diff options
author | metamuffin <metamuffin@disroot.org> | 2022-10-09 18:59:23 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2022-10-09 18:59:23 +0200 |
commit | c8ac1b899f7a79898b3ec84157db642051e8e1ae (patch) | |
tree | 059941b972c8ac8ee00640769edce59352ba2577 /client-web/source/index.ts | |
parent | 75683cf2ce3b13f5ddf9c3fca3060ff6d5b78043 (diff) | |
download | keks-meet-c8ac1b899f7a79898b3ec84157db642051e8e1ae.tar keks-meet-c8ac1b899f7a79898b3ec84157db642051e8e1ae.tar.bz2 keks-meet-c8ac1b899f7a79898b3ec84157db642051e8e1ae.tar.zst |
onbeforeunload
Diffstat (limited to 'client-web/source/index.ts')
-rw-r--r-- | client-web/source/index.ts | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/client-web/source/index.ts b/client-web/source/index.ts index be44c57..c16fa23 100644 --- a/client-web/source/index.ts +++ b/client-web/source/index.ts @@ -40,7 +40,14 @@ window.onhashchange = () => { // TODO might just destroy room object and create a new one, but cleanup probably wont work. lets reload instead window.location.reload() } +window.onbeforeunload = ev => { + if (r.local_user.resources.size != 0 && PREFS.enable_onbeforeunload) { + ev.preventDefault() + return ev.returnValue = "You have local resources shared. Really quit?" + } +} +let r: Room; export async function main() { log("*", "starting up") document.body.querySelectorAll("p").forEach(e => e.remove()) @@ -54,7 +61,7 @@ export async function main() { 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!") const conn = await (new SignalingConnection().connect(room_name)) - const r = new Room(conn) + r = new Room(conn) setup_keybinds(r) r.on_ready = () => { |