diff --git a/apprelays.js b/apprelays.js index cf228f39..69fed7fe 100644 --- a/apprelays.js +++ b/apprelays.js @@ -216,8 +216,8 @@ module.exports.CreateSshRelay = function (parent, db, ws, req, args, domain) { delete obj.wsClient; } - if ((arg == 1) || (arg == null)) { try { ws.close(); } catch (e) { console.log(e); } } // Soft close, close the websocket - if (arg == 2) { try { ws._socket._parent.end(); } catch (e) { console.log(e); } } // Hard close, close the TCP socket + if ((arg == 1) || (arg == null)) { try { ws.close(); } catch (ex) { console.log(ex); } } // Soft close, close the websocket + if (arg == 2) { try { ws._socket._parent.end(); } catch (ex) { console.log(ex); } } // Hard close, close the TCP socket obj.ws.removeAllListeners(); obj.relayActive = false; @@ -229,7 +229,6 @@ module.exports.CreateSshRelay = function (parent, db, ws, req, args, domain) { // Decode the authentication cookie obj.cookie = parent.parent.decodeCookie(req.query.auth, parent.parent.loginCookieEncryptionKey); if (obj.cookie == null) { obj.ws.send(JSON.stringify({ action: 'sessionerror' })); obj.close(); return; } - console.log(obj.cookie); // Start the looppback server function startRelayConnection() { @@ -391,8 +390,8 @@ module.exports.CreateSshTerminalRelay = function (parent, db, ws, req, domain, u delete obj.wsClient; } - if ((arg == 1) || (arg == null)) { try { ws.close(); } catch (e) { console.log(e); } } // Soft close, close the websocket - if (arg == 2) { try { ws._socket._parent.end(); } catch (e) { console.log(e); } } // Hard close, close the TCP socket + if ((arg == 1) || (arg == null)) { try { ws.close(); } catch (ex) { console.log(ex); } } // Soft close, close the websocket + if (arg == 2) { try { ws._socket._parent.end(); } catch (ex) { console.log(ex); } } // Hard close, close the TCP socket obj.ws.removeAllListeners(); obj.relayActive = false; diff --git a/views/default.handlebars b/views/default.handlebars index ca096cf6..e65052b7 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -6417,7 +6417,7 @@ x += '
'; // Show action button, only show if we have permissions 4, 8, 64 - if (((meshrights & (4 + 8 + 64)) != 0) && (node.mtype != 3) && (node.agent.id != 34)) { x += ''; } + if (((meshrights & (4 + 8 + 64)) != 0) && (node.mtype != 3) && ((node.agent == null) || (node.agent.id != 34))) { x += ''; } x += ''; x += ''; if ((meshrights & 8) && ((connectivity & 1) || ((node.pmt == 1) && ((features2 & 2) != 0)))) { x += ''; } @@ -6460,7 +6460,7 @@ x += '
'; if ((node.agent) && (node.mtype != 3)) x += '' + "Interfaces" + ' '; if ((features & 0x00008000) && (xxmap != null)) x += '' + "Location" + ' '; - if ((node.agent.id != 14) && (node.agent.id != 34)) { + if ((node.agent == null) || ((node.agent.id != 14) && (node.agent.id != 34))) { if ((userinfo.siteadmin == 0xFFFFFFFF) || ((userinfo.siteadmin & 128) == 0)) { // Check if we should view tools if ((terminalAccess) && ((meshrights & 8) != 0) && (node.agent != null) && (node.agent.id != 14)) x += '' + "MeshCmd" + ' '; }