Fix log-viewer ignoring screenshotless events
All checks were successful
continuous-integration/drone Build is passing
All checks were successful
continuous-integration/drone Build is passing
This commit is contained in:
@@ -46,15 +46,18 @@ async function run() {
|
||||
});
|
||||
|
||||
async function wrapEvent(doc) {
|
||||
let newDoc;
|
||||
let screenShotArray = [];
|
||||
let blob;
|
||||
if (doc && doc.screenshot_count) {
|
||||
newDoc = {...doc, screenshots: []}
|
||||
for (let i = 1; i <= doc.screenshot_count ; i++) {
|
||||
let presignedUrl = await minioClient.presignedUrl('GET', minioBucket, `${doc.camera}/${doc._id}/${i}.jpg`, 60 * 60);
|
||||
newDoc.screenshots.push({ url: presignedUrl });
|
||||
screenShotArray.push({ url: presignedUrl });
|
||||
}
|
||||
blob = JSON.stringify({...doc, ...screenShotArray});
|
||||
} else {
|
||||
blob = JSON.stringify({...doc})
|
||||
};
|
||||
let blob = JSON.stringify(newDoc);
|
||||
|
||||
return `event: log-entry\ndata: ${blob}\n\n`
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user