mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-03-09 15:40:18 +00:00
Merge branch 'vendor/master' into feature/sync-device-name-to-agentname
This commit is contained in:
commit
b4b2889d29
10 changed files with 34 additions and 57 deletions
|
@ -2752,10 +2752,10 @@ function kvm_consent_ask(ws){
|
|||
return (this.consent);
|
||||
});
|
||||
} 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 {
|
||||
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;
|
||||
ws.pause();
|
||||
|
|
2
mcrec.js
2
mcrec.js
|
@ -321,7 +321,7 @@ function setup() { InstallModules(['image-size'], start); }
|
|||
function start() { startEx(process.argv); }
|
||||
function startEx(argv) {
|
||||
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("");
|
||||
log(" Usage: node mcrec [file]");
|
||||
|
|
|
@ -583,6 +583,8 @@ function CreateMeshCentralServer(config, args) {
|
|||
// Launch MeshCentral as a child server and monitor it.
|
||||
obj.launchChildServer = function (startArgs) {
|
||||
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.traceProcessWarnings === true) { startArgs.unshift('--trace-warnings'); } } catch (ex) { }
|
||||
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; }
|
||||
var datastr = data;
|
||||
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) {
|
||||
var datastr = data;
|
||||
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[data.length - 1] == '\n') { data = data.substring(0, data.length - 1); }
|
||||
obj.logError(data);
|
||||
|
|
|
@ -847,7 +847,7 @@ function CreateDesktopMultiplexor(parent, domain, nodeid, id, func) {
|
|||
return;
|
||||
}
|
||||
// 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 firstBlock = JSON.stringify(metadata);
|
||||
recordingEntry(fd, 1, 0, firstBlock, function () {
|
||||
|
|
|
@ -445,15 +445,15 @@ function CreateMeshRelayEx(parent, ws, req, domain, user, cookie) {
|
|||
relayinfo.peer1.sendPeerImage();
|
||||
} else {
|
||||
// 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,
|
||||
userid: sessionUser._id,
|
||||
username: sessionUser.name,
|
||||
sessionid: obj.id,
|
||||
ipaddr1: (obj.req == null) ? null : obj.req.clientIp,
|
||||
ipaddr2: ((obj.peer == null) || (obj.peer.req == null)) ? null : obj.peer.req.clientIp,
|
||||
ipaddr1: ((obj.peer == null) || (obj.peer.req == null)) ? null : obj.peer.req.clientIp,
|
||||
ipaddr2: (obj.req == null) ? null : obj.req.clientIp,
|
||||
time: new Date().toLocaleString(),
|
||||
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)
|
||||
|
@ -512,7 +512,7 @@ function CreateMeshRelayEx(parent, ws, req, domain, user, cookie) {
|
|||
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 == 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.
|
||||
parent.parent.DispatchEvent(['*', sessionUser._id], obj, event);
|
||||
|
||||
|
|
27
meshuser.js
27
meshuser.js
|
@ -3079,7 +3079,16 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
|||
}
|
||||
if (commandsOk == true) {
|
||||
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
|
||||
var agent = parent.wsagents[node._id];
|
||||
if ((agent != null) && (agent.authenticated == 2) && (agent.agentInfo != null)) {
|
||||
// Send the commands to the agent
|
||||
try { agent.send(JSON.stringify(theCommand)); } catch (ex) { }
|
||||
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.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) { } }
|
||||
|
@ -3087,20 +3096,8 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
|||
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];
|
||||
if ((agent != null) && (agent.authenticated == 2) && (agent.agentInfo != null)) {
|
||||
// Send the commands to the agent
|
||||
try { agent.send(JSON.stringify(theCommand)); } catch (ex) { }
|
||||
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.DispatchEvent(targets, obj, event);
|
||||
} else {
|
||||
if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'runcommands', responseid: command.responseid, result: 'Agent not connected' })); } catch (ex) { } }
|
||||
}
|
||||
} else {
|
||||
if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'runcommands', responseid: command.responseid, result: 'Agent not connected' })); } catch (ex) { } }
|
||||
}
|
||||
} else {
|
||||
if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'runcommands', responseid: command.responseid, result: 'Invalid command type' })); } catch (ex) { } }
|
||||
|
|
|
@ -703,6 +703,10 @@ body {
|
|||
text-align: center;
|
||||
}
|
||||
|
||||
.DeviceCheckbox {
|
||||
margin-top: 2px !important;
|
||||
}
|
||||
|
||||
.deviceBarCheckbox {
|
||||
width:22px;
|
||||
float:left;
|
||||
|
@ -823,15 +827,15 @@ NoMeshesPanel img {
|
|||
.deviceNotifySmallDot {
|
||||
position:absolute;
|
||||
right:10px;
|
||||
top:0px;
|
||||
top:4px;
|
||||
height:10px;
|
||||
}
|
||||
|
||||
.deviceNotifySmallDotSub {
|
||||
text-align:center;
|
||||
color:#FFF;
|
||||
height:10px;
|
||||
width:10px;
|
||||
height:14px;
|
||||
width:14px;
|
||||
padding:2px;
|
||||
background-color:#00F;
|
||||
border-radius:10px;
|
||||
|
|
|
@ -26609,32 +26609,6 @@
|
|||
"default3.handlebars->35->3234"
|
||||
]
|
||||
},
|
||||
{
|
||||
"bs": "DeviceCheckbox",
|
||||
"ca": "Casilla de verificació del dispositiu",
|
||||
"cs": "DeviceCheckbox",
|
||||
"da": "Enheds Checkbox",
|
||||
"de": "DeviceCheckbox",
|
||||
"en": "DeviceCheckbox",
|
||||
"es": "Casilla de Verificación del Dispositivo",
|
||||
"fi": "LaitteenValintaruutu",
|
||||
"fr": "DeviceCheckbox",
|
||||
"hi": "DeviceCheckbox",
|
||||
"hu": "DeviceCheckbox",
|
||||
"it": "Casella di controllo del dispositivo",
|
||||
"ja": "DeviceCheckbox",
|
||||
"ko": "장치 체크 박스",
|
||||
"nl": "DeviceCheckbox",
|
||||
"pl": "Pole wyboru urządzenia",
|
||||
"pt": "DeviceCheckbox",
|
||||
"pt-br": "DeviceCheckbox",
|
||||
"ru": "DeviceCheckbox",
|
||||
"sv": "DeviceCheckbox",
|
||||
"tr": "DeviceCheckbox",
|
||||
"zh-chs": "设备复选框",
|
||||
"zh-cht": "裝置複選框",
|
||||
"uk": "Прапорець Пристрою"
|
||||
},
|
||||
{
|
||||
"bs": "Uređaji",
|
||||
"ca": "Dispositius",
|
||||
|
|
|
@ -5381,7 +5381,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;
|
||||
if (sort == 1) { collapseName = ('pwr:' + (node.pwr ? node.pwr : 0)); }
|
||||
|
@ -5391,7 +5391,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=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=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
|
||||
if (deviceViewSettings == null) { deviceViewSettings = {}; }
|
||||
|
|
|
@ -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("&"); }
|
||||
|
||||
// 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 serverName = (obj.getWebServerName(domain, req)).replaceAll('.','\\.');
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue