Small fixes

This commit is contained in:
Pitu 2017-01-19 00:31:01 -03:00
parent 7c8be0341f
commit 93891ae1e5
3 changed files with 12 additions and 4 deletions

View File

@ -20,6 +20,7 @@ module.exports = {
// Files will be served at http://localhost:9999/Fxt0.png // Files will be served at http://localhost:9999/Fxt0.png
{ domain: 'localhost:9999' } { domain: 'localhost:9999' }
], ],
// Port on which to run the server // Port on which to run the server
@ -31,7 +32,7 @@ module.exports = {
// Folder where images should be stored // Folder where images should be stored
folder: 'uploads', folder: 'uploads',
// Max file size allowed // Max file size allowed. Needs to be in MB
maxSize: '512MB', maxSize: '512MB',
// The length of the random generated name for the uploaded files // The length of the random generated name for the uploaded files

View File

@ -21,7 +21,7 @@ albumsController.list = function(req, res, next){
let ids = [] let ids = []
for(let album of albums){ for(let album of albums){
album.date = new Date(album.timestamp * 1000) 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) ids.push(album.id)
} }

View File

@ -93,10 +93,17 @@ uploadsController.list = function(req, res){
.then((files) => { .then((files) => {
db.table('albums').then((albums) => { 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){ 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 = 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 = '' file.album = ''