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

+4 -1
View File
@@ -64,6 +64,8 @@
#intro .how p { margin: 0; }
#intro .how span { display: inline-block; width: 30px; }
#intro em { color: #8a96ab; font-style: normal; font-size: 12px; }
/* which build is served — filled in by main.js, empty (and invisible) if the header is missing */
#build { margin: 10px 0 0; font-size: 9px; color: #5a6270; letter-spacing: 0.5px; }
#intro .start { margin-top: 18px; color: #e0cc72; font-weight: bold; letter-spacing: 1px; animation: blink 1.1s step-end infinite; }
@keyframes blink { 50% { opacity: 0.25; } }
</style>
@@ -84,8 +86,9 @@
<p class="kb"><span>⌨️</span> WASD / arrows + SPACE</p>
</div>
<p class="start">TAP TO START</p>
<p id="build"></p>
</div>
</div>
<script type="module" src="main.js?v=50"></script>
<script type="module" src="main.js?v=51"></script>
</body>
</html>
+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