diff --git a/src/modules/fedimbed.js b/src/modules/fedimbed.js index 009174a..75fd6e4 100644 --- a/src/modules/fedimbed.js +++ b/src/modules/fedimbed.js @@ -343,28 +343,34 @@ async function blueskyQuoteEmbed(quote) { const components = []; - const header = { - type: 9, - components: [ - { - type: 10, - content: `### <:i:1308640087759654922> Quoted Post\n## ${quote.author.displayName}\n[@${ - quote.author.handle - }](https://bsky.app/profile/${quote.author.did})\n${ - quote.value.facets?.length ?? 0 > 0 - ? processBlueskyFacets(quote.value.text, quote.value.facets) - : quote.value.text - }`.trim(), - }, - ], - accessory: { - type: 11, - media: { - url: quote.author.avatar, + const header = [ + { + type: 10, + content: "-# <:i:1308640087759654922> Quoted Post", + }, + { + type: 9, + components: [ + { + type: 10, + content: `## ${quote.author.displayName}\n-# [@${quote.author.handle}](https://bsky.app/profile/${ + quote.author.did + })\n${ + quote.value.facets?.length ?? 0 > 0 + ? processBlueskyFacets(quote.value.text, quote.value.facets) + : quote.value.text + }`, + }, + ], + accessory: { + type: 11, + media: { + url: quote.author.avatar, + }, }, }, - }; - components.push(header); + ]; + components.push(...header); if (quote.embeds?.[0]) { const embed = quote.embeds[0]; @@ -620,33 +626,39 @@ async function bluesky(msg, url, spoiler = false) { let context = ""; if (data.thread.parent) { const reply = data.thread.parent.post; - context = `### <:i:1308640078825787412> Replying to: [${reply.author.displayName} (@${ + context = `-# <:i:1308640078825787412> Replying to: [${reply.author.displayName} (@${ reply.author.handle })](https://bsky.app/profile/${reply.author.did}/post/${reply.uri.substring(reply.uri.lastIndexOf("/") + 1)})`; } - const header = { - type: 9, - components: [ - { - type: 10, - content: `${context}\n## ${post.author.displayName}\n[@${post.author.handle}](https://bsky.app/profile/${ - post.author.did - })\n${ - post.record.facets?.length ?? 0 > 0 - ? processBlueskyFacets(post.record.text, post.record.facets) - : post.record.text - }`.trim(), - }, - ], - accessory: { - type: 11, - media: { - url: post.author.avatar, + const header = [ + context && { + type: 10, + content: context, + }, + { + type: 9, + components: [ + { + type: 10, + content: `## ${post.author.displayName}\n-# [@${post.author.handle}](https://bsky.app/profile/${ + post.author.did + })\n${ + post.record.facets?.length ?? 0 > 0 + ? processBlueskyFacets(post.record.text, post.record.facets) + : post.record.text + }`, + }, + ], + accessory: { + type: 11, + media: { + url: post.author.avatar, + }, }, }, - }; - container.components.push(header); + ].filter((x) => !!x); + container.components.push(...header); const footer = { type: 9,