diff --git a/config.js.template b/config.js.template index e9e7c53..dcab1cf 100644 --- a/config.js.template +++ b/config.js.template @@ -2,6 +2,7 @@ const config = { domain: process.env.DOMAIN || '127.0.0.1', // Or for example 'teddit.net' reddit_app_id: process.env.REDDIT_APP_ID || 'H6-HjZ5pUPjaFQ', // You should obtain your own Reddit app ID. For testing purposes it's okay to use this project's default app ID. Create your Reddit app here: https://old.reddit.com/prefs/apps/. Make sure to create an "installed app" type of app. cert_dir: process.env.CERT_DIR || '', // For example '/home/teddit/letsencrypt/live/teddit.net', if you are using https. No trailing slash. + 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, redis_enabled: process.env.REDIS_ENABLED !== "true" || true, // If disabled, does not cache Reddit API calls diff --git a/inc/commons.js b/inc/commons.js index b0e7aa3..2cea66e 100644 --- a/inc/commons.js +++ b/inc/commons.js @@ -199,6 +199,10 @@ module.exports = function(request, fs) { } this.formatLinkFlair = async (post) => { + if (!config.flairs_enabled) { + return '' + } + const wrap = (inner) => `${inner}` if (post.link_flair_text === null) @@ -222,6 +226,10 @@ module.exports = function(request, fs) { } this.formatUserFlair = async (post) => { + if (!config.flairs_enabled) { + return '' + } + // Generate the entire HTML here for consistency in both pug and HTML const wrap = (inner) => `${inner}`