diff --git a/Iceshrimp.Backend/Core/Federation/ActivityPub/ActivityFetcherService.cs b/Iceshrimp.Backend/Core/Federation/ActivityPub/ActivityFetcherService.cs index ba31f854..c52ca175 100644 --- a/Iceshrimp.Backend/Core/Federation/ActivityPub/ActivityFetcherService.cs +++ b/Iceshrimp.Backend/Core/Federation/ActivityPub/ActivityFetcherService.cs @@ -21,7 +21,8 @@ public class ActivityFetcherService( HttpRequestService httpRqSvc, SystemUserService systemUserSvc, DatabaseContext db, - ILogger logger + ILogger logger, + FederationControlService fedCtrlSvc ) { private static readonly IReadOnlyCollection AcceptableActivityTypes = @@ -77,6 +78,12 @@ public class ActivityFetcherService( var requestHost = new Uri(url).Host; if (requestHost == config.Value.WebDomain || requestHost == config.Value.AccountDomain) throw GracefulException.UnprocessableEntity("Refusing to fetch activity from local domain"); + + if (await fedCtrlSvc.ShouldBlockAsync(requestHost)) + { + logger.LogDebug("Refusing to fetch activity from blocked instance"); + return (null, new Uri(url)); + } var request = httpRqSvc.GetSigned(url, AcceptableActivityTypes, actor, keypair); var response = await client.SendAsync(request);