Implemented FxA

This commit is contained in:
Danny Coates 2018-08-07 15:40:17 -07:00
parent 70bc2b7656
commit 718d74fa50
No known key found for this signature in database
GPG key ID: 4C442633C62E00CB
40 changed files with 1306 additions and 651 deletions

View file

@ -14,15 +14,15 @@ module.exports = async function(req, res) {
'WWW-Authenticate': `send-v1 ${req.nonce}`
});
const file_stream = await storage.get(id);
const fileStream = await storage.get(id);
let cancelled = false;
req.on('close', () => {
cancelled = true;
file_stream.destroy();
fileStream.destroy();
});
file_stream.on('end', async () => {
fileStream.on('end', async () => {
if (cancelled) {
return;
}
@ -40,7 +40,7 @@ module.exports = async function(req, res) {
}
});
file_stream.pipe(res);
fileStream.pipe(res);
} catch (e) {
res.sendStatus(404);
}