diff --git a/src/modules/fedimbed.js b/src/modules/fedimbed.js index 5e4284b..814b0b8 100644 --- a/src/modules/fedimbed.js +++ b/src/modules/fedimbed.js @@ -81,6 +81,7 @@ const BSKY_DOMAINS = [ "stupidpenisx.com", "girlcockx.com", "ilsforpresident.com", + "theworstplaceontheinter.net", // these two are base64 encoded just because i dont want those words in my codebase Buffer.from("aGl0bGVyeC5jb20=", "base64").toString(), Buffer.from("bmlnZ2VyeC5jb20=", "base64").toString(), @@ -98,6 +99,11 @@ const pageParser = new XMLParser({ trimValues: false, }); +const statsFormatter = Intl.NumberFormat("en-US", { + notation: "compact", + maximumFractionDigits: 1, +}); + const domainCache = new Map(); domainCache.set("cohost.org", "cohost"); // no nodeinfo @@ -299,6 +305,16 @@ function processBlueskyFacets(str, facets) { return splitString.map((part) => part.text).join(""); } +function getStatsBluesky(post) { + const stats = []; + if (post.replyCount > 0) stats.push(`\u21a9 ${statsFormatter.format(post.replyCount)}`); + if (post.repostCount > 0) stats.push(`\ud83d\udd01 ${statsFormatter.format(post.repostCount)}`); + if (post.quoteCount > 0) stats.push(`\u2198 ${statsFormatter.format(post.quoteCount)}`); + if (post.likeCount > 0) stats.push(`\u2665 ${statsFormatter.format(post.likeCount)}`); + + return stats.join("\u3000"); +} + async function blueskyQuoteEmbed(quote) { const embeds = []; const videos = []; @@ -334,7 +350,7 @@ async function blueskyQuoteEmbed(quote) { }, description: quote.value.text, footer: { - text: "Bluesky", + text: `${getStatsBluesky(quote)}\nBluesky`, icon_url: "https://bsky.app/static/apple-touch-icon.png", }, timestamp: quote.value.createdAt, @@ -525,7 +541,7 @@ async function bluesky(msg, url, spoiler = false) { url: post.author.avatar, }, footer: { - text: "Bluesky", + text: `${getStatsBluesky(post)}\nBluesky`, icon_url: "https://bsky.app/static/apple-touch-icon.png", }, timestamp: post.record.createdAt,