1
0
mirror of https://gitlab.com/timvisee/send.git synced 2024-11-11 05:32:40 +01:00
send/server/routes/params.js
2018-08-31 11:43:56 -07:00

18 lines
430 B
JavaScript

const config = require('../config');
const storage = require('../storage');
module.exports = function(req, res) {
const max = req.user ? config.max_downloads : config.anon_max_downloads;
const dlimit = req.body.dlimit;
if (!dlimit || dlimit > max) {
return res.sendStatus(400);
}
try {
storage.setField(req.params.id, 'dlimit', dlimit);
res.sendStatus(200);
} catch (e) {
res.sendStatus(404);
}
};