From 66ee14b2a112a1787faa2407d801a9a8ac942987 Mon Sep 17 00:00:00 2001 From: Kopper Date: Tue, 7 Jan 2025 02:05:14 +0300 Subject: [PATCH] [backend/federation] Hide outbox if public preview is locked down --- .../Controllers/Federation/ActivityPubController.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Iceshrimp.Backend/Controllers/Federation/ActivityPubController.cs b/Iceshrimp.Backend/Controllers/Federation/ActivityPubController.cs index cd51c576..4e57e03b 100644 --- a/Iceshrimp.Backend/Controllers/Federation/ActivityPubController.cs +++ b/Iceshrimp.Backend/Controllers/Federation/ActivityPubController.cs @@ -29,7 +29,8 @@ public class ActivityPubController( QueueService queues, ActivityPub.NoteRenderer noteRenderer, ActivityPub.UserRenderer userRenderer, - IOptions config + IOptions config, + IOptionsSnapshot security ) : ControllerBase, IScopedService { [HttpGet("/notes/{id}")] @@ -226,6 +227,9 @@ public class ActivityPubController( if (user == null) throw GracefulException.NotFound("User not found"); var actor = HttpContext.GetActor(); + if (actor == null && security.Value.PublicPreview == Enums.PublicPreview.Lockdown) + throw new PublicPreviewDisabledException(); + var notes = await db.Notes.Where(p => p.UserId == id) .Include(p => p.User) .Include(p => p.Renote)