From 11e3c9502680111798f47e948a9a62b30d51c549 Mon Sep 17 00:00:00 2001 From: dakkar Date: Wed, 9 Oct 2024 16:39:24 +0100 Subject: [PATCH] replace `isBlockedHost` with `isFederationAllowedHost` --- packages/backend/src/server/ActivityPubServerService.ts | 6 +++--- .../backend/src/server/api/endpoints/notes/search-by-tag.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/backend/src/server/ActivityPubServerService.ts b/packages/backend/src/server/ActivityPubServerService.ts index 398ad54f6a..204c50dea3 100644 --- a/packages/backend/src/server/ActivityPubServerService.ts +++ b/packages/backend/src/server/ActivityPubServerService.ts @@ -176,7 +176,7 @@ export class ActivityPubServerService { } const meta = await this.metaService.fetch(); - if (this.utilityService.isBlockedHost(meta.blockedHosts, keyHost)) { + if (this.utilityService.isFederationAllowedHost(keyHost)) { /* blocked instance: refuse (we don't care if the signature is good, if they even pretend to be from a blocked instance, they're out) */ @@ -795,7 +795,7 @@ export class ActivityPubServerService { fastify.get<{ Params: { user: string; } }>('/users/:user', { constraints: { apOrHtml: 'ap' } }, async (request, reply) => { if (await this.shouldRefuseGetRequest(request, reply, request.params.user)) return; - + vary(reply.raw, 'Accept'); const userId = request.params.user; @@ -811,7 +811,7 @@ export class ActivityPubServerService { fastify.get<{ Params: { user: string; } }>('/@:user', { constraints: { apOrHtml: 'ap' } }, async (request, reply) => { if (await this.shouldRefuseGetRequest(request, reply, request.params.user)) return; - + vary(reply.raw, 'Accept'); const user = await this.usersRepository.findOneBy({ diff --git a/packages/backend/src/server/api/endpoints/notes/search-by-tag.ts b/packages/backend/src/server/api/endpoints/notes/search-by-tag.ts index 55ff6771b1..e90fb07a87 100644 --- a/packages/backend/src/server/api/endpoints/notes/search-by-tag.ts +++ b/packages/backend/src/server/api/endpoints/notes/search-by-tag.ts @@ -156,7 +156,7 @@ export default class extends Endpoint { // eslint- notes = notes.filter(note => { if (note.user?.isSilenced && me && followings && note.userId !== me.id && !followings[note.userId]) return false; if (note.user?.isSuspended) return false; - if (this.utilityService.isBlockedHost(meta.blockedHosts, note.userHost)) return false; + if (this.utilityService.isFederationAllowedHost(note.userHost)) return false; if (this.utilityService.isSilencedHost(meta.silencedHosts, note.userHost)) return false; return true; });