mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-20 17:14:42 +01:00
Added an api call to pull down user configuration
This commit is contained in:
parent
0a48b5e31a
commit
6c7175e33d
@@ -1,16 +1,36 @@
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using System.Collections.Generic;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
|
||||
namespace MediaBrowser.Controller.Configuration
|
||||
{
|
||||
public class ServerConfiguration : BaseConfiguration
|
||||
{
|
||||
public string ImagesByNamePath { get; set; }
|
||||
public int RecentItemDays { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the default UI configuration
|
||||
/// </summary>
|
||||
public UserConfiguration DefaultUserConfiguration { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a list of registered UI device names
|
||||
/// </summary>
|
||||
public List<string> DeviceNames { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets all available UIConfigurations
|
||||
/// The key contains device name and user id
|
||||
/// </summary>
|
||||
public Dictionary<string, UserConfiguration> UserConfigurations { get; set; }
|
||||
|
||||
public ServerConfiguration()
|
||||
: base()
|
||||
{
|
||||
RecentItemDays = 14;
|
||||
DefaultUserConfiguration = new UserConfiguration();
|
||||
|
||||
UserConfigurations = new Dictionary<string, UserConfiguration>();
|
||||
|
||||
DeviceNames = new List<string>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
|
||||
namespace MediaBrowser.Controller.Configuration
|
||||
{
|
||||
/// <summary>
|
||||
/// Extends BaseConfigurationController by adding methods to get and set UIConfiguration data
|
||||
/// </summary>
|
||||
public class ServerConfigurationController : ConfigurationController<ServerConfiguration>
|
||||
{
|
||||
private string GetDictionaryKey(Guid userId, string deviceName)
|
||||
{
|
||||
string guidString = userId == Guid.Empty ? string.Empty : userId.ToString();
|
||||
|
||||
return deviceName + "-" + guidString;
|
||||
}
|
||||
|
||||
public UserConfiguration GetUserConfiguration(Guid userId)
|
||||
{
|
||||
return Configuration.DefaultUserConfiguration;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Common.Kernel;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Events;
|
||||
@@ -16,7 +17,7 @@ using MediaBrowser.Model.Users;
|
||||
|
||||
namespace MediaBrowser.Controller
|
||||
{
|
||||
public class Kernel : BaseKernel<ServerConfiguration>
|
||||
public class Kernel : BaseKernel<ServerConfigurationController, ServerConfiguration>
|
||||
{
|
||||
public static Kernel Instance { get; private set; }
|
||||
|
||||
@@ -249,7 +250,9 @@ namespace MediaBrowser.Controller
|
||||
{
|
||||
DateTime now = DateTime.Now;
|
||||
|
||||
return GetParentalAllowedRecursiveChildren(parent, userId).Where(i => !(i is Folder) && (now - i.DateCreated).TotalDays < Configuration.RecentItemDays);
|
||||
UserConfiguration config = ConfigurationController.GetUserConfiguration(userId);
|
||||
|
||||
return GetParentalAllowedRecursiveChildren(parent, userId).Where(i => !(i is Folder) && (now - i.DateCreated).TotalDays < config.RecentItemDays);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Configuration\ServerConfiguration.cs" />
|
||||
<Compile Include="Configuration\ServerConfigurationController.cs" />
|
||||
<Compile Include="Events\ItemResolveEventArgs.cs" />
|
||||
<Compile Include="IO\DirectoryWatchers.cs" />
|
||||
<Compile Include="IO\Shortcut.cs" />
|
||||
|
||||
Reference in New Issue
Block a user