Download date

This commit is contained in:
loicbersier 2020-01-26 03:15:22 +01:00
parent 72e9a7daa7
commit 422f95182d
2 changed files with 8 additions and 2 deletions

View file

@ -68,11 +68,11 @@ class DownloadController {
if (f.endsWith('.mp4') || f.endsWith('.webm')) { if (f.endsWith('.mp4') || f.endsWith('.webm')) {
// Send file name, file size in MB relative path for the file // Send file name, file size in MB relative path for the file
let fileInfo = formatBytes(fs.statSync(`./public/uploads/${f}`).size).split(' '); 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')) { } 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 // 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(' '); 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}); return view.render('index', { version: version, viewCounter: viewCounter, file: files, day: day, month: month, announcement: announcement});

View file

@ -170,6 +170,12 @@
<span class="tag is-primary">{{ antl.formatNumber(file.size) }} {{ file.unit }}</span> <span class="tag is-primary">{{ antl.formatNumber(file.size) }} {{ file.unit }}</span>
</div> </div>
</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> </div>
</div> </div>