diff options
-rw-r--r-- | client-native-gui/src/main.rs | 4 | ||||
-rw-r--r-- | client-web/public/start.html | 4 | ||||
-rw-r--r-- | client-web/source/index.ts | 10 | ||||
-rw-r--r-- | client-web/source/preferences/mod.ts | 10 | ||||
-rw-r--r-- | server/src/main.rs | 14 |
5 files changed, 21 insertions, 21 deletions
diff --git a/client-native-gui/src/main.rs b/client-native-gui/src/main.rs index ab6387d..83de3a0 100644 --- a/client-native-gui/src/main.rs +++ b/client-native-gui/src/main.rs @@ -43,7 +43,7 @@ use tokio::task::JoinHandle; /// A graphical interface to keks-meet conferences struct Args { #[arg(short = 'R', long, default_value = "")] - default_room_name: String, + default_room_secret: String, #[arg(short = 'U', long, default_value = "alice")] default_username: String, } @@ -113,7 +113,7 @@ enum GuiResourceState { impl App { pub fn new(args: Args) -> Self { - Self::Prejoin(args.default_room_name, args.default_username) + Self::Prejoin(args.default_room_secret, args.default_username) } } diff --git a/client-web/public/start.html b/client-web/public/start.html index aa60f35..afe771e 100644 --- a/client-web/public/start.html +++ b/client-web/public/start.html @@ -16,7 +16,7 @@ </p> <p> To get started, click 'Join' and share the URL with your - partner. You can also optionally customize the url by entering a + partner. You can also optionally customize the URL by entering a <b>secure/unguessable(!!!)</b> identifier below. </p> <noscript> @@ -28,7 +28,7 @@ const room_input = document.createElement("input"); room_input.type = "text"; room_input.id = "room-id-input"; - room_input.placeholder = "Room ID"; + room_input.placeholder = "Room Secret"; const submit = document.createElement("input"); submit.type = "button"; diff --git a/client-web/source/index.ts b/client-web/source/index.ts index d2bd276..bc52f8b 100644 --- a/client-web/source/index.ts +++ b/client-web/source/index.ts @@ -52,17 +52,17 @@ let r: Room; export async function main() { log("*", "starting up") document.body.querySelectorAll("p").forEach(e => e.remove()) - const room_name = load_params().rname + const room_secret = load_params().rsecret if (!globalThis.RTCPeerConnection) return log({ scope: "webrtc", error: true }, "WebRTC not supported.") if (!globalThis.isSecureContext) log({ scope: "*", warn: true }, "This page is not in a 'Secure Context'") if (!globalThis.crypto.subtle) return log({ scope: "crypto", error: true }, "SubtleCrypto not availible") if (!globalThis.navigator.serviceWorker) log({ scope: "*", warn: true }, "Your browser does not support the Service Worker API, some features dont work without it.") - if (room_name.length < 8) log({ scope: "crypto", warn: true }, "Room name is very short. e2ee is insecure!") - if (room_name.length == 0) return window.location.href = "/" // send them back to the start page - if (PREFS.warn_redirect) log({ scope: "crypto", warn: true }, "You were redirected from the old URL format. The server knows the room name now - e2ee is insecure!") + if (room_secret.length < 8) log({ scope: "crypto", warn: true }, "Room name is very short. e2ee is insecure!") + if (room_secret.length == 0) return window.location.href = "/" // send them back to the start page + if (PREFS.warn_redirect) log({ scope: "crypto", warn: true }, "You were redirected from the old URL format. The server knows the room secret now - e2ee is insecure!") - const conn = await (new SignalingConnection().connect(room_name)) + const conn = await (new SignalingConnection().connect(room_secret)) r = new Room(conn) setup_keybinds(r) diff --git a/client-web/source/preferences/mod.ts b/client-web/source/preferences/mod.ts index 5de73eb..04fae2c 100644 --- a/client-web/source/preferences/mod.ts +++ b/client-web/source/preferences/mod.ts @@ -85,19 +85,19 @@ export function generate_section(): string { PREFS_EXPLICIT[key as unknown as keyof typeof PREFS_EXPLICIT] ))) } - return load_params().rname + "?" + section.join("&") + return load_params().rsecret + "?" + section.join("&") } -export function load_params(): { raw_params: { [key: string]: string }, rname: string } { +export function load_params(): { raw_params: { [key: string]: string }, rsecret: string } { const raw_params: Record<string, string> = {} - const [rname, param_str] = window.location.hash.substring(1).split("?") - if (!param_str) return { rname, raw_params: {} } + const [rsecret, param_str] = window.location.hash.substring(1).split("?") + if (!param_str) return { rsecret, raw_params: {} } for (const kv of param_str.split("&")) { const [key, value] = kv.split("=") if (key == "prototype") continue raw_params[decodeURIComponent(key)] = decodeURIComponent(value) } - return { raw_params, rname } + return { raw_params, rsecret } } function get_param<T>(ty: string, key: string): T | undefined { 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)) } |