add volumes to database

Signed-off-by: Simon Smith <simonsmith5521@gmail.com>
This commit is contained in:
Simon Smith 2023-10-01 19:50:27 +00:00
parent f057633e14
commit 4fb8e4713d
2 changed files with 21 additions and 0 deletions

View File

@ -654,6 +654,21 @@ var meshCoreObj = { action: 'coreinfo', value: (require('MeshAgent').coreHash ?
// Get the operating system description string
try { require('os').name().then(function (v) { meshCoreObj.osdesc = v; meshCoreObjChanged(); }); } catch (ex) { }
// Get Volumes and BitLocker if Windows
try {
if (process.platform == 'win32'){
if (require('identifiers').volumes_promise != null){
var p = require('identifiers').volumes_promise();
p.then(function (res){
meshCoreObj.volumes = res;
meshCoreObjChanged();
});
}else if (require('identifiers').volumes != null){
meshCoreObj.volumes = require('identifiers').volumes();
meshCoreObjChanged();
}
}
} catch(e) { }
// Setup logged in user monitoring (THIS IS BROKEN IN WIN7)
try {

View File

@ -1936,6 +1936,12 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
// 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.
}
// Volumes and BitLocker
if(command.volumes != null){
if(!device.volumes) { device.volumes = {}; }
if (JSON.stringify(device.volumes) != JSON.stringify(command.volumes)) { /*changes.push('Volumes status');*/ device.volumes = command.volumes; change = 1; log = 1; }
}
// If there are changes, event the new device
if (change == 1) {
// Do some clean up if needed, these values should not be in the database.