feat(api): #301 POST-ify side-effecting troubleshoot GETs + GET /api/auth/machine-key

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-12 21:50:24 +02:00
co-authored by Claude Opus 4.8
parent 9dc48118d1
commit 88d82266b6
10 changed files with 423 additions and 419 deletions
@@ -0,0 +1,6 @@
#nullable enable
namespace ErsatzTV.Core.Api.Troubleshooting;
// Returned once a troubleshooting playback session has started producing segments; Url is the
// rooted /iptv path the SPA feeds straight to hls.js (HlsPlayer never inspects the status code).
public record TroubleshootingPlaybackStartedResponseModel(string Url);
@@ -1,7 +1,9 @@
using System.Collections.Generic;
using System.Security.Claims;
using ErsatzTV.Application.Auth;
using ErsatzTV.Controllers.Api;
using ErsatzTV.Controllers.Api.Requests;
using ErsatzTV.Services;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
@@ -23,13 +25,20 @@ public class AuthControllerTests
: new Dictionary<string, string?>())
.Build();
private static IApiKeyProvider ApiKeyProvider(string key = "the-machine-key")
{
var provider = Substitute.For<IApiKeyProvider>();
provider.ApiKey.Returns(key);
return provider;
}
[Test]
public async Task Config_Reports_Setup_Not_Required_When_Env_Seed_Configured()
{
var mediator = Substitute.For<IMediator>();
mediator.Send(Arg.Any<IsLocalAdminConfigured>(), Arg.Any<CancellationToken>()).Returns(false);
var controller = new AuthController(mediator, Config(envSeed: true));
var controller = new AuthController(mediator, Config(envSeed: true), ApiKeyProvider());
var result = await controller.Config(CancellationToken.None) as OkObjectResult;
var body = result!.Value.ShouldBeOfType<AuthConfigResponse>();
@@ -44,7 +53,7 @@ public class AuthControllerTests
var mediator = Substitute.For<IMediator>();
mediator.Send(Arg.Any<IsLocalAdminConfigured>(), Arg.Any<CancellationToken>()).Returns(false);
var controller = new AuthController(mediator, Config(envSeed: false));
var controller = new AuthController(mediator, Config(envSeed: false), ApiKeyProvider());
var result = await controller.Config(CancellationToken.None) as OkObjectResult;
var body = result!.Value.ShouldBeOfType<AuthConfigResponse>();
@@ -56,7 +65,7 @@ public class AuthControllerTests
public async Task Setup_Is_Closed_With_409_When_Env_Seed_Configured()
{
var mediator = Substitute.For<IMediator>();
var controller = new AuthController(mediator, Config(envSeed: true))
var controller = new AuthController(mediator, Config(envSeed: true), ApiKeyProvider())
{
ControllerContext = new ControllerContext { HttpContext = new DefaultHttpContext() }
};
@@ -68,4 +77,41 @@ public class AuthControllerTests
// The claim must never be attempted while the env seed owns the credential.
await mediator.DidNotReceive().Send(Arg.Any<ClaimLocalAdmin>(), Arg.Any<CancellationToken>());
}
[Test]
public void MachineKey_Returns_401_When_Anonymous()
{
var mediator = Substitute.For<IMediator>();
var controller = new AuthController(mediator, Config(envSeed: false), ApiKeyProvider())
{
ControllerContext = new ControllerContext { HttpContext = new DefaultHttpContext() }
};
IActionResult result = controller.MachineKey();
var unauthorized = result.ShouldBeOfType<UnauthorizedObjectResult>();
unauthorized.Value.ShouldBeOfType<ProblemDetails>().Status.ShouldBe(401);
}
[Test]
public void MachineKey_Returns_The_Key_For_An_Authenticated_Session()
{
var mediator = Substitute.For<IMediator>();
var controller = new AuthController(mediator, Config(envSeed: false), ApiKeyProvider("the-machine-key"))
{
ControllerContext = new ControllerContext
{
HttpContext = new DefaultHttpContext
{
User = new ClaimsPrincipal(
new ClaimsIdentity([new Claim(ClaimTypes.Name, "admin")], AuthConstants.CookieScheme))
}
}
};
IActionResult result = controller.MachineKey();
var ok = result.ShouldBeOfType<OkObjectResult>();
ok.Value.ShouldBeOfType<MachineKeyResponse>().ApiKey.ShouldBe("the-machine-key");
}
}
@@ -72,34 +72,37 @@ public class OpenApiContractHonestyTests
}
[Test]
public void Colliding_Troubleshoot_HeadGet_Pairs_Should_Carry_VerbDerived_OperationIds()
public void Troubleshoot_Playback_Actions_Should_Carry_Stable_Explicit_OperationIds()
{
// The 3 Troubleshoot HEAD/GET pairs share a controller+action and differ only by verb. Their
// synthesized operationIds must be verb-suffixed (structural, order-independent) — NOT one bare
// base + one arbitrary suffix that depends on ApiExplorer visitation order. See #197 Bundle C.
// #301 POST-ified these three side-effecting actions (each now a single POST with an explicit
// Name=), which removed the former HEAD/GET collision entirely — so the synthesized verb-suffix
// disambiguation (#197 Bundle C) no longer applies to them. Pin the explicit ids instead, and
// assert the old synthesized/colliding forms are gone.
var ids = EnumerateOperations().Select(op => op.Operation.OperationId!).ToHashSet(StringComparer.Ordinal);
foreach (string expected in new[]
{
"TroubleshootTroubleshootPlaybackGet",
"TroubleshootTroubleshootPlaybackHead",
"TroubleshootTroubleshootPlaybackArchiveGet",
"TroubleshootTroubleshootPlaybackArchiveHead",
"TroubleshootTroubleshootPlaybackSampleGet",
"TroubleshootTroubleshootPlaybackSampleHead"
"StartTroubleshootingPlayback",
"DownloadTroubleshootingArchive",
"DownloadTroubleshootingMediaSample"
})
{
ids.ShouldContain(expected);
}
// The old order-dependent forms (bare base + "...GET" suffix) must be gone.
foreach (string stale in new[]
{
"TroubleshootTroubleshootPlayback",
"TroubleshootTroubleshootPlaybackArchive",
"TroubleshootTroubleshootPlaybackSample",
"TroubleshootTroubleshootPlaybackGet",
"TroubleshootTroubleshootPlaybackHead",
"TroubleshootTroubleshootPlaybackGET",
"TroubleshootTroubleshootPlaybackArchive",
"TroubleshootTroubleshootPlaybackArchiveGet",
"TroubleshootTroubleshootPlaybackArchiveHead",
"TroubleshootTroubleshootPlaybackArchiveGET",
"TroubleshootTroubleshootPlaybackSample",
"TroubleshootTroubleshootPlaybackSampleGet",
"TroubleshootTroubleshootPlaybackSampleHead",
"TroubleshootTroubleshootPlaybackSampleGET"
})
{
@@ -20,6 +20,7 @@ using ErsatzTV.Core.Notifications;
using ErsatzTV.Core.Troubleshooting;
using LanguageExt;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using NSubstitute;
using NUnit.Framework;
@@ -249,22 +250,64 @@ public class TroubleshootControllerTests
attribute.Name.ShouldBe("GetTroubleshootingPlaybackStatus");
}
private static StartTroubleshootingPlaybackRequest DefaultPlaybackRequest(int mediaItem = 1, int channel = 0) =>
new(
mediaItem,
channel,
FfmpegProfile: 1,
StreamingMode.HttpLiveStreamingSegmenter,
Watermark: [],
GraphicsElement: [],
StreamSelector: string.Empty,
SubtitleId: null,
SeekSeconds: 0,
Start: null);
[Test]
public void Controller_Should_Expose_Idiomatic_Rest_Route_For_TroubleshootPlayback()
{
MethodInfo action = typeof(TroubleshootController).GetMethod(nameof(TroubleshootController.TroubleshootPlayback))
?? throw new AssertionException("Missing action TroubleshootPlayback");
var attribute = action.GetCustomAttributes<HttpPostAttribute>().Single();
attribute.Template.ShouldBe("api/troubleshoot/playback/start");
attribute.Name.ShouldBe("StartTroubleshootingPlayback");
action.GetParameters()[0].ParameterType.ShouldBe(typeof(StartTroubleshootingPlaybackRequest));
}
[Test]
public void Controller_Should_Expose_Idiomatic_Rest_Route_For_PlaybackArchive()
{
MethodInfo action = typeof(TroubleshootController).GetMethod(nameof(TroubleshootController.TroubleshootPlaybackArchive))
?? throw new AssertionException("Missing action TroubleshootPlaybackArchive");
var attribute = action.GetCustomAttributes<HttpPostAttribute>().Single();
attribute.Template.ShouldBe("api/troubleshoot/playback/archive");
attribute.Name.ShouldBe("DownloadTroubleshootingArchive");
action.GetCustomAttributes<HttpGetAttribute>().ShouldBeEmpty();
action.GetCustomAttributes<HttpHeadAttribute>().ShouldBeEmpty();
}
[Test]
public void Controller_Should_Expose_Idiomatic_Rest_Route_For_PlaybackSample()
{
MethodInfo action = typeof(TroubleshootController).GetMethod(nameof(TroubleshootController.TroubleshootPlaybackSample))
?? throw new AssertionException("Missing action TroubleshootPlaybackSample");
var attribute = action.GetCustomAttributes<HttpPostAttribute>().Single();
attribute.Template.ShouldBe("api/troubleshoot/playback/sample/{mediaItemId:int}");
attribute.Name.ShouldBe("DownloadTroubleshootingMediaSample");
action.GetCustomAttributes<HttpGetAttribute>().ShouldBeEmpty();
action.GetCustomAttributes<HttpHeadAttribute>().ShouldBeEmpty();
}
[Test]
public async Task TroubleshootPlayback_Should_Return_409_When_Already_Locked()
{
_entityLocker.IsTroubleshootingPlaybackLocked().Returns(true);
IActionResult result = await _controller.TroubleshootPlayback(
mediaItem: 1,
channel: 0,
ffmpegProfile: 1,
StreamingMode.HttpLiveStreamingSegmenter,
watermark: [],
graphicsElement: [],
streamSelector: string.Empty,
subtitleId: null,
seekSeconds: 0,
start: null,
DefaultPlaybackRequest(),
CancellationToken.None);
ConflictObjectResult conflict = result.ShouldBeOfType<ConflictObjectResult>();
@@ -284,16 +327,7 @@ public class TroubleshootControllerTests
new ErsatzTV.Core.Errors.NotFoundError("no such media item")));
IActionResult result = await _controller.TroubleshootPlayback(
mediaItem: 999,
channel: 0,
ffmpegProfile: 1,
StreamingMode.HttpLiveStreamingSegmenter,
watermark: [],
graphicsElement: [],
streamSelector: string.Empty,
subtitleId: null,
seekSeconds: 0,
start: null,
DefaultPlaybackRequest(mediaItem: 999),
CancellationToken.None);
var notFound = result.ShouldBeOfType<NotFoundObjectResult>();
@@ -308,22 +342,94 @@ public class TroubleshootControllerTests
.Returns(Either<BaseError, PlayoutItemResult>.Left(BaseError.New("unable to prepare")));
IActionResult result = await _controller.TroubleshootPlayback(
mediaItem: 1,
channel: 0,
ffmpegProfile: 1,
StreamingMode.HttpLiveStreamingSegmenter,
watermark: [],
graphicsElement: [],
streamSelector: string.Empty,
subtitleId: null,
seekSeconds: 0,
start: null,
DefaultPlaybackRequest(),
CancellationToken.None);
var unprocessable = result.ShouldBeOfType<UnprocessableEntityObjectResult>();
unprocessable.Value.ShouldBeOfType<ProblemDetails>().Status.ShouldBe(422);
}
[Test]
public async Task TroubleshootPlayback_Should_Return_200_With_Rooted_Iptv_Url_On_Success()
{
// The segment-readiness poll shells out to the real filesystem (Directory.GetFiles), not the
// injected IFileSystem abstraction, so this test seeds real files under the troubleshooting
// transcode folder rather than mocking it.
Directory.CreateDirectory(FileSystemLayout.TranscodeTroubleshootingFolder);
string segmentPath = Path.Combine(FileSystemLayout.TranscodeTroubleshootingFolder, "seg-test-0.ts");
string segmentPath2 = Path.Combine(FileSystemLayout.TranscodeTroubleshootingFolder, "seg-test-1.ts");
await File.WriteAllTextAsync(segmentPath, string.Empty);
await File.WriteAllTextAsync(segmentPath2, string.Empty);
try
{
_entityLocker.IsTroubleshootingPlaybackLocked().Returns(false);
var playoutItemResult = new PlayoutItemResult(
new CliWrap.Command("ffmpeg"),
Option<ErsatzTV.Core.Interfaces.Streaming.GraphicsEngineContext>.None,
Option<int>.Some(1));
_mediator.Send(Arg.Any<PrepareTroubleshootingPlayback>(), Arg.Any<CancellationToken>())
.Returns(Either<BaseError, PlayoutItemResult>.Right(playoutItemResult));
_mediator.Send(Arg.Any<GetMediaItemInfo>(), Arg.Any<CancellationToken>())
.Returns(Either<BaseError, MediaItemInfo>.Right(FakeMediaItemInfo()));
_mediator.Send(Arg.Any<GetTroubleshootingInfo>(), Arg.Any<CancellationToken>())
.Returns(new TroubleshootingInfo(
"1.2.3",
new Dictionary<string, string>(),
[],
[],
[],
new ErsatzTV.Application.FFmpegProfiles.FFmpegSettingsViewModel(),
[],
[],
[],
false,
false,
null,
null,
null,
null));
var fileSystem = Substitute.For<IFileSystem>();
fileSystem.File.Exists(Arg.Any<string>()).Returns(true);
var configElementRepository = Substitute.For<IConfigElementRepository>();
configElementRepository
.GetValue<int>(ConfigElementKey.FFmpegInitialSegmentCount, Arg.Any<CancellationToken>())
.Returns(Option<int>.Some(2));
var controller = new TroubleshootController(
System.Threading.Channels.Channel.CreateUnbounded<IFFmpegWorkerRequest>().Writer,
fileSystem,
configElementRepository,
Substitute.For<ITroubleshootingNotifier>(),
_entityLocker,
_statusStore,
_mediator)
{
ControllerContext = new ControllerContext
{
HttpContext = new DefaultHttpContext { Request = { PathBase = "/etv" } }
}
};
IActionResult result = await controller.TroubleshootPlayback(
DefaultPlaybackRequest(),
CancellationToken.None);
var ok = result.ShouldBeOfType<OkObjectResult>();
var body = ok.Value.ShouldBeOfType<TroubleshootingPlaybackStartedResponseModel>();
body.Url.ShouldBe("/etv/iptv/session/.troubleshooting/live.m3u8");
}
finally
{
File.Delete(segmentPath);
File.Delete(segmentPath2);
}
}
[Test]
public async Task GetPlaybackStatus_Should_Report_Idle_When_No_Result_And_Unlocked()
{
+27 -1
View File
@@ -4,6 +4,7 @@ using ErsatzTV.Controllers.Api.Requests;
using ErsatzTV.Core;
using ErsatzTV.Extensions;
using ErsatzTV.Filters;
using ErsatzTV.Services;
using MediatR;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Http;
@@ -21,7 +22,8 @@ namespace ErsatzTV.Controllers.Api;
[ApiController]
[ApiExplorerSettings(IgnoreApi = true)]
[SkipApiAuthorization]
public class AuthController(IMediator mediator, IConfiguration configuration) : ControllerBase
public class AuthController(IMediator mediator, IConfiguration configuration, IApiKeyProvider apiKeyProvider)
: ControllerBase
{
// When the operator has set an env seed, the local admin is managed via configuration — the browser
// setup-claim is closed. This also eliminates the startup race where an attacker could claim admin in the
@@ -48,6 +50,28 @@ public class AuthController(IMediator mediator, IConfiguration configuration) :
return Ok(new AuthSessionResponse(true, User.Identity?.Name, User.FindFirst(AuthConstants.AuthMethodClaim)?.Value));
}
/// <summary>
/// The effective machine <c>X-Api-Key</c> (issue #301), for the ChicoryTV "API Key" settings screen to
/// display once it moves off session-managed auth. Requires any authenticated session (OIDC or local);
/// 401 otherwise. Never CSRF-gated — it's a GET, and SOP already blocks a cross-site page from reading a
/// credentialed response body.
/// </summary>
[HttpGet("/api/auth/machine-key")]
public IActionResult MachineKey()
{
if (User.Identity?.IsAuthenticated != true)
{
return Unauthorized(new ProblemDetails
{
Status = StatusCodes.Status401Unauthorized,
Title = "Unauthorized",
Detail = "An authenticated session is required."
});
}
return Ok(new MachineKeyResponse(apiKeyProvider.ApiKey));
}
/// <summary>First-run setup-claim: create the local admin. Fails 409 if one already exists.</summary>
[HttpPost("/api/auth/setup")]
[EnableRateLimiting("auth")]
@@ -232,3 +256,5 @@ public class AuthController(IMediator mediator, IConfiguration configuration) :
public record AuthConfigResponse(bool OidcEnabled, bool LocalLoginEnabled, bool SetupRequired);
public record AuthSessionResponse(bool Authenticated, string Username, string Method);
public record MachineKeyResponse(string ApiKey);
@@ -0,0 +1,15 @@
using ErsatzTV.Core.Domain;
namespace ErsatzTV.Controllers.Api.Requests;
public record StartTroubleshootingPlaybackRequest(
int MediaItem,
int Channel,
int FfmpegProfile,
StreamingMode StreamingMode,
List<int> Watermark,
List<int> GraphicsElement,
string StreamSelector,
int? SubtitleId,
int SeekSeconds,
DateTimeOffset? Start);
@@ -112,37 +112,30 @@ public class TroubleshootController(
new ValidateSequentialScheduleResponseModel(result.IsValid, result.Messages, result.Json));
}
[HttpHead("api/troubleshoot/playback.m3u8")]
[HttpGet("api/troubleshoot/playback.m3u8")]
[HttpPost("api/troubleshoot/playback/start", Name = "StartTroubleshootingPlayback")]
[Tags("Troubleshooting")]
[EndpointSummary("Start a troubleshooting playback session")]
[EndpointGroupName("general")]
[ProducesResponseType(typeof(TroubleshootingPlaybackStartedResponseModel), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status404NotFound)]
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status409Conflict)]
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status422UnprocessableEntity)]
public async Task<IActionResult> TroubleshootPlayback(
[FromQuery]
int mediaItem,
[FromQuery]
int channel,
[FromQuery]
int ffmpegProfile,
[FromQuery]
StreamingMode streamingMode,
[FromQuery]
List<int> watermark,
[FromQuery]
List<int> graphicsElement,
[FromQuery]
string streamSelector,
[FromQuery]
int? subtitleId,
[FromQuery]
int seekSeconds,
[FromQuery]
DateTimeOffset? start,
[FromBody]
StartTroubleshootingPlaybackRequest request,
CancellationToken cancellationToken)
{
int mediaItem = request.MediaItem;
int channel = request.Channel;
int ffmpegProfile = request.FfmpegProfile;
StreamingMode streamingMode = request.StreamingMode;
List<int> watermark = request.Watermark;
List<int> graphicsElement = request.GraphicsElement;
string streamSelector = request.StreamSelector;
int? subtitleId = request.SubtitleId;
int seekSeconds = request.SeekSeconds;
DateTimeOffset? start = request.Start;
var sessionId = Guid.NewGuid();
using var logContext = LogContext.PushProperty(InMemoryLogService.CorrelationIdKey, sessionId);
@@ -261,7 +254,9 @@ public class TroubleshootController(
if (!notifier.IsFailed(sessionId))
{
return Redirect("~/iptv/session/.troubleshooting/live.m3u8");
return Ok(
new TroubleshootingPlaybackStartedResponseModel(
$"{Request.PathBase}/iptv/session/.troubleshooting/live.m3u8"));
}
}
finally
@@ -292,8 +287,7 @@ public class TroubleshootController(
"Troubleshooting playback did not produce any output. It may have failed to start or been cancelled.");
}
[HttpHead("api/troubleshoot/playback/archive")]
[HttpGet("api/troubleshoot/playback/archive")]
[HttpPost("api/troubleshoot/playback/archive", Name = "DownloadTroubleshootingArchive")]
[Tags("Troubleshooting")]
[EndpointSummary("Download the last troubleshooting playback session archive")]
[EndpointGroupName("general")]
@@ -318,8 +312,7 @@ public class TroubleshootController(
return NotFound();
}
[HttpHead("api/troubleshoot/playback/sample/{mediaItemId:int}")]
[HttpGet("api/troubleshoot/playback/sample/{mediaItemId:int}")]
[HttpPost("api/troubleshoot/playback/sample/{mediaItemId:int}", Name = "DownloadTroubleshootingMediaSample")]
[Tags("Troubleshooting")]
[EndpointSummary("Download a media sample archive for troubleshooting")]
[EndpointGroupName("general")]
+135 -338
View File
@@ -21113,278 +21113,59 @@
]
}
},
"/api/troubleshoot/playback.m3u8": {
"head": {
"/api/troubleshoot/playback/start": {
"post": {
"tags": [
"Troubleshooting"
],
"summary": "Start a troubleshooting playback session",
"operationId": "TroubleshootTroubleshootPlaybackHead",
"parameters": [
{
"name": "mediaItem",
"in": "query",
"schema": {
"type": "integer",
"format": "int32"
}
},
{
"name": "channel",
"in": "query",
"schema": {
"type": "integer",
"format": "int32"
}
},
{
"name": "ffmpegProfile",
"in": "query",
"schema": {
"type": "integer",
"format": "int32"
}
},
{
"name": "streamingMode",
"in": "query",
"schema": {
"$ref": "#/components/schemas/StreamingMode"
}
},
{
"name": "watermark",
"in": "query",
"schema": {
"type": "array",
"items": {
"type": "integer",
"format": "int32"
"operationId": "StartTroubleshootingPlayback",
"requestBody": {
"content": {
"application/json-patch+json": {
"schema": {
"$ref": "#/components/schemas/StartTroubleshootingPlaybackRequest"
}
},
"application/json": {
"schema": {
"$ref": "#/components/schemas/StartTroubleshootingPlaybackRequest"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/StartTroubleshootingPlaybackRequest"
}
},
"application/*+json": {
"schema": {
"$ref": "#/components/schemas/StartTroubleshootingPlaybackRequest"
}
}
},
{
"name": "graphicsElement",
"in": "query",
"schema": {
"type": "array",
"items": {
"type": "integer",
"format": "int32"
}
}
},
{
"name": "streamSelector",
"in": "query",
"schema": {
"type": "string"
}
},
{
"name": "subtitleId",
"in": "query",
"schema": {
"type": "integer",
"format": "int32"
}
},
{
"name": "seekSeconds",
"in": "query",
"schema": {
"type": "integer",
"format": "int32"
}
},
{
"name": "start",
"in": "query",
"schema": {
"type": "string",
"format": "date-time"
}
}
],
"responses": {
"404": {
"description": "Not Found",
"content": {
"text/plain": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
},
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
}
},
"409": {
"description": "Conflict",
"content": {
"text/plain": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
},
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
}
},
"422": {
"description": "Unprocessable Entity",
"content": {
"text/plain": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
},
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
}
},
"401": {
"description": "API key missing or invalid.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
}
},
"400": {
"description": "Request validation failed (model binding or FluentValidation).",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ValidationProblemDetails"
}
}
}
}
"required": true
},
"security": [
{ }
]
},
"get": {
"tags": [
"Troubleshooting"
],
"summary": "Start a troubleshooting playback session",
"operationId": "TroubleshootTroubleshootPlaybackGet",
"parameters": [
{
"name": "mediaItem",
"in": "query",
"schema": {
"type": "integer",
"format": "int32"
}
},
{
"name": "channel",
"in": "query",
"schema": {
"type": "integer",
"format": "int32"
}
},
{
"name": "ffmpegProfile",
"in": "query",
"schema": {
"type": "integer",
"format": "int32"
}
},
{
"name": "streamingMode",
"in": "query",
"schema": {
"$ref": "#/components/schemas/StreamingMode"
}
},
{
"name": "watermark",
"in": "query",
"schema": {
"type": "array",
"items": {
"type": "integer",
"format": "int32"
}
}
},
{
"name": "graphicsElement",
"in": "query",
"schema": {
"type": "array",
"items": {
"type": "integer",
"format": "int32"
}
}
},
{
"name": "streamSelector",
"in": "query",
"schema": {
"type": "string"
}
},
{
"name": "subtitleId",
"in": "query",
"schema": {
"type": "integer",
"format": "int32"
}
},
{
"name": "seekSeconds",
"in": "query",
"schema": {
"type": "integer",
"format": "int32"
}
},
{
"name": "start",
"in": "query",
"schema": {
"type": "string",
"format": "date-time"
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"text/plain": {
"schema": {
"$ref": "#/components/schemas/TroubleshootingPlaybackStartedResponseModel"
}
},
"application/json": {
"schema": {
"$ref": "#/components/schemas/TroubleshootingPlaybackStartedResponseModel"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/TroubleshootingPlaybackStartedResponseModel"
}
}
}
},
"404": {
"description": "Not Found",
"content": {
@@ -21472,37 +21253,12 @@
}
},
"/api/troubleshoot/playback/archive": {
"head": {
"post": {
"tags": [
"Troubleshooting"
],
"summary": "Download the last troubleshooting playback session archive",
"operationId": "TroubleshootTroubleshootPlaybackArchiveHead",
"responses": {
"200": {
"description": "OK"
},
"401": {
"description": "API key missing or invalid.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
}
}
},
"security": [
{ }
]
},
"get": {
"tags": [
"Troubleshooting"
],
"summary": "Download the last troubleshooting playback session archive",
"operationId": "TroubleshootTroubleshootPlaybackArchiveGet",
"operationId": "DownloadTroubleshootingArchive",
"responses": {
"200": {
"description": "OK"
@@ -21524,58 +21280,12 @@
}
},
"/api/troubleshoot/playback/sample/{mediaItemId}": {
"head": {
"post": {
"tags": [
"Troubleshooting"
],
"summary": "Download a media sample archive for troubleshooting",
"operationId": "TroubleshootTroubleshootPlaybackSampleHead",
"parameters": [
{
"name": "mediaItemId",
"in": "path",
"required": true,
"schema": {
"type": "integer",
"format": "int32"
}
}
],
"responses": {
"200": {
"description": "OK"
},
"401": {
"description": "API key missing or invalid.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
}
},
"400": {
"description": "Request validation failed (model binding or FluentValidation).",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ValidationProblemDetails"
}
}
}
}
},
"security": [
{ }
]
},
"get": {
"tags": [
"Troubleshooting"
],
"summary": "Download a media sample archive for troubleshooting",
"operationId": "TroubleshootTroubleshootPlaybackSampleGet",
"operationId": "DownloadTroubleshootingMediaSample",
"parameters": [
{
"name": "mediaItemId",
@@ -30188,6 +29898,82 @@
}
}
},
"StartTroubleshootingPlaybackRequest": {
"required": [
"mediaItem",
"channel",
"ffmpegProfile",
"streamingMode",
"watermark",
"graphicsElement",
"streamSelector",
"subtitleId",
"seekSeconds",
"start"
],
"type": "object",
"properties": {
"mediaItem": {
"type": "integer",
"format": "int32"
},
"channel": {
"type": "integer",
"format": "int32"
},
"ffmpegProfile": {
"type": "integer",
"format": "int32"
},
"streamingMode": {
"$ref": "#/components/schemas/StreamingMode"
},
"watermark": {
"type": [
"null",
"array"
],
"items": {
"type": "integer",
"format": "int32"
}
},
"graphicsElement": {
"type": [
"null",
"array"
],
"items": {
"type": "integer",
"format": "int32"
}
},
"streamSelector": {
"type": [
"null",
"string"
]
},
"subtitleId": {
"type": [
"null",
"integer"
],
"format": "int32"
},
"seekSeconds": {
"type": "integer",
"format": "int32"
},
"start": {
"type": [
"null",
"string"
],
"format": "date-time"
}
}
},
"StartType": {
"enum": [
"Dynamic",
@@ -30427,6 +30213,17 @@
}
}
},
"TroubleshootingPlaybackStartedResponseModel": {
"required": [
"url"
],
"type": "object",
"properties": {
"url": {
"type": "string"
}
}
},
"TroubleshootingPlaybackStatusResponseModel": {
"required": [
"state",
+4 -7
View File
@@ -2,7 +2,7 @@
*Generated by `scripts/generate-endpoint-index.py` from `ErsatzTV/wwwroot/openapi/v1.json`. Do not edit by hand -- regenerated by `scripts/update-openapi.sh`.*
159 endpoints, 244 operations.
159 endpoints, 241 operations.
## Artists
@@ -416,12 +416,9 @@
| Method | Path | Operation | Summary |
|---|---|---|---|
| GET | `/api/troubleshoot/info` | GetTroubleshootingInfo | Get troubleshooting diagnostic info |
| GET | `/api/troubleshoot/playback.m3u8` | TroubleshootTroubleshootPlaybackGet | Start a troubleshooting playback session |
| HEAD | `/api/troubleshoot/playback.m3u8` | TroubleshootTroubleshootPlaybackHead | Start a troubleshooting playback session |
| GET | `/api/troubleshoot/playback/archive` | TroubleshootTroubleshootPlaybackArchiveGet | Download the last troubleshooting playback session archive |
| HEAD | `/api/troubleshoot/playback/archive` | TroubleshootTroubleshootPlaybackArchiveHead | Download the last troubleshooting playback session archive |
| GET | `/api/troubleshoot/playback/sample/{mediaItemId}` | TroubleshootTroubleshootPlaybackSampleGet | Download a media sample archive for troubleshooting |
| HEAD | `/api/troubleshoot/playback/sample/{mediaItemId}` | TroubleshootTroubleshootPlaybackSampleHead | Download a media sample archive for troubleshooting |
| POST | `/api/troubleshoot/playback/archive` | DownloadTroubleshootingArchive | Download the last troubleshooting playback session archive |
| POST | `/api/troubleshoot/playback/sample/{mediaItemId}` | DownloadTroubleshootingMediaSample | Download a media sample archive for troubleshooting |
| POST | `/api/troubleshoot/playback/start` | StartTroubleshootingPlayback | Start a troubleshooting playback session |
| GET | `/api/troubleshoot/playback/status` | GetTroubleshootingPlaybackStatus | Get the status of the current or last troubleshooting playback session |
| GET | `/api/troubleshoot/playback/stream-selectors` | GetTroubleshootingStreamSelectors | List available channel stream selectors |
| GET | `/api/troubleshoot/playback/subtitles/{mediaItemId}` | GetTroubleshootingSubtitles | List selectable subtitle streams for a media item |
+15
View File
@@ -1434,6 +1434,18 @@ export interface components {
"id": number;
"name": string;
"query": string;
};
"StartTroubleshootingPlaybackRequest": {
"mediaItem": number;
"channel": number;
"ffmpegProfile": number;
"streamingMode": components["schemas"]["StreamingMode"];
"watermark": null | Array<number>;
"graphicsElement": null | Array<number>;
"streamSelector": null | string;
"subtitleId": null | number;
"seekSeconds": number;
"start": null | string;
};
"StartType": "Dynamic" | "Fixed";
"StreamingMode": "TransportStream" | "HttpLiveStreamingDirect" | "HttpLiveStreamingSegmenter" | "TransportStreamHybrid";
@@ -1485,6 +1497,9 @@ export interface components {
"qsvCapabilities": null | string;
"vaapiCapabilities": null | string;
"videoToolboxCapabilities": null | string;
};
"TroubleshootingPlaybackStartedResponseModel": {
"url": string;
};
"TroubleshootingPlaybackStatusResponseModel": {
"state": string;