mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-27 12:34:56 +01:00
Added an api call to pull down user configuration
This commit is contained in:
parent
0a48b5e31a
commit
6c7175e33d
@@ -3,7 +3,7 @@
|
||||
namespace MediaBrowser.Common.Configuration
|
||||
{
|
||||
/// <summary>
|
||||
/// Serves as a common base class for the Server and UI Configurations
|
||||
/// Serves as a common base class for the Server and UI application Configurations
|
||||
/// </summary>
|
||||
public class BaseConfiguration
|
||||
{
|
||||
|
||||
37
MediaBrowser.Common/Configuration/ConfigurationController.cs
Normal file
37
MediaBrowser.Common/Configuration/ConfigurationController.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.IO;
|
||||
using MediaBrowser.Common.Json;
|
||||
|
||||
namespace MediaBrowser.Common.Configuration
|
||||
{
|
||||
public class ConfigurationController<TConfigurationType>
|
||||
where TConfigurationType : BaseConfiguration, new ()
|
||||
{
|
||||
/// <summary>
|
||||
/// The path to the configuration file
|
||||
/// </summary>
|
||||
public string Path { get; set; }
|
||||
|
||||
public TConfigurationType Configuration { get; set; }
|
||||
|
||||
public void Reload()
|
||||
{
|
||||
if (!File.Exists(Path))
|
||||
{
|
||||
Configuration = new TConfigurationType();
|
||||
}
|
||||
else
|
||||
{
|
||||
Configuration = JsonSerializer.DeserializeFromFile<TConfigurationType>(Path);
|
||||
}
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
21
MediaBrowser.Common/Configuration/UserConfiguration.cs
Normal file
21
MediaBrowser.Common/Configuration/UserConfiguration.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Common.Configuration
|
||||
{
|
||||
/// <summary>
|
||||
/// This holds settings that can be personalized on a per-user, per-device basis.
|
||||
/// </summary>
|
||||
public class UserConfiguration
|
||||
{
|
||||
public int RecentItemDays { get; set; }
|
||||
|
||||
public UserConfiguration()
|
||||
{
|
||||
RecentItemDays = 14;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user