feat: add /tracks/:track/download route

This commit is contained in:
Paul Bienkowski 2020-12-13 20:46:52 +01:00 committed by uwewoessner
parent 1121098977
commit 93b7945d2b

View file

@ -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; module.exports = router;