mirror of
https://github.com/wukko/cobalt.git
synced 2025-06-12 13:17:45 +02:00
web: load turnstile only in save tab and only once
turnstile will stay in background after being loaded once (just like before), but now it will not load on pages other than save if they are opened first
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
import env from "$lib/env";
|
||||
import { onMount } from "svelte";
|
||||
|
||||
import { turnstileLoaded } from "$lib/state/turnstile";
|
||||
import { turnstileLoaded, turnstileCreated } from "$lib/state/turnstile";
|
||||
|
||||
let turnstileElement: HTMLElement;
|
||||
let turnstileScript: HTMLElement;
|
||||
@ -10,6 +10,9 @@
|
||||
onMount(() => {
|
||||
const sitekey = env.TURNSTILE_KEY;
|
||||
if (!sitekey) return;
|
||||
|
||||
$turnstileCreated = true;
|
||||
|
||||
const setup = () => {
|
||||
window.turnstile?.render(turnstileElement, {
|
||||
sitekey,
|
||||
|
Reference in New Issue
Block a user