mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-03-09 15:40:18 +00:00
Merge branch 'master' of https://github.com/Ylianst/MeshCentral
This commit is contained in:
commit
993f3c2777
50 changed files with 9824 additions and 8954 deletions
|
@ -754,6 +754,15 @@ function createMeshCore(agent) {
|
|||
for (var i in data.macs) { sendWakeOnLan(data.macs[i]); }
|
||||
break;
|
||||
}
|
||||
case 'uninstallagent':
|
||||
// Uninstall this agent
|
||||
var agentName = process.platform == 'win32' ? 'Mesh Agent' : 'meshagent';
|
||||
if (require('service-manager').manager.getService(agentName).isMe()) {
|
||||
try { diagnosticAgent_uninstall(); } catch (x) { }
|
||||
var js = "require('service-manager').manager.getService('" + agentName + "').stop(); require('service-manager').manager.uninstallService('" + agentName + "'); process.exit();";
|
||||
this.child = require('child_process').execFile(process.execPath, [process.platform == 'win32' ? (process.execPath.split('\\').pop()) : (process.execPath.split('/').pop()), '-b64exec', Buffer.from(js).toString('base64')], { type: 4, detached: true });
|
||||
}
|
||||
break;
|
||||
case 'poweraction': {
|
||||
// Server telling us to execute a power action
|
||||
if ((mesh.ExecPowerState != undefined) && (data.actiontype)) {
|
||||
|
@ -810,15 +819,7 @@ function createMeshCore(agent) {
|
|||
case 'ping': { mesh.SendCommand('{"action":"pong"}'); break; }
|
||||
case 'pong': { break; }
|
||||
case 'plugin': {
|
||||
if (typeof data.pluginaction == 'string') {
|
||||
try {
|
||||
MeshServerLog('Plugin called', data);
|
||||
// Not yet implemented
|
||||
// require(data.plugin.name).serveraction(data);
|
||||
} catch (e) {
|
||||
MeshServerLog('Error calling plugin', data);
|
||||
}
|
||||
}
|
||||
try { require(data.plugin).consoleaction(data, data.rights, data.sessionid, this); } catch (e) { throw e; }
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -1998,17 +1999,12 @@ function createMeshCore(agent) {
|
|||
}
|
||||
break;
|
||||
}
|
||||
case 'uninstallagent':
|
||||
case 'uninstallagent': // Uninstall this agent
|
||||
var agentName = process.platform == 'win32' ? 'Mesh Agent' : 'meshagent';
|
||||
if (!require('service-manager').manager.getService(agentName).isMe()) {
|
||||
response = 'Uininstall failed, this instance is not the service instance';
|
||||
}
|
||||
else {
|
||||
try {
|
||||
diagnosticAgent_uninstall();
|
||||
}
|
||||
catch (x) {
|
||||
}
|
||||
} else {
|
||||
try { diagnosticAgent_uninstall(); } catch (x) { }
|
||||
var js = "require('service-manager').manager.getService('" + agentName + "').stop(); require('service-manager').manager.uninstallService('" + agentName + "'); process.exit();";
|
||||
this.child = require('child_process').execFile(process.execPath, [process.platform == 'win32' ? (process.execPath.split('\\').pop()) : (process.execPath.split('/').pop()), '-b64exec', Buffer.from(js).toString('base64')], { type: 4, detached: true });
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue