Fixed server crash due to assigning a const.

This commit is contained in:
Ylian Saint-Hilaire 2020-03-31 10:37:52 -07:00
parent 90d5a3cd6f
commit 7bd3a6e75e
2 changed files with 3 additions and 4 deletions

View File

@ -857,13 +857,12 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
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; }
if (parent.parent.pluginHandler != null) { info.plugins = []; for (var i in parent.parent.pluginHandler.plugins) { info.plugins.push(i); } } if (parent.parent.pluginHandler != null) { info.plugins = []; for (var i in parent.parent.pluginHandler.plugins) { info.plugins.push(i); } }
try { info.nodeVersion = Number(process.version.match(/^v(\d+\.\d+)/)[1]); } catch (ex) { } try { info.nodeVersion = process.version; } catch (ex) { }
try { info.currentVer = parent.parent.currentVer; } catch (ex) { } try { info.meshVersion = 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.cpuUsage = process.cpuUsage(); } catch (ex) { } try { info.cpuUsage = process.cpuUsage(); } catch (ex) { }
try { info.warnings = parent.parent.getServerWarnings(); } catch (ex) { } try { info.warnings = parent.parent.getServerWarnings(); } catch (ex) { }
try { info.database = ["Unknown", "NeDB", "MongoJS", "MongoDB", "MariaDB", "MySQL"][parent.parent.db.databaseType]; } catch (ex) { } try { info.database = ["Unknown", "NeDB", "MongoJS", "MongoDB", "MariaDB", "MySQL"][parent.parent.db.databaseType]; } catch (ex) { }

View File

@ -3238,7 +3238,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
// Handle a request to download a mesh agent // Handle a request to download a mesh agent
obj.handleMeshAgentRequest = function (req, res) { obj.handleMeshAgentRequest = function (req, res) {
const domain = getDomain(req, res); var domain = getDomain(req, res);
if (domain == null) { parent.debug('web', 'handleRootRequest: invalid domain.'); try { res.sendStatus(404); } catch (ex) { } return; } if (domain == null) { parent.debug('web', 'handleRootRequest: invalid domain.'); try { res.sendStatus(404); } catch (ex) { } return; }
// If required, check if this user has rights to do this // If required, check if this user has rights to do this