mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
fix: inbox.announce to not reject activities from relays
This commit is contained in:
@@ -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`);
|
||||
|
||||
@@ -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 }) => {
|
||||
|
||||
Reference in New Issue
Block a user