From edc0bf902d16e89a9e83f929945b9525a62ef9aa Mon Sep 17 00:00:00 2001 From: Cynthia Foxwell Date: Mon, 11 Nov 2024 10:39:12 -0700 Subject: [PATCH] fedimbed.bluesky: forgot all parts dont have features --- src/modules/fedimbed.js | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/src/modules/fedimbed.js b/src/modules/fedimbed.js index c4dbf8c..703e6f5 100644 --- a/src/modules/fedimbed.js +++ b/src/modules/fedimbed.js @@ -253,28 +253,29 @@ async function bluesky(msg, url, spoiler = false) { splitString.push({text: mainEmbed.description.substring(start)}); for (const part of splitString) { - for (const feature of part.features) { - switch (feature.$type) { - case "app.bsky.richtext.facet#link": { - if (part.text == feature.uri.replace(/^https?:\/\//, "")) { - part.text = feature.uri; - } else { - part.text = `[${part.text}](${feature.uri})`; + if (part.features) + for (const feature of part.features) { + switch (feature.$type) { + case "app.bsky.richtext.facet#link": { + if (part.text == feature.uri.replace(/^https?:\/\//, "")) { + part.text = feature.uri; + } else { + part.text = `[${part.text}](${feature.uri})`; + } + break; } - break; + case "app.bsky.richtext.facet#mention": { + part.text = `[${part.text}](https://bsky.app/profile/${feature.did})`; + break; + } + case "app.bsky.richtext.facet#tag": { + part.text = `[${part.text}](https://bsky.app/hashtag/${feature.tag})`; + break; + } + default: + break; } - case "app.bsky.richtext.facet#mention": { - part.text = `[${part.text}](https://bsky.app/profile/${feature.did})`; - break; - } - case "app.bsky.richtext.facet#tag": { - part.text = `[${part.text}](https://bsky.app/hashtag/${feature.tag})`; - break; - } - default: - break; } - } } mainEmbed.description = splitString.map((part) => part.text).join("");