make the preference show_upvoted_percentage configurable via config.js #274

This commit is contained in:
teddit 2021-12-21 22:19:38 +01:00
parent 4bf092e481
commit 8315ad3f16
2 changed files with 5 additions and 0 deletions

View File

@ -34,6 +34,7 @@ const config = {
: [], // Replacements for domains in outgoing links. Tuples with regular expressions to match, and replacement values. This is in addition to user-level configuration of privacyDomains.
cache_control: process.env.CACHE_CONTROL !== 'true' || true, // If true, teddit will automatically remove all cached static files. By default this is set to true.
cache_control_interval: process.env.CACHE_CONTROL_INTERVAL || 24, // How often the cache directory for static files is emptied (in hours). Requires cache_control to be true. Default is every 24 hours.
show_upvoted_percentage: process.env.SHOW_UPVOTED_PERCENTAGE === 'true' || true,
post_media_max_heights: {
/**
* Sets the max-height value for images and videos in posts.

View File

@ -68,6 +68,10 @@ overridingRoutes.all('*', (req, res, next) => {
maxAge: 31536000,
httpOnly: true,
});
} else if (!req.cookies.show_upvoted_percentage) {
if (config.show_upvoted_percentage) {
req.cookies.show_upvoted_percentage = 'true';
}
}
let domainTwitter = req.query.domain_twitter;