121 lines
3.9 KiB
HTML
121 lines
3.9 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="zh">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<link rel="icon" href="https://xiaoshadiao.club/xsdv2.png" type="image/x-icon">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>好玩的验证awa</title>
|
|
<!-- 加载 Turnstile JS (推荐放在 <head> 中) -->
|
|
<script src="https://challenges.cloudflare.com/turnstile/v0/api.js" async defer></script>
|
|
<style>
|
|
body {
|
|
font-family: Arial, sans-serif;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
height: 100vh;
|
|
margin: 0;
|
|
}
|
|
|
|
.container {
|
|
text-align: center;
|
|
padding: 20px;
|
|
border: 0px solid #d9ff00;
|
|
border-radius: 8px;
|
|
}
|
|
|
|
#turnstile-widget {
|
|
margin: 20px 0;
|
|
}
|
|
|
|
#result {
|
|
margin-top: 20px;
|
|
color: green;
|
|
font-weight: bold;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<div class="container">
|
|
<form id="demo-form">
|
|
<!-- Turnstile 挂载点 -->
|
|
<div id="turnstile-widget" class="cf-turnstile" data-sitekey="0x4AAAAAABghjek4jVecQ-sc"
|
|
data-callback="handleSuccess" data-error-callback="handleFailed" data-theme="light"></div>
|
|
</form>
|
|
<div id="result">
|
|
<h3> </h3>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
|
|
let alreadyFlag = false;
|
|
|
|
function handleSuccess() {
|
|
console.log("awa!")
|
|
|
|
const thisUrl = new URL(window.location.href)
|
|
if (!thisUrl.searchParams.get("code")) {
|
|
handleResult(function () {
|
|
setTimeout(() => window.location.replace("/"), 5000)
|
|
|
|
const resultH3 = document.querySelector('#result h3');
|
|
resultH3.textContent = "Hmmm, 好像缺少了什么东西验证不了呢qwq";
|
|
resultH3.style.color = "red";
|
|
})
|
|
return;
|
|
}
|
|
|
|
const response = turnstile.getResponse()
|
|
|
|
const requestVerify = new XMLHttpRequest()
|
|
|
|
requestVerify.open("get", "https://xiaoshadiao.club/qqgroupmemberverify?action=handle&code=" + thisUrl.searchParams.get("code") + "&response=" + response)
|
|
|
|
requestVerify.onload = function () {
|
|
if (requestVerify.status == 200) {
|
|
handleResult(function () {
|
|
const json = JSON.parse(requestVerify.responseText)
|
|
const resultH3 = document.querySelector('#result h3');
|
|
resultH3.textContent = "验证成功, 在群内发送\"" + json["verifycode"] + "\"就能完成验证了awa";
|
|
resultH3.style.color = "green";
|
|
})
|
|
} else {
|
|
handleResult(function () {
|
|
setTimeout(() => window.location.reload(), 5000)
|
|
|
|
const resultH3 = document.querySelector('#result h3');
|
|
resultH3.textContent = "验证失败qwq, 等待5s后重试吧 (" + requestVerify.responseText + ") (如果你挂了梯子, 关掉重试)";
|
|
resultH3.style.color = "red";
|
|
})
|
|
}
|
|
};
|
|
|
|
requestVerify.send()
|
|
}
|
|
|
|
function handleFailed() {
|
|
handleResult(function () {
|
|
console.log("qwq...")
|
|
setTimeout(() => window.location.reload(), 5000)
|
|
|
|
const resultH3 = document.querySelector('#result h3');
|
|
resultH3.textContent = "验证失败qwq, 等待5s后重试吧";
|
|
resultH3.style.color = "red";
|
|
})
|
|
}
|
|
|
|
function handleResult(fun) {
|
|
if (!alreadyFlag) {
|
|
alreadyFlag = true;
|
|
fun()
|
|
}
|
|
}
|
|
|
|
</script>
|
|
</body>
|
|
|
|
</html>
|