Add loading of web plugins in interface

Add separate BaseWebPlugin class which plugins can extend and expose
through a webEntrypoint in a similar fasion to the existing master,
instance and control entrypoints.

To simplify the logic for the rest of the web interface code the plugins
context is changed to be a mapping of loaded WebPlugin instances.  This
in turn means the plugins and plugin view pages fetches the plugin list
upon load in order to show plugins that failed to load (which
incidentally also gives them an up to date list).
This commit is contained in:
Hornwitser committed 2021-03-13 21:01:53 +01:00
1 parent 6c4e094d44
commit 5ce3fb6cc6
6 files changed
+140 -45

No files matched your search

+2 -1
View File
@@ -275,7 +275,8 @@ app.get("/api/plugins", (req, res) => {
for (let pluginInfo of pluginInfos) {
let name = pluginInfo.name;
let loaded = masterPlugins.has(name);
plugins.push({ name, version: pluginInfo.version, loaded });
let enabled = loaded && masterConfig.group(pluginInfo.name).get("load_plugin");
plugins.push({ name, version: pluginInfo.version, enabled, loaded });
}
res.send(plugins);
});