Turnstile works!

This commit is contained in:
Captain Jack Sparrow 2024-06-02 22:32:35 +00:00
parent 95a5e1a932
commit c16e66f2a3
3 changed files with 18 additions and 9 deletions

View file

@ -25,17 +25,16 @@ function TurnstileInteractive() {
return ( return (
<div <div
className={classNames( className={classNames(
"absolute w-10/12 max-w-[800px] max-h-[325px] p-20 rounded-lg select-none z-50 top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 transform", "absolute w-10/12 max-w-[43em] p-10 rounded-lg bg-dropdown-altBackground select-none z-50 top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 transform",
show ? "" : "hidden", show ? "" : "hidden",
"bg-[#222222]",
)} )}
> >
<div className="w-full grid lg:grid-cols-[1fr,auto] gap-8 items-center"> <div className="w-full grid lg:grid-cols-[1fr,auto] gap-5 items-center">
<div className="text-left"> <div className="text-left">
<h2 className="text-type-emphasis font-bold text-xl mb-6"> <h2 className="text-type-emphasis font-bold text-xl mb-6">
{t("player.turnstile.title")} {t("player.turnstile.title")}
</h2> </h2>
<p className="text-type-emphasis mb-6"> <p className="text-type-emphasis">
{t("player.turnstile.description")} {t("player.turnstile.description")}
</p> </p>
</div> </div>

View file

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

View file

@ -111,6 +111,7 @@ export function TurnstileProvider(props: {
> >
<Turnstile <Turnstile
sitekey={siteKey} sitekey={siteKey}
theme={"light"}
onLoad={(widgetId, bound) => { onLoad={(widgetId, bound) => {
idRef.current = widgetId; idRef.current = widgetId;
setTurnstile(widgetId, bound, !!props.isInPopout); setTurnstile(widgetId, bound, !!props.isInPopout);