Skip to content

Commit 9f52462

Browse files
skeptomaiclaude
andcommitted
feat: Add deployment marker for cache verification
Users can't tell if they have the latest deployment due to browser caching. Added visible build information on disclaimer page. Changes: - GitHub Actions: Create buildinfo.json with commit hash and timestamp - JavaScript: Load buildinfo.json and display on disclaimer page - CSS: Style build info line (small, dim, subtle) Display format: "Build: a791a06 @ 12/16/2025, 2:45:23 AM" Users can now compare the commit hash with the latest GitHub commit to verify they have the current deployment. No more guessing about cache issues. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent a791a06 commit 9f52462

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed

.github/workflows/deploy-pages.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ jobs:
3434
- name: Build WASM
3535
run: wasm-pack build --target web --out-dir web/pkg --no-default-features --features wasm
3636

37+
- name: Create build info
38+
run: |
39+
echo "{\"commit\":\"${GITHUB_SHA:0:7}\",\"timestamp\":\"$(date -u +%Y-%m-%dT%H:%M:%SZ)\"}" > web/buildinfo.json
40+
cat web/buildinfo.json
41+
3742
- name: Setup Pages
3843
uses: actions/configure-pages@v4
3944

web/css/terminal.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,16 @@ body {
436436
text-align: center;
437437
color: var(--terminal-dim);
438438
margin-top: 5px;
439+
margin-bottom: 5px;
440+
}
441+
442+
.build-info {
443+
text-align: center;
444+
color: var(--terminal-dim);
445+
font-size: 0.8em;
446+
margin-top: 0;
439447
margin-bottom: 20px;
448+
opacity: 0.7;
440449
}
441450

442451
/* ============================================

web/js/main.js

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,16 @@ function BlurToggle({ blurLevel, onToggle, disabled }) {
112112
* Disclaimer Component
113113
* Shown before loading the game with legal notices
114114
*/
115-
function Disclaimer({ onContinue, onLoadOwn, theme, onThemeChange, font, onFontChange, crtEnabled, onCrtChange, blurLevel, onBlurChange, version }) {
115+
function Disclaimer({ onContinue, onLoadOwn, theme, onThemeChange, font, onFontChange, crtEnabled, onCrtChange, blurLevel, onBlurChange, version, buildInfo }) {
116116
const crtClass = crtEnabled ? `crt-enhanced crt-blur-${blurLevel || 'medium'}` : '';
117117
return html`
118118
<div class="terminal theme-${theme} font-${font} ${crtClass}">
119119
<div class="disclaimer">
120120
<h1 class="disclaimer-title">GRUESOME</h1>
121121
<p class="disclaimer-subtitle">Z-Machine Interpreter${version ? ` v${version}` : ''}</p>
122+
${buildInfo && html`
123+
<p class="build-info">Build: ${buildInfo.commit} @ ${new Date(buildInfo.timestamp).toLocaleString()}</p>
124+
`}
122125
123126
<${ThemeToggle} theme=${theme} onToggle=${onThemeChange} />
124127
<${FontToggle} font=${font} onToggle=${onFontChange} />
@@ -204,6 +207,9 @@ function App() {
204207
// Interpreter version - fetch from WASM on load
205208
const [interpreterVersion, setInterpreterVersion] = useState(null);
206209

210+
// Build info for deployment tracking
211+
const [buildInfo, setBuildInfo] = useState(null);
212+
207213
// Game state (when playing with real WASM)
208214
const [gameState, setGameState] = useState({
209215
status: { location: '', score: 0, moves: 0 },
@@ -212,6 +218,23 @@ function App() {
212218
quit: false,
213219
});
214220

221+
// Load build info on app startup for deployment tracking
222+
useEffect(() => {
223+
async function loadBuildInfo() {
224+
try {
225+
const response = await fetch('./buildinfo.json');
226+
if (response.ok) {
227+
const info = await response.json();
228+
setBuildInfo(info);
229+
console.log('Build info:', info);
230+
}
231+
} catch (err) {
232+
console.log('Could not load build info:', err);
233+
}
234+
}
235+
loadBuildInfo();
236+
}, []);
237+
215238
// Load WASM module on app startup to fetch version
216239
// This runs once when the app loads, before the user clicks "Play Zork"
217240
// Version is pulled from Cargo.toml via CARGO_PKG_VERSION at build time
@@ -554,6 +577,7 @@ function App() {
554577
blurLevel=${settings.blurLevel || 'medium'}
555578
onBlurChange=${handleBlurChange}
556579
version=${interpreterVersion}
580+
buildInfo=${buildInfo}
557581
/>
558582
`;
559583

0 commit comments

Comments
 (0)