mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-02-12 11:01:52 +00:00
Fixed cross-domain event leakage.
This commit is contained in:
parent
b129740f28
commit
9c7aeaef21
2 changed files with 4 additions and 4 deletions
|
@ -1634,7 +1634,7 @@ function CreateMeshCentralServer(config, args) {
|
||||||
|
|
||||||
// Event any changes on this server only
|
// Event any changes on this server only
|
||||||
if ((newConnectivity != oldPowerState) || (newPowerState != oldPowerState)) {
|
if ((newConnectivity != oldPowerState) || (newPowerState != oldPowerState)) {
|
||||||
obj.DispatchEvent(obj.webserver.CreateNodeDispatchTargets(meshid, nodeid), obj, { action: 'nodeconnect', meshid: meshid, nodeid: nodeid, conn: newConnectivity, pwr: newPowerState, nolog: 1, nopeers: 1 });
|
obj.DispatchEvent(obj.webserver.CreateNodeDispatchTargets(meshid, nodeid), obj, { action: 'nodeconnect', meshid: meshid, nodeid: nodeid, domain: nodeid.split('/')[1], conn: newConnectivity, pwr: newPowerState, nolog: 1, nopeers: 1 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1683,7 +1683,7 @@ function CreateMeshCentralServer(config, args) {
|
||||||
|
|
||||||
// Event the node connection change
|
// Event the node connection change
|
||||||
if (eventConnectChange == 1) {
|
if (eventConnectChange == 1) {
|
||||||
obj.DispatchEvent(obj.webserver.CreateNodeDispatchTargets(meshid, nodeid), obj, { action: 'nodeconnect', meshid: meshid, nodeid: nodeid, conn: state.connectivity, pwr: state.powerState, ct: connectTime, nolog: 1, nopeers: 1 });
|
obj.DispatchEvent(obj.webserver.CreateNodeDispatchTargets(meshid, nodeid), obj, { action: 'nodeconnect', meshid: meshid, nodeid: nodeid, domain: nodeid.split('/')[1], conn: state.connectivity, pwr: state.powerState, ct: connectTime, nolog: 1, nopeers: 1 });
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Multi server mode
|
// Multi server mode
|
||||||
|
@ -1757,7 +1757,7 @@ function CreateMeshCentralServer(config, args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Event the node connection change
|
// Event the node connection change
|
||||||
if (eventConnectChange == 1) { obj.DispatchEvent(obj.webserver.CreateNodeDispatchTargets(meshid, nodeid), obj, { action: 'nodeconnect', meshid: meshid, nodeid: nodeid, conn: state.connectivity, pwr: state.powerState, nolog: 1, nopeers: 1 }); }
|
if (eventConnectChange == 1) { obj.DispatchEvent(obj.webserver.CreateNodeDispatchTargets(meshid, nodeid), obj, { action: 'nodeconnect', meshid: meshid, nodeid: nodeid, domain: nodeid.split('/')[1], conn: state.connectivity, pwr: state.powerState, nolog: 1, nopeers: 1 }); }
|
||||||
} else {
|
} else {
|
||||||
// Multi server mode
|
// Multi server mode
|
||||||
|
|
||||||
|
|
|
@ -268,7 +268,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
||||||
|
|
||||||
// Handle events
|
// Handle events
|
||||||
ws.HandleEvent = function (source, event, ids, id) {
|
ws.HandleEvent = function (source, event, ids, id) {
|
||||||
if (!event.domain || event.domain == domain.id) {
|
if ((event.domain == null) || (event.domain == domain.id)) {
|
||||||
try {
|
try {
|
||||||
if (event == 'close') { try { delete req.session; } catch (ex) { } obj.close(); }
|
if (event == 'close') { try { delete req.session; } catch (ex) { } obj.close(); }
|
||||||
else if (event == 'resubscribe') { user.subscriptions = parent.subscribe(user._id, ws); }
|
else if (event == 'resubscribe') { user.subscriptions = parent.subscribe(user._id, ws); }
|
||||||
|
|
Loading…
Reference in a new issue