From 3772a254c209e1e583c1492b5aba6efd71efd603 Mon Sep 17 00:00:00 2001 From: dylan Date: Thu, 25 Dec 2025 21:22:42 +0000 Subject: [PATCH] updated getMastodonPost to replace URLs with link emoji --- utils.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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 } }