fix: inbox.announce to not reject activities from relays

This commit is contained in:
Julian Lam
2025-08-26 13:53:51 -04:00
parent f4d1df7c66
commit b1dbb19c10
2 changed files with 8 additions and 1 deletions

View File

@@ -288,6 +288,9 @@ inbox.announce = async (req) => {
cid = actor;
}
// Received via relay?
const fromRelay = await activitypub.relays.is(actor);
switch(true) {
case object.type === 'Like': {
const id = object.object.id || object.object;
@@ -333,7 +336,7 @@ inbox.announce = async (req) => {
socketHelpers.sendNotificationToPostOwner(pid, actor, 'announce', 'notifications:activitypub.announce');
} else { // Remote object
// Follower check
if (!cid) {
if (!fromRelay && !cid) {
const { followers } = await activitypub.actors.getLocalFollowCounts(actor);
if (!followers) {
winston.verbose(`[activitypub/inbox.announce] Rejecting ${object.id} via ${actor} due to no followers`);

View File

@@ -7,6 +7,10 @@ const db = require('../database');
const activitypub = module.parent.exports;
const Relays = module.exports;
Relays.is = async (actor) => {
return db.isSortedSetMember('relays:createtime', actor);
};
Relays.list = async () => {
let relays = await db.getSortedSetMembersWithScores('relays:state');
relays = relays.reduce((memo, { value, score }) => {