feat: Windows download link + self-served update feed + install tracking
Downloads/updates: - config: DOWNLOADS_DIR (override to a mounted volume in prod). - static.js: serves /downloads/* (installer, latest.yml, .blockmap) with range support for resumable + differential auto-updates; /download/windows redirects to the current .exe (stable link). Landing page gets a "Download the Windows desktop app" button (hidden in-app). Install tracking (who installed the app): - db app_installs + repos.appInstalls (upsert by install_id, fills in the user on sign-in). - POST /api/v1/telemetry/install (records install + user once authenticated); GET /api/v1/admin/installs (admin: list installs with user/version/os/last-seen). - desktop main.js: stable per-install id in userData, exposed via preload (bizConnectNative.installId/version/os); home.html reportInstall() posts it after login. - e2e: +2 checks (telemetry recorded, admin sees it). 119/119. build batch20. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+7
-1
@@ -3,10 +3,16 @@
|
||||
// or prefer native push). No Node APIs are exposed to page JS.
|
||||
const { contextBridge, ipcRenderer } = require('electron');
|
||||
|
||||
// Pull the stable install id + version/os from main (synchronous, one-time at preload).
|
||||
let info = { installId: '', appVersion: '', os: '' };
|
||||
try { info = ipcRenderer.sendSync('get-install-info') || info; } catch (_) {}
|
||||
|
||||
contextBridge.exposeInMainWorld('__NATIVE__', 'desktop');
|
||||
contextBridge.exposeInMainWorld('bizConnectNative', Object.freeze({
|
||||
platform: 'desktop',
|
||||
version: process.env.npm_package_version || '0.1.0',
|
||||
version: info.appVersion || '0.1.0',
|
||||
installId: info.installId || '',
|
||||
os: info.os || '',
|
||||
// Bring the app window to the foreground (e.g. when a notification is clicked) — the web
|
||||
// Notification's window.focus() can't raise an Electron window; the main process must.
|
||||
focusApp: () => ipcRenderer.send('focus-window'),
|
||||
|
||||
Reference in New Issue
Block a user