mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-11-22 12:52:50 +03:00
Last Connect improvements, #2939
This commit is contained in:
parent
a5ab48242a
commit
e55d04a2c6
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
agents/agents-new/MeshService.exe
Normal file
BIN
agents/agents-new/MeshService.exe
Normal file
Binary file not shown.
BIN
agents/agents-new/MeshService64.exe
Normal file
BIN
agents/agents-new/MeshService64.exe
Normal file
Binary file not shown.
BIN
agents/agents-old/MeshCmd-signed.exe
Normal file
BIN
agents/agents-old/MeshCmd-signed.exe
Normal file
Binary file not shown.
BIN
agents/agents-old/MeshCmd64-signed.exe
Normal file
BIN
agents/agents-old/MeshCmd64-signed.exe
Normal file
Binary file not shown.
BIN
agents/agents-old/MeshService-signed.exe
Normal file
BIN
agents/agents-old/MeshService-signed.exe
Normal file
Binary file not shown.
BIN
agents/agents-old/MeshService.exe
Normal file
BIN
agents/agents-old/MeshService.exe
Normal file
Binary file not shown.
BIN
agents/agents-old/MeshService64-signed.exe
Normal file
BIN
agents/agents-old/MeshService64-signed.exe
Normal file
Binary file not shown.
BIN
agents/agents-old/MeshService64.exe
Normal file
BIN
agents/agents-old/MeshService64.exe
Normal file
Binary file not shown.
35
meshuser.js
35
meshuser.js
@ -5404,7 +5404,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
||||
'getnetworkinfo': serverCommandGetNetworkInfo,
|
||||
'getsysinfo': serverCommandGetSysInfo,
|
||||
'lastconnect': serverCommandLastConnect,
|
||||
'lastseen': serverCommandLastSeen,
|
||||
'lastconnects': serverCommandLastConnects,
|
||||
'meshes': serverCommandMeshes,
|
||||
'serverconsole': serverCommandServerConsole,
|
||||
'servererrors': serverCommandServerErrors,
|
||||
@ -5538,27 +5538,22 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
||||
});
|
||||
}
|
||||
|
||||
function serverCommandLastSeen(command) {
|
||||
var links = parent.GetAllMeshIdWithRights(user);
|
||||
var extraids = getUserExtraIds();
|
||||
db.GetAllTypeNoTypeFieldMeshFiltered(links, extraids, domain.id, 'node', null, (err, docs) => {
|
||||
if (docs == null) { docs = []; }
|
||||
function serverCommandLastConnects(command) {
|
||||
const links = parent.GetAllMeshIdWithRights(user);
|
||||
const extraids = getUserExtraIds();
|
||||
db.GetAllTypeNoTypeFieldMeshFiltered(links, extraids, domain.id, 'node', null, function (err, docs) {
|
||||
if (docs == null) return;
|
||||
|
||||
// use associative array to join lastconnects on to users's nodes (left join)
|
||||
var LCs = {}
|
||||
for (var i in docs) {
|
||||
LCs[docs[i]._id] = '';
|
||||
}
|
||||
// Create a list of node ids for this user and query them for last device connection time
|
||||
const ids = []
|
||||
for (var i in docs) { ids.push('lc' + docs[i]._id); }
|
||||
|
||||
db.GetAllType('lastconnect', (err, docs) => {
|
||||
for (var j in docs) {
|
||||
var nodeid = docs[j]._id.substring(2);
|
||||
if (LCs[nodeid] != null) {
|
||||
LCs[nodeid] = docs[j].time;
|
||||
}
|
||||
}
|
||||
|
||||
try { ws.send(JSON.stringify({ action: 'lastseen', lastconnects: LCs })); } catch (ex) { }
|
||||
// Pull list of last connections only for device owned by this user
|
||||
db.GetAllIdsOfType(ids, domain.id, 'lastconnect', function (err, docs) {
|
||||
if (docs == null) return;
|
||||
const response = {};
|
||||
for (var j in docs) { response[docs[j]._id.substring(2)] = docs[j].time; }
|
||||
try { ws.send(JSON.stringify({ action: 'lastconnects', lastconnects: response, tag: command.tag })); } catch (ex) { }
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -1373,6 +1373,7 @@
|
||||
var checkedNodeids = {};
|
||||
var deskKeyboardShortcuts = [];
|
||||
var deskLastClipboardSent = null;
|
||||
var requestedLastConnects = false;
|
||||
|
||||
// Console Message Display Timers
|
||||
var p11DeskConsoleMsgTimer = null;
|
||||
@ -1929,7 +1930,6 @@
|
||||
meshserver.send({ action: 'usergroups' });
|
||||
meshserver.send({ action: 'meshes' });
|
||||
meshserver.send({ action: 'nodes', id: '{{currentNode}}' });
|
||||
meshserver.send({ action: 'lastseen' });
|
||||
meshserver.send({ action: 'loginTokens' });
|
||||
if (pluginHandler != null) { meshserver.send({ action: 'plugins' }); }
|
||||
if ('{{currentNode}}'.toLowerCase() == '') { meshserver.send({ action: 'files' }); }
|
||||
@ -2292,13 +2292,14 @@
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'lastseen': {
|
||||
case 'lastconnects': {
|
||||
var lcnodes = Object.keys(message.lastconnects);
|
||||
for (var i in lcnodes) {
|
||||
var lcnodeid = lcnodes[i];
|
||||
var node = getNodeFromId(lcnodeid);
|
||||
if (node != null) { node.lastconnect = message.lastconnects[lcnodeid] }
|
||||
}
|
||||
mainUpdate(4);
|
||||
}
|
||||
case 'msg': {
|
||||
// Check if this is a message from a node
|
||||
@ -3984,7 +3985,10 @@
|
||||
if (deviceViewSettings.devsCols.indexOf('user') >= 0) { colums += '<th style=color:gray;width:120px>' + "User"; }
|
||||
if (deviceViewSettings.devsCols.indexOf('ip') >= 0) { colums += '<th style=color:gray;width:120px>' + "Address"; }
|
||||
if (deviceViewSettings.devsCols.indexOf('conn') >= 0) { colums += '<th style=color:gray;width:100px>' + "Connectivity"; }
|
||||
if (deviceViewSettings.devsCols.indexOf('lastseen') >= 0) { colums += '<th style=color:gray;width:120px>' + "Last Seen"; }
|
||||
if (deviceViewSettings.devsCols.indexOf('lastseen') >= 0) {
|
||||
colums += '<th style=color:gray;width:120px>' + "Last Seen";
|
||||
if (requestedLastConnects == false) { requestedLastConnects = true; meshserver.send({ action: 'lastconnects' }); }
|
||||
}
|
||||
|
||||
// This height of 1 div at the end to fix a problem in Linux firefox browsers
|
||||
r = '<table style=width:100%;margin-top:4px cellpadding=0 cellspacing=0><th style=color:gray>' + colums + r + '</tr></table><div style=height:1px></div>';
|
||||
|
Loading…
Reference in New Issue
Block a user