Fix turnstiles mostly!

This commit is contained in:
Captain Jack Sparrow 2024-06-05 01:57:25 +00:00
parent 02a3fbc879
commit 94246484b0
2 changed files with 6 additions and 19 deletions

View File

@ -90,21 +90,11 @@ export function WorkerTestPart() {
} catch (err) {
const error = err as Error;
error.message = error.message.replace(worker.url, "WORKER_URL");
if (
error.message ===
'[Cloudflare Turnstile] Invalid or missing type for parameter "sitekey", expected "string", got "object".'
) {
updateWorker(worker.id, {
id: worker.id,
status: "success",
});
} else {
updateWorker(worker.id, {
id: worker.id,
status: "error",
error,
});
}
updateWorker(worker.id, {
id: worker.id,
status: "error",
error,
});
}
});

View File

@ -81,9 +81,6 @@ export async function getTurnstileToken() {
const turnstile = getTurnstile();
try {
// I hate turnstile
if (turnstile.controls.isExpired()) {
turnstile.controls.reset();
}
(window as any).turnstile.execute(
document.querySelector(`#${turnstile.id}`),
{},
@ -101,7 +98,7 @@ export function TurnstileProvider(props: {
isInPopout?: boolean;
onUpdateShow?: (show: boolean) => void;
}) {
const siteKey = conf().TURNSTILE_KEY?.toString();
const siteKey = conf().TURNSTILE_KEY;
const idRef = useRef<string | null>(null);
const setTurnstile = useTurnstileStore((s) => s.setTurnstile);
const processToken = useTurnstileStore((s) => s.processToken);