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

Improved error message if the server can't read session recordings. (#4363)

This commit is contained in:
Ylian Saint-Hilaire 2022-08-04 11:28:28 -07:00
parent 8b81ee564c
commit 13c0afbc1e
2 changed files with 9 additions and 4 deletions

View file

@ -1025,11 +1025,11 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
if (domain.sessionrecording.filepath) { recordingsPath = domain.sessionrecording.filepath; } else { recordingsPath = parent.parent.recordpath; }
if (recordingsPath == null) return;
fs.readdir(recordingsPath, function (err, files) {
if (err != null) return;
if (err != null) { try { ws.send(JSON.stringify({ action: 'recordings', error: 1, tag: command.tag })); } catch (ex) { } return; }
if ((command.limit == null) || (typeof command.limit != 'number')) {
// Send the list of all recordings
db.GetEvents(['recording'], domain.id, function (err, docs) {
if (err != null) return;
if (err != null) { try { ws.send(JSON.stringify({ action: 'recordings', error: 2, tag: command.tag })); } catch (ex) { } return; }
for (var i in docs) {
delete docs[i].action; delete docs[i].etype; delete docs[i].msg; // TODO: We could make a more specific query in the DB and never have these.
if (files.indexOf(docs[i].filename) >= 0) { docs[i].present = 1; }
@ -1039,7 +1039,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
} else {
// Send the list of most recent recordings, up to 'limit' count
db.GetEventsWithLimit(['recording'], domain.id, command.limit, function (err, docs) {
if (err != null) return;
if (err != null) { try { ws.send(JSON.stringify({ action: 'recordings', error: 2, tag: command.tag })); } catch (ex) { } return; }
for (var i in docs) {
delete docs[i].action; delete docs[i].etype; delete docs[i].msg; // TODO: We could make a more specific query in the DB and never have these.
if (files.indexOf(docs[i].filename) >= 0) { docs[i].present = 1; }