diff --git a/internal/readme-shots.mjs b/internal/readme-shots.mjs index 4dc76dfed..2f21a9bca 100644 --- a/internal/readme-shots.mjs +++ b/internal/readme-shots.mjs @@ -64,20 +64,25 @@ const BASE = `http://127.0.0.1:${server.address().port}` // the build config is local and deterministic — the network path degrades silently, setting TK to // '' when doxa.life is slow, after which every shot is taken token-limited and still written to // disk. The fetch is kept only as a fallback for a tree whose build config has no baked token. +// ★ TOKENLESS BY DEFAULT (Driver, 2026-09-26). The engine default is now 'auto': no token means +// MapLibre, which is what every keyless partner embed shows. So the README pictures are taken with +// NO token, showing the look a reader gets by default. SHOTS_WITH_TOKEN=1 restores the Mapbox shots +// (the token ladder below). +const WITH_TOKEN = process.env.SHOTS_WITH_TOKEN === '1' let TK = '' let TK_SRC = '' -try { +if (WITH_TOKEN) try { const cfg = JSON.parse(await readFile(new URL('../vite.doxa-maps-build-config.json', import.meta.url), 'utf8')) if (typeof cfg.token === 'string' && cfg.token.startsWith('pk.')) { TK = cfg.token; TK_SRC = 'build config (the token the bundles ship)' } } catch {} -if (!TK) { +if (WITH_TOKEN && !TK) { try { const r = await fetch('https://doxa.life/api/maps/token', { signal: AbortSignal.timeout(8000) }) TK = r.ok ? ((await r.json()).token || '') : '' if (TK) TK_SRC = 'doxa.life/api/maps/token (fallback — needs the Referer header below)' } catch {} } -console.log(TK ? `token: ${TK.length} chars from ${TK_SRC}` : 'token: NONE — maps token-limited') +console.log(TK ? `token: ${TK.length} chars from ${TK_SRC}` : (WITH_TOKEN ? 'token: NONE — maps token-limited' : 'token: none, by design (engine auto -> MapLibre); SHOTS_WITH_TOKEN=1 for Mapbox')) // ★ SwiftShader — WITHOUT THESE ARGS EVERY MAP SHOT IS TAKEN WITH NO GL CONTEXT. // This script was written under the belief "this VPS has no WebGL", which was a LAUNCH-FLAG @@ -168,7 +173,7 @@ async function shot(name, path, { let inflight = 0, lastNet = Date.now() const track = (d) => (req) => { if (/^(websocket|eventsource|media)$/.test(req.resourceType())) return; inflight += d; lastNet = Date.now() } page.on('request', track(1)); page.on('requestfinished', track(-1)); page.on('requestfailed', track(-1)) - const url = (/^https?:/.test(path) ? path : BASE + path) + (tokenFree ? '' : (path.includes('?') ? '&' : '?') + 'tk=' + encodeURIComponent(TK)) + const url = (/^https?:/.test(path) ? path : BASE + path) + (tokenFree || !TK ? '' : (path.includes('?') ? '&' : '?') + 'tk=' + encodeURIComponent(TK)) try { await page.goto(url, { waitUntil: 'load', timeout: 45000 }) if (waitFor) await page.waitForSelector(waitFor, { timeout: 20000 })