diff options
Diffstat (limited to 'Emby.Server.Implementations/HttpServer')
| -rw-r--r-- | Emby.Server.Implementations/HttpServer/WebSocketConnection.cs | 28 | ||||
| -rw-r--r-- | Emby.Server.Implementations/HttpServer/WebSocketManager.cs | 4 |
2 files changed, 9 insertions, 23 deletions
diff --git a/Emby.Server.Implementations/HttpServer/WebSocketConnection.cs b/Emby.Server.Implementations/HttpServer/WebSocketConnection.cs index 6dc6d9d289..17070c39ba 100644 --- a/Emby.Server.Implementations/HttpServer/WebSocketConnection.cs +++ b/Emby.Server.Implementations/HttpServer/WebSocketConnection.cs @@ -1,6 +1,5 @@ using System; using System.Buffers; -using System.Collections.Generic; using System.Globalization; using System.IO.Pipelines; using System.Net; @@ -9,7 +8,6 @@ using System.Text; using System.Text.Json; using System.Threading; using System.Threading.Tasks; -using Emby.Server.Implementations.Localization; using Jellyfin.Extensions.Json; using MediaBrowser.Controller.Net; using MediaBrowser.Controller.Net.WebSocketMessages; @@ -73,12 +71,6 @@ namespace Emby.Server.Implementations.HttpServer public IPAddress? RemoteEndPoint { get; } /// <summary> - /// Gets or initializes the culture fallback chain captured from the - /// <c>Accept-Language</c> header of the upgrade request. - /// </summary> - public IReadOnlyList<string>? RequestCultureFallback { get; init; } - - /// <summary> /// Gets or initializes the UI culture name captured from the upgrade request. /// </summary> public string? RequestUICulture { get; init; } @@ -98,22 +90,18 @@ namespace Emby.Server.Implementations.HttpServer /// <inheritdoc /> public void ApplyRequestCulture() { - if (RequestCultureFallback is not null) + if (string.IsNullOrEmpty(RequestUICulture)) { - LocalizationManager.RequestCultureFallback = RequestCultureFallback; + return; } - if (!string.IsNullOrEmpty(RequestUICulture)) + try { - try - { - CultureInfo.CurrentUICulture = CultureInfo.GetCultureInfo(RequestUICulture); - } - catch (CultureNotFoundException) - { - // Jellyfin culture codes (e.g. "es_419") aren't always valid .NET cultures — - // skip setting CurrentUICulture; RequestCultureFallback above carries the chain. - } + CultureInfo.CurrentUICulture = CultureInfo.GetCultureInfo(RequestUICulture); + } + catch (CultureNotFoundException) + { + // Codes that aren't valid .NET cultures are ignored. } } diff --git a/Emby.Server.Implementations/HttpServer/WebSocketManager.cs b/Emby.Server.Implementations/HttpServer/WebSocketManager.cs index 3b5f6d1d09..dcdfda5472 100644 --- a/Emby.Server.Implementations/HttpServer/WebSocketManager.cs +++ b/Emby.Server.Implementations/HttpServer/WebSocketManager.cs @@ -8,7 +8,6 @@ using System.Globalization; using System.Linq; using System.Net.WebSockets; using System.Threading.Tasks; -using Emby.Server.Implementations.Localization; using MediaBrowser.Common.Extensions; using MediaBrowser.Controller.Net; using Microsoft.AspNetCore.Http; @@ -50,7 +49,7 @@ namespace Emby.Server.Implementations.HttpServer WebSocket webSocket = await context.WebSockets.AcceptWebSocketAsync().ConfigureAwait(false); - // Capture the culture context set by AcceptLanguageMiddleware so it can be + // Capture the culture set by RequestLocalizationMiddleware so it can be // restored both when processing incoming messages and when periodic // listeners produce server-initiated payloads on background tasks. var connection = new WebSocketConnection( @@ -59,7 +58,6 @@ namespace Emby.Server.Implementations.HttpServer authorizationInfo, context.GetNormalizedRemoteIP()) { - RequestCultureFallback = LocalizationManager.RequestCultureFallback, RequestUICulture = CultureInfo.CurrentUICulture.Name }; connection.OnReceive = result => |
