ai generated solutions to our ai generated problems
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
# Static Public Data
|
||||
|
||||
The frontend can try these JSON snapshots before falling back to the live API
|
||||
when `VITE_STATIC_DATA=true`. By default, the app requests `/api/tss/*` directly
|
||||
and lets the web server answer from the same public data cache.
|
||||
The frontend tries these JSON snapshots before falling back to the live API by
|
||||
default. The web server serves `/data/*` from the public data cache and fills
|
||||
missing snapshots from the matching `/api/tss/*` route with a short timeout.
|
||||
|
||||
- `/data/leaderboard-teams.json`
|
||||
- `/data/leaderboard-players.json`
|
||||
|
||||
@@ -51,7 +51,7 @@ const siteVersion = '1.0.1'
|
||||
|
||||
const turnstileSiteKey = import.meta.env.VITE_TURNSTILE_SITE_KEY || ''
|
||||
const staticDataBase = (import.meta.env.VITE_STATIC_DATA_BASE || '/data').replace(/\/+$/, '')
|
||||
const staticDataEnabled = String(import.meta.env.VITE_STATIC_DATA || 'false').toLowerCase() === 'true'
|
||||
const staticDataEnabled = String(import.meta.env.VITE_STATIC_DATA || 'true').toLowerCase() !== 'false'
|
||||
const missingStaticDataPaths = new Set()
|
||||
|
||||
const defaultAnalyticsPreferences = {
|
||||
@@ -126,8 +126,11 @@ async function fetchPublicJson(source, signal) {
|
||||
return await fetchJson(source.staticPath, signal)
|
||||
} catch (error) {
|
||||
if (signal?.aborted || error?.name === 'AbortError') throw error
|
||||
if (error?.status === 404 || error?.contentType) missingStaticDataPaths.add(source.staticPath)
|
||||
return fetchJson(source.apiPath, signal)
|
||||
if (error?.status === 404 || error?.contentType) {
|
||||
missingStaticDataPaths.add(source.staticPath)
|
||||
return fetchJson(source.apiPath, signal)
|
||||
}
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user