fix(captcha): cap Cloudflare checks in flight, and let a blocked widget be retried

- 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]>
This commit is contained in:
SnipzilandClaude Opus 5.5 committed 2026-10-21 22:24:59 -04:00
1 parent 43f2717b44
commit 974f68490e
4 files changed
+62 -19

No files matched your search

+4
View File
@@ -101,6 +101,10 @@ module.exports = {
// tried or an account is made, with both set. off without them.
turnstile: env.AJ_TURNSTILE_SITE_KEY && env.AJ_TURNSTILE_SECRET
? {siteKey: env.AJ_TURNSTILE_SITE_KEY, secret: env.AJ_TURNSTILE_SECRET} : null,
// A stalled CAPTCHA provider must not consume all of the VPS's outbound
// sockets. This only limits simultaneous verification requests; normal
// players use one, and a rejected request can safely be retried.
maxConcurrentCaptchaChecks: Math.max(1, Math.min(100, Number(env.AJ_CAPTCHA_MAX_CONCURRENT) || 24)),
// Account-recovery mail is delivered to this HTTPS webhook. It receives
// {to, subject, text}; point it at the transactional-mail provider or