From 1c241869c80528213e7a335f96765f25d8c12165 Mon Sep 17 00:00:00 2001 From: Gautam Anand Date: Sat, 11 Jan 2025 16:40:12 -0600 Subject: [PATCH] New join code system --- components/home.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/components/home.js b/components/home.js index d81b8e2..a63f24e 100644 --- a/components/home.js +++ b/components/home.js @@ -1047,11 +1047,20 @@ setShowCountryButtons(false) }, [screen, inCrazyGames]) useEffect(() => { + + if(window.location.search.includes("code=")) { + try { + window.localStorage.setItem("joinCode", window.location.search.split("code=")[1].split("&")[0]) + window.location.href = "/" + } catch(e) {} + return; + } + if(multiplayerState?.connected) { // check if joined via invite link try { - let code = inCrazyGames ? window.CrazyGames.SDK.game.getInviteParam("code") : window.location.search.includes("code=") ? window.location.search.split("code=")[1].split("&")[0] : null; + let code = inCrazyGames ? window.CrazyGames.SDK.game.getInviteParam("code") : window.localStorage.getItem("joinCode"); let instantJoin = window.location.search.includes("instantJoin");