feat: detect new web builds + hard-refresh escape hatch (0.1.17/batch78)
Root cause of "the fix works on mobile but not on desktop/web": nothing was wrong with the code — the desktop app now CLOSES TO TRAY, so it can run for weeks on the page it loaded on day one and never re-fetch after a deploy. There was also no way to force it off a stale page (no menu bar → no reload accelerator). - Server: GET /api/build returns home.html's __BUILD marker. - Client: polls it (boot, on focus/visibility, every 10 min); when the server's build differs from the running one, shows a branded "A new version is available — Refresh" banner. Settings gains an always-available "Refresh app" with the current build shown. - hardReloadApp(): in the browser it unregisters service workers + clears CacheStorage then reloads cache-busted; in the shell it calls the native hard reload. - Desktop: hard-reload IPC (clears the session HTTP cache + reloadIgnoringCache), wired to Ctrl+R (reload), Ctrl+Shift+R / F5 (hard reload), and a "Refresh app (get latest)" tray item. Previously there was literally no way to clear the cache from the app. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -917,6 +917,17 @@ route('GET', '/api/meetings/config', (req, res) => {
|
||||
json(res, 200, { sfu: LIVEKIT_ENABLED, url: LIVEKIT_ENABLED ? LIVEKIT_URL : '' });
|
||||
});
|
||||
|
||||
// The web build currently on the server (home.html's __BUILD marker). Long-running clients poll this and
|
||||
// offer a Refresh when it changes. This matters because the desktop app now CLOSES TO TRAY — it can run
|
||||
// for weeks without ever reloading the page, so it would silently keep serving stale code after a deploy.
|
||||
let APP_BUILD = '';
|
||||
try {
|
||||
const h = fs.readFileSync(path.join(require('./config').PUBLIC_DIR, 'home.html'), 'utf8');
|
||||
const m = /__BUILD='([^']+)'/.exec(h);
|
||||
if (m) APP_BUILD = m[1];
|
||||
} catch (_) {}
|
||||
route('GET', '/api/build', (req, res) => json(res, 200, { build: APP_BUILD }));
|
||||
|
||||
// Mint a LiveKit join token for the signed-in user + a specific room (the 6-digit meeting code).
|
||||
// The room-membership/host authorization already happens over the meeting WebSocket; this only
|
||||
// hands the client a media-plane credential scoped to that room and its own identity.
|
||||
|
||||
Reference in New Issue
Block a user