mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-03-09 15:40:18 +00:00
Compare commits
22 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
88a765bb13 | ||
|
|
7ad4b917be | ||
|
|
d10173a018 | ||
|
|
0e3a6b4915 | ||
|
|
b949cecc5f | ||
|
|
c7cbf2f12a | ||
|
|
d49afdd7bf | ||
|
|
133e77c8c6 | ||
|
|
e404e86b9f | ||
|
|
c6da201af8 | ||
|
|
9a27d7637c | ||
|
|
5aa2467409 | ||
|
|
9398afd07e | ||
|
|
b2cd84035b | ||
|
|
97547d72a3 | ||
|
|
7faf043c35 | ||
|
|
9df0330896 | ||
|
|
42f61ea46e | ||
|
|
0d65080a8a | ||
|
|
bd4d8b12d4 | ||
|
|
18ae8bdbf4 | ||
|
|
46c76f7234 |
30 changed files with 10836 additions and 10409 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -295,8 +295,9 @@ if (process.platform == 'win32' && require('user-sessions').isRoot()) {
|
||||||
// Check the Agent Uninstall MetaData for correctness, as the installer may have written an incorrect value
|
// Check the Agent Uninstall MetaData for correctness, as the installer may have written an incorrect value
|
||||||
try {
|
try {
|
||||||
var writtenSize = 0, actualSize = Math.floor(require('fs').statSync(process.execPath).size / 1024);
|
var writtenSize = 0, actualSize = Math.floor(require('fs').statSync(process.execPath).size / 1024);
|
||||||
try { writtenSize = require('win-registry').QueryKey(require('win-registry').HKEY.LocalMachine, 'Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MeshCentralAgent', 'EstimatedSize'); } catch (ex) { }
|
var serviceName = (_MSH().serviceName ? _MSH().serviceName : (require('_agentNodeId').serviceName() ? require('_agentNodeId').serviceName() : 'Mesh Agent'));
|
||||||
if (writtenSize != actualSize) { try { require('win-registry').WriteKey(require('win-registry').HKEY.LocalMachine, 'Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MeshCentralAgent', 'EstimatedSize', actualSize); } catch (ex) { } }
|
try { writtenSize = require('win-registry').QueryKey(require('win-registry').HKEY.LocalMachine, 'Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\' + serviceName, 'EstimatedSize'); } catch (ex) { }
|
||||||
|
if (writtenSize != actualSize) { try { require('win-registry').WriteKey(require('win-registry').HKEY.LocalMachine, 'Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\' + serviceName, 'EstimatedSize', actualSize); } catch (ex) { } }
|
||||||
} catch (ex) { }
|
} catch (ex) { }
|
||||||
|
|
||||||
// Check to see if we are the Installed Mesh Agent Service, if we are, make sure we can run in Safe Mode
|
// Check to see if we are the Installed Mesh Agent Service, if we are, make sure we can run in Safe Mode
|
||||||
|
|
@ -310,6 +311,16 @@ if (process.platform == 'win32' && require('user-sessions').isRoot()) {
|
||||||
try { meshCheck = require('service-manager').manager.getService(svcname).isMe(); } catch (ex) { }
|
try { meshCheck = require('service-manager').manager.getService(svcname).isMe(); } catch (ex) { }
|
||||||
if (meshCheck && require('win-bcd').isSafeModeService && !require('win-bcd').isSafeModeService(svcname)) { require('win-bcd').enableSafeModeService(svcname); }
|
if (meshCheck && require('win-bcd').isSafeModeService && !require('win-bcd').isSafeModeService(svcname)) { require('win-bcd').enableSafeModeService(svcname); }
|
||||||
} catch (ex) { }
|
} catch (ex) { }
|
||||||
|
|
||||||
|
// Check the Agent Uninstall MetaData for DisplayVersion and update if not the same and only on windows
|
||||||
|
if (process.platform == 'win32') {
|
||||||
|
try {
|
||||||
|
var writtenDisplayVersion = 0, actualDisplayVersion = process.versions.commitDate.toString();
|
||||||
|
var serviceName = (_MSH().serviceName ? _MSH().serviceName : (require('_agentNodeId').serviceName() ? require('_agentNodeId').serviceName() : 'Mesh Agent'));
|
||||||
|
try { writtenDisplayVersion = require('win-registry').QueryKey(require('win-registry').HKEY.LocalMachine, 'Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\' + serviceName, 'DisplayVersion'); } catch (ex) { }
|
||||||
|
if (writtenDisplayVersion != actualDisplayVersion) { try { require('win-registry').WriteKey(require('win-registry').HKEY.LocalMachine, 'Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\' + serviceName, 'DisplayVersion', actualDisplayVersion); } catch (ex) { } }
|
||||||
|
} catch (ex) { }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process.platform != 'win32') {
|
if (process.platform != 'win32') {
|
||||||
|
|
@ -2752,10 +2763,10 @@ function kvm_consent_ask(ws){
|
||||||
return (this.consent);
|
return (this.consent);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
pr = require('message-box').create(consentTitle, consentMessage, ws.httprequest.consentTimeout, null, this.tsid);
|
pr = require('message-box').create(consentTitle, consentMessage, ws.httprequest.consentTimeout, null, ws.tsid);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pr = require('message-box').create(consentTitle, consentMessage, ws.httprequest.consentTimeout, null, this.tsid);
|
pr = require('message-box').create(consentTitle, consentMessage, ws.httprequest.consentTimeout, null, ws.tsid);
|
||||||
}
|
}
|
||||||
pr.ws = ws;
|
pr.ws = ws;
|
||||||
ws.pause();
|
ws.pause();
|
||||||
|
|
@ -4573,10 +4584,11 @@ function processConsoleCommand(cmd, args, rights, sessionid) {
|
||||||
if (process.platform == 'win32') {
|
if (process.platform == 'win32') {
|
||||||
// Check the Agent Uninstall MetaData for correctness, as the installer may have written an incorrect value
|
// Check the Agent Uninstall MetaData for correctness, as the installer may have written an incorrect value
|
||||||
var writtenSize = 0;
|
var writtenSize = 0;
|
||||||
try { writtenSize = require('win-registry').QueryKey(require('win-registry').HKEY.LocalMachine, 'Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MeshCentralAgent', 'EstimatedSize'); } catch (ex) { response = ex; }
|
var serviceName = (_MSH().serviceName ? _MSH().serviceName : (require('_agentNodeId').serviceName() ? require('_agentNodeId').serviceName() : 'Mesh Agent'));
|
||||||
|
try { writtenSize = require('win-registry').QueryKey(require('win-registry').HKEY.LocalMachine, 'Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\' + serviceName, 'EstimatedSize'); } catch (ex) { response = ex; }
|
||||||
if (writtenSize != actualSize) {
|
if (writtenSize != actualSize) {
|
||||||
response = "Size updated from: " + writtenSize + " to: " + actualSize;
|
response = "Size updated from: " + writtenSize + " to: " + actualSize;
|
||||||
try { require('win-registry').WriteKey(require('win-registry').HKEY.LocalMachine, 'Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MeshCentralAgent', 'EstimatedSize', actualSize); } catch (ex) { response = ex; }
|
try { require('win-registry').WriteKey(require('win-registry').HKEY.LocalMachine, 'Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\' + serviceName, 'EstimatedSize', actualSize); } catch (ex) { response = ex; }
|
||||||
} else
|
} else
|
||||||
{ response = "Agent Size: " + actualSize + " kb"; }
|
{ response = "Agent Size: " + actualSize + " kb"; }
|
||||||
} else
|
} else
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -123,6 +123,10 @@ Use of the optional file `plugin_name.js` in the optional folder `modules_meshco
|
||||||
Much of MeshCentral revolves around returning objects for your structures, and plugins are no different. Within your plugin you can traverse all the way up to the web server and MeshCentral Server classes to access all the functionality those layers provide. This is done by passing the current object to newly created objects, and assigning that reference to a `parent` variable within that object.
|
Much of MeshCentral revolves around returning objects for your structures, and plugins are no different. Within your plugin you can traverse all the way up to the web server and MeshCentral Server classes to access all the functionality those layers provide. This is done by passing the current object to newly created objects, and assigning that reference to a `parent` variable within that object.
|
||||||
|
|
||||||
|
|
||||||
|
## Ping-Pong
|
||||||
|
|
||||||
|
If you build a plugin which makes use of `meshrelay.ashx`, keep in mind to either handle ping-pong messages (`serverPing`, `serverPong`) on the control channel or to request MeshCentral to not send such messages through sending the `noping=1` parameter in the connection URL. For a deeper sight search for "PING/PONG" in `meshrelay.js`.
|
||||||
|
|
||||||
## Versioning
|
## Versioning
|
||||||
|
|
||||||
Versioning your plugin correctly and consistently is essential to ensure users of your plugin are prompted to upgrade when it is available. Semantic versioning is recommended.
|
Versioning your plugin correctly and consistently is essential to ensure users of your plugin are prompted to upgrade when it is available. Semantic versioning is recommended.
|
||||||
|
|
|
||||||
2
mcrec.js
2
mcrec.js
|
|
@ -321,7 +321,7 @@ function setup() { InstallModules(['image-size'], start); }
|
||||||
function start() { startEx(process.argv); }
|
function start() { startEx(process.argv); }
|
||||||
function startEx(argv) {
|
function startEx(argv) {
|
||||||
if (argv.length > 2) { indexFile(argv[2]); } else {
|
if (argv.length > 2) { indexFile(argv[2]); } else {
|
||||||
log("MeshCentral Session Recodings Processor");
|
log("MeshCentral Session Recordings Processor");
|
||||||
log("This tool will index a .mcrec file so that the player can seek thru the file.");
|
log("This tool will index a .mcrec file so that the player can seek thru the file.");
|
||||||
log("");
|
log("");
|
||||||
log(" Usage: node mcrec [file]");
|
log(" Usage: node mcrec [file]");
|
||||||
|
|
|
||||||
|
|
@ -583,6 +583,8 @@ function CreateMeshCentralServer(config, args) {
|
||||||
// Launch MeshCentral as a child server and monitor it.
|
// Launch MeshCentral as a child server and monitor it.
|
||||||
obj.launchChildServer = function (startArgs) {
|
obj.launchChildServer = function (startArgs) {
|
||||||
const child_process = require('child_process');
|
const child_process = require('child_process');
|
||||||
|
const isInspectorAttached = (()=> { try { return require('node:inspector').url() !== undefined; } catch (_) { return false; } }).call();
|
||||||
|
const logFromChildProcess = isInspectorAttached ? () => {} : console.log.bind(console);
|
||||||
try { if (process.traceDeprecation === true) { startArgs.unshift('--trace-deprecation'); } } catch (ex) { }
|
try { if (process.traceDeprecation === true) { startArgs.unshift('--trace-deprecation'); } } catch (ex) { }
|
||||||
try { if (process.traceProcessWarnings === true) { startArgs.unshift('--trace-warnings'); } } catch (ex) { }
|
try { if (process.traceProcessWarnings === true) { startArgs.unshift('--trace-warnings'); } } catch (ex) { }
|
||||||
if (startArgs[0] != "--disable-proto=delete") startArgs.unshift("--disable-proto=delete")
|
if (startArgs[0] != "--disable-proto=delete") startArgs.unshift("--disable-proto=delete")
|
||||||
|
|
@ -657,12 +659,12 @@ function CreateMeshCentralServer(config, args) {
|
||||||
else if (data.indexOf('Starting self upgrade to: ') >= 0) { obj.args.specificupdate = data.substring(26).split('\r')[0].split('\n')[0]; childProcess.xrestart = 3; }
|
else if (data.indexOf('Starting self upgrade to: ') >= 0) { obj.args.specificupdate = data.substring(26).split('\r')[0].split('\n')[0]; childProcess.xrestart = 3; }
|
||||||
var datastr = data;
|
var datastr = data;
|
||||||
while (datastr.endsWith('\r') || datastr.endsWith('\n')) { datastr = datastr.substring(0, datastr.length - 1); }
|
while (datastr.endsWith('\r') || datastr.endsWith('\n')) { datastr = datastr.substring(0, datastr.length - 1); }
|
||||||
console.log(datastr);
|
logFromChildProcess(datastr);
|
||||||
});
|
});
|
||||||
childProcess.stderr.on('data', function (data) {
|
childProcess.stderr.on('data', function (data) {
|
||||||
var datastr = data;
|
var datastr = data;
|
||||||
while (datastr.endsWith('\r') || datastr.endsWith('\n')) { datastr = datastr.substring(0, datastr.length - 1); }
|
while (datastr.endsWith('\r') || datastr.endsWith('\n')) { datastr = datastr.substring(0, datastr.length - 1); }
|
||||||
console.log('ERR: ' + datastr);
|
logFromChildProcess('ERR: ' + datastr);
|
||||||
if (data.startsWith('le.challenges[tls-sni-01].loopback')) { return; } // Ignore this error output from GreenLock
|
if (data.startsWith('le.challenges[tls-sni-01].loopback')) { return; } // Ignore this error output from GreenLock
|
||||||
if (data[data.length - 1] == '\n') { data = data.substring(0, data.length - 1); }
|
if (data[data.length - 1] == '\n') { data = data.substring(0, data.length - 1); }
|
||||||
obj.logError(data);
|
obj.logError(data);
|
||||||
|
|
|
||||||
|
|
@ -847,7 +847,7 @@ function CreateDesktopMultiplexor(parent, domain, nodeid, id, func) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Write the recording file header
|
// Write the recording file header
|
||||||
parent.parent.debug('relay', 'Relay: Started recoding to file: ' + recFullFilename);
|
parent.parent.debug('relay', 'Relay: Started recording to file: ' + recFullFilename);
|
||||||
var metadata = { magic: 'MeshCentralRelaySession', ver: 1, nodeid: obj.nodeid, meshid: obj.meshid, time: new Date().toLocaleString(), protocol: 2, devicename: obj.name, devicegroup: obj.meshname };
|
var metadata = { magic: 'MeshCentralRelaySession', ver: 1, nodeid: obj.nodeid, meshid: obj.meshid, time: new Date().toLocaleString(), protocol: 2, devicename: obj.name, devicegroup: obj.meshname };
|
||||||
var firstBlock = JSON.stringify(metadata);
|
var firstBlock = JSON.stringify(metadata);
|
||||||
recordingEntry(fd, 1, 0, firstBlock, function () {
|
recordingEntry(fd, 1, 0, firstBlock, function () {
|
||||||
|
|
|
||||||
|
|
@ -445,15 +445,15 @@ function CreateMeshRelayEx(parent, ws, req, domain, user, cookie) {
|
||||||
relayinfo.peer1.sendPeerImage();
|
relayinfo.peer1.sendPeerImage();
|
||||||
} else {
|
} else {
|
||||||
// Write the recording file header
|
// Write the recording file header
|
||||||
parent.parent.debug('relay', 'Relay: Started recoding to file: ' + recFullFilename);
|
parent.parent.debug('relay', 'Relay: Started recording to file: ' + recFullFilename);
|
||||||
var metadata = {
|
var metadata = {
|
||||||
magic: 'MeshCentralRelaySession',
|
magic: 'MeshCentralRelaySession',
|
||||||
ver: 1,
|
ver: 1,
|
||||||
userid: sessionUser._id,
|
userid: sessionUser._id,
|
||||||
username: sessionUser.name,
|
username: sessionUser.name,
|
||||||
sessionid: obj.id,
|
sessionid: obj.id,
|
||||||
ipaddr1: (obj.req == null) ? null : obj.req.clientIp,
|
ipaddr1: ((obj.peer == null) || (obj.peer.req == null)) ? null : obj.peer.req.clientIp,
|
||||||
ipaddr2: ((obj.peer == null) || (obj.peer.req == null)) ? null : obj.peer.req.clientIp,
|
ipaddr2: (obj.req == null) ? null : obj.req.clientIp,
|
||||||
time: new Date().toLocaleString(),
|
time: new Date().toLocaleString(),
|
||||||
protocol: (((obj.req == null) || (obj.req.query == null)) ? null : obj.req.query.p),
|
protocol: (((obj.req == null) || (obj.req.query == null)) ? null : obj.req.query.p),
|
||||||
nodeid: (((obj.req == null) || (obj.req.query == null)) ? null : obj.req.query.nodeid)
|
nodeid: (((obj.req == null) || (obj.req.query == null)) ? null : obj.req.query.nodeid)
|
||||||
|
|
@ -512,7 +512,7 @@ function CreateMeshRelayEx(parent, ws, req, domain, user, cookie) {
|
||||||
if (obj.req.query.p == 1) { msg = 'Started terminal session'; msgid = 14; }
|
if (obj.req.query.p == 1) { msg = 'Started terminal session'; msgid = 14; }
|
||||||
else if (obj.req.query.p == 2) { msg = 'Started desktop session'; msgid = 15; }
|
else if (obj.req.query.p == 2) { msg = 'Started desktop session'; msgid = 15; }
|
||||||
else if (obj.req.query.p == 5) { msg = 'Started file management session'; msgid = 16; }
|
else if (obj.req.query.p == 5) { msg = 'Started file management session'; msgid = 16; }
|
||||||
var event = { etype: 'relay', action: 'relaylog', domain: domain.id, userid: sessionUser._id, username: sessionUser.name, msgid: msgid, msgArgs: [obj.id, req.clientIp, obj.peer.req.clientIp], msg: msg + ' \"' + obj.id + '\" from ' + req.clientIp + ' to ' + obj.peer.req.clientIp, protocol: req.query.p, nodeid: req.query.nodeid };
|
var event = { etype: 'relay', action: 'relaylog', domain: domain.id, userid: sessionUser._id, username: sessionUser.name, msgid: msgid, msgArgs: [obj.id, obj.peer.req.clientIp, req.clientIp], msg: msg + ' \"' + obj.id + '\" from ' + obj.peer.req.clientIp + ' to ' + req.clientIp, protocol: req.query.p, nodeid: req.query.nodeid };
|
||||||
if (obj.guestname) { event.guestname = obj.guestname; } else if (relayinfo.peer1.guestname) { event.guestname = relayinfo.peer1.guestname; } // If this is a sharing session, set the guest name here.
|
if (obj.guestname) { event.guestname = obj.guestname; } else if (relayinfo.peer1.guestname) { event.guestname = relayinfo.peer1.guestname; } // If this is a sharing session, set the guest name here.
|
||||||
parent.parent.DispatchEvent(['*', sessionUser._id], obj, event);
|
parent.parent.DispatchEvent(['*', sessionUser._id], obj, event);
|
||||||
|
|
||||||
|
|
|
||||||
38
meshuser.js
38
meshuser.js
|
|
@ -601,11 +601,11 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
||||||
}
|
}
|
||||||
if (typeof domain.userconsentflags == 'number') { serverinfo.consent = domain.userconsentflags; }
|
if (typeof domain.userconsentflags == 'number') { serverinfo.consent = domain.userconsentflags; }
|
||||||
if ((typeof domain.usersessionidletimeout == 'number') && (domain.usersessionidletimeout > 0)) {serverinfo.timeout = (domain.usersessionidletimeout * 60 * 1000); }
|
if ((typeof domain.usersessionidletimeout == 'number') && (domain.usersessionidletimeout > 0)) {serverinfo.timeout = (domain.usersessionidletimeout * 60 * 1000); }
|
||||||
if (typeof domain.logoutOnIdleSessionTimeout == 'boolean') {
|
if (typeof domain.logoutonidlesessiontimeout == 'boolean') {
|
||||||
serverinfo.logoutOnIdleSessionTimeout = domain.logoutOnIdleSessionTimeout;
|
serverinfo.logoutonidlesessiontimeout = domain.logoutonidlesessiontimeout;
|
||||||
} else {
|
} else {
|
||||||
// Default
|
// Default
|
||||||
serverinfo.logoutOnIdleSessionTimeout = true;
|
serverinfo.logoutonidlesessiontimeout = true;
|
||||||
}
|
}
|
||||||
if (user.siteadmin === SITERIGHT_ADMIN) {
|
if (user.siteadmin === SITERIGHT_ADMIN) {
|
||||||
if (parent.parent.config.settings.managealldevicegroups.indexOf(user._id) >= 0) { serverinfo.manageAllDeviceGroups = true; }
|
if (parent.parent.config.settings.managealldevicegroups.indexOf(user._id) >= 0) { serverinfo.manageAllDeviceGroups = true; }
|
||||||
|
|
@ -3079,16 +3079,6 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
||||||
}
|
}
|
||||||
if (commandsOk == true) {
|
if (commandsOk == true) {
|
||||||
var theCommand = { action: 'runcommands', type: command.type, cmds: command.cmds, runAsUser: command.runAsUser, reply: command.reply, responseid: command.responseid };
|
var theCommand = { action: 'runcommands', type: command.type, cmds: command.cmds, runAsUser: command.runAsUser, reply: command.reply, responseid: command.responseid };
|
||||||
if (parent.parent.multiServer != null) { // peering setup
|
|
||||||
// Send the commands to the agent
|
|
||||||
parent.parent.multiServer.DispatchMessage({ action: 'agentCommand', nodeid: node._id, command: theCommand});
|
|
||||||
if (command.responseid != null && command.reply == false) { try { ws.send(JSON.stringify({ action: 'runcommands', responseid: command.responseid, result: 'OK' })); } catch (ex) { } }
|
|
||||||
// Send out an event that these commands where run on this device
|
|
||||||
var targets = parent.CreateNodeDispatchTargets(node.meshid, node._id, ['server-users', user._id]);
|
|
||||||
var event = { etype: 'node', userid: user._id, username: user.name, nodeid: node._id, action: 'runcommands', msg: 'Running commands', msgid: msgid, cmds: command.cmds, cmdType: command.type, runAsUser: command.runAsUser, domain: domain.id };
|
|
||||||
parent.parent.multiServer.DispatchEvent(targets, obj, event);
|
|
||||||
} else { // normal setup
|
|
||||||
// Get the agent and run the commands
|
|
||||||
var agent = parent.wsagents[node._id];
|
var agent = parent.wsagents[node._id];
|
||||||
if ((agent != null) && (agent.authenticated == 2) && (agent.agentInfo != null)) {
|
if ((agent != null) && (agent.authenticated == 2) && (agent.agentInfo != null)) {
|
||||||
// Send the commands to the agent
|
// Send the commands to the agent
|
||||||
|
|
@ -3098,10 +3088,17 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
||||||
var targets = parent.CreateNodeDispatchTargets(node.meshid, node._id, ['server-users', user._id]);
|
var targets = parent.CreateNodeDispatchTargets(node.meshid, node._id, ['server-users', user._id]);
|
||||||
var event = { etype: 'node', userid: user._id, username: user.name, nodeid: node._id, action: 'runcommands', msg: 'Running commands', msgid: msgid, cmds: command.cmds, cmdType: command.type, runAsUser: command.runAsUser, domain: domain.id };
|
var event = { etype: 'node', userid: user._id, username: user.name, nodeid: node._id, action: 'runcommands', msg: 'Running commands', msgid: msgid, cmds: command.cmds, cmdType: command.type, runAsUser: command.runAsUser, domain: domain.id };
|
||||||
parent.parent.DispatchEvent(targets, obj, event);
|
parent.parent.DispatchEvent(targets, obj, event);
|
||||||
|
} else if (parent.parent.multiServer != null) { // peering setup
|
||||||
|
// Send the commands to the agent
|
||||||
|
parent.parent.multiServer.DispatchMessage({ action: 'agentCommand', nodeid: node._id, command: theCommand});
|
||||||
|
if (command.responseid != null && command.reply == false) { try { ws.send(JSON.stringify({ action: 'runcommands', responseid: command.responseid, result: 'OK' })); } catch (ex) { } }
|
||||||
|
// Send out an event that these commands where run on this device
|
||||||
|
var targets = parent.CreateNodeDispatchTargets(node.meshid, node._id, ['server-users', user._id]);
|
||||||
|
var event = { etype: 'node', userid: user._id, username: user.name, nodeid: node._id, action: 'runcommands', msg: 'Running commands', msgid: msgid, cmds: command.cmds, cmdType: command.type, runAsUser: command.runAsUser, domain: domain.id };
|
||||||
|
parent.parent.multiServer.DispatchEvent(targets, obj, event);
|
||||||
} else {
|
} else {
|
||||||
if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'runcommands', responseid: command.responseid, result: 'Agent not connected' })); } catch (ex) { } }
|
if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'runcommands', responseid: command.responseid, result: 'Agent not connected' })); } catch (ex) { } }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'runcommands', responseid: command.responseid, result: 'Invalid command type' })); } catch (ex) { } }
|
if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'runcommands', responseid: command.responseid, result: 'Invalid command type' })); } catch (ex) { } }
|
||||||
}
|
}
|
||||||
|
|
@ -5080,9 +5077,18 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
||||||
if ((common.validateStrArray(command.nodeids, 1) == false) && (command.nodeids != null)) break; // Check nodeids
|
if ((common.validateStrArray(command.nodeids, 1) == false) && (command.nodeids != null)) break; // Check nodeids
|
||||||
if (common.validateString(command.type, 3, 4) == false) break; // Check type
|
if (common.validateString(command.type, 3, 4) == false) break; // Check type
|
||||||
|
|
||||||
|
const links = parent.GetAllMeshIdWithRights(user);
|
||||||
|
const extraids = getUserExtraIds();
|
||||||
|
db.GetAllTypeNoTypeFieldMeshFiltered(links, extraids, domain.id, 'node', null, obj.deviceSkip, obj.deviceLimit, function (err, docs) {
|
||||||
|
if (docs == null) return;
|
||||||
|
const ids = [];
|
||||||
|
if (command.nodeids != null) {
|
||||||
// Create a list of node ids and query them for last device connection time
|
// Create a list of node ids and query them for last device connection time
|
||||||
const ids = []
|
|
||||||
for (var i in command.nodeids) { ids.push('lc' + command.nodeids[i]); }
|
for (var i in command.nodeids) { ids.push('lc' + command.nodeids[i]); }
|
||||||
|
} else {
|
||||||
|
// Create a list of node ids for this user and query them for last device connection time
|
||||||
|
for (var i in docs) { ids.push('lc' + docs[i]._id); }
|
||||||
|
}
|
||||||
db.GetAllIdsOfType(ids, domain.id, 'lastconnect', function (err, docs) {
|
db.GetAllIdsOfType(ids, domain.id, 'lastconnect', function (err, docs) {
|
||||||
const lastConnects = {};
|
const lastConnects = {};
|
||||||
if (docs != null) { for (var i in docs) { lastConnects[docs[i]._id] = docs[i]; } }
|
if (docs != null) { for (var i in docs) { lastConnects[docs[i]._id] = docs[i]; } }
|
||||||
|
|
@ -5358,7 +5364,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
||||||
try { ws.send(JSON.stringify({ action: 'getDeviceDetails', data: output, type: type })); } catch (ex) { }
|
try { ws.send(JSON.stringify({ action: 'getDeviceDetails', data: output, type: type })); } catch (ex) { }
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'endDesktopMultiplex': {
|
case 'endDesktopMultiplex': {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "meshcentral",
|
"name": "meshcentral",
|
||||||
"version": "1.1.39",
|
"version": "1.1.42",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"Remote Device Management",
|
"Remote Device Management",
|
||||||
"Remote Device Monitoring",
|
"Remote Device Monitoring",
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,7 @@ module.exports.pluginHandler = function (parent) {
|
||||||
try {
|
try {
|
||||||
obj.plugins[p][hookName](...args);
|
obj.plugins[p][hookName](...args);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log("Error occurred while running plugin hook" + p + ':' + hookName + ' (' + e + ')');
|
console.log("Error occurred while running plugin hook " + p + ':' + hookName, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
2
public/scripts/amt-wsman-0.2.0-min.js
vendored
2
public/scripts/amt-wsman-0.2.0-min.js
vendored
File diff suppressed because one or more lines are too long
|
|
@ -703,6 +703,10 @@ body {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.DeviceCheckbox {
|
||||||
|
margin-top: 2px !important;
|
||||||
|
}
|
||||||
|
|
||||||
.deviceBarCheckbox {
|
.deviceBarCheckbox {
|
||||||
width:22px;
|
width:22px;
|
||||||
float:left;
|
float:left;
|
||||||
|
|
@ -823,15 +827,15 @@ NoMeshesPanel img {
|
||||||
.deviceNotifySmallDot {
|
.deviceNotifySmallDot {
|
||||||
position:absolute;
|
position:absolute;
|
||||||
right:10px;
|
right:10px;
|
||||||
top:0px;
|
top:4px;
|
||||||
height:10px;
|
height:10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.deviceNotifySmallDotSub {
|
.deviceNotifySmallDotSub {
|
||||||
text-align:center;
|
text-align:center;
|
||||||
color:#FFF;
|
color:#FFF;
|
||||||
height:10px;
|
height:14px;
|
||||||
width:10px;
|
width:14px;
|
||||||
padding:2px;
|
padding:2px;
|
||||||
background-color:#00F;
|
background-color:#00F;
|
||||||
border-radius:10px;
|
border-radius:10px;
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ var meshCentralSourceFiles = [
|
||||||
"../views/messenger.handlebars",
|
"../views/messenger.handlebars",
|
||||||
"../views/player.handlebars",
|
"../views/player.handlebars",
|
||||||
"../views/sharing.handlebars",
|
"../views/sharing.handlebars",
|
||||||
|
"../views/sharing-mobile.handlebars",
|
||||||
"../views/mstsc.handlebars",
|
"../views/mstsc.handlebars",
|
||||||
"../views/ssh.handlebars",
|
"../views/ssh.handlebars",
|
||||||
"../emails/account-check.html",
|
"../emails/account-check.html",
|
||||||
|
|
|
||||||
20475
translate/translate.json
20475
translate/translate.json
File diff suppressed because it is too large
Load diff
|
|
@ -1524,10 +1524,24 @@
|
||||||
function setSessionActivity() { sessionActivity = Date.now(); }
|
function setSessionActivity() { sessionActivity = Date.now(); }
|
||||||
function checkIdleSessionTimeout() {
|
function checkIdleSessionTimeout() {
|
||||||
var delta = (Date.now() - sessionActivity);
|
var delta = (Date.now() - sessionActivity);
|
||||||
if (delta > serverinfo.timeout && serverinfo.logoutOnIdleSessionTimeout) {
|
if (delta > serverinfo.timeout) {
|
||||||
|
if (desktop != null) { // Disconnect remote desktop
|
||||||
|
desktop.Stop();
|
||||||
|
desktopNode = desktop = null;
|
||||||
|
}
|
||||||
|
if (terminal != null) { // Disconnect terminal
|
||||||
|
terminal.Stop();
|
||||||
|
terminal = null;
|
||||||
|
}
|
||||||
|
if (files != null) { // Disconnect files
|
||||||
|
files.Stop();
|
||||||
|
files = null;
|
||||||
|
}
|
||||||
|
if (serverinfo.logoutonidlesessiontimeout) {
|
||||||
window.location.href = 'logout';
|
window.location.href = 'logout';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function onMessage(server, message) {
|
function onMessage(server, message) {
|
||||||
switch (message.action) {
|
switch (message.action) {
|
||||||
|
|
@ -6805,7 +6819,19 @@
|
||||||
if (e.shiftKey == true) { meshserver.send({ action: 'uploadagentcore', nodeid: consoleNode._id, type: 'default' }); } // Upload default core
|
if (e.shiftKey == true) { meshserver.send({ action: 'uploadagentcore', nodeid: consoleNode._id, type: 'default' }); } // Upload default core
|
||||||
else if (e.altKey == true) { meshserver.send({ action: 'uploadagentcore', nodeid: consoleNode._id, type: 'clear' }); } // Clear the core
|
else if (e.altKey == true) { meshserver.send({ action: 'uploadagentcore', nodeid: consoleNode._id, type: 'clear' }); } // Clear the core
|
||||||
else if (e.ctrlKey == true) { p15uploadCore2(); } // Upload the core from a file
|
else if (e.ctrlKey == true) { p15uploadCore2(); } // Upload the core from a file
|
||||||
else { setDialogMode(2, "Perform Agent Action", 3, p15uploadCoreEx, addHtmlValue("Action", '<select id=d3coreMode style=width:230px><option value=1>' + "Upload default server core" + '</option><option value=2>' + "Clear the core" + '</option><option value=6>' + "Upload recovery core" + '</option><option value=7>' + "Upload tiny core" + '</option><option value=3>' + "Upload a core file" + '</option><option value=4>' + "Soft disconnect agent" + '</option><option value=5>' + "Hard disconnect agent" + '</option><option value=8>' + "Restart agent service" + '</select>')); }
|
else {
|
||||||
|
var htmlValue = '<select id=d3coreMode style=width:230px>' +
|
||||||
|
'<option value=1>' + "Upload default server core" + '</option>' +
|
||||||
|
'<option value=2>' + "Clear the core" + '</option>' +
|
||||||
|
'<option value=3>' + "Upload a core file" + '</option>' +
|
||||||
|
'<option value=4>' + "Soft disconnect agent" + '</option>' +
|
||||||
|
'<option value=5>' + "Hard disconnect agent" + '</option>' +
|
||||||
|
'<option value=6>' + "Upload recovery core" + '</option>' +
|
||||||
|
'<option value=7>' + "Upload tiny core" + '</option>' +
|
||||||
|
'<option value=8>' + "Restart agent service" + '</option>' +
|
||||||
|
'<option value=9>' + "Force agent update" + '</option></select>';
|
||||||
|
setDialogMode(2, "Perform Agent Action", 3, p15uploadCoreEx, addHtmlValue("Action", htmlValue));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function p15uploadCoreEx() {
|
function p15uploadCoreEx() {
|
||||||
|
|
@ -6833,6 +6859,9 @@
|
||||||
} else if (Q('d3coreMode').value == 8) {
|
} else if (Q('d3coreMode').value == 8) {
|
||||||
// Restart MeshAgent service
|
// Restart MeshAgent service
|
||||||
meshserver.send({ action: 'msg', type: 'console', nodeid: consoleNode._id, value:'service restart' });
|
meshserver.send({ action: 'msg', type: 'console', nodeid: consoleNode._id, value:'service restart' });
|
||||||
|
} else if (Q('d3coreMode').value == 9) {
|
||||||
|
// Update mesh agent
|
||||||
|
meshserver.send({ action: 'updateAgents', nodeids: [consoleNode._id] });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1479,7 +1479,7 @@
|
||||||
<label style="display:block"><input type="checkbox" id="d7rdp4" />Disable Theming</label>
|
<label style="display:block"><input type="checkbox" id="d7rdp4" />Disable Theming</label>
|
||||||
<label style="display:block"><input type="checkbox" id="d7rdp6" />Disable Cursor Shadow</label>
|
<label style="display:block"><input type="checkbox" id="d7rdp6" />Disable Cursor Shadow</label>
|
||||||
<label style="display:block"><input type="checkbox" id="d7rdp7" />Disable Cursor Settings</label>
|
<label style="display:block"><input type="checkbox" id="d7rdp7" />Disable Cursor Settings</label>
|
||||||
<label style="display:block"><input type="checkbox" id="d7rdp8" />Enable Font Smooting</label>
|
<label style="display:block"><input type="checkbox" id="d7rdp8" />Enable Font Smoothing</label>
|
||||||
<label style="display:block"><input type="checkbox" id="d7rdp9" />Enable Desktop Composision</label>
|
<label style="display:block"><input type="checkbox" id="d7rdp9" />Enable Desktop Composision</label>
|
||||||
<label style="display:block"><input type="checkbox" id="d7rdpclip" />Automatic Clipboard</label>
|
<label style="display:block"><input type="checkbox" id="d7rdpclip" />Automatic Clipboard</label>
|
||||||
<label style="display:block"><input type="checkbox" id="d7rdpsmb" />Swap Mouse Buttons</label>
|
<label style="display:block"><input type="checkbox" id="d7rdpsmb" />Swap Mouse Buttons</label>
|
||||||
|
|
@ -2447,18 +2447,29 @@
|
||||||
files.Stop();
|
files.Stop();
|
||||||
files = null;
|
files = null;
|
||||||
}
|
}
|
||||||
if (serverinfo.logoutOnIdleSessionTimeout) {
|
if (serverinfo.logoutonidlesessiontimeout) {
|
||||||
window.location.href = 'logout';
|
window.location.href = 'logout';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var ds = Math.round((serverinfo.timeout - delta) / 1000);
|
var ds = Math.round((serverinfo.timeout - delta) / 1000);
|
||||||
|
var sessionInProgress = desktop != null || terminal != null || files != null;
|
||||||
|
var show = serverinfo.logoutonidlesessiontimeout || sessionInProgress;
|
||||||
|
var isLogout = serverinfo.logoutonidlesessiontimeout;
|
||||||
|
var theText = ''; // Initialize theText
|
||||||
if (ds <= 60) {
|
if (ds <= 60) {
|
||||||
QH('idleTimeoutNotify', '<br />' + format((ds == 1)?"1 second until disconnect":"{0} seconds until disconnect", ds));
|
theText = isLogout
|
||||||
|
? (ds == 1 ? "1 second until logout" : "{0} seconds until logout")
|
||||||
|
: (ds == 1 ? "1 second until disconnect" : "{0} seconds until disconnect");
|
||||||
} else {
|
} else {
|
||||||
ds = Math.round(ds / 60);
|
ds = Math.round(ds / 60);
|
||||||
if (ds <= 5) { QH('idleTimeoutNotify', '<br />' + format((ds == 1)?"1 minute until disconnect":"{0} minutes until disconnect", ds)); }
|
if (ds <= 5) {
|
||||||
|
theText = isLogout
|
||||||
|
? (ds == 1 ? "1 minute until logout" : "{0} minutes until logout")
|
||||||
|
: (ds == 1 ? "1 minute until disconnect" : "{0} minutes until disconnect");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
QH('idleTimeoutNotify', show && theText ? '<br />' + format(theText, ds) : '');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onMessage(server, message) {
|
function onMessage(server, message) {
|
||||||
|
|
@ -12733,7 +12744,19 @@
|
||||||
if (e.shiftKey == true) { meshserver.send({ action: 'uploadagentcore', nodeids: [ consoleNode._id ], type: 'default' }); } // Upload default core
|
if (e.shiftKey == true) { meshserver.send({ action: 'uploadagentcore', nodeids: [ consoleNode._id ], type: 'default' }); } // Upload default core
|
||||||
else if (e.altKey == true) { meshserver.send({ action: 'uploadagentcore', nodeids: [ consoleNode._id ], type: 'clear' }); } // Clear the core
|
else if (e.altKey == true) { meshserver.send({ action: 'uploadagentcore', nodeids: [ consoleNode._id ], type: 'clear' }); } // Clear the core
|
||||||
else if (e.ctrlKey == true) { p15uploadCore2(); } // Upload the core from a file
|
else if (e.ctrlKey == true) { p15uploadCore2(); } // Upload the core from a file
|
||||||
else { setDialogMode(2, "Perform Agent Action", 3, p15uploadCoreEx, addHtmlValue("Action", '<select id=d3coreMode style=width:230px><option value=1>' + "Upload default server core" + '</option><option value=2>' + "Clear the core" + '</option><option value=6>' + "Upload recovery core" + '</option><option value=7>' + "Upload tiny core" + '</option><option value=3>' + "Upload a core file" + '</option><option value=4>' + "Soft disconnect agent" + '</option><option value=5>' + "Hard disconnect agent" + '</option><option value=8>' + "Restart agent service" + '</select>')); }
|
else {
|
||||||
|
var htmlValue = '<select id=d3coreMode style=width:230px>' +
|
||||||
|
'<option value=1>' + "Upload default server core" + '</option>' +
|
||||||
|
'<option value=2>' + "Clear the core" + '</option>' +
|
||||||
|
'<option value=3>' + "Upload a core file" + '</option>' +
|
||||||
|
'<option value=4>' + "Soft disconnect agent" + '</option>' +
|
||||||
|
'<option value=5>' + "Hard disconnect agent" + '</option>' +
|
||||||
|
'<option value=6>' + "Upload recovery core" + '</option>' +
|
||||||
|
'<option value=7>' + "Upload tiny core" + '</option>' +
|
||||||
|
'<option value=8>' + "Restart agent service" + '</option>' +
|
||||||
|
'<option value=9>' + "Force agent update" + '</option></select>';
|
||||||
|
setDialogMode(2, "Perform Agent Action", 3, p15uploadCoreEx, addHtmlValue("Action", htmlValue));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function p15uploadCoreEx() {
|
function p15uploadCoreEx() {
|
||||||
|
|
@ -12761,6 +12784,9 @@
|
||||||
} else if (Q('d3coreMode').value == 8) {
|
} else if (Q('d3coreMode').value == 8) {
|
||||||
// Restart MeshAgent service
|
// Restart MeshAgent service
|
||||||
meshserver.send({ action: 'msg', type: 'console', nodeid: consoleNode._id, value:'service restart' });
|
meshserver.send({ action: 'msg', type: 'console', nodeid: consoleNode._id, value:'service restart' });
|
||||||
|
} else if (Q('d3coreMode').value == 9) {
|
||||||
|
// Update mesh agent
|
||||||
|
meshserver.send({ action: 'updateAgents', nodeids: [ consoleNode._id ] });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1878,7 +1878,7 @@
|
||||||
<label style="display:block"><input type="checkbox" id="d7rdp4" />Disable Theming</label>
|
<label style="display:block"><input type="checkbox" id="d7rdp4" />Disable Theming</label>
|
||||||
<label style="display:block"><input type="checkbox" id="d7rdp6" />Disable Cursor Shadow</label>
|
<label style="display:block"><input type="checkbox" id="d7rdp6" />Disable Cursor Shadow</label>
|
||||||
<label style="display:block"><input type="checkbox" id="d7rdp7" />Disable Cursor Settings</label>
|
<label style="display:block"><input type="checkbox" id="d7rdp7" />Disable Cursor Settings</label>
|
||||||
<label style="display:block"><input type="checkbox" id="d7rdp8" />Enable Font Smooting</label>
|
<label style="display:block"><input type="checkbox" id="d7rdp8" />Enable Font Smoothing</label>
|
||||||
<label style="display:block"><input type="checkbox" id="d7rdp9" />Enable Desktop Composision</label>
|
<label style="display:block"><input type="checkbox" id="d7rdp9" />Enable Desktop Composision</label>
|
||||||
<label style="display:block"><input type="checkbox" id="d7rdpclip" />Automatic Clipboard</label>
|
<label style="display:block"><input type="checkbox" id="d7rdpclip" />Automatic Clipboard</label>
|
||||||
<label style="display:block"><input type="checkbox" id="d7rdpsmb" />Swap Mouse Buttons</label>
|
<label style="display:block"><input type="checkbox" id="d7rdpsmb" />Swap Mouse Buttons</label>
|
||||||
|
|
@ -2897,18 +2897,29 @@
|
||||||
files.Stop();
|
files.Stop();
|
||||||
files = null;
|
files = null;
|
||||||
}
|
}
|
||||||
if (serverinfo.logoutOnIdleSessionTimeout) {
|
if (serverinfo.logoutonidlesessiontimeout) {
|
||||||
window.location.href = 'logout';
|
window.location.href = 'logout';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var ds = Math.round((serverinfo.timeout - delta) / 1000);
|
var ds = Math.round((serverinfo.timeout - delta) / 1000);
|
||||||
|
var sessionInProgress = (desktop != null || terminal != null || files != null);
|
||||||
|
var show = serverinfo.logoutonidlesessiontimeout || sessionInProgress;
|
||||||
|
var isLogout = serverinfo.logoutonidlesessiontimeout;
|
||||||
|
var theText = '';
|
||||||
if (ds <= 60) {
|
if (ds <= 60) {
|
||||||
QH('idleTimeoutNotify', '<br />' + format((ds == 1) ? "1 second until disconnect" : "{0} seconds until disconnect", ds));
|
theText = isLogout
|
||||||
|
? (ds == 1 ? "1 second until logout" : "{0} seconds until logout")
|
||||||
|
: (ds == 1 ? "1 second until disconnect" : "{0} seconds until disconnect");
|
||||||
} else {
|
} else {
|
||||||
ds = Math.round(ds / 60);
|
ds = Math.round(ds / 60);
|
||||||
if (ds <= 5) { QH('idleTimeoutNotify', '<br />' + format((ds == 1) ? "1 minute until disconnect" : "{0} minutes until disconnect", ds)); }
|
if (ds <= 5) {
|
||||||
|
theText = isLogout
|
||||||
|
? (ds == 1 ? "1 minute until logout" : "{0} minutes until logout")
|
||||||
|
: (ds == 1 ? "1 minute until disconnect" : "{0} minutes until disconnect");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
QH('idleTimeoutNotify', show && theText ? '<br />' + format(theText, ds) : '');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onMessage(server, message) {
|
function onMessage(server, message) {
|
||||||
|
|
@ -5381,7 +5392,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node.desc && (deviceViewSettings.devsCols.indexOf('desc') >= 0)) { name = '<div style=float:right' + (stars[node._id] == 1 ? ';padding-right:15px' : '') + '>' + EscapeHtml(node.desc) + '</div><div>' + name + '</div>'; }
|
if (node.desc && (deviceViewSettings.devsCols.indexOf('desc') >= 0)) { name = '<div class="flex-grow-1">' + name + '</div><div style=float:right' + (stars[node._id] == 1 ? ';padding-right:15px' : '') + '>' + EscapeHtml(node.desc) + '</div>'; }
|
||||||
|
|
||||||
var collapseName = node.meshid;
|
var collapseName = node.meshid;
|
||||||
if (sort == 1) { collapseName = ('pwr:' + (node.pwr ? node.pwr : 0)); }
|
if (sort == 1) { collapseName = ('pwr:' + (node.pwr ? node.pwr : 0)); }
|
||||||
|
|
@ -5391,7 +5402,7 @@
|
||||||
r += '<div class=deviceBarCheckbox><input class="' + node.meshid + ' DeviceCheckbox form-check-input me-2" value=devid_' + node._id + ' type=checkbox onchange=p1devcheck(event) ' + (checkedNodeids[node._id] ? ' checked' : '') + '></div>';
|
r += '<div class=deviceBarCheckbox><input class="' + node.meshid + ' DeviceCheckbox form-check-input me-2" value=devid_' + node._id + ' type=checkbox onchange=p1devcheck(event) ' + (checkedNodeids[node._id] ? ' checked' : '') + '></div>';
|
||||||
r += '<div class=deviceBarIcon onmouseup=gotoDevice(\'' + node._id + '\',null,null,event)><div class="j' + icon + '" style=width:16px;margin-top:1px;margin-left:2px;height:16px></div></div>';
|
r += '<div class=deviceBarIcon onmouseup=gotoDevice(\'' + node._id + '\',null,null,event)><div class="j' + icon + '" style=width:16px;margin-top:1px;margin-left:2px;height:16px></div></div>';
|
||||||
r += '<div class=g1 style=height:18px;float:left></div><div class=g2 style=height:18px;float:right></div>';
|
r += '<div class=g1 style=height:18px;float:left></div><div class=g2 style=height:18px;float:right></div>';
|
||||||
r += '<div class=style10 style=cursor:pointer;font-size:14px;max-height:18px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap title="' + title + '" onmouseup=gotoDevice(\'' + node._id + '\',null,null,event)>' + name + '</div></div>' + devNotify + '</td>';
|
r += '<div class="style10 d-flex align-items-center" style=cursor:pointer;font-size:14px;max-height:18px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap title="' + title + '" onmouseup=gotoDevice(\'' + node._id + '\',null,null,event)>' + name + '</div></div>' + devNotify + '</td>';
|
||||||
|
|
||||||
// Use defaults if needed
|
// Use defaults if needed
|
||||||
if (deviceViewSettings == null) { deviceViewSettings = {}; }
|
if (deviceViewSettings == null) { deviceViewSettings = {}; }
|
||||||
|
|
@ -12150,7 +12161,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function p13openfilefolder() {
|
function p13openfilefolder() {
|
||||||
setModalContent('xxAddAgent', "Open File/Folder", 'Are you sure you want to open this file/folder on the remote devices desktop ?');
|
setModalContent('xxAddAgent', "Open File/Folder", "Are you sure you want to open this file/folder on the remote devices desktop?");
|
||||||
showModal('xxAddAgentModal', 'idx_dlgOkButton', () => p13openfilefolderEx());
|
showModal('xxAddAgentModal', 'idx_dlgOkButton', () => p13openfilefolderEx());
|
||||||
}
|
}
|
||||||
function p13openfilefolderEx() {
|
function p13openfilefolderEx() {
|
||||||
|
|
@ -13567,7 +13578,17 @@
|
||||||
else if (e.altKey == true) { meshserver.send({ action: 'uploadagentcore', nodeids: [consoleNode._id], type: 'clear' }); } // Clear the core
|
else if (e.altKey == true) { meshserver.send({ action: 'uploadagentcore', nodeids: [consoleNode._id], type: 'clear' }); } // Clear the core
|
||||||
else if (e.ctrlKey == true) { p15uploadCore2(); } // Upload the core from a file
|
else if (e.ctrlKey == true) { p15uploadCore2(); } // Upload the core from a file
|
||||||
else {
|
else {
|
||||||
setModalContent('xxAddAgent', "Perform Agent Action", addHtmlFormFloating("Action", '<select id=d3coreMode class="form-select me-2"><option value=1>' + "Upload default server core" + '</option><option value=2>' + "Clear the core" + '</option><option value=6>' + "Upload recovery core" + '</option><option value=7>' + "Upload tiny core" + '</option><option value=3>' + "Upload a core file" + '</option><option value=4>' + "Soft disconnect agent" + '</option><option value=5>' + "Hard disconnect agent" + '</option><option value=8>' + "Restart agent service" + '</select>'));
|
var htmlValue = '<select id=d3coreMode class="form-select me-2">' +
|
||||||
|
'<option value=1>' + "Upload default server core" + '</option>' +
|
||||||
|
'<option value=2>' + "Clear the core" + '</option>' +
|
||||||
|
'<option value=3>' + "Upload a core file" + '</option>' +
|
||||||
|
'<option value=4>' + "Soft disconnect agent" + '</option>' +
|
||||||
|
'<option value=5>' + "Hard disconnect agent" + '</option>' +
|
||||||
|
'<option value=6>' + "Upload recovery core" + '</option>' +
|
||||||
|
'<option value=7>' + "Upload tiny core" + '</option>' +
|
||||||
|
'<option value=8>' + "Restart agent service" + '</option>' +
|
||||||
|
'<option value=9>' + "Force agent update" + '</option></select>';
|
||||||
|
setModalContent('xxAddAgent', "Perform Agent Action", addHtmlFormFloating("Action", htmlValue));
|
||||||
showModal('xxAddAgentModal', 'idx_dlgOkButton', p15uploadCoreEx);
|
showModal('xxAddAgentModal', 'idx_dlgOkButton', p15uploadCoreEx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -13597,6 +13618,9 @@
|
||||||
} else if (Q('d3coreMode').value == 8) {
|
} else if (Q('d3coreMode').value == 8) {
|
||||||
// Restart MeshAgent service
|
// Restart MeshAgent service
|
||||||
meshserver.send({ action: 'msg', type: 'console', nodeid: consoleNode._id, value:'service restart' });
|
meshserver.send({ action: 'msg', type: 'console', nodeid: consoleNode._id, value:'service restart' });
|
||||||
|
} else if (Q('d3coreMode').value == 9) {
|
||||||
|
// Update mesh agent
|
||||||
|
meshserver.send({ action: 'updateAgents', nodeids: [consoleNode._id] });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -746,7 +746,7 @@
|
||||||
var domainUrl = '{{{domainurl}}}';
|
var domainUrl = '{{{domainurl}}}';
|
||||||
var authCookie = '{{{authCookie}}}';
|
var authCookie = '{{{authCookie}}}';
|
||||||
var authRelayCookie = '{{{authRelayCookie}}}';
|
var authRelayCookie = '{{{authRelayCookie}}}';
|
||||||
var viewOnly = (parseInt('{{{viewOnly}}}') == 1);
|
var viewOnly = parseInt('{{{viewOnly}}}');
|
||||||
var authCookieRenewTimer = null;
|
var authCookieRenewTimer = null;
|
||||||
var serverPublicNamePort = '{{{serverDnsName}}}:{{{serverPublicPort}}}';
|
var serverPublicNamePort = '{{{serverDnsName}}}:{{{serverPublicPort}}}';
|
||||||
var debugmode = false;
|
var debugmode = false;
|
||||||
|
|
@ -822,10 +822,24 @@
|
||||||
function setSessionActivity() { sessionActivity = Date.now(); }
|
function setSessionActivity() { sessionActivity = Date.now(); }
|
||||||
function checkIdleSessionTimeout() {
|
function checkIdleSessionTimeout() {
|
||||||
var delta = (Date.now() - sessionActivity);
|
var delta = (Date.now() - sessionActivity);
|
||||||
if (delta > serverinfo.timeout && serverinfo.logoutOnIdleSessionTimeout) {
|
if (delta > serverinfo.timeout) {
|
||||||
|
if (desktop != null) { // Disconnect remote desktop
|
||||||
|
desktop.Stop();
|
||||||
|
desktopNode = desktop = null;
|
||||||
|
}
|
||||||
|
if (terminal != null) { // Disconnect terminal
|
||||||
|
terminal.Stop();
|
||||||
|
terminal = null;
|
||||||
|
}
|
||||||
|
if (files != null) { // Disconnect files
|
||||||
|
files.Stop();
|
||||||
|
files = null;
|
||||||
|
}
|
||||||
|
if (serverinfo.logoutonidlesessiontimeout) {
|
||||||
window.location.href = 'logout';
|
window.location.href = 'logout';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Menu System
|
// Menu System
|
||||||
|
|
@ -850,7 +864,7 @@
|
||||||
gotKeyPressEvent = true;
|
gotKeyPressEvent = true;
|
||||||
Q('softKeyboard').value = '';
|
Q('softKeyboard').value = '';
|
||||||
// Check what keys we are allows to send
|
// Check what keys we are allows to send
|
||||||
if (viewOnly) return false;
|
if (viewOnly == 1) return false;
|
||||||
return desktop.m.handleKeys(e);
|
return desktop.m.handleKeys(e);
|
||||||
}
|
}
|
||||||
if (terminal && !xxdialogMode && (xxcurrentView == 10) && (currentDevicePanel == 5) && (t !== 1)) {
|
if (terminal && !xxdialogMode && (xxcurrentView == 10) && (currentDevicePanel == 5) && (t !== 1)) {
|
||||||
|
|
@ -878,7 +892,7 @@
|
||||||
gotKeyPressEvent = false;
|
gotKeyPressEvent = false;
|
||||||
Q('softKeyboard').value = '';
|
Q('softKeyboard').value = '';
|
||||||
// Check what keys we are allows to send
|
// Check what keys we are allows to send
|
||||||
if (viewOnly) return false;
|
if (viewOnly == 1) return false;
|
||||||
return desktop.m.handleKeyDown(e);
|
return desktop.m.handleKeyDown(e);
|
||||||
}
|
}
|
||||||
if (terminal && !xxdialogMode && (xxcurrentView == 10) && (currentDevicePanel == 5) && (t !== 1)) {
|
if (terminal && !xxdialogMode && (xxcurrentView == 10) && (currentDevicePanel == 5) && (t !== 1)) {
|
||||||
|
|
@ -907,7 +921,7 @@
|
||||||
var inputStr = Q('softKeyboard').value;
|
var inputStr = Q('softKeyboard').value;
|
||||||
Q('softKeyboard').value = '';
|
Q('softKeyboard').value = '';
|
||||||
// Check what keys we are allows to send
|
// Check what keys we are allows to send
|
||||||
if (viewOnly) return;
|
if (viewOnly == 1) return;
|
||||||
if ((gotKeyPressEvent == false) && (inputStr.length > 0) && desktop.m.SendKeyUnicode) {
|
if ((gotKeyPressEvent == false) && (inputStr.length > 0) && desktop.m.SendKeyUnicode) {
|
||||||
// This is a mobile keyboard, we need to send that is in the input control.
|
// This is a mobile keyboard, we need to send that is in the input control.
|
||||||
var inputchar = inputStr[inputStr.length - 1].charCodeAt(0);
|
var inputchar = inputStr[inputStr.length - 1].charCodeAt(0);
|
||||||
|
|
@ -1067,6 +1081,7 @@
|
||||||
desktop = CreateAmtRedirect(CreateAmtRemoteDesktop('Desk'), authCookie);
|
desktop = CreateAmtRedirect(CreateAmtRemoteDesktop('Desk'), authCookie);
|
||||||
desktop.debugmode = debugmode;
|
desktop.debugmode = debugmode;
|
||||||
desktop.onStateChanged = onDesktopStateChange;
|
desktop.onStateChanged = onDesktopStateChange;
|
||||||
|
desktop.m.stopInput = (viewOnly == 1);
|
||||||
desktop.m.bpp = (desktopsettings.encoding == 1 || desktopsettings.encoding == 3) ? 1 : 2;
|
desktop.m.bpp = (desktopsettings.encoding == 1 || desktopsettings.encoding == 3) ? 1 : 2;
|
||||||
desktop.m.useZRLE = (desktopsettings.encoding < 3);
|
desktop.m.useZRLE = (desktopsettings.encoding < 3);
|
||||||
desktop.m.showmouse = true;
|
desktop.m.showmouse = true;
|
||||||
|
|
@ -1076,6 +1091,8 @@
|
||||||
} else if ((contype == null) || (contype == 1) || ((contype == 3))) {
|
} else if ((contype == null) || (contype == 1) || ((contype == 3))) {
|
||||||
// Setup the Mesh Agent remote desktop
|
// Setup the Mesh Agent remote desktop
|
||||||
desktop = CreateAgentRedirect(null, CreateAgentRemoteDesktop('Desk'), serverPublicNamePort, authCookie, null, domainUrl);
|
desktop = CreateAgentRedirect(null, CreateAgentRemoteDesktop('Desk'), serverPublicNamePort, authCookie, null, domainUrl);
|
||||||
|
desktop.m.stopInput = (viewOnly == 1);
|
||||||
|
desktop.m.mouseCursorActive(true);
|
||||||
desktop.debugmode = debugmode;
|
desktop.debugmode = debugmode;
|
||||||
desktop.m.debugmode = debugmode;
|
desktop.m.debugmode = debugmode;
|
||||||
desktop.attemptWebRTC = attemptWebRTC;
|
desktop.attemptWebRTC = attemptWebRTC;
|
||||||
|
|
@ -1447,7 +1464,7 @@
|
||||||
QV('deskarea4', !fullscreen);
|
QV('deskarea4', !fullscreen);
|
||||||
QV('termarea1', !fullscreen);
|
QV('termarea1', !fullscreen);
|
||||||
QV('termarea4', !fullscreen);
|
QV('termarea4', !fullscreen);
|
||||||
var inputAllowed = !viewOnly;
|
var inputAllowed = (viewOnly == 0);
|
||||||
|
|
||||||
// Show full screen buttons if needed
|
// Show full screen buttons if needed
|
||||||
QV('deskkeybutton1', fullscreen);
|
QV('deskkeybutton1', fullscreen);
|
||||||
|
|
|
||||||
|
|
@ -2839,7 +2839,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
|
||||||
if (Object.keys(req.query).length > 0) { url += "?" + Object.keys(req.query).map(function(key) { return encodeURIComponent(key) + "=" + encodeURIComponent(req.query[key]); }).join("&"); }
|
if (Object.keys(req.query).length > 0) { url += "?" + Object.keys(req.query).map(function(key) { return encodeURIComponent(key) + "=" + encodeURIComponent(req.query[key]); }).join("&"); }
|
||||||
|
|
||||||
// check for relaystate is set, test against configured server name and accepted query params
|
// check for relaystate is set, test against configured server name and accepted query params
|
||||||
if(req.body.RelayState !== undefined){
|
if(req.body && req.body.RelayState !== undefined){
|
||||||
var relayState = decodeURIComponent(req.body.RelayState);
|
var relayState = decodeURIComponent(req.body.RelayState);
|
||||||
var serverName = (obj.getWebServerName(domain, req)).replaceAll('.','\\.');
|
var serverName = (obj.getWebServerName(domain, req)).replaceAll('.','\\.');
|
||||||
|
|
||||||
|
|
@ -7092,7 +7092,10 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// Login failed
|
// Login failed
|
||||||
handleRootRequestEx(req, res, domain, direct);
|
parent.debug('web', 'handleRootRequest: login authorization failed when returning from Duo 2FA.');
|
||||||
|
req.session.loginmode = 1;
|
||||||
|
res.redirect(domain.url + getQueryPortion(req)); // redirect back to main page
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue