diff options
| author | Shadowghost <Ghost_of_Stone@web.de> | 2026-05-16 09:57:06 +0200 |
|---|---|---|
| committer | Shadowghost <Ghost_of_Stone@web.de> | 2026-05-16 09:57:06 +0200 |
| commit | ea8f6c51fd1013b6c841fb74a7fcde532d57d8da (patch) | |
| tree | 53ccd2afeda449f22e4198dfcf3b78993938a654 /Emby.Server.Implementations/HttpServer/WebSocketConnection.cs | |
| parent | d71194aa8cb07d998c0ed15df964c7c1259e7f17 (diff) | |
| parent | c4a21cb3224b284ecde65cf978a12de82d9f910c (diff) | |
Merge remote-tracking branch 'upstream/master' into search-rebased
Diffstat (limited to 'Emby.Server.Implementations/HttpServer/WebSocketConnection.cs')
| -rw-r--r-- | Emby.Server.Implementations/HttpServer/WebSocketConnection.cs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Emby.Server.Implementations/HttpServer/WebSocketConnection.cs b/Emby.Server.Implementations/HttpServer/WebSocketConnection.cs index 373b0994a6..e9bf3b93a7 100644 --- a/Emby.Server.Implementations/HttpServer/WebSocketConnection.cs +++ b/Emby.Server.Implementations/HttpServer/WebSocketConnection.cs @@ -1,5 +1,6 @@ using System; using System.Buffers; +using System.Globalization; using System.IO.Pipelines; using System.Net; using System.Net.WebSockets; @@ -69,6 +70,11 @@ namespace Emby.Server.Implementations.HttpServer /// <inheritdoc /> public IPAddress? RemoteEndPoint { get; } + /// <summary> + /// Gets or initializes the UI culture captured from the upgrade request. + /// </summary> + public CultureInfo? RequestUICulture { get; init; } + /// <inheritdoc /> public Func<WebSocketMessageInfo, Task>? OnReceive { get; set; } @@ -82,6 +88,17 @@ namespace Emby.Server.Implementations.HttpServer public WebSocketState State => _socket.State; /// <inheritdoc /> + public void ApplyRequestCulture() + { + if (RequestUICulture is null) + { + return; + } + + CultureInfo.CurrentUICulture = RequestUICulture; + } + + /// <inheritdoc /> public async Task SendAsync(OutboundWebSocketMessage message, CancellationToken cancellationToken) { var json = JsonSerializer.SerializeToUtf8Bytes(message, _jsonOptions); |
