From a25e3c02568b5632278e23d6168efa927b29eda9 Mon Sep 17 00:00:00 2001 From: BaronGreenback Date: Sat, 27 Feb 2021 13:56:21 +0000 Subject: [PATCH 1/4] fix for override ports contained in PublishedServerUrl --- Emby.Dlna/Main/DlnaEntryPoint.cs | 9 ++++++--- Emby.Server.Implementations/ApplicationHost.cs | 10 ++++++++++ MediaBrowser.Controller/IServerApplicationHost.cs | 5 +++++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Emby.Dlna/Main/DlnaEntryPoint.cs b/Emby.Dlna/Main/DlnaEntryPoint.cs index 82490ec310..2652e62457 100644 --- a/Emby.Dlna/Main/DlnaEntryPoint.cs +++ b/Emby.Dlna/Main/DlnaEntryPoint.cs @@ -313,9 +313,12 @@ namespace Emby.Dlna.Main _logger.LogInformation("Registering publisher for {0} on {1}", fullService, address); 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.HttpServerPortNumber; + if (string.IsNullOrEmpty(_appHost.PublishedServerUrl)) + { + // DLNA will only work over http, so we must reset to http:// : {port}. + uri.Scheme = "http"; + uri.Port = _netConfig.HttpServerPortNumber; + } var device = new SsdpRootDevice { diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index 1b9bb86bbd..604f699862 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -135,6 +135,11 @@ namespace Emby.Server.Implementations public bool CoreStartupHasCompleted { get; private set; } + /// + /// Gets a value indicating whether this instance has a custom published url. + /// + public Uri PublishedServerUrl => _startupOptions.PublishedServerUrl; + public virtual bool CanLaunchWebBrowser { get @@ -1141,6 +1146,11 @@ namespace Emby.Server.Implementations /// public bool ListenWithHttps => Certificate != null && ServerConfigurationManager.GetNetworkConfiguration().EnableHttps; + public string GetStartupOption(string propName) + { + return _startupOptions.GetType().GetProperty(propName).GetValue(src, null); + } + /// public string GetSmartApiUrl(IPAddress ipAddress, int? port = null) { diff --git a/MediaBrowser.Controller/IServerApplicationHost.cs b/MediaBrowser.Controller/IServerApplicationHost.cs index 92b2d43ce2..b6f049391f 100644 --- a/MediaBrowser.Controller/IServerApplicationHost.cs +++ b/MediaBrowser.Controller/IServerApplicationHost.cs @@ -52,6 +52,11 @@ namespace MediaBrowser.Controller /// The name of the friendly. string FriendlyName { get; } + /// + /// Gets a value indicating whether this instance has a custom published url. + /// + Uri PublishedServerUrl { get; } + /// /// Gets the system info. /// From d95ca20fc731cf51e060c7ba6802821b6dd8c48f Mon Sep 17 00:00:00 2001 From: BaronGreenback Date: Sat, 27 Feb 2021 14:05:13 +0000 Subject: [PATCH 2/4] removed bad merge code --- Emby.Dlna/Main/DlnaEntryPoint.cs | 2 +- Emby.Server.Implementations/ApplicationHost.cs | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/Emby.Dlna/Main/DlnaEntryPoint.cs b/Emby.Dlna/Main/DlnaEntryPoint.cs index 2652e62457..797045857f 100644 --- a/Emby.Dlna/Main/DlnaEntryPoint.cs +++ b/Emby.Dlna/Main/DlnaEntryPoint.cs @@ -313,7 +313,7 @@ namespace Emby.Dlna.Main _logger.LogInformation("Registering publisher for {0} on {1}", fullService, address); var uri = new UriBuilder(_appHost.GetSmartApiUrl(address.Address) + descriptorUri); - if (string.IsNullOrEmpty(_appHost.PublishedServerUrl)) + if (_appHost.PublishedServerUrl == null) { // DLNA will only work over http, so we must reset to http:// : {port}. uri.Scheme = "http"; diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index 604f699862..56aa5a007f 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -1146,11 +1146,6 @@ namespace Emby.Server.Implementations /// public bool ListenWithHttps => Certificate != null && ServerConfigurationManager.GetNetworkConfiguration().EnableHttps; - public string GetStartupOption(string propName) - { - return _startupOptions.GetType().GetProperty(propName).GetValue(src, null); - } - /// public string GetSmartApiUrl(IPAddress ipAddress, int? port = null) { From 9f03064ad890395aedb7617d0c65a4a4197a1198 Mon Sep 17 00:00:00 2001 From: BaronGreenback Date: Sat, 27 Feb 2021 17:34:44 +0000 Subject: [PATCH 3/4] Update MediaBrowser.Controller/IServerApplicationHost.cs Co-authored-by: Cody Robibero --- MediaBrowser.Controller/IServerApplicationHost.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MediaBrowser.Controller/IServerApplicationHost.cs b/MediaBrowser.Controller/IServerApplicationHost.cs index b6f049391f..6378625e87 100644 --- a/MediaBrowser.Controller/IServerApplicationHost.cs +++ b/MediaBrowser.Controller/IServerApplicationHost.cs @@ -53,7 +53,7 @@ namespace MediaBrowser.Controller string FriendlyName { get; } /// - /// Gets a value indicating whether this instance has a custom published url. + /// Gets the configured published server url. /// Uri PublishedServerUrl { get; } From 73ca367bf9419b47e6be9487971bce90aec6b82d Mon Sep 17 00:00:00 2001 From: BaronGreenback Date: Sat, 27 Feb 2021 17:34:48 +0000 Subject: [PATCH 4/4] Update Emby.Server.Implementations/ApplicationHost.cs Co-authored-by: Cody Robibero --- Emby.Server.Implementations/ApplicationHost.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index 56aa5a007f..cddd600791 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -135,9 +135,7 @@ namespace Emby.Server.Implementations public bool CoreStartupHasCompleted { get; private set; } - /// - /// Gets a value indicating whether this instance has a custom published url. - /// + /// public Uri PublishedServerUrl => _startupOptions.PublishedServerUrl; public virtual bool CanLaunchWebBrowser