mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-11-22 22:17:31 +03:00
Added function handlers for traffic stats,delta
This commit is contained in:
parent
ccd04ed573
commit
ca864539ff
22
meshuser.js
22
meshuser.js
@ -4478,16 +4478,6 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
||||
});
|
||||
break;
|
||||
}
|
||||
case 'trafficstats': {
|
||||
try { ws.send(JSON.stringify({ action: 'trafficstats', stats: parent.getTrafficStats() })); } catch (ex) { }
|
||||
break;
|
||||
}
|
||||
case 'trafficdelta': {
|
||||
const stats = parent.getTrafficDelta(obj.trafficStats);
|
||||
obj.trafficStats = stats.current;
|
||||
try { ws.send(JSON.stringify({ action: 'trafficdelta', delta: stats.delta })); } catch (ex) { }
|
||||
break;
|
||||
}
|
||||
case 'getDeviceDetails': {
|
||||
if ((common.validateStrArray(command.nodeids, 1) == false) && (command.nodeids != null)) break; // Check nodeids
|
||||
if (common.validateString(command.type, 3, 4) == false) break; // Check type
|
||||
@ -4898,6 +4888,8 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
||||
'serverversion': serverCommandServerVersion,
|
||||
'setClip': serverCommandSetClip,
|
||||
'smsuser': serverCommandSmsUser,
|
||||
'trafficdelta': serverCommandTrafficDelta,
|
||||
'trafficstats': serverCommandtrafficStats,
|
||||
'updateUserImage': serverCommandUpdateUserImage,
|
||||
'urlargs': serverCommandUrlArgs,
|
||||
'users': serverCommandUsers,
|
||||
@ -6078,6 +6070,16 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
||||
});
|
||||
}
|
||||
|
||||
function serverCommandTrafficDelta(command) {
|
||||
const stats = parent.getTrafficDelta(obj.trafficStats);
|
||||
obj.trafficStats = stats.current;
|
||||
try { ws.send(JSON.stringify({ action: 'trafficdelta', delta: stats.delta })); } catch (ex) { }
|
||||
}
|
||||
|
||||
function serverCommandtrafficStats(command) {
|
||||
try { ws.send(JSON.stringify({ action: 'trafficstats', stats: parent.getTrafficStats() })); } catch (ex) { }
|
||||
}
|
||||
|
||||
function serverCommandUpdateUserImage(command) {
|
||||
if (req.session.loginToken != null) return; // Do not allow this command when logged in using a login token
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user