aboutsummaryrefslogtreecommitdiff
path: root/controllers
diff options
context:
space:
mode:
authorPitu <[email protected]>2017-02-07 04:52:53 -0300
committerPitu <[email protected]>2017-02-07 04:52:53 -0300
commit36e17b037221ff7c69680e00e9a83dccd31ef44e (patch)
treeb23bf2bb17d3a5f4a68563b91ba6d47c3164f2cf /controllers
parentbleh (diff)
downloadhost.fuwn.me-36e17b037221ff7c69680e00e9a83dccd31ef44e.tar.xz
host.fuwn.me-36e17b037221ff7c69680e00e9a83dccd31ef44e.zip
Album stuff
Diffstat (limited to 'controllers')
-rw-r--r--controllers/albumsController.js13
1 files changed, 12 insertions, 1 deletions
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
})