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 (
<div
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",
"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">
<h2 className="text-type-emphasis font-bold text-xl mb-6">
{t("player.turnstile.title")}
</h2>
<p className="text-type-emphasis mb-6">
<p className="text-type-emphasis">
{t("player.turnstile.description")}
</p>
</div>

View File

@ -90,12 +90,21 @@ 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,
});
}
}
});
await Promise.all(workerPromises);

View File

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