web/server-info: reload the page if turnstile sitekey changes

This commit is contained in:
wukko 2024-09-23 16:16:17 +06:00
parent f8a6b533be
commit 416a9efdd1
No known key found for this signature in database
GPG key ID: 3E30B3F26C7B4AA2

View file

@ -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;
}