diff --git a/lib/jf2-to-as2.js b/lib/jf2-to-as2.js index df62b87..693703a 100644 --- a/lib/jf2-to-as2.js +++ b/lib/jf2-to-as2.js @@ -250,9 +250,12 @@ export function jf2ToAS2Activity(properties, actorUrl, publicationUrl, options = if (postType === "like") { const likeOf = properties["like-of"]; if (!likeOf) return null; + const followersUrl = `${actorUrl.replace(/\/$/, "")}/followers`; return new Like({ actor: actorUri, object: new URL(likeOf), + to: new URL("https://www.w3.org/ns/activitystreams#Public"), + cc: new URL(followersUrl), }); } @@ -260,10 +263,12 @@ export function jf2ToAS2Activity(properties, actorUrl, publicationUrl, options = if (postType === "repost") { const repostOf = properties["repost-of"]; if (!repostOf) return null; + const followersUrl = `${actorUrl.replace(/\/$/, "")}/followers`; return new Announce({ actor: actorUri, object: new URL(repostOf), to: new URL("https://www.w3.org/ns/activitystreams#Public"), + cc: new URL(followersUrl), }); } @@ -554,7 +559,7 @@ function buildPlainTags(properties, publicationUrl, existing) { for (const cat of asArray(properties.category)) { tags.push({ type: "Hashtag", - name: `#${cat.replace(/\s+/g, "")}`, + name: `#${cat.split("/").at(-1).replace(/\s+/g, "")}`, href: `${publicationUrl}categories/${encodeURIComponent(cat)}`, }); } @@ -576,7 +581,7 @@ function buildFedifyTags(properties, publicationUrl, postType) { for (const cat of asArray(properties.category)) { tags.push( new Hashtag({ - name: `#${cat.replace(/\s+/g, "")}`, + name: `#${cat.split("/").at(-1).replace(/\s+/g, "")}`, href: new URL( `${publicationUrl}categories/${encodeURIComponent(cat)}`, ),