Browse Source

allow previewing jwt channels (#1586)

pull/1587/head
Jason Dove 2 years ago committed by GitHub
parent
commit
3d99c2593d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 5
      CHANGELOG.md
  2. 14
      ErsatzTV/Pages/Channels.razor

5
CHANGELOG.md

@ -11,6 +11,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fix antiforgery error caused by reusing existing browser tabs across docker container restarts - Fix antiforgery error caused by reusing existing browser tabs across docker container restarts
- Data protection keys will now be persisted under ErsatzTV's config folder instead of being recreated at startup - Data protection keys will now be persisted under ErsatzTV's config folder instead of being recreated at startup
### Changed
- Pass through `access_token` query param from `Channels` page url to streaming endpoints
- This parameter isn't normally needed on the `Channels` page, since the web UI is not protected with JWT
- Its only purpose is to allow playback of authenticated channels in the web UI
## [0.8.5-beta] - 2024-01-30 ## [0.8.5-beta] - 2024-01-30
### Added ### Added
- Respect browser's `Accept-Language` header for date time display - Respect browser's `Accept-Language` header for date time display

14
ErsatzTV/Pages/Channels.razor

@ -4,6 +4,8 @@
@using ErsatzTV.Application.FFmpegProfiles @using ErsatzTV.Application.FFmpegProfiles
@using System.Globalization @using System.Globalization
@using ErsatzTV.Core.Interfaces.FFmpeg @using ErsatzTV.Core.Interfaces.FFmpeg
@using Microsoft.AspNetCore.WebUtilities
@using Microsoft.Extensions.Primitives
@implements IDisposable @implements IDisposable
@inject IDialogService Dialog @inject IDialogService Dialog
@inject IMediator Mediator @inject IMediator Mediator
@ -180,10 +182,16 @@
return; return;
} }
string currentUri = NavigationManager.Uri; var uri = new UriBuilder(NavigationManager.ToAbsoluteUri(NavigationManager.Uri));
string streamUri = currentUri.Replace("/channels", $"/iptv/channel/{channel.Number}.m3u8?mode=segmenter"); uri.Path = uri.Path.Replace("/channels", $"/iptv/channel/{channel.Number}.m3u8");
string query = uri.Query;
uri.Query = "?mode=segmenter";
if (QueryHelpers.ParseQuery(query).TryGetValue("access_token", out StringValues token))
{
uri.Query += $"&access_token={token.ToString()}";
}
var parameters = new DialogParameters { { "StreamUri", streamUri } }; var parameters = new DialogParameters { { "StreamUri", uri.ToString() } };
var options = new DialogOptions { CloseButton = true, MaxWidth = MaxWidth.ExtraLarge }; var options = new DialogOptions { CloseButton = true, MaxWidth = MaxWidth.ExtraLarge };
await Dialog.ShowAsync<ChannelPreviewDialog>("Channel Preview", parameters, options); await Dialog.ShowAsync<ChannelPreviewDialog>("Channel Preview", parameters, options);
} }

Loading…
Cancel
Save