From e03052b00e43feccc1b99d9a769ecb9bd4db6eb4 Mon Sep 17 00:00:00 2001 From: Nathaniel Tampus Date: Wed, 22 Mar 2023 14:57:40 +0800 Subject: [PATCH 1/2] fix join game from url --- client/src/components/home/JoinGame.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/components/home/JoinGame.tsx b/client/src/components/home/JoinGame.tsx index c212a89..eb8e72a 100644 --- a/client/src/components/home/JoinGame.tsx +++ b/client/src/components/home/JoinGame.tsx @@ -25,7 +25,7 @@ export default function JoinGame() { setButtonLoading(true); if (code.startsWith("http") || code.startsWith("ches.su")) { - code = new URL(code).pathname.split("/")[2]; + code = new URL(code).pathname.split("/")[1]; } const game = await getGame(code); From 3a059d8874bf2463dab48bfe0bb08c36ef7a1b1f Mon Sep 17 00:00:00 2001 From: Nathaniel Tampus Date: Wed, 22 Mar 2023 15:40:10 +0800 Subject: [PATCH 2/2] fix for joining links with no http/https --- client/src/components/home/JoinGame.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/src/components/home/JoinGame.tsx b/client/src/components/home/JoinGame.tsx index eb8e72a..77090ad 100644 --- a/client/src/components/home/JoinGame.tsx +++ b/client/src/components/home/JoinGame.tsx @@ -24,7 +24,10 @@ export default function JoinGame() { setButtonLoading(true); - if (code.startsWith("http") || code.startsWith("ches.su")) { + if (code.startsWith("ches.su")) { + code = "http://" + code; + } + if (code.startsWith("http")) { code = new URL(code).pathname.split("/")[1]; }