From 62f142a04613d9e16f3ed0c54ab4ca45883e5397 Mon Sep 17 00:00:00 2001 From: Bobby Wibowo Date: Wed, 7 Feb 2018 13:45:18 +0700 Subject: [PATCH] Updates Patching albums for installations which serve files through a different domain (experimental). --- config.sample.js | 6 ++++++ controllers/albumsController.js | 3 ++- views/album.handlebars | 14 +++++++------- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/config.sample.js b/config.sample.js index 5597de4..e5a2505 100644 --- a/config.sample.js +++ b/config.sample.js @@ -27,6 +27,12 @@ module.exports = { serveFilesWithNode: false, domain: 'https://lolisafe.moe', + /* + If you are serving your files with a different domain than your lolisafe homepage, + then fill this option with your lolisafe homepage, otherwise leave it null (or other falsy value). + */ + albumDomain: null, + // Port on which to run the server port: 9999, diff --git a/controllers/albumsController.js b/controllers/albumsController.js index 57bbc5c..7335a2c 100644 --- a/controllers/albumsController.js +++ b/controllers/albumsController.js @@ -8,6 +8,7 @@ const Zip = require('jszip') const albumsController = {} albumsController.list = async (req, res, next) => { + const albumDomain = config.albumDomain || config.domain const user = await utils.authorize(req, res) const fields = ['id', 'name'] @@ -26,7 +27,7 @@ albumsController.list = async (req, res, next) => { album.date = new Date(album.timestamp * 1000) album.date = utils.getPrettyDate(album.date) - album.identifier = `${config.domain}/a/${album.identifier}` + album.identifier = `${albumDomain}/a/${album.identifier}` ids.push(album.id) } diff --git a/views/album.handlebars b/views/album.handlebars index 162cca2..5ef5d24 100644 --- a/views/album.handlebars +++ b/views/album.handlebars @@ -10,13 +10,13 @@ {{ title }} - - - - - - - + + + + + + +