feat(webapp): show running version in Mini App footer

Compute `git describe --tags --always --dirty` at server startup
and expose via unauthenticated /api/version. Render as small muted
text at the bottom of the Mini App so the running version can be
confirmed at a glance.

Once tags exist, the badge will show e.g. v0.1.0 or v0.1.0-3-gSHA.
Until then it shows the short SHA.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Danny 2026-04-18 17:38:52 +02:00
parent 31d426d53e
commit b4d76b0eca
4 changed files with 56 additions and 1 deletions

View file

@ -767,8 +767,22 @@ function fmtWeight(w) {
return w === Math.floor(w) ? Math.floor(w).toString() : w.toString();
}
// ── Version badge ───────────────────────────────────────────────
async function loadVersion() {
try {
const res = await fetch(API + "/version");
if (!res.ok) return;
const data = await res.json();
const badge = document.getElementById("version-badge");
if (badge && data.version) badge.textContent = data.version;
} catch (e) {
// Silent — footer just stays empty if unreachable
}
}
// ── Init ────────────────────────────────────────────────────────
async function init() {
loadVersion();
if (!userId) return;
try {
const data = await api("GET", "/exercises");

View file

@ -88,6 +88,10 @@
<p>Loading...</p>
</div>
</div>
<footer id="app-footer">
<span id="version-badge"></span>
</footer>
</div>
<script src="app.js"></script>

View file

@ -472,3 +472,15 @@ details[open] .raw-toggle::before {
transform: translateX(-50%) translateY(0);
opacity: 1;
}
/* ── Footer / version badge ──────────────────────────────────── */
#app-footer {
margin-top: 24px;
padding: 12px 16px 20px;
text-align: center;
font-size: 11px;
color: var(--tg-theme-hint-color, #999);
opacity: 0.6;
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}