feat: add /tracks/:track/download route
This commit is contained in:
parent
1121098977
commit
93b7945d2b
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue