diff --git a/agents/meshcore.js b/agents/meshcore.js index 31b3c3bd..c7e0f598 100644 --- a/agents/meshcore.js +++ b/agents/meshcore.js @@ -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(); diff --git a/mcrec.js b/mcrec.js index 4e10d8d4..43966b88 100644 --- a/mcrec.js +++ b/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]"); diff --git a/meshcentral.js b/meshcentral.js index 6bd209df..a792dda5 100644 --- a/meshcentral.js +++ b/meshcentral.js @@ -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); diff --git a/meshdesktopmultiplex.js b/meshdesktopmultiplex.js index 36bf6195..9b6d1e19 100644 --- a/meshdesktopmultiplex.js +++ b/meshdesktopmultiplex.js @@ -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 () { diff --git a/meshrelay.js b/meshrelay.js index 9b2c52c6..7f91904d 100644 --- a/meshrelay.js +++ b/meshrelay.js @@ -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); diff --git a/meshuser.js b/meshuser.js index ea6390db..59573b0c 100644 --- a/meshuser.js +++ b/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) { } } diff --git a/public/styles/style-bootstrap.css b/public/styles/style-bootstrap.css index cf6fe678..ddb824d4 100644 --- a/public/styles/style-bootstrap.css +++ b/public/styles/style-bootstrap.css @@ -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; diff --git a/translate/translate.json b/translate/translate.json index ec4b3087..32d9fcd7 100644 --- a/translate/translate.json +++ b/translate/translate.json @@ -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", diff --git a/views/default3.handlebars b/views/default3.handlebars index 94a236ec..cfb6f8cb 100644 --- a/views/default3.handlebars +++ b/views/default3.handlebars @@ -5381,7 +5381,7 @@ } } - if (node.desc && (deviceViewSettings.devsCols.indexOf('desc') >= 0)) { name = '