Replace the click-to-scan-only flow with a self-throttled auto-scan that rides the existing task-processor idle poll (the same shape as the network-drift check — no new daemon, unit, or endpoint): - 'libreportal updater check auto' gates on the age of the generated updates.json vs CFG_UPDATER_SCAN_INTERVAL (minutes, default 30, 0 disables); a fresh file makes the 60s tick a single stat() + return. Manual checks and post-update rescans reset the clock for free, and a missing file means the first scan runs ~a minute after install. - Eligible signed hotfixes keep flowing through artifactApplyAuto, which only enqueues ordinary tasks — mutations stay on the task path. - Open updater surfaces (standalone /updater and the fleet Overview's headless UpdaterPage) follow along with a 60s static-JSON re-read that repaints only when a generated_at stamp changed; timer released via dispose() on unmount, ticks skipped while hidden. - Empty states now say the first scan happens automatically; Check now stays as the immediate manual override. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: librelad <librelad@digitalangels.vip>
36 lines
1.6 KiB
JavaScript
36 lines
1.6 KiB
JavaScript
// components/updater/index.js — App Updater feature module.
|
|
//
|
|
// Per-app version tracking + CVE/security scanning + disaster-recovery
|
|
// (snapshot-before-update and rollback). Built in the same shape as the backup
|
|
// feature: a self-registering module whose mount() lazy-loads the controller,
|
|
// renders a fragment, and news the page object; unmount() releases its
|
|
// task-refresh registration. All state-changing actions go through the task
|
|
// system (libreportal updater …), never a new mutating API.
|
|
LP.features.register({
|
|
id: 'updater',
|
|
routes: ['/updater', '/updater*'],
|
|
scripts: ['/components/updater/js/updater-page.js'],
|
|
|
|
async mount(ctx) {
|
|
await ctx.loadScripts(this.scripts);
|
|
const html = await ctx.loadFragment('/components/updater/html/updater-content.html');
|
|
ctx.setContent(html, 'Updates');
|
|
if (typeof UpdaterPage === 'undefined') {
|
|
throw new Error('UpdaterPage controller failed to load');
|
|
}
|
|
window.updaterPage = new UpdaterPage(ctx.services);
|
|
await window.updaterPage.init();
|
|
},
|
|
|
|
async unmount(ctx) {
|
|
// Drop the task-refresh registration so a finished update/rollback task
|
|
// doesn't repaint a torn-down page. The page self-guards via
|
|
// (window.updaterPage === this); nulling it neutralises any pending work.
|
|
try { ctx.services.tasks.refresh && ctx.services.tasks.refresh.unregister('updater'); } catch (_) {}
|
|
// Release the auto-refresh timer that keeps the page in step with the
|
|
// host-side auto-scan.
|
|
try { window.updaterPage && window.updaterPage.dispose && window.updaterPage.dispose(); } catch (_) {}
|
|
window.updaterPage = null;
|
|
},
|
|
});
|