mirror of
https://github.com/Yonle/bostr.git
synced 2025-11-20 10:56:25 +01:00
Make NIP-11 work by adding Access-Control-Allow-Origin
Signed-off-by: Yonle <yonle@lecturify.net>
This commit is contained in:
5
http.js
5
http.js
@@ -15,9 +15,10 @@ const wss = new WebSocket.WebSocketServer({ noServer: true });
|
|||||||
server.on('request', (req, res) => {
|
server.on('request', (req, res) => {
|
||||||
log(`${req.headers["x-forwarded-for"]?.split(",")[0] || req.socket.address()?.address} - ${req.method} ${req.url}`)
|
log(`${req.headers["x-forwarded-for"]?.split(",")[0] || req.socket.address()?.address} - ${req.method} ${req.url}`)
|
||||||
|
|
||||||
if (req.headers.accept?.includes("nostr"))
|
if (req.headers.accept?.includes("application/nostr+json"))
|
||||||
return res.writeHead(200, {
|
return res.writeHead(200, {
|
||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json",
|
||||||
|
"Access-Control-Allow-Origin": "*"
|
||||||
}).end(JSON.stringify(config.server_meta));
|
}).end(JSON.stringify(config.server_meta));
|
||||||
|
|
||||||
if (req.url === "/") {
|
if (req.url === "/") {
|
||||||
|
|||||||
Reference in New Issue
Block a user