mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-02-04 10:25:58 -05:00
1. Added polyfill for Array.findIndex() if missing
2. Added try/catch around indentiers module
This commit is contained in:
parent
b58d7837a3
commit
1574a9bec9
@ -46,6 +46,27 @@ var MESHRIGHT_CHATNOTIFY = 16384;
|
||||
var MESHRIGHT_UNINSTALL = 32768;
|
||||
var MESHRIGHT_NODESKTOP = 65536;
|
||||
|
||||
try
|
||||
{
|
||||
Object.defineProperty(Array.prototype, 'findIndex', {
|
||||
value: function (func)
|
||||
{
|
||||
var i = 0;
|
||||
for (i = 0; i < this.length; ++i)
|
||||
{
|
||||
if (func(this[i], i, this))
|
||||
{
|
||||
return (i);
|
||||
}
|
||||
}
|
||||
return (-1);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (x)
|
||||
{
|
||||
}
|
||||
|
||||
if (require('MeshAgent').ARCHID == null) {
|
||||
var id = null;
|
||||
switch (process.platform) {
|
||||
@ -409,7 +430,10 @@ if ((require('fs').existsSync(process.cwd() + 'batterystate.txt')) && (require('
|
||||
}, 1000);
|
||||
});
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
// Setup normal battery monitoring
|
||||
if (require('identifiers').isBatteryPowered && require('identifiers').isBatteryPowered()) {
|
||||
require('MeshAgent')._battLevelChanged = function _battLevelChanged(val) {
|
||||
@ -433,6 +457,10 @@ else {
|
||||
});
|
||||
}
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MeshAgent JavaScript Core Module. This code is sent to and running on the mesh agent.
|
||||
|
Loading…
x
Reference in New Issue
Block a user