From d45a3714b5917b9353152d3650e7bf2c7cee16f5 Mon Sep 17 00:00:00 2001 From: Cynthia Foxwell Date: Sun, 13 Jul 2025 16:12:57 -0600 Subject: [PATCH] fedimbed: i think i have too many domains --- src/modules/fedimbed.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/modules/fedimbed.js b/src/modules/fedimbed.js index 6e93816..196a56b 100644 --- a/src/modules/fedimbed.js +++ b/src/modules/fedimbed.js @@ -72,6 +72,7 @@ const BSKY_DOMAINS = [ ]; const OWN_TW_DOMAINS = ["tw.c7.pm", "tw.counter-strike.gay", "tw.suicide.watch", "tw1tter.com"]; +const OWN_TW_DOMAIN_REGEX = /(tw\.(counter-strike\.gay|c7\.pm|suicide\.watch)|tw1tter\.com)/g; const TW_DOMAINS = [ ...OWN_TW_DOMAINS, "xcancel.com", @@ -1333,9 +1334,7 @@ async function processUrl(msg, url, spoiler = false, command = false, inQuote = if (!inQuote) quoteRes = await processUrl(msg, quoteUrl, spoiler, command, true, minimal); } - content = content - .replaceAll(/tw\.(counter-strike\.gay|c7\.pm)/g, "twitter.com") - .replaceAll(/twitter\.com\/t\.co/g, "t.co"); + content = content.replaceAll(OWN_TW_DOMAIN_REGEX, "twitter.com").replaceAll(/twitter\.com\/t\.co/g, "t.co"); const verifiedType = author.fields.find((f) => f.name === "Verified Type"); if (verifiedType) { @@ -1392,7 +1391,7 @@ async function processUrl(msg, url, spoiler = false, command = false, inQuote = if (platformName == "Twitter") { const newHandle = author.handle.split("@")[0]; author.handle = "@" + newHandle; - author.url = author.url.replaceAll(/tw\.(counter-strike\.gay|c7\.pm)/g, "twitter.com"); + author.url = author.url.replaceAll(OWN_TW_DOMAIN_REGEX, "twitter.com"); if (context) { const contextHandle = context.match(/\(([^@]+?@.+?)\)/)?.[1]; @@ -1400,7 +1399,7 @@ async function processUrl(msg, url, spoiler = false, command = false, inQuote = const newContextHandle = contextHandle.split("@")[0]; context = context.replace(contextHandle, "@" + newContextHandle); } - context = context.replaceAll(/tw\.(counter-strike\.gay|c7\.pm)/g, "twitter.com"); + context = context.replaceAll(OWN_TW_DOMAIN_REGEX, "twitter.com"); } }