feat: show app version and server build tag in settings

Adds an About section at the bottom of Settings displaying the app
version. In WEB mode it fetches /api/version and appends the live
server build tag so you can confirm which deploy is running.
This commit is contained in:
Jonathan Sykes
2026-07-01 04:04:15 +08:00
parent 30a05d3ebd
commit 79359dba44
2 changed files with 26 additions and 0 deletions

View File

@@ -1550,6 +1550,19 @@ async function renderSettings() {
<button id="resetAppBtn" class="btn danger">Reset app</button>
</div>
</div>
</div>
<div class="set-group">
<div class="set-group-title">About</div>
<div class="set-row">
<span>
Version
<small>App version and current build.</small>
</span>
<div class="set-actions" style="margin:0">
<span id="aboutVersion" class="about-version">v${APP_VERSION}</span>
</div>
</div>
</div>`;
c.appendChild(wrap);
@@ -1656,6 +1669,18 @@ async function renderSettings() {
$('importBackupBtn').addEventListener('click', () => $('backupFileInput').click());
$('backupFileInput').addEventListener('change', importBackup);
// ---- About: append server build tag (WEB mode only) ----
if (WEB) {
try {
const res = await fetch('/api/version', { cache: 'no-store' });
if (res.ok && view.type === 'settings') {
const v = await res.json();
const el = $('aboutVersion');
if (el && v.buildTag) el.textContent = `v${v.version || APP_VERSION} · build ${v.buildTag}`;
}
} catch { /* offline — leave the static version in place */ }
}
// ---- Reset ----
$('refreshUiBtn').addEventListener('click', async () => {
const btn = $('refreshUiBtn');