aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPitu <[email protected]>2017-01-18 21:50:40 -0300
committerPitu <[email protected]>2017-01-18 21:50:40 -0300
commitd6c7aff21bb6ebdc55d5510f370b4f130af8c44c (patch)
tree6c0fe87f967da5a3197e1b2e6180706597fed33b
parentAdded multi-domain support. Maybe (diff)
downloadhost.fuwn.me-d6c7aff21bb6ebdc55d5510f370b4f130af8c44c.tar.xz
host.fuwn.me-d6c7aff21bb6ebdc55d5510f370b4f130af8c44c.zip
Multi-domain fixes. Maybe it's ready?
-rw-r--r--controllers/uploadController.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/controllers/uploadController.js b/controllers/uploadController.js
index 6a4e5c9..47eb54d 100644
--- a/controllers/uploadController.js
+++ b/controllers/uploadController.js
@@ -56,19 +56,22 @@ uploadsController.upload = function(req, res, next){
db.table('files').insert(files).then(() => {
- let basedomain = req.get('host') + '/'
+ console.log('basedomain: ' + req.get('host'))
+ let basedomain = req.get('host')
for(let domain of config.domains)
if(domain.host === req.get('host'))
if(domain.hasOwnProperty('resolve'))
- return basedomain = domain.resolve + '/'
+ basedomain = domain.resolve
+ console.log('basedomain: ' + basedomain)
+
res.json({
success: true,
files: files.map(file => {
return {
name: file.name,
size: file.size,
- url: basedomain + file.name
+ url: 'http://' + basedomain + '/' + file.name
}
})
})