From 422f95182d9fa71bccba01e234f70f7d071d8f7f Mon Sep 17 00:00:00 2001
From: loicbersier <loic.bersier1@gmail.com>
Date: Sun, 26 Jan 2020 03:15:22 +0100
Subject: [PATCH] Download date

---
 app/Controllers/Http/DownloadController.js | 4 ++--
 resources/views/index.edge                 | 6 ++++++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/app/Controllers/Http/DownloadController.js b/app/Controllers/Http/DownloadController.js
index 8f3ff1b..f52f9ed 100644
--- a/app/Controllers/Http/DownloadController.js
+++ b/app/Controllers/Http/DownloadController.js
@@ -68,11 +68,11 @@ class DownloadController {
       if (f.endsWith('.mp4') || f.endsWith('.webm')) {
         // Send file name, file size in MB relative path for the file
         let fileInfo = formatBytes(fs.statSync(`./public/uploads/${f}`).size).split(' ');
-        files.push({ name: f.split('.').slice(0, -1).join('.'), size: fileInfo[0], unit: fileInfo[1], location: `uploads/${f}`, ext: f.split('.').pop(), img: '' });
+        files.push({ name: f.split('.').slice(0, -1).join('.'), size: fileInfo[0], unit: fileInfo[1], date: fs.statSync(`./public/uploads/${f}`).ctime, location: `uploads/${f}`, ext: f.split('.').pop(), img: '' });
       } else if (f.endsWith('.mp3') || f.endsWith('.flac')) {
         // Send file name, file size in MB relative path for the file and relative path of music.png
         let fileInfo = formatBytes(fs.statSync(`./public/uploads/${f}`).size).split(' ');
-        files.push({ name: f.split('.').slice(0, -1).join('.'), size: fileInfo[0], unit: fileInfo[1], location: `uploads/${f}`, ext: f.split('.').pop(), img: `/asset/music.png` });
+        files.push({ name: f.split('.').slice(0, -1).join('.'), size: fileInfo[0], unit: fileInfo[1], date: fs.statSync(`./public/uploads/${f}`).ctime, location: `uploads/${f}`, ext: f.split('.').pop(), img: `/asset/music.png` });
       }
     }
 		return view.render('index', { version: version, viewCounter: viewCounter, file: files, day: day, month: month, announcement: announcement});
diff --git a/resources/views/index.edge b/resources/views/index.edge
index b8cb0e5..9dc4300 100644
--- a/resources/views/index.edge
+++ b/resources/views/index.edge
@@ -170,6 +170,12 @@
                                 <span class="tag is-primary">{{ antl.formatNumber(file.size) }} {{ file.unit }}</span>
                             </div>
                         </div>
+                        <div class="control">
+                            <div class="tags has-addons">
+                                <span class="tag">{{ antl.formatMessage('messages.recentDate') }}</span>
+                                <span class="tag is-primary">{{ antl.formatDate(file.date) }}</span>
+                            </div>
+                        </div>
                     </div>
                 </div>
             </div>