1
0
mirror of https://gitlab.com/timvisee/send.git synced 2024-11-10 05:02:45 +01:00
send/server/routes/metadata.js

17 lines
346 B
JavaScript

const storage = require('../storage');
module.exports = async function(req, res) {
const id = req.params.id;
const meta = req.meta;
try {
const ttl = await storage.ttl(id);
res.send({
metadata: meta.metadata,
finalDownload: meta.dl + 1 === meta.dlimit,
ttl
});
} catch (e) {
res.sendStatus(404);
}
};