feat(dashboard): "App installs" view + compact top-right Download button

- dashboard.html: admin "App installs" card — table of user · platform · version · OS ·
  first/last seen, from GET /api/v1/admin/installs (loadInstalls).
- index.html: replaced the long inline link with a compact white "Download app" button in
  the blue top header (top-right); hidden when already inside the desktop app.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-01 22:16:38 +05:30
parent 899770ed02
commit 9ff2ef5d48
2 changed files with 21 additions and 2 deletions
+14
View File
@@ -235,6 +235,11 @@ async function dashboard(me) {
<button id="hAdd">Add webhook</button>
</div>
<div id="hOut"></div>
</div>
<div class="card" id="installsCard">
<h2>App installs <span class="muted" style="font-weight:400;font-size:.8rem;text-transform:none;letter-spacing:0">— who installed the desktop / mobile app</span></h2>
<div class="table-scroll"><table id="installs"><thead><tr><th>User</th><th>Platform</th><th>Version</th><th>OS</th><th>First seen</th><th>Last seen</th></tr></thead><tbody></tbody></table></div>
<p id="installsEmpty" class="muted" style="margin-top:.6rem;display:none">No installs recorded yet.</p>
</div>` : ''}`);
document.getElementById('fApply').onclick = loadReport;
document.getElementById('fExcel').onclick = exportExcel;
@@ -246,8 +251,17 @@ async function dashboard(me) {
document.getElementById('hAdd').onclick = createHook;
await loadKeys();
await loadHooks();
await loadInstalls();
}
}
async function loadInstalls(){
let rows=[]; try{ rows=await fetch('/api/v1/admin/installs').then(r=>r.json()); }catch(_){}
const tb=document.querySelector('#installs tbody'); if(!tb) return;
const empty=document.getElementById('installsEmpty');
if(!Array.isArray(rows)||!rows.length){ tb.innerHTML=''; if(empty) empty.style.display='block'; return; }
if(empty) empty.style.display='none';
tb.innerHTML=rows.map(r=>`<tr><td>${esc(r.user_email||'—')}</td><td>${esc(r.platform||'—')}</td><td>${esc(r.app_version||'—')}</td><td>${esc(r.os||'—')}</td><td>${fmtTs(r.first_seen)}</td><td>${fmtTs(r.last_seen)}</td></tr>`).join('');
}
// ---------- Integrations: API keys + webhooks (admin) ----------
function fmtTs(ms){ return ms ? new Date(ms).toLocaleString() : '—'; }