mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-03-09 15:40:18 +00:00
More base updates, including web socket handling and display logic
This commit is contained in:
parent
aa32bac323
commit
ef79477d25
4 changed files with 86 additions and 8 deletions
30
agents/meshcore.min.js
vendored
30
agents/meshcore.min.js
vendored
|
@ -1491,6 +1491,36 @@ function createMeshCore(agent)
|
|||
// Unknown action, ignore it.
|
||||
break;
|
||||
}
|
||||
} else if (this.httprequest.protocol == 7) { // plugin data exchange
|
||||
var cmd = null;
|
||||
try { cmd = JSON.parse(data); } catch (e) { };
|
||||
if (cmd == null) { return; }
|
||||
if ((cmd.ctrlChannel == '102938') || ((cmd.type == 'offer') && (cmd.sdp != null))) { onTunnelControlData(cmd, this); return; } // If this is control data, handle it now.
|
||||
if (cmd.action == undefined) { return; }
|
||||
//sendConsoleText('CMD: ' + JSON.stringify(cmd));
|
||||
|
||||
if ((cmd.path != null) && (process.platform != 'win32') && (cmd.path[0] != '/')) { cmd.path = '/' + cmd.path; } // Add '/' to paths on non-windows
|
||||
//console.log(objToString(cmd, 0, ' '));
|
||||
|
||||
switch (cmd.action) {
|
||||
case 'plugin': {
|
||||
try {
|
||||
require(cmd.plugin).consoleaction(cmd, null, null, this);
|
||||
} catch (e) {
|
||||
/*var fs = require('fs');
|
||||
var logStream = fs.createWriteStream('log.txt', {'flags': 'a'});
|
||||
logStream.write('\nCouldnt load plugin '+e+e.stack);
|
||||
logStream.end('\n')*/
|
||||
throw e;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
// probably shouldn't happen, but just in case this feature is expanded
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//sendConsoleText("Got tunnel #" + this.httprequest.index + " data: " + data, this.httprequest.sessionid);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue