mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-22 00:35:26 +03:00
rework result factory
This commit is contained in:
@@ -10,6 +10,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Controller.Net;
|
||||
using MediaBrowser.Model.Services;
|
||||
|
||||
namespace MediaBrowser.Api.UserLibrary
|
||||
@@ -57,12 +58,14 @@ namespace MediaBrowser.Api.UserLibrary
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IUserViewManager _userViewManager;
|
||||
private readonly IDtoService _dtoService;
|
||||
private readonly IAuthorizationContext _authContext;
|
||||
|
||||
public UserViewsService(IUserManager userManager, IUserViewManager userViewManager, IDtoService dtoService)
|
||||
public UserViewsService(IUserManager userManager, IUserViewManager userViewManager, IDtoService dtoService, IAuthorizationContext authContext)
|
||||
{
|
||||
_userManager = userManager;
|
||||
_userViewManager = userViewManager;
|
||||
_dtoService = dtoService;
|
||||
_authContext = authContext;
|
||||
}
|
||||
|
||||
public async Task<object> Get(GetUserViews request)
|
||||
@@ -82,7 +85,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||
query.PresetViews = request.PresetViews.Split(',');
|
||||
}
|
||||
|
||||
var app = AuthorizationContext.GetAuthorizationInfo(Request).Client ?? string.Empty;
|
||||
var app = _authContext.GetAuthorizationInfo(Request).Client ?? string.Empty;
|
||||
if (app.IndexOf("emby rt", StringComparison.OrdinalIgnoreCase) != -1)
|
||||
{
|
||||
query.PresetViews = new[] { CollectionType.Music, CollectionType.Movies, CollectionType.TvShows };
|
||||
@@ -91,7 +94,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||
|
||||
var folders = await _userViewManager.GetUserViews(query, CancellationToken.None).ConfigureAwait(false);
|
||||
|
||||
var dtoOptions = GetDtoOptions(request);
|
||||
var dtoOptions = GetDtoOptions(_authContext, request);
|
||||
dtoOptions.Fields = new List<ItemFields>();
|
||||
dtoOptions.Fields.Add(ItemFields.PrimaryImageAspectRatio);
|
||||
dtoOptions.Fields.Add(ItemFields.DisplayPreferencesId);
|
||||
|
||||
Reference in New Issue
Block a user