2018-08-07 22:40:17 +00:00
|
|
|
const config = require('../config');
|
2017-11-30 21:41:09 +00:00
|
|
|
const storage = require('../storage');
|
|
|
|
|
2018-02-06 22:31:18 +00:00
|
|
|
module.exports = function(req, res) {
|
2017-11-30 21:41:09 +00:00
|
|
|
const dlimit = req.body.dlimit;
|
2018-08-07 22:40:17 +00:00
|
|
|
// TODO: fxa auth
|
|
|
|
if (!dlimit || dlimit > config.max_downloads) {
|
2017-11-30 21:41:09 +00:00
|
|
|
return res.sendStatus(400);
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
2018-02-06 22:31:18 +00:00
|
|
|
storage.setField(req.params.id, 'dlimit', dlimit);
|
2017-11-30 21:41:09 +00:00
|
|
|
res.sendStatus(200);
|
|
|
|
} catch (e) {
|
|
|
|
res.sendStatus(404);
|
|
|
|
}
|
|
|
|
};
|