feat(web): download the Android APK from Settings

Backend serves a staged APK so co-users self-serve the latest build:
- GET /api/apk streams APK_PATH (default /data/novasonic.apk) with the
  android package content-type + attachment disposition; 404 if absent.
- GET /api/apk/info reports availability, size, mtime, and an optional
  version from /data/novasonic.version.txt.
- Settings gets a "🤖 Android App" section that appears only when an APK is
  present and shows version/size/date.

Maintainer updates the APK with:
  docker cp app-release.apk novasonic-backend:/data/novasonic.apk

Android source is already tracked; only build artifacts stay out of git.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
HoneyandClaude Opus 4.8 committed 2026-08-25 18:00:36 +02:00
1 parent 7996971ba0
commit 908b50bcd9
4 files changed
+67

No files matched your search

+21
View File
@@ -54,6 +54,27 @@ export function openSettings() {
_renderThemePicker();
document.getElementById('settings-modal').classList.add('open');
checkBackend();
_loadApkInfo();
}
// Show the "download the Android APK" button only if the backend actually has an APK staged.
async function _loadApkInfo() {
const section = document.getElementById('s-apk-section');
const btn = document.getElementById('s-apk-btn');
const meta = document.getElementById('s-apk-meta');
if (!section || !btn) return;
section.style.display = 'none';
const base = S.cfg.backendUrl;
if (!base) return;
try {
const info = await fetch(`${base}/api/apk/info`).then(r => r.json());
if (!info?.available) return;
btn.href = `${base}/api/apk`;
const mb = info.size ? (info.size / 1048576).toFixed(1) + ' MB' : '';
const date = info.updatedAt ? new Date(info.updatedAt).toLocaleDateString('de-DE') : '';
if (meta) meta.textContent = [info.version && `v${info.version}`, mb, date && `Stand ${date}`].filter(Boolean).join(' · ');
section.style.display = '';
} catch {}
}
function _renderThemePicker() {