diff --git a/lib/jf2-to-as2.js b/lib/jf2-to-as2.js
index 6bfb119..f355e5e 100644
--- a/lib/jf2-to-as2.js
+++ b/lib/jf2-to-as2.js
@@ -52,20 +52,38 @@ export function jf2ToActivityStreams(properties, actorUrl, publicationUrl) {
const postType = properties["post-type"];
if (postType === "like") {
+ // Serve like posts as Note objects for AP content negotiation.
+ // Returning a bare Like activity breaks Mastodon's authorize_interaction
+ // flow because it expects a content object (Note/Article), not an activity.
+ const likeOf = properties["like-of"];
+ const postUrl = resolvePostUrl(properties.url, publicationUrl);
return {
"@context": "https://www.w3.org/ns/activitystreams",
- type: "Like",
- actor: actorUrl,
- object: properties["like-of"],
+ type: "Note",
+ id: postUrl,
+ attributedTo: actorUrl,
+ published: properties.published,
+ url: postUrl,
+ to: ["https://www.w3.org/ns/activitystreams#Public"],
+ cc: [`${actorUrl.replace(/\/$/, "")}/followers`],
+ content: `\u2764\uFE0F ${likeOf}`,
};
}
if (postType === "repost") {
+ // Same rationale as like — serve as Note for content negotiation.
+ const repostOf = properties["repost-of"];
+ const postUrl = resolvePostUrl(properties.url, publicationUrl);
return {
"@context": "https://www.w3.org/ns/activitystreams",
- type: "Announce",
- actor: actorUrl,
- object: properties["repost-of"],
+ type: "Note",
+ id: postUrl,
+ attributedTo: actorUrl,
+ published: properties.published,
+ url: postUrl,
+ to: ["https://www.w3.org/ns/activitystreams#Public"],
+ cc: [`${actorUrl.replace(/\/$/, "")}/followers`],
+ content: `\u{1F501} ${repostOf}`,
};
}