mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2024-12-14 16:36:21 +00:00
Forced resolve, updated config.sample.js
This commit is contained in:
parent
e9b3ecbd05
commit
cd123b4c11
@ -12,14 +12,16 @@ module.exports = {
|
||||
// The registered domain where you will be serving the app. Use IP if none.
|
||||
domains: [
|
||||
|
||||
/*
|
||||
You need to specify the base domain where loli-self is running
|
||||
and how should it resolve the URL for uploaded files. For example:
|
||||
*/
|
||||
|
||||
// Files will be served at http(s)://i.kanacchi.moe/Fxt0.png
|
||||
{ host: 'i.kanacchi.moe' },
|
||||
{ host: 'kanacchi.moe', resolve: 'https://i.kanacchi.moe'},
|
||||
|
||||
// Files will be served at http(s)://my.kanacchi.moe/loli-self/files/Fxt0.png
|
||||
{ host: 'my.kanacchi.moe', resolve: 'https://my.kanacchi.moe/loli-self/files' },
|
||||
|
||||
// Files will be served at http://localhost:9999/Fxt0.png
|
||||
{ domain: 'localhost:9999' }
|
||||
// Files will be served at https://my.kanacchi.moe/loli-self/files/Fxt0.png
|
||||
{ host: 'kanacchi.moe', resolve: 'https://my.kanacchi.moe/loli-self/files' }
|
||||
|
||||
],
|
||||
|
||||
|
@ -98,6 +98,7 @@ 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'))
|
||||
@ -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()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user