From 4e0764fe4db584b7cf21c99d32c1db863aa9390a Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Fri, 17 Apr 2020 23:52:35 -0700 Subject: [PATCH] Server upgrade improvements. --- meshcentral.js | 5 +++-- package.json | 2 +- sample-config.json | 6 ++---- views/default.handlebars | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/meshcentral.js b/meshcentral.js index 174b3650..2d5cf163 100644 --- a/meshcentral.js +++ b/meshcentral.js @@ -390,6 +390,7 @@ function CreateMeshCentralServer(config, args) { // Server self-update exit var version = ''; if (typeof obj.args.selfupdate == 'string') { version = '@' + obj.args.selfupdate; } + else if (typeof obj.args.specificupdate == 'string') { version = '@' + obj.args.specificupdate; delete obj.args.specificupdate; } var child_process = require('child_process'); var npmpath = ((typeof obj.args.npmpath == 'string') ? obj.args.npmpath : 'npm'); var npmproxy = ((typeof obj.args.npmproxy == 'string') ? (' --proxy ' + obj.args.npmproxy) : ''); @@ -416,7 +417,7 @@ function CreateMeshCentralServer(config, args) { else if (data.indexOf('Server Ctrl-C exit...') >= 0) { childProcess.xrestart = 2; } else if (data.indexOf('Starting self upgrade...') >= 0) { childProcess.xrestart = 3; } else if (data.indexOf('Server restart...') >= 0) { childProcess.xrestart = 1; } - else if (data.indexOf('Starting self upgrade to: ') >= 0) { obj.args.selfupdate = data.substring(26).split('\r')[0].split('\n')[0]; childProcess.xrestart = 3; } + else if (data.indexOf('Starting self upgrade to: ') >= 0) { obj.args.specificupdate = data.substring(26).split('\r')[0].split('\n')[0]; childProcess.xrestart = 3; } var datastr = data; while (datastr.endsWith('\r') || datastr.endsWith('\n')) { datastr = datastr.substring(0, datastr.length - 1); } console.log(datastr); @@ -462,7 +463,7 @@ function CreateMeshCentralServer(config, args) { obj.getServerTags = function (callback) { if (callback == null) return; try { - if (typeof obj.args.selfupdate == 'string') { callback(getCurrentVerion(), obj.args.selfupdate); return; } // If we are targetting a specific version, return that one as current. + if (typeof obj.args.selfupdate == 'string') { callback({ current: getCurrentVerion(), latest: obj.args.selfupdate }); return; } // If we are targetting a specific version, return that one as current. var child_process = require('child_process'); var npmpath = ((typeof obj.args.npmpath == 'string') ? obj.args.npmpath : 'npm'); var npmproxy = ((typeof obj.args.npmproxy == 'string') ? (' --proxy ' + obj.args.npmproxy) : ''); diff --git a/package.json b/package.json index fdb6bf62..e057b04f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "meshcentral", - "version": "0.5.5", + "version": "0.5.6", "keywords": [ "Remote Management", "Intel AMT", diff --git a/sample-config.json b/sample-config.json index cccc8f06..1dae7946 100644 --- a/sample-config.json +++ b/sample-config.json @@ -74,10 +74,8 @@ "meshcommander": "https://www.meshcommander.com/" }, "__MaxInvalidLogin": "Time in minutes, max amount of bad logins from a source IP in the time before logins are rejected.", - "MaxInvalidLogin": { "time": 10, "count": 10, "coolofftime": 10 }, - "Plugins": { - "enabled": true - } + "_MaxInvalidLogin": { "time": 10, "count": 10, "coolofftime": 10 }, + "_Plugins": { "enabled": true } }, "_domains": { "": { diff --git a/views/default.handlebars b/views/default.handlebars index b90fc9ef..fef8591b 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -8253,7 +8253,7 @@ function server_showVersionDlgEx(b, tags) { if (Q('d2updateCheck1').checked) { meshserver.send({ action: 'serverupdate', tag: 'stable', version: tags.stable }); } - if (Q('d2updateCheck2').checked) { meshserver.send({ action: 'serverupdate', tag: 'latest', version: tags.latest }); } + if (Q('d2updateCheck2').checked) { meshserver.send({ action: 'serverupdate' }); } // , tag: 'latest', version: tags.latest } function server_showErrorsDlg() {