Comment-only tidy from the feng-shui audit — no code behavior changes. The features/ directory was renamed to components/ during modularization, but several header banners and inline comments still named the old path: - 6 component module headers (admin/tasks/backup/dashboard/updater/index.js + updater/js/updater-page.js) now name their real components/<id>/… path - core/kernel/js/spa.js + core/tasks/js/task-router.js comments - backend/routes/features.js doc-banner (drop a components/<id>/ folder …) - core/update-notifier/css/update-notifier.css header (js/update-notifier.js) Guarded the rewrite so the LIVE /api/features/list endpoint name (feature- registry.js sources + backend route) is untouched — only stale 'features/<path>' directory references were updated. Signed-off-by: librelad <librelad@digitalangels.vip>
33 lines
1.4 KiB
JavaScript
33 lines
1.4 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 (_) {}
|
|
window.updaterPage = null;
|
|
},
|
|
});
|