Fix for #2638

Ylian Saint-Hilaire committed May 15, 2021 at 14:53 UTC 4a526dafd2bcaa7ff19800c104bbbf2fd9f4eed1
3 files changed +44 -3
agents/meshcore.js
+1 -1
@@ -62,7 +62,7 @@ if (require('MeshAgent').ARCHID == null) {
62 catch (xx) {
63 id = 16;
64 }
65 - break; break;
65 + break;
66 }
67 if (id != null) { Object.defineProperty(require('MeshAgent'), 'ARCHID', { value: id }); }
68 }
meshdevicefile.js
+1 -1
@@ -302,7 +302,7 @@ module.exports.CreateMeshDeviceFile = function (parent, ws, res, req, domain, us
302 } catch (ex) {
303 var x = { 'Cache-Control': 'no-store', 'Content-Type': type, 'Content-Disposition': 'attachment; filename="' + altname + '"' };
304 if (typeof size == 'number') { x['Content-Length'] = size; }
305 - res.set(x);
305 + try { res.set(x); } catch (ex) { }
306 }
307 }
308
views/default.handlebars
+42 -1
@@ -4192,6 +4192,47 @@
4192 }
4193 }
4194
4195 + // Return HTML with a list of MeshCentral Router links
4196 + function getShortRouterLinks(node) {
4197 + var x = '', meshrights = GetNodeRights(node);
4198 +
4199 + // RDP link, show this link only of the remote machine is Windows.
4200 + if (((node.conn & 1) != 0) && (node.agent) && ((meshrights & 8) != 0) && (node.agent.id != 14)) {
4201 + if ((node.agent.id > 0) && (node.agent.id < 5)) {
4202 + if (navigator.platform.toLowerCase() == 'win32') {
4203 + if ((serverinfo.devicemeshrouterlinks == null) || (serverinfo.devicemeshrouterlinks.rdp != false)) {
4204 + x += '<a href=# cmenu=altPortContextMenu id=rdpMCRouterLink onclick=p10MCRouter("' + node._id + '",3)>' + "RDP" + '</a>&nbsp;';
4205 + }
4206 + }
4207 + }
4208 + if (node.agent.id > 4) {
4209 + if ((navigator.platform.toLowerCase() == 'win32') || (navigator.platform.toLowerCase() == 'macintel')) {
4210 + if ((serverinfo.devicemeshrouterlinks == null) || (serverinfo.devicemeshrouterlinks.ssh != false)) {
4211 + x += '<a href=# onclick=p10MCRouter("' + node._id + '",4,22)>' + "SSH" + '</a>&nbsp;';
4212 + }
4213 + }
4214 + if (navigator.platform.toLowerCase() == 'win32') {
4215 + if ((serverinfo.devicemeshrouterlinks == null) || (serverinfo.devicemeshrouterlinks.scp != false)) {
4216 + x += '<a href=# onclick=p10MCRouter("' + node._id + '",5,22)>' + "SCP" + '</a>&nbsp;';
4217 + }
4218 + }
4219 + }
4220 + if ((navigator.platform.toLowerCase() == 'win32') || (navigator.platform.toLowerCase() == 'macintel')) {
4221 + if ((serverinfo.devicemeshrouterlinks != null) && (Array.isArray(serverinfo.devicemeshrouterlinks.extralinks))) {
4222 + for (var i in serverinfo.devicemeshrouterlinks.extralinks) {
4223 + var r = serverinfo.devicemeshrouterlinks.extralinks[i], p = 0;
4224 + if (doesDeviceMatchFilterTags(node, r.filter)) {
4225 + 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; }
4226 + x += '<a href=# onclick=p10MCRouter("' + node._id + '",' + p + ',' + r.port + (r.ip?(',\"' + r.ip + '\"'):'') + ')>' + r.name + '</a>&nbsp;';
4227 + }
4228 + }
4229 + }
4230 + }
4231 + }
4232 +
4233 + return x;
4234 + }
4235 +
4236 // Check if this device matches any of the given filters
4237 function doesDeviceMatchFilterTags(node, filter) {
4238 if (filter == null) return true; // No filters, every device matches.
@@ -8291,7 +8332,7 @@
8332 function showDeskClipSet() {
8333 if (desktop == null || desktop.State != 3) return;
8334 meshserver.send({ action: 'msg', type: 'setclip', nodeid: currentNode._id, data: Q('d2clipText').value });
8294 - QV('linuxClipWarn', currentNode && currentNode.agent && (currentNode.agent.id > 4) && (currentNode.agent.id != 21) && (currentNode.agent.id != 22));
8335 + QV('linuxClipWarn', currentNode && currentNode.agent && (currentNode.agent.id > 4) && (currentNode.agent.id != 21) && (currentNode.agent.id != 22) && (currentNode.agent.id != 34));
8336 }
8337
8338 // Send CTRL-ALT-DEL