Files
crowdsource-freedns/public/index.html
2025-07-27 03:34:18 -04:00

75 lines
2.1 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>solve captchas</title>
<style>
body {
display: flex;
justify-content: center;
align-items: center;
width: 100vw;
height: 100vh;
margin: 0;
padding: 0;
flex-direction: column;
background-color: black;
color: white;
}
h1 {
font-size: 32px;
margin: 20px;
text-align: center;
}
img {
width: 40%;
margin: 20px;
}
input {
width: 30%;
margin: 20px;
padding: 10px;
}
div {
width: 100%;
display: flex;
justify-content: center;
align-items: center;
}
button {
margin: 20px;
padding: 10px;
}
</style>
<script>
let captchaUUID;
document.addEventListener("DOMContentLoaded", async ()=>await loadCaptcha());
async function loadCaptcha() {
captchaUUID = await (await fetch("/new")).text();
document.getElementById("captcha").src = "/image/" + captchaUUID;
document.getElementById("solved").value = "";
document.getElementById("solvedNum").innerText = `solved: ${await (await fetch("/solved")).text()}`
}
async function submit() {
await fetch('/solve', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ uuid: captchaUUID, answer: document.getElementById("solved").value })
})
await loadCaptcha();
}
</script>
</head>
<body>
<h1>solve captchas for fun</h1>
<img id="captcha">
<div>
<input type="text" id="solved" placeholder="solve the captcha above..">
<button onclick="submit()">submit</button>
</div>
<p id="solvedNum">solved: -</p>
</body>
</html>