aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Emby.Server.Implementations/ApplicationHost.cs18
-rw-r--r--Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs2
-rw-r--r--Emby.Server.Implementations/HttpServer/HttpListenerHost.cs6
-rw-r--r--Jellyfin.Server/Program.cs4
-rw-r--r--MediaBrowser.Controller/IServerApplicationHost.cs29
-rw-r--r--MediaBrowser.Model/Configuration/ServerConfiguration.cs35
-rw-r--r--MediaBrowser.Model/System/SystemInfo.cs4
7 files changed, 66 insertions, 32 deletions
diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs
index 33aec1a06..9655d9f5e 100644
--- a/Emby.Server.Implementations/ApplicationHost.cs
+++ b/Emby.Server.Implementations/ApplicationHost.cs
@@ -1144,7 +1144,7 @@ namespace Emby.Server.Implementations
InternalMetadataPath = ApplicationPaths.InternalMetadataPath,
CachePath = ApplicationPaths.CachePath,
HttpServerPortNumber = HttpPort,
- SupportsHttps = SupportsHttps,
+ SupportsHttps = ListenWithHttps || ServerConfigurationManager.Configuration.IsBehindProxy,
HttpsPortNumber = HttpsPort,
OperatingSystem = OperatingSystem.Id.ToString(),
OperatingSystemDisplayName = OperatingSystem.Name,
@@ -1181,10 +1181,10 @@ namespace Emby.Server.Implementations
};
}
- public bool EnableHttps => SupportsHttps && ServerConfigurationManager.Configuration.EnableHttps;
-
- public bool SupportsHttps => Certificate != null || ServerConfigurationManager.Configuration.IsBehindProxy;
+ /// <inheritdoc/>
+ public bool ListenWithHttps => Certificate != null && ServerConfigurationManager.Configuration.EnableHttps;
+ /// <inheritdoc/>
public async Task<string> GetLocalApiUrl(CancellationToken cancellationToken)
{
try
@@ -1240,14 +1240,14 @@ namespace Emby.Server.Implementations
return GetLocalApiUrl(ipAddress.ToString());
}
- /// <inheritdoc />
+ /// <inheritdoc/>
public string GetLocalApiUrl(ReadOnlySpan<char> host)
{
var url = new StringBuilder(64);
- url.Append(EnableHttps ? "https://" : "http://")
+ url.Append(ListenWithHttps ? "https://" : "http://")
.Append(host)
.Append(':')
- .Append(EnableHttps ? HttpsPort : HttpPort);
+ .Append(ListenWithHttps ? HttpsPort : HttpPort);
string baseUrl = ServerConfigurationManager.Configuration.BaseUrl;
if (baseUrl.Length != 0)
@@ -1289,7 +1289,7 @@ namespace Emby.Server.Implementations
}
}
- var valid = await IsIpAddressValidAsync(address, cancellationToken).ConfigureAwait(false);
+ var valid = await IsLocalIpAddressValidAsync(address, cancellationToken).ConfigureAwait(false);
if (valid)
{
resultList.Add(address);
@@ -1323,7 +1323,7 @@ namespace Emby.Server.Implementations
private readonly ConcurrentDictionary<string, bool> _validAddressResults = new ConcurrentDictionary<string, bool>(StringComparer.OrdinalIgnoreCase);
- private async Task<bool> IsIpAddressValidAsync(IPAddress address, CancellationToken cancellationToken)
+ private async Task<bool> IsLocalIpAddressValidAsync(IPAddress address, CancellationToken cancellationToken)
{
if (address.Equals(IPAddress.Loopback)
|| address.Equals(IPAddress.IPv6Loopback))
diff --git a/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs b/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs
index 37d7fd479..adec9dbe2 100644
--- a/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs
+++ b/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs
@@ -64,7 +64,7 @@ namespace Emby.Server.Implementations.EntryPoints
.Append(config.PublicHttpsPort).Append(Separator)
.Append(_appHost.HttpPort).Append(Separator)
.Append(_appHost.HttpsPort).Append(Separator)
- .Append(_appHost.EnableHttps).Append(Separator)
+ .Append(_appHost.ListenWithHttps).Append(Separator)
.Append(config.EnableRemoteAccess).Append(Separator)
.ToString();
}
diff --git a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs
index 211a0c1d9..01813fac1 100644
--- a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs
+++ b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs
@@ -424,9 +424,13 @@ namespace Emby.Server.Implementations.HttpServer
return true;
}
+ /// <summary>
+ /// Validate a connection from a remote IP address to a URL to see if a redirection to HTTPS is required.
+ /// </summary>
+ /// <returns>True if the request is valid, or false if the request is not valid and an HTTPS redirect is required.</returns>
private bool ValidateSsl(string remoteIp, string urlString)
{
- if (_config.Configuration.RequireHttps && _appHost.EnableHttps && !_config.Configuration.IsBehindProxy)
+ if (_config.Configuration.RequireHttps && _appHost.ListenWithHttps)
{
if (urlString.IndexOf("https://", StringComparison.OrdinalIgnoreCase) == -1)
{
diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.cs
index 193d30e3a..7aa238efa 100644
--- a/Jellyfin.Server/Program.cs
+++ b/Jellyfin.Server/Program.cs
@@ -273,7 +273,7 @@ namespace Jellyfin.Server
_logger.LogInformation("Kestrel listening on {IpAddress}", address);
options.Listen(address, appHost.HttpPort);
- if (appHost.EnableHttps && appHost.Certificate != null)
+ if (appHost.ListenWithHttps)
{
options.Listen(address, appHost.HttpsPort, listenOptions =>
{
@@ -296,7 +296,7 @@ namespace Jellyfin.Server
_logger.LogInformation("Kestrel listening on all interfaces");
options.ListenAnyIP(appHost.HttpPort);
- if (appHost.EnableHttps && appHost.Certificate != null)
+ if (appHost.ListenWithHttps)
{
options.ListenAnyIP(appHost.HttpsPort, listenOptions =>
{
diff --git a/MediaBrowser.Controller/IServerApplicationHost.cs b/MediaBrowser.Controller/IServerApplicationHost.cs
index 608ffc61c..8537e4180 100644
--- a/MediaBrowser.Controller/IServerApplicationHost.cs
+++ b/MediaBrowser.Controller/IServerApplicationHost.cs
@@ -39,10 +39,9 @@ namespace MediaBrowser.Controller
int HttpsPort { get; }
/// <summary>
- /// Gets a value indicating whether [supports HTTPS].
+ /// Gets a value indicating whether the server should listen on an HTTPS port.
/// </summary>
- /// <value><c>true</c> if [supports HTTPS]; otherwise, <c>false</c>.</value>
- bool EnableHttps { get; }
+ bool ListenWithHttps { get; }
/// <summary>
/// Gets a value indicating whether this instance has update available.
@@ -57,29 +56,33 @@ namespace MediaBrowser.Controller
string FriendlyName { get; }
/// <summary>
- /// Gets the local ip address.
+ /// Gets all the local IP addresses of this API instance. Each address is validated by sending a 'ping' request
+ /// to the API that should exist at the address.
/// </summary>
- /// <value>The local ip address.</value>
+ /// <param name="cancellationToken">A cancellation token that can be used to cancel the task.</param>
+ /// <returns>A list containing all the local IP addresses of the server.</returns>
Task<List<IPAddress>> GetLocalIpAddresses(CancellationToken cancellationToken);
/// <summary>
- /// Gets the local API URL.
+ /// Gets a local (LAN) URL that can be used to access the API. The hostname used is the first valid configured
+ /// IP address that can be found via <see cref="GetLocalIpAddresses"/>.
/// </summary>
- /// <value>The local API URL.</value>
+ /// <param name="cancellationToken">A cancellation token that can be used to cancel the task.</param>
+ /// <returns>The server URL.</returns>
Task<string> GetLocalApiUrl(CancellationToken cancellationToken);
/// <summary>
- /// Gets the local API URL.
+ /// Gets a local (LAN) URL that can be used to access the API.
/// </summary>
- /// <param name="hostname">The hostname.</param>
- /// <returns>The local API URL.</returns>
+ /// <param name="hostname">The hostname to use in the URL.</param>
+ /// <returns>The API URL.</returns>
string GetLocalApiUrl(ReadOnlySpan<char> hostname);
/// <summary>
- /// Gets the local API URL.
+ /// Gets a local (LAN) URL that can be used to access the API.
/// </summary>
- /// <param name="address">The IP address.</param>
- /// <returns>The local API URL.</returns>
+ /// <param name="address">The IP address to use as the hostname in the URL.</param>
+ /// <returns>The API URL.</returns>
string GetLocalApiUrl(IPAddress address);
/// <summary>
diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs
index b5e8d5589..6ee6a1f93 100644
--- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs
+++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs
@@ -44,17 +44,24 @@ namespace MediaBrowser.Model.Configuration
public int HttpsPortNumber { get; set; }
/// <summary>
- /// Gets or sets a value indicating whether [use HTTPS].
+ /// Gets or sets a value indicating whether to use HTTPS.
/// </summary>
- /// <value><c>true</c> if [use HTTPS]; otherwise, <c>false</c>.</value>
+ /// <remarks>
+ /// In order for HTTPS to be used, in addition to setting this to true, valid values must also be
+ /// provided for <see cref="CertificatePath"/> and <see cref="CertificatePassword"/>.
+ /// </remarks>
public bool EnableHttps { get; set; }
+
public bool EnableNormalizedItemByNameIds { get; set; }
/// <summary>
- /// Gets or sets the value pointing to the file system where the ssl certificate is located..
+ /// Gets or sets the filesystem path of an X.509 certificate to use for SSL.
/// </summary>
- /// <value>The value pointing to the file system where the ssl certificate is located..</value>
public string CertificatePath { get; set; }
+
+ /// <summary>
+ /// Gets or sets the password required to access the X.509 certificate data in the file specified by <see cref="CertificatePath"/>.
+ /// </summary>
public string CertificatePassword { get; set; }
/// <summary>
@@ -64,8 +71,11 @@ namespace MediaBrowser.Model.Configuration
public bool IsPortAuthorized { get; set; }
public bool AutoRunWebApp { get; set; }
+
public bool EnableRemoteAccess { get; set; }
+
public bool CameraUploadUpgraded { get; set; }
+
public bool CollectionsUpgraded { get; set; }
/// <summary>
@@ -81,6 +91,7 @@ namespace MediaBrowser.Model.Configuration
/// </summary>
/// <value>The metadata path.</value>
public string MetadataPath { get; set; }
+
public string MetadataNetworkPath { get; set; }
/// <summary>
@@ -203,15 +214,31 @@ namespace MediaBrowser.Model.Configuration
public int RemoteClientBitrateLimit { get; set; }
public bool EnableFolderView { get; set; }
+
public bool EnableGroupingIntoCollections { get; set; }
+
public bool DisplaySpecialsWithinSeasons { get; set; }
+
public string[] LocalNetworkSubnets { get; set; }
+
public string[] LocalNetworkAddresses { get; set; }
+
public string[] CodecsUsed { get; set; }
+
public bool IgnoreVirtualInterfaces { get; set; }
+
public bool EnableExternalContentInSuggestions { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether the server should force connections over HTTPS.
+ /// </summary>
public bool RequireHttps { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether the server is behind a reverse proxy.
+ /// </summary>
public bool IsBehindProxy { get; set; }
+
public bool EnableNewOmdbSupport { get; set; }
public string[] RemoteIPFilter { get; set; }
diff --git a/MediaBrowser.Model/System/SystemInfo.cs b/MediaBrowser.Model/System/SystemInfo.cs
index 3d543039e..9753f4e06 100644
--- a/MediaBrowser.Model/System/SystemInfo.cs
+++ b/MediaBrowser.Model/System/SystemInfo.cs
@@ -122,9 +122,9 @@ namespace MediaBrowser.Model.System
public int HttpServerPortNumber { get; set; }
/// <summary>
- /// Gets or sets a value indicating whether [enable HTTPS].
+ /// Gets or sets a value indicating whether a client can connect to the server over HTTPS, either directly or
+ /// via a reverse proxy.
/// </summary>
- /// <value><c>true</c> if [enable HTTPS]; otherwise, <c>false</c>.</value>
public bool SupportsHttps { get; set; }
/// <summary>