Added MeshCentral Router link customization.
This commit is contained in:
parent
c0efcbb1e1
commit
9b7a5d8ffc
|
@ -224,6 +224,33 @@
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
"required": [ "name", "url" ]
|
"required": [ "name", "url" ]
|
||||||
},
|
},
|
||||||
|
"deviceMeshRouterLinks": {
|
||||||
|
"rdp": { "type": "boolean", "default": true, "description": "Display a RDP link in the device tab when supported." },
|
||||||
|
"ssh": { "type": "boolean", "default": true, "description": "Display a SSH link in the device tab when supported." },
|
||||||
|
"scp": { "type": "boolean", "default": true, "description": "Display a SCP link in the device tab when supported." },
|
||||||
|
"extralinks": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"additionalProperties": false,
|
||||||
|
"required": [ "name", "protocol", "port" ],
|
||||||
|
"properties": {
|
||||||
|
"name": {
|
||||||
|
"description": "Name os the link to be displayed on the web site.",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"protocol": {
|
||||||
|
"description": "Protocol. Valid values are: custom,http,https,rdp,ssh,scp.",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"port": {
|
||||||
|
"description": "The port on the remote device.",
|
||||||
|
"type": "number"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"certUrl": {
|
"certUrl": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "uri",
|
"format": "uri",
|
||||||
|
|
|
@ -460,6 +460,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
||||||
if (matchingDomains.length > 0) { serverinfo.amtAcmFqdn = matchingDomains; }
|
if (matchingDomains.length > 0) { serverinfo.amtAcmFqdn = matchingDomains; }
|
||||||
}
|
}
|
||||||
if ((typeof domain.altmessenging == 'object') && (typeof domain.altmessenging.name == 'string') && (typeof domain.altmessenging.url == 'string')) { serverinfo.altmessenging = [{ name: domain.altmessenging.name, url: domain.altmessenging.url }]; }
|
if ((typeof domain.altmessenging == 'object') && (typeof domain.altmessenging.name == 'string') && (typeof domain.altmessenging.url == 'string')) { serverinfo.altmessenging = [{ name: domain.altmessenging.name, url: domain.altmessenging.url }]; }
|
||||||
|
if (typeof domain.devicemeshrouterlinks == 'object') { serverinfo.devicemeshrouterlinks = domain.devicemeshrouterlinks; }
|
||||||
if (Array.isArray(domain.altmessenging)) { serverinfo.altmessenging = []; for (var i in domain.altmessenging) { if ((typeof domain.altmessenging[i] == 'object') && (typeof domain.altmessenging[i].name == 'string') && (typeof domain.altmessenging[i].url == 'string')) { serverinfo.altmessenging.push({ name: domain.altmessenging[i].name, url: domain.altmessenging[i].url }); } } }
|
if (Array.isArray(domain.altmessenging)) { serverinfo.altmessenging = []; for (var i in domain.altmessenging) { if ((typeof domain.altmessenging[i] == 'object') && (typeof domain.altmessenging[i].name == 'string') && (typeof domain.altmessenging[i].url == 'string')) { serverinfo.altmessenging.push({ name: domain.altmessenging[i].name, url: domain.altmessenging[i].url }); } } }
|
||||||
serverinfo.https = true;
|
serverinfo.https = true;
|
||||||
serverinfo.redirport = args.redirport;
|
serverinfo.redirport = args.redirport;
|
||||||
|
|
|
@ -149,6 +149,23 @@
|
||||||
"name": "Jitsi",
|
"name": "Jitsi",
|
||||||
"url": "https://meet.jit.si/myserver-{0}"
|
"url": "https://meet.jit.si/myserver-{0}"
|
||||||
},
|
},
|
||||||
|
"_deviceMeshRouterLinks": {
|
||||||
|
"rdp": true,
|
||||||
|
"ssh": true,
|
||||||
|
"scp": true,
|
||||||
|
"extralinks": [
|
||||||
|
{
|
||||||
|
"name": "HTTP",
|
||||||
|
"protocol": "http",
|
||||||
|
"port": 80
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "HTTPS",
|
||||||
|
"protocol": "https",
|
||||||
|
"port": 443
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"myServer": {
|
"myServer": {
|
||||||
"Backup": false,
|
"Backup": false,
|
||||||
"Restore": false,
|
"Restore": false,
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -2418,12 +2418,7 @@
|
||||||
var url = 'mcrouter://' + servername + portStr + domainUrl + 'control.ashx?c=' + authCookie + '&t=' + serverinfo.tlshash + '&l={{{lang}}}' + (urlargs.key?('&key=' + urlargs.key):'');
|
var url = 'mcrouter://' + servername + portStr + domainUrl + 'control.ashx?c=' + authCookie + '&t=' + serverinfo.tlshash + '&l={{{lang}}}' + (urlargs.key?('&key=' + urlargs.key):'');
|
||||||
if (message.nodeid != null) { url += ('&nodeid=' + message.nodeid); }
|
if (message.nodeid != null) { url += ('&nodeid=' + message.nodeid); }
|
||||||
if (message.tcpport != null) { url += ('&protocol=1&remoteport=' + message.tcpport); }
|
if (message.tcpport != null) { url += ('&protocol=1&remoteport=' + message.tcpport); }
|
||||||
if (message.protocol == 'HTTP') { url += ('&appid=1'); } // HTTP
|
url += ('&appid=' + message.protocol + '&autoexit=1'); // Protocol: 0 = Custom, 1 = HTTP, 2 = HTTPS, 3 = RDP, 4 = PuTTY, 5 = WinSCP
|
||||||
if (message.protocol == 'HTTPS') { url += ('&appid=2'); } // HTTPS
|
|
||||||
if (message.protocol == 'RDP2') { url += ('&appid=3'); } // RDP
|
|
||||||
if (message.protocol == 'PSSH') { url += ('&appid=4'); } // Putty
|
|
||||||
if (message.protocol == 'WSCP') { url += ('&appid=5'); } // WinSCP
|
|
||||||
url += '&autoexit=1';
|
|
||||||
downloadFile(url, '');
|
downloadFile(url, '');
|
||||||
} else if (message.tag == 'novnc') {
|
} else if (message.tag == 'novnc') {
|
||||||
var vncurl = window.location.origin + domainUrl + 'novnc/vnc.html?ws=wss%3A%2F%2F' + window.location.host + encodeURIComponentEx(domainUrl) + 'meshrelay.ashx%3Fauth%3D' + message.cookie + '&show_dot=1' + (urlargs.key?('&key=' + urlargs.key):'') + '&l={{{lang}}}';
|
var vncurl = window.location.origin + domainUrl + 'novnc/vnc.html?ws=wss%3A%2F%2F' + window.location.host + encodeURIComponentEx(domainUrl) + 'meshrelay.ashx%3Fauth%3D' + message.cookie + '&show_dot=1' + (urlargs.key?('&key=' + urlargs.key):'') + '&l={{{lang}}}';
|
||||||
|
@ -5065,7 +5060,7 @@
|
||||||
// Save the new RDP port to the server
|
// Save the new RDP port to the server
|
||||||
var rdpport = ((Q('d10rdpport').value.length > 0) ? parseInt(Q('d10rdpport').value) : 3389);
|
var rdpport = ((Q('d10rdpport').value.length > 0) ? parseInt(Q('d10rdpport').value) : 3389);
|
||||||
meshserver.send({ action: 'changedevice', nodeid: currentNode._id, rdpport: rdpport });
|
meshserver.send({ action: 'changedevice', nodeid: currentNode._id, rdpport: rdpport });
|
||||||
if (currentNode != null) { p10MCRouter(currentNode._id, 'RDP2', rdpport); }
|
if (currentNode != null) { p10MCRouter(currentNode._id, 3, rdpport); }
|
||||||
}, x, currentNode);
|
}, x, currentNode);
|
||||||
Q('d10rdpport').focus();
|
Q('d10rdpport').focus();
|
||||||
if (currentNode.rdpport != null) { Q('d10rdpport').value = currentNode.rdpport; }
|
if (currentNode.rdpport != null) { Q('d10rdpport').value = currentNode.rdpport; }
|
||||||
|
@ -6093,13 +6088,32 @@
|
||||||
|
|
||||||
// RDP link, show this link only of the remote machine is Windows.
|
// RDP link, show this link only of the remote machine is Windows.
|
||||||
if (((connectivity & 1) != 0) && (node.agent) && ((meshrights & 8) != 0) && (node.agent.id != 14)) {
|
if (((connectivity & 1) != 0) && (node.agent) && ((meshrights & 8) != 0) && (node.agent.id != 14)) {
|
||||||
if ((node.agent.id > 0) && (node.agent.id < 5)) { x += '<a href=# cmenu=altPortContextMenu id=rdpMCRouterLink onclick=p10MCRouter("' + node._id + '","RDP2") title="' + "Requires installation of MeshCentral Router" + '.">' + "RDP" + '</a> '; }
|
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) title="' + "Requires installation of MeshCentral Router" + '.">' + "RDP" + '</a> ';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (node.agent.id > 4) {
|
if (node.agent.id > 4) {
|
||||||
if ((navigator.platform.toLowerCase() == 'win32') || (navigator.platform.toLowerCase() == 'macintel')) {
|
if ((navigator.platform.toLowerCase() == 'win32') || (navigator.platform.toLowerCase() == 'macintel')) {
|
||||||
x += '<a href=# onclick=p10MCRouter("' + node._id + '","PSSH",22) title="' + "Requires installation of MeshCentral Router." + '">' + "SSH" + '</a> ';
|
if ((serverinfo.devicemeshrouterlinks == null) || (serverinfo.devicemeshrouterlinks.ssh != false)) {
|
||||||
|
x += '<a href=# onclick=p10MCRouter("' + node._id + '",4,22) title="' + "Requires installation of MeshCentral Router." + '">' + "SSH" + '</a> ';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (navigator.platform.toLowerCase() == 'win32') {
|
if (navigator.platform.toLowerCase() == 'win32') {
|
||||||
x += '<a href=# onclick=p10MCRouter("' + node._id + '","WSCP",22) title="' + "Requires installation of MeshCentral Router." + '">' + "SCP" + '</a> ';
|
if ((serverinfo.devicemeshrouterlinks == null) || (serverinfo.devicemeshrouterlinks.scp != false)) {
|
||||||
|
x += '<a href=# onclick=p10MCRouter("' + node._id + '",5,22) title="' + "Requires installation of MeshCentral Router." + '">' + "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 (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 + ') title="' + "Requires installation of MeshCentral Router." + '">' + r.name + '</a> ';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6765,8 +6779,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function p10MCRouter(nodeid, protocol, port) {
|
function p10MCRouter(nodeid, protocol, port) {
|
||||||
if ((protocol == 'RDP2') && (port == null)) { if (currentNode.rdpport != null) { port = currentNode.rdpport; } else { port = 3389; } }
|
if ((protocol == 3) && (port == null)) { if (currentNode.rdpport != null) { port = currentNode.rdpport; } else { port = 3389; } }
|
||||||
meshserver.send({ action: 'getcookie', nodeid: nodeid, tcpport: port, tag: 'MCRouter', protocol: protocol });
|
meshserver.send({ action: 'getcookie', nodeid: nodeid, tcpport: port, tag: 'MCRouter', protocol: protocol }); // Protocol: 0 = Custom, 1 = HTTP, 2 = HTTPS, 3 = RDP, 4 = PuTTY, 5 = WinSCP
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue