refactored server

This commit is contained in:
Danny Coates 2018-02-06 14:31:18 -08:00
parent 6d470b8eba
commit 3fd2537311
No known key found for this signature in database
GPG key ID: 4C442633C62E00CB
36 changed files with 2944 additions and 792 deletions

View file

@ -14,12 +14,8 @@ module.exports = function(req, res) {
}
const owner = crypto.randomBytes(10).toString('hex');
const meta = {
dlimit: 1,
dl: 0,
owner,
delete: owner, // delete is deprecated
metadata,
pwd: 0,
auth: auth.split(' ')[1],
nonce: crypto.randomBytes(16).toString('base64')
};
@ -47,7 +43,7 @@ module.exports = function(req, res) {
req.on('close', async err => {
try {
await storage.forceDelete(newId);
await storage.del(newId);
} catch (e) {
log.info('DeleteError:', newId);
}