Begin implementing a reporting mechanism

This commit is contained in:
Danny Coates 2020-07-13 10:21:28 -07:00
parent ccbcb69666
commit 9891d1f0ba
No known key found for this signature in database
GPG key ID: 4C442633C62E00CB
37 changed files with 762 additions and 183 deletions

View file

@ -23,14 +23,17 @@ module.exports = {
const id = req.params.id;
const appState = await state(req);
try {
const { nonce, pwd } = await storage.metadata(id);
const { nonce, pwd, dead, flagged } = await storage.metadata(id);
if (dead && !flagged) {
return next();
}
res.set('WWW-Authenticate', `send-v1 ${nonce}`);
res.send(
stripEvents(
routes().toString(
`/download/${id}`,
Object.assign(appState, {
downloadMetadata: { nonce, pwd }
downloadMetadata: { nonce, pwd, flagged }
})
)
)