diff options
Diffstat (limited to 'src/routes/(static)/support')
| -rw-r--r-- | src/routes/(static)/support/+page.svelte | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/routes/(static)/support/+page.svelte b/src/routes/(static)/support/+page.svelte index 620ed018..4cf9706d 100644 --- a/src/routes/(static)/support/+page.svelte +++ b/src/routes/(static)/support/+page.svelte @@ -1,7 +1,7 @@ <script> import { PUBLIC_RECAPTCHA_SITE_KEY } from "$env/static/public"; import { browser } from "$app/environment"; - import { onDestroy } from "svelte"; + import { onDestroy, onMount } from "svelte"; import { fail, success, post } from "$lib/utils"; import { scale } from "svelte/transition"; import Icon from "$comp/Icon.svelte"; @@ -15,7 +15,15 @@ let message = $state(); let sent = $state(); let recaptchaSiteKey = PUBLIC_RECAPTCHA_SITE_KEY; - let isTor = $derived(browser && location.hostname.endsWith(".onion")); + let isTor = browser && location.hostname.endsWith(".onion"); + + onMount(() => { + if (!isTor && recaptchaSiteKey) { + let s = document.createElement("script"); + s.src = "https://www.google.com/recaptcha/api.js?render=" + recaptchaSiteKey; + document.head.appendChild(s); + } + }); let submit = (e) => { e.preventDefault(); @@ -62,14 +70,6 @@ }); </script> -{#if !isTor} -<svelte:head - ><script - src={"https://www.google.com/recaptcha/api.js?render=" + recaptchaSiteKey} - ></script></svelte:head -> -{/if} - <div class="container max-w-lg mx-auto space-y-8 p-4 pb-20"> {#if sent} <h1 class="text-center text-3xl lg:text-4xl font-semibold">Thank you!</h1> |
