mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-03-09 15:40:18 +00:00
Greenlock being deprecated, added NODESKTOP device group permission.
This commit is contained in:
parent
16e679d49a
commit
67a3b001e1
7 changed files with 435 additions and 403 deletions
34
mcrec.js
34
mcrec.js
|
@ -263,23 +263,25 @@ function readNextBlock(state, func) {
|
|||
var r = {}, buf = Buffer.alloc(16);
|
||||
fs.read(state.recFile, buf, 0, 16, state.recFilePtr, function (err, bytesRead, buf) {
|
||||
if (bytesRead != 16) { func(state, null, true); return; } // Error
|
||||
r.type = buf.readUInt16BE(0);
|
||||
r.flags = buf.readUInt16BE(2);
|
||||
r.size = buf.readUInt32BE(4);
|
||||
r.time = buf.readUIntBE(8, 8);
|
||||
r.date = new Date(r.time);
|
||||
r.ptr = state.recFilePtr;
|
||||
if ((state.recFilePtr + 16 + r.size) > state.recFileSize) { func(state, null, true); return; } // Error
|
||||
if (r.size == 0) {
|
||||
r.data = null;
|
||||
func(state, r);
|
||||
} else {
|
||||
r.data = Buffer.alloc(r.size);
|
||||
fs.read(state.recFile, r.data, 0, r.size, state.recFilePtr + 16, function (err, bytesRead, buf) {
|
||||
state.recFilePtr += (16 + r.size);
|
||||
try {
|
||||
r.type = buf.readUInt16BE(0);
|
||||
r.flags = buf.readUInt16BE(2);
|
||||
r.size = buf.readUInt32BE(4);
|
||||
r.time = buf.readUIntBE(8, 8);
|
||||
r.date = new Date(r.time);
|
||||
r.ptr = state.recFilePtr;
|
||||
if ((state.recFilePtr + 16 + r.size) > state.recFileSize) { func(state, null, true); return; } // Error
|
||||
if (r.size == 0) {
|
||||
r.data = null;
|
||||
func(state, r);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
r.data = Buffer.alloc(r.size);
|
||||
fs.read(state.recFile, r.data, 0, r.size, state.recFilePtr + 16, function (err, bytesRead, buf) {
|
||||
state.recFilePtr += (16 + r.size);
|
||||
func(state, r);
|
||||
});
|
||||
}
|
||||
} catch (ex) { func(state, null, true); return; } // Error
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue