Add logic to parse and remove any instances of https://twitter.com by replacing with user's preference

The issue was happening since the original regex is checking for href tags only, so I tried a simpler approach of searching for https://twitter.com instead whenever the regex does not match the input string

Add Nodemon package to dev dependencies for local debugging
このコミットが含まれているのは:
Anshuman Kumar 2022-12-29 20:19:58 +05:30
コミット c71bf6ee48
4個のファイルの変更904行の追加190行の削除

ファイルの表示

@ -261,8 +261,14 @@ module.exports = function(request, fs) {
str = str.replace(youtubeRegex, protocol + user_preferences.domain_youtube)
if(typeof(user_preferences.domain_twitter) != 'undefined')
if(user_preferences.domain_twitter)
str = str.replace(twitterRegex, protocol + user_preferences.domain_twitter)
if(user_preferences.domain_twitter){
if (twitterRegex.test(str)){
str = str.replace(twitterRegex, protocol + user_preferences.domain_twitter)
}
else {
str = str.replace('https://twitter.com',protocol + user_preferences.domain_twitter)
}
}
if(typeof(user_preferences.domain_instagram) != 'undefined')
if(user_preferences.domain_instagram)

ファイルの表示

@ -210,7 +210,7 @@ module.exports = function() {
}
comments_html += replies_html + '</details></div>'
} else {
if(comment.children.length > 0) {
if(comment.children.length > 0) {
let parent_id = comment.parent_id.split('_')[1]
let load_comms_href = parent_id

1075
package-lock.json generated

ファイル差分が大きすぎるため省略します 差分を読み込み

ファイルの表示

@ -20,7 +20,8 @@
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node app.js"
"start": "node app.js",
"dev": "nodemon app.js"
},
"dependencies": {
"compression": "^1.7.4",
@ -34,5 +35,7 @@
"pug": "^3.0.2",
"redis": "^3.1.2"
},
"devDependencies": {}
"devDependencies": {
"nodemon": "^2.0.20"
}
}