Added LoginKey support to MeshCmd
Ylian Saint-Hilaire committed
Sep 18, 2020 at 11:40 UTC
d12d9e7e2ac96592bbc1254bac711fe38605d7b8
2 files changed
+3
agents/meshcmd.js
+1
@@ -2120,6 +2120,7 @@ function startRouter() {
2120
url += '?user=' + settings.username + '&pass=' + settings.password;
2121
}
2122
if (settings.emailtoken) { url += '&token=**email**'; } else if (settings.token != null) { url += '&token=' + settings.token; }
2123
+ if (settings.loginkey) { url += '&key=' + settings.loginkey; }
2124
options = http.parseUri(url);
2125
} catch (e) { console.log("Unable to parse \"serverUrl\"."); process.exit(1); return; }
2126
options.checkServerIdentity = onVerifyServer;
webserver.js
+2
@@ -4233,6 +4233,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
4233
debugLevel: 0
4234
};
4235
if (user != null) { meshaction.username = user.name; }
4236
+ if (req.query.key != null) { meshaction.loginKey = req.query.key; }
4237
var httpsPort = ((obj.args.aliasport == null) ? obj.args.port : obj.args.aliasport); // Use HTTPS alias port is specified
4238
if (obj.args.lanonly != true) { meshaction.serverUrl = ((obj.args.notls == true) ? 'ws://' : 'wss://') + obj.getWebServerName(domain) + ':' + httpsPort + '/' + ((domain.id == '') ? '' : ('/' + domain.id)) + 'meshrelay.ashx'; }
4239
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) {
4248
debugLevel: 0
4249
};
4250
if (user != null) { meshaction.username = user.name; }
4251
+ if (req.query.key != null) { meshaction.loginKey = req.query.key; }
4252
var httpsPort = ((obj.args.aliasport == null) ? obj.args.port : obj.args.aliasport); // Use HTTPS alias port is specified
4253
if (obj.args.lanonly != true) { meshaction.serverUrl = ((obj.args.notls == true) ? 'ws://' : 'wss://') + obj.getWebServerName(domain) + ':' + httpsPort + '/' + ((domain.id == '') ? '' : ('/' + domain.id)) + 'meshrelay.ashx'; }
4254
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"' });