From 4a526dafd2bcaa7ff19800c104bbbf2fd9f4eed1 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Sat, 15 May 2021 14:53:35 -0700 Subject: [PATCH] Fix for #2638 --- agents/meshcore.js | 2 +- meshdevicefile.js | 2 +- views/default.handlebars | 43 +++++++++++++++++++++++++++++++++++++++- 3 files changed, 44 insertions(+), 3 deletions(-) diff --git a/agents/meshcore.js b/agents/meshcore.js index d448a9e1..23d25a4d 100644 --- a/agents/meshcore.js +++ b/agents/meshcore.js @@ -62,7 +62,7 @@ if (require('MeshAgent').ARCHID == null) { catch (xx) { id = 16; } - break; break; + break; } if (id != null) { Object.defineProperty(require('MeshAgent'), 'ARCHID', { value: id }); } } diff --git a/meshdevicefile.js b/meshdevicefile.js index c9be5bb1..c3b71531 100644 --- a/meshdevicefile.js +++ b/meshdevicefile.js @@ -302,7 +302,7 @@ module.exports.CreateMeshDeviceFile = function (parent, ws, res, req, domain, us } catch (ex) { var x = { 'Cache-Control': 'no-store', 'Content-Type': type, 'Content-Disposition': 'attachment; filename="' + altname + '"' }; if (typeof size == 'number') { x['Content-Length'] = size; } - res.set(x); + try { res.set(x); } catch (ex) { } } } diff --git a/views/default.handlebars b/views/default.handlebars index a5e58f54..575335b9 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -4192,6 +4192,47 @@ } } + // Return HTML with a list of MeshCentral Router links + function getShortRouterLinks(node) { + var x = '', meshrights = GetNodeRights(node); + + // RDP link, show this link only of the remote machine is Windows. + if (((node.conn & 1) != 0) && (node.agent) && ((meshrights & 8) != 0) && (node.agent.id != 14)) { + if ((node.agent.id > 0) && (node.agent.id < 5)) { + if (navigator.platform.toLowerCase() == 'win32') { + if ((serverinfo.devicemeshrouterlinks == null) || (serverinfo.devicemeshrouterlinks.rdp != false)) { + x += '' + "RDP" + ' '; + } + } + } + if (node.agent.id > 4) { + if ((navigator.platform.toLowerCase() == 'win32') || (navigator.platform.toLowerCase() == 'macintel')) { + if ((serverinfo.devicemeshrouterlinks == null) || (serverinfo.devicemeshrouterlinks.ssh != false)) { + x += '' + "SSH" + ' '; + } + } + if (navigator.platform.toLowerCase() == 'win32') { + if ((serverinfo.devicemeshrouterlinks == null) || (serverinfo.devicemeshrouterlinks.scp != false)) { + x += '' + "SCP" + ' '; + } + } + } + if ((navigator.platform.toLowerCase() == 'win32') || (navigator.platform.toLowerCase() == 'macintel')) { + if ((serverinfo.devicemeshrouterlinks != null) && (Array.isArray(serverinfo.devicemeshrouterlinks.extralinks))) { + for (var i in serverinfo.devicemeshrouterlinks.extralinks) { + var r = serverinfo.devicemeshrouterlinks.extralinks[i], p = 0; + if (doesDeviceMatchFilterTags(node, r.filter)) { + if (typeof r.protocol == 'number') { p = r.protocol; } else if (r.protocol == 'http') { p = 1; } else if (r.protocol == 'https') { p = 2; } else if (r.protocol == 'rdp') { p = 3; } else if (r.protocol == 'ssh') { p = 4; } else if (r.protocol == 'scp') { p = 5; } + x += '' + r.name + ' '; + } + } + } + } + } + + return x; + } + // Check if this device matches any of the given filters function doesDeviceMatchFilterTags(node, filter) { if (filter == null) return true; // No filters, every device matches. @@ -8291,7 +8332,7 @@ function showDeskClipSet() { if (desktop == null || desktop.State != 3) return; meshserver.send({ action: 'msg', type: 'setclip', nodeid: currentNode._id, data: Q('d2clipText').value }); - QV('linuxClipWarn', currentNode && currentNode.agent && (currentNode.agent.id > 4) && (currentNode.agent.id != 21) && (currentNode.agent.id != 22)); + QV('linuxClipWarn', currentNode && currentNode.agent && (currentNode.agent.id > 4) && (currentNode.agent.id != 21) && (currentNode.agent.id != 22) && (currentNode.agent.id != 34)); } // Send CTRL-ALT-DEL