diff --git a/agents/meshcmd.js b/agents/meshcmd.js index 28999c39..ebd3d761 100644 --- a/agents/meshcmd.js +++ b/agents/meshcmd.js @@ -2120,6 +2120,7 @@ function startRouter() { url += '?user=' + settings.username + '&pass=' + settings.password; } if (settings.emailtoken) { url += '&token=**email**'; } else if (settings.token != null) { url += '&token=' + settings.token; } + if (settings.loginkey) { url += '&key=' + settings.loginkey; } options = http.parseUri(url); } catch (e) { console.log("Unable to parse \"serverUrl\"."); process.exit(1); return; } options.checkServerIdentity = onVerifyServer; diff --git a/webserver.js b/webserver.js index db56241a..3d4b733a 100644 --- a/webserver.js +++ b/webserver.js @@ -4233,6 +4233,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) { debugLevel: 0 }; if (user != null) { meshaction.username = user.name; } + if (req.query.key != null) { meshaction.loginKey = req.query.key; } var httpsPort = ((obj.args.aliasport == null) ? obj.args.port : obj.args.aliasport); // Use HTTPS alias port is specified if (obj.args.lanonly != true) { meshaction.serverUrl = ((obj.args.notls == true) ? 'ws://' : 'wss://') + obj.getWebServerName(domain) + ':' + httpsPort + '/' + ((domain.id == '') ? '' : ('/' + domain.id)) + 'meshrelay.ashx'; } res.set({ 'Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0', 'Content-Type': 'text/plain', 'Content-Disposition': 'attachment; filename="meshaction.txt"' }); @@ -4247,6 +4248,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) { debugLevel: 0 }; if (user != null) { meshaction.username = user.name; } + if (req.query.key != null) { meshaction.loginKey = req.query.key; } var httpsPort = ((obj.args.aliasport == null) ? obj.args.port : obj.args.aliasport); // Use HTTPS alias port is specified if (obj.args.lanonly != true) { meshaction.serverUrl = ((obj.args.notls == true) ? 'ws://' : 'wss://') + obj.getWebServerName(domain) + ':' + httpsPort + '/' + ((domain.id == '') ? '' : ('/' + domain.id)) + 'meshrelay.ashx'; } res.set({ 'Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0', 'Content-Type': 'text/plain', 'Content-Disposition': 'attachment; filename="meshaction.txt"' });