fedimbed: i think i have too many domains

This commit is contained in:
Cynthia Foxwell 2025-07-13 16:12:57 -06:00
parent 48e16c3988
commit d45a3714b5
Signed by: Cynosphere
SSH key fingerprint: SHA256:H3SM8ufP/uxqLwKSH7xY89TDnbR9uOHzjLoBr0tlajk

View file

@ -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");
}
}