Skip to content

Commit

Permalink
Use shared inbox & provide to/cc
Browse files Browse the repository at this point in the history
  • Loading branch information
dahlia committed Oct 12, 2024
1 parent a1562fb commit b8c247c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/api/v1/statuses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
EmojiReact,
Image,
Note,
PUBLIC_COLLECTION,
Remove,
Undo,
} from "@fedify/fedify";
Expand Down Expand Up @@ -998,6 +999,8 @@ app.put(
const activity = new EmojiReact({
id: new URL(`/#react/${owner.id}/${postId}/${emoji}`, url),
actor: fedCtx.getActorUri(owner.handle),
tos: [new URL(post.account.iri), fedCtx.getFollowersUri(owner.handle)],
cc: PUBLIC_COLLECTION,
object: new URL(post.iri),
content: emojiCode,
tags: tag == null ? [] : [tag],
Expand All @@ -1006,6 +1009,7 @@ app.put(
{ username: owner.handle },
"followers",
activity,
{ preferSharedInbox: true },
);
await fedCtx.sendActivity(
{ username: owner.handle },
Expand All @@ -1020,6 +1024,7 @@ app.put(
},
},
activity,
{ preferSharedInbox: true },
);
return c.json(serializePost(post, owner, c.req.url));
},
Expand Down Expand Up @@ -1063,9 +1068,13 @@ app.delete(
const activity = new Undo({
id: new URL(`/#react/undo/${owner.id}/${postId}/${emoji}`, url),
actor: fedCtx.getActorUri(owner.handle),
tos: [new URL(post.account.iri), fedCtx.getFollowersUri(owner.handle)],
cc: PUBLIC_COLLECTION,
object: new EmojiReact({
id: new URL(`/#react/${owner.id}/${postId}/${emoji}`, url),
actor: fedCtx.getActorUri(owner.handle),
tos: [new URL(post.account.iri), fedCtx.getFollowersUri(owner.handle)],
cc: PUBLIC_COLLECTION,
object: new URL(post.iri),
content: reaction.emoji,
tags:
Expand All @@ -1086,6 +1095,7 @@ app.delete(
{ username: owner.handle },
"followers",
activity,
{ preferSharedInbox: true },
);
await fedCtx.sendActivity(
{ username: owner.handle },
Expand All @@ -1100,6 +1110,7 @@ app.delete(
},
},
activity,
{ preferSharedInbox: true },
);
return c.json(serializePost(post, owner, c.req.url));
},
Expand Down

0 comments on commit b8c247c

Please sign in to comment.