aboutsummaryrefslogtreecommitdiff
path: root/controllers
diff options
context:
space:
mode:
authorPitu <[email protected]>2017-01-19 00:31:01 -0300
committerPitu <[email protected]>2017-01-19 00:31:01 -0300
commit93891ae1e5e3492cf9ce5b5ff15a7686c4796b81 (patch)
treedfa3ce20f6d957c67249f41d1cd8f94e8f994c1a /controllers
parentCuter file upload progress (diff)
downloadhost.fuwn.me-93891ae1e5e3492cf9ce5b5ff15a7686c4796b81.tar.xz
host.fuwn.me-93891ae1e5e3492cf9ce5b5ff15a7686c4796b81.zip
Small fixes
Diffstat (limited to 'controllers')
-rw-r--r--controllers/albumsController.js2
-rw-r--r--controllers/uploadController.js11
2 files changed, 10 insertions, 3 deletions
diff --git a/controllers/albumsController.js b/controllers/albumsController.js
index 16efd9c..9c666be 100644
--- a/controllers/albumsController.js
+++ b/controllers/albumsController.js
@@ -21,7 +21,7 @@ albumsController.list = function(req, res, next){
let ids = []
for(let album of albums){
album.date = new Date(album.timestamp * 1000)
- album.date = album.date.getFullYear() + '-' + album.date.getMonth() + '-' + 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()
+ 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()
ids.push(album.id)
}
diff --git a/controllers/uploadController.js b/controllers/uploadController.js
index 4585087..6b962c3 100644
--- a/controllers/uploadController.js
+++ b/controllers/uploadController.js
@@ -93,10 +93,17 @@ uploadsController.list = function(req, res){
.then((files) => {
db.table('albums').then((albums) => {
+ let basedomain = req.get('host')
+ for(let domain of config.domains)
+ if(domain.host === req.get('host'))
+ if(domain.hasOwnProperty('resolve'))
+ basedomain = domain.resolve
+
for(let file of files){
- file.file = config.basedomain + config.uploads.prefix + file.name
+ file.file = 'http://' + basedomain + '/' + file.name
+ //file.file = config.basedomain + config.uploads.prefix + file.name
file.date = new Date(file.timestamp * 1000)
- file.date = file.date.getFullYear() + '-' + file.date.getMonth() + '-' + file.date.getDate() + ' ' + (file.date.getHours() < 10 ? '0' : '') + file.date.getHours() + ':' + (file.date.getMinutes() < 10 ? '0' : '') + file.date.getMinutes() + ':' + (file.date.getSeconds() < 10 ? '0' : '') + file.date.getSeconds()
+ file.date = file.date.getFullYear() + '-' + (file.date.getMonth() + 1) + '-' + file.date.getDate() + ' ' + (file.date.getHours() < 10 ? '0' : '') + file.date.getHours() + ':' + (file.date.getMinutes() < 10 ? '0' : '') + file.date.getMinutes() + ':' + (file.date.getSeconds() < 10 ? '0' : '') + file.date.getSeconds()
file.album = ''