replace reddit links by default

This commit is contained in:
teddit 2021-03-21 21:48:28 +01:00
parent e209391665
commit fa5e3337c7
1 changed files with 3 additions and 3 deletions

View File

@ -164,9 +164,6 @@ module.exports = function(request, fs) {
} }
this.replacePrivacyDomains = (str, user_preferences) => { this.replacePrivacyDomains = (str, user_preferences) => {
if(typeof(user_preferences) == 'undefined')
return str
let redditRegex = /([A-z.]+\.)?(reddit(\.com)|redd(\.it))/gm; let redditRegex = /([A-z.]+\.)?(reddit(\.com)|redd(\.it))/gm;
let youtubeRegex = /([A-z.]+\.)?youtu(be\.com|\.be)/gm; let youtubeRegex = /([A-z.]+\.)?youtu(be\.com|\.be)/gm;
let twitterRegex = /([A-z.]+\.)?twitter\.com/gm; let twitterRegex = /([A-z.]+\.)?twitter\.com/gm;
@ -174,6 +171,9 @@ module.exports = function(request, fs) {
str = str.replace(redditRegex, config.domain) str = str.replace(redditRegex, config.domain)
if(typeof(user_preferences) == 'undefined')
return str
if(typeof(user_preferences.domain_youtube) != 'undefined') if(typeof(user_preferences.domain_youtube) != 'undefined')
if(user_preferences.domain_youtube) if(user_preferences.domain_youtube)
str = str.replace(youtubeRegex, user_preferences.domain_youtube) str = str.replace(youtubeRegex, user_preferences.domain_youtube)