Skip to content

Commit

Permalink
web/server-info: reload the page if turnstile sitekey changes
Browse files Browse the repository at this point in the history
  • Loading branch information
wukko committed Sep 23, 2024
1 parent f8a6b53 commit 416a9ef
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions web/src/lib/api/server-info.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { browser } from "$app/environment";

import { get, writable } from "svelte/store";
import { currentApiURL } from "$lib/api/api-url";

Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 416a9ef

Please sign in to comment.