mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-24 02:02:36 -04:00
Fix warnings
This commit is contained in:
parent
31d8f5f7b9
commit
95ccceb259
@ -61,12 +61,12 @@ namespace Kyoo.Authentication
|
||||
/// <inheritdoc />
|
||||
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()
|
||||
|
@ -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<string>(apiKey))
|
||||
if (!_options.ApiKeys.Contains<string>(apiKey!))
|
||||
return AuthenticateResult.Fail("Invalid API-Key.");
|
||||
return AuthenticateResult.Success(
|
||||
new AuthenticationTicket(
|
||||
|
@ -196,7 +196,7 @@ namespace Kyoo.Tests.Database
|
||||
{
|
||||
string slug = TestSample.Get<T>().Slug[2..4];
|
||||
ICollection<T> ret = await _repository.GetAll(x => x.Slug.Contains(slug));
|
||||
Assert.Equal(1, ret.Count);
|
||||
Assert.Single(ret);
|
||||
KAssert.DeepEqual(TestSample.Get<T>(), ret.First());
|
||||
}
|
||||
|
||||
|
@ -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<Provider>().Slug, retrieved.Providers.First().Slug);
|
||||
}
|
||||
|
||||
|
@ -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());
|
||||
|
@ -414,7 +414,7 @@ namespace Kyoo.Tests.Utility
|
||||
};
|
||||
IDictionary<int, string> 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]);
|
||||
}
|
||||
|
||||
|
12
shell.nix
12
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}";
|
||||
|
Loading…
x
Reference in New Issue
Block a user