Improved server console commands info and added showpaths.

This commit is contained in:
Ylian Saint-Hilaire 2019-12-09 14:57:40 -08:00
parent cedb058a4b
commit 66432ff13b
2 changed files with 24 additions and 4 deletions

View File

@ -691,9 +691,14 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
switch (cmd) { switch (cmd) {
case 'help': { case 'help': {
r = 'Available commands: help, info, versions, args, resetserver, showconfig, usersessions, tasklimiter, setmaxtasks, cores,\r\n' var fin = '', f = '', availcommands = 'help,info,versions,args,resetserver,showconfig,usersessions,tasklimiter,setmaxtasks,cores,migrationagents,agentstats,webstats,mpsstats,swarmstats,acceleratorsstats,updatecheck,serverupdate,nodeconfig,heapdump,relays,autobackup,backupconfig,dupagents,dispatchtable,badlogins,showpaths';
r += 'migrationagents, agentstats, webstats, mpsstats, swarmstats, acceleratorsstats, updatecheck, serverupdate, nodeconfig,\r\n'; availcommands = availcommands.split(',').sort();
r += 'heapdump, relays, autobackup, backupconfig, dupagents, dispatchtable, badlogins.'; while (availcommands.length > 0) {
if (f.length > 80) { fin += (f + ',\r\n'); f = ''; }
f += (((f != '') ? ', ' : ' ') + availcommands.shift());
}
if (f != '') { fin += f; }
r = 'Available commands: \r\n' + fin + '.';
break; break;
} }
case 'badlogins': { case 'badlogins': {
@ -776,12 +781,15 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
var info = process.memoryUsage(); var info = process.memoryUsage();
info.dbType = ['None', 'NeDB', 'MongoJS', 'MongoDB'][parent.db.databaseType]; info.dbType = ['None', 'NeDB', 'MongoJS', 'MongoDB'][parent.db.databaseType];
if (parent.db.databaseType == 3) { info.dbChangeStream = parent.db.changeStream; } if (parent.db.databaseType == 3) { info.dbChangeStream = parent.db.changeStream; }
try { info.nodeVersion = Number(process.version.match(/^v(\d+\.\d+)/)[1]); } catch (ex) { }
try { info.currentVer = parent.parent.currentVer; } catch (ex) { }
try { info.platform = process.platform; } catch (ex) { } try { info.platform = process.platform; } catch (ex) { }
try { info.arch = process.arch; } catch (ex) { } try { info.arch = process.arch; } catch (ex) { }
try { info.pid = process.pid; } catch (ex) { } try { info.pid = process.pid; } catch (ex) { }
try { info.uptime = process.uptime(); } catch (ex) { } try { info.uptime = process.uptime(); } catch (ex) { }
try { info.version = process.version; } catch (ex) { } try { info.version = process.version; } catch (ex) { }
try { info.cpuUsage = process.cpuUsage(); } catch (ex) { } try { info.cpuUsage = process.cpuUsage(); } catch (ex) { }
try { info.warnings = parent.parent.getServerWarnings(); } catch (ex) { }
r = JSON.stringify(info, null, 4); r = JSON.stringify(info, null, 4);
break; break;
} }
@ -839,6 +847,18 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
if (parent.parent.defaultMeshCores != null) { for (var i in parent.parent.defaultMeshCores) { r += i + ': ' + parent.parent.defaultMeshCores[i].length + ' bytes<br />'; } } if (parent.parent.defaultMeshCores != null) { for (var i in parent.parent.defaultMeshCores) { r += i + ': ' + parent.parent.defaultMeshCores[i].length + ' bytes<br />'; } }
break; break;
} }
case 'showpaths': {
r = 'Parent: ' + parent.parent.parentpath + '\r\n';
r += 'Data: ' + parent.parent.datapath + '\r\n';
r += 'Files: ' + parent.parent.filespath + '\r\n';
r += 'Backup: ' + parent.parent.backuppath + '\r\n';
r += 'Record: ' + parent.parent.recordpath + '\r\n';
r += 'WebPublic: ' + parent.parent.webPublicPath + '\r\n';
r += 'WebViews: ' + parent.parent.webViewsPath + '\r\n';
if (parent.parent.webViewsOverridePath) { r += 'XWebPublic: ' + parent.parent.webViewsOverridePath + '\r\n'; }
if (parent.parent.webViewsOverridePath) { r += 'XWebViews: ' + parent.parent.webPublicOverridePath + '\r\n'; }
break;
}
case 'showconfig': { case 'showconfig': {
// Make a copy of the configuration and hide any secrets // Make a copy of the configuration and hide any secrets
var config = common.Clone(parent.parent.config); var config = common.Clone(parent.parent.config);

View File

@ -1,6 +1,6 @@
{ {
"name": "meshcentral", "name": "meshcentral",
"version": "0.4.5-l", "version": "0.4.5-m",
"keywords": [ "keywords": [
"Remote Management", "Remote Management",
"Intel AMT", "Intel AMT",