ErsatzTV built every absolute M3U/XMLTV URL from the incoming request's
Scheme/Host/PathBase, so a client fetching via a host that downstream
consumers can't resolve (e.g. Dispatcharr over Docker DNS → Kodi) baked
that internal host into programme-image/stream URLs.
Add an optional advertised IPTV base URL, backed by the existing
ConfigElement key/value store (key `iptv.base_url`, no EF migration):
- Central pure Core helper `AdvertisedBaseUrl` (TryParse/Resolve):
validates absolute http(s), no credentials/query/fragment, preserves
port + path prefix, normalizes trailing slash. Blank/invalid falls
back to the request-derived values, so unset output is byte-identical.
- Resolved inside `GetChannelPlaylistHandler` (M3U guide/logo/stream) and
`GetChannelGuideHandler` (both XMLTV {RequestBase} sites) — controllers
stay thin, golden tests untouched.
- New `iptv` settings group: GET/PUT /api/v1/settings/iptv (blank clears,
malformed → 422) + a new IPTV section on the SPA Settings screen.
- Scoped to M3U + XMLTV; HDHomeRun deliberately out of scope. Distinct
from ETV_BASE_URL (which only sets ASP.NET PathBase).
Tests: AdvertisedBaseUrl unit tests (override/fallback/port/path/invalid),
handler override tests for both generators, settings controller + handler
tests, SPA client + screen tests. Docs: m3u-xmltv, decisions, domain-model,
regenerated OpenAPI v1.json + v1.d.ts + endpoint-index.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
14 lines
490 B
C#
14 lines
490 B
C#
using ErsatzTV.Application.Configuration;
|
|
|
|
namespace ErsatzTV.Controllers.Api.Requests;
|
|
|
|
/// <summary>
|
|
/// IPTV output settings. <see cref="BaseUrl" /> is the optional advertised base URL applied to
|
|
/// absolute M3U/XMLTV URLs; send an empty string to clear it and use the incoming request's origin.
|
|
/// </summary>
|
|
public record UpdateIptvSettingsRequest(string BaseUrl)
|
|
{
|
|
public UpdateIptvSettings ToCommand() =>
|
|
new(new IptvSettingsViewModel { BaseUrl = BaseUrl });
|
|
}
|