Created
September 9, 2024 08:52
-
-
Save vinhjaxt/cc2043f5425dff5dc860b741d6a7b9da to your computer and use it in GitHub Desktop.
Cloudflare Turnstile Captcha
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Captcha</title> | |
<style> | |
html, | |
body { | |
padding: 0; | |
margin: 0; | |
} | |
</style> | |
</head> | |
<body> | |
<div id="cf-turnstile-el" class="cf-turnstile"></div> | |
<script src="https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit&onload=onloadTurnstileCallback" | |
defer></script> | |
<script> | |
const cfTurnStileSiteKey = '0x4AAAAAAAi0u5-vlDWayczz' | |
window.onloadTurnstileCallback = function () { | |
// Reset: turnstile.reset(window.turnstileCurrentWidget) | |
window.turnstileCurrentWidget = turnstile.render('#cf-turnstile-el', { | |
sitekey: cfTurnStileSiteKey, | |
callback: function (token) { | |
console.log(`Captcha Challenge Success:`, token); | |
if (window.flutter_inappwebview) { | |
window.flutter_inappwebview.callHandler('GotCaptchaToken', token).then(function (r) { | |
console.log('Result:', r); | |
}); | |
} else if (typeof WebviewCaptcha != 'undefined') { | |
WebviewCaptcha.postMessage(token); | |
} | |
}, | |
}); | |
}; | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment