mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-03-09 15:40:18 +00:00
More device session notification work.
This commit is contained in:
parent
2ca1817065
commit
6431974136
6 changed files with 97 additions and 11 deletions
18
meshagent.js
18
meshagent.js
|
@ -1327,6 +1327,13 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
|
|||
});
|
||||
break;
|
||||
}
|
||||
case 'sessions': {
|
||||
// This is a list of sessions provided by the agent
|
||||
if (obj.sessions == null) { obj.sessions = {}; }
|
||||
if (command.type == 'kvm') { obj.sessions.kvm = command.value; }
|
||||
obj.updateSessions();
|
||||
break;
|
||||
}
|
||||
case 'plugin': {
|
||||
if ((parent.parent.pluginHandler == null) || (typeof command.plugin != 'string')) break;
|
||||
try {
|
||||
|
@ -1350,6 +1357,17 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
|
|||
}
|
||||
}
|
||||
|
||||
// Notify update of sessions
|
||||
obj.updateSessions = function () {
|
||||
// Perform some clean up
|
||||
for (var i in obj.sessions) { if (Object.keys(obj.sessions[i]).length == 0) { delete obj.sessions[i]; } }
|
||||
if (Object.keys(obj.sessions).length == 0) { delete obj.sessions; }
|
||||
|
||||
// Event the new sessions, this will notify everyone that agent sessions have changed
|
||||
var event = { etype: 'node', action: 'devicesessions', nodeid: obj.dbNodeKey, domain: domain.id, sessions: obj.sessions, nolog: 1 };
|
||||
parent.parent.DispatchEvent(parent.CreateMeshDispatchTargets(obj.dbMeshKey, [obj.dbNodeKey]), obj, event);
|
||||
}
|
||||
|
||||
// Change the current core information string and event it
|
||||
function ChangeAgentCoreInfo(command) {
|
||||
if (obj.agentInfo.capabilities & 0x40) return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue