feat(swarm): Add direct swarm interaction delivery for likes, reposts, and unreosts

- Add swarm post handling to like endpoint with direct delivery to origin node
- Add swarm post handling to repost endpoint with direct delivery to origin node
- Add new unrepost endpoint for removing reposts from swarm posts
- Implement deliverSwarmUnrepost function in interactions library
- Extract swarm domain and post ID validation for all interaction types
- Return appropriate error responses for invalid swarm post IDs
- Log successful swarm interaction deliveries for debugging
- Improve separation between local post and swarm post handling logic
- Enable federated users to interact with remote swarm posts directly without local caching
This commit is contained in:
Christomatt
2026-01-26 13:04:05 +01:00
parent 12f515b7fb
commit f361e13e53
4 changed files with 222 additions and 6 deletions
+20
View File
@@ -110,6 +110,16 @@ export interface SwarmUnfollowPayload {
};
}
export interface SwarmUnrepostPayload {
postId: string;
unrepost: {
actorHandle: string;
actorNodeDomain: string;
interactionId: string;
timestamp: string;
};
}
export interface SwarmMentionPayload {
mentionedHandle: string;
mention: {
@@ -219,6 +229,16 @@ export async function deliverSwarmUnfollow(
return deliverSwarmInteraction(targetDomain, '/api/swarm/interactions/unfollow', payload);
}
/**
* Deliver an unrepost to a swarm node
*/
export async function deliverSwarmUnrepost(
targetDomain: string,
payload: SwarmUnrepostPayload
): Promise<SwarmInteractionResponse> {
return deliverSwarmInteraction(targetDomain, '/api/swarm/interactions/unrepost', payload);
}
/**
* Deliver a mention notification to a swarm node
*/