[backend/api] Add admin endpoint to manually trigger media cleanup

This commit is contained in:
Laura Hausmann 2024-09-30 23:29:53 +02:00
parent 138ac01d13
commit 1b4ba8b6a0
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -12,6 +12,7 @@ using Iceshrimp.Backend.Core.Federation.ActivityStreams.Types;
using Iceshrimp.Backend.Core.Helpers;
using Iceshrimp.Backend.Core.Middleware;
using Iceshrimp.Backend.Core.Services;
using Iceshrimp.Backend.Core.Tasks;
using Iceshrimp.Shared.Schemas.Web;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
@ -177,6 +178,14 @@ public class AdminController(
await relaySvc.UnsubscribeFromRelay(relay);
}
[HttpPost("drive/prune-expired-media")]
[ProducesResults(HttpStatusCode.OK)]
public async Task PruneExpiredMedia([FromServices] IServiceScopeFactory factory)
{
await using var scope = factory.CreateAsyncScope();
await new MediaCleanupTask().Invoke(scope.ServiceProvider);
}
[UseNewtonsoftJson]
[HttpGet("activities/notes/{id}")]
[OverrideResultType<ASNote>]