1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-03-09 15:40:18 +00:00

Started work on web-based SSH support.

This commit is contained in:
Ylian Saint-Hilaire 2021-04-28 23:22:54 -07:00
parent ee3581aa31
commit 110195d8c6
9 changed files with 2151 additions and 1701 deletions

View file

@ -2480,6 +2480,12 @@
if (node != null) { rdpurl += '&name=' + encodeURIComponentEx(node.name); }
if (message.localRelay) { rdpurl += '&local=1'; }
safeNewWindow(rdpurl, 'mcmstsc/' + message.nodeid);
} else if (message.tag == 'ssh') {
var sshurl = window.location.origin + domainUrl + 'ssh.html?ws=' + message.cookie + (urlargs.key?('&key=' + urlargs.key):'');
var node = getNodeFromId(message.nodeid);
if (node != null) { sshurl += '&name=' + encodeURIComponentEx(node.name); }
if (message.localRelay) { sshurl += '&local=1'; }
safeNewWindow(sshurl, 'mcssh/' + message.nodeid);
}
break;
}
@ -6442,7 +6448,7 @@
// noVNC link
if ((((connectivity & 1) != 0) || (node.mtype == 3)) && (node.agent) && ((meshrights & 8) != 0) && ((features & 0x20000000) == 0) && (node.agent.id != 14)) {
x += '<a href=# cmenu=rfbPortContextMenu id=rfbLink onclick=p10rfb("' + node._id + '") title="' + "Launch noVNC session to this device" + '.">' + "noVNC" + '</a>&nbsp;';
x += '<a href=# cmenu=rfbPortContextMenu id=rfbLink onclick=p10rfb("' + node._id + '") title="' + "Launch web-based VNC session to this device" + '.">' + "Web-VNC" + '</a>&nbsp;';
}
// MSTSC.js link
@ -6450,6 +6456,11 @@
x += '<a href=# cmenu=altPortContextMenu id=mstscLink onclick=p10mstsc("' + node._id + '") title="' + "Launch web-based RDP session to this device" + '.">' + "Web-RDP" + '</a>&nbsp;';
}
// SSH link
if ((((connectivity & 1) != 0) || (node.mtype == 3)) && (node.agent) && ((meshrights & 8) != 0) && ((features & 0x40000000) == 0) && (node.agent.id != 14)) {
x += '<a href=# cmenu=altPortContextMenu id=sshLink onclick=p10ssh("' + node._id + '") title="' + "Launch web-based SSH session to this device" + '.">' + "Web-SSH" + '</a>&nbsp;';
}
// MQTT options
if ((meshrights == 0xFFFFFFFF) && (features & 0x00400000)) { x += '<a href=# onclick=p10showMqttLoginDialog("' + node._id + '") title="' + "Get MQTT login credentials for this device." + '">' + "MQTT Login" + '</a>&nbsp;'; }
x += '</div><br>'
@ -7224,6 +7235,12 @@
meshserver.send({ action: 'getcookie', nodeid: nodeid, tcpport: port, tag: 'mstsc' });
}
function p10ssh(nodeid, port) {
var node = getNodeFromId(nodeid);
if (port == null) { if (node.sshport != null) { port = node.sshport; } else { port = 22; } }
meshserver.send({ action: 'getcookie', nodeid: nodeid, tcpport: port, tag: 'ssh' });
}
// Show current location
var d2map = null;
function p10showNodeLocationDialog() {