From a32cea93e98b43aa2dccdc1dff6a930bc2e8d532 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Thu, 14 Apr 2022 12:28:37 -0700 Subject: [PATCH] Web-VNC fixes when used with replayed device group. --- meshuser.js | 1 - views/default.handlebars | 12 ++++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/meshuser.js b/meshuser.js index 0d942684..edf266bb 100644 --- a/meshuser.js +++ b/meshuser.js @@ -5699,7 +5699,6 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use if (command.nodeid) { cookieContent.nodeid = command.nodeid; } if (command.tcpaddr) { cookieContent.tcpaddr = command.tcpaddr; } // Indicates the browser want the agent to TCP connect to a remote address if (command.tcpport) { cookieContent.tcpport = command.tcpport; } // Indicates the browser want the agent to TCP connect to a remote port - if (command.ip) { cookieContent.ip = command.ip; } // Indicates the browser want to agent to relay a TCP connection to a IP:port if (node.mtype == 3) { cookieContent.lc = 1; command.localRelay = true; } // Indicate this is for a local connection command.cookie = parent.parent.encodeCookie(cookieContent, parent.parent.loginCookieEncryptionKey); command.trustedCert = parent.isTrustedCert(domain); diff --git a/views/default.handlebars b/views/default.handlebars index 0757e150..aa5be236 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -7930,19 +7930,19 @@ meshserver.send({ action: 'removedevices', nodeids: [ nodeid ] }); } - function p10MCRouter(nodeid, protocol, port, ip, localport) { + function p10MCRouter(nodeid, protocol, port, addr, localport) { var node = getNodeFromId(nodeid); if ((protocol == 3) && (port == null)) { if (node.rdpport != null) { port = node.rdpport; } else { port = 3389; } } // Adjust RDP port if needed - if (node.mtype == 3) { var mesh = meshes[node.meshid]; if (mesh.relayid) { nodeid = mesh.relayid; ip = node.host; } } // Setup device replay if needed - 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, 6 = MCRDesktop, 7 = MCRFiles + if (node.mtype == 3) { var mesh = meshes[node.meshid]; if (mesh.relayid) { nodeid = mesh.relayid; addr = node.host; } } // Setup device replay if needed + meshserver.send({ action: 'getcookie', nodeid: nodeid, tcpport: port, ip: addr, tag: 'MCRouter', protocol: protocol, localport: localport }); // Protocol: 0 = Custom, 1 = HTTP, 2 = HTTPS, 3 = RDP, 4 = PuTTY, 5 = WinSCP, 6 = MCRDesktop, 7 = MCRFiles return false; } function p10rfb(nodeid, port) { - var node = getNodeFromId(nodeid); + var node = getNodeFromId(nodeid), addr = null; if (port == null) { if (node.rfbport != null) { port = node.rfbport; } else { port = 5900; } } - if (node.mtype == 3) { var mesh = meshes[node.meshid]; if (mesh.relayid) { nodeid = mesh.relayid; ip = node.host; } } // Setup device replay if needed - meshserver.send({ action: 'getcookie', nodeid: nodeid, tcpport: port, tag: 'novnc' }); + if (node.mtype == 3) { var mesh = meshes[node.meshid]; if (mesh.relayid) { nodeid = mesh.relayid; addr = node.host; } } // Setup device replay if needed + meshserver.send({ action: 'getcookie', nodeid: nodeid, tcpport: port, tcpaddr: addr, tag: 'novnc' }); } function p10mstsc(nodeid, port) {