2020-07-13 17:21:28 +00:00
|
|
|
const storage = require('../storage');
|
|
|
|
const { statReportEvent } = require('../amplitude');
|
|
|
|
|
|
|
|
module.exports = async function(req, res) {
|
|
|
|
try {
|
|
|
|
const id = req.params.id;
|
|
|
|
const meta = await storage.metadata(id);
|
2020-07-25 22:36:09 +00:00
|
|
|
storage.flag(id);
|
|
|
|
statReportEvent({
|
|
|
|
id,
|
|
|
|
ip: req.ip,
|
2020-07-28 16:31:09 +00:00
|
|
|
country: req.geo.country,
|
|
|
|
state: req.geo.state,
|
2020-07-25 22:36:09 +00:00
|
|
|
owner: meta.owner,
|
|
|
|
reason: req.body.reason,
|
|
|
|
download_limit: meta.dlimit,
|
|
|
|
download_count: meta.dl,
|
|
|
|
agent: req.ua.browser.name || req.ua.ua.substring(0, 6)
|
|
|
|
});
|
|
|
|
res.sendStatus(200);
|
2020-07-13 17:21:28 +00:00
|
|
|
} catch (e) {
|
|
|
|
res.sendStatus(404);
|
|
|
|
}
|
|
|
|
};
|