fix: regenerate public track data when saving a track as visible

This commit is contained in:
Paul Bienkowski 2021-01-20 18:13:13 +01:00
parent 4a119a0fc9
commit 7fec413437
2 changed files with 4 additions and 0 deletions

View file

@ -18,6 +18,8 @@ services:
volumes: volumes:
- ./src:/opt/obsAPI/src - ./src:/opt/obsAPI/src
- ./local/api-data:/data - ./local/api-data:/data
- .migrations.js:/opt/obsAPI/.migrations.js
- ./migrations:/opt/obsAPI/migrations/
environment: environment:
- PORT=3000 - PORT=3000
- MONGODB_URL=mongodb://mongo/obsTest - MONGODB_URL=mongodb://mongo/obsTest

View file

@ -248,6 +248,8 @@ router.put(
track.uploadedByUserAgent = normalizeUserAgent(req.headers['user-agent']); track.uploadedByUserAgent = normalizeUserAgent(req.headers['user-agent']);
await track.writeToOriginalFile(fileBody) await track.writeToOriginalFile(fileBody)
await track.rebuildTrackDataAndSave();
} else if (track.visible && !track.publicTrackData) {
await track.rebuildTrackDataAndSave(); await track.rebuildTrackDataAndSave();
} else { } else {
await track.save(); await track.save();