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