revert to turnstile

This commit is contained in:
localhost 2026-02-22 20:29:43 +01:00
parent a681a87314
commit 6d1415d246
2 changed files with 8 additions and 9 deletions

View File

@ -35,7 +35,7 @@
</h3> </h3>
</div> </div>
<script src="https://js.hcaptcha.com/1/api.js" async defer></script> <script src="https://challenges.cloudflare.com/turnstile/v0/api.js" async defer></script>
<script> <script>
const url = "<%= it.url %>" const url = "<%= it.url %>"
const websocket = "<%= it.websocket %>" const websocket = "<%= it.websocket %>"
@ -63,7 +63,7 @@
return return
} else if (msg.data.startsWith('CAPTCHA -')) { } else if (msg.data.startsWith('CAPTCHA -')) {
captcha.style.display = 'block' captcha.style.display = 'block'
hcaptcha.render(captcha, { turnstile.render('#captcha', {
sitekey: sitekey, sitekey: sitekey,
callback: function(token) { callback: function(token) {
captcha.remove() captcha.remove()

View File

@ -36,17 +36,16 @@ function convertRelativeToDate(relativeTime: string) {
return currentDate; return currentDate;
} }
async function checkCaptcha(response: string, remoteIp: string): any { async function checkCaptcha(response: string, remoteIp: string): Promise<any> {
const confirm = await (await fetch('https://api.hcaptcha.com/siteverify', { const confirm = await (await fetch('https://challenges.cloudflare.com/turnstile/v0/siteverify', {
method: 'POST', method: 'POST',
body: new URLSearchParams({ body: JSON.stringify({
'response': response, 'response': response,
'secret': process.env.CAPTCHA_SECRET!, 'secret': process.env.CAPTCHA_SECRET,
'remoteip': remoteIp, 'remoteip': remoteIp
'sitekey': process.env.SITEKEY!
}), }),
headers: { headers: {
'content-type': 'application/x-www-form-urlencoded' 'content-type': 'application/json'
} }
})).json() })).json()