fix(NIP-11): Add CORS header and content type for main page
This commit is contained in:
+7
-3
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
//! Server process
|
//! Server process
|
||||||
use futures::SinkExt;
|
use futures::SinkExt;
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
@@ -134,14 +135,17 @@ async fn handle_web_request(
|
|||||||
return Ok(Response::builder()
|
return Ok(Response::builder()
|
||||||
.status(200)
|
.status(200)
|
||||||
.header("Content-Type", "application/nostr+json")
|
.header("Content-Type", "application/nostr+json")
|
||||||
|
.header("Access-Control-Allow-Origin", "*")
|
||||||
.body(b)
|
.body(b)
|
||||||
.unwrap());
|
.unwrap());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(Response::new(Body::from(
|
Ok(Response::builder()
|
||||||
"Please use a Nostr client to connect.",
|
.status(200)
|
||||||
)))
|
.header("Content-Type", "text/plain")
|
||||||
|
.body(Body::from("Please use a Nostr client to connect.")).unwrap()
|
||||||
|
)
|
||||||
}
|
}
|
||||||
(_, _) => {
|
(_, _) => {
|
||||||
//handle any other url
|
//handle any other url
|
||||||
|
|||||||
Reference in New Issue
Block a user