Browse Source

fix: disable hdhr controller when jwt is used (#2999)

pull/3000/head
Jason Dove 2 weeks ago committed by GitHub
parent
commit
463a4c808a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 10
      ErsatzTV/Pages/Settings/HDHRSettings.razor
  3. 26
      ErsatzTV/RemoveHdhrConvention.cs
  4. 5
      ErsatzTV/Startup.cs

1
CHANGELOG.md

@ -23,6 +23,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). @@ -23,6 +23,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fix a shuffled sequence with `repeat` making the build run with no end; this stopped all other background work
- Fix bug in XMLTV template for episodes that was breaking thumbnail artwork
- Those with customized `episode.sbntxt` templates will want to make a similar fix
- Disable HDHR endpoints when JWT is used; they never worked in this configuration in the first place
## [26.8.1] - 2026-08-29
### Security

10
ErsatzTV/Pages/Settings/HDHRSettings.razor

@ -8,12 +8,18 @@ @@ -8,12 +8,18 @@
<MudForm @ref="_form" @bind-IsValid="@_hdhrSuccess" Style="max-height: 100%">
<MudPaper Square="true" Style="display: flex; height: 64px; min-height: 64px; width: 100%; z-index: 100; align-items: center">
<MudButton Variant="Variant.Filled" Color="Color.Primary" OnClick="@(_ => SaveHDHRSettings())" Class="ml-6" StartIcon="@Icons.Material.Filled.Save">Save Settings</MudButton>
<MudButton Variant="Variant.Filled" Color="Color.Primary" OnClick="@(_ => SaveHDHRSettings())" Class="ml-6" StartIcon="@Icons.Material.Filled.Save" Disabled="@JwtHelper.IsEnabled">Save Settings</MudButton>
</MudPaper>
<div class="d-flex flex-column" style="height: 100vh; overflow-x: auto">
<MudContainer MaxWidth="MaxWidth.ExtraLarge" Class="pt-8">
<MudText Typo="Typo.h5" Class="mb-2">HDHomeRun</MudText>
<MudDivider Class="mb-6"/>
@if (JwtHelper.IsEnabled)
{
<MudAlert Severity="Severity.Warning" Class="mb-6">
HDHomeRun endpoints are disabled because JWT is used. These settings have no effect.
</MudAlert>
}
<MudStack Row="true" Breakpoint="Breakpoint.SmAndDown" Class="form-field-stack gap-md-8 mb-5">
<div class="d-flex">
<MudText>UUID</MudText>
@ -24,7 +30,7 @@ @@ -24,7 +30,7 @@
<div class="d-flex">
<MudText>Tuner Count</MudText>
</div>
<MudTextField @bind-Value="_tunerCount" Validation="@(new Func<int, string>(ValidateTunerCount))" Required="true" RequiredError="Tuner count is required!"/>
<MudTextField @bind-Value="_tunerCount" Validation="@(new Func<int, string>(ValidateTunerCount))" Required="true" RequiredError="Tuner count is required!" Disabled="@JwtHelper.IsEnabled"/>
</MudStack>
</MudContainer>
</div>

26
ErsatzTV/RemoveHdhrConvention.cs

@ -0,0 +1,26 @@ @@ -0,0 +1,26 @@
using System.Reflection;
using ErsatzTV.Controllers;
using Microsoft.AspNetCore.Mvc.ApplicationModels;
namespace ErsatzTV;
public class RemoveHdhrConvention : IApplicationModelConvention
{
public void Apply(ApplicationModel application)
{
Option<ControllerModel> toRemove = None;
foreach (ControllerModel controller in application.Controllers)
{
if (controller.ControllerType == typeof(HdhrController).GetTypeInfo())
{
toRemove = controller;
break;
}
}
foreach (ControllerModel remove in toRemove)
{
application.Controllers.Remove(remove);
}
}
}

5
ErsatzTV/Startup.cs

@ -317,6 +317,11 @@ public class Startup @@ -317,6 +317,11 @@ public class Startup
services.AddControllers(options =>
{
if (JwtHelper.IsEnabled)
{
options.Conventions.Add(new RemoveHdhrConvention());
}
options.OutputFormatters.Insert(0, new ConcatPlaylistOutputFormatter());
options.OutputFormatters.Insert(0, new ChannelPlaylistOutputFormatter());
options.OutputFormatters.Insert(0, new ChannelGuideOutputFormatter());

Loading…
Cancel
Save