From 416a9efdd105ccbdf7b9e0348f26d30c6ba6313b Mon Sep 17 00:00:00 2001 From: wukko Date: Mon, 23 Sep 2024 16:16:17 +0600 Subject: [PATCH] web/server-info: reload the page if turnstile sitekey changes --- web/src/lib/api/server-info.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/web/src/lib/api/server-info.ts b/web/src/lib/api/server-info.ts index 51a3a90a..8a3e1b60 100644 --- a/web/src/lib/api/server-info.ts +++ b/web/src/lib/api/server-info.ts @@ -1,3 +1,5 @@ +import { browser } from "$app/environment"; + import { get, writable } from "svelte/store"; import { currentApiURL } from "$lib/api/api-url"; @@ -50,6 +52,17 @@ export const getServerInfo = async () => { info: freshInfo, origin: currentApiURL(), }); + + /* + reload the page if turnstile sitekey changed. + there's no other proper way to do this, at least i couldn't find any :( + */ + if (cache?.info?.cobalt?.turnstileSitekey && freshInfo?.cobalt?.turnstileSitekey) { + if (browser) { + window.location.reload(); + } + } + return true; }