Fixed automatic NPM path.
Ylian Saint-Hilaire committed
Feb 10, 2020 at 13:17 UTC
a6ed676450003cf58daceb0ec3a811f539421e43
2 files changed
+14
-14
meshcentral.js
+13
-13
@@ -212,6 +212,19 @@ function CreateMeshCentralServer(config, args) {
212
return;
213
}
214
215
+ // 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.
216
+ if (obj.args.npmpath == null) {
217
+ try {
218
+ var nodepath = process.argv[0];
219
+ var npmpath = obj.path.join(obj.path.dirname(process.argv[0]), 'npm');
220
+ if (obj.fs.existsSync(nodepath) && obj.fs.existsSync(npmpath)) {
221
+ if (nodepath.indexOf(' ') >= 0) { nodepath = '"' + nodepath + '"'; }
222
+ if (npmpath.indexOf(' ') >= 0) { npmpath = '"' + npmpath + '"'; }
223
+ if (obj.platform == 'win32') { obj.args.npmpath = npmpath; } else { obj.args.npmpath = (nodepath + ' ' + npmpath); }
224
+ }
225
+ } catch (ex) { }
226
+ }
227
+
228
// Linux background service systemd handling
229
if (obj.platform == 'linux') {
230
if (obj.args.install == true) {
@@ -1260,19 +1273,6 @@ function CreateMeshCentralServer(config, args) {
1273
if (obj.config.settings.autobackup && (typeof obj.config.settings.autobackup.backupintervalhours == 'number')) {
1274
setInterval(obj.db.performBackup, obj.config.settings.autobackup.backupintervalhours * 60 * 60 * 1000);
1275
}
1263
-
1264
- // 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.
1265
- if (obj.args.npmpath == null) {
1266
- try {
1267
- var nodepath = process.argv[0];
1268
- var npmpath = obj.path.join(obj.path.dirname(process.argv[0]), 'npm');
1269
- if (obj.fs.existsSync(nodepath) && obj.fs.existsSync(npmpath)) {
1270
- if (nodepath.indexOf(' ') >= 0) { nodepath = '"' + nodepath + '"'; }
1271
- if (npmpath.indexOf(' ') >= 0) { npmpath = '"' + npmpath + '"'; }
1272
- if (obj.platform == 'win32') { obj.args.npmpath = npmpath; } else { obj.args.npmpath = (nodepath + ' ' + npmpath); }
1273
- }
1274
- } catch (ex) { }
1275
- }
1276
});
1277
});
1278
};
views/default.handlebars
+1
-1
@@ -3884,7 +3884,7 @@
3884
var csv = "id, name, rname, host, icon, ip, osdesc, state, groupname, conn, pwr" + '\r\n', chkNodeIds = getCheckedDevices(), r = [];
3885
for (var i in chkNodeIds) {
3886
var n = getNodeFromId(chkNodeIds[i]);
3887
- 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';
3887
+ 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';
3888
}
3889
saveAs(new Blob([csv], { type: 'application/octet-stream' }), "devicelist.csv");
3890
return false;