2018-08-08 00:40:17 +02:00
|
|
|
const config = require('../config');
|
2017-11-30 22:41:09 +01:00
|
|
|
const storage = require('../storage');
|
|
|
|
|
2018-02-06 23:31:18 +01:00
|
|
|
module.exports = function(req, res) {
|
2020-07-27 20:18:52 +02:00
|
|
|
const max = req.meta.fxa ? config.max_downloads : config.anon_max_downloads;
|
2017-11-30 22:41:09 +01:00
|
|
|
const dlimit = req.body.dlimit;
|
2018-08-31 19:59:26 +02:00
|
|
|
if (!dlimit || dlimit > max) {
|
2017-11-30 22:41:09 +01:00
|
|
|
return res.sendStatus(400);
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
2018-02-06 23:31:18 +01:00
|
|
|
storage.setField(req.params.id, 'dlimit', dlimit);
|
2017-11-30 22:41:09 +01:00
|
|
|
res.sendStatus(200);
|
|
|
|
} catch (e) {
|
|
|
|
res.sendStatus(404);
|
|
|
|
}
|
|
|
|
};
|