diff --git a/back/src/Kyoo.Authentication/AuthenticationModule.cs b/back/src/Kyoo.Authentication/AuthenticationModule.cs index cd6f154f..8214c101 100644 --- a/back/src/Kyoo.Authentication/AuthenticationModule.cs +++ b/back/src/Kyoo.Authentication/AuthenticationModule.cs @@ -61,12 +61,12 @@ namespace Kyoo.Authentication /// public void Configure(IServiceCollection services) { - string secret = _configuration.GetValue("AUTHENTICATION_SECRET", AuthenticationOption.DefaultSecret); + string secret = _configuration.GetValue("AUTHENTICATION_SECRET", AuthenticationOption.DefaultSecret)!; PermissionOption permissions = new() { - Default = _configuration.GetValue("UNLOGGED_PERMISSIONS", "overall.read").Split(','), - NewUser = _configuration.GetValue("DEFAULT_PERMISSIONS", "overall.read").Split(','), - ApiKeys = _configuration.GetValue("KYOO_APIKEYS", string.Empty).Split(','), + Default = _configuration.GetValue("UNLOGGED_PERMISSIONS", "overall.read")!.Split(','), + NewUser = _configuration.GetValue("DEFAULT_PERMISSIONS", "overall.read")!.Split(','), + ApiKeys = _configuration.GetValue("KYOO_APIKEYS", string.Empty)!.Split(','), }; services.AddSingleton(permissions); services.AddSingleton(new AuthenticationOption() diff --git a/back/src/Kyoo.Authentication/Controllers/PermissionValidator.cs b/back/src/Kyoo.Authentication/Controllers/PermissionValidator.cs index e5b4fa48..9e238045 100644 --- a/back/src/Kyoo.Authentication/Controllers/PermissionValidator.cs +++ b/back/src/Kyoo.Authentication/Controllers/PermissionValidator.cs @@ -198,7 +198,7 @@ namespace Kyoo.Authentication { if (!context.HttpContext.Request.Headers.TryGetValue("X-API-Key", out StringValues apiKey)) return AuthenticateResult.NoResult(); - if (!_options.ApiKeys.Contains(apiKey)) + if (!_options.ApiKeys.Contains(apiKey!)) return AuthenticateResult.Fail("Invalid API-Key."); return AuthenticateResult.Success( new AuthenticationTicket( diff --git a/back/tests/Kyoo.Tests/Database/RepositoryTests.cs b/back/tests/Kyoo.Tests/Database/RepositoryTests.cs index ff891a55..8e7acc03 100644 --- a/back/tests/Kyoo.Tests/Database/RepositoryTests.cs +++ b/back/tests/Kyoo.Tests/Database/RepositoryTests.cs @@ -196,7 +196,7 @@ namespace Kyoo.Tests.Database { string slug = TestSample.Get().Slug[2..4]; ICollection ret = await _repository.GetAll(x => x.Slug.Contains(slug)); - Assert.Equal(1, ret.Count); + Assert.Single(ret); KAssert.DeepEqual(TestSample.Get(), ret.First()); } diff --git a/back/tests/Kyoo.Tests/Database/SpecificTests/LibraryTests.cs b/back/tests/Kyoo.Tests/Database/SpecificTests/LibraryTests.cs index 2c7cc9e6..57a7deea 100644 --- a/back/tests/Kyoo.Tests/Database/SpecificTests/LibraryTests.cs +++ b/back/tests/Kyoo.Tests/Database/SpecificTests/LibraryTests.cs @@ -91,7 +91,7 @@ namespace Kyoo.Tests.Database await _repository.Create(library); Library retrieved = await _repository.Get(2); await Repositories.LibraryManager.Load(retrieved, x => x.Providers); - Assert.Equal(1, retrieved.Providers.Count); + Assert.Single(retrieved.Providers); Assert.Equal(TestSample.Get().Slug, retrieved.Providers.First().Slug); } diff --git a/back/tests/Kyoo.Tests/Database/SpecificTests/ShowTests.cs b/back/tests/Kyoo.Tests/Database/SpecificTests/ShowTests.cs index 91be9da9..5d24ff39 100644 --- a/back/tests/Kyoo.Tests/Database/SpecificTests/ShowTests.cs +++ b/back/tests/Kyoo.Tests/Database/SpecificTests/ShowTests.cs @@ -316,7 +316,7 @@ namespace Kyoo.Tests.Database .ThenInclude(x => x.Provider) .FirstAsync(x => x.ID == created.ID); KAssert.DeepEqual(expected, retrieved); - Assert.Equal(1, retrieved.ExternalIDs.Count); + Assert.Single(retrieved.ExternalIDs); Assert.Equal("ID", retrieved.ExternalIDs.First().DataID); } @@ -362,8 +362,8 @@ namespace Kyoo.Tests.Database await Repositories.LibraryManager.Load(show, x => x.Seasons); await Repositories.LibraryManager.Load(show, x => x.Episodes); Assert.Equal(1, await _repository.GetCount()); - Assert.Equal(1, show.Seasons.Count); - Assert.Equal(1, show.Episodes.Count); + Assert.Single(show.Seasons); + Assert.Single(show.Episodes); await _repository.Delete(show); Assert.Equal(0, await Repositories.LibraryManager.ShowRepository.GetCount()); Assert.Equal(0, await Repositories.LibraryManager.SeasonRepository.GetCount()); diff --git a/back/tests/Kyoo.Tests/Utility/MergerTests.cs b/back/tests/Kyoo.Tests/Utility/MergerTests.cs index dd9c71a2..810e68c9 100644 --- a/back/tests/Kyoo.Tests/Utility/MergerTests.cs +++ b/back/tests/Kyoo.Tests/Utility/MergerTests.cs @@ -414,7 +414,7 @@ namespace Kyoo.Tests.Utility }; IDictionary ret = Merger.CompleteDictionaries(first, second, out bool changed); Assert.True(changed); - Assert.Equal(1, ret.Count); + Assert.Single(ret); Assert.Equal("new-poster", ret[Images.Poster]); } diff --git a/shell.nix b/shell.nix index b14ef34d..9e60002d 100644 --- a/shell.nix +++ b/shell.nix @@ -10,8 +10,8 @@ in nodePackages.expo-cli (with dotnetCorePackages; combinePackages [ - sdk_6_0 - aspnetcore_6_0 + sdk_7_0 + aspnetcore_7_0 ]) python3 python3Packages.pip @@ -19,10 +19,10 @@ in cargo-watch rustfmt rustc - pkgconfig - openssl - mediainfo - ffmpeg + pkgconfig + openssl + mediainfo + ffmpeg ]; RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";