mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-12-25 22:55:52 -05:00
Merge pull request #610 from ryanblenis/plugin
Expand PluginHandler to Support Periodic Updates
This commit is contained in:
commit
630c760d13
@ -2573,7 +2573,7 @@ function createMeshCore(agent) {
|
|||||||
if ((meshCoreObj.av == null) || (JSON.stringify(meshCoreObj.av) != JSON.stringify(av))) { meshCoreObj.av = av; mesh.SendCommand(meshCoreObj); }
|
if ((meshCoreObj.av == null) || (JSON.stringify(meshCoreObj.av) != JSON.stringify(av))) { meshCoreObj.av = av; mesh.SendCommand(meshCoreObj); }
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: add plugin hook here
|
mesh.SendCommand({ action: "plugin", plugin: "__all", hook: "sendPeriodicServerUpdate"});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
2
agents/meshcore.min.js
vendored
2
agents/meshcore.min.js
vendored
@ -2517,7 +2517,7 @@ function createMeshCore(agent) {
|
|||||||
if ((meshCoreObj.av == null) || (JSON.stringify(meshCoreObj.av) != JSON.stringify(av))) { meshCoreObj.av = av; mesh.SendCommand(meshCoreObj); }
|
if ((meshCoreObj.av == null) || (JSON.stringify(meshCoreObj.av) != JSON.stringify(av))) { meshCoreObj.av = av; mesh.SendCommand(meshCoreObj); }
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: add plugin hook here
|
mesh.SendCommand({ action: "plugin", plugin: "__all", hook: "sendPeriodicServerUpdate"});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1278,7 +1278,11 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
|
|||||||
if (typeof command.plugin != 'string') break;
|
if (typeof command.plugin != 'string') break;
|
||||||
try {
|
try {
|
||||||
var pluginHandler = require('./pluginHandler.js').pluginHandler(parent.parent);
|
var pluginHandler = require('./pluginHandler.js').pluginHandler(parent.parent);
|
||||||
|
if (command.plugin == '__all') {
|
||||||
|
pluginHandler.callHook(command.hook, command, obj, parent);
|
||||||
|
} else {
|
||||||
pluginHandler.plugins[command.plugin].serveraction(command, obj, parent);
|
pluginHandler.plugins[command.plugin].serveraction(command, obj, parent);
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('Error loading plugin handler (' + e + ')');
|
console.log('Error loading plugin handler (' + e + ')');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user