diff --git a/Jellyfin2Samsung-CrossOS/Helpers/AppSettings.cs b/Jellyfin2Samsung-CrossOS/Helpers/AppSettings.cs index de4c7ad..b79e33c 100644 --- a/Jellyfin2Samsung-CrossOS/Helpers/AppSettings.cs +++ b/Jellyfin2Samsung-CrossOS/Helpers/AppSettings.cs @@ -85,7 +85,7 @@ namespace Jellyfin2Samsung.Helpers // ----- Application-scoped settings (readonly at runtime) ----- public string ReleasesUrl { get; set; } = "https://api.github.com/repos/jeppevinkel/jellyfin-tizen-builds/releases"; public string AuthorEndpoint { get; set; } = "https://dev.tizen.samsung.com/apis/v2/authors"; - public string AppVersion { get; set; } = "v2.2.0.8"; + public string AppVersion { get; set; } = "v2.2.0.9"; public string TizenSdb { get; set; } = "https://api.github.com/repos/PatrickSt1991/tizen-sdb/releases"; public string JellyfinAvRelease { get; set; } = "https://api.github.com/repos/PatrickSt1991/tizen-jellyfin-avplay/releases"; public string JellyfinAvReleaseFork { get; set; } = "https://api.github.com/repos/asamahy/tizen-jellyfin-avplay/releases"; diff --git a/Jellyfin2Samsung-CrossOS/Helpers/Core/GitHubAuthHandler.cs b/Jellyfin2Samsung-CrossOS/Helpers/Core/GitHubAuthHandler.cs index 434b041..5961646 100644 --- a/Jellyfin2Samsung-CrossOS/Helpers/Core/GitHubAuthHandler.cs +++ b/Jellyfin2Samsung-CrossOS/Helpers/Core/GitHubAuthHandler.cs @@ -1,5 +1,6 @@ using System; using System.Diagnostics; +using System.Net; using System.Net.Http; using System.Net.Http.Headers; using System.Threading; @@ -17,7 +18,7 @@ namespace Jellyfin2Samsung.Helpers.Core _token = token; } - protected override Task SendAsync( + protected override async Task SendAsync( HttpRequestMessage request, CancellationToken cancellationToken) { @@ -26,7 +27,23 @@ namespace Jellyfin2Samsung.Helpers.Core request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", _token); } - return base.SendAsync(request, cancellationToken); + var response = await base.SendAsync(request, cancellationToken); + + // Token is expired or revoked — retry unauthenticated for public endpoints + if (response.StatusCode == HttpStatusCode.Unauthorized && + request.Headers.Authorization != null) + { + Trace.TraceWarning("[GitHubAuth] Token rejected (401) — retrying without authorization"); + var retry = new HttpRequestMessage(request.Method, request.RequestUri); + foreach (var header in request.Headers) + { + if (!string.Equals(header.Key, "Authorization", StringComparison.OrdinalIgnoreCase)) + retry.Headers.TryAddWithoutValidation(header.Key, header.Value); + } + response = await base.SendAsync(retry, cancellationToken); + } + + return response; } private static bool IsGitHubRequest(Uri? uri)