Web-VNC fixes when used with replayed device group.

Ylian Saint-Hilaire committed Apr 14, 2022 at 12:28 UTC a32cea93e98b43aa2dccdc1dff6a930bc2e8d532
2 files changed +6 -7
meshuser.js
-1
@@ -5699,7 +5699,6 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
5699 if (command.nodeid) { cookieContent.nodeid = command.nodeid; }
5700 if (command.tcpaddr) { cookieContent.tcpaddr = command.tcpaddr; } // Indicates the browser want the agent to TCP connect to a remote address
5701 if (command.tcpport) { cookieContent.tcpport = command.tcpport; } // Indicates the browser want the agent to TCP connect to a remote port
5702 - if (command.ip) { cookieContent.ip = command.ip; } // Indicates the browser want to agent to relay a TCP connection to a IP:port
5702 if (node.mtype == 3) { cookieContent.lc = 1; command.localRelay = true; } // Indicate this is for a local connection
5703 command.cookie = parent.parent.encodeCookie(cookieContent, parent.parent.loginCookieEncryptionKey);
5704 command.trustedCert = parent.isTrustedCert(domain);
views/default.handlebars
+6 -6
@@ -7930,19 +7930,19 @@
7930 meshserver.send({ action: 'removedevices', nodeids: [ nodeid ] });
7931 }
7932
7933 - function p10MCRouter(nodeid, protocol, port, ip, localport) {
7933 + function p10MCRouter(nodeid, protocol, port, addr, localport) {
7934 var node = getNodeFromId(nodeid);
7935 if ((protocol == 3) && (port == null)) { if (node.rdpport != null) { port = node.rdpport; } else { port = 3389; } } // Adjust RDP port if needed
7936 - if (node.mtype == 3) { var mesh = meshes[node.meshid]; if (mesh.relayid) { nodeid = mesh.relayid; ip = node.host; } } // Setup device replay if needed
7937 - 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
7936 + if (node.mtype == 3) { var mesh = meshes[node.meshid]; if (mesh.relayid) { nodeid = mesh.relayid; addr = node.host; } } // Setup device replay if needed
7937 + 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
7938 return false;
7939 }
7940
7941 function p10rfb(nodeid, port) {
7942 - var node = getNodeFromId(nodeid);
7942 + var node = getNodeFromId(nodeid), addr = null;
7943 if (port == null) { if (node.rfbport != null) { port = node.rfbport; } else { port = 5900; } }
7944 - if (node.mtype == 3) { var mesh = meshes[node.meshid]; if (mesh.relayid) { nodeid = mesh.relayid; ip = node.host; } } // Setup device replay if needed
7945 - meshserver.send({ action: 'getcookie', nodeid: nodeid, tcpport: port, tag: 'novnc' });
7944 + if (node.mtype == 3) { var mesh = meshes[node.meshid]; if (mesh.relayid) { nodeid = mesh.relayid; addr = node.host; } } // Setup device replay if needed
7945 + meshserver.send({ action: 'getcookie', nodeid: nodeid, tcpport: port, tcpaddr: addr, tag: 'novnc' });
7946 }
7947
7948 function p10mstsc(nodeid, port) {