mirror of
https://github.com/timvisee/send.git
synced 2025-10-06 02:39:57 +02:00
implemented download tokens
This commit is contained in:
parent
87d46f7ef5
commit
81e9d81dab
26 changed files with 271 additions and 126 deletions
17
server/routes/token.js
Normal file
17
server/routes/token.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
module.exports = async function(req, res) {
|
||||
const meta = req.meta;
|
||||
try {
|
||||
if (meta.dead || meta.flagged) {
|
||||
return res.sendStatus(404);
|
||||
}
|
||||
const token = await meta.getDownloadToken();
|
||||
res.send({
|
||||
token
|
||||
});
|
||||
} catch (e) {
|
||||
if (e.message === 'limit') {
|
||||
return res.sendStatus(403);
|
||||
}
|
||||
res.sendStatus(404);
|
||||
}
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue