web: use turnstile & session only when the processing instance has them
now also always fetching server info in the save tab
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
<script lang="ts">
|
||||
import env from "$lib/env";
|
||||
import { onMount } from "svelte";
|
||||
|
||||
import { cachedInfo } from "$lib/api/server-info";
|
||||
import { turnstileLoaded, turnstileCreated } from "$lib/state/turnstile";
|
||||
|
||||
let turnstileElement: HTMLElement;
|
||||
let turnstileScript: HTMLElement;
|
||||
|
||||
onMount(() => {
|
||||
const sitekey = env.TURNSTILE_KEY;
|
||||
const sitekey = $cachedInfo?.info?.cobalt?.turnstileSitekey;
|
||||
if (!sitekey) return;
|
||||
|
||||
$turnstileCreated = true;
|
||||
@@ -17,7 +17,7 @@
|
||||
window.turnstile?.render(turnstileElement, {
|
||||
sitekey,
|
||||
"error-callback": (error) => {
|
||||
console.log("turnstile error code:", error);
|
||||
console.log("error code from turnstile:", error);
|
||||
return true;
|
||||
},
|
||||
callback: () => {
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
import { browser } from "$app/environment";
|
||||
import { SvelteComponent, tick } from "svelte";
|
||||
|
||||
import env from "$lib/env";
|
||||
import { t } from "$lib/i18n/translations";
|
||||
|
||||
import dialogs from "$lib/dialogs";
|
||||
|
||||
import { link } from "$lib/state/omnibox";
|
||||
import { cachedInfo } from "$lib/api/server-info";
|
||||
import { updateSetting } from "$lib/state/settings";
|
||||
import { turnstileLoaded } from "$lib/state/turnstile";
|
||||
|
||||
@@ -57,7 +57,9 @@
|
||||
goto("/", { replaceState: true });
|
||||
}
|
||||
|
||||
$: if (env.TURNSTILE_KEY) {
|
||||
// FIXME: figure out why regular processing spinner
|
||||
// doesn't show up after turnstile loads
|
||||
$: if ($cachedInfo?.info?.cobalt?.turnstileSitekey) {
|
||||
if ($turnstileLoaded) {
|
||||
isDisabled = false;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user