Add OBS podcast ingestion and account withdrawal privacy controls
Support scoped RTMPS publishing through MediaMTX, authenticated replay, resource accounting and PostIt activation/revocation. Close withdrawn accounts, erase managed files and purge eligible payment residues after one year. Include migrations, documentation and regression tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
97b350be2d
commit
b157dce4e4
54 changed files with 12996 additions and 50 deletions
57
src/Yavsc.Api/Controllers/Musical/PodcastObsController.cs
Normal file
57
src/Yavsc.Api/Controllers/Musical/PodcastObsController.cs
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Yavsc.Abstract.Streaming;
|
||||
using Yavsc.Api.Middleware;
|
||||
using Yavsc.Api.Services;
|
||||
using Yavsc.Server.Helpers;
|
||||
|
||||
namespace Yavsc.ApiControllers;
|
||||
|
||||
[ApiController, ApiExplorerSettings(GroupName = "podcasts")]
|
||||
[Authorize(Policy = "ApiScope")]
|
||||
[Route(Constants.APIPrefix + "/podcasts")]
|
||||
[TypeFilter(typeof(PodcastExceptionFilter))]
|
||||
[ResponseCache(NoStore = true, Location = ResponseCacheLocation.None)]
|
||||
public sealed class PodcastObsController(IPodcastObsService obs) : ControllerBase
|
||||
{
|
||||
[HttpPost("{id:guid}/obs"), EndpointSummary("Activer OBS pour une emission programmee et obtenir une cle a usage limite")]
|
||||
[ProducesResponseType<PodcastObsCredentials>(200)]
|
||||
[ProducesResponseType<ProblemDetails>(403)]
|
||||
[ProducesResponseType<ProblemDetails>(404)]
|
||||
[ProducesResponseType<ProblemDetails>(409)]
|
||||
[ProducesResponseType<ProblemDetails>(429)]
|
||||
[ProducesResponseType<ProblemDetails>(413)]
|
||||
[ProducesResponseType<ProblemDetails>(503)]
|
||||
public async Task<ActionResult<PodcastObsCredentials>> Activate(Guid id, CancellationToken ct)
|
||||
=> Ok(await obs.ActivateAsync(id, User.GetUserId(), ct));
|
||||
|
||||
[HttpGet("{id:guid}/obs"), EndpointSummary("Consulter l'activation OBS et les erreurs de reception, sans exposer la cle")]
|
||||
[ProducesResponseType<PodcastObsStatus>(200)]
|
||||
[ProducesResponseType<ProblemDetails>(403)]
|
||||
[ProducesResponseType<ProblemDetails>(404)]
|
||||
public async Task<ActionResult<PodcastObsStatus>> Status(Guid id, CancellationToken ct)
|
||||
=> Ok(await obs.StatusAsync(id, User.GetUserId(), ct));
|
||||
|
||||
[HttpDelete("{id:guid}/obs"), EndpointSummary("Revoquer la cle OBS et deconnecter le diffuseur")]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType<ProblemDetails>(403)]
|
||||
[ProducesResponseType<ProblemDetails>(404)]
|
||||
[ProducesResponseType<ProblemDetails>(503)]
|
||||
[ResourceUsageRelief]
|
||||
public async Task<IActionResult> Deactivate(Guid id, CancellationToken ct)
|
||||
{
|
||||
await obs.DeactivateAsync(id, User.GetUserId(), ct);
|
||||
return NoContent();
|
||||
}
|
||||
|
||||
[AllowAnonymous, HttpPost("relay/auth")]
|
||||
[RequestSizeLimit(4096), ResourceUsageExempt]
|
||||
[EndpointSummary("Authentification externe MediaMTX : publication avec cle, lecture interne et administration privees")]
|
||||
[ProducesResponseType<PodcastRelayAuthorization>(200)]
|
||||
[ProducesResponseType(401)]
|
||||
public async Task<IActionResult> Authenticate(PodcastRelayAuthentication request, CancellationToken ct)
|
||||
{
|
||||
var authorization = await obs.AuthenticateAsync(request, ct);
|
||||
return authorization is null ? Unauthorized() : Ok(authorization);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue