1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-03-09 15:40:18 +00:00

wait 5 sec after record and also pass message back (#5508)

* wait 5 sec after record and also pass message back

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

* add connect-flash package (#5509)

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

---------

Signed-off-by: si458 <simonsmith5521@gmail.com>
This commit is contained in:
Simon Smith 2023-11-05 04:39:02 +00:00 committed by GitHub
parent 7b016eac58
commit 4790f40179
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 46 additions and 44 deletions

View file

@ -741,32 +741,34 @@ function CreateMeshRelayEx(parent, ws, req, domain, user, cookie) {
var logfile = ws.logfile;
delete ws.logfile;
if (peer.ws) { delete peer.ws.logfile; }
recordingEntry(logfile, 3, 0, 'MeshCentralMCREC', function (logfile, tag) {
parent.parent.fs.close(logfile.fd);
setTimeout(function(){ // wait 5 seconds before finishing file for some reason?
recordingEntry(logfile, 3, 0, 'MeshCentralMCREC', function (logfile, tag) {
parent.parent.fs.closeSync(logfile.fd);
// Now that the recording file is closed, check if we need to index this file.
if (domain.sessionrecording.index && domain.sessionrecording.index !== false) { parent.parent.certificateOperations.acceleratorPerformOperation('indexMcRec', tag.logfile.filename); }
// Now that the recording file is closed, check if we need to index this file.
if (domain.sessionrecording.index && domain.sessionrecording.index !== false) { parent.parent.certificateOperations.acceleratorPerformOperation('indexMcRec', tag.logfile.filename); }
// Compute session length
var sessionLength = null;
if (tag.logfile.startTime != null) { sessionLength = Math.round((Date.now() - tag.logfile.startTime) / 1000); }
// Compute session length
var sessionLength = null;
if (tag.logfile.startTime != null) { sessionLength = Math.round((Date.now() - tag.logfile.startTime) / 1000); }
// Add a event entry about this recording
var basefile = parent.parent.path.basename(tag.logfile.filename);
var event = { etype: 'relay', action: 'recording', domain: domain.id, nodeid: tag.logfile.nodeid, msg: "Finished recording session" + (sessionLength ? (', ' + sessionLength + ' second(s)') : ''), filename: basefile, size: tag.logfile.size };
if (user) { event.userids = [user._id]; } else if (peer.user) { event.userids = [peer.user._id]; }
var xprotocol = (((obj.req == null) || (obj.req.query == null)) ? null : obj.req.query.p);
if ((xprotocol == null) && (logfile.text == 2)) { xprotocol = 200; }
if (xprotocol != null) { event.protocol = parseInt(xprotocol); }
var mesh = parent.meshes[tag.logfile.meshid];
if (mesh != null) { event.meshname = mesh.name; event.meshid = mesh._id; }
if (tag.logfile.startTime) { event.startTime = tag.logfile.startTime; event.lengthTime = sessionLength; }
if (tag.logfile.name) { event.name = tag.logfile.name; }
if (tag.logfile.icon) { event.icon = tag.logfile.icon; }
parent.parent.DispatchEvent(['*', 'recording', tag.logfile.nodeid, tag.logfile.meshid], obj, event);
// Add a event entry about this recording
var basefile = parent.parent.path.basename(tag.logfile.filename);
var event = { etype: 'relay', action: 'recording', domain: domain.id, nodeid: tag.logfile.nodeid, msg: "Finished recording session" + (sessionLength ? (', ' + sessionLength + ' second(s)') : ''), filename: basefile, size: tag.logfile.size };
if (user) { event.userids = [user._id]; } else if (peer.user) { event.userids = [peer.user._id]; }
var xprotocol = (((obj.req == null) || (obj.req.query == null)) ? null : obj.req.query.p);
if ((xprotocol == null) && (logfile.text == 2)) { xprotocol = 200; }
if (xprotocol != null) { event.protocol = parseInt(xprotocol); }
var mesh = parent.meshes[tag.logfile.meshid];
if (mesh != null) { event.meshname = mesh.name; event.meshid = mesh._id; }
if (tag.logfile.startTime) { event.startTime = tag.logfile.startTime; event.lengthTime = sessionLength; }
if (tag.logfile.name) { event.name = tag.logfile.name; }
if (tag.logfile.icon) { event.icon = tag.logfile.icon; }
parent.parent.DispatchEvent(['*', 'recording', tag.logfile.nodeid, tag.logfile.meshid], obj, event);
cleanUpRecordings();
}, { ws: ws, pws: peer.ws, logfile: logfile });
cleanUpRecordings();
}, { ws: ws, pws: peer.ws, logfile: logfile });
},5000);
}
try { ws.close(); } catch (ex) { }