1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-03-09 15:40:18 +00:00

Improvements to plugin support.

This commit is contained in:
Ylian Saint-Hilaire 2019-10-10 11:13:25 -07:00
parent 5bc3da5bf6
commit ac5b6a9d73
11 changed files with 15748 additions and 561 deletions

View file

@ -31,6 +31,7 @@ function CreateMeshCentralServer(config, args) {
obj.swarmserver = null;
obj.mailserver = null;
obj.amtEventHandler = null;
obj.pluginHandler = null;
obj.amtScanner = null;
obj.meshScanner = null;
obj.letsencrypt = null;
@ -702,6 +703,11 @@ function CreateMeshCentralServer(config, args) {
return;
}
// Start plugin manager if configuration allows this.
if ((obj.config) && (obj.config.settings) && (obj.config.settings.plugins != null)) {
obj.pluginHandler = require("./pluginHandler.js").pluginHandler(obj);
}
// Load the default meshcore and meshcmd
obj.updateMeshCore();
obj.updateMeshCmd();
@ -865,10 +871,8 @@ function CreateMeshCentralServer(config, args) {
// Dispatch an event that the server is now running
obj.DispatchEvent(['*'], obj, { etype: 'server', action: 'started', msg: 'Server started' });
obj.pluginHandler = require("./pluginHandler.js").pluginHandler(obj);
// Plugin hook. Need to run something at server startup? This is the place.
obj.pluginHandler.callHook("server_startup");
if (obj.pluginHandler) { obj.pluginHandler.callHook("server_startup"); }
// Load the login cookie encryption key from the database if allowed
if ((obj.config) && (obj.config.settings) && (obj.config.settings.allowlogintoken == true)) {
@ -1352,8 +1356,10 @@ function CreateMeshCentralServer(config, args) {
}
}
}
obj.pluginHandler = require("./pluginHandler.js").pluginHandler(obj);
obj.pluginHandler.addMeshCoreModules(modulesAdd);
// Add plugins to cores
if (obj.pluginHandler) { obj.pluginHandler.addMeshCoreModules(modulesAdd); }
// Merge the cores and compute the hashes
for (var i in modulesAdd) {
if ((i == 'windows-recovery') || (i == 'linux-recovery')) {