Make horrid webview captcha route

This commit is contained in:
regalijan 2023-10-19 16:51:11 -04:00
parent ebc0b5e81f
commit 036f532f31
Signed by: regalijan
GPG Key ID: 5D4196DA269EF520

View File

@ -1,9 +1,38 @@
import { useLoaderData } from "@remix-run/react";
export async function loader({
context,
}: {
context: RequestContext;
}): Promise<string> {
return context.env.TURNSTILE_SITEKEY;
}
export default function () {
return (
<>
<div
className="cf-turnstile"
data-callback="returnToken"
data-error-callback="handleError"
data-sitekey={useLoaderData<typeof loader>()}
></div>
<script>
{`
function returnToken(token) {
window.flutter_inappwebview.callHandler("onToken", token);
}
function handleError(_error) {
window.flutter_inappwebview.callHandler("onToken", null);
}
`}
</script>
<script
async
defer
src="https://challenges.cloudflare.com/turnstile/v0/api.js"
></script>
</>
);
}