ai generated solutions to our ai generated problems

This commit is contained in:
Heidi
2026-06-20 00:32:28 +01:00
parent f631ea12a8
commit 152467515d
4 changed files with 18 additions and 6 deletions
+1
View File
@@ -120,6 +120,7 @@ PUBLIC_DATA_CACHE_STALE_MS=86400000
PUBLIC_DATA_PREWARM_INTERVAL_MS=300000 PUBLIC_DATA_PREWARM_INTERVAL_MS=300000
PUBLIC_DATA_COLD_TIMEOUT_MS=8000 PUBLIC_DATA_COLD_TIMEOUT_MS=8000
VITE_STATIC_DATA=true VITE_STATIC_DATA=true
VITE_SITE_GATE=false
API_RATE_LIMIT_WINDOW_MS=60000 API_RATE_LIMIT_WINDOW_MS=60000
API_RATE_LIMIT_MAX=120 API_RATE_LIMIT_MAX=120
``` ```
+1
View File
@@ -62,4 +62,5 @@ DISCORD_INCLUDE_PATCH=true
# TURNSTILE_SECRET_KEY is the server-only secret used to call the Siteverify endpoint. # TURNSTILE_SECRET_KEY is the server-only secret used to call the Siteverify endpoint.
VITE_TURNSTILE_SITE_KEY= VITE_TURNSTILE_SITE_KEY=
TURNSTILE_SECRET_KEY= TURNSTILE_SECRET_KEY=
VITE_SITE_GATE=false
VITE_STATIC_DATA=true VITE_STATIC_DATA=true
-6
View File
@@ -2,12 +2,6 @@
<html lang="en"> <html lang="en">
<head> <head>
<title>__SEO_TITLE__</title> <title>__SEO_TITLE__</title>
<link rel="preconnect" href="https://challenges.cloudflare.com" />
<script
src="https://challenges.cloudflare.com/turnstile/v0/api.js"
async
defer>
</script>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+16
View File
@@ -50,6 +50,7 @@ const liveRefreshMs = 15000
const siteVersion = '1.0.1' const siteVersion = '1.0.1'
const turnstileSiteKey = import.meta.env.VITE_TURNSTILE_SITE_KEY || '' const turnstileSiteKey = import.meta.env.VITE_TURNSTILE_SITE_KEY || ''
const siteGateEnabled = String(import.meta.env.VITE_SITE_GATE || 'false').toLowerCase() === 'true'
const staticDataBase = (import.meta.env.VITE_STATIC_DATA_BASE || '/data').replace(/\/+$/, '') const staticDataBase = (import.meta.env.VITE_STATIC_DATA_BASE || '/data').replace(/\/+$/, '')
const staticDataEnabled = String(import.meta.env.VITE_STATIC_DATA || 'true').toLowerCase() !== 'false' const staticDataEnabled = String(import.meta.env.VITE_STATIC_DATA || 'true').toLowerCase() !== 'false'
const missingStaticDataPaths = new Set() const missingStaticDataPaths = new Set()
@@ -901,6 +902,16 @@ function TurnstileWidget({ siteKey, theme = 'auto', size = 'normal', action, onV
let cancelled = false let cancelled = false
let pollTimer let pollTimer
let script = document.querySelector('script[data-tss-turnstile]')
if (!script) {
script = document.createElement('script')
script.src = 'https://challenges.cloudflare.com/turnstile/v0/api.js'
script.async = true
script.defer = true
script.dataset.tssTurnstile = 'true'
document.head.appendChild(script)
}
const renderWidget = () => { const renderWidget = () => {
if (cancelled) return if (cancelled) return
@@ -1019,6 +1030,11 @@ function SiteGate({ onVerified }) {
} }
function App() { function App() {
if (!siteGateEnabled) return <AppContent />
return <GatedAppContent />
}
function GatedAppContent() {
const embeddedGateState = document const embeddedGateState = document
.querySelector('meta[name="tss-turnstile-session"]') .querySelector('meta[name="tss-turnstile-session"]')
?.getAttribute('content') ?.getAttribute('content')