mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-01-12 23:43:20 -05:00
More auto device removal fixes. #3089
This commit is contained in:
parent
7d25391f78
commit
b2905bfe29
6
db.js
6
db.js
@ -156,9 +156,10 @@ module.exports.CreateDB = function (parent, func) {
|
||||
var expireDays = -1;
|
||||
if (removeInactiveDevicesPerDomain[docs[j].domain]) { expireDays = removeInactiveDevicesPerDomain[docs[j].domain]; }
|
||||
const mesh = parent.webserver.meshes[docs[j].meshid];
|
||||
if (mesh && (typeof mesh.expireDevs == 'number') && (expireDays > mesh.expireDevs)) { expireDays = mesh.expireDevs; }
|
||||
if (mesh && (typeof mesh.expireDevs == 'number')) { expireDays = mesh.expireDevs; }
|
||||
var remove = false;
|
||||
if ((expireDays > 0) && (expireDays < days)) { remove = true; }
|
||||
if (expireDays > 0) {
|
||||
if (expireDays < days) { remove = true; }
|
||||
if (cb) { if (showall || remove) { cb(docs[j]._id.substring(2) + ', ' + days + ' days, expire ' + expireDays + ' days' + (remove ? ', removing' : '')); } }
|
||||
if (remove) {
|
||||
// Check if this device is connected right now
|
||||
@ -219,6 +220,7 @@ module.exports.CreateDB = function (parent, func) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -6255,7 +6255,6 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
||||
cmdData.result = 'Usage: removeinactivedevices [showremoved|showall]';
|
||||
} else {
|
||||
parent.db.removeInactiveDevices((arg == 'showall'), function (msg) { try { ws.send(JSON.stringify({ action: 'serverconsole', value: msg, tag: cmdData.command.tag })); } catch (ex) { } });
|
||||
cmdData.result = 'Ok';
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user