mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-05-15 13:16:49 +01:00
Cleanup
This commit is contained in:
@@ -71,9 +71,9 @@ namespace Emby.Server.Implementations.HttpServer
|
||||
public IPAddress? RemoteEndPoint { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or initializes the UI culture name captured from the upgrade request.
|
||||
/// Gets or initializes the UI culture captured from the upgrade request.
|
||||
/// </summary>
|
||||
public string? RequestUICulture { get; init; }
|
||||
public CultureInfo? RequestUICulture { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public Func<WebSocketMessageInfo, Task>? OnReceive { get; set; }
|
||||
@@ -90,19 +90,12 @@ namespace Emby.Server.Implementations.HttpServer
|
||||
/// <inheritdoc />
|
||||
public void ApplyRequestCulture()
|
||||
{
|
||||
if (string.IsNullOrEmpty(RequestUICulture))
|
||||
if (RequestUICulture is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
CultureInfo.CurrentUICulture = CultureInfo.GetCultureInfo(RequestUICulture);
|
||||
}
|
||||
catch (CultureNotFoundException)
|
||||
{
|
||||
// Codes that aren't valid .NET cultures are ignored.
|
||||
}
|
||||
CultureInfo.CurrentUICulture = RequestUICulture;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -48,17 +48,13 @@ namespace Emby.Server.Implementations.HttpServer
|
||||
_logger.LogInformation("WS {IP} request", context.Connection.RemoteIpAddress);
|
||||
|
||||
WebSocket webSocket = await context.WebSockets.AcceptWebSocketAsync().ConfigureAwait(false);
|
||||
|
||||
// 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(
|
||||
_loggerFactory.CreateLogger<WebSocketConnection>(),
|
||||
webSocket,
|
||||
authorizationInfo,
|
||||
context.GetNormalizedRemoteIP())
|
||||
{
|
||||
RequestUICulture = CultureInfo.CurrentUICulture.Name
|
||||
RequestUICulture = CultureInfo.CurrentUICulture
|
||||
};
|
||||
connection.OnReceive = result =>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user