aboutsummaryrefslogtreecommitdiff
path: root/controllers/uploadController.js
diff options
context:
space:
mode:
authorPitu <[email protected]>2017-01-21 17:21:29 -0300
committerPitu <[email protected]>2017-01-21 17:21:29 -0300
commitcd123b4c119127b9300a641e3735221f2b03a7bc (patch)
tree1f818fde559c54a1a12ec308b53075f09372e611 /controllers/uploadController.js
parentFixed public upload. Whoopsies (diff)
downloadhost.fuwn.me-cd123b4c119127b9300a641e3735221f2b03a7bc.tar.xz
host.fuwn.me-cd123b4c119127b9300a641e3735221f2b03a7bc.zip
Forced resolve, updated config.sample.js
Diffstat (limited to 'controllers/uploadController.js')
-rw-r--r--controllers/uploadController.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/controllers/uploadController.js b/controllers/uploadController.js
index 7082ead..d337018 100644
--- a/controllers/uploadController.js
+++ b/controllers/uploadController.js
@@ -98,12 +98,13 @@ uploadsController.upload = function(req, res, next){
uploadsController.processFilesForDisplay = function(req, res, files, existingFiles){
+
let basedomain = req.get('host')
for(let domain of config.domains)
if(domain.host === req.get('host'))
if(domain.hasOwnProperty('resolve'))
basedomain = domain.resolve
-
+
if(files.length === 0){
return res.json({
success: true,
@@ -111,7 +112,7 @@ uploadsController.processFilesForDisplay = function(req, res, files, existingFil
return {
name: file.name,
size: file.size,
- url: 'http://' + basedomain + '/' + file.name
+ url: basedomain + '/' + file.name
}
})
})
@@ -127,7 +128,7 @@ uploadsController.processFilesForDisplay = function(req, res, files, existingFil
return {
name: file.name,
size: file.size,
- url: 'http://' + basedomain + '/' + file.name
+ url: basedomain + '/' + file.name
}
})
})
@@ -200,7 +201,7 @@ uploadsController.list = function(req, res){
basedomain = domain.resolve
for(let file of files){
- file.file = 'http://' + basedomain + '/' + file.name
+ file.file = basedomain + '/' + file.name
file.date = new Date(file.timestamp * 1000)
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()