From 5cfb379aa63689435077c8f1ebc10c98f625238c Mon Sep 17 00:00:00 2001 From: Shadowghost Date: Mon, 4 May 2026 21:57:11 +0200 Subject: Use native middleware --- .../HttpServer/WebSocketConnection.cs | 28 +++++++--------------- 1 file changed, 8 insertions(+), 20 deletions(-) (limited to 'Emby.Server.Implementations/HttpServer/WebSocketConnection.cs') 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; @@ -72,12 +70,6 @@ namespace Emby.Server.Implementations.HttpServer /// public IPAddress? RemoteEndPoint { get; } - /// - /// Gets or initializes the culture fallback chain captured from the - /// Accept-Language header of the upgrade request. - /// - public IReadOnlyList? RequestCultureFallback { get; init; } - /// /// Gets or initializes the UI culture name captured from the upgrade request. /// @@ -98,22 +90,18 @@ namespace Emby.Server.Implementations.HttpServer /// 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. } } -- cgit v1.2.3