From b05f8ea5d0b0356bab40e25a702ed6646b8783df Mon Sep 17 00:00:00 2001 From: VariableVince <24507472+VariableVince@users.noreply.github.com> Date: Wed, 6 May 2026 19:18:32 +0200 Subject: [PATCH] Explain ways to fix turnstile token invalid/rejected, instead of only displaying raw error to user --- src/server/Worker.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/server/Worker.ts b/src/server/Worker.ts index 13cf1f32c..b3a46d80a 100644 --- a/src/server/Worker.ts +++ b/src/server/Worker.ts @@ -330,7 +330,10 @@ export async function startWorker() { log.warn(`Invalid token: ${result.message}`, { gameID: clientMsg.gameID, }); - ws.close(1002, `Unauthorized: invalid token`); + ws.close( + 1002, + "Unauthorized: invalid token \n\n Try this to fix: \n 1. Do a hard refresh (Mac: Cmd+Shift+R, Windows: Ctrl+F5) \n 2. Or resync your device clock \n 3. Or close all browser windows and restart your browser \n 4. Or try another browser, preferably without extensions \n 5. Or clear site data for this site", + ); return; } const { persistentId, claims } = result; @@ -443,7 +446,10 @@ export async function startWorker() { gameID: clientMsg.gameID, reason: turnstileResult.reason, }); - ws.close(1002, "Unauthorized: Turnstile token rejected"); + ws.close( + 1002, + "Unauthorized: Turnstile token rejected \n\n Try this to fix: \n 1. Do a hard refresh (Mac: Cmd+Shift+R, Windows: Ctrl+F5) \n 2. Or resync your device clock \n 3. Or close all browser windows and restart your browser \n 4. Or try another browser, preferably without extensions \n 5. Or clear site data for this site", + ); return; case "error": // Fail open, allow the client to join.