fedimbed.bluesky: inline post link into footer

This commit is contained in:
Cynthia Foxwell 2025-04-18 15:09:20 -06:00
parent cb5fd724fd
commit 9d9ca95034
Signed by: Cynosphere
SSH key fingerprint: SHA256:H3SM8ufP/uxqLwKSH7xY89TDnbR9uOHzjLoBr0tlajk

View file

@ -416,8 +416,21 @@ async function blueskyQuoteEmbed(quote) {
} }
const footer = { const footer = {
type: 9,
components: [
{
type: 10, type: 10,
content: `${getStatsBluesky(quote)}\n<t:${Math.floor(new Date(quote.value.createdAt).getTime() / 1000)}:F>`, content: `${getStatsBluesky(quote)}\n<:i:1362895346690424832> Bluesky \u2022 <t:${Math.floor(
new Date(quote.view.createdAt).getTime() / 1000
)}:F>`,
},
],
accessory: {
type: 2,
style: 5,
label: "View Post",
url: `https://bsky.app/profile/${quote.author.did}/post/${quote.uri.substring(quote.uri.lastIndexOf("/") + 1)}`,
},
}; };
if (images.length > 0) { if (images.length > 0) {
@ -434,11 +447,7 @@ async function blueskyQuoteEmbed(quote) {
} }
components.push(footer); components.push(footer);
const url = `https://bsky.app/profile/${quote.author.did}/post/${quote.uri.substring( return {components, adult, hidden, spoiler, tags};
quote.uri.lastIndexOf("/") + 1
)}`;
return {components, url, adult, hidden, spoiler, tags};
} }
async function bluesky(msg, url, spoiler = false) { async function bluesky(msg, url, spoiler = false) {
@ -640,8 +649,21 @@ async function bluesky(msg, url, spoiler = false) {
container.components.push(header); container.components.push(header);
const footer = { const footer = {
type: 9,
components: [
{
type: 10, type: 10,
content: `${getStatsBluesky(post)}\n<t:${Math.floor(new Date(post.record.createdAt).getTime() / 1000)}:F>`, content: `${getStatsBluesky(post)}\n<:i:1362895346690424832> Bluesky \u2022 <t:${Math.floor(
new Date(post.record.createdAt).getTime() / 1000
)}:F>`,
},
],
accessory: {
type: 2,
style: 5,
label: "View Post",
url,
},
}; };
if (images.length > 0) { if (images.length > 0) {
@ -662,20 +684,6 @@ async function bluesky(msg, url, spoiler = false) {
if (quoteData) container.components.push({type: 14}, ...quoteData.components); if (quoteData) container.components.push({type: 14}, ...quoteData.components);
const buttons = {
type: 1,
components: [
{
type: 2,
style: 5,
label: "Post",
url,
},
],
};
if (quoteData?.url) buttons.components.push({type: 2, style: 5, label: "Quoted Post", url: quoteData.url});
container.components.push(buttons);
return { return {
response: { response: {
flags: 1 << 15, flags: 1 << 15,