Show which build the start screen is running

"Am I on the right version?" needs an answer on the device, not in a terminal.
The browser cannot see git and push = deploy leaves no build step to inject a
sha into, so the marker is the served main.js's own Last-Modified — it moves on
every deploy with nothing to remember to bump. Match it with
`git log -1 --format=%cd`.

Cache-buster bumped with it: without that the phone keeps the old main.js and
shows a stale build line, which is the exact thing this is meant to catch.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
wuwiandClaude Opus 5 committed 2026-07-31 08:42:23 +02:00
1 parent 47d960e4ea
commit 5f97c7cff4
2 files changed
+11 -1

No files matched your search

+7
View File
@@ -32,6 +32,13 @@ function dismissIntro() {
intro.remove(); ambient(); voice('quiet_please'); // low atmosphere bed starts with the first gesture
}
intro.addEventListener('pointerdown', e => { e.preventDefault(); dismissIntro(); });
// which build am I looking at? Push = deploy and the browser cannot see git, so the served file's
// own timestamp IS the version marker — it changes on every deploy, with nothing to remember to bump.
// Match it against `git log -1 --format=%cd` when a phone looks suspiciously out of date.
fetch('main.js', { method: 'HEAD' })
.then(r => { const t = r.headers.get('last-modified'); if (!t) return;
document.getElementById('build').textContent = 'BUILD ' + new Date(t).toLocaleString('en-GB').replace(',', ''); })
.catch(() => {}); // no header, no line — never a broken start screen
addEventListener('keydown', () => dismissIntro(), { once: true });
// eaten: any tap or key restarts — but only once the death animation has played out, so a