From cd4a9c1d162041565c855e10bee83faad22be1d4 Mon Sep 17 00:00:00 2001 From: Jason Dove <1695733+jasongdove@users.noreply.github.com> Date: Tue, 1 Jul 2025 15:13:16 +0000 Subject: [PATCH] fix hdhr endpoint classification (#2101) --- CHANGELOG.md | 3 +++ ErsatzTV/Startup.cs | 13 ++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 53f450158..5d916d52f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -73,6 +73,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Fix display of SVG channel logo and watermark in admin UI - Existing SVG logos and watermarks will have to be re-uploaded to display properly in the admin UI - This does not affect streaming at all; existing artwork still works fine for streaming +- Classify HDHR endpoints as streaming endpoints + - This allows these endpoints to be accessed through port `ETV_STREAMING_PORT` (default `8409`) + - This only matters if you configured `ETV_UI_PORT` to be a different value, which makes UI endpoints inaccessible on the streaming port ## [25.2.0] - 2025-06-24 ### Added diff --git a/ErsatzTV/Startup.cs b/ErsatzTV/Startup.cs index 7d241ec7d..98b9c57fc 100644 --- a/ErsatzTV/Startup.cs +++ b/ErsatzTV/Startup.cs @@ -562,7 +562,7 @@ public class Startup async (context, next) => { if (!context.Request.Host.Value.StartsWith("localhost", StringComparison.OrdinalIgnoreCase) && - !context.Request.Path.StartsWithSegments("/iptv") && + !IsIptvPath(context.Request.Path) && context.Connection.LocalPort != Settings.UiPort) { context.Response.StatusCode = 404; @@ -573,7 +573,7 @@ public class Startup }); app.MapWhen( - ctx => !ctx.Request.Path.StartsWithSegments("/iptv"), + ctx => !IsIptvPath(ctx.Request.Path), blazor => { blazor.UseRouting(); @@ -596,12 +596,19 @@ public class Startup }); app.MapWhen( - ctx => ctx.Request.Path.StartsWithSegments("/iptv"), + ctx => IsIptvPath(ctx.Request.Path), iptv => { iptv.UseRouting(); iptv.UseEndpoints(endpoints => endpoints.MapControllers()); }); + return; + + bool IsIptvPath(PathString path) => path.StartsWithSegments("/iptv") || + path.StartsWithSegments("/discover.json") || + path.StartsWithSegments("/device.xml") || + path.StartsWithSegments("/lineup.json") || + path.StartsWithSegments("/lineup_status.json"); } private static void CustomServices(IServiceCollection services)