add volumes to database

Signed-off-by: Simon Smith <simonsmith5521@gmail.com>

Simon Smith committed Oct 1, 2023 at 19:50 UTC 4fb8e4713dc8988d249dae5d76aa6911329932c6
2 files changed +21
agents/meshcore.js
+15
@@ -654,6 +654,21 @@ var meshCoreObj = { action: 'coreinfo', value: (require('MeshAgent').coreHash ?
654 // Get the operating system description string
655 try { require('os').name().then(function (v) { meshCoreObj.osdesc = v; meshCoreObjChanged(); }); } catch (ex) { }
656
657 +// Get Volumes and BitLocker if Windows
658 +try {
659 + if (process.platform == 'win32'){
660 + if (require('identifiers').volumes_promise != null){
661 + var p = require('identifiers').volumes_promise();
662 + p.then(function (res){
663 + meshCoreObj.volumes = res;
664 + meshCoreObjChanged();
665 + });
666 + }else if (require('identifiers').volumes != null){
667 + meshCoreObj.volumes = require('identifiers').volumes();
668 + meshCoreObjChanged();
669 + }
670 + }
671 +} catch(e) { }
672
673 // Setup logged in user monitoring (THIS IS BROKEN IN WIN7)
674 try {
meshagent.js
+6
@@ -1936,6 +1936,12 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
1936 // TODO: Check that the agent has an interface that is the same as the one we got this websocket connection on. Only set if we have a match.
1937 }
1938
1939 + // Volumes and BitLocker
1940 + if(command.volumes != null){
1941 + if(!device.volumes) { device.volumes = {}; }
1942 + if (JSON.stringify(device.volumes) != JSON.stringify(command.volumes)) { /*changes.push('Volumes status');*/ device.volumes = command.volumes; change = 1; log = 1; }
1943 + }
1944 +
1945 // If there are changes, event the new device
1946 if (change == 1) {
1947 // Do some clean up if needed, these values should not be in the database.