chore: update filters
This commit is contained in:
parent
350c4961d4
commit
185bab9ff4
1 changed files with 3 additions and 3 deletions
|
@ -1,5 +1,6 @@
|
||||||
const marked = require('marked')
|
const marked = require('marked')
|
||||||
const sanitizeHTML = require('sanitize-html')
|
const sanitizeHTML = require('sanitize-html')
|
||||||
|
const utmPattern = /[?&](utm_[^&=]+=[^&#]*)/gi
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
trim: (string, limit) => {
|
trim: (string, limit) => {
|
||||||
|
@ -18,8 +19,7 @@ module.exports = {
|
||||||
return string.replace(pattern, replacement)
|
return string.replace(pattern, replacement)
|
||||||
},
|
},
|
||||||
stripUtm: (string) => {
|
stripUtm: (string) => {
|
||||||
const pattern = /[?&](utm_[^&=]+=[^&#]*)/gi
|
return string.replace(utmPattern, '')
|
||||||
return string.replace(pattern, '')
|
|
||||||
},
|
},
|
||||||
getPostImage: (image) => {
|
getPostImage: (image) => {
|
||||||
if (image && image !== '') return image
|
if (image && image !== '') return image
|
||||||
|
@ -51,7 +51,7 @@ module.exports = {
|
||||||
|
|
||||||
const filtered =
|
const filtered =
|
||||||
webmentions
|
webmentions
|
||||||
.filter((entry) => entry['wm-target'] === `https://coryd.dev${url}`)
|
.filter((entry) => entry['wm-target'].replace(utmPattern, '') === `https://coryd.dev${url}`)
|
||||||
.filter((entry) => allowedTypes.includes(entry['wm-property'])) || []
|
.filter((entry) => allowedTypes.includes(entry['wm-property'])) || []
|
||||||
|
|
||||||
filtered.forEach((m) => {
|
filtered.forEach((m) => {
|
||||||
|
|
Reference in a new issue