diff --git a/controllers/albumsController.js b/controllers/albumsController.js index 238275d..c40b978 100644 --- a/controllers/albumsController.js +++ b/controllers/albumsController.js @@ -18,8 +18,10 @@ albumsController.list = function(req, res, next){ let fields = ['id', 'name'] - if(req.params.sidebar === undefined) + if(req.params.sidebar === undefined){ fields.push('timestamp') + fields.push('identifier') + } db.table('albums').select(fields).where({enabled: 1, userid: user[0].id}).then((albums) => { @@ -31,6 +33,14 @@ albumsController.list = function(req, res, next){ album.date = new Date(album.timestamp * 1000) album.date = album.date.getFullYear() + '-' + (album.date.getMonth() + 1) + '-' + album.date.getDate() + ' ' + (album.date.getHours() < 10 ? '0' : '') + album.date.getHours() + ':' + (album.date.getMinutes() < 10 ? '0' : '') + album.date.getMinutes() + ':' + (album.date.getSeconds() < 10 ? '0' : '') + album.date.getSeconds() + let basedomain = req.get('host') + for(let domain of config.domains) + if(domain.host === req.get('host')) + if(domain.hasOwnProperty('resolve')) + basedomain = domain.resolve + + album.identifier = basedomain + '/' + album.identifier + ids.push(album.id) } @@ -196,6 +206,7 @@ albumsController.get = function(req, res, next){ return res.json({ success: true, title: title, + count: files.length, files }) diff --git a/pages/album.html b/pages/album.html index a04bcd9..59bab4b 100644 --- a/pages/album.html +++ b/pages/album.html @@ -45,6 +45,7 @@

+


diff --git a/public/js/album.js b/public/js/album.js index 8a69d94..d3880ee 100644 --- a/public/js/album.js +++ b/public/js/album.js @@ -4,6 +4,7 @@ album.get = function(album){ axios.get('/api/album/get/' + album) .then(function (response) { document.getElementById('title').innerHTML = response.data.title; + document.getElementById('count').innerHTML = response.data.count + ' files'; var container = document.createElement('div'); container.innerHTML = `
` diff --git a/public/js/dashboard.js b/public/js/dashboard.js index f128c05..3024d62 100644 --- a/public/js/dashboard.js +++ b/public/js/dashboard.js @@ -272,6 +272,7 @@ panel.getAlbums = function(){ Name Files Created At + Public link @@ -290,6 +291,7 @@ panel.getAlbums = function(){ ${item.name} ${item.files} ${item.date} + Album link