diff --git a/utils.js b/utils.js index 1924a6c..bc1c8f3 100644 --- a/utils.js +++ b/utils.js @@ -69,11 +69,14 @@ export async function getMastodonPost(feedUrl) { const link = item.querySelector('link')?.textContent.trim() // use description as the text, stripping HTML - const cleanText = sanitizeHtml(description, { + let cleanText = sanitizeHtml(description, { allowedTags: [], allowedAttributes: {}, })?.trim() + // replace URLs with link emoji + cleanText = cleanText.replace(/https?:\/\/\S+/g, '🔗').trim() + return { text: cleanText, url: link } } @@ -81,10 +84,12 @@ export async function getMastodonPost(feedUrl) { const firstItem = items[0] const description = firstItem.querySelector('description')?.textContent || '' const link = firstItem.querySelector('link')?.textContent.trim() - const cleanText = sanitizeHtml(description, { + let cleanText = sanitizeHtml(description, { allowedTags: [], allowedAttributes: {}, })?.trim() + // replace URLs with link emoji + cleanText = cleanText.replace(/https?:\/\/\S+/g, '🔗').trim() return { text: cleanText, url: link } }