2017-08-24 21:54:02 +00:00
|
|
|
const storage = require('../storage');
|
|
|
|
|
|
|
|
module.exports = async (req, res) => {
|
|
|
|
try {
|
2018-02-06 22:31:18 +00:00
|
|
|
const meta = await storage.metadata(req.params.id);
|
2020-07-13 17:21:28 +00:00
|
|
|
if (!meta || meta.dead) {
|
|
|
|
return res.sendStatus(404);
|
|
|
|
}
|
2017-12-21 15:54:19 +00:00
|
|
|
res.set('WWW-Authenticate', `send-v1 ${meta.nonce}`);
|
|
|
|
res.send({
|
2018-07-31 18:09:18 +00:00
|
|
|
requiresPassword: meta.pwd
|
2017-12-21 15:54:19 +00:00
|
|
|
});
|
2017-08-24 21:54:02 +00:00
|
|
|
} catch (e) {
|
|
|
|
res.sendStatus(404);
|
|
|
|
}
|
|
|
|
};
|