[backend/federation] Hide outbox if public preview is locked down
This commit is contained in:
parent
ff320e43c9
commit
66ee14b2a1
1 changed files with 5 additions and 1 deletions
|
@ -29,7 +29,8 @@ public class ActivityPubController(
|
||||||
QueueService queues,
|
QueueService queues,
|
||||||
ActivityPub.NoteRenderer noteRenderer,
|
ActivityPub.NoteRenderer noteRenderer,
|
||||||
ActivityPub.UserRenderer userRenderer,
|
ActivityPub.UserRenderer userRenderer,
|
||||||
IOptions<Config.InstanceSection> config
|
IOptions<Config.InstanceSection> config,
|
||||||
|
IOptionsSnapshot<Config.SecuritySection> security
|
||||||
) : ControllerBase, IScopedService
|
) : ControllerBase, IScopedService
|
||||||
{
|
{
|
||||||
[HttpGet("/notes/{id}")]
|
[HttpGet("/notes/{id}")]
|
||||||
|
@ -226,6 +227,9 @@ public class ActivityPubController(
|
||||||
if (user == null) throw GracefulException.NotFound("User not found");
|
if (user == null) throw GracefulException.NotFound("User not found");
|
||||||
|
|
||||||
var actor = HttpContext.GetActor();
|
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)
|
var notes = await db.Notes.Where(p => p.UserId == id)
|
||||||
.Include(p => p.User)
|
.Include(p => p.User)
|
||||||
.Include(p => p.Renote)
|
.Include(p => p.Renote)
|
||||||
|
|
Loading…
Add table
Reference in a new issue