Apply review suggestions

This commit is contained in:
Shadowghost 2023-07-03 15:59:39 +02:00
parent 32ac3b580c
commit e233a3b074
4 changed files with 24 additions and 24 deletions

View File

@ -475,8 +475,8 @@ namespace Emby.Server.Implementations
} }
var networkConfiguration = ConfigurationManager.GetNetworkConfiguration(); var networkConfiguration = ConfigurationManager.GetNetworkConfiguration();
HttpPort = networkConfiguration.ServerPortNumberHttp; HttpPort = networkConfiguration.InternalHttpPort;
HttpsPort = networkConfiguration.ServerPortNumberHttps; HttpsPort = networkConfiguration.InternalHttpsPort;
// Safeguard against invalid configuration // Safeguard against invalid configuration
if (HttpPort == HttpsPort) if (HttpPort == HttpsPort)
@ -785,8 +785,8 @@ namespace Emby.Server.Implementations
if (HttpPort != 0 && HttpsPort != 0) if (HttpPort != 0 && HttpsPort != 0)
{ {
// Need to restart if ports have changed // Need to restart if ports have changed
if (networkConfiguration.ServerPortNumberHttp != HttpPort if (networkConfiguration.InternalHttpPort != HttpPort
|| networkConfiguration.ServerPortNumberHttps != HttpsPort) || networkConfiguration.InternalHttpsPort != HttpsPort)
{ {
if (ConfigurationManager.Configuration.IsPortAuthorized) if (ConfigurationManager.Configuration.IsPortAuthorized)
{ {

View File

@ -57,8 +57,8 @@ namespace Emby.Server.Implementations.EntryPoints
return new StringBuilder(32) return new StringBuilder(32)
.Append(config.EnableUPnP).Append(Separator) .Append(config.EnableUPnP).Append(Separator)
.Append(config.PublicPortHttp).Append(Separator) .Append(config.PublicHttpPort).Append(Separator)
.Append(config.PublicPortHttps).Append(Separator) .Append(config.PublicHttpsPort).Append(Separator)
.Append(_appHost.HttpPort).Append(Separator) .Append(_appHost.HttpPort).Append(Separator)
.Append(_appHost.HttpsPort).Append(Separator) .Append(_appHost.HttpsPort).Append(Separator)
.Append(_appHost.ListenWithHttps).Append(Separator) .Append(_appHost.ListenWithHttps).Append(Separator)
@ -146,11 +146,11 @@ namespace Emby.Server.Implementations.EntryPoints
private IEnumerable<Task> CreatePortMaps(INatDevice device) private IEnumerable<Task> CreatePortMaps(INatDevice device)
{ {
var config = _config.GetNetworkConfiguration(); var config = _config.GetNetworkConfiguration();
yield return CreatePortMap(device, _appHost.HttpPort, config.PublicPortHttp); yield return CreatePortMap(device, _appHost.HttpPort, config.PublicHttpPort);
if (_appHost.ListenWithHttps) if (_appHost.ListenWithHttps)
{ {
yield return CreatePortMap(device, _appHost.HttpsPort, config.PublicPortHttps); yield return CreatePortMap(device, _appHost.HttpsPort, config.PublicHttpsPort);
} }
} }

View File

@ -10,12 +10,12 @@ namespace Jellyfin.Networking.Configuration
public class NetworkConfiguration public class NetworkConfiguration
{ {
/// <summary> /// <summary>
/// The default value for <see cref="ServerPortNumberHttp"/>. /// The default value for <see cref="InternalHttpPort"/>.
/// </summary> /// </summary>
public const int DefaultHttpPort = 8096; public const int DefaultHttpPort = 8096;
/// <summary> /// <summary>
/// The default value for <see cref="PublicPortHttps"/> and <see cref="ServerPortNumberHttps"/>. /// The default value for <see cref="PublicHttpsPort"/> and <see cref="InternalHttpsPort"/>.
/// </summary> /// </summary>
public const int DefaultHttpsPort = 8920; public const int DefaultHttpsPort = 8920;
@ -79,28 +79,28 @@ namespace Jellyfin.Networking.Configuration
public string CertificatePassword { get; set; } = string.Empty; public string CertificatePassword { get; set; } = string.Empty;
/// <summary> /// <summary>
/// Gets or sets the HTTP server port number. /// Gets or sets the internal HTTP server port.
/// </summary> /// </summary>
/// <value>The HTTP server port number.</value> /// <value>The HTTP server port.</value>
public int ServerPortNumberHttp { get; set; } = DefaultHttpPort; public int InternalHttpPort { get; set; } = DefaultHttpPort;
/// <summary> /// <summary>
/// Gets or sets the HTTPS server port number. /// Gets or sets the internal HTTPS server port.
/// </summary> /// </summary>
/// <value>The HTTPS server port number.</value> /// <value>The HTTPS server port.</value>
public int ServerPortNumberHttps { get; set; } = DefaultHttpsPort; public int InternalHttpsPort { get; set; } = DefaultHttpsPort;
/// <summary> /// <summary>
/// Gets or sets the public mapped port. /// Gets or sets the public HTTP port.
/// </summary> /// </summary>
/// <value>The public mapped port.</value> /// <value>The public HTTP port.</value>
public int PublicPortHttp { get; set; } = DefaultHttpPort; public int PublicHttpPort { get; set; } = DefaultHttpPort;
/// <summary> /// <summary>
/// Gets or sets the public HTTPS port. /// Gets or sets the public HTTPS port.
/// </summary> /// </summary>
/// <value>The public HTTPS port.</value> /// <value>The public HTTPS port.</value>
public int PublicPortHttps { get; set; } = DefaultHttpsPort; public int PublicHttpsPort { get; set; } = DefaultHttpsPort;
/// <summary> /// <summary>
/// Gets or sets a value indicating whether Autodiscovery is enabled. /// Gets or sets a value indicating whether Autodiscovery is enabled.

View File

@ -57,17 +57,17 @@ public class MigrateNetworkConfiguration : IMigrationRoutine
networkConfiguration.EnableRemoteAccess = oldNetworkConfiguration.EnableRemoteAccess; networkConfiguration.EnableRemoteAccess = oldNetworkConfiguration.EnableRemoteAccess;
networkConfiguration.EnableUPnP = oldNetworkConfiguration.EnableUPnP; networkConfiguration.EnableUPnP = oldNetworkConfiguration.EnableUPnP;
networkConfiguration.IgnoreVirtualInterfaces = oldNetworkConfiguration.IgnoreVirtualInterfaces; networkConfiguration.IgnoreVirtualInterfaces = oldNetworkConfiguration.IgnoreVirtualInterfaces;
networkConfiguration.InternalHttpPort = oldNetworkConfiguration.HttpServerPortNumber;
networkConfiguration.InternalHttpsPort = oldNetworkConfiguration.HttpsPortNumber;
networkConfiguration.IsRemoteIPFilterBlacklist = oldNetworkConfiguration.IsRemoteIPFilterBlacklist; networkConfiguration.IsRemoteIPFilterBlacklist = oldNetworkConfiguration.IsRemoteIPFilterBlacklist;
networkConfiguration.KnownProxies = oldNetworkConfiguration.KnownProxies; networkConfiguration.KnownProxies = oldNetworkConfiguration.KnownProxies;
networkConfiguration.LocalNetworkAddresses = oldNetworkConfiguration.LocalNetworkAddresses; networkConfiguration.LocalNetworkAddresses = oldNetworkConfiguration.LocalNetworkAddresses;
networkConfiguration.LocalNetworkSubnets = oldNetworkConfiguration.LocalNetworkSubnets; networkConfiguration.LocalNetworkSubnets = oldNetworkConfiguration.LocalNetworkSubnets;
networkConfiguration.PublicPortHttp = oldNetworkConfiguration.PublicPort; networkConfiguration.PublicHttpPort = oldNetworkConfiguration.PublicPort;
networkConfiguration.PublicPortHttps = oldNetworkConfiguration.PublicHttpsPort; networkConfiguration.PublicHttpsPort = oldNetworkConfiguration.PublicHttpsPort;
networkConfiguration.PublishedServerUriBySubnet = oldNetworkConfiguration.PublishedServerUriBySubnet; networkConfiguration.PublishedServerUriBySubnet = oldNetworkConfiguration.PublishedServerUriBySubnet;
networkConfiguration.RemoteIPFilter = oldNetworkConfiguration.RemoteIPFilter; networkConfiguration.RemoteIPFilter = oldNetworkConfiguration.RemoteIPFilter;
networkConfiguration.RequireHttps = oldNetworkConfiguration.RequireHttps; networkConfiguration.RequireHttps = oldNetworkConfiguration.RequireHttps;
networkConfiguration.ServerPortNumberHttp = oldNetworkConfiguration.HttpServerPortNumber;
networkConfiguration.ServerPortNumberHttps = oldNetworkConfiguration.HttpsPortNumber;
// Migrate old virtual interface name schema // Migrate old virtual interface name schema
var oldVirtualInterfaceNames = oldNetworkConfiguration.VirtualInterfaceNames; var oldVirtualInterfaceNames = oldNetworkConfiguration.VirtualInterfaceNames;