mirror of
https://codeberg.org/tacerus/teddit.git
synced 2024-11-22 06:49:26 +01:00
Add configuration setting for flairs
This commit is contained in:
parent
9c4cda7b42
commit
19d9a7c631
@ -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
|
||||
|
@ -199,6 +199,10 @@ module.exports = function(request, fs) {
|
||||
}
|
||||
|
||||
this.formatLinkFlair = async (post) => {
|
||||
if (!config.flairs_enabled) {
|
||||
return ''
|
||||
}
|
||||
|
||||
const wrap = (inner) => `<span class="flair">${inner}</span>`
|
||||
|
||||
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) => `<span class="flair">${inner}</span>`
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user