aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornielsvanvelzen <nielsvanvelzen@users.noreply.github.com>2026-01-28 12:11:30 -0500
committerBond_009 <bond.009@outlook.com>2026-01-28 12:11:30 -0500
commit841e4dabb513c9c94bcbb0005d19e2a8be6434a5 (patch)
tree7038f205633d5deef3301f3f2eee5b84c76e3cd6
parent815a153b940aa5507923f1b22b73cd146367e1ea (diff)
Backport pull request #16109 from jellyfin/release-10.11.zHEADmaster
Fix SessionInfoWebSocketListener not using SessionInfoDto Original-merge: e65aff8bc67e3cc97d2ebe141de9ff6a8681d792 Merged-by: nielsvanvelzen <nielsvanvelzen@users.noreply.github.com> Backported-by: Bond_009 <bond.009@outlook.com>
-rw-r--r--Emby.Server.Implementations/Session/SessionManager.cs3
-rw-r--r--Jellyfin.Api/WebSocketListeners/SessionInfoWebSocketListener.cs15
-rw-r--r--MediaBrowser.Controller/Session/ISessionManager.cs7
3 files changed, 18 insertions, 7 deletions
diff --git a/Emby.Server.Implementations/Session/SessionManager.cs b/Emby.Server.Implementations/Session/SessionManager.cs
index bbe23f8df..8e14f5bdf 100644
--- a/Emby.Server.Implementations/Session/SessionManager.cs
+++ b/Emby.Server.Implementations/Session/SessionManager.cs
@@ -1186,7 +1186,8 @@ namespace Emby.Server.Implementations.Session
return session;
}
- private SessionInfoDto ToSessionInfoDto(SessionInfo sessionInfo)
+ /// <inheritdoc />
+ public SessionInfoDto ToSessionInfoDto(SessionInfo sessionInfo)
{
return new SessionInfoDto
{
diff --git a/Jellyfin.Api/WebSocketListeners/SessionInfoWebSocketListener.cs b/Jellyfin.Api/WebSocketListeners/SessionInfoWebSocketListener.cs
index 143d82bac..db24c9746 100644
--- a/Jellyfin.Api/WebSocketListeners/SessionInfoWebSocketListener.cs
+++ b/Jellyfin.Api/WebSocketListeners/SessionInfoWebSocketListener.cs
@@ -7,6 +7,7 @@ using MediaBrowser.Controller.Authentication;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Net;
using MediaBrowser.Controller.Session;
+using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Session;
using Microsoft.Extensions.Logging;
@@ -15,7 +16,7 @@ namespace Jellyfin.Api.WebSocketListeners;
/// <summary>
/// Class SessionInfoWebSocketListener.
/// </summary>
-public class SessionInfoWebSocketListener : BasePeriodicWebSocketListener<IEnumerable<SessionInfo>, WebSocketListenerState>
+public class SessionInfoWebSocketListener : BasePeriodicWebSocketListener<IEnumerable<SessionInfoDto>, WebSocketListenerState>
{
private readonly ISessionManager _sessionManager;
private bool _disposed;
@@ -52,24 +53,26 @@ public class SessionInfoWebSocketListener : BasePeriodicWebSocketListener<IEnume
/// Gets the data to send.
/// </summary>
/// <returns>Task{SystemInfo}.</returns>
- protected override Task<IEnumerable<SessionInfo>> GetDataToSend()
+ protected override Task<IEnumerable<SessionInfoDto>> GetDataToSend()
{
- return Task.FromResult(_sessionManager.Sessions);
+ return Task.FromResult(_sessionManager.Sessions.Select(_sessionManager.ToSessionInfoDto));
}
/// <inheritdoc />
- protected override Task<IEnumerable<SessionInfo>> GetDataToSendForConnection(IWebSocketConnection connection)
+ protected override Task<IEnumerable<SessionInfoDto>> GetDataToSendForConnection(IWebSocketConnection connection)
{
+ var sessions = _sessionManager.Sessions;
+
// For non-admin users, filter the sessions to only include their own sessions
if (connection.AuthorizationInfo?.User is not null &&
!connection.AuthorizationInfo.IsApiKey &&
!connection.AuthorizationInfo.User.HasPermission(PermissionKind.IsAdministrator))
{
var userId = connection.AuthorizationInfo.User.Id;
- return Task.FromResult(_sessionManager.Sessions.Where(s => s.UserId.Equals(userId) || s.ContainsUser(userId)));
+ sessions = sessions.Where(s => s.UserId.Equals(userId) || s.ContainsUser(userId));
}
- return Task.FromResult(_sessionManager.Sessions);
+ return Task.FromResult(sessions.Select(_sessionManager.ToSessionInfoDto));
}
/// <inheritdoc />
diff --git a/MediaBrowser.Controller/Session/ISessionManager.cs b/MediaBrowser.Controller/Session/ISessionManager.cs
index 2b3afa117..c11c65c33 100644
--- a/MediaBrowser.Controller/Session/ISessionManager.cs
+++ b/MediaBrowser.Controller/Session/ISessionManager.cs
@@ -350,5 +350,12 @@ namespace MediaBrowser.Controller.Session
/// <param name="sessionIdOrPlaySessionId">The session id or playsession id.</param>
/// <returns>Task.</returns>
Task CloseLiveStreamIfNeededAsync(string liveStreamId, string sessionIdOrPlaySessionId);
+
+ /// <summary>
+ /// Gets the dto for session info.
+ /// </summary>
+ /// <param name="sessionInfo">The session info.</param>
+ /// <returns><see cref="SessionInfoDto"/> of the session.</returns>
+ SessionInfoDto ToSessionInfoDto(SessionInfo sessionInfo);
}
}