Skip to content

Node.js based forum software built for the modern web

fix: inbox.announce to not reject activities from relays

Julian Lamb1dbb19c10c0
diff --git a/src/activitypub/inbox.js b/src/activitypub/inbox.js
index faab5c0674..754720f208 100644
--- a/src/activitypub/inbox.js
+++ b/src/activitypub/inbox.js
@@ -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`);
diff --git a/src/activitypub/relays.js b/src/activitypub/relays.js
index aa6000f154..1aff86c130 100644
--- a/src/activitypub/relays.js
+++ b/src/activitypub/relays.js
@@ -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 }) => {