mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-03-09 15:40:18 +00:00
Added MeshCentral Router local port support.
This commit is contained in:
parent
e012e1427e
commit
02fd8751b0
3 changed files with 7 additions and 46 deletions
|
@ -2482,6 +2482,7 @@
|
|||
if (message.nodeid != null) { url += ('&nodeid=' + message.nodeid); }
|
||||
if (message.tcpport != null) { url += ('&protocol=1&remoteport=' + message.tcpport); }
|
||||
if (message.localRelay) { url += '&local=1'; }
|
||||
if (message.localport) { url += '&localport=' + message.localport; }
|
||||
if (message.ip != null) { url += ('&remoteip=' + message.ip); }
|
||||
url += ('&appid=' + message.protocol + '&autoexit=1'); // Protocol: 0 = Custom, 1 = HTTP, 2 = HTTPS, 3 = RDP, 4 = PuTTY, 5 = WinSCP
|
||||
downloadFile(url, '');
|
||||
|
@ -4191,47 +4192,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
// 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 += '<a href=# cmenu=altPortContextMenu id=rdpMCRouterLink onclick=p10MCRouter("' + node._id + '",3)>' + "RDP" + '</a> ';
|
||||
}
|
||||
}
|
||||
}
|
||||
if (node.agent.id > 4) {
|
||||
if ((navigator.platform.toLowerCase() == 'win32') || (navigator.platform.toLowerCase() == 'macintel')) {
|
||||
if ((serverinfo.devicemeshrouterlinks == null) || (serverinfo.devicemeshrouterlinks.ssh != false)) {
|
||||
x += '<a href=# onclick=p10MCRouter("' + node._id + '",4,22)>' + "SSH" + '</a> ';
|
||||
}
|
||||
}
|
||||
if (navigator.platform.toLowerCase() == 'win32') {
|
||||
if ((serverinfo.devicemeshrouterlinks == null) || (serverinfo.devicemeshrouterlinks.scp != false)) {
|
||||
x += '<a href=# onclick=p10MCRouter("' + node._id + '",5,22)>' + "SCP" + '</a> ';
|
||||
}
|
||||
}
|
||||
}
|
||||
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 += '<a href=# onclick=p10MCRouter("' + node._id + '",' + p + ',' + r.port + (r.ip?(',\"' + r.ip + '\"'):'') + ')>' + r.name + '</a> ';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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.
|
||||
|
@ -6493,7 +6453,7 @@
|
|||
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 += '<a href=# onclick=p10MCRouter("' + node._id + '",' + p + ',' + r.port + (r.ip?(',\"' + r.ip + '\"'):'') + ') title="' + "Requires installation of MeshCentral Router." + '">' + r.name + '</a> ';
|
||||
x += '<a href=# onclick=p10MCRouter("' + node._id + '",' + p + ',' + r.port + (r.ip?(',\"' + r.ip + '\"'):',null') + ',' + (r.localport?r.localport:0) + ') title="' + "Requires installation of MeshCentral Router." + '">' + r.name + '</a> ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7274,10 +7234,10 @@
|
|||
meshserver.send({ action: 'removedevices', nodeids: [ nodeid ] });
|
||||
}
|
||||
|
||||
function p10MCRouter(nodeid, protocol, port, ip) {
|
||||
function p10MCRouter(nodeid, protocol, port, ip, localport) {
|
||||
var node = getNodeFromId(nodeid);
|
||||
if ((protocol == 3) && (port == null)) { if (node.rdpport != null) { port = node.rdpport; } else { port = 3389; } }
|
||||
meshserver.send({ action: 'getcookie', nodeid: nodeid, tcpport: port, ip: ip, tag: 'MCRouter', protocol: protocol }); // Protocol: 0 = Custom, 1 = HTTP, 2 = HTTPS, 3 = RDP, 4 = PuTTY, 5 = WinSCP
|
||||
meshserver.send({ action: 'getcookie', nodeid: nodeid, tcpport: port, ip: ip, tag: 'MCRouter', protocol: protocol, localport: localport }); // Protocol: 0 = Custom, 1 = HTTP, 2 = HTTPS, 3 = RDP, 4 = PuTTY, 5 = WinSCP
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue