mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-14 07:24:52 +09:00
Merge pull request #1010 from bbassie/feature/plugin-browser
Plugin management through web interface
This commit is contained in:
1 parent
e36a76acc5
commit
ffe82f81d8
48 files changed
+4275
-536
No files matched your search
@@ -75,6 +75,8 @@ export default class Controller {
|
||||
hooks = new ControllerHooks(logger);
|
||||
/** Plugins which are currently loaded */
|
||||
loadedPlugins: Set<lib.PluginNodeEnvInfo> = new Set();
|
||||
/** Latest versions of plugins on npm, as shown on the plugins page */
|
||||
pluginLatestVersionCache: lib.LatestVersionCache = new Map();
|
||||
|
||||
/** WebSocket server */
|
||||
wsServer: WsServer;
|
||||
@@ -646,7 +648,9 @@ export default class Controller {
|
||||
requests.push(hostConnection.send(new lib.SystemInfoRequest()));
|
||||
}
|
||||
const restartRequired = await this.checkRestartRequired();
|
||||
requests.push(lib.gatherSystemInfo("controller", this.canRestart, restartRequired, this.startedAtMs));
|
||||
requests.push(lib.gatherSystemInfo(
|
||||
"controller", this.canRestart, restartRequired, this.startedAtMs, await this.listPlugins(),
|
||||
));
|
||||
const newMetrics = await Promise.all(requests);
|
||||
for (const metric of newMetrics) {
|
||||
this.systems.set(metric);
|
||||
@@ -656,6 +660,15 @@ export default class Controller {
|
||||
}
|
||||
}
|
||||
|
||||
/** Plugins on the controller, including those installed or updated since it started */
|
||||
async listPlugins() {
|
||||
return await lib.listPluginDetails(
|
||||
this.pluginInfos,
|
||||
pluginInfo => this.loadedPlugins.has(pluginInfo),
|
||||
pluginInfo => this.config.get(`${pluginInfo.name}.load_plugin`),
|
||||
);
|
||||
}
|
||||
|
||||
async checkRestartRequired() {
|
||||
if (this.config.restartRequired) {
|
||||
return true;
|
||||
|
||||
Reference in new issue
Block a user