mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-03-09 15:40:18 +00:00
Now need agent uninstall permission to delete a device, mesh edit permission to move a device between groups.
This commit is contained in:
parent
936d7aeb0e
commit
dd70ec8a34
6 changed files with 33 additions and 25 deletions
|
@ -251,17 +251,18 @@ function createMeshCore(agent) {
|
|||
return (svc);
|
||||
}
|
||||
|
||||
/*
|
||||
// TODO: Monitor the file 'batterystate.txt' in the agent's folder and sends battery update when this file is changed.
|
||||
if (require('fs').existsSync('batterystate.txt')) {
|
||||
/*
|
||||
if (require('fs').existsSync(process.cwd() + 'batterystate.txt')) {
|
||||
// Setup manual battery monitoring
|
||||
require('MeshAgent')._batteryFileWatcher = require('fs').watch('.', function (a) {
|
||||
sendConsoleText('Manual Battery State Monitor');
|
||||
require('MeshAgent')._batteryFileWatcher = require('fs').watch(process.cwd(), function (a) {
|
||||
if (require('MeshAgent')._batteryFileTimer != null) return;
|
||||
require('MeshAgent')._batteryFileTimer = setTimeout(function () {
|
||||
sendConsoleText('Battery State Changed');
|
||||
try {
|
||||
require('MeshAgent')._batteryFileTimer = null;
|
||||
var data = require('fs').readFileSync('batterystate.txt').toString();
|
||||
var data = require('fs').readFileSync(process.cwd() + 'batterystate.txt').toString();
|
||||
if (data.length < 10) {
|
||||
data = data.split(',');
|
||||
if ((data.length == 2) && ((data[0] == 'ac') || (data[0] == 'dc'))) { require('MeshAgent').SendCommand({ action: 'battery', state: data[0], level: parseInt(data[1]) }); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue