From be9663ae896dd28aa9a455469391f0304cc73a5f Mon Sep 17 00:00:00 2001 From: cvium Date: Tue, 7 Sep 2021 10:27:55 +0200 Subject: [PATCH] Use GetSmartApiUrl instead (hopefully it works) --- Emby.Server.Implementations/ApplicationHost.cs | 9 +-------- tests/Jellyfin.Networking.Tests/NetworkParseTests.cs | 8 ++++---- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index c244e7cfa4..da99ea647e 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -1186,14 +1186,7 @@ namespace Emby.Server.Implementations } /// - public string GetUrlForUseByHttpApi() - { - // GetBindInterfaces will return an interface. - var bind = NetManager.GetInternalBindAddresses().FirstOrDefault() ?? - NetManager.GetAllBindInterfaces(true).First(); - - return GetLocalApiUrl(bind.Address.ToString(), Uri.UriSchemeHttp); - } + public string GetUrlForUseByHttpApi() => GetSmartApiUrl(string.Empty); /// public string GetLocalApiUrl(string hostname, string scheme = null, int? port = null) diff --git a/tests/Jellyfin.Networking.Tests/NetworkParseTests.cs b/tests/Jellyfin.Networking.Tests/NetworkParseTests.cs index 170f0279fd..b7385fde8b 100644 --- a/tests/Jellyfin.Networking.Tests/NetworkParseTests.cs +++ b/tests/Jellyfin.Networking.Tests/NetworkParseTests.cs @@ -482,9 +482,9 @@ namespace Jellyfin.Networking.Tests [InlineData("192.168.1.208/24,-16,eth16|10.0.0.1/24,10,eth7", "192.168.1.0/24", "", "192.168.1.208")] // LAN address is specified by default. [InlineData("192.168.1.208/24,-16,eth16|10.0.0.1/24,10,eth7", "192.168.1.0/24", "10.0.0.1", "10.0.0.1")] // return bind address - public void Get_Appropriate_Interface_NoSource(string interfaces, string lan, string bind, string result) + public void GetBindInterface_NoSourceGiven_Success(string interfaces, string lan, string bind, string result) { - var conf = new NetworkConfiguration() + var conf = new NetworkConfiguration { EnableIPV4 = true, LocalNetworkSubnets = lan.Split(','), @@ -506,9 +506,9 @@ namespace Jellyfin.Networking.Tests [InlineData("192.168.1.208/24,-16,eth16|10.0.0.1/24,10,eth7", "192.168.1.0/24", "10.0.0.1", "192.168.1.209", "10.0.0.1")] // LAN not bound, so return external. [InlineData("192.168.1.208/24,-16,eth16|10.0.0.1/24,10,eth7", "192.168.1.0/24", "192.168.1.208,10.0.0.1", "8.8.8.8", "10.0.0.1")] // return external bind address [InlineData("192.168.1.208/24,-16,eth16|10.0.0.1/24,10,eth7", "192.168.1.0/24", "192.168.1.208,10.0.0.1", "192.168.1.210", "192.168.1.208")] // return LAN bind address - public void Get_Appropriate_Interface_ForSource(string interfaces, string lan, string bind, string source, string result) + public void GetBindInterface_ValidSourceGiven_Success(string interfaces, string lan, string bind, string source, string result) { - var conf = new NetworkConfiguration() + var conf = new NetworkConfiguration { EnableIPV4 = true, LocalNetworkSubnets = lan.Split(','),