summaryrefslogtreecommitdiff
path: root/client-web/source/index.ts
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2022-09-09 14:43:19 +0200
committermetamuffin <metamuffin@disroot.org>2022-09-09 14:43:19 +0200
commit32373fd18a05663c3bb7d9b1d9fa0a21d909c784 (patch)
tree8a165f64f09d5fb40c80bc80951ab4e615021cde /client-web/source/index.ts
parentd101fb7f77822aac2a3d42ca1529028405cfad0d (diff)
downloadkeks-meet-32373fd18a05663c3bb7d9b1d9fa0a21d909c784.tar
keks-meet-32373fd18a05663c3bb7d9b1d9fa0a21d909c784.tar.bz2
keks-meet-32373fd18a05663c3bb7d9b1d9fa0a21d909c784.tar.zst
redirect
Diffstat (limited to 'client-web/source/index.ts')
-rw-r--r--client-web/source/index.ts10
1 files changed, 9 insertions, 1 deletions
diff --git a/client-web/source/index.ts b/client-web/source/index.ts
index 502ab98..0249d4d 100644
--- a/client-web/source/index.ts
+++ b/client-web/source/index.ts
@@ -3,6 +3,7 @@
import { ediv } from "./helper.ts";
import { log } from "./logger.ts"
import { create_menu } from "./menu.ts";
+import { PREFS } from "./preferences.ts";
import { SignalingConnection } from "./protocol/mod.ts";
import { Room } from "./room.ts"
@@ -24,10 +25,17 @@ export interface User {
window.onload = () => main()
export async function main() {
- document.body.querySelectorAll("p").forEach(e => e.remove())
log("*", "starting up")
+ document.body.querySelectorAll("p").forEach(e => e.remove())
const room_name = window.location.hash.substring(1)
+
+ 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 (room_name.length < 8) log({ scope: "crypto", warn: true }, "Room name is very short. e2ee is insecure!")
if (room_name.length == 0) 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 you room name now - e2ee is insecure!")
+
const conn = await (new SignalingConnection().connect(room_name))
new Room(conn)
create_menu()