Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make horrid webview captcha route
  • Loading branch information
regalijan committed Oct 19, 2023
1 parent ebc0b5e commit 036f532
Showing 1 changed file with 34 additions and 5 deletions.
39 changes: 34 additions & 5 deletions app/routes/captcha.tsx
@@ -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 (
<script
async
defer
src="https://challenges.cloudflare.com/turnstile/v0/api.js"
></script>
<>
<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>
</>
);
}

0 comments on commit 036f532

Please sign in to comment.