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');

View File

@@ -919,6 +919,7 @@ input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.25); }
.set-row small { color: var(--text-dim); font-size: 11.5px; font-weight: 400; line-height: 1.4; max-width: 280px; }
.set-row input[type="range"] { width: 150px; }
.set-row input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; }
.about-version { color: var(--text-dim); font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; user-select: text; }
.set-select {
background: var(--bg-3); color: var(--text);
border: 1px solid var(--line); border-radius: 9px;