From 71829a58acdaefa9b44bb8342ba980d46d743ce2 Mon Sep 17 00:00:00 2001 From: Cynthia Foxwell Date: Wed, 7 May 2025 20:22:39 -0600 Subject: [PATCH] fedimbed: move timestamp next to username in minimal --- src/modules/fedimbed.js | 131 ++++++++++++++++++---------------------- 1 file changed, 60 insertions(+), 71 deletions(-) diff --git a/src/modules/fedimbed.js b/src/modules/fedimbed.js index f3f5095..b6d3048 100644 --- a/src/modules/fedimbed.js +++ b/src/modules/fedimbed.js @@ -381,7 +381,9 @@ async function blueskyQuoteEmbed(quote, minimal = false) { ? [ { type: 10, - content: `### ${Icons.fedimbed.quote} [${quote.author.displayName} (@${quote.author.handle})](${quoteUrl})\n${content}`, + content: `### ${Icons.fedimbed.quote} [${quote.author.displayName} (@${ + quote.author.handle + })](${quoteUrl}) \u2022 \n${content}`, }, ] : [ @@ -456,28 +458,23 @@ async function blueskyQuoteEmbed(quote, minimal = false) { } } - const footer = minimal - ? { + const footer = { + type: 9, + components: [ + { type: 10, - content: ``, - } - : { - type: 9, - components: [ - { - type: 10, - content: `### -# ${getStatsBluesky(quote)}\n${Icons.fedimbed.bluesky} Bluesky \u2022 `, - }, - ], - accessory: { - type: 2, - style: 5, - label: "View Post", - url: quoteUrl, - }, - }; + content: `### -# ${getStatsBluesky(quote)}\n${Icons.fedimbed.bluesky} Bluesky \u2022 `, + }, + ], + accessory: { + type: 2, + style: 5, + label: "View Post", + url: quoteUrl, + }, + }; if (images.length > 0) { components.push({ @@ -491,7 +488,7 @@ async function blueskyQuoteEmbed(quote, minimal = false) { items: [video], }); } - components.push(footer); + if (!minimal) components.push(footer); return {components, adult, hidden, spoiler, tags}; } @@ -680,7 +677,9 @@ async function bluesky(msg, url, spoiler = false, minimal = false) { const contentComponent = { type: 10, content: minimal - ? `### [${post.author.displayName} (@${post.author.handle})](${url})\n${content}` + ? `### [${post.author.displayName} (@${post.author.handle})](${url}) \u2022 \n${content}` : `## ${post.author.displayName}\n-# [@${post.author.handle}](https://bsky.app/profile/${post.author.did})\n${content}`, }; @@ -704,28 +703,23 @@ async function bluesky(msg, url, spoiler = false, minimal = false) { ].filter((x) => !!x); container.components.push(...header); - const footer = minimal - ? { + const footer = { + type: 9, + components: [ + { type: 10, - content: ``, - } - : { - type: 9, - components: [ - { - type: 10, - content: `### -# ${getStatsBluesky(post)}\n${Icons.fedimbed.bluesky} Bluesky \u2022 `, - }, - ], - accessory: { - type: 2, - style: 5, - label: "View Post", - url, - }, - }; + content: `### -# ${getStatsBluesky(post)}\n${Icons.fedimbed.bluesky} Bluesky \u2022 `, + }, + ], + accessory: { + type: 2, + style: 5, + label: "View Post", + url, + }, + }; if (images.length > 0) { container.components.push({ @@ -739,7 +733,7 @@ async function bluesky(msg, url, spoiler = false, minimal = false) { items: [video], }); } - container.components.push(footer); + if (!minimal) container.components.push(footer); if (quoteOnly && !hasQuote) return {}; @@ -1410,7 +1404,9 @@ async function processUrl(msg, url, spoiler = false, command = false, inQuote = }; let headerContent = minimal - ? `### [${author.name ? `${author.name} (${author.handle})` : author.handle}](${realUrl})` + ? `### [${author.name ? `${author.name} (${author.handle})` : author.handle}](${realUrl}) \u2022 ` : `${author.name ? `## ${author.name}\n` : ""}-# [${author.handle}](${author.url})`; if (title) headerContent += minimal ? "\n**__" + title + "__**" : "\n### " + title; @@ -1478,30 +1474,23 @@ async function processUrl(msg, url, spoiler = false, command = false, inQuote = } const footerIcon = PLATFORM_ICONS[platformName.toLowerCase()]; - const footer = minimal - ? { + const footer = { + type: 9, + components: [ + { type: 10, - content: `${platformName === "Twitter" ? "" : platformName + " "}`, - } - : { - type: 9, - components: [ - { - type: 10, - content: `${stats.length > 0 ? "### -# " + stats + "\n" : ""}${ - footerIcon ? footerIcon + " " : "" - }${platformName} \u2022 `, - }, - ], - accessory: { - type: 2, - style: 5, - label: "View Post", - url: realUrl, - }, - }; + content: `${stats.length > 0 ? "### -# " + stats + "\n" : ""}${ + footerIcon ? footerIcon + " " : "" + }${platformName} \u2022 `, + }, + ], + accessory: { + type: 2, + style: 5, + label: "View Post", + url: realUrl, + }, + }; if (images.length > 0) { const overMax = images.length + videos.length > 40; if (images.length > 10) { @@ -1557,7 +1546,7 @@ async function processUrl(msg, url, spoiler = false, command = false, inQuote = ); } - container.components.push(footer); + if (!minimal) container.components.push(footer); const components = [cw.length > 0 && warningText, container];