add a button to clear out finished share links

The dashboard listed every share ever made, including ones revoked or expired
months ago, and nothing ever pruned them. There is now a "Clean up finished links"
button next to Refresh that runs a normal cleanup pass and then drops the records
that are done with, reporting how many went.

Only revoked, expired and failed records are removed. A link that can still be
used is left alone, including a spent one-use link whose guest is still watching
until it expires, since that record is Redeemed rather than finished.

Folded into 1.0.3.0 rather than shipped as 1.0.3.1: the ceiling fix and this are
going out as one replacement of that version.
Cette révision appartient à :
Franciskid
2026-07-26 23:04:51 +02:00
Parent 34ed2c8ad9
révision 4ad6d5b1ed
5 fichiers modifiés avec 81 ajouts et 5 suppressions
+15
Voir le fichier
@@ -269,6 +269,21 @@ public sealed class ShareLinksController : ControllerBase
return Ok(ToDto(record));
}
/// <summary>Removes revoked, expired and failed share links from the store.</summary>
[HttpPost("Admin/Cleanup")]
[Authorize(AuthenticationSchemes = "CustomAuthentication")]
public async Task<ActionResult> Cleanup(CancellationToken cancellationToken)
{
SetNoStoreHeaders();
if (!User.IsInRole("Administrator"))
{
return Forbid();
}
var removed = await _cleanupService.PurgeFinishedAsync(cancellationToken).ConfigureAwait(false);
return Ok(new { removed });
}
/// <summary>Returns the guest session state for the current authenticated user.</summary>
[HttpGet("GuestState")]
[Authorize(AuthenticationSchemes = "CustomAuthentication")]