add theme to config file, fix #33

This commit is contained in:
teddit 2021-01-01 17:15:11 +01:00
parent 781b8683e4
commit 0c071f475f
2 changed files with 3 additions and 0 deletions

2
app.js
View File

@ -102,6 +102,8 @@ const preferencesMiddleware = (req, res, next) => {
req.cookies.theme = themeOverride
// this will set it for future requests
res.cookie('theme', themeOverride, { maxAge: 31536000, httpOnly: true })
} else if(!req.cookies.theme && req.cookies.theme !== '') {
req.cookies.theme = config.theme
}
let flairsOverride = req.query.flairs

View File

@ -2,6 +2,7 @@ const config = {
domain: process.env.DOMAIN || '127.0.0.1', // Or for example 'teddit.net'
use_reddit_oauth: process.env.USE_REDDIT_OAUTH === "true" || false, // If false, teddit uses Reddit's public API. If true, you need to have your own Reddit app ID (enter the app ID to the "reddit_app_id" config key).
cert_dir: process.env.CERT_DIR || '', // For example '/home/teddit/letsencrypt/live/teddit.net', if you are using https. No trailing slash.
theme: process.env.THEME || 'dark', // One of: 'dark', ''
flairs_enabled: process.env.FLAIRS_ENABLED !== "true" || true, // Enables the rendering of user and link flairs on teddit
api_enabled: process.env.API_ENABLED !== "true" || true, // Teddit API feature. Might increase loads significantly on your instance.
video_enabled: process.env.VIDEO_ENABLED !== "true" || true,