mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-12-24 06:05:53 -05:00
Fixed automatic NPM path.
This commit is contained in:
parent
6412d4ae20
commit
a6ed676450
@ -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) { }
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user