mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-02-12 11:01:52 +00:00
Expand pluginHandler support to communicate with browser<->server over the control channel.
Expand plugin functionality on agents to get plugin commands as their own action.
This commit is contained in:
parent
39ab885174
commit
3e20fc5195
3 changed files with 7 additions and 19 deletions
|
@ -819,15 +819,7 @@ function createMeshCore(agent) {
|
||||||
case 'ping': { mesh.SendCommand('{"action":"pong"}'); break; }
|
case 'ping': { mesh.SendCommand('{"action":"pong"}'); break; }
|
||||||
case 'pong': { break; }
|
case 'pong': { break; }
|
||||||
case 'plugin': {
|
case 'plugin': {
|
||||||
if (typeof data.pluginaction == 'string') {
|
try { require(data.plugin).consoleaction(data, data.rights, data.sessionid, this); } catch (e) { throw e; }
|
||||||
try {
|
|
||||||
MeshServerLog('Plugin called', data);
|
|
||||||
// Not yet implemented
|
|
||||||
// require(data.plugin.name).serveraction(data);
|
|
||||||
} catch (e) {
|
|
||||||
MeshServerLog('Error calling plugin', data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
10
agents/meshcore.min.js
vendored
10
agents/meshcore.min.js
vendored
|
@ -819,15 +819,7 @@ function createMeshCore(agent) {
|
||||||
case 'ping': { mesh.SendCommand('{"action":"pong"}'); break; }
|
case 'ping': { mesh.SendCommand('{"action":"pong"}'); break; }
|
||||||
case 'pong': { break; }
|
case 'pong': { break; }
|
||||||
case 'plugin': {
|
case 'plugin': {
|
||||||
if (typeof data.pluginaction == 'string') {
|
try { require(data.plugin).consoleaction(data, data.rights, data.sessionid, this); } catch (e) { throw e; }
|
||||||
try {
|
|
||||||
MeshServerLog('Plugin called', data);
|
|
||||||
// Not yet implemented
|
|
||||||
// require(data.plugin.name).serveraction(data);
|
|
||||||
} catch (e) {
|
|
||||||
MeshServerLog('Error calling plugin', data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -50,6 +50,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
||||||
var obj = {};
|
var obj = {};
|
||||||
obj.user = user;
|
obj.user = user;
|
||||||
obj.domain = domain;
|
obj.domain = domain;
|
||||||
|
obj.ws = ws;
|
||||||
|
|
||||||
// Server side Intel AMT stack
|
// Server side Intel AMT stack
|
||||||
const WsmanComm = require('./amt/amt-wsman-comm.js');
|
const WsmanComm = require('./amt/amt-wsman-comm.js');
|
||||||
|
@ -3105,7 +3106,10 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
||||||
if (command.routeToNode === true) {
|
if (command.routeToNode === true) {
|
||||||
routeCommandToNode(command);
|
routeCommandToNode(command);
|
||||||
} else {
|
} else {
|
||||||
// TODO
|
try {
|
||||||
|
var pluginHandler = require('./pluginHandler.js').pluginHandler(parent.parent);
|
||||||
|
pluginHandler.plugins[command.plugin].serveraction(command, obj, parent);
|
||||||
|
} catch (e) { console.log('Error loading plugin handler (' + e + ')'); }
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue