diff options
| author | Cody Robibero <cody@robibe.ro> | 2024-04-14 08:18:36 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-14 08:18:36 -0600 |
| commit | 6fb6b5f1766a1f37a61b9faaa40209bab995bf30 (patch) | |
| tree | f169e72afeda371db2ffeb1b47c4dd88a03b4744 /Jellyfin.Api/Helpers | |
| parent | 9a4db8008593647cb6728b10317680dd3152c934 (diff) | |
Validate item access (#11171)
Diffstat (limited to 'Jellyfin.Api/Helpers')
| -rw-r--r-- | Jellyfin.Api/Helpers/MediaInfoHelper.cs | 14 | ||||
| -rw-r--r-- | Jellyfin.Api/Helpers/StreamingHelpers.cs | 5 |
2 files changed, 8 insertions, 11 deletions
diff --git a/Jellyfin.Api/Helpers/MediaInfoHelper.cs b/Jellyfin.Api/Helpers/MediaInfoHelper.cs index 6a24ad32a..52e2e1df5 100644 --- a/Jellyfin.Api/Helpers/MediaInfoHelper.cs +++ b/Jellyfin.Api/Helpers/MediaInfoHelper.cs @@ -76,21 +76,17 @@ public class MediaInfoHelper /// <summary> /// Get playback info. /// </summary> - /// <param name="id">Item id.</param> - /// <param name="userId">User Id.</param> + /// <param name="item">The item.</param> + /// <param name="user">The user.</param> /// <param name="mediaSourceId">Media source id.</param> /// <param name="liveStreamId">Live stream id.</param> /// <returns>A <see cref="Task"/> containing the <see cref="PlaybackInfoResponse"/>.</returns> public async Task<PlaybackInfoResponse> GetPlaybackInfo( - Guid id, - Guid? userId, + BaseItem item, + User? user, string? mediaSourceId = null, string? liveStreamId = null) { - var user = userId.IsNullOrEmpty() - ? null - : _userManager.GetUserById(userId.Value); - var item = _libraryManager.GetItemById(id); var result = new PlaybackInfoResponse(); MediaSourceInfo[] mediaSources; @@ -402,7 +398,7 @@ public class MediaInfoHelper if (profile is not null) { - var item = _libraryManager.GetItemById(request.ItemId); + var item = _libraryManager.GetItemById<BaseItem>(request.ItemId); SetDeviceSpecificData( item, diff --git a/Jellyfin.Api/Helpers/StreamingHelpers.cs b/Jellyfin.Api/Helpers/StreamingHelpers.cs index bfe71fd87..ab4826369 100644 --- a/Jellyfin.Api/Helpers/StreamingHelpers.cs +++ b/Jellyfin.Api/Helpers/StreamingHelpers.cs @@ -11,6 +11,7 @@ using Jellyfin.Extensions; using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Extensions; using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.MediaEncoding; using MediaBrowser.Controller.Streaming; @@ -107,7 +108,7 @@ public static class StreamingHelpers ?? state.SupportedSubtitleCodecs.FirstOrDefault(); } - var item = libraryManager.GetItemById(streamingRequest.Id); + var item = libraryManager.GetItemById<BaseItem>(streamingRequest.Id); state.IsInputVideo = item.MediaType == MediaType.Video; @@ -125,7 +126,7 @@ public static class StreamingHelpers if (mediaSource is null) { - var mediaSources = await mediaSourceManager.GetPlaybackMediaSources(libraryManager.GetItemById(streamingRequest.Id), null, false, false, cancellationToken).ConfigureAwait(false); + var mediaSources = await mediaSourceManager.GetPlaybackMediaSources(libraryManager.GetItemById<BaseItem>(streamingRequest.Id), null, false, false, cancellationToken).ConfigureAwait(false); mediaSource = string.IsNullOrEmpty(streamingRequest.MediaSourceId) ? mediaSources[0] |
