mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-18 17:27:50 -05:00
- server: at most config.maxConcurrentCaptchaChecks (AJ_CAPTCHA_MAX_CONCURRENT, 24 by default, 1 to 100) Turnstile checks wait on Cloudflare at once; past that the answer is captcha_unavailable at once, so a slow Cloudflare cannot hold thousands of sockets open. The page's policy lets it connect to challenges.cloudflare.com too. - page: public/captcha.js gives up on a widget that has not loaded in 15 s, or that loaded without turnstile.render, instead of waiting for ever, and a render that throws counts as a failed answer. The game's captcha window says to check the connection or a content blocker, with a "Try again" button. Co-Authored-By: Claude Opus 5.5 <[email protected]>
69 lines
2.5 KiB
HTML
69 lines
2.5 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>Burrow</title>
|
|
<link rel="icon" type="image/png" href="/logo-square.png">
|
|
<style>
|
|
/* the captcha alone, in a small window the client opens over its login
|
|
screen (its app/main.js); the answer goes back through that
|
|
window's preload. */
|
|
@font-face { font-family: "DigitalDelivery"; font-weight: 400; src: url("/fonts/CCDigitalDelivery-Regular.otf") format("opentype"); }
|
|
:root { color-scheme: dark; }
|
|
html, body { height: 100%; }
|
|
body {
|
|
margin: 0;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 12px;
|
|
background: #000;
|
|
color: #8c8c8c;
|
|
font: 14px/1.4 "DigitalDelivery", system-ui, "Segoe UI", sans-serif;
|
|
-webkit-font-smoothing: antialiased;
|
|
}
|
|
#status { margin: 0; text-align: center; }
|
|
button { display: none; border: 1px solid #8c8c8c; border-radius: 5px; padding: 6px 12px; background: transparent; color: #ddd; font: inherit; cursor: pointer; }
|
|
button.show { display: block; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="widget"></div>
|
|
<p id="status" role="status">Checking…</p>
|
|
<button id="retry" type="button">Try again</button>
|
|
<script src="/captcha.js"></script>
|
|
<script>
|
|
"use strict";
|
|
|
|
const action = new URLSearchParams(location.search).get("action") === "signup" ? "signup" : "login";
|
|
const status = document.getElementById("status");
|
|
const retry = document.getElementById("retry");
|
|
const done = token => {
|
|
if (window.burrowCaptcha) {
|
|
window.burrowCaptcha.done(token);
|
|
}
|
|
};
|
|
if (!window.captcha.on) {
|
|
status.textContent = "No captcha needed.";
|
|
done("");
|
|
}
|
|
else {
|
|
// cloudflare may try again after an error, and an answer can still come.
|
|
const check = window.captcha.mount(document.getElementById("widget"), action, {appearance: "always", onAnswer: token => {
|
|
status.textContent = "Done.";
|
|
done(token);
|
|
}});
|
|
check.answer().then(token => {
|
|
if (!token) {
|
|
status.textContent = "Captcha could not load. Check your connection or content blocker.";
|
|
retry.classList.add("show");
|
|
}
|
|
});
|
|
}
|
|
retry.addEventListener("click", () => location.reload());
|
|
</script>
|
|
</body>
|
|
</html>
|