fix getDeviceDetails asking for all devices not including lastconnect #6833

Signed-off-by: si458 <simonsmith5521@gmail.com>
This commit is contained in:
si458 2025-03-03 14:13:34 +00:00
parent b2cd84035b
commit 9398afd07e

View File

@ -5077,9 +5077,18 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
if ((common.validateStrArray(command.nodeids, 1) == false) && (command.nodeids != null)) break; // Check nodeids
if (common.validateString(command.type, 3, 4) == false) break; // Check type
const links = parent.GetAllMeshIdWithRights(user);
const extraids = getUserExtraIds();
db.GetAllTypeNoTypeFieldMeshFiltered(links, extraids, domain.id, 'node', null, obj.deviceSkip, obj.deviceLimit, function (err, docs) {
if (docs == null) return;
const ids = [];
if (command.nodeids != null) {
// Create a list of node ids and query them for last device connection time
const ids = []
for (var i in command.nodeids) { ids.push('lc' + command.nodeids[i]); }
} else {
// Create a list of node ids for this user and query them for last device connection time
for (var i in docs) { ids.push('lc' + docs[i]._id); }
}
db.GetAllIdsOfType(ids, domain.id, 'lastconnect', function (err, docs) {
const lastConnects = {};
if (docs != null) { for (var i in docs) { lastConnects[docs[i]._id] = docs[i]; } }
@ -5355,7 +5364,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
try { ws.send(JSON.stringify({ action: 'getDeviceDetails', data: output, type: type })); } catch (ex) { }
});
});
});
break;
}
case 'endDesktopMultiplex': {