fedimbed: dont include original platform name if its in the crawled platform name

This commit is contained in:
Cynthia Foxwell 2025-04-17 22:38:33 -06:00
parent ea63a96ec1
commit 27f8563c4f
Signed by: Cynosphere
SSH key fingerprint: SHA256:H3SM8ufP/uxqLwKSH7xY89TDnbR9uOHzjLoBr0tlajk

View file

@ -50,6 +50,7 @@ const PLATFORM_COLORS = {
pixelfed: 0x10c5f8,
//cohost: 0x83254f,
bluesky: 0x0085ff,
nitter: 0xff6c60,
twitter: 0xff6c60, // Nitter accent color
};
@ -200,10 +201,10 @@ async function getCrawledData(url, color, platformName) {
if (platformName == "<no nodeinfo>") {
platformName = tag.$content;
} else {
platformName = `${tag.$content} (${platformName})`;
platformName = tag.$content.includes(platformName) ? tag.$content : `${tag.$content} (${platformName})`;
}
} else if (!color && tag.$name == "theme-color") {
color = parseInt(tag.$content.replace("^#", "0x"));
color = parseInt(tag.$content.replace(/^#/, "0x"));
}
}
}
@ -1453,6 +1454,12 @@ async function processUrl(msg, url, spoiler = false, command = false) {
platformName = crawled.platformName;
}
if (platformName.includes("Nitter") && platformName.includes(" \u2022 ")) {
const [ns, nn] = platformName.split(" \u2022 ");
stats = ns;
platformName = nn;
}
const baseEmbed = {
color,
url,