diff --git a/src/routes/api/tracks.js b/src/routes/api/tracks.js index 40bc717..a63e2e9 100644 --- a/src/routes/api/tracks.js +++ b/src/routes/api/tracks.js @@ -359,4 +359,17 @@ router.get( }), ); +// download the original file +router.get( + '/:track/download', + auth.optional, + wrapRoute(async (req, res) => { + if (!req.track.isVisibleTo(req.user)) { + return res.sendStatus(403); + } + + return res.sendFile(req.track.fullOriginalFilePath) + }), +); + module.exports = router;