ai generated solutions to our ai generated problems

This commit is contained in:
Heidi
2026-06-22 19:51:13 +01:00
parent a3947f3662
commit 237a9a69fc
9 changed files with 688 additions and 101 deletions
-35
View File
@@ -60,7 +60,6 @@ const PUBLIC_DATA_STALE_REVALIDATE_SECONDS = Math.max(0, Math.floor(PUBLIC_DATA_
const API_RATE_LIMIT_WINDOW_MS = Number(process.env.API_RATE_LIMIT_WINDOW_MS || 60000)
const API_RATE_LIMIT_MAX = Number(process.env.API_RATE_LIMIT_MAX || 120)
const TURNSTILE_SECRET_KEY = process.env.TURNSTILE_SECRET_KEY || ''
const COMING_SOON = String(process.env.comingsoon || process.env.COMINGSOON || '').toLowerCase() === 'true'
const TURNSTILE_VERIFY_URL = 'https://challenges.cloudflare.com/turnstile/v0/siteverify'
const TURNSTILE_VERIFY_TIMEOUT_MS = Number(process.env.TURNSTILE_VERIFY_TIMEOUT_MS || 5000)
const TURNSTILE_MAX_TOKEN_LENGTH = 2048
@@ -2371,36 +2370,6 @@ function sendHtml(req, res, data, status = 200) {
})
}
function comingSoonHtml() {
return `<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noindex">
<meta name="theme-color" content="#fefde7">
<title>Toothless' TSS Bot | Coming soon</title>
</head>
<body style="margin:0;min-width:320px;min-height:100vh;background:#fefde7;color:#000;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Inter,Arial,sans-serif;">
<main style="min-height:100vh;display:grid;place-items:center;padding:32px;">
<section style="width:min(100%,720px);border-left:4px solid #e82517;padding:8px 0 8px 28px;">
<p style="margin:0 0 14px;color:#e82517;font-size:13px;font-weight:800;letter-spacing:.08em;text-transform:uppercase;">Toothless' TSS Bot</p>
<h1 style="margin:0;color:#000;font-size:clamp(48px,12vw,112px);line-height:.92;font-weight:900;letter-spacing:0;">Coming soon</h1>
<p style="margin:24px 0 0;max-width:520px;color:#555;font-size:18px;line-height:1.6;font-weight:600;">TSS analytics are getting tucked away for a little bit. Check back soon.</p>
</section>
</main>
</body>
</html>`
}
function sendComingSoonPage(req, res) {
send(res, 200, comingSoonHtml(), {
...securityHeaders(req, { html: true }),
'content-type': mimeTypes['.html'],
'cache-control': 'no-store',
})
}
function sendRobotsTxt(req, res) {
const origin = pagePublicOrigin(req)
const body = [
@@ -2452,10 +2421,6 @@ function serveStatic(req, res) {
} catch {
return send(res, 400, 'Bad request', { 'content-type': 'text/plain; charset=utf-8' })
}
if (COMING_SOON) {
return sendComingSoonPage(req, res)
}
const relativePath = requestPath === '/' ? '/index.html' : requestPath
const filePath = path.resolve(DIST_DIR, `.${relativePath}`)
const relativeToDist = path.relative(DIST_DIR, filePath)