From fa5e3337c77c78128ea44d2ab8bb298dd7478621 Mon Sep 17 00:00:00 2001 From: teddit Date: Sun, 21 Mar 2021 21:48:28 +0100 Subject: [PATCH] replace reddit links by default --- inc/commons.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/inc/commons.js b/inc/commons.js index 83d5af9..569411d 100644 --- a/inc/commons.js +++ b/inc/commons.js @@ -164,9 +164,6 @@ module.exports = function(request, fs) { } this.replacePrivacyDomains = (str, user_preferences) => { - if(typeof(user_preferences) == 'undefined') - return str - let redditRegex = /([A-z.]+\.)?(reddit(\.com)|redd(\.it))/gm; let youtubeRegex = /([A-z.]+\.)?youtu(be\.com|\.be)/gm; let twitterRegex = /([A-z.]+\.)?twitter\.com/gm; @@ -174,6 +171,9 @@ module.exports = function(request, fs) { str = str.replace(redditRegex, config.domain) + if(typeof(user_preferences) == 'undefined') + return str + if(typeof(user_preferences.domain_youtube) != 'undefined') if(user_preferences.domain_youtube) str = str.replace(youtubeRegex, user_preferences.domain_youtube)