mirror of
				https://github.com/jellyfin/jellyfin.git
				synced 2025-11-04 03:27:21 -05:00 
			
		
		
		
	reverted
This commit is contained in:
		
							parent
							
								
									688e7c6a2d
								
							
						
					
					
						commit
						b9f0f4f53b
					
				@ -43,6 +43,8 @@ using Microsoft.OpenApi.Models;
 | 
				
			|||||||
using Swashbuckle.AspNetCore.SwaggerGen;
 | 
					using Swashbuckle.AspNetCore.SwaggerGen;
 | 
				
			||||||
using AuthenticationSchemes = Jellyfin.Api.Constants.AuthenticationSchemes;
 | 
					using AuthenticationSchemes = Jellyfin.Api.Constants.AuthenticationSchemes;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[assembly: InternalsVisibleTo("Jellyfin.Api.Tests")]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace Jellyfin.Server.Extensions
 | 
					namespace Jellyfin.Server.Extensions
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    /// <summary>
 | 
					    /// <summary>
 | 
				
			||||||
 | 
				
			|||||||
@ -36,12 +36,6 @@
 | 
				
			|||||||
    <CodeAnalysisRuleSet>../jellyfin.ruleset</CodeAnalysisRuleSet>
 | 
					    <CodeAnalysisRuleSet>../jellyfin.ruleset</CodeAnalysisRuleSet>
 | 
				
			||||||
  </PropertyGroup>
 | 
					  </PropertyGroup>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <ItemGroup>
 | 
					 | 
				
			||||||
    <AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute">
 | 
					 | 
				
			||||||
    <_Parameter1>Jellyfin.Api.Tests</_Parameter1>
 | 
					 | 
				
			||||||
    </AssemblyAttribute>
 | 
					 | 
				
			||||||
  </ItemGroup>
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
  <ItemGroup>
 | 
					  <ItemGroup>
 | 
				
			||||||
    <PackageReference Include="CommandLineParser" Version="2.8.0" />
 | 
					    <PackageReference Include="CommandLineParser" Version="2.8.0" />
 | 
				
			||||||
    <PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="5.0.0" />
 | 
					    <PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="5.0.0" />
 | 
				
			||||||
@ -79,4 +73,10 @@
 | 
				
			|||||||
    </None>
 | 
					    </None>
 | 
				
			||||||
  </ItemGroup>
 | 
					  </ItemGroup>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  <ItemGroup>
 | 
				
			||||||
 | 
					    <AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
 | 
				
			||||||
 | 
					      <_Parameter1>Jellyfin.Api.Tests</_Parameter1>
 | 
				
			||||||
 | 
					    </AssemblyAttribute>
 | 
				
			||||||
 | 
					  </ItemGroup>
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
</Project>
 | 
					</Project>
 | 
				
			||||||
 | 
				
			|||||||
@ -14,27 +14,6 @@ namespace Jellyfin.Api.Tests
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    public class ParseNetworkTests
 | 
					    public class ParseNetworkTests
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        private static IConfigurationManager GetMockConfig(NetworkConfiguration conf)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            var configManager = new Mock<IConfigurationManager>
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                CallBase = true
 | 
					 | 
				
			||||||
            };
 | 
					 | 
				
			||||||
            configManager.Setup(x => x.GetConfiguration(It.IsAny<string>())).Returns(conf);
 | 
					 | 
				
			||||||
            return (IConfigurationManager)configManager.Object;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        private static NetworkManager CreateNetworkManager()
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            var conf = new NetworkConfiguration()
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                EnableIPV6 = true,
 | 
					 | 
				
			||||||
                EnableIPV4 = true,
 | 
					 | 
				
			||||||
            };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            return new NetworkManager(GetMockConfig(conf), new NullLogger<NetworkManager>());
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /// <summary>
 | 
					        /// <summary>
 | 
				
			||||||
        /// Order of the result has always got to be hosts, then networks.
 | 
					        /// Order of the result has always got to be hosts, then networks.
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
@ -53,9 +32,11 @@ namespace Jellyfin.Api.Tests
 | 
				
			|||||||
            using var nm = CreateNetworkManager();
 | 
					            using var nm = CreateNetworkManager();
 | 
				
			||||||
            nm.SystemIP6Enabled = ip6;
 | 
					            nm.SystemIP6Enabled = ip6;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            var settings = new NetworkConfiguration();
 | 
					            var settings = new NetworkConfiguration
 | 
				
			||||||
            settings.EnableIPV4 = ip4;
 | 
					            {
 | 
				
			||||||
            settings.EnableIPV6 = ip6;
 | 
					                EnableIPV4 = ip4,
 | 
				
			||||||
 | 
					                EnableIPV6 = ip6
 | 
				
			||||||
 | 
					            };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            var result = match + ',';
 | 
					            var result = match + ',';
 | 
				
			||||||
            ForwardedHeadersOptions options = new ForwardedHeadersOptions();
 | 
					            ForwardedHeadersOptions options = new ForwardedHeadersOptions();
 | 
				
			||||||
@ -83,5 +64,26 @@ namespace Jellyfin.Api.Tests
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            Assert.True(string.Equals(sb.ToString(), result, StringComparison.OrdinalIgnoreCase), "Not matched: " + sb.ToString() + " does not match " + result);
 | 
					            Assert.True(string.Equals(sb.ToString(), result, StringComparison.OrdinalIgnoreCase), "Not matched: " + sb.ToString() + " does not match " + result);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        private static IConfigurationManager GetMockConfig(NetworkConfiguration conf)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            var configManager = new Mock<IConfigurationManager>
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                CallBase = true
 | 
				
			||||||
 | 
					            };
 | 
				
			||||||
 | 
					            configManager.Setup(x => x.GetConfiguration(It.IsAny<string>())).Returns(conf);
 | 
				
			||||||
 | 
					            return (IConfigurationManager)configManager.Object;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        private static NetworkManager CreateNetworkManager()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            var conf = new NetworkConfiguration()
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                EnableIPV6 = true,
 | 
				
			||||||
 | 
					                EnableIPV4 = true,
 | 
				
			||||||
 | 
					            };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            return new NetworkManager(GetMockConfig(conf), new NullLogger<NetworkManager>());
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user