Skip to content
Permalink
71381e937b
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
31 lines (29 sloc) 880 Bytes
export async function onRequestGet(context: RequestContext) {
return new Response(
`<!DOCTYPE html>
<html lang="en">
<head>
<title>WebView Captcha</title>
<script async defer src="https://challenges.cloudflare.com/turnstile/v0/api.js"></script>
</head>
<body>
<div class="cf-turnstile" data-callback="returnToken" data-error-callback="handleError" data-sitekey="${context.env.TURNSTILE_SITEKEY}" style="width: 90%; translate(5%);"></div>
<script>
function handleError(error) {
console.error(error);
onToken.postMessage(null);
return true;
}
function returnToken(token) {
onToken.postMessage(token);
}
</script>
</body>
</html>`,
{
headers: {
"content-type": "text/html",
},
},
);
}