Fixing URL Encoding for logo generation (#1818)

This commit is contained in:
Sylvain
2024-07-27 10:37:37 -05:00
committed by GitHub
parent e4e4f68eb4
commit 01090f62e6
4 changed files with 15 additions and 10 deletions
@@ -1,4 +1,5 @@
using ErsatzTV.Core.Domain;
using ErsatzTV.Core.Domain;
using System.Net;
namespace ErsatzTV.Application.Channels;
@@ -20,4 +21,7 @@ public record ChannelViewModel(
string PreferredSubtitleLanguageCode,
ChannelSubtitleMode SubtitleMode,
ChannelMusicVideoCreditsMode MusicVideoCreditsMode,
string MusicVideoCreditsTemplate);
string MusicVideoCreditsTemplate)
{
public string WebEncodedName => WebUtility.UrlEncode(Name);
}
+3 -1
View File
@@ -1,4 +1,5 @@
using ErsatzTV.Core.Domain.Filler;
using ErsatzTV.Core.Domain.Filler;
using System.Net;
namespace ErsatzTV.Core.Domain;
@@ -29,4 +30,5 @@ public class Channel
public ChannelMusicVideoCreditsMode MusicVideoCreditsMode { get; set; }
public string MusicVideoCreditsTemplate { get; set; }
public ChannelProgressMode ProgressMode { get; set; }
public string WebEncodedName => WebUtility.UrlEncode(Name);
}
+1 -1
View File
@@ -65,7 +65,7 @@ public class ChannelPlaylist
.HeadOrNone()
.Match(
artwork => $"{_scheme}://{_host}{_baseUrl}/iptv/logos/{artwork.Path}.jpg{accessTokenUri}",
() => $"{_scheme}://{_host}{_baseUrl}/iptv/logos/gen?text={WebUtility.UrlEncode(channel.Name)}{accessTokenUriAmp}");
() => $"{_scheme}://{_host}{_baseUrl}/iptv/logos/gen?text={channel.WebEncodedName}{accessTokenUriAmp}");
string shortUniqueId = Convert.ToBase64String(channel.UniqueId.ToByteArray())
.TrimEnd('=')
+5 -6
View File
@@ -47,10 +47,10 @@
{
<MudElement HtmlTag="img" src="@($"iptv/logos/{context.Logo}")" Style="max-height: 50px"/>
}
else
{
<MudElement HtmlTag="img" src="@($"iptv/logos/gen?text={context.Name}")" Style="max-height: 50px" />
}
else
{
<MudElement HtmlTag="img" src="@($"iptv/logos/gen?text={context.WebEncodedName}")" Style="max-height: 50px" />
}
</MudTd>
<MudTd DataLabel="Name">@context.Name</MudTd>
<MudTd DataLabel="Language">@context.PreferredAudioLanguageCode</MudTd>
@@ -252,5 +252,4 @@
StreamingMode.TransportStreamHybrid => "MPEG-TS",
_ => "MPEG-TS (Legacy)"
};
}
}