From 990214ed1978ecf5a9183bbeee26cd41846250c4 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Mon, 9 Dec 2019 14:57:40 -0800 Subject: [PATCH] Improved server console commands info and added showpaths. --- meshuser.js | 26 +++++++++++++++++++++++--- package.json | 2 +- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/meshuser.js b/meshuser.js index 297ec00a..3d105576 100644 --- a/meshuser.js +++ b/meshuser.js @@ -691,9 +691,14 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use switch (cmd) { case 'help': { - r = 'Available commands: help, info, versions, args, resetserver, showconfig, usersessions, tasklimiter, setmaxtasks, cores,\r\n' - r += 'migrationagents, agentstats, webstats, mpsstats, swarmstats, acceleratorsstats, updatecheck, serverupdate, nodeconfig,\r\n'; - r += 'heapdump, relays, autobackup, backupconfig, dupagents, dispatchtable, badlogins.'; + 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'; + availcommands = availcommands.split(',').sort(); + 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; } case 'badlogins': { @@ -776,12 +781,15 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use var info = process.memoryUsage(); info.dbType = ['None', 'NeDB', 'MongoJS', 'MongoDB'][parent.db.databaseType]; 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.arch = process.arch; } catch (ex) { } try { info.pid = process.pid; } catch (ex) { } try { info.uptime = process.uptime(); } catch (ex) { } try { info.version = process.version; } catch (ex) { } try { info.cpuUsage = process.cpuUsage(); } catch (ex) { } + try { info.warnings = parent.parent.getServerWarnings(); } catch (ex) { } r = JSON.stringify(info, null, 4); 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
'; } } 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': { // Make a copy of the configuration and hide any secrets var config = common.Clone(parent.parent.config); diff --git a/package.json b/package.json index ceafa8bd..af9b3482 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "meshcentral", - "version": "0.4.5-l", + "version": "0.4.5-m", "keywords": [ "Remote Management", "Intel AMT",