drop.chapril.org-firefoxsend/server/routes/params.js
2020-07-29 11:02:22 -07:00

18 lines
434 B
JavaScript

const config = require('../config');
const storage = require('../storage');
module.exports = function(req, res) {
const max = req.meta.fxa ? 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);
}
};