Final modularization layout (user-chosen): every page is a self-contained folder under components/<id>/ (controllers + CSS + its html fragment), and all shared/framework code folds into core/: core/kernel (feature-registry, lifecycle, services, spa) core/boot (auth, system-loader/orchestrator, setup, loaders) core/lib (data-loader, router, helpers, the task kernel, shared modules) core/ui (topbar, modal, notifications, … + topbar.html) core/css (all shared stylesheets) core/icons Top level is now just: components/, core/, themes/, index.html (+ runtime data/). Every path reference rewritten (index.html, scripts arrays, fetch()/ loadFragment()/loadScript() literals, system-loader + config-manager controller paths, kernel manifest URL, feature.json, backend FEATURES_DIR). The /api/features/list endpoint NAME is unchanged (it now scans components/). Deleted 3 dead files (app-content.html, apps-content.html, html-cache.js). Verified: 0 stale prefixes, 0 double-rewrites, all JS/JSON valid. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: librelad <librelad@digitalangels.vip>
33 lines
1.4 KiB
JavaScript
33 lines
1.4 KiB
JavaScript
// features/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/updater-page.js'],
|
|
|
|
async mount(ctx) {
|
|
await ctx.loadScripts(this.scripts);
|
|
const html = await ctx.loadFragment('/components/updater/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;
|
|
},
|
|
});
|