aboutsummaryrefslogtreecommitdiff
path: root/client-web
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2022-09-09 15:35:48 +0200
committermetamuffin <metamuffin@disroot.org>2022-09-09 15:35:48 +0200
commit8aaf7e201e58ec9ecb431a6ac05e07d0078b12b0 (patch)
tree190a24165b6d15d750ca8f9d998f8bfd74b65f05 /client-web
parent8e4242a02e2558d5a33b570d573774a4fb2c8278 (diff)
downloadkeks-meet-8aaf7e201e58ec9ecb431a6ac05e07d0078b12b0.tar
keks-meet-8aaf7e201e58ec9ecb431a6ac05e07d0078b12b0.tar.bz2
keks-meet-8aaf7e201e58ec9ecb431a6ac05e07d0078b12b0.tar.zst
pref format changed
Diffstat (limited to 'client-web')
-rw-r--r--client-web/source/index.ts4
-rw-r--r--client-web/source/preferences.ts12
2 files changed, 8 insertions, 8 deletions
diff --git a/client-web/source/index.ts b/client-web/source/index.ts
index 0249d4d..c15ec38 100644
--- a/client-web/source/index.ts
+++ b/client-web/source/index.ts
@@ -3,7 +3,7 @@
import { ediv } from "./helper.ts";
import { log } from "./logger.ts"
import { create_menu } from "./menu.ts";
-import { PREFS } from "./preferences.ts";
+import { get_param, load_params, PREFS } from "./preferences.ts";
import { SignalingConnection } from "./protocol/mod.ts";
import { Room } from "./room.ts"
@@ -27,7 +27,7 @@ window.onload = () => main()
export async function main() {
log("*", "starting up")
document.body.querySelectorAll("p").forEach(e => e.remove())
- const room_name = window.location.hash.substring(1)
+ const room_name = load_params().rname
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'")
diff --git a/client-web/source/preferences.ts b/client-web/source/preferences.ts
index c25cece..b47956b 100644
--- a/client-web/source/preferences.ts
+++ b/client-web/source/preferences.ts
@@ -25,17 +25,17 @@ export function register_prefs<T extends Record<string, PrefDecl<unknown>>>(ds:
return p
}
-const raw_params = load_query_params();
-export function load_query_params(): { [key: string]: string } {
- const q: { [key: string]: string } = {}
- const params = window.location.hash.substring(1).split("?")[1]
- if (!params) return {}
+const raw_params = load_params().p;
+export function load_params(): { p: { [key: string]: string }, rname: string } {
+ const q: Record<string, string> = {}
+ const [rname, params] = window.location.hash.substring(1).split("?")
+ if (!params) return { rname, p: {} }
for (const kv of params.split("&")) {
const [key, value] = kv.split("=")
if (key == "prototype") continue
q[decodeURIComponent(key)] = decodeURIComponent(value)
}
- return q
+ return { p: q, rname }
}
export function get_param<T>(ty: string, key: string): T | undefined {