Show app version in lobby footer; expose version via /api/config
- Server reads version from package.json and returns it from /api/config - Client fetches it at boot and renders it in a lobby footer - Bump service-worker cache to shelem-v3 so precache refreshes Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "shelem",
|
||||
"version": "1.0.0",
|
||||
"version": "1.1.2",
|
||||
"description": "Shelem card game — multiplayer",
|
||||
"main": "server.js",
|
||||
"scripts": {
|
||||
|
||||
@@ -1700,11 +1700,20 @@ async function validateAuth() {
|
||||
updateAuthBar();
|
||||
}
|
||||
|
||||
// Show the running app version in the lobby footer (served from /api/config)
|
||||
async function loadAppVersion() {
|
||||
try {
|
||||
const d = await fetch('/api/config').then(r => r.json());
|
||||
if (d.version) $('app-version').textContent = `v${d.version}`;
|
||||
} catch { /* ignore */ }
|
||||
}
|
||||
|
||||
// ─── Boot ─────────────────────────────────────────────────────
|
||||
document.addEventListener('DOMContentLoaded', async () => {
|
||||
initLobby();
|
||||
wireGameEvents();
|
||||
applyBarBottom();
|
||||
loadAppVersion();
|
||||
|
||||
// Drop any stale/corrupted auth token before we use it to connect
|
||||
await validateAuth();
|
||||
|
||||
@@ -91,6 +91,7 @@
|
||||
|
||||
<p id="lobby-error" class="error-msg"></p>
|
||||
</div>
|
||||
<div id="app-version" class="app-version"></div>
|
||||
</div>
|
||||
|
||||
<!-- ══════════════ WAITING ROOM ══════════════ -->
|
||||
|
||||
@@ -1033,6 +1033,15 @@ input:focus { border-color: var(--gold); }
|
||||
.lb-table td { border-bottom: 1px solid rgba(255,255,255,.05); }
|
||||
.lb-table tr:hover td { background: rgba(255,255,255,.04); }
|
||||
|
||||
/* ── App version footer ───── */
|
||||
.app-version {
|
||||
text-align: center;
|
||||
margin-top: 14px;
|
||||
font-size: .72rem;
|
||||
color: rgba(255,255,255,.35);
|
||||
letter-spacing: .5px;
|
||||
}
|
||||
|
||||
/* ── Round-by-round breakdown ───── */
|
||||
.round-breakdown-wrap { margin: 6px 0 2px; }
|
||||
.rb-scroll { max-height: 42vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
'use strict';
|
||||
const CACHE_NAME = 'shelem-v2';
|
||||
const CACHE_NAME = 'shelem-v3';
|
||||
|
||||
// ── Generate all 55 card paths ──────────────────────────────────
|
||||
const SUITS = ['CLUB', 'DIAMOND', 'HEART', 'SPADE'];
|
||||
|
||||
@@ -132,8 +132,10 @@ app.use(express.static(path.join(__dirname, 'public'), {
|
||||
}));
|
||||
|
||||
// ─── Auth API ─────────────────────────────────────────────────
|
||||
const APP_VERSION = require('./package.json').version;
|
||||
|
||||
app.get('/api/config', (_req, res) => {
|
||||
res.json({ signupsOpen: config.signupsOpen });
|
||||
res.json({ signupsOpen: config.signupsOpen, version: APP_VERSION });
|
||||
});
|
||||
|
||||
// Validate the stored auth token; the client uses this at startup to detect a
|
||||
|
||||
Reference in New Issue
Block a user