fedimbed: move timestamp next to username in minimal

This commit is contained in:
Cynthia Foxwell 2025-05-07 20:22:39 -06:00
parent cafe25d614
commit 71829a58ac
Signed by: Cynosphere
SSH key fingerprint: SHA256:H3SM8ufP/uxqLwKSH7xY89TDnbR9uOHzjLoBr0tlajk

View file

@ -381,7 +381,9 @@ async function blueskyQuoteEmbed(quote, minimal = false) {
? [ ? [
{ {
type: 10, 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 <t:${Math.floor(new Date(quote.value.createdAt).getTime() / 1000)}:F>\n${content}`,
}, },
] ]
: [ : [
@ -456,28 +458,23 @@ async function blueskyQuoteEmbed(quote, minimal = false) {
} }
} }
const footer = minimal const footer = {
? { type: 9,
components: [
{
type: 10, type: 10,
content: `<t:${Math.floor(new Date(quote.value.createdAt).getTime() / 1000)}:F>`, content: `### -# ${getStatsBluesky(quote)}\n${Icons.fedimbed.bluesky} Bluesky \u2022 <t:${Math.floor(
} new Date(quote.value.createdAt).getTime() / 1000
: { )}:F>`,
type: 9, },
components: [ ],
{ accessory: {
type: 10, type: 2,
content: `### -# ${getStatsBluesky(quote)}\n${Icons.fedimbed.bluesky} Bluesky \u2022 <t:${Math.floor( style: 5,
new Date(quote.value.createdAt).getTime() / 1000 label: "View Post",
)}:F>`, url: quoteUrl,
}, },
], };
accessory: {
type: 2,
style: 5,
label: "View Post",
url: quoteUrl,
},
};
if (images.length > 0) { if (images.length > 0) {
components.push({ components.push({
@ -491,7 +488,7 @@ async function blueskyQuoteEmbed(quote, minimal = false) {
items: [video], items: [video],
}); });
} }
components.push(footer); if (!minimal) components.push(footer);
return {components, adult, hidden, spoiler, tags}; return {components, adult, hidden, spoiler, tags};
} }
@ -680,7 +677,9 @@ async function bluesky(msg, url, spoiler = false, minimal = false) {
const contentComponent = { const contentComponent = {
type: 10, type: 10,
content: minimal content: minimal
? `### [${post.author.displayName} (@${post.author.handle})](${url})\n${content}` ? `### [${post.author.displayName} (@${post.author.handle})](${url}) \u2022 <t:${Math.floor(
new Date(post.record.createdAt).getTime() / 1000
)}:F>\n${content}`
: `## ${post.author.displayName}\n-# [@${post.author.handle}](https://bsky.app/profile/${post.author.did})\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); ].filter((x) => !!x);
container.components.push(...header); container.components.push(...header);
const footer = minimal const footer = {
? { type: 9,
components: [
{
type: 10, type: 10,
content: `<t:${Math.floor(new Date(post.record.createdAt).getTime() / 1000)}:F>`, content: `### -# ${getStatsBluesky(post)}\n${Icons.fedimbed.bluesky} Bluesky \u2022 <t:${Math.floor(
} new Date(post.record.createdAt).getTime() / 1000
: { )}:F>`,
type: 9, },
components: [ ],
{ accessory: {
type: 10, type: 2,
content: `### -# ${getStatsBluesky(post)}\n${Icons.fedimbed.bluesky} Bluesky \u2022 <t:${Math.floor( style: 5,
new Date(post.record.createdAt).getTime() / 1000 label: "View Post",
)}:F>`, url,
}, },
], };
accessory: {
type: 2,
style: 5,
label: "View Post",
url,
},
};
if (images.length > 0) { if (images.length > 0) {
container.components.push({ container.components.push({
@ -739,7 +733,7 @@ async function bluesky(msg, url, spoiler = false, minimal = false) {
items: [video], items: [video],
}); });
} }
container.components.push(footer); if (!minimal) container.components.push(footer);
if (quoteOnly && !hasQuote) return {}; if (quoteOnly && !hasQuote) return {};
@ -1410,7 +1404,9 @@ async function processUrl(msg, url, spoiler = false, command = false, inQuote =
}; };
let headerContent = minimal let headerContent = minimal
? `### [${author.name ? `${author.name} (${author.handle})` : author.handle}](${realUrl})` ? `### [${author.name ? `${author.name} (${author.handle})` : author.handle}](${realUrl}) \u2022 <t:${Math.floor(
new Date(timestamp).getTime() / 1000
)}:F>`
: `${author.name ? `## ${author.name}\n` : ""}-# [${author.handle}](${author.url})`; : `${author.name ? `## ${author.name}\n` : ""}-# [${author.handle}](${author.url})`;
if (title) headerContent += minimal ? "\n**__" + title + "__**" : "\n### " + title; 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 footerIcon = PLATFORM_ICONS[platformName.toLowerCase()];
const footer = minimal const footer = {
? { type: 9,
components: [
{
type: 10, type: 10,
content: `${platformName === "Twitter" ? "" : platformName + " "}<t:${Math.floor( content: `${stats.length > 0 ? "### -# " + stats + "\n" : ""}${
new Date(timestamp).getTime() / 1000 footerIcon ? footerIcon + " " : ""
)}:F>`, }${platformName} \u2022 <t:${Math.floor(new Date(timestamp).getTime() / 1000)}:F>`,
} },
: { ],
type: 9, accessory: {
components: [ type: 2,
{ style: 5,
type: 10, label: "View Post",
content: `${stats.length > 0 ? "### -# " + stats + "\n" : ""}${ url: realUrl,
footerIcon ? footerIcon + " " : "" },
}${platformName} \u2022 <t:${Math.floor(new Date(timestamp).getTime() / 1000)}:F>`, };
},
],
accessory: {
type: 2,
style: 5,
label: "View Post",
url: realUrl,
},
};
if (images.length > 0) { if (images.length > 0) {
const overMax = images.length + videos.length > 40; const overMax = images.length + videos.length > 40;
if (images.length > 10) { 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]; const components = [cw.length > 0 && warningText, container];