Fixed MeshCtrl.js, #3999

Ylian Saint-Hilaire committed May 18, 2022 at 13:13 UTC b7231e00e49436318a43196c9c3230ef2bac50bd
1 file changed +11 -1
meshctrl.js
+11 -1
@@ -2187,8 +2187,18 @@ function serverConnect() {
2187 console.log(data.result);
2188 process.exit();
2189 } else {
2190 - ws.send(JSON.stringify({ action: 'loginTokens', responseid: 'meshctrl' }));
2190 + if (args.json) {
2191 + console.log(data);
2192 + } else {
2193 + console.log("New login token created.");
2194 + if (data.name) { console.log("Token name: " + data.name); }
2195 + if (data.created) { console.log("Created: " + new Date(data.created).toLocaleString()); }
2196 + if (data.expire) { console.log("Expire: " + new Date(data.expire).toLocaleString()); }
2197 + if (data.tokenUser) { console.log("Username: " + data.tokenUser); }
2198 + if (data.tokenPass) { console.log("Password: " + data.tokenPass); }
2199 + }
2200 }
2201 + process.exit();
2202 break;
2203 }
2204 case 'loginTokens': {