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)