diff options
author | metamuffin <metamuffin@disroot.org> | 2023-01-17 22:28:35 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2023-01-17 22:28:35 +0100 |
commit | f85d40d8c6cc2f3b58d1e0ea7f0382db88fffd4e (patch) | |
tree | 29aa31d00ff246d3ab662e5350a4ae9563ac279a /server | |
parent | 6c8025c6dec52a26103186848510d72936f15603 (diff) | |
download | keks-meet-f85d40d8c6cc2f3b58d1e0ea7f0382db88fffd4e.tar keks-meet-f85d40d8c6cc2f3b58d1e0ea7f0382db88fffd4e.tar.bz2 keks-meet-f85d40d8c6cc2f3b58d1e0ea7f0382db88fffd4e.tar.zst |
refer to room name as secret instead
Diffstat (limited to 'server')
-rw-r--r-- | server/src/main.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/server/src/main.rs b/server/src/main.rs index d958d66..85f1854 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -44,11 +44,11 @@ async fn run() { let assets: _ = warp::path("assets").and(warp::fs::dir("../client-web/public/assets")); let sw_script: _ = warp::path("sw.js").and(warp::fs::file("../client-web/public/assets/sw.js")); let favicon: _ = warp::path!("favicon.ico").map(|| ""); - let old_format_redirect: _ = warp::path!("room" / String).map(|rname| { + let old_format_redirect: _ = warp::path!("room" / String).map(|rsecret| { reply::with_header( StatusCode::MOVED_PERMANENTLY, header::LOCATION, - format!("/room#{rname}?warn_redirect=true"), + format!("/room#{rsecret}?warn_redirect=true"), ) .into_response() }); @@ -106,20 +106,20 @@ async fn handle_rejection(err: Rejection) -> Result<impl Reply, Infallible> { Ok(warp::reply::with_status(json, code)) } -fn signaling_connect(rname: String, rooms: Rooms, ws: warp::ws::Ws) -> impl Reply { - async fn inner(sock: WebSocket, rname: String, rooms: Rooms) { +fn signaling_connect(rsecret: String, rooms: Rooms, ws: warp::ws::Ws) -> impl Reply { + async fn inner(sock: WebSocket, rsecret: String, rooms: Rooms) { debug!("ws upgrade"); let mut guard = rooms.write().await; let room = guard - .entry(rname.clone()) + .entry(rsecret.clone()) .or_insert_with(|| Default::default()) .to_owned(); drop(guard); room.client_connect(sock).await; if room.should_remove().await { - rooms.write().await.remove(&rname); + rooms.write().await.remove(&rsecret); } } - ws.on_upgrade(move |sock| inner(sock, rname, rooms)) + ws.on_upgrade(move |sock| inner(sock, rsecret, rooms)) } |