From 9cd20ed1dacf8c7ea8791c43dfe0ea8f6fc9815c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Tue, 8 Aug 2023 14:04:35 +0200 Subject: [PATCH] Delete hash once loaded MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/room/GroupCallView.tsx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/room/GroupCallView.tsx b/src/room/GroupCallView.tsx index 45bcac3b..0726d818 100644 --- a/src/room/GroupCallView.tsx +++ b/src/room/GroupCallView.tsx @@ -257,14 +257,13 @@ export function GroupCallView({ useEffect(() => { const originalHash = location.hash; - let hash = originalHash === "" ? "#" : originalHash; - hash = hash.split("?password=")[0]; - hash += `?password=${e2eeSharedKey ?? ""}`; + const hash = originalHash === "" ? "#" : originalHash; + const [hashStart, password] = hash.split("?password="); - if (originalHash !== hash) { - location.replace(hash); - } - }, [e2eeSharedKey]); + if (password !== e2eeSharedKey) return; + + location.replace(hashStart); + }, [password, e2eeSharedKey]); const e2eeConfig = useMemo( () => (e2eeSharedKey ? { sharedKey: e2eeSharedKey } : undefined),