mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-03-09 15:40:18 +00:00
Added built-in noVNC support.
This commit is contained in:
parent
1eee98446e
commit
3a9b6464cc
104 changed files with 79292 additions and 1809 deletions
|
@ -77,6 +77,9 @@
|
|||
<div id="altPortContextMenu" class="contextMenu noselect" style="display:none;min-width:0px">
|
||||
<div class="cmtext" onclick="cmaltportaction(1,event)">Alternate Port</div>
|
||||
</div>
|
||||
<div id="rfbPortContextMenu" class="contextMenu noselect" style="display:none;min-width:0px">
|
||||
<div class="cmtext" onclick="cmrfbportaction(1,event)">Alternate Port</div>
|
||||
</div>
|
||||
<div id="filesContextMenu" class="contextMenu noselect" style="display:none;min-width:0px">
|
||||
<div class="cmtext" onclick="cmfilesaction(1,event)">Rename</div>
|
||||
<div class="cmtext" onclick="cmfilesaction(2,event)">Edit</div>
|
||||
|
@ -2193,6 +2196,13 @@
|
|||
newWindow.opener = null;
|
||||
}
|
||||
}
|
||||
if (message.tag == 'novnc') {
|
||||
var vncurl = window.location.origin + domainUrl + 'novnc/vnc.html?ws=wss%3A%2F%2F' + window.location.hostname + '%2Fmeshrelay.ashx%3Fauth%3D' + message.cookie;
|
||||
var node = getNodeFromId(message.nodeid);
|
||||
if (node != null) { vncurl += '&name=' + encodeURIComponentEx(node.name); }
|
||||
var newWindow = window.open(vncurl, 'mcnovnc/' + message.nodeid);
|
||||
newWindow.opener = null;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'getNotes': {
|
||||
|
@ -2605,6 +2615,7 @@
|
|||
node.tags = message.event.node.tags;
|
||||
node.userloc = message.event.node.userloc;
|
||||
node.rdpport = message.event.node.rdpport;
|
||||
node.rfbport = message.event.node.rfbport;
|
||||
node.consent = message.event.node.consent;
|
||||
if (message.event.node.links != null) { node.links = message.event.node.links; } else { delete node.links; }
|
||||
if (message.event.node.agent != null) {
|
||||
|
@ -4413,6 +4424,20 @@
|
|||
if (currentNode.rdpport != null) { Q('d10rdpport').value = currentNode.rdpport; }
|
||||
}
|
||||
|
||||
function cmrfbportaction(action) {
|
||||
if (xxdialogMode) return;
|
||||
var x = "noVNC remote connection port:" + '<br /><br /><input type=text placeholder="5900" inputmode="numeric" pattern="[0-9]*" onkeypress="return (event.keyCode == 8) || (event.charCode >= 48 && event.charCode <= 57)" maxlength=5 id=d10rfbport type=text>';
|
||||
setDialogMode(2, "noVNC Connection", 3, function() {
|
||||
setDialogMode(0);
|
||||
// Save the new RFB port to the server
|
||||
var rfbport = ((Q('d10rfbport').value.length > 0) ? parseInt(Q('d10rfbport').value) : 3389);
|
||||
meshserver.send({ action: 'changedevice', nodeid: currentNode._id, rfbport: rfbport });
|
||||
if (currentNode != null) { p10rfb(currentNode._id, rfbport); }
|
||||
}, x, currentNode);
|
||||
Q('d10rfbport').focus();
|
||||
if (currentNode.rfbport != null) { Q('d10rfbport').value = currentNode.rfbport; }
|
||||
}
|
||||
|
||||
function cmfilesaction(action) {
|
||||
if (xxdialogMode) return;
|
||||
var filetreexx = p13sort_files(p13filetree.dir);
|
||||
|
@ -4459,6 +4484,7 @@
|
|||
QV('termShellContextMenuLinux', false);
|
||||
QV('deskConnectContextMenu', false);
|
||||
QV('altPortContextMenu', false);
|
||||
QV('rfbPortContextMenu', false);
|
||||
QV('filesContextMenu', false);
|
||||
QV('deskPlayerContextMenu', false);
|
||||
//QV('pluginTabContextMenu', false);
|
||||
|
@ -5336,6 +5362,11 @@
|
|||
}
|
||||
}
|
||||
|
||||
// noVNC link
|
||||
if (((connectivity & 1) != 0) && (node.agent) && ((meshrights & 8) != 0)) {
|
||||
x += '<a href=# cmenu=rfbPortContextMenu id=rfbLink onclick=p10rfb("' + node._id + '") title="' + "Launch noVNC session to this device" + '.">' + "noVNC" + '</a> ';
|
||||
}
|
||||
|
||||
// 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> '; }
|
||||
x += '</div><br>'
|
||||
|
@ -5844,6 +5875,11 @@
|
|||
return false;
|
||||
}
|
||||
|
||||
function p10rfb(nodeid, port) {
|
||||
if (port == null) { if (currentNode.rfbport != null) { port = currentNode.rfbport; } else { port = 5900; } }
|
||||
meshserver.send({ action: 'getcookie', nodeid: nodeid, tcpport: port, tag: 'novnc' });
|
||||
}
|
||||
|
||||
// Show current location
|
||||
var d2map = null;
|
||||
function p10showNodeLocationDialog() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue