From 7e88b3281e329ce177574a7c1aa4e17a99eceede Mon Sep 17 00:00:00 2001 From: Jonathan Cremin Date: Sat, 22 Aug 2015 18:40:23 +0100 Subject: [PATCH] Restore file download counting --- web/routes/file.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/web/routes/file.js b/web/routes/file.js index a92420e..9a624bf 100644 --- a/web/routes/file.js +++ b/web/routes/file.js @@ -68,6 +68,12 @@ export function* get() { this.set('Expires', new Date(2020, 1).toISOString()); this.set('Cache-control', 'max-age=2592000'); + this.db.Files.updateOne( + {_id: file._id}, + {'$set': {'last_accessed': Math.ceil(Date.now()/1000)}, '$inc': {downloads: 1}}, + {w:0} + ); + this.body = yield hostrFileStream(localPath, remotePath); }