diff --git a/meshcentral.js b/meshcentral.js index 109085c4..5efe7118 100644 --- a/meshcentral.js +++ b/meshcentral.js @@ -212,6 +212,19 @@ function CreateMeshCentralServer(config, args) { return; } + // Setup the Node+NPM path if possible, this makes it possible to update the server even if NodeJS and NPM are not in default paths. + if (obj.args.npmpath == null) { + try { + var nodepath = process.argv[0]; + var npmpath = obj.path.join(obj.path.dirname(process.argv[0]), 'npm'); + if (obj.fs.existsSync(nodepath) && obj.fs.existsSync(npmpath)) { + if (nodepath.indexOf(' ') >= 0) { nodepath = '"' + nodepath + '"'; } + if (npmpath.indexOf(' ') >= 0) { npmpath = '"' + npmpath + '"'; } + if (obj.platform == 'win32') { obj.args.npmpath = npmpath; } else { obj.args.npmpath = (nodepath + ' ' + npmpath); } + } + } catch (ex) { } + } + // Linux background service systemd handling if (obj.platform == 'linux') { if (obj.args.install == true) { @@ -1260,19 +1273,6 @@ function CreateMeshCentralServer(config, args) { if (obj.config.settings.autobackup && (typeof obj.config.settings.autobackup.backupintervalhours == 'number')) { setInterval(obj.db.performBackup, obj.config.settings.autobackup.backupintervalhours * 60 * 60 * 1000); } - - // Setup the Node+NPM path if possible, this makes it possible to update the server even if NodeJS and NPM are not in default paths. - if (obj.args.npmpath == null) { - try { - var nodepath = process.argv[0]; - var npmpath = obj.path.join(obj.path.dirname(process.argv[0]), 'npm'); - if (obj.fs.existsSync(nodepath) && obj.fs.existsSync(npmpath)) { - if (nodepath.indexOf(' ') >= 0) { nodepath = '"' + nodepath + '"'; } - if (npmpath.indexOf(' ') >= 0) { npmpath = '"' + npmpath + '"'; } - if (obj.platform == 'win32') { obj.args.npmpath = npmpath; } else { obj.args.npmpath = (nodepath + ' ' + npmpath); } - } - } catch (ex) { } - } }); }); }; diff --git a/views/default.handlebars b/views/default.handlebars index 291eebdb..12aa381b 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -3884,7 +3884,7 @@ var csv = "id, name, rname, host, icon, ip, osdesc, state, groupname, conn, pwr" + '\r\n', chkNodeIds = getCheckedDevices(), r = []; for (var i in chkNodeIds) { var n = getNodeFromId(chkNodeIds[i]); - csv += '\"' + n._id.split(',').join('') + '\",\"' + n.name.split(',').join('') + '\",\"' + (n.rname?(n.rname.split(',').join('')):'') + '\",\"' + n.host.split(',').join('') + '\",\"' + n.icon + '\",\"' + (n.ip?n.ip:'') + '\",\"' + (n.osdesc?(n.osdesc.split(',').join('')):'') + '\",\"' + n.state + '\",\"' + meshes[n.meshid].name.split(',').join('') + '\",\"' + (n.conn?n.conn:'') + '\",\"' + (n.pwr?n.pwr:'') + '\"\r\n'; + csv += '\"' + n._id.split(',').join('') + '\",\"' + n.name.split(',').join('') + '\",\"' + (n.rname?(n.rname.split(',').join('')):'') + '\",\"' + (n.host?(n.host.split(',').join('')):'') + '\",\"' + n.icon + '\",\"' + (n.ip?n.ip:'') + '\",\"' + (n.osdesc?(n.osdesc.split(',').join('')):'') + '\",\"' + n.state + '\",\"' + meshes[n.meshid].name.split(',').join('') + '\",\"' + (n.conn?n.conn:'') + '\",\"' + (n.pwr?n.pwr:'') + '\"\r\n'; } saveAs(new Blob([csv], { type: 'application/octet-stream' }), "devicelist.csv"); return false;