diff --git a/meshuser.js b/meshuser.js index 6277e134..58d6c016 100644 --- a/meshuser.js +++ b/meshuser.js @@ -5644,9 +5644,8 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use function serverCommandServerErrors(command) { // Load the server error log - if (userHasSiteUpdate() && domainHasMyServerErrorLog()) { + if (userHasSiteUpdate() && domainHasMyServerErrorLog()) fs.readFile(parent.parent.getConfigFilePath('mesherrors.txt'), 'utf8', function (err, data) { try { ws.send(JSON.stringify({ action: 'servererrors', data: data })); } catch (ex) { } }); - } } function serverCommandServerStats(command) { @@ -5669,10 +5668,8 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use if (req.session.loginToken != null) return; // Perform server update - if (!userHasSiteUpdate()) return; - if ((domain.myserver === false) || ((domain.myserver != null) && (domain.myserver !== true) && (domain.myserver.upgrade !== true))) return; - if ((command.version != null) && (typeof command.version != 'string')) return; - parent.parent.performServerUpdate(command.version); + if (userHasSiteUpdate() && domainHasMyServerUpgrade() && !((command.version != null) && (typeof command.version != 'string'))) + parent.parent.performServerUpdate(command.version); } function serverCommandServerVersion(command) { @@ -5680,9 +5677,8 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use if (req.session.loginToken != null) return; // Check the server version - if (!userHasSiteUpdate()) return; - if ((domain.myserver === false) || ((domain.myserver != null) && (domain.myserver !== true) && (domain.myserver.upgrade !== true))) return; - parent.parent.getServerTags(function (tags, err) { try { ws.send(JSON.stringify({ action: 'serverversion', tags: tags })); } catch (ex) { } }); + if (userHasSiteUpdate() && domainHasMyServerUpgrade()) + parent.parent.getServerTags(function (tags, err) { try { ws.send(JSON.stringify({ action: 'serverversion', tags: tags })); } catch (ex) { } }); } function serverCommandUsers(command) { @@ -6287,7 +6283,8 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use } function userHasSiteUpdate() { return ((user.siteadmin & SITERIGHT_SERVERUPDATE) > 0); } - function domainHasMyServerErrorLog() { return !((domain.myserver === false) || ((domain.myserver != null) && (domain.myserver !== true) && (domain.myserver.errorlog !== true))) } + function domainHasMyServerErrorLog() { return !((domain.myserver === false) || ((domain.myserver != null) && (domain.myserver !== true) && (domain.myserver.errorlog !== true))); } + function domainHasMyServerUpgrade() { return !((domain.myserver === false) || ((domain.myserver != null) && (domain.myserver !== true) && (domain.myserver.upgrade !== true))); } function csvClean(s) { return '\"' + s.split('\"').join('').split(',').join('').split('\r').join('').split('\n').join('') + '\"'; }