mirror of
https://github.com/jellyfin/jellyfin
synced 2024-09-05 23:53:44 +00:00
Create a store key constant for network
This commit is contained in:
parent
69df004b9f
commit
0485ff1899
|
@ -124,7 +124,7 @@ namespace Emby.Dlna.Main
|
||||||
config);
|
config);
|
||||||
Current = this;
|
Current = this;
|
||||||
|
|
||||||
var netConfig = config.GetConfiguration<NetworkConfiguration>("network");
|
var netConfig = config.GetConfiguration<NetworkConfiguration>(NetworkConfigurationStore.StoreKey);
|
||||||
_disabled = appHost.ListenWithHttps && netConfig.RequireHttps;
|
_disabled = appHost.ListenWithHttps && netConfig.RequireHttps;
|
||||||
|
|
||||||
if (_disabled && _config.GetDlnaConfiguration().EnableServer)
|
if (_disabled && _config.GetDlnaConfiguration().EnableServer)
|
||||||
|
|
|
@ -93,7 +93,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
NetworkConfiguration settings = _config.GetNetworkConfiguration();
|
NetworkConfiguration settings = _config.GetNetworkConfiguration();
|
||||||
settings.EnableRemoteAccess = startupRemoteAccessDto.EnableRemoteAccess;
|
settings.EnableRemoteAccess = startupRemoteAccessDto.EnableRemoteAccess;
|
||||||
settings.EnableUPnP = startupRemoteAccessDto.EnableAutomaticPortMapping;
|
settings.EnableUPnP = startupRemoteAccessDto.EnableAutomaticPortMapping;
|
||||||
_config.SaveConfiguration("network", settings);
|
_config.SaveConfiguration(NetworkConfigurationStore.StoreKey, settings);
|
||||||
return NoContent();
|
return NoContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,11 +16,7 @@ namespace Jellyfin.Networking.Configuration
|
||||||
{
|
{
|
||||||
return new[]
|
return new[]
|
||||||
{
|
{
|
||||||
new ConfigurationStore
|
new NetworkConfigurationStore()
|
||||||
{
|
|
||||||
Key = "network",
|
|
||||||
ConfigurationType = typeof(NetworkConfiguration)
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
using MediaBrowser.Common.Configuration;
|
||||||
|
|
||||||
|
namespace Jellyfin.Networking.Configuration
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A configuration that stores network related settings.
|
||||||
|
/// </summary>
|
||||||
|
public class NetworkConfigurationStore : ConfigurationStore
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The name of the configuration in the storage.
|
||||||
|
/// </summary>
|
||||||
|
public const string StoreKey = "network";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="NetworkConfigurationStore"/> class.
|
||||||
|
/// </summary>
|
||||||
|
public NetworkConfigurationStore()
|
||||||
|
{
|
||||||
|
ConfigurationType = typeof(NetworkConfiguration);
|
||||||
|
Key = StoreKey;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -727,7 +727,7 @@ namespace Jellyfin.Networking.Manager
|
||||||
|
|
||||||
private void ConfigurationUpdated(object? sender, ConfigurationUpdateEventArgs evt)
|
private void ConfigurationUpdated(object? sender, ConfigurationUpdateEventArgs evt)
|
||||||
{
|
{
|
||||||
if (evt.Key.Equals("network", StringComparison.Ordinal))
|
if (evt.Key.Equals(NetworkConfigurationStore.StoreKey, StringComparison.Ordinal))
|
||||||
{
|
{
|
||||||
UpdateSettings((NetworkConfiguration)evt.NewConfiguration);
|
UpdateSettings((NetworkConfiguration)evt.NewConfiguration);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue