From baac0a60bcd41f563ae460ca042e1e4617a70a61 Mon Sep 17 00:00:00 2001 From: Ricardo Date: Fri, 20 Feb 2026 09:28:08 +0100 Subject: [PATCH] fix: filter Like and Announce to only log reactions to our content MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After following remote actors, their servers deliver all activities to our inbox — including likes/boosts of other people's posts. Only log Likes and Announces where the objectUrl starts with our publication URL, filtering out unrelated activity. --- lib/inbox-listeners.js | 14 ++++++++++++-- package.json | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/inbox-listeners.js b/lib/inbox-listeners.js index cfe95b6..f6775f0 100644 --- a/lib/inbox-listeners.js +++ b/lib/inbox-listeners.js @@ -161,13 +161,18 @@ export function registerInboxListeners(inboxChain, options) { } }) .on(Like, async (ctx, like) => { + const objectId = (await like.getObject())?.id?.href || ""; + + // Only log likes of our own content + const pubUrl = collections._publicationUrl; + if (!objectId || (pubUrl && !objectId.startsWith(pubUrl))) return; + const actorObj = await like.getActor(); const actorUrl = actorObj?.id?.href || ""; const actorName = actorObj?.name?.toString() || actorObj?.preferredUsername?.toString() || actorUrl; - const objectId = (await like.getObject())?.id?.href || ""; await logActivity(collections, storeRawActivities, { direction: "inbound", @@ -179,13 +184,18 @@ export function registerInboxListeners(inboxChain, options) { }); }) .on(Announce, async (ctx, announce) => { + const objectId = (await announce.getObject())?.id?.href || ""; + + // Only log boosts of our own content + const pubUrl = collections._publicationUrl; + if (!objectId || (pubUrl && !objectId.startsWith(pubUrl))) return; + const actorObj = await announce.getActor(); const actorUrl = actorObj?.id?.href || ""; const actorName = actorObj?.name?.toString() || actorObj?.preferredUsername?.toString() || actorUrl; - const objectId = (await announce.getObject())?.id?.href || ""; await logActivity(collections, storeRawActivities, { direction: "inbound", diff --git a/package.json b/package.json index c0143bc..d0b2d76 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@rmdes/indiekit-endpoint-activitypub", - "version": "1.0.13", + "version": "1.0.14", "description": "ActivityPub federation endpoint for Indiekit via Fedify. Adds full fediverse support: actor, inbox, outbox, followers, following, syndication, and Mastodon migration.", "keywords": [ "indiekit",