aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Emby.Dlna/Main/DlnaEntryPoint.cs23
-rw-r--r--Emby.Server.Implementations/ApplicationHost.cs6
-rw-r--r--Jellyfin.Networking/Configuration/NetworkConfiguration.cs6
-rw-r--r--Jellyfin.Networking/Manager/NetworkManager.cs2
4 files changed, 28 insertions, 9 deletions
diff --git a/Emby.Dlna/Main/DlnaEntryPoint.cs b/Emby.Dlna/Main/DlnaEntryPoint.cs
index fb4454a34..ced56a718 100644
--- a/Emby.Dlna/Main/DlnaEntryPoint.cs
+++ b/Emby.Dlna/Main/DlnaEntryPoint.cs
@@ -9,6 +9,7 @@ using System.Threading;
using System.Threading.Tasks;
using Emby.Dlna.PlayTo;
using Emby.Dlna.Ssdp;
+using Jellyfin.Networking.Configuration;
using Jellyfin.Networking.Manager;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Extensions;
@@ -52,6 +53,8 @@ namespace Emby.Dlna.Main
private readonly ISocketFactory _socketFactory;
private readonly INetworkManager _networkManager;
private readonly object _syncLock = new object();
+ private readonly NetworkConfiguration _netConfig;
+ private readonly bool _disabled;
private PlayToManager _manager;
private SsdpDevicePublisher _publisher;
@@ -122,6 +125,13 @@ namespace Emby.Dlna.Main
httpClientFactory,
config);
Current = this;
+
+ _netConfig = config.GetConfiguration<NetworkConfiguration>("network");
+ _disabled = appHost.ListenWithHttps && _netConfig.RequireHttps;
+ if (_disabled)
+ {
+ _logger.LogError("The DLNA specification does not support HTTPS.");
+ }
}
public static DlnaEntryPoint Current { get; private set; }
@@ -136,6 +146,12 @@ namespace Emby.Dlna.Main
{
await ((DlnaManager)_dlnaManager).InitProfilesAsync().ConfigureAwait(false);
+ if (_disabled)
+ {
+ // No use starting as dlna won't work, as we're running purely on HTTPS.
+ return;
+ }
+
ReloadComponents();
_config.NamedConfigurationUpdated += OnNamedConfigurationUpdated;
@@ -290,12 +306,15 @@ namespace Emby.Dlna.Main
_logger.LogInformation("Registering publisher for {0} on {1}", fullService, address);
- var uri = new Uri(_appHost.GetSmartApiUrl(address.Address) + descriptorUri);
+ var uri = new UriBuilder(_appHost.GetSmartApiUrl(address.Address) + descriptorUri);
+ // DLNA will only work over http, so we must reset to http:// : {port}
+ uri.Scheme = "http://";
+ uri.Port = _netConfig.PublicPort;
var device = new SsdpRootDevice
{
CacheLifetime = TimeSpan.FromSeconds(1800), // How long SSDP clients can cache this info.
- Location = uri, // Must point to the URL that serves your devices UPnP description document.
+ Location = uri.Uri, // Must point to the URL that serves your devices UPnP description document.
Address = address.Address,
PrefixLength = address.PrefixLength,
FriendlyName = "Jellyfin",
diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs
index d74ea0352..b6f63e565 100644
--- a/Emby.Server.Implementations/ApplicationHost.cs
+++ b/Emby.Server.Implementations/ApplicationHost.cs
@@ -496,7 +496,7 @@ namespace Emby.Server.Implementations
{
var networkConfiguration = ServerConfigurationManager.GetNetworkConfiguration();
HttpPort = networkConfiguration.HttpServerPortNumber;
- HttpsPort = networkConfiguration.HttpsPortNumber;
+ HttpsPort = networkConfiguration.HttpsServerPortNumber;
// Safeguard against invalid configuration
if (HttpPort == HttpsPort)
@@ -714,7 +714,7 @@ namespace Emby.Server.Implementations
// Don't use an empty string password
var password = string.IsNullOrWhiteSpace(info.Password) ? null : info.Password;
- var localCert = new X509Certificate2(certificateLocation, password);
+ var localCert = new X509Certificate2(certificateLocation, password, X509KeyStorageFlags.UserKeySet);
// localCert.PrivateKey = PrivateKey.CreateFromFile(pvk_file).RSA;
if (!localCert.HasPrivateKey)
{
@@ -919,7 +919,7 @@ namespace Emby.Server.Implementations
var networkConfiguration = ServerConfigurationManager.GetNetworkConfiguration();
// Need to restart if ports have changed
if (networkConfiguration.HttpServerPortNumber != HttpPort ||
- networkConfiguration.HttpsPortNumber != HttpsPort)
+ networkConfiguration.HttpsServerPortNumber != HttpsPort)
{
if (ServerConfigurationManager.Configuration.IsPortAuthorized)
{
diff --git a/Jellyfin.Networking/Configuration/NetworkConfiguration.cs b/Jellyfin.Networking/Configuration/NetworkConfiguration.cs
index df420f48a..8db3d3a9c 100644
--- a/Jellyfin.Networking/Configuration/NetworkConfiguration.cs
+++ b/Jellyfin.Networking/Configuration/NetworkConfiguration.cs
@@ -16,7 +16,7 @@ namespace Jellyfin.Networking.Configuration
public const int DefaultHttpPort = 8096;
/// <summary>
- /// The default value for <see cref="PublicHttpsPort"/> and <see cref="HttpsPortNumber"/>.
+ /// The default value for <see cref="PublicHttpsPort"/> and <see cref="HttpsServerPortNumber"/>.
/// </summary>
public const int DefaultHttpsPort = 8920;
@@ -76,7 +76,7 @@ namespace Jellyfin.Networking.Configuration
/// Gets or sets the HTTPS server port number.
/// </summary>
/// <value>The HTTPS server port number.</value>
- public int HttpsPortNumber { get; set; } = DefaultHttpsPort;
+ public int HttpsServerPortNumber { get; set; } = DefaultHttpsPort;
/// <summary>
/// Gets or sets a value indicating whether to use HTTPS.
@@ -88,7 +88,7 @@ namespace Jellyfin.Networking.Configuration
public bool EnableHttps { get; set; }
/// <summary>
- /// Gets or sets the public mapped port.
+ /// Gets or sets the Upublic mapped port.
/// </summary>
/// <value>The public mapped port.</value>
public int PublicPort { get; set; } = DefaultHttpPort;
diff --git a/Jellyfin.Networking/Manager/NetworkManager.cs b/Jellyfin.Networking/Manager/NetworkManager.cs
index 85da927fb..a76ba49b6 100644
--- a/Jellyfin.Networking/Manager/NetworkManager.cs
+++ b/Jellyfin.Networking/Manager/NetworkManager.cs
@@ -784,7 +784,7 @@ namespace Jellyfin.Networking.Manager
}
else
{
- _logger.LogDebug("Invalid or unknown network {Token}.", token);
+ _logger.LogDebug("Invalid or unknown object {Token}.", token);
}
}