Update relay config info; use http3 in nginx

This commit is contained in:
Tony Klink 2024-01-15 21:38:01 -06:00
parent 5137ffa34f
commit 5b2726e66d
Signed by: klink
GPG key ID: 85175567C4D19231
3 changed files with 10 additions and 3 deletions

View file

@ -95,6 +95,8 @@ in {
addSSL = mkIf cfg.sslEnable true;
enableACME = mkIf cfg.sslEnable true;
http3 = true;
locations."/" = {
proxyPass = "http://${cfg.localAddress}:8080";
proxyWebsockets = true; # needed if you need to use WebSocket

View file

@ -16,9 +16,11 @@ pub async fn relay_config(header: String) -> Result<impl Reply, Rejection> {
Err(warp::reject::not_found())
} else {
let res = serde_json::json!({
"name": "Zhitno.st",
"contact": "klink@zhitno.st",
"name": "zhitno.st",
"description": "Very *special* nostr relay",
"software": "sneedstr",
"supported_nips": [ 1, 9, 11, 12, 15, 16, 20, 22, 28, 33 ],
"software": "git+https://git.zhitno.st/Klink/sneedstr.git",
"version": "0.1.0"
});
Ok(warp::reply::json(&res))

View file

@ -13,14 +13,17 @@ fn index(context: Context) -> impl Filter<Extract = impl Reply, Error = Rejectio
// let real_client_ip = warp::header::optional::<std::net::SocketAddr>("X-Real-IP");
let real_client_ip = warp::addr::remote();
let accept_application_json_header = warp::header::header("Accept");
let cors = warp::cors().allow_any_origin();
warp::path::end().and(
accept_application_json_header
.and_then(handler::relay_config)
.with(&cors)
.or(warp::ws()
.and(with_context(context))
.and(real_client_ip)
.and_then(handler::ws_handler)),
.and_then(handler::ws_handler)
.with(&cors)),
)
}