mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-07-15 02:33:33 +01:00
Merge branch 'master' into sort-nfo-data
This commit is contained in:
@@ -22,7 +22,7 @@ namespace MediaBrowser.Controller.Channels
|
||||
[JsonIgnore]
|
||||
public override SourceType SourceType => SourceType.Channel;
|
||||
|
||||
public override bool IsVisible(User user)
|
||||
public override bool IsVisible(User user, bool skipAllowedTagsCheck = false)
|
||||
{
|
||||
var blockedChannelsPreference = user.GetPreferenceValues<Guid>(PreferenceKind.BlockedChannels);
|
||||
if (blockedChannelsPreference.Length != 0)
|
||||
@@ -41,7 +41,7 @@ namespace MediaBrowser.Controller.Channels
|
||||
}
|
||||
}
|
||||
|
||||
return base.IsVisible(user);
|
||||
return base.IsVisible(user, skipAllowedTagsCheck);
|
||||
}
|
||||
|
||||
protected override QueryResult<BaseItem> GetItemsInternal(InternalItemsQuery query)
|
||||
|
||||
@@ -1303,7 +1303,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
return false;
|
||||
}
|
||||
|
||||
if (GetParents().Any(i => !i.IsVisible(user)))
|
||||
if (GetParents().Any(i => !i.IsVisible(user, true)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -1525,13 +1525,14 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// Determines if a given user has access to this item.
|
||||
/// </summary>
|
||||
/// <param name="user">The user.</param>
|
||||
/// <param name="skipAllowedTagsCheck">Don't check for allowed tags.</param>
|
||||
/// <returns><c>true</c> if [is parental allowed] [the specified user]; otherwise, <c>false</c>.</returns>
|
||||
/// <exception cref="ArgumentNullException">If user is null.</exception>
|
||||
public bool IsParentalAllowed(User user)
|
||||
public bool IsParentalAllowed(User user, bool skipAllowedTagsCheck)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(user);
|
||||
|
||||
if (!IsVisibleViaTags(user))
|
||||
if (!IsVisibleViaTags(user, skipAllowedTagsCheck))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -1603,7 +1604,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
return list.Distinct(StringComparer.OrdinalIgnoreCase).ToList();
|
||||
}
|
||||
|
||||
private bool IsVisibleViaTags(User user)
|
||||
private bool IsVisibleViaTags(User user, bool skipAllowedTagsCheck)
|
||||
{
|
||||
var allTags = GetInheritedTags();
|
||||
if (user.GetPreference(PreferenceKind.BlockedTags).Any(i => allTags.Contains(i, StringComparison.OrdinalIgnoreCase)))
|
||||
@@ -1618,7 +1619,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
}
|
||||
|
||||
var allowedTagsPreference = user.GetPreference(PreferenceKind.AllowedTags);
|
||||
if (allowedTagsPreference.Length != 0 && !allowedTagsPreference.Any(i => allTags.Contains(i, StringComparison.OrdinalIgnoreCase)))
|
||||
if (!skipAllowedTagsCheck && allowedTagsPreference.Length != 0 && !allowedTagsPreference.Any(i => allTags.Contains(i, StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -1658,13 +1659,14 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// Default is just parental allowed. Can be overridden for more functionality.
|
||||
/// </summary>
|
||||
/// <param name="user">The user.</param>
|
||||
/// <param name="skipAllowedTagsCheck">Don't check for allowed tags.</param>
|
||||
/// <returns><c>true</c> if the specified user is visible; otherwise, <c>false</c>.</returns>
|
||||
/// <exception cref="ArgumentNullException"><paramref name="user" /> is <c>null</c>.</exception>
|
||||
public virtual bool IsVisible(User user)
|
||||
public virtual bool IsVisible(User user, bool skipAllowedTagsCheck = false)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(user);
|
||||
|
||||
return IsParentalAllowed(user);
|
||||
return IsParentalAllowed(user, skipAllowedTagsCheck);
|
||||
}
|
||||
|
||||
public virtual bool IsVisibleStandalone(User user)
|
||||
|
||||
@@ -96,11 +96,11 @@ namespace MediaBrowser.Controller.Entities
|
||||
return GetLibraryOptions(Path);
|
||||
}
|
||||
|
||||
public override bool IsVisible(User user)
|
||||
public override bool IsVisible(User user, bool skipAllowedTagsCheck = false)
|
||||
{
|
||||
if (GetLibraryOptions().Enabled)
|
||||
{
|
||||
return base.IsVisible(user);
|
||||
return base.IsVisible(user, skipAllowedTagsCheck);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -219,7 +219,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
LibraryManager.CreateItem(item, this);
|
||||
}
|
||||
|
||||
public override bool IsVisible(User user)
|
||||
public override bool IsVisible(User user, bool skipAllowedTagsCheck = false)
|
||||
{
|
||||
if (this is ICollectionFolder && this is not BasePluginFolder)
|
||||
{
|
||||
@@ -241,7 +241,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
}
|
||||
}
|
||||
|
||||
return base.IsVisible(user);
|
||||
return base.IsVisible(user, skipAllowedTagsCheck);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -452,7 +452,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
if (newItems.Count > 0)
|
||||
{
|
||||
LibraryManager.CreateOrUpdateItems(newItems, this, cancellationToken);
|
||||
LibraryManager.CreateItems(newItems, this, cancellationToken);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1202,6 +1202,11 @@ namespace MediaBrowser.Controller.Entities
|
||||
return false;
|
||||
}
|
||||
|
||||
if (request.Is4K.HasValue)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (request.IsHD.HasValue)
|
||||
{
|
||||
return false;
|
||||
|
||||
@@ -145,14 +145,14 @@ namespace MediaBrowser.Controller.Entities.Movies
|
||||
return GetItemLookupInfo<BoxSetInfo>();
|
||||
}
|
||||
|
||||
public override bool IsVisible(User user)
|
||||
public override bool IsVisible(User user, bool skipAllowedTagsCheck = false)
|
||||
{
|
||||
if (IsLegacyBoxSet)
|
||||
{
|
||||
return base.IsVisible(user);
|
||||
return base.IsVisible(user, skipAllowedTagsCheck);
|
||||
}
|
||||
|
||||
if (base.IsVisible(user))
|
||||
if (base.IsVisible(user, skipAllowedTagsCheck))
|
||||
{
|
||||
if (LinkedChildren.Length == 0)
|
||||
{
|
||||
|
||||
@@ -258,7 +258,7 @@ namespace MediaBrowser.Controller.Library
|
||||
/// <param name="items">Items to create.</param>
|
||||
/// <param name="parent">Parent of new items.</param>
|
||||
/// <param name="cancellationToken">CancellationToken to use for operation.</param>
|
||||
void CreateOrUpdateItems(IReadOnlyList<BaseItem> items, BaseItem? parent, CancellationToken cancellationToken);
|
||||
void CreateItems(IReadOnlyList<BaseItem> items, BaseItem? parent, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Updates the item.
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Jellyfin.Data.Entities;
|
||||
|
||||
namespace MediaBrowser.Controller.Net
|
||||
@@ -20,31 +19,31 @@ namespace MediaBrowser.Controller.Net
|
||||
/// Gets or sets the device identifier.
|
||||
/// </summary>
|
||||
/// <value>The device identifier.</value>
|
||||
public string DeviceId { get; set; }
|
||||
public string? DeviceId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the device.
|
||||
/// </summary>
|
||||
/// <value>The device.</value>
|
||||
public string Device { get; set; }
|
||||
public string? Device { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the client.
|
||||
/// </summary>
|
||||
/// <value>The client.</value>
|
||||
public string Client { get; set; }
|
||||
public string? Client { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the version.
|
||||
/// </summary>
|
||||
/// <value>The version.</value>
|
||||
public string Version { get; set; }
|
||||
public string? Version { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the token.
|
||||
/// </summary>
|
||||
/// <value>The token.</value>
|
||||
public string Token { get; set; }
|
||||
public string? Token { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether the authorization is from an api key.
|
||||
@@ -54,7 +53,7 @@ namespace MediaBrowser.Controller.Net
|
||||
/// <summary>
|
||||
/// Gets or sets the user making the request.
|
||||
/// </summary>
|
||||
public User User { get; set; }
|
||||
public User? User { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether the token is authenticated.
|
||||
@@ -62,8 +61,9 @@ namespace MediaBrowser.Controller.Net
|
||||
public bool IsAuthenticated { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether the request has a token.
|
||||
/// Gets a value indicating whether the request has a token.
|
||||
/// </summary>
|
||||
public bool HasToken { get; set; }
|
||||
[MemberNotNullWhen(true, nameof(Token))]
|
||||
public bool HasToken => !string.IsNullOrWhiteSpace(Token);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,11 +227,11 @@ namespace MediaBrowser.Controller.Playlists
|
||||
return [item];
|
||||
}
|
||||
|
||||
public override bool IsVisible(User user)
|
||||
public override bool IsVisible(User user, bool skipAllowedTagsCheck = false)
|
||||
{
|
||||
if (!IsSharedItem)
|
||||
{
|
||||
return base.IsVisible(user);
|
||||
return base.IsVisible(user, skipAllowedTagsCheck);
|
||||
}
|
||||
|
||||
if (OpenAccess)
|
||||
|
||||
Reference in New Issue
Block a user