From 4baa484b84c5184286cac2743575251454a5ee2b Mon Sep 17 00:00:00 2001 From: Agando Date: Mon, 25 May 2026 18:02:02 +0200 Subject: auto: 2026-05-25_18:02 changes --- modules/core/module-modmgr.js | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 modules/core/module-modmgr.js (limited to 'modules/core/module-modmgr.js') diff --git a/modules/core/module-modmgr.js b/modules/core/module-modmgr.js new file mode 100644 index 0000000..1104883 --- /dev/null +++ b/modules/core/module-modmgr.js @@ -0,0 +1,40 @@ +// Extracted from newOS4 index.html — ModuleManagerModule + class ModuleManagerModule { + constructor() { this.commands = {}; this.terminal = null; } + getHelpInfo() { + return { + 'modules': 'modules — Open the module manager GUI', + 'listmods': 'listmods — List all loaded modules with status', + 'loadmod': 'loadmod — Load a module from a URL', + 'removemod': 'removemod — Remove a loaded module by name', + 'startup-modules': 'startup-modules — Open the startup modules selector', + 'load-local': 'load-local — Load a module from VFS or URL', + 'loadlocal': 'loadlocal — Alias for load-local', + }; + } + registerCommands() { + this.commands['modules'] = () => { this.terminal.openModuleManager(); }; + this.commands['loadmod'] = async (args) => { + if(!args[0]) return this.terminal.print("Usage: loadmod ", 'warning'); + await this.terminal.moduleManager.loadModuleFromURL(args[0]); + this.terminal.renderModuleList(); + }; + this.commands['removemod'] = (args) => { + if(!args[0]) return this.terminal.print("Usage: removemod ", 'warning'); + if(this.terminal.moduleManager.unregisterModule(args[0])) { + this.terminal.print(`Module '${args[0]}' removed`, 'success'); + } else { + this.terminal.print(`Module not found: ${args[0]}`, 'error'); + } + }; + this.commands['listmods'] = () => { + const mods = this.terminal.moduleManager.getModuleList(); + if(mods.length === 0) return this.terminal.print("No modules loaded"); + mods.forEach(m => { + const status = m.loaded ? '✓' : '✗'; + const badge = m.url ? '' : ' [Built-in]'; + this.terminal.print(`${status} ${m.name}${badge}`); + }); + }; + } + } -- cgit v1.2.3