Skip to content

Kavita is a fast, feature rich, cross platform reading server. Built with the goal of being a full solution for all your reading needs. Setup your own server and share your reading collection with your friends and family.

v0.7.2 - Reading Lists, CBL Support, OPDS Flattening and More! (#1959)

Joe Milazzo006e67af98b1
diff --git a/.github/workflows/sonar-scan.yml b/.github/workflows/sonar-scan.yml
index 3b73a11a8..ad33f1c28 100644
--- a/.github/workflows/sonar-scan.yml
+++ b/.github/workflows/sonar-scan.yml
@@ -2,30 +2,37 @@ name: .NET Build Test and Sonar Scan
on:
push:
- branches: '*'
+ branches: '**'
pull_request:
branches: [ main, develop ]
types: [synchronize]
- workflow_dispatch:
-
+
jobs:
+ check_pr:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Check PR Body
+ uses: JJ/github-pr-contains-action@releases/v10
+ with:
+ github-token: ${{ secrets.GITHUB_TOKEN }}
+ bodyDoesNotContain: "[\"|`]"
build:
name: Build .Net
runs-on: windows-latest
steps:
- name: Checkout Repo
- uses: actions/checkout@v2
+ uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup .NET Core
- uses: actions/setup-dotnet@v2
+ uses: actions/setup-dotnet@v3
with:
- dotnet-version: 6.0.x
+ dotnet-version: 7.0.x
- name: Install Swashbuckle CLI
shell: powershell
- run: dotnet tool install -g --version 6.4.0 Swashbuckle.AspNetCore.Cli
+ run: dotnet tool install -g --version 6.5.0 Swashbuckle.AspNetCore.Cli
- name: Install dependencies
run: dotnet restore
@@ -75,24 +82,23 @@ jobs:
- name: Test
run: dotnet test --no-restore --verbosity normal
-
version:
name: Bump version on Develop push
needs: [ build ]
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/develop' }}
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup .NET Core
- uses: actions/setup-dotnet@v2
+ uses: actions/setup-dotnet@v3
with:
- dotnet-version: 6.0.x
+ dotnet-version: 7.0.x
- name: Install Swashbuckle CLI
- run: dotnet tool install -g --version 6.4.0 Swashbuckle.AspNetCore.Cli
+ run: dotnet tool install -g --version 6.5.0 Swashbuckle.AspNetCore.Cli
- name: Install dependencies
run: dotnet restore
@@ -111,6 +117,9 @@ jobs:
name: Build Nightly Docker if Develop push
needs: [ build, version ]
runs-on: ubuntu-latest
+ permissions:
+ packages: write
+ contents: read
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/develop' }}
steps:
- name: Find Current Pull Request
@@ -140,7 +149,7 @@ jobs:
echo "::set-output name=BODY::$body"
- name: Check Out Repo
- uses: actions/checkout@v2
+ uses: actions/checkout@v3
with:
ref: develop
@@ -151,7 +160,7 @@ jobs:
- run: |
cd UI/Web || exit
echo 'Installing web dependencies'
- npm ci --legacy-peer-deps
+ npm ci
echo 'Building UI'
npm run prod
@@ -177,21 +186,28 @@ jobs:
run: echo "${{steps.get-version.outputs.assembly-version}}"
- name: Compile dotnet app
- uses: actions/setup-dotnet@v2
+ uses: actions/setup-dotnet@v3
with:
- dotnet-version: 6.0.x
+ dotnet-version: 7.0.x
- name: Install Swashbuckle CLI
- run: dotnet tool install -g --version 6.4.0 Swashbuckle.AspNetCore.Cli
+ run: dotnet tool install -g --version 6.5.0 Swashbuckle.AspNetCore.Cli
- run: ./monorepo-build.sh
- name: Login to Docker Hub
- uses: docker/login-action@v1
+ uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
+ - name: Login to GitHub Container Registry
+ uses: docker/login-action@v2
+ with:
+ registry: ghcr.io
+ username: ${{ github.actor }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
@@ -206,7 +222,7 @@ jobs:
context: .
platforms: linux/amd64,linux/arm/v7,linux/arm64
push: true
- tags: kizaing/kavita:nightly, kizaing/kavita:nightly-${{ steps.parse-version.outputs.VERSION }}
+ tags: kizaing/kavita:nightly, kizaing/kavita:nightly-${{ steps.parse-version.outputs.VERSION }}, ghcr.io/kareadita/kavita:nightly, ghcr.io/kareadita/kavita:nightly-${{ steps.parse-version.outputs.VERSION }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
@@ -224,6 +240,9 @@ jobs:
name: Build Stable Docker if Main push
needs: [ build ]
runs-on: ubuntu-latest
+ permissions:
+ packages: write
+ contents: read
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
steps:
@@ -254,7 +273,7 @@ jobs:
echo "::set-output name=BODY::$body"
- name: Check Out Repo
- uses: actions/checkout@v2
+ uses: actions/checkout@v3
with:
ref: main
@@ -266,7 +285,7 @@ jobs:
cd UI/Web || exit
echo 'Installing web dependencies'
- npm ci --legacy-peer-deps
+ npm install
echo 'Building UI'
npm run prod
@@ -294,20 +313,27 @@ jobs:
id: parse-version
- name: Compile dotnet app
- uses: actions/setup-dotnet@v2
+ uses: actions/setup-dotnet@v3
with:
- dotnet-version: 6.0.x
+ dotnet-version: 7.0.x
- name: Install Swashbuckle CLI
- run: dotnet tool install -g --version 6.4.0 Swashbuckle.AspNetCore.Cli
+ run: dotnet tool install -g --version 6.5.0 Swashbuckle.AspNetCore.Cli
- run: ./monorepo-build.sh
- name: Login to Docker Hub
- uses: docker/login-action@v1
+ uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
+ - name: Login to GitHub Container Registry
+ uses: docker/login-action@v2
+ with:
+ registry: ghcr.io
+ username: ${{ github.actor }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
@@ -322,7 +348,7 @@ jobs:
context: .
platforms: linux/amd64,linux/arm/v7,linux/arm64
push: true
- tags: kizaing/kavita:latest, kizaing/kavita:${{ steps.parse-version.outputs.VERSION }}
+ tags: kizaing/kavita:latest, kizaing/kavita:${{ steps.parse-version.outputs.VERSION }}, ghcr.io/kareadita/kavita:latest, ghcr.io/kareadita/kavita:${{ steps.parse-version.outputs.VERSION }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
diff --git a/API.Benchmark/API.Benchmark.csproj b/API.Benchmark/API.Benchmark.csproj
index 11ef151a2..e6dc8301a 100644
--- a/API.Benchmark/API.Benchmark.csproj
+++ b/API.Benchmark/API.Benchmark.csproj
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <TargetFramework>net6.0</TargetFramework>
+ <TargetFramework>net7.0</TargetFramework>
<OutputType>Exe</OutputType>
</PropertyGroup>
@@ -10,9 +10,9 @@
</ItemGroup>
<ItemGroup>
- <PackageReference Include="BenchmarkDotNet" Version="0.13.2" />
- <PackageReference Include="BenchmarkDotNet.Annotations" Version="0.13.2" />
- <PackageReference Include="NSubstitute" Version="4.4.0" />
+ <PackageReference Include="BenchmarkDotNet" Version="0.13.5" />
+ <PackageReference Include="BenchmarkDotNet.Annotations" Version="0.13.5" />
+ <PackageReference Include="NSubstitute" Version="5.0.0" />
</ItemGroup>
<ItemGroup>
diff --git a/API.Benchmark/ArchiveServiceBenchmark.cs b/API.Benchmark/ArchiveServiceBenchmark.cs
index e24589205..e856aa7c8 100644
--- a/API.Benchmark/ArchiveServiceBenchmark.cs
+++ b/API.Benchmark/ArchiveServiceBenchmark.cs
@@ -16,7 +16,7 @@ namespace API.Benchmark;
[MemoryDiagnoser]
[RankColumn]
[Orderer(SummaryOrderPolicy.FastestToSlowest)]
-[SimpleJob(launchCount: 1, warmupCount: 5, targetCount: 20)]
+[SimpleJob(launchCount: 1, warmupCount: 5, invocationCount: 20)]
public class ArchiveServiceBenchmark
{
private readonly ArchiveService _archiveService;
diff --git a/API.Benchmark/CleanTitleBenchmark.cs b/API.Benchmark/CleanTitleBenchmark.cs
index 90310a9ef..c3a383647 100644
--- a/API.Benchmark/CleanTitleBenchmark.cs
+++ b/API.Benchmark/CleanTitleBenchmark.cs
@@ -1,9 +1,6 @@
-using System;
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.IO;
-using System.Text.RegularExpressions;
using BenchmarkDotNet.Attributes;
-using BenchmarkDotNet.Order;
namespace API.Benchmark;
diff --git a/API.Benchmark/EpubBenchmark.cs b/API.Benchmark/EpubBenchmark.cs
index 1df4f176e..1d47889b1 100644
--- a/API.Benchmark/EpubBenchmark.cs
+++ b/API.Benchmark/EpubBenchmark.cs
@@ -14,22 +14,11 @@ namespace API.Benchmark;
[MemoryDiagnoser]
[RankColumn]
[Orderer(SummaryOrderPolicy.FastestToSlowest)]
-[SimpleJob(launchCount: 1, warmupCount: 5, targetCount: 20)]
+[SimpleJob(launchCount: 1, warmupCount: 5, invocationCount: 20)]
public class EpubBenchmark
{
private const string FilePath = @"E:\Books\Invaders of the Rokujouma\Invaders of the Rokujouma - Volume 01.epub";
- private readonly Regex WordRegex = new Regex(@"\b\w+\b", RegexOptions.Compiled | RegexOptions.IgnoreCase);
-
- // [Benchmark]
- // public async Task GetWordCount_PassByString()
- // {
- // using var book = await EpubReader.OpenBookAsync(FilePath, BookService.BookReaderOptions);
- // foreach (var bookFile in book.Content.Html.Values)
- // {
- // GetBookWordCount_PassByString(await bookFile.ReadContentAsTextAsync());
- // ;
- // }
- // }
+ private readonly Regex _wordRegex = new Regex(@"\b\w+\b", RegexOptions.Compiled | RegexOptions.IgnoreCase);
[Benchmark]
public async Task GetWordCount_PassByRef()
@@ -111,6 +100,6 @@ public class EpubBenchmark
return doc.DocumentNode.SelectNodes("//body//text()[not(parent::script)]")
- .Sum(node => WordRegex.Matches(node.InnerText).Count);
+ .Sum(node => _wordRegex.Matches(node.InnerText).Count);
}
}
diff --git a/API.Benchmark/ParserBenchmarks.cs b/API.Benchmark/ParserBenchmarks.cs
index d7706a3f4..0dabc560b 100644
--- a/API.Benchmark/ParserBenchmarks.cs
+++ b/API.Benchmark/ParserBenchmarks.cs
@@ -74,5 +74,24 @@ public class ParserBenchmarks
}
}
+ [Benchmark]
+ public void Test_CharacterReplace()
+ {
+ foreach (var name in _names)
+ {
+ var d = name.Contains('a');
+ }
+ }
+
+ [Benchmark]
+ public void Test_StringReplace()
+ {
+ foreach (var name in _names)
+ {
+
+ var d = name.Contains("a");
+ }
+ }
+
}
diff --git a/API.Tests/API.Tests.csproj b/API.Tests/API.Tests.csproj
index cda56af18..75af5f61b 100644
--- a/API.Tests/API.Tests.csproj
+++ b/API.Tests/API.Tests.csproj
@@ -1,39 +1,39 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <TargetFramework>net6.0</TargetFramework>
-
+ <TargetFramework>net7.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
- <PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="6.0.10" />
- <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
+ <PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.5" />
+ <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="Moq" Version="4.18.4" />
<PackageReference Include="NSubstitute" Version="4.4.0" />
- <PackageReference Include="System.IO.Abstractions.TestingHelpers" Version="17.2.3" />
+ <PackageReference Include="System.IO.Abstractions.TestingHelpers" Version="19.2.11" />
+ <PackageReference Include="TestableIO.System.IO.Abstractions.Wrappers" Version="19.2.11" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
- <PackageReference Include="coverlet.collector" Version="3.1.2">
+ <PackageReference Include="coverlet.collector" Version="3.2.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
- <ProjectReference Include="..\API\API.csproj" />
+ <ProjectReference Include="..\API\API.csproj" />
</ItemGroup>
<ItemGroup>
- <Folder Include="Services\Test Data\ArchiveService\ComicInfos" />
- <Folder Include="Services\Test Data\ScannerService\Manga" />
+ <Folder Include="Services\Test Data\ArchiveService\ComicInfos" />
+ <Folder Include="Services\Test Data\ScannerService\Manga" />
</ItemGroup>
<ItemGroup>
- <None Remove="Extensions\Test Data\modified on run.txt" />
+ <None Remove="Extensions\Test Data\modified on run.txt" />
</ItemGroup>
</Project>
diff --git a/API.Tests/AbstractDbTest.cs b/API.Tests/AbstractDbTest.cs
index 1a9926345..18f0669cd 100644
--- a/API.Tests/AbstractDbTest.cs
+++ b/API.Tests/AbstractDbTest.cs
@@ -7,6 +7,7 @@ using API.Data;
using API.Entities;
using API.Entities.Enums;
using API.Helpers;
+using API.Helpers.Builders;
using API.Services;
using AutoMapper;
using Microsoft.Data.Sqlite;
@@ -29,6 +30,7 @@ public abstract class AbstractDbTest
protected const string BackupDirectory = "C:/kavita/config/backups/";
protected const string LogDirectory = "C:/kavita/config/logs/";
protected const string BookmarkDirectory = "C:/kavita/config/bookmarks/";
+ protected const string SiteThemeDirectory = "C:/kavita/config/themes/";
protected const string TempDirectory = "C:/kavita/config/temp/";
protected const string DataDirectory = "C:/data/";
@@ -77,18 +79,9 @@ public abstract class AbstractDbTest
_context.ServerSetting.Update(setting);
- _context.Library.Add(new Library()
- {
- Name = "Manga",
- Folders = new List<FolderPath>()
- {
- new FolderPath()
- {
- Path = "C:/data/"
- }
- },
- Series = new List<Series>()
- });
+ _context.Library.Add(new LibraryBuilder("Manga")
+ .WithFolderPath(new FolderPathBuilder("C:/data/").Build())
+ .Build());
return await _context.SaveChangesAsync() > 0;
}
@@ -103,6 +96,7 @@ public abstract class AbstractDbTest
fileSystem.AddDirectory(CoverImageDirectory);
fileSystem.AddDirectory(BackupDirectory);
fileSystem.AddDirectory(BookmarkDirectory);
+ fileSystem.AddDirectory(SiteThemeDirectory);
fileSystem.AddDirectory(LogDirectory);
fileSystem.AddDirectory(TempDirectory);
fileSystem.AddDirectory(DataDirectory);
diff --git a/API.Tests/Entities/ComicInfoTests.cs b/API.Tests/Entities/ComicInfoTests.cs
index ea8b0187d..783248a3b 100644
--- a/API.Tests/Entities/ComicInfoTests.cs
+++ b/API.Tests/Entities/ComicInfoTests.cs
@@ -36,7 +36,6 @@ public class ComicInfoTests
}
#endregion
-
#region CalculatedCount
[Fact]
diff --git a/API.Tests/Entities/SeriesTest.cs b/API.Tests/Entities/SeriesTest.cs
deleted file mode 100644
index 0b49bd3dd..000000000
--- a/API.Tests/Entities/SeriesTest.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-using API.Data;
-using Xunit;
-
-namespace API.Tests.Entities;
-
-/// <summary>
-/// Tests for <see cref="API.Entities.Series"/>
-/// </summary>
-public class SeriesTest
-{
- [Theory]
- [InlineData("Darker than Black")]
- public void CreateSeries(string name)
- {
- var key = API.Services.Tasks.Scanner.Parser.Parser.Normalize(name);
- var series = DbFactory.Series(name);
- Assert.Equal(0, series.Id);
- Assert.Equal(0, series.Pages);
- Assert.Equal(name, series.Name);
- Assert.Null(series.CoverImage);
- Assert.Equal(name, series.LocalizedName);
- Assert.Equal(name, series.SortName);
- Assert.Equal(name, series.OriginalName);
- Assert.Equal(key, series.NormalizedName);
- }
-}
diff --git a/API.Tests/Extensions/ChapterListExtensionsTests.cs b/API.Tests/Extensions/ChapterListExtensionsTests.cs
index f6ea62408..3b59f1b02 100644
--- a/API.Tests/Extensions/ChapterListExtensionsTests.cs
+++ b/API.Tests/Extensions/ChapterListExtensionsTests.cs
@@ -4,7 +4,8 @@ using System.Linq;
using API.Entities;
using API.Entities.Enums;
using API.Extensions;
-using API.Parser;
+using API.Helpers.Builders;
+using API.Services.Tasks.Scanner.Parser;
using Xunit;
namespace API.Tests.Extensions;
@@ -13,22 +14,15 @@ public class ChapterListExtensionsTests
{
private static Chapter CreateChapter(string range, string number, MangaFile file, bool isSpecial)
{
- return new Chapter()
- {
- Range = range,
- Number = number,
- Files = new List<MangaFile>() {file},
- IsSpecial = isSpecial
- };
+ return new ChapterBuilder(number, range)
+ .WithIsSpecial(isSpecial)
+ .WithFile(file)
+ .Build();
}
private static MangaFile CreateFile(string file, MangaFormat format)
{
- return new MangaFile()
- {
- FilePath = file,
- Format = format
- };
+ return new MangaFileBuilder(file, format).Build();
}
[Fact]
diff --git a/API.Tests/Extensions/ParserInfoListExtensionsTests.cs b/API.Tests/Extensions/ParserInfoListExtensionsTests.cs
index b6a5ca362..6ea35e471 100644
--- a/API.Tests/Extensions/ParserInfoListExtensionsTests.cs
+++ b/API.Tests/Extensions/ParserInfoListExtensionsTests.cs
@@ -3,7 +3,7 @@ using System.IO.Abstractions.TestingHelpers;
using System.Linq;
using API.Entities.Enums;
using API.Extensions;
-using API.Parser;
+using API.Helpers.Builders;
using API.Services;
using API.Services.Tasks.Scanner.Parser;
using API.Tests.Helpers;
@@ -27,7 +27,7 @@ public class ParserInfoListExtensions
[InlineData(new[] {"1", "1", "3-5", "5", "8", "0", "0"}, new[] {"1", "3-5", "5", "8", "0"})]
public void DistinctVolumesTest(string[] volumeNumbers, string[] expectedNumbers)
{
- var infos = volumeNumbers.Select(n => new ParserInfo() {Volumes = n}).ToList();
+ var infos = volumeNumbers.Select(n => new ParserInfo() {Series = "", Volumes = n}).ToList();
Assert.Equal(expectedNumbers, infos.DistinctVolumes());
}
@@ -45,8 +45,10 @@ public class ParserInfoListExtensions
string.Empty));
}
- var files = inputChapters.Select(s => EntityFactory.CreateMangaFile(s, MangaFormat.Archive, 199)).ToList();
- var chapter = EntityFactory.CreateChapter("0-6", false, files);
+ var files = inputChapters.Select(s => new MangaFileBuilder(s, MangaFormat.Archive, 199).Build()).ToList();
+ var chapter = new ChapterBuilder("0-6")
+ .WithFiles(files)
+ .Build();
Assert.Equal(expectedHasInfo, infos.HasInfo(chapter));
}
diff --git a/API.Tests/Extensions/QueryableExtensionsTests.cs b/API.Tests/Extensions/QueryableExtensionsTests.cs
index ee1ada416..230028d44 100644
--- a/API.Tests/Extensions/QueryableExtensionsTests.cs
+++ b/API.Tests/Extensions/QueryableExtensionsTests.cs
@@ -1,10 +1,13 @@
using System.Collections.Generic;
using System.Linq;
+using API.Data;
using API.Data.Misc;
using API.Entities;
using API.Entities.Enums;
using API.Entities.Metadata;
using API.Extensions;
+using API.Extensions.QueryExtensions;
+using API.Helpers.Builders;
using Xunit;
namespace API.Tests.Extensions;
@@ -18,27 +21,15 @@ public class QueryableExtensionsTests
{
var items = new List<Series>()
{
- new Series()
- {
- Metadata = new SeriesMetadata()
- {
- AgeRating = AgeRating.Teen,
- }
- },
- new Series()
- {
- Metadata = new SeriesMetadata()
- {
- AgeRating = AgeRating.Unknown,
- }
- },
- new Series()
- {
- Metadata = new SeriesMetadata()
- {
- AgeRating = AgeRating.X18Plus,
- }
- },
+ new SeriesBuilder("Test 1")
+ .WithMetadata(new SeriesMetadataBuilder().WithAgeRating(AgeRating.Teen).Build())
+ .Build(),
+ new SeriesBuilder("Test 2")
+ .WithMetadata(new SeriesMetadataBuilder().WithAgeRating(AgeRating.Unknown).Build())
+ .Build(),
+ new SeriesBuilder("Test 3")
+ .WithMetadata(new SeriesMetadataBuilder().WithAgeRating(AgeRating.X18Plus).Build())
+ .Build()
};
var filtered = items.AsQueryable().RestrictAgainstAgeRestriction(new AgeRestriction()
@@ -56,40 +47,16 @@ public class QueryableExtensionsTests
{
var items = new List<CollectionTag>()
{
- new CollectionTag()
- {
- SeriesMetadatas = new List<SeriesMetadata>()
- {
- new SeriesMetadata()
- {
- AgeRating = AgeRating.Teen,
- }
- }
- },
- new CollectionTag()
- {
- SeriesMetadatas = new List<SeriesMetadata>()
- {
- new SeriesMetadata()
- {
- AgeRating = AgeRating.Unknown,
- },
- new SeriesMetadata()
- {
- AgeRating = AgeRating.Teen,
- }
- }
- },
- new CollectionTag()
- {
- SeriesMetadatas = new List<SeriesMetadata>()
- {
- new SeriesMetadata()
- {
- AgeRating = AgeRating.X18Plus,
- }
- }
- },
+ new CollectionTagBuilder("Test")
+ .WithSeriesMetadata(new SeriesMetadataBuilder().WithAgeRating(AgeRating.Teen).Build())
+ .Build(),
+ new CollectionTagBuilder("Test 2")
+ .WithSeriesMetadata(new SeriesMetadataBuilder().WithAgeRating(AgeRating.Unknown).Build())
+ .WithSeriesMetadata(new SeriesMetadataBuilder().WithAgeRating(AgeRating.Teen).Build())
+ .Build(),
+ new CollectionTagBuilder("Test 3")
+ .WithSeriesMetadata(new SeriesMetadataBuilder().WithAgeRating(AgeRating.X18Plus).Build())
+ .Build(),
};
var filtered = items.AsQueryable().RestrictAgainstAgeRestriction(new AgeRestriction()
@@ -107,40 +74,16 @@ public class QueryableExtensionsTests
{
var items = new List<Genre>()
{
- new Genre()
- {
- SeriesMetadatas = new List<SeriesMetadata>()
- {
- new SeriesMetadata()
- {
- AgeRating = AgeRating.Teen,
- }
- }
- },
- new Genre()
- {
- SeriesMetadatas = new List<SeriesMetadata>()
- {
- new SeriesMetadata()
- {
- AgeRating = AgeRating.Unknown,
- },
- new SeriesMetadata()
- {
- AgeRating = AgeRating.Teen,
- }
- }
- },
- new Genre()
- {
- SeriesMetadatas = new List<SeriesMetadata>()
- {
- new SeriesMetadata()
- {
- AgeRating = AgeRating.X18Plus,
- }
- }
- },
+ new GenreBuilder("A")
+ .WithSeriesMetadata(new SeriesMetadataBuilder().WithAgeRating(AgeRating.Teen).Build())
+ .Build(),
+ new GenreBuilder("B")
+ .WithSeriesMetadata(new SeriesMetadataBuilder().WithAgeRating(AgeRating.Unknown).Build())
+ .WithSeriesMetadata(new SeriesMetadataBuilder().WithAgeRating(AgeRating.Teen).Build())
+ .Build(),
+ new GenreBuilder("C")
+ .WithSeriesMetadata(new SeriesMetadataBuilder().WithAgeRating(AgeRating.X18Plus).Build())
+ .Build(),
};
var filtered = items.AsQueryable().RestrictAgainstAgeRestriction(new AgeRestriction()
@@ -158,40 +101,16 @@ public class QueryableExtensionsTests
{
var items = new List<Tag>()
{
- new Tag()
- {
- SeriesMetadatas = new List<SeriesMetadata>()
- {
- new SeriesMetadata()
- {
- AgeRating = AgeRating.Teen,
- }
- }
- },
- new Tag()
- {
- SeriesMetadatas = new List<SeriesMetadata>()
- {
- new SeriesMetadata()
- {
- AgeRating = AgeRating.Unknown,
- },
- new SeriesMetadata()
- {
- AgeRating = AgeRating.Teen,
- }
- }
- },
- new Tag()
- {
- SeriesMetadatas = new List<SeriesMetadata>()
- {
- new SeriesMetadata()
- {
- AgeRating = AgeRating.X18Plus,
- }
- }
- },
+ new TagBuilder("Test 1")
+ .WithSeriesMetadata(new SeriesMetadataBuilder().WithAgeRating(AgeRating.Teen).Build())
+ .Build(),
+ new TagBuilder("Test 2")
+ .WithSeriesMetadata(new SeriesMetadataBuilder().WithAgeRating(AgeRating.Unknown).Build())
+ .WithSeriesMetadata(new SeriesMetadataBuilder().WithAgeRating(AgeRating.Teen).Build())
+ .Build(),
+ new TagBuilder("Test 3")
+ .WithSeriesMetadata(new SeriesMetadataBuilder().WithAgeRating(AgeRating.X18Plus).Build())
+ .Build(),
};
var filtered = items.AsQueryable().RestrictAgainstAgeRestriction(new AgeRestriction()
@@ -209,40 +128,16 @@ public class QueryableExtensionsTests
{
var items = new List<Person>()
{
- new Person()
- {
- SeriesMetadatas = new List<SeriesMetadata>()
- {
- new SeriesMetadata()
- {
- AgeRating = AgeRating.Teen,
- }
- }
- },
- new Person()
- {
- SeriesMetadatas = new List<SeriesMetadata>()
- {
- new SeriesMetadata()
- {
- AgeRating = AgeRating.Unknown,
- },
- new SeriesMetadata()
- {
- AgeRating = AgeRating.Teen,
- }
- }
- },
- new Person()
- {
- SeriesMetadatas = new List<SeriesMetadata>()
- {
- new SeriesMetadata()
- {
- AgeRating = AgeRating.X18Plus,
- }
- }
- },
+ new PersonBuilder("Test", PersonRole.Character)
+ .WithSeriesMetadata(new SeriesMetadataBuilder().WithAgeRating(AgeRating.Teen).Build())
+ .Build(),
+ new PersonBuilder("Test", PersonRole.Character)
+ .WithSeriesMetadata(new SeriesMetadataBuilder().WithAgeRating(AgeRating.Unknown).Build())
+ .WithSeriesMetadata(new SeriesMetadataBuilder().WithAgeRating(AgeRating.Teen).Build())
+ .Build(),
+ new PersonBuilder("Test", PersonRole.Character)
+ .WithSeriesMetadata(new SeriesMetadataBuilder().WithAgeRating(AgeRating.X18Plus).Build())
+ .Build(),
};
var filtered = items.AsQueryable().RestrictAgainstAgeRestriction(new AgeRestriction()
@@ -258,20 +153,12 @@ public class QueryableExtensionsTests
[InlineData(false, 1)]
public void RestrictAgainstAgeRestriction_ReadingList_ShouldRestrictEverythingAboveTeen(bool includeUnknowns, int expectedCount)
{
+
var items = new List<ReadingList>()
{
- new ReadingList()
- {
- AgeRating = AgeRating.Teen,
- },
- new ReadingList()
- {
- AgeRating = AgeRating.Unknown,
- },
- new ReadingList()
- {
- AgeRating = AgeRating.X18Plus
- },
+ new ReadingListBuilder("Test List").WithRating(AgeRating.Teen).Build(),
+ new ReadingListBuilder("Test List").WithRating(AgeRating.Unknown).Build(),
+ new ReadingListBuilder("Test List").WithRating(AgeRating.X18Plus).Build(),
};
var filtered = items.AsQueryable().RestrictAgainstAgeRestriction(new AgeRestriction()
diff --git a/API.Tests/Extensions/SeriesExtensionsTests.cs b/API.Tests/Extensions/SeriesExtensionsTests.cs
index f8dce8876..b68d7c533 100644
--- a/API.Tests/Extensions/SeriesExtensionsTests.cs
+++ b/API.Tests/Extensions/SeriesExtensionsTests.cs
@@ -3,124 +3,31 @@ using System.Linq;
using API.Comparators;
using API.Entities;
using API.Entities.Enums;
-using API.Entities.Metadata;
using API.Extensions;
-using API.Parser;
-using API.Services.Tasks.Scanner;
+using API.Helpers.Builders;
using Xunit;
namespace API.Tests.Extensions;
public class SeriesExtensionsTests
{
- [Theory]
- [InlineData(new [] {"Darker than Black", "Darker Than Black", "Darker than Black"}, new [] {"Darker than Black"}, true)]
- [InlineData(new [] {"Darker than Black", "Darker Than Black", "Darker than Black"}, new [] {"Darker_than_Black"}, true)]
- [InlineData(new [] {"Darker than Black", "Darker Than Black", "Darker than Black"}, new [] {"Darker then Black!"}, false)]
- [InlineData(new [] {"Salem's Lot", "Salem's Lot", "Salem's Lot"}, new [] {"Salem's Lot"}, true)]
- [InlineData(new [] {"Salem's Lot", "Salem's Lot", "Salem's Lot"}, new [] {"salems lot"}, true)]
- [InlineData(new [] {"Salem's Lot", "Salem's Lot", "Salem's Lot"}, new [] {"salem's lot"}, true)]
- // Different normalizations pass as we check normalization against an on-the-fly calculation so we don't delete series just because we change how normalization works
- [InlineData(new [] {"Salem's Lot", "Salem's Lot", "Salem's Lot", "salems lot"}, new [] {"salem's lot"}, true)]
- [InlineData(new [] {"Rent-a-Girlfriend", "Rent-a-Girlfriend", "Kanojo, Okarishimasu", "rentagirlfriend"}, new [] {"Kanojo, Okarishimasu"}, true)]
- public void NameInListTest(string[] seriesInput, string[] list, bool expected)
- {
- var series = new Series()
- {
- Name = seriesInput[0],
- LocalizedName = seriesInput[1],
- OriginalName = seriesInput[2],
- NormalizedName = seriesInput.Length == 4 ? seriesInput[3] : API.Services.Tasks.Scanner.Parser.Parser.Normalize(seriesInput[0]),
- Metadata = new SeriesMetadata()
- };
-
- Assert.Equal(expected, series.NameInList(list));
- }
-
- [Theory]
- [InlineData(new [] {"Darker than Black", "Darker Than Black", "Darker than Black"}, new [] {"Darker than Black"}, MangaFormat.Archive, true)]
- [InlineData(new [] {"Darker than Black", "Darker Than Black", "Darker than Black"}, new [] {"Darker_than_Black"}, MangaFormat.Archive, true)]
- [InlineData(new [] {"Darker than Black", "Darker Than Black", "Darker than Black"}, new [] {"Darker then Black!"}, MangaFormat.Archive, false)]
- [InlineData(new [] {"Salem's Lot", "Salem's Lot", "Salem's Lot"}, new [] {"Salem's Lot"}, MangaFormat.Archive, true)]
- [InlineData(new [] {"Salem's Lot", "Salem's Lot", "Salem's Lot"}, new [] {"salems lot"}, MangaFormat.Archive, true)]
- [InlineData(new [] {"Salem's Lot", "Salem's Lot", "Salem's Lot"}, new [] {"salem's lot"}, MangaFormat.Archive, true)]
- // Different normalizations pass as we check normalization against an on-the-fly calculation so we don't delete series just because we change how normalization works
- [InlineData(new [] {"Salem's Lot", "Salem's Lot", "Salem's Lot", "salems lot"}, new [] {"salem's lot"}, MangaFormat.Archive, true)]
- [InlineData(new [] {"Rent-a-Girlfriend", "Rent-a-Girlfriend", "Kanojo, Okarishimasu", "rentagirlfriend"}, new [] {"Kanojo, Okarishimasu"}, MangaFormat.Archive, true)]
- public void NameInListParserInfoTest(string[] seriesInput, string[] list, MangaFormat format, bool expected)
- {
- var series = new Series()
- {
- Name = seriesInput[0],
- LocalizedName = seriesInput[1],
- OriginalName = seriesInput[2],
- NormalizedName = seriesInput.Length == 4 ? seriesInput[3] : API.Services.Tasks.Scanner.Parser.Parser.Normalize(seriesInput[0]),
- Metadata = new SeriesMetadata(),
- };
-
- var parserInfos = list.Select(s => new ParsedSeries()
- {
- Name = s,
- NormalizedName = API.Services.Tasks.Scanner.Parser.Parser.Normalize(s),
- }).ToList();
-
- // This doesn't do any checks against format
- Assert.Equal(expected, series.NameInList(parserInfos));
- }
-
-
- [Theory]
- [InlineData(new [] {"Darker than Black", "Darker Than Black", "Darker than Black"}, "Darker than Black", true)]
- [InlineData(new [] {"Rent-a-Girlfriend", "Rent-a-Girlfriend", "Kanojo, Okarishimasu", "rentagirlfriend"}, "Kanojo, Okarishimasu", true)]
- [InlineData(new [] {"Rent-a-Girlfriend", "Rent-a-Girlfriend", "Kanojo, Okarishimasu", "rentagirlfriend"}, "Rent", false)]
- public void NameInParserInfoTest(string[] seriesInput, string parserSeries, bool expected)
- {
- var series = new Series()
- {
- Name = seriesInput[0],
- LocalizedName = seriesInput[1],
- OriginalName = seriesInput[2],
- NormalizedName = seriesInput.Length == 4 ? seriesInput[3] : API.Services.Tasks.Scanner.Parser.Parser.Normalize(seriesInput[0]),
- Metadata = new SeriesMetadata()
- };
- var info = new ParserInfo
- {
- Series = parserSeries
- };
-
- Assert.Equal(expected, series.NameInParserInfo(info));
- }
-
[Fact]
public void GetCoverImage_MultipleSpecials_Comics()
{
- var series = new Series()
- {
- Format = MangaFormat.Archive,
- Volumes = new List<Volume>()
- {
- new Volume()
- {
- Number = 0,
- Name = API.Services.Tasks.Scanner.Parser.Parser.DefaultVolume,
- Chapters = new List<Chapter>()
- {
- new Chapter()
- {
- IsSpecial = true,
- Number = API.Services.Tasks.Scanner.Parser.Parser.DefaultChapter,
- CoverImage = "Special 1",
- },
- new Chapter()
- {
- IsSpecial = true,
- Number = API.Services.Tasks.Scanner.Parser.Parser.DefaultChapter,
- CoverImage = "Special 2",
- }
- },
- }
- }
- };
+ var series = new SeriesBuilder("Test 1")
+ .WithFormat(MangaFormat.Archive)
+ .WithVolume(new VolumeBuilder("0")
+ .WithName(API.Services.Tasks.Scanner.Parser.Parser.DefaultVolume)
+ .WithChapter(new ChapterBuilder(API.Services.Tasks.Scanner.Parser.Parser.DefaultChapter)
+ .WithCoverImage("Special 1")
+ .WithIsSpecial(true)
+ .Build())
+ .WithChapter(new ChapterBuilder(API.Services.Tasks.Scanner.Parser.Parser.DefaultChapter)
+ .WithCoverImage("Special 2")
+ .WithIsSpecial(true)
+ .Build())
+ .Build())
+ .Build();
Assert.Equal("Special 1", series.GetCoverImage());
@@ -129,33 +36,20 @@ public class SeriesExtensionsTests
[Fact]
public void GetCoverImage_MultipleSpecials_Books()
{
- var series = new Series()
- {
- Format = MangaFormat.Epub,
- Volumes = new List<Volume>()
- {
- new Volume()
- {
- Number = 0,
- Name = API.Services.Tasks.Scanner.Parser.Parser.DefaultVolume,
- Chapters = new List<Chapter>()
- {
- new Chapter()
- {
- IsSpecial = true,
- Number = API.Services.Tasks.Scanner.Parser.Parser.DefaultChapter,
- CoverImage = "Special 1",
- },
- new Chapter()
- {
- IsSpecial = true,
- Number = API.Services.Tasks.Scanner.Parser.Parser.DefaultChapter,
- CoverImage = "Special 2",
- }
- },
- }
- }
- };
+ var series = new SeriesBuilder("Test 1")
+ .WithFormat(MangaFormat.Archive)
+ .WithVolume(new VolumeBuilder("0")
+ .WithName(API.Services.Tasks.Scanner.Parser.Parser.DefaultVolume)
+ .WithChapter(new ChapterBuilder(API.Services.Tasks.Scanner.Parser.Parser.DefaultChapter)
+ .WithCoverImage("Special 1")
+ .WithIsSpecial(true)
+ .Build())
+ .WithChapter(new ChapterBuilder(API.Services.Tasks.Scanner.Parser.Parser.DefaultChapter)
+ .WithCoverImage("Special 2")
+ .WithIsSpecial(true)
+ .Build())
+ .Build())
+ .Build();
Assert.Equal("Special 1", series.GetCoverImage());
}
@@ -163,33 +57,20 @@ public class SeriesExtensionsTests
[Fact]
public void GetCoverImage_JustChapters_Comics()
{
- var series = new Series()
- {
- Format = MangaFormat.Archive,
- Volumes = new List<Volume>()
- {
- new Volume()
- {
- Number = 0,
- Name = API.Services.Tasks.Scanner.Parser.Parser.DefaultVolume,
- Chapters = new List<Chapter>()
- {
- new Chapter()
- {
- IsSpecial = false,
- Number = "2.5",
- CoverImage = "Special 1",
- },
- new Chapter()
- {
- IsSpecial = false,
- Number = "2",
- CoverImage = "Special 2",
- }
- },
- }
- }
- };
+ var series = new SeriesBuilder("Test 1")
+ .WithFormat(MangaFormat.Archive)
+ .WithVolume(new VolumeBuilder("0")
+ .WithName(API.Services.Tasks.Scanner.Parser.Parser.DefaultVolume)
+ .WithChapter(new ChapterBuilder("2.5")
+ .WithIsSpecial(false)
+ .WithCoverImage("Special 1")
+ .Build())
+ .WithChapter(new ChapterBuilder("2")
+ .WithIsSpecial(false)
+ .WithCoverImage("Special 2")
+ .Build())
+ .Build())
+ .Build();
foreach (var vol in series.Volumes)
{
@@ -202,39 +83,24 @@ public class SeriesExtensionsTests
[Fact]
public void GetCoverImage_JustChaptersAndSpecials_Comics()
{
- var series = new Series()
- {
- Format = MangaFormat.Archive,
- Volumes = new List<Volume>()
- {
- new Volume()
- {
- Number = 0,
- Name = API.Services.Tasks.Scanner.Parser.Parser.DefaultVolume,
- Chapters = new List<Chapter>()
- {
- new Chapter()
- {
- IsSpecial = false,
- Number = "2.5",
- CoverImage = "Special 1",
- },
- new Chapter()
- {
- IsSpecial = false,
- Number = "2",
- CoverImage = "Special 2",
- },
- new Chapter()
- {
- IsSpecial = true,
- Number = API.Services.Tasks.Scanner.Parser.Parser.DefaultChapter,
- CoverImage = "Special 3",
- }
- },
- }
- }
- };
+ var series = new SeriesBuilder("Test 1")
+ .WithFormat(MangaFormat.Archive)
+ .WithVolume(new VolumeBuilder("0")
+ .WithName(API.Services.Tasks.Scanner.Parser.Parser.DefaultVolume)
+ .WithChapter(new ChapterBuilder("2.5")
+ .WithIsSpecial(false)
+ .WithCoverImage("Special 1")
+ .Build())
+ .WithChapter(new ChapterBuilder("2")
+ .WithIsSpecial(false)
+ .WithCoverImage("Special 2")
+ .Build())
+ .WithChapter(new ChapterBuilder("0")
+ .WithIsSpecial(true)
+ .WithCoverImage("Special 3")
+ .Build())
+ .Build())
+ .Build();
foreach (var vol in series.Volumes)
{
@@ -247,54 +113,31 @@ public class SeriesExtensionsTests
[Fact]
public void GetCoverImage_VolumesChapters_Comics()
{
- var series = new Series()
- {
- Format = MangaFormat.Archive,
- Volumes = new List<Volume>()
- {
- new Volume()
- {
- Number = 0,
- Name = API.Services.Tasks.Scanner.Parser.Parser.DefaultVolume,
- Chapters = new List<Chapter>()
- {
- new Chapter()
- {
- IsSpecial = false,
- Number = "2.5",
- CoverImage = "Special 1",
- },
- new Chapter()
- {
- IsSpecial = false,
- Number = "2",
- CoverImage = "Special 2",
- },
- new Chapter()
- {
- IsSpecial = true,
- Number = API.Services.Tasks.Scanner.Parser.Parser.DefaultChapter,
- CoverImage = "Special 3",
- }
- },
- },
- new Volume()
- {
- Number = 1,
- Name = "1",
- Chapters = new List<Chapter>()
- {
- new Chapter()
- {
- IsSpecial = false,
- Number = "0",
- CoverImage = "Volume 1",
- },
-
- },
- }
- }
- };
+ var series = new SeriesBuilder("Test 1")
+ .WithFormat(MangaFormat.Archive)
+ .WithVolume(new VolumeBuilder("0")
+ .WithName(API.Services.Tasks.Scanner.Parser.Parser.DefaultVolume)
+ .WithChapter(new ChapterBuilder("2.5")
+ .WithIsSpecial(false)
+ .WithCoverImage("Special 1")
+ .Build())
+ .WithChapter(new ChapterBuilder("2")
+ .WithIsSpecial(false)
+ .WithCoverImage("Special 2")
+ .Build())
+ .WithChapter(new ChapterBuilder("0")
+ .WithIsSpecial(true)
+ .WithCoverImage("Special 3")
+ .Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("1")
+ .WithNumber(1)
+ .WithChapter(new ChapterBuilder("0")
+ .WithIsSpecial(false)
+ .WithCoverImage("Volume 1")
+ .Build())
+ .Build())
+ .Build();
foreach (var vol in series.Volumes)
{
@@ -307,54 +150,31 @@ public class SeriesExtensionsTests
[Fact]
public void GetCoverImage_VolumesChaptersAndSpecials_Comics()
{
- var series = new Series()
- {
- Format = MangaFormat.Archive,
- Volumes = new List<Volume>()
- {
- new Volume()
- {
- Number = 0,
- Name = API.Services.Tasks.Scanner.Parser.Parser.DefaultVolume,
- Chapters = new List<Chapter>()
- {
- new Chapter()
- {
- IsSpecial = false,
- Number = "2.5",
- CoverImage = "Special 1",
- },
- new Chapter()
- {
- IsSpecial = false,
- Number = "2",
- CoverImage = "Special 2",
- },
- new Chapter()
- {
- IsSpecial = true,
- Number = API.Services.Tasks.Scanner.Parser.Parser.DefaultChapter,
- CoverImage = "Special 3",
- }
- },
- },
- new Volume()
- {
- Number = 1,
- Name = "1",
- Chapters = new List<Chapter>()
- {
- new Chapter()
- {
- IsSpecial = false,
- Number = "0",
- CoverImage = "Volume 1",
- },
-
- },
- }
- }
- };
+ var series = new SeriesBuilder("Test 1")
+ .WithFormat(MangaFormat.Archive)
+ .WithVolume(new VolumeBuilder("0")
+ .WithName(API.Services.Tasks.Scanner.Parser.Parser.DefaultVolume)
+ .WithChapter(new ChapterBuilder("2.5")
+ .WithIsSpecial(false)
+ .WithCoverImage("Special 1")
+ .Build())
+ .WithChapter(new ChapterBuilder("2")
+ .WithIsSpecial(false)
+ .WithCoverImage("Special 2")
+ .Build())
+ .WithChapter(new ChapterBuilder("0")
+ .WithIsSpecial(true)
+ .WithCoverImage("Special 3")
+ .Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("1")
+ .WithNumber(1)
+ .WithChapter(new ChapterBuilder("0")
+ .WithIsSpecial(false)
+ .WithCoverImage("Volume 1")
+ .Build())
+ .Build())
+ .Build();
foreach (var vol in series.Volumes)
{
diff --git a/API.Tests/Extensions/VolumeListExtensionsTests.cs b/API.Tests/Extensions/VolumeListExtensionsTests.cs
index 264437ecd..2db82eeda 100644
--- a/API.Tests/Extensions/VolumeListExtensionsTests.cs
+++ b/API.Tests/Extensions/VolumeListExtensionsTests.cs
@@ -2,6 +2,7 @@
using API.Entities;
using API.Entities.Enums;
using API.Extensions;
+using API.Helpers.Builders;
using API.Tests.Helpers;
using Xunit;
@@ -16,16 +17,14 @@ public class VolumeListExtensionsTests
{
var volumes = new List<Volume>()
{
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("3", false),
- EntityFactory.CreateChapter("4", false),
- }),
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false),
- EntityFactory.CreateChapter("0", true),
- }),
+ new VolumeBuilder("1")
+ .WithChapter(new ChapterBuilder("3").Build())
+ .WithChapter(new ChapterBuilder("4").Build())
+ .Build(),
+ new VolumeBuilder(API.Services.Tasks.Scanner.Parser.Parser.DefaultVolume)
+ .WithChapter(new ChapterBuilder("1").Build())
+ .WithChapter(new ChapterBuilder(API.Services.Tasks.Scanner.Parser.Parser.DefaultChapter).WithIsSpecial(true).Build())
+ .Build(),
};
Assert.Equal(volumes[0].Number, volumes.GetCoverImage(MangaFormat.Archive).Number);
@@ -36,16 +35,14 @@ public class VolumeListExtensionsTests
{
var volumes = new List<Volume>()
{
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("3", false),
- EntityFactory.CreateChapter("4", false),
- }),
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false),
- EntityFactory.CreateChapter("0", true),
- }),
+ new VolumeBuilder("1")
+ .WithChapter(new ChapterBuilder("3").Build())
+ .WithChapter(new ChapterBuilder("4").Build())
+ .Build(),
+ new VolumeBuilder(API.Services.Tasks.Scanner.Parser.Parser.DefaultVolume)
+ .WithChapter(new ChapterBuilder("1").Build())
+ .WithChapter(new ChapterBuilder(API.Services.Tasks.Scanner.Parser.Parser.DefaultChapter).WithIsSpecial(true).Build())
+ .Build(),
};
Assert.Equal(volumes[1].Name, volumes.GetCoverImage(MangaFormat.Epub).Name);
@@ -56,16 +53,14 @@ public class VolumeListExtensionsTests
{
var volumes = new List<Volume>()
{
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("3", false),
- EntityFactory.CreateChapter("4", false),
- }),
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false),
- EntityFactory.CreateChapter("0", true),
- }),
+ new VolumeBuilder("1")
+ .WithChapter(new ChapterBuilder("3").Build())
+ .WithChapter(new ChapterBuilder("4").Build())
+ .Build(),
+ new VolumeBuilder(API.Services.Tasks.Scanner.Parser.Parser.DefaultVolume)
+ .WithChapter(new ChapterBuilder("1").Build())
+ .WithChapter(new ChapterBuilder(API.Services.Tasks.Scanner.Parser.Parser.DefaultChapter).WithIsSpecial(true).Build())
+ .Build(),
};
Assert.Equal(volumes[1].Name, volumes.GetCoverImage(MangaFormat.Pdf).Name);
@@ -76,16 +71,14 @@ public class VolumeListExtensionsTests
{
var volumes = new List<Volume>()
{
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("3", false),
- EntityFactory.CreateChapter("4", false),
- }),
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false),
- EntityFactory.CreateChapter("0", true),
- }),
+ new VolumeBuilder("1")
+ .WithChapter(new ChapterBuilder("3").Build())
+ .WithChapter(new ChapterBuilder("4").Build())
+ .Build(),
+ new VolumeBuilder(API.Services.Tasks.Scanner.Parser.Parser.DefaultVolume)
+ .WithChapter(new ChapterBuilder("1").Build())
+ .WithChapter(new ChapterBuilder(API.Services.Tasks.Scanner.Parser.Parser.DefaultChapter).WithIsSpecial(true).Build())
+ .Build(),
};
Assert.Equal(volumes[0].Name, volumes.GetCoverImage(MangaFormat.Image).Name);
@@ -96,16 +89,14 @@ public class VolumeListExtensionsTests
{
var volumes = new List<Volume>()
{
- EntityFactory.CreateVolume("2", new List<Chapter>()
- {
- EntityFactory.CreateChapter("3", false),
- EntityFactory.CreateChapter("4", false),
- }),
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false),
- EntityFactory.CreateChapter("0", true),
- }),
+ new VolumeBuilder("2")
+ .WithChapter(new ChapterBuilder("3").Build())
+ .WithChapter(new ChapterBuilder("4").Build())
+ .Build(),
+ new VolumeBuilder("1")
+ .WithChapter(new ChapterBuilder("1").Build())
+ .WithChapter(new ChapterBuilder(API.Services.Tasks.Scanner.Parser.Parser.DefaultChapter).Build())
+ .Build(),
};
Assert.Equal(volumes[1].Name, volumes.GetCoverImage(MangaFormat.Image).Name);
diff --git a/API.Tests/Helpers/CacheHelperTests.cs b/API.Tests/Helpers/CacheHelperTests.cs
index d78ed1601..82f496a7b 100644
--- a/API.Tests/Helpers/CacheHelperTests.cs
+++ b/API.Tests/Helpers/CacheHelperTests.cs
@@ -3,7 +3,9 @@ using System.Collections.Generic;
using System.IO;
using System.IO.Abstractions.TestingHelpers;
using API.Entities;
+using API.Entities.Enums;
using API.Helpers;
+using API.Helpers.Builders;
using API.Services;
using Xunit;
@@ -51,11 +53,10 @@ public class CacheHelperTests
[Fact]
public void ShouldUpdateCoverImage_OnFirstRun()
{
- var file = new MangaFile()
- {
- FilePath = TestCoverArchive,
- LastModified = DateTime.Now
- };
+
+ var file = new MangaFileBuilder(TestCoverArchive, MangaFormat.Archive)
+ .WithLastModified(DateTime.Now)
+ .Build();
Assert.True(_cacheHelper.ShouldUpdateCoverImage(null, file, DateTime.Now.Subtract(TimeSpan.FromMinutes(1)),
false, false));
}
@@ -64,11 +65,9 @@ public class CacheHelperTests
public void ShouldUpdateCoverImage_ShouldNotUpdateOnSecondRunWithCoverImageSetNotLocked()
{
// Represents first run
- var file = new MangaFile()
- {
- FilePath = TestCoverArchive,
- LastModified = DateTime.Now
- };
+ var file = new MangaFileBuilder(TestCoverArchive, MangaFormat.Archive)
+ .WithLastModified(DateTime.Now)
+ .Build();
Assert.False(_cacheHelper.ShouldUpdateCoverImage(_testCoverPath, file, DateTime.Now.Subtract(TimeSpan.FromMinutes(1)),
false, false));
}
@@ -77,11 +76,9 @@ public class CacheHelperTests
public void ShouldUpdateCoverImage_ShouldNotUpdateOnSecondRunWithCoverImageSetNotLocked_2()
{
// Represents first run
- var file = new MangaFile()
- {
- FilePath = TestCoverArchive,
- LastModified = DateTime.Now
- };
+ var file = new MangaFileBuilder(TestCoverArchive, MangaFormat.Archive)
+ .WithLastModified(DateTime.Now)
+ .Build();
Assert.False(_cacheHelper.ShouldUpdateCoverImage(_testCoverPath, file, DateTime.Now,
false, false));
}
@@ -90,11 +87,9 @@ public class CacheHelperTests
public void ShouldUpdateCoverImage_ShouldNotUpdateOnSecondRunWithCoverImageSetLocked()
{
// Represents first run
- var file = new MangaFile()
- {
- FilePath = TestCoverArchive,
- LastModified = DateTime.Now
- };
+ var file = new MangaFileBuilder(TestCoverArchive, MangaFormat.Archive)
+ .WithLastModified(DateTime.Now)
+ .Build();
Assert.False(_cacheHelper.ShouldUpdateCoverImage(_testCoverPath, file, DateTime.Now.Subtract(TimeSpan.FromMinutes(1)),
false, true));
}
@@ -103,11 +98,9 @@ public class CacheHelperTests
public void ShouldUpdateCoverImage_ShouldNotUpdateOnSecondRunWithCoverImageSetLocked_Modified()
{
// Represents first run
- var file = new MangaFile()
- {
- FilePath = TestCoverArchive,
- LastModified = DateTime.Now
- };
+ var file = new MangaFileBuilder(TestCoverArchive, MangaFormat.Archive)
+ .WithLastModified(DateTime.Now)
+ .Build();
Assert.False(_cacheHelper.ShouldUpdateCoverImage(_testCoverPath, file, DateTime.Now.Subtract(TimeSpan.FromMinutes(1)),
false, true));
}
@@ -129,11 +122,10 @@ public class CacheHelperTests
var cacheHelper = new CacheHelper(fileService);
var created = DateTime.Now.Subtract(TimeSpan.FromHours(1));
- var file = new MangaFile()
- {
- FilePath = TestCoverArchive,
- LastModified = DateTime.Now.Subtract(TimeSpan.FromMinutes(1))
- };
+ var file = new MangaFileBuilder(TestCoverArchive, MangaFormat.Archive)
+ .WithLastModified(DateTime.Now.Subtract(TimeSpan.FromMinutes(1)))
+ .Build();
+
Assert.True(cacheHelper.ShouldUpdateCoverImage(_testCoverPath, file, created,
false, false));
}
@@ -154,17 +146,14 @@ public class CacheHelperTests
var fileService = new FileService(fileSystem);
var cacheHelper = new CacheHelper(fileService);
- var chapter = new Chapter()
- {
- Created = filesystemFile.LastWriteTime.DateTime,
- LastModified = filesystemFile.LastWriteTime.DateTime
- };
+ var chapter = new ChapterBuilder("1")
+ .WithLastModified(filesystemFile.LastWriteTime.DateTime)
+ .WithCreated(filesystemFile.LastWriteTime.DateTime)
+ .Build();
- var file = new MangaFile()
- {
- FilePath = TestCoverArchive,
- LastModified = filesystemFile.LastWriteTime.DateTime
- };
+ var file = new MangaFileBuilder(TestCoverArchive, MangaFormat.Archive)
+ .WithLastModified(filesystemFile.LastWriteTime.DateTime)
+ .Build();
Assert.True(cacheHelper.IsFileUnmodifiedSinceCreationOrLastScan(chapter, false, file));
}
@@ -184,17 +173,15 @@ public class CacheHelperTests
var fileService = new FileService(fileSystem);
var cacheHelper = new CacheHelper(fileService);
- var chapter = new Chapter()
- {
- Created = filesystemFile.LastWriteTime.DateTime,
- LastModified = filesystemFile.LastWriteTime.DateTime
- };
+ var chapter = new ChapterBuilder("1")
+ .WithLastModified(filesystemFile.LastWriteTime.DateTime)
+ .WithCreated(filesystemFile.LastWriteTime.DateTime)
+ .Build();
+
+ var file = new MangaFileBuilder(TestCoverArchive, MangaFormat.Archive)
+ .WithLastModified(filesystemFile.LastWriteTime.DateTime)
+ .Build();
- var file = new MangaFile()
- {
- FilePath = TestCoverArchive,
- LastModified = filesystemFile.LastWriteTime.DateTime
- };
Assert.True(cacheHelper.IsFileUnmodifiedSinceCreationOrLastScan(chapter, false, file));
}
@@ -214,17 +201,14 @@ public class CacheHelperTests
var fileService = new FileService(fileSystem);
var cacheHelper = new CacheHelper(fileService);
- var chapter = new Chapter()
- {
- Created = filesystemFile.LastWriteTime.DateTime,
- LastModified = filesystemFile.LastWriteTime.DateTime
- };
+ var chapter = new ChapterBuilder("1")
+ .WithLastModified(filesystemFile.LastWriteTime.DateTime)
+ .WithCreated(filesystemFile.LastWriteTime.DateTime)
+ .Build();
- var file = new MangaFile()
- {
- FilePath = TestCoverArchive,
- LastModified = filesystemFile.LastWriteTime.DateTime
- };
+ var file = new MangaFileBuilder(TestCoverArchive, MangaFormat.Archive)
+ .WithLastModified(filesystemFile.LastWriteTime.DateTime)
+ .Build();
Assert.False(cacheHelper.IsFileUnmodifiedSinceCreationOrLastScan(chapter, true, file));
}
@@ -245,17 +229,14 @@ public class CacheHelperTests
var fileService = new FileService(fileSystem);
var cacheHelper = new CacheHelper(fileService);
- var chapter = new Chapter()
- {
- Created = DateTime.Now.Subtract(TimeSpan.FromMinutes(10)),
- LastModified = DateTime.Now.Subtract(TimeSpan.FromMinutes(10))
- };
+ var chapter = new ChapterBuilder("1")
+ .WithLastModified(DateTime.Now.Subtract(TimeSpan.FromMinutes(10)))
+ .WithCreated(DateTime.Now.Subtract(TimeSpan.FromMinutes(10)))
+ .Build();
- var file = new MangaFile()
- {
- FilePath = Path.Join(TestCoverImageDirectory, TestCoverArchive),
- LastModified = filesystemFile.LastWriteTime.DateTime
- };
+ var file = new MangaFileBuilder(TestCoverArchive, MangaFormat.Archive)
+ .WithLastModified(filesystemFile.LastWriteTime.DateTime)
+ .Build();
Assert.False(cacheHelper.IsFileUnmodifiedSinceCreationOrLastScan(chapter, false, file));
}
@@ -275,17 +256,15 @@ public class CacheHelperTests
var fileService = new FileService(fileSystem);
var cacheHelper = new CacheHelper(fileService);
- var chapter = new Chapter()
- {
- Created = DateTime.Now.Subtract(TimeSpan.FromMinutes(10)),
- LastModified = DateTime.Now
- };
+ var chapter = new ChapterBuilder("1")
+ .WithLastModified(DateTime.Now)
+ .WithCreated(DateTime.Now.Subtract(TimeSpan.FromMinutes(10)))
+ .Build();
+
+ var file = new MangaFileBuilder(Path.Join(TestCoverImageDirectory, TestCoverArchive), MangaFormat.Archive)
+ .WithLastModified(filesystemFile.LastWriteTime.DateTime)
+ .Build();
- var file = new MangaFile()
- {
- FilePath = Path.Join(TestCoverImageDirectory, TestCoverArchive),
- LastModified = filesystemFile.LastWriteTime.DateTime
- };
Assert.False(cacheHelper.IsFileUnmodifiedSinceCreationOrLastScan(chapter, false, file));
}
diff --git a/API.Tests/Helpers/EntityFactory.cs b/API.Tests/Helpers/EntityFactory.cs
deleted file mode 100644
index a73a611e2..000000000
--- a/API.Tests/Helpers/EntityFactory.cs
+++ /dev/null
@@ -1,68 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-using API.Data;
-using API.Entities;
-using API.Entities.Enums;
-using API.Entities.Metadata;
-
-namespace API.Tests.Helpers;
-
-/// <summary>
-/// Used to help quickly create DB entities for Unit Testing
-/// </summary>
-public static class EntityFactory
-{
- public static Series CreateSeries(string name)
- {
- return new Series()
- {
- Name = name,
- SortName = name,
- LocalizedName = name,
- NormalizedName = API.Services.Tasks.Scanner.Parser.Parser.Normalize(name),
- Volumes = new List<Volume>(),
- Metadata = new SeriesMetadata()
- };
- }
-
- public static Volume CreateVolume(string volumeNumber, List<Chapter> chapters = null)
- {
- var chaps = chapters ?? new List<Chapter>();
- var pages = chaps.Count > 0 ? chaps.Max(c => c.Pages) : 0;
- return new Volume()
- {
- Name = volumeNumber,
- Number = (int) API.Services.Tasks.Scanner.Parser.Parser.MinNumberFromRange(volumeNumber),
- Pages = pages,
- Chapters = chaps
- };
- }
-
- public static Chapter CreateChapter(string range, bool isSpecial, List<MangaFile> files = null, int pageCount = 0)
- {
- return new Chapter()
- {
- IsSpecial = isSpecial,
- Range = range,
- Number = API.Services.Tasks.Scanner.Parser.Parser.MinNumberFromRange(range) + string.Empty,
- Files = files ?? new List<MangaFile>(),
- Pages = pageCount,
-
- };
- }
-
- public static MangaFile CreateMangaFile(string filename, MangaFormat format, int pages)
- {
- return new MangaFile()
- {
- FilePath = filename,
- Format = format,
- Pages = pages
- };
- }
-
- public static CollectionTag CreateCollectionTag(int id, string title, string summary, bool promoted)
- {
- return DbFactory.CollectionTag(id, title, summary, promoted);
- }
-}
diff --git a/API.Tests/Helpers/GenreHelperTests.cs b/API.Tests/Helpers/GenreHelperTests.cs
index 1cda535fd..fb182d601 100644
--- a/API.Tests/Helpers/GenreHelperTests.cs
+++ b/API.Tests/Helpers/GenreHelperTests.cs
@@ -2,6 +2,7 @@
using API.Data;
using API.Entities;
using API.Helpers;
+using API.Helpers.Builders;
using Xunit;
namespace API.Tests.Helpers;
@@ -13,9 +14,9 @@ public class GenreHelperTests
{
var allGenres = new List<Genre>
{
- DbFactory.Genre("Action"),
- DbFactory.Genre("action"),
- DbFactory.Genre("Sci-fi"),
+ new GenreBuilder("Action").Build(),
+ new GenreBuilder("action").Build(),
+ new GenreBuilder("Sci-fi").Build(),
};
var genreAdded = new List<Genre>();
@@ -33,9 +34,9 @@ public class GenreHelperTests
{
var allGenres = new List<Genre>
{
- DbFactory.Genre("Action"),
- DbFactory.Genre("action"),
- DbFactory.Genre("Sci-fi"),
+ new GenreBuilder("Action").Build(),
+ new GenreBuilder("action").Build(),
+ new GenreBuilder("Sci-fi").Build(),
};
var genreAdded = new List<Genre>();
@@ -54,19 +55,19 @@ public class GenreHelperTests
{
var existingGenres = new List<Genre>
{
- DbFactory.Genre("Action"),
- DbFactory.Genre("action"),
- DbFactory.Genre("Sci-fi"),
+ new GenreBuilder("Action").Build(),
+ new GenreBuilder("action").Build(),
+ new GenreBuilder("Sci-fi").Build(),
};
- GenreHelper.AddGenreIfNotExists(existingGenres, DbFactory.Genre("Action"));
+ GenreHelper.AddGenreIfNotExists(existingGenres, new GenreBuilder("Action").Build());
Assert.Equal(3, existingGenres.Count);
- GenreHelper.AddGenreIfNotExists(existingGenres, DbFactory.Genre("action"));
+ GenreHelper.AddGenreIfNotExists(existingGenres, new GenreBuilder("action").Build());
Assert.Equal(3, existingGenres.Count);
- GenreHelper.AddGenreIfNotExists(existingGenres, DbFactory.Genre("Shonen"));
+ GenreHelper.AddGenreIfNotExists(existingGenres, new GenreBuilder("Shonen").Build());
Assert.Equal(4, existingGenres.Count);
}
@@ -75,13 +76,13 @@ public class GenreHelperTests
{
var existingGenres = new List<Genre>
{
- DbFactory.Genre("Action"),
- DbFactory.Genre("Sci-fi"),
+ new GenreBuilder("Action").Build(),
+ new GenreBuilder("Sci-fi").Build(),
};
var peopleFromChapters = new List<Genre>
{
- DbFactory.Genre("Action"),
+ new GenreBuilder("Action").Build(),
};
var genreRemoved = new List<Genre>();
@@ -99,8 +100,8 @@ public class GenreHelperTests
{
var existingGenres = new List<Genre>
{
- DbFactory.Genre("Action"),
- DbFactory.Genre("Sci-fi"),
+ new GenreBuilder("Action").Build(),
+ new GenreBuilder("Sci-fi").Build(),
};
var peopleFromChapters = new List<Genre>();
diff --git a/API.Tests/Helpers/ParserInfoFactory.cs b/API.Tests/Helpers/ParserInfoFactory.cs
index 793b764b0..40d0ea4f4 100644
--- a/API.Tests/Helpers/ParserInfoFactory.cs
+++ b/API.Tests/Helpers/ParserInfoFactory.cs
@@ -3,8 +3,9 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using API.Entities.Enums;
-using API.Parser;
+using API.Extensions;
using API.Services.Tasks.Scanner;
+using API.Services.Tasks.Scanner.Parser;
namespace API.Tests.Helpers;
@@ -29,12 +30,12 @@ public static class ParserInfoFactory
public static void AddToParsedInfo(IDictionary<ParsedSeries, IList<ParserInfo>> collectedSeries, ParserInfo info)
{
var existingKey = collectedSeries.Keys.FirstOrDefault(ps =>
- ps.Format == info.Format && ps.NormalizedName == API.Services.Tasks.Scanner.Parser.Parser.Normalize(info.Series));
+ ps.Format == info.Format && ps.NormalizedName == info.Series.ToNormalized());
existingKey ??= new ParsedSeries()
{
Format = info.Format,
Name = info.Series,
- NormalizedName = API.Services.Tasks.Scanner.Parser.Parser.Normalize(info.Series)
+ NormalizedName = info.Series.ToNormalized()
};
if (collectedSeries.GetType() == typeof(ConcurrentDictionary<,>))
{
diff --git a/API.Tests/Helpers/ParserInfoHelperTests.cs b/API.Tests/Helpers/ParserInfoHelperTests.cs
index e51362b81..70ce3aa69 100644
--- a/API.Tests/Helpers/ParserInfoHelperTests.cs
+++ b/API.Tests/Helpers/ParserInfoHelperTests.cs
@@ -2,9 +2,11 @@
using API.Entities;
using API.Entities.Enums;
using API.Entities.Metadata;
+using API.Extensions;
using API.Helpers;
-using API.Parser;
+using API.Helpers.Builders;
using API.Services.Tasks.Scanner;
+using API.Services.Tasks.Scanner.Parser;
using Xunit;
namespace API.Tests.Helpers;
@@ -21,23 +23,13 @@ public class ParserInfoHelperTests
ParserInfoFactory.AddToParsedInfo(infos, new ParserInfo() {Series = "Darker than Black", Volumes = "1", Format = MangaFormat.Archive});
//AddToParsedInfo(infos, new ParserInfo() {Series = "Darker than Black", Volumes = "1", Format = MangaFormat.Epub});
- var series = new Series()
- {
- Name = "Darker Than Black",
- LocalizedName = "Darker Than Black",
- OriginalName = "Darker Than Black",
- Volumes = new List<Volume>()
- {
- new Volume()
- {
- Number = 1,
- Name = "1"
- }
- },
- NormalizedName = API.Services.Tasks.Scanner.Parser.Parser.Normalize("Darker Than Black"),
- Metadata = new SeriesMetadata(),
- Format = MangaFormat.Epub
- };
+ var series = new SeriesBuilder("Darker Than Black")
+ .WithFormat(MangaFormat.Epub)
+ .WithVolume(new VolumeBuilder("1")
+ .WithName("1")
+ .Build())
+ .WithLocalizedName("Darker Than Black")
+ .Build();
Assert.False(ParserInfoHelpers.SeriesHasMatchingParserInfoFormat(series, infos));
}
@@ -50,23 +42,14 @@ public class ParserInfoHelperTests
ParserInfoFactory.AddToParsedInfo(infos, new ParserInfo() {Series = "Darker than Black", Volumes = "1", Format = MangaFormat.Archive});
ParserInfoFactory.AddToParsedInfo(infos, new ParserInfo() {Series = "Darker than Black", Volumes = "1", Format = MangaFormat.Epub});
- var series = new Series()
- {
- Name = "Darker Than Black",
- LocalizedName = "Darker Than Black",
- OriginalName = "Darker Than Black",
- Volumes = new List<Volume>()
- {
- new Volume()
- {
- Number = 1,
- Name = "1"
- }
- },
- NormalizedName = API.Services.Tasks.Scanner.Parser.Parser.Normalize("Darker Than Black"),
- Metadata = new SeriesMetadata(),
- Format = MangaFormat.Epub
- };
+
+ var series = new SeriesBuilder("Darker Than Black")
+ .WithFormat(MangaFormat.Epub)
+ .WithVolume(new VolumeBuilder("1")
+ .WithName("1")
+ .Build())
+ .WithLocalizedName("Darker Than Black")
+ .Build();
Assert.True(ParserInfoHelpers.SeriesHasMatchingParserInfoFormat(series, infos));
}
diff --git a/API.Tests/Helpers/PersonHelperTests.cs b/API.Tests/Helpers/PersonHelperTests.cs
index 85f1687c9..112bbf42b 100644
--- a/API.Tests/Helpers/PersonHelperTests.cs
+++ b/API.Tests/Helpers/PersonHelperTests.cs
@@ -1,22 +1,26 @@
using System;
using System.Collections.Generic;
+using System.Linq;
using API.Data;
+using API.DTOs;
using API.Entities;
using API.Entities.Enums;
using API.Helpers;
+using API.Helpers.Builders;
using Xunit;
namespace API.Tests.Helpers;
public class PersonHelperTests
{
+ #region UpdatePeople
[Fact]
public void UpdatePeople_ShouldAddNewPeople()
{
var allPeople = new List<Person>
{
- DbFactory.Person("Joe Shmo", PersonRole.CoverArtist),
- DbFactory.Person("Joe Shmo", PersonRole.Writer)
+ new PersonBuilder("Joe Shmo", PersonRole.CoverArtist).Build(),
+ new PersonBuilder("Joe Shmo", PersonRole.Writer).Build(),
};
var peopleAdded = new List<Person>();
@@ -34,9 +38,9 @@ public class PersonHelperTests
{
var allPeople = new List<Person>
{
- DbFactory.Person("Joe Shmo", PersonRole.CoverArtist),
- DbFactory.Person("Joe Shmo", PersonRole.Writer),
- DbFactory.Person("Sally Ann", PersonRole.CoverArtist),
+ new PersonBuilder("Joe Shmo", PersonRole.CoverArtist).Build(),
+ new PersonBuilder("Joe Shmo", PersonRole.Writer).Build(),
+ new PersonBuilder("Sally Ann", PersonRole.CoverArtist).Build(),
};
var peopleAdded = new List<Person>();
@@ -48,14 +52,166 @@ public class PersonHelperTests
Assert.Equal(3, allPeople.Count);
}
+ #endregion
+ #region UpdatePeopleList
+
+ [Fact]
+ public void UpdatePeopleList_NullTags_NoChanges()
+ {
+ // Arrange
+ ICollection<PersonDto> tags = null;
+ var series = new SeriesBuilder("Test Series").Build();
+ var allTags = new List<Person>();
+ var handleAddCalled = false;
+ var onModifiedCalled = false;
+
+ // Act
+ PersonHelper.UpdatePeopleList(PersonRole.Writer, tags, series, allTags, p => handleAddCalled = true, () => onModifiedCalled = true);
+
+ // Assert
+ Assert.False(handleAddCalled);
+ Assert.False(onModifiedCalled);
+ }
+
+ [Fact]
+ public void UpdatePeopleList_AddNewTag_TagAddedAndOnModifiedCalled()
+ {
+ // Arrange
+ const PersonRole role = PersonRole.Writer;
+ var tags = new List<PersonDto>
+ {
+ new PersonDto { Id = 1, Name = "John Doe", Role = role }
+ };
+ var series = new SeriesBuilder("Test Series").Build();
+ var allTags = new List<Person>();
+ var handleAddCalled = false;
+ var onModifiedCalled = false;
+
+ // Act
+ PersonHelper.UpdatePeopleList(role, tags, series, allTags, p =>
+ {
+ handleAddCalled = true;
+ series.Metadata.People.Add(p);
+ }, () => onModifiedCalled = true);
+
+ // Assert
+ Assert.True(handleAddCalled);
+ Assert.True(onModifiedCalled);
+ Assert.Single(series.Metadata.People);
+ Assert.Equal("John Doe", series.Metadata.People.First().Name);
+ }
+
+ [Fact]
+ public void UpdatePeopleList_RemoveExistingTag_TagRemovedAndOnModifiedCalled()
+ {
+ // Arrange
+ const PersonRole role = PersonRole.Writer;
+ var tags = new List<PersonDto>();
+ var series = new SeriesBuilder("Test Series").Build();
+ var person = new PersonBuilder("John Doe", role).Build();
+ person.Id = 1;
+ series.Metadata.People.Add(person);
+ var allTags = new List<Person>
+ {
+ person
+ };
+ var handleAddCalled = false;
+ var onModifiedCalled = false;
+
+ // Act
+ PersonHelper.UpdatePeopleList(role, tags, series, allTags, p =>
+ {
+ handleAddCalled = true;
+ series.Metadata.People.Add(p);
+ }, () => onModifiedCalled = true);
+
+ // Assert
+ Assert.False(handleAddCalled);
+ Assert.True(onModifiedCalled);
+ Assert.Empty(series.Metadata.People);
+ }
+
+ [Fact]
+ public void UpdatePeopleList_UpdateExistingTag_OnModifiedCalled()
+ {
+ // Arrange
+ const PersonRole role = PersonRole.Writer;
+ var tags = new List<PersonDto>
+ {
+ new PersonDto { Id = 1, Name = "John Doe", Role = role }
+ };
+ var series = new SeriesBuilder("Test Series").Build();
+ var person = new PersonBuilder("John Doe", role).Build();
+ person.Id = 1;
+ series.Metadata.People.Add(person);
+ var allTags = new List<Person>
+ {
+ person
+ };
+ var handleAddCalled = false;
+ var onModifiedCalled = false;
+
+ // Act
+ PersonHelper.UpdatePeopleList(role, tags, series, allTags, p =>
+ {
+ handleAddCalled = true;
+ series.Metadata.People.Add(p);
+ }, () => onModifiedCalled = true);
+
+ // Assert
+ Assert.False(handleAddCalled);
+ Assert.False(onModifiedCalled);
+ Assert.Single(series.Metadata.People);
+ Assert.Equal("John Doe", series.Metadata.People.First().Name);
+ }
+
+ [Fact]
+ public void UpdatePeopleList_NoChanges_HandleAddAndOnModifiedNotCalled()
+ {
+ // Arrange
+ const PersonRole role = PersonRole.Writer;
+ var tags = new List<PersonDto>
+ {
+ new PersonDto { Id = 1, Name = "John Doe", Role = role }
+ };
+ var series = new SeriesBuilder("Test Series").Build();
+ var person = new PersonBuilder("John Doe", role).Build();
+ person.Id = 1;
+ series.Metadata.People.Add(person);
+ var allTags = new List<Person>
+ {
+ new PersonBuilder("John Doe", role).Build()
+ };
+ var handleAddCalled = false;
+ var onModifiedCalled = false;
+
+ // Act
+ PersonHelper.UpdatePeopleList(role, tags, series, allTags, p =>
+ {
+ handleAddCalled = true;
+ series.Metadata.People.Add(p);
+ }, () => onModifiedCalled = true);
+
+ // Assert
+ Assert.False(handleAddCalled);
+ Assert.False(onModifiedCalled);
+ Assert.Single(series.Metadata.People);
+ Assert.Equal("John Doe", series.Metadata.People.First().Name);
+ }
+
+
+
+ #endregion
+
+ #region RemovePeople
[Fact]
public void RemovePeople_ShouldRemovePeopleOfSameRole()
{
var existingPeople = new List<Person>
{
- DbFactory.Person("Joe Shmo", PersonRole.CoverArtist),
- DbFactory.Person("Joe Shmo", PersonRole.Writer)
+ new PersonBuilder("Joe Shmo", PersonRole.CoverArtist).Build(),
+ new PersonBuilder("Joe Shmo", PersonRole.Writer).Build(),
};
var peopleRemoved = new List<Person>();
PersonHelper.RemovePeople(existingPeople, new[] {"Joe Shmo", "Sally Ann"}, PersonRole.Writer, person =>
@@ -72,8 +228,8 @@ public class PersonHelperTests
{
var existingPeople = new List<Person>
{
- DbFactory.Person("Joe Shmo", PersonRole.CoverArtist),
- DbFactory.Person("Joe Shmo", PersonRole.Writer)
+ new PersonBuilder("Joe Shmo", PersonRole.CoverArtist).Build(),
+ new PersonBuilder("Joe Shmo", PersonRole.Writer).Build(),
};
var peopleRemoved = new List<Person>();
PersonHelper.RemovePeople(existingPeople, new[] {"Joe Shmo", "Sally Ann"}, PersonRole.Writer, person =>
@@ -98,9 +254,9 @@ public class PersonHelperTests
{
var existingPeople = new List<Person>
{
- DbFactory.Person("Joe Shmo", PersonRole.Writer),
- DbFactory.Person("Joe Shmo", PersonRole.Writer),
- DbFactory.Person("Joe Shmo", PersonRole.CoverArtist)
+ new PersonBuilder("Joe Shmo", PersonRole.CoverArtist).Build(),
+ new PersonBuilder("Joe Shmo", PersonRole.Writer).Build(),
+ new PersonBuilder("Joe Shmo", PersonRole.Writer).Build(),
};
var peopleRemoved = new List<Person>();
PersonHelper.RemovePeople(existingPeople, new List<string>(), PersonRole.Writer, person =>
@@ -112,19 +268,23 @@ public class PersonHelperTests
Assert.Equal(2, peopleRemoved.Count);
}
+
+ #endregion
+
+ #region KeepOnlySamePeopleBetweenLists
[Fact]
public void KeepOnlySamePeopleBetweenLists()
{
var existingPeople = new List<Person>
{
- DbFactory.Person("Joe Shmo", PersonRole.CoverArtist),
- DbFactory.Person("Joe Shmo", PersonRole.Writer),
- DbFactory.Person("Sally", PersonRole.Writer),
+ new PersonBuilder("Joe Shmo", PersonRole.CoverArtist).Build(),
+ new PersonBuilder("Joe Shmo", PersonRole.Writer).Build(),
+ new PersonBuilder("Sally", PersonRole.Writer).Build(),
};
var peopleFromChapters = new List<Person>
{
- DbFactory.Person("Joe Shmo", PersonRole.CoverArtist),
+ new PersonBuilder("Joe Shmo", PersonRole.CoverArtist).Build(),
};
var peopleRemoved = new List<Person>();
@@ -136,26 +296,120 @@ public class PersonHelperTests
Assert.Equal(2, peopleRemoved.Count);
}
+ #endregion
+
+ #region AddPeople
+
+ [Fact]
+ public void AddPersonIfNotExists_ShouldAddPerson_WhenPersonDoesNotExist()
+ {
+ // Arrange
+ var metadataPeople = new List<Person>();
+ var person = new PersonBuilder("John Smith", PersonRole.Character).Build();
+
+ // Act
+ PersonHelper.AddPersonIfNotExists(metadataPeople, person);
+
+ // Assert
+ Assert.Single(metadataPeople);
+ Assert.Contains(person, metadataPeople);
+ }
+
+ [Fact]
+ public void AddPersonIfNotExists_ShouldNotAddPerson_WhenPersonAlreadyExists()
+ {
+ // Arrange
+ var metadataPeople = new List<Person>
+ {
+ new PersonBuilder("John Smith", PersonRole.Character)
+ .WithId(1)
+ .Build()
+ };
+ var person = new PersonBuilder("John Smith", PersonRole.Character).Build();
+ // Act
+ PersonHelper.AddPersonIfNotExists(metadataPeople, person);
+
+ // Assert
+ Assert.Single(metadataPeople);
+ Assert.NotNull(metadataPeople.SingleOrDefault(p =>
+ p.Name.Equals(person.Name) && p.Role == person.Role && p.NormalizedName == person.NormalizedName));
+ Assert.Equal(1, metadataPeople.First().Id);
+ }
+
+ [Fact]
+ public void AddPersonIfNotExists_ShouldNotAddPerson_WhenPersonNameIsNullOrEmpty()
+ {
+ // Arrange
+ var metadataPeople = new List<Person>();
+ var person2 = new PersonBuilder(string.Empty, PersonRole.Character).Build();
+
+ // Act
+ PersonHelper.AddPersonIfNotExists(metadataPeople, person2);
+
+ // Assert
+ Assert.Empty(metadataPeople);
+ }
+
+ [Fact]
+ public void AddPersonIfNotExists_ShouldAddPerson_WhenPersonNameIsDifferentButRoleIsSame()
+ {
+ // Arrange
+ var metadataPeople = new List<Person>
+ {
+ new PersonBuilder("John Smith", PersonRole.Character).Build()
+ };
+ var person = new PersonBuilder("John Doe", PersonRole.Character).Build();
+
+ // Act
+ PersonHelper.AddPersonIfNotExists(metadataPeople, person);
+
+ // Assert
+ Assert.Equal(2, metadataPeople.Count);
+ Assert.Contains(person, metadataPeople);
+ }
+
+ [Fact]
+ public void AddPersonIfNotExists_ShouldAddPerson_WhenPersonNameIsSameButRoleIsDifferent()
+ {
+ // Arrange
+ var metadataPeople = new List<Person>
+ {
+ new PersonBuilder("John Doe", PersonRole.Writer).Build()
+ };
+ var person = new PersonBuilder("John Smith", PersonRole.Character).Build();
+
+ // Act
+ PersonHelper.AddPersonIfNotExists(metadataPeople, person);
+
+ // Assert
+ Assert.Equal(2, metadataPeople.Count);
+ Assert.Contains(person, metadataPeople);
+ }
+
+
+
[Fact]
public void AddPeople_ShouldAddOnlyNonExistingPeople()
{
var existingPeople = new List<Person>
{
- DbFactory.Person("Joe Shmo", PersonRole.CoverArtist),
- DbFactory.Person("Joe Shmo", PersonRole.Writer),
- DbFactory.Person("Sally", PersonRole.Writer),
+ new PersonBuilder("Joe Shmo", PersonRole.CoverArtist).Build(),
+ new PersonBuilder("Joe Shmo", PersonRole.Writer).Build(),
+ new PersonBuilder("Sally", PersonRole.Writer).Build(),
};
- PersonHelper.AddPersonIfNotExists(existingPeople, DbFactory.Person("Joe Shmo", PersonRole.CoverArtist));
+ PersonHelper.AddPersonIfNotExists(existingPeople, new PersonBuilder("Joe Shmo", PersonRole.CoverArtist).Build());
Assert.Equal(3, existingPeople.Count);
- PersonHelper.AddPersonIfNotExists(existingPeople, DbFactory.Person("Joe Shmo", PersonRole.Writer));
+ PersonHelper.AddPersonIfNotExists(existingPeople, new PersonBuilder("Joe Shmo", PersonRole.Writer).Build());
Assert.Equal(3, existingPeople.Count);
- PersonHelper.AddPersonIfNotExists(existingPeople, DbFactory.Person("Joe Shmo Two", PersonRole.CoverArtist));
+ PersonHelper.AddPersonIfNotExists(existingPeople, new PersonBuilder("Joe Shmo Two", PersonRole.CoverArtist).Build());
Assert.Equal(4, existingPeople.Count);
}
+ #endregion
+
}
diff --git a/API.Tests/Helpers/SeriesHelperTests.cs b/API.Tests/Helpers/SeriesHelperTests.cs
index 139803e0a..a5b5a063b 100644
--- a/API.Tests/Helpers/SeriesHelperTests.cs
+++ b/API.Tests/Helpers/SeriesHelperTests.cs
@@ -3,7 +3,9 @@ using System.Linq;
using API.Data;
using API.Entities;
using API.Entities.Enums;
+using API.Extensions;
using API.Helpers;
+using API.Helpers.Builders;
using API.Services.Tasks.Scanner;
using Xunit;
@@ -15,147 +17,161 @@ public class SeriesHelperTests
[Fact]
public void FindSeries_ShouldFind_SameFormat()
{
- var series = DbFactory.Series("Darker than Black");
+ var series = new SeriesBuilder("Darker than Black").Build();
series.OriginalName = "Something Random";
series.Format = MangaFormat.Archive;
Assert.True(SeriesHelper.FindSeries(series, new ParsedSeries()
{
Format = MangaFormat.Archive,
Name = "Darker than Black",
- NormalizedName = API.Services.Tasks.Scanner.Parser.Parser.Normalize("Darker than Black")
+ NormalizedName = "Darker than Black".ToNormalized()
}));
Assert.True(SeriesHelper.FindSeries(series, new ParsedSeries()
{
Format = MangaFormat.Archive,
Name = "Darker than Black".ToLower(),
- NormalizedName = API.Services.Tasks.Scanner.Parser.Parser.Normalize("Darker than Black")
+ NormalizedName = "Darker than Black".ToNormalized()
}));
Assert.True(SeriesHelper.FindSeries(series, new ParsedSeries()
{
Format = MangaFormat.Archive,
Name = "Darker than Black".ToUpper(),
- NormalizedName = API.Services.Tasks.Scanner.Parser.Parser.Normalize("Darker than Black")
+ NormalizedName = "Darker than Black".ToNormalized()
+ }));
+ }
+
+ [Fact]
+ public void FindSeries_ShouldFind_NullName()
+ {
+ var series = new SeriesBuilder("Darker than Black").Build();
+ series.OriginalName = null;
+ series.Format = MangaFormat.Archive;
+ Assert.True(SeriesHelper.FindSeries(series, new ParsedSeries()
+ {
+ Format = MangaFormat.Archive,
+ Name = "Darker than Black",
+ NormalizedName = "Darker than Black".ToNormalized()
}));
}
[Fact]
public void FindSeries_ShouldNotFind_WrongFormat()
{
- var series = DbFactory.Series("Darker than Black");
+ var series = new SeriesBuilder("Darker than Black").Build();
series.OriginalName = "Something Random";
series.Format = MangaFormat.Archive;
Assert.False(SeriesHelper.FindSeries(series, new ParsedSeries()
{
Format = MangaFormat.Image,
Name = "Darker than Black",
- NormalizedName = API.Services.Tasks.Scanner.Parser.Parser.Normalize("Darker than Black")
+ NormalizedName = "Darker than Black".ToNormalized()
}));
Assert.False(SeriesHelper.FindSeries(series, new ParsedSeries()
{
Format = MangaFormat.Image,
Name = "Darker than Black".ToLower(),
- NormalizedName = API.Services.Tasks.Scanner.Parser.Parser.Normalize("Darker than Black")
+ NormalizedName = "Darker than Black".ToNormalized()
}));
Assert.False(SeriesHelper.FindSeries(series, new ParsedSeries()
{
Format = MangaFormat.Image,
Name = "Darker than Black".ToUpper(),
- NormalizedName = API.Services.Tasks.Scanner.Parser.Parser.Normalize("Darker than Black")
+ NormalizedName = "Darker than Black".ToNormalized()
}));
}
[Fact]
public void FindSeries_ShouldFind_UsingOriginalName()
{
- var series = DbFactory.Series("Darker than Black");
+ var series = new SeriesBuilder("Darker than Black").Build();
series.OriginalName = "Something Random";
series.Format = MangaFormat.Image;
Assert.True(SeriesHelper.FindSeries(series, new ParsedSeries()
{
Format = MangaFormat.Image,
Name = "Something Random",
- NormalizedName = API.Services.Tasks.Scanner.Parser.Parser.Normalize("Something Random")
+ NormalizedName = "Something Random".ToNormalized()
}));
Assert.True(SeriesHelper.FindSeries(series, new ParsedSeries()
{
Format = MangaFormat.Image,
Name = "Something Random".ToLower(),
- NormalizedName = API.Services.Tasks.Scanner.Parser.Parser.Normalize("Something Random")
+ NormalizedName = "Something Random".ToNormalized()
}));
Assert.True(SeriesHelper.FindSeries(series, new ParsedSeries()
{
Format = MangaFormat.Image,
Name = "Something Random".ToUpper(),
- NormalizedName = API.Services.Tasks.Scanner.Parser.Parser.Normalize("Something Random")
+ NormalizedName = "Something Random".ToNormalized()
}));
Assert.True(SeriesHelper.FindSeries(series, new ParsedSeries()
{
Format = MangaFormat.Image,
Name = "SomethingRandom".ToUpper(),
- NormalizedName = API.Services.Tasks.Scanner.Parser.Parser.Normalize("SomethingRandom")
+ NormalizedName = "SomethingRandom".ToNormalized()
}));
}
[Fact]
public void FindSeries_ShouldFind_UsingLocalizedName()
{
- var series = DbFactory.Series("Darker than Black");
+ var series = new SeriesBuilder("Darker than Black").Build();
series.LocalizedName = "Something Random";
series.Format = MangaFormat.Image;
Assert.True(SeriesHelper.FindSeries(series, new ParsedSeries()
{
Format = MangaFormat.Image,
Name = "Something Random",
- NormalizedName = API.Services.Tasks.Scanner.Parser.Parser.Normalize("Something Random")
+ NormalizedName = "Something Random".ToNormalized()
}));
Assert.True(SeriesHelper.FindSeries(series, new ParsedSeries()
{
Format = MangaFormat.Image,
Name = "Something Random".ToLower(),
- NormalizedName = API.Services.Tasks.Scanner.Parser.Parser.Normalize("Something Random")
+ NormalizedName = "Something Random".ToNormalized()
}));
Assert.True(SeriesHelper.FindSeries(series, new ParsedSeries()
{
Format = MangaFormat.Image,
Name = "Something Random".ToUpper(),
- NormalizedName = API.Services.Tasks.Scanner.Parser.Parser.Normalize("Something Random")
+ NormalizedName = "Something Random".ToNormalized()
}));
Assert.True(SeriesHelper.FindSeries(series, new ParsedSeries()
{
Format = MangaFormat.Image,
Name = "SomethingRandom".ToUpper(),
- NormalizedName = API.Services.Tasks.Scanner.Parser.Parser.Normalize("SomethingRandom")
+ NormalizedName = "SomethingRandom".ToNormalized()
}));
}
[Fact]
public void FindSeries_ShouldFind_UsingLocalizedName_2()
{
- var series = DbFactory.Series("My Dress-Up Darling");
+ var series = new SeriesBuilder("My Dress-Up Darling").Build();
series.LocalizedName = "Sono Bisque Doll wa Koi wo Suru";
series.Format = MangaFormat.Archive;
Assert.True(SeriesHelper.FindSeries(series, new ParsedSeries()
{
Format = MangaFormat.Archive,
Name = "My Dress-Up Darling",
- NormalizedName = API.Services.Tasks.Scanner.Parser.Parser.Normalize("My Dress-Up Darling")
+ NormalizedName = "My Dress-Up Darling".ToNormalized()
}));
Assert.True(SeriesHelper.FindSeries(series, new ParsedSeries()
{
Format = MangaFormat.Archive,
Name = "Sono Bisque Doll wa Koi wo Suru".ToLower(),
- NormalizedName = API.Services.Tasks.Scanner.Parser.Parser.Normalize("Sono Bisque Doll wa Koi wo Suru")
+ NormalizedName = "Sono Bisque Doll wa Koi wo Suru".ToNormalized()
}));
}
#endregion
@@ -165,13 +181,13 @@ public class SeriesHelperTests
{
var existingSeries = new List<Series>()
{
- EntityFactory.CreateSeries("Darker than Black Vol 1"),
- EntityFactory.CreateSeries("Darker than Black"),
- EntityFactory.CreateSeries("Beastars"),
+ new SeriesBuilder("Darker than Black Vol 1").Build(),
+ new SeriesBuilder("Darker than Black").Build(),
+ new SeriesBuilder("Beastars").Build(),
};
var missingSeries = new List<Series>()
{
- EntityFactory.CreateSeries("Darker than Black Vol 1"),
+ new SeriesBuilder("Darker than Black Vol 1").Build(),
};
existingSeries = SeriesHelper.RemoveMissingSeries(existingSeries, missingSeries, out var removeCount).ToList();
diff --git a/API.Tests/Helpers/TagHelperTests.cs b/API.Tests/Helpers/TagHelperTests.cs
index bc8c1be17..0f1cb4200 100644
--- a/API.Tests/Helpers/TagHelperTests.cs
+++ b/API.Tests/Helpers/TagHelperTests.cs
@@ -2,6 +2,7 @@
using API.Data;
using API.Entities;
using API.Helpers;
+using API.Helpers.Builders;
using Xunit;
namespace API.Tests.Helpers;
@@ -13,9 +14,9 @@ public class TagHelperTests
{
var allTags = new List<Tag>
{
- DbFactory.Tag("Action"),
- DbFactory.Tag("action"),
- DbFactory.Tag("Sci-fi"),
+ new TagBuilder("Action").Build(),
+ new TagBuilder("action").Build(),
+ new TagBuilder("Sci-fi").Build(),
};
var tagAdded = new List<Tag>();
@@ -37,9 +38,9 @@ public class TagHelperTests
{
var allTags = new List<Tag>
{
- DbFactory.Tag("Action"),
- DbFactory.Tag("action"),
- DbFactory.Tag("Sci-fi"),
+ new TagBuilder("Action").Build(),
+ new TagBuilder("action").Build(),
+ new TagBuilder("Sci-fi").Build(),
};
var tagAdded = new List<Tag>();
@@ -62,19 +63,19 @@ public class TagHelperTests
{
var existingTags = new List<Tag>
{
- DbFactory.Tag("Action"),
- DbFactory.Tag("action"),
- DbFactory.Tag("Sci-fi"),
+ new TagBuilder("Action").Build(),
+ new TagBuilder("action").Build(),
+ new TagBuilder("Sci-fi").Build(),
};
- TagHelper.AddTagIfNotExists(existingTags, DbFactory.Tag("Action"));
+ TagHelper.AddTagIfNotExists(existingTags, new TagBuilder("Action").Build());
Assert.Equal(3, existingTags.Count);
- TagHelper.AddTagIfNotExists(existingTags, DbFactory.Tag("action"));
+ TagHelper.AddTagIfNotExists(existingTags, new TagBuilder("action").Build());
Assert.Equal(3, existingTags.Count);
- TagHelper.AddTagIfNotExists(existingTags, DbFactory.Tag("Shonen"));
+ TagHelper.AddTagIfNotExists(existingTags, new TagBuilder("Shonen").Build());
Assert.Equal(4, existingTags.Count);
}
@@ -83,13 +84,13 @@ public class TagHelperTests
{
var existingTags = new List<Tag>
{
- DbFactory.Tag("Action"),
- DbFactory.Tag("Sci-fi"),
+ new TagBuilder("Action").Build(),
+ new TagBuilder("Sci-fi").Build(),
};
var peopleFromChapters = new List<Tag>
{
- DbFactory.Tag("Action"),
+ new TagBuilder("Action").Build(),
};
var tagRemoved = new List<Tag>();
@@ -107,8 +108,8 @@ public class TagHelperTests
{
var existingTags = new List<Tag>
{
- DbFactory.Tag("Action"),
- DbFactory.Tag("Sci-fi"),
+ new TagBuilder("Action").Build(),
+ new TagBuilder("Sci-fi").Build(),
};
var peopleFromChapters = new List<Tag>();
diff --git a/API.Tests/Parser/ComicParserTests.cs b/API.Tests/Parser/ComicParserTests.cs
index 9b6bf212d..72129a777 100644
--- a/API.Tests/Parser/ComicParserTests.cs
+++ b/API.Tests/Parser/ComicParserTests.cs
@@ -1,5 +1,4 @@
using System.IO.Abstractions.TestingHelpers;
-using API.Parser;
using API.Services;
using API.Services.Tasks.Scanner.Parser;
using Microsoft.Extensions.Logging;
diff --git a/API.Tests/Parser/DefaultParserTests.cs b/API.Tests/Parser/DefaultParserTests.cs
index 7f843b552..61ed57aca 100644
--- a/API.Tests/Parser/DefaultParserTests.cs
+++ b/API.Tests/Parser/DefaultParserTests.cs
@@ -1,7 +1,8 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using System.IO.Abstractions.TestingHelpers;
+using System.Linq;
using API.Entities.Enums;
-using API.Parser;
using API.Services;
using API.Services.Tasks.Scanner.Parser;
using Microsoft.Extensions.Logging;
@@ -51,7 +52,7 @@ public class DefaultParserTests
{
const string rootDirectory = "/manga/";
var tokens = expectedParseInfo.Split("~");
- var actual = new ParserInfo {Chapters = "0", Volumes = "0"};
+ var actual = new ParserInfo {Series = "", Chapters = "0", Volumes = "0"};
_defaultParser.ParseFromFallbackFolders(inputFile, rootDirectory, LibraryType.Manga, ref actual);
Assert.Equal(tokens[0], actual.Series);
Assert.Equal(tokens[1], actual.Volumes);
@@ -100,6 +101,14 @@ public class DefaultParserTests
#region Parse
+ [Fact]
+ public void Parse_MangaLibrary_JustCover_ShouldReturnNull()
+ {
+ const string rootPath = @"E:/Manga/";
+ var actual = _defaultParser.Parse(@"E:/Manga/Accel World/cover.png", rootPath);
+ Assert.Null(actual);
+ }
+
[Fact]
public void Parse_ParseInfo_Manga()
{
diff --git a/API.Tests/Parser/MangaParserTests.cs b/API.Tests/Parser/MangaParserTests.cs
index 20c1a27ae..208ace3bc 100644
--- a/API.Tests/Parser/MangaParserTests.cs
+++ b/API.Tests/Parser/MangaParserTests.cs
@@ -1,4 +1,3 @@
-using System.Runtime.InteropServices;
using API.Entities.Enums;
using Xunit;
using Xunit.Abstractions;
@@ -82,6 +81,7 @@ public class MangaParserTests
[InlineData("몰?루 아카이브 7.5권", "7.5")]
[InlineData("63권#200", "63")]
[InlineData("시즌34삽화2", "34")]
+ [InlineData("Accel World Chapter 001 Volume 002", "2")]
public void ParseVolumeTest(string filename, string expected)
{
Assert.Equal(expected, API.Services.Tasks.Scanner.Parser.Parser.ParseVolume(filename));
@@ -196,6 +196,7 @@ public class MangaParserTests
[InlineData("Манга Том 1 3-4 Глава", "Манга")]
[InlineData("Esquire 6권 2021년 10월호", "Esquire")]
[InlineData("Accel World: Vol 1", "Accel World")]
+ [InlineData("Accel World Chapter 001 Volume 002", "Accel World")]
public void ParseSeriesTest(string filename, string expected)
{
Assert.Equal(expected, API.Services.Tasks.Scanner.Parser.Parser.ParseSeries(filename));
@@ -279,6 +280,7 @@ public class MangaParserTests
[InlineData("Манга Глава 2", "2")]
[InlineData("Манга 2 Глава", "2")]
[InlineData("Манга Том 1 2 Глава", "2")]
+ [InlineData("Accel World Chapter 001 Volume 002", "1")]
public void ParseChaptersTest(string filename, string expected)
{
Assert.Equal(expected, API.Services.Tasks.Scanner.Parser.Parser.ParseChapter(filename));
diff --git a/API.Tests/Parser/ParserInfoTests.cs b/API.Tests/Parser/ParserInfoTests.cs
index ee4881eff..e7c48317b 100644
--- a/API.Tests/Parser/ParserInfoTests.cs
+++ b/API.Tests/Parser/ParserInfoTests.cs
@@ -1,5 +1,5 @@
using API.Entities.Enums;
-using API.Parser;
+using API.Services.Tasks.Scanner.Parser;
using Xunit;
namespace API.Tests.Parser;
diff --git a/API.Tests/Parser/ParserTest.cs b/API.Tests/Parser/ParserTest.cs
index e2f06465b..886643893 100644
--- a/API.Tests/Parser/ParserTest.cs
+++ b/API.Tests/Parser/ParserTest.cs
@@ -249,7 +249,7 @@ public class ParserTests
[InlineData("The ()quick brown fox jumps over the lazy dog")]
[InlineData("The (quick (brown)) fox jumps over the lazy dog")]
[InlineData("The (quick (brown) fox jumps over the lazy dog)")]
- public void BalancedParenTestMatches(string input)
+ public void BalancedParenTest_Matches(string input)
{
Assert.Matches($@"^{BalancedParen}$", input);
}
@@ -261,7 +261,7 @@ public class ParserTests
[InlineData("The quick (brown)) fox jumps over the lazy dog")]
[InlineData("The quick (brown) fox jumps over the lazy dog)")]
[InlineData("(The ))(quick (brown) fox jumps over the lazy dog")]
- public void BalancedParenTestDoesNotMatch(string input)
+ public void BalancedParenTest_DoesNotMatch(string input)
{
Assert.DoesNotMatch($@"^{BalancedParen}$", input);
}
@@ -273,9 +273,9 @@ public class ParserTests
[InlineData("The []quick brown fox jumps over the lazy dog")]
[InlineData("The [quick [brown]] fox jumps over the lazy dog")]
[InlineData("The [quick [brown] fox jumps over the lazy dog]")]
- public void BalancedBrackTestMatches(string input)
+ public void BalancedBracketTest_Matches(string input)
{
- Assert.Matches($@"^{BalancedBrack}$", input);
+ Assert.Matches($@"^{BalancedBracket}$", input);
}
[Theory]
@@ -285,8 +285,8 @@ public class ParserTests
[InlineData("The quick [brown]] fox jumps over the lazy dog")]
[InlineData("The quick [brown] fox jumps over the lazy dog]")]
[InlineData("[The ]][quick [brown] fox jumps over the lazy dog")]
- public void BalancedBrackTestDoesNotMatch(string input)
+ public void BalancedBracketTest_DoesNotMatch(string input)
{
- Assert.DoesNotMatch($@"^{BalancedBrack}$", input);
+ Assert.DoesNotMatch($@"^{BalancedBracket}$", input);
}
}
diff --git a/API.Tests/Repository/CollectionTagRepositoryTests.cs b/API.Tests/Repository/CollectionTagRepositoryTests.cs
new file mode 100644
index 000000000..1859ab1fc
--- /dev/null
+++ b/API.Tests/Repository/CollectionTagRepositoryTests.cs
@@ -0,0 +1,178 @@
+using System.Collections.Generic;
+using System.Data.Common;
+using System.IO.Abstractions.TestingHelpers;
+using System.Linq;
+using System.Threading.Tasks;
+using API.Data;
+using API.Entities;
+using API.Entities.Enums;
+using API.Helpers;
+using API.Helpers.Builders;
+using API.Services;
+using AutoMapper;
+using Microsoft.Data.Sqlite;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.Extensions.Logging;
+using NSubstitute;
+using Xunit;
+
+namespace API.Tests.Repository;
+
+public class CollectionTagRepositoryTests
+{
+ private readonly IUnitOfWork _unitOfWork;
+
+ private readonly DbConnection _connection;
+ private readonly DataContext _context;
+
+ private const string CacheDirectory = "C:/kavita/config/cache/";
+ private const string CoverImageDirectory = "C:/kavita/config/covers/";
+ private const string BackupDirectory = "C:/kavita/config/backups/";
+ private const string DataDirectory = "C:/data/";
+
+ public CollectionTagRepositoryTests()
+ {
+ var contextOptions = new DbContextOptionsBuilder().UseSqlite(CreateInMemoryDatabase()).Options;
+ _connection = RelationalOptionsExtension.Extract(contextOptions).Connection;
+
+ _context = new DataContext(contextOptions);
+ Task.Run(SeedDb).GetAwaiter().GetResult();
+
+ var config = new MapperConfiguration(cfg => cfg.AddProfile<AutoMapperProfiles>());
+ var mapper = config.CreateMapper();
+ _unitOfWork = new UnitOfWork(_context, mapper, null);
+ }
+
+ #region Setup
+
+ private static DbConnection CreateInMemoryDatabase()
+ {
+ var connection = new SqliteConnection("Filename=:memory:");
+
+ connection.Open();
+
+ return connection;
+ }
+
+ private async Task<bool> SeedDb()
+ {
+ await _context.Database.MigrateAsync();
+ var filesystem = CreateFileSystem();
+
+ await Seed.SeedSettings(_context,
+ new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), filesystem));
+
+ var setting = await _context.ServerSetting.Where(s => s.Key == ServerSettingKey.CacheDirectory).SingleAsync();
+ setting.Value = CacheDirectory;
+
+ setting = await _context.ServerSetting.Where(s => s.Key == ServerSettingKey.BackupDirectory).SingleAsync();
+ setting.Value = BackupDirectory;
+
+ _context.ServerSetting.Update(setting);
+
+
+ var lib = new LibraryBuilder("Manga")
+ .WithFolderPath(new FolderPathBuilder("C:/data/").Build())
+ .Build();
+
+ _context.AppUser.Add(new AppUser()
+ {
+ UserName = "majora2007",
+ Libraries = new List<Library>()
+ {
+ lib
+ }
+ });
+
+ return await _context.SaveChangesAsync() > 0;
+ }
+
+ private async Task ResetDb()
+ {
+ _context.Series.RemoveRange(_context.Series.ToList());
+ _context.AppUserRating.RemoveRange(_context.AppUserRating.ToList());
+ _context.Genre.RemoveRange(_context.Genre.ToList());
+ _context.CollectionTag.RemoveRange(_context.CollectionTag.ToList());
+ _context.Person.RemoveRange(_context.Person.ToList());
+
+ await _context.SaveChangesAsync();
+ }
+
+ private static MockFileSystem CreateFileSystem()
+ {
+ var fileSystem = new MockFileSystem();
+ fileSystem.Directory.SetCurrentDirectory("C:/kavita/");
+ fileSystem.AddDirectory("C:/kavita/config/");
+ fileSystem.AddDirectory(CacheDirectory);
+ fileSystem.AddDirectory(CoverImageDirectory);
+ fileSystem.AddDirectory(BackupDirectory);
+ fileSystem.AddDirectory(DataDirectory);
+
+ return fileSystem;
+ }
+
+ #endregion
+
+ #region RemoveTagsWithoutSeries
+
+ [Fact]
+ public async Task RemoveTagsWithoutSeries_ShouldRemoveTags()
+ {
+ var library = new LibraryBuilder("Test", LibraryType.Manga).Build();
+ var series = new SeriesBuilder("Test 1").Build();
+ var commonTag = new CollectionTagBuilder("Tag 1").Build();
+ series.Metadata.CollectionTags.Add(commonTag);
+ series.Metadata.CollectionTags.Add(new CollectionTagBuilder("Tag 2").Build());
+
+ var series2 = new SeriesBuilder("Test 1").Build();
+ series2.Metadata.CollectionTags.Add(commonTag);
+ library.Series.Add(series);
+ library.Series.Add(series2);
+ _unitOfWork.LibraryRepository.Add(library);
+ await _unitOfWork.CommitAsync();
+
+ Assert.Equal(2, series.Metadata.CollectionTags.Count);
+ Assert.Single(series2.Metadata.CollectionTags);
+
+ // Delete both series
+ _unitOfWork.SeriesRepository.Remove(series);
+ _unitOfWork.SeriesRepository.Remove(series2);
+
+ await _unitOfWork.CommitAsync();
+
+ // Validate that both tags exist
+ Assert.Equal(2, (await _unitOfWork.CollectionTagRepository.GetAllTagsAsync()).Count());
+
+ await _unitOfWork.CollectionTagRepository.RemoveTagsWithoutSeries();
+
+ Assert.Empty(await _unitOfWork.CollectionTagRepository.GetAllTagsAsync());
+ }
+
+ [Fact]
+ public async Task RemoveTagsWithoutSeries_ShouldNotRemoveTags()
+ {
+ var library = new LibraryBuilder("Test", LibraryType.Manga).Build();
+ var series = new SeriesBuilder("Test 1").Build();
+ var commonTag = new CollectionTagBuilder("Tag 1").Build();
+ series.Metadata.CollectionTags.Add(commonTag);
+ series.Metadata.CollectionTags.Add(new CollectionTagBuilder("Tag 2").Build());
+
+ var series2 = new SeriesBuilder("Test 1").Build();
+ series2.Metadata.CollectionTags.Add(commonTag);
+ library.Series.Add(series);
+ library.Series.Add(series2);
+ _unitOfWork.LibraryRepository.Add(library);
+ await _unitOfWork.CommitAsync();
+
+ Assert.Equal(2, series.Metadata.CollectionTags.Count);
+ Assert.Single(series2.Metadata.CollectionTags);
+
+ await _unitOfWork.CollectionTagRepository.RemoveTagsWithoutSeries();
+
+ // Validate that both tags exist
+ Assert.Equal(2, (await _unitOfWork.CollectionTagRepository.GetAllTagsAsync()).Count());
+ }
+
+ #endregion
+}
diff --git a/API.Tests/Repository/SeriesRepositoryTests.cs b/API.Tests/Repository/SeriesRepositoryTests.cs
index fe285641e..b24e53d7f 100644
--- a/API.Tests/Repository/SeriesRepositoryTests.cs
+++ b/API.Tests/Repository/SeriesRepositoryTests.cs
@@ -6,7 +6,9 @@ using System.Threading.Tasks;
using API.Data;
using API.Entities;
using API.Entities.Enums;
+using API.Extensions;
using API.Helpers;
+using API.Helpers.Builders;
using API.Services;
using AutoMapper;
using Microsoft.Data.Sqlite;
@@ -40,7 +42,7 @@ public class SeriesRepositoryTests
var config = new MapperConfiguration(cfg => cfg.AddProfile<AutoMapperProfiles>());
var mapper = config.CreateMapper();
- _unitOfWork = new UnitOfWork(_context, mapper, null);
+ _unitOfWork = new UnitOfWork(_context, mapper, null!);
}
#region Setup
@@ -70,10 +72,9 @@ public class SeriesRepositoryTests
_context.ServerSetting.Update(setting);
- var lib = new Library()
- {
- Name = "Manga", Folders = new List<FolderPath>() {new FolderPath() {Path = "C:/data/"}}
- };
+ var lib = new LibraryBuilder("Manga")
+ .WithFolderPath(new FolderPathBuilder("C:/data/").Build())
+ .Build();
_context.AppUser.Add(new AppUser()
{
@@ -115,37 +116,31 @@ public class SeriesRepositoryTests
private async Task SetupSeriesData()
{
- var library = new Library()
- {
- Name = "Manga",
- Type = LibraryType.Manga,
- Folders = new List<FolderPath>()
- {
- new FolderPath() {Path = "C:/data/manga/"}
- }
- };
-
- var s = DbFactory.Series("The Idaten Deities Know Only Peace", "Heion Sedai no Idaten-tachi");
- s.Format = MangaFormat.Archive;
-
- library.Series = new List<Series>()
- {
- s,
- };
+ var library = new LibraryBuilder("GetFullSeriesByAnyName Manga", LibraryType.Manga)
+ .WithFolderPath(new FolderPathBuilder("C:/data/manga/").Build())
+ .WithSeries(new SeriesBuilder("The Idaten Deities Know Only Peace")
+ .WithLocalizedName("Heion Sedai no Idaten-tachi")
+ .WithFormat(MangaFormat.Archive)
+ .Build())
+ .Build();
_unitOfWork.LibraryRepository.Add(library);
await _unitOfWork.CommitAsync();
}
- [InlineData("Heion Sedai no Idaten-tachi", "", MangaFormat.Archive, "The Idaten Deities Know Only Peace")] // Matching on localized name in DB
- [InlineData("Heion Sedai no Idaten-tachi", "", MangaFormat.Pdf, null)]
+ [Theory]
+ [InlineData("The Idaten Deities Know Only Peace", MangaFormat.Archive, "", "The Idaten Deities Know Only Peace")] // Matching on series name in DB
+ [InlineData("Heion Sedai no Idaten-tachi", MangaFormat.Archive, "The Idaten Deities Know Only Peace", "The Idaten Deities Know Only Peace")] // Matching on localized name in DB
+ [InlineData("Heion Sedai no Idaten-tachi", MangaFormat.Pdf, "", null)]
public async Task GetFullSeriesByAnyName_Should(string seriesName, MangaFormat format, string localizedName, string? expected)
{
- var firstSeries = await _unitOfWork.SeriesRepository.GetSeriesByIdAsync(1);
+ await ResetDb();
+ await SetupSeriesData();
+
var series =
await _unitOfWork.SeriesRepository.GetFullSeriesByAnyName(seriesName, localizedName,
- 1, format);
+ 2, format, false);
if (expected == null)
{
Assert.Null(series);
@@ -157,6 +152,4 @@ public class SeriesRepositoryTests
}
}
-
- //public async Task
}
diff --git a/API.Tests/Services/ArchiveServiceTests.cs b/API.Tests/Services/ArchiveServiceTests.cs
index b59ee097e..139dd0df9 100644
--- a/API.Tests/Services/ArchiveServiceTests.cs
+++ b/API.Tests/Services/ArchiveServiceTests.cs
@@ -5,7 +5,6 @@ using System.IO.Abstractions.TestingHelpers;
using System.IO.Compression;
using System.Linq;
using API.Archive;
-using API.Data.Metadata;
using API.Services;
using Microsoft.Extensions.Logging;
using NetVips;
@@ -154,11 +153,11 @@ public class ArchiveServiceTests
[Theory]
- [InlineData("v10.cbz", "v10.expected.png")]
- [InlineData("v10 - with folder.cbz", "v10 - with folder.expected.png")]
- [InlineData("v10 - nested folder.cbz", "v10 - nested folder.expected.png")]
+ //[InlineData("v10.cbz", "v10.expected.png")] // Commented out as these break usually when NetVips is updated
+ //[InlineData("v10 - with folder.cbz", "v10 - with folder.expected.png")]
+ //[InlineData("v10 - nested folder.cbz", "v10 - nested folder.expected.png")]
[InlineData("macos_native.zip", "macos_native.png")]
- [InlineData("v10 - duplicate covers.cbz", "v10 - duplicate covers.expected.png")]
+ //[InlineData("v10 - duplicate covers.cbz", "v10 - duplicate covers.expected.png")]
[InlineData("sorting.zip", "sorting.expected.png")]
[InlineData("test.zip", "test.expected.jpg")]
public void GetCoverImage_Default_Test(string inputFile, string expectedOutputFile)
@@ -187,11 +186,11 @@ public class ArchiveServiceTests
[Theory]
- [InlineData("v10.cbz", "v10.expected.png")]
- [InlineData("v10 - with folder.cbz", "v10 - with folder.expected.png")]
- [InlineData("v10 - nested folder.cbz", "v10 - nested folder.expected.png")]
+ //[InlineData("v10.cbz", "v10.expected.png")] // Commented out as these break usually when NetVips is updated
+ //[InlineData("v10 - with folder.cbz", "v10 - with folder.expected.png")]
+ //[InlineData("v10 - nested folder.cbz", "v10 - nested folder.expected.png")]
[InlineData("macos_native.zip", "macos_native.png")]
- [InlineData("v10 - duplicate covers.cbz", "v10 - duplicate covers.expected.png")]
+ //[InlineData("v10 - duplicate covers.cbz", "v10 - duplicate covers.expected.png")]
[InlineData("sorting.zip", "sorting.expected.png")]
public void GetCoverImage_SharpCompress_Test(string inputFile, string expectedOutputFile)
{
@@ -245,6 +244,17 @@ public class ArchiveServiceTests
Assert.Equal(summaryInfo, comicInfo.Summary);
}
+ [Fact]
+ public void ShouldHaveComicInfo_CanParseUmlaut()
+ {
+ var testDirectory = Path.Join(Directory.GetCurrentDirectory(), "../../../Services/Test Data/ArchiveService/ComicInfos");
+ var archive = Path.Join(testDirectory, "Umlaut.zip");
+
+ var comicInfo = _archiveService.GetComicInfo(archive);
+ Assert.NotNull(comicInfo);
+ Assert.Equal("Belladonna", comicInfo.Series);
+ }
+
[Fact]
public void ShouldHaveComicInfo_WithAuthors()
{
diff --git a/API.Tests/Services/BackupServiceTests.cs b/API.Tests/Services/BackupServiceTests.cs
index 783e0b62d..c4ca95a11 100644
--- a/API.Tests/Services/BackupServiceTests.cs
+++ b/API.Tests/Services/BackupServiceTests.cs
@@ -1,18 +1,16 @@
using System.Collections.Generic;
using System.Data.Common;
using System.IO.Abstractions.TestingHelpers;
-using System.IO.Compression;
using System.Linq;
using System.Threading.Tasks;
using API.Data;
using API.Entities;
using API.Entities.Enums;
-using API.Extensions;
+using API.Helpers.Builders;
using API.Services;
using API.Services.Tasks;
using API.SignalR;
using AutoMapper;
-using Microsoft.AspNetCore.SignalR;
using Microsoft.Data.Sqlite;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
@@ -83,18 +81,9 @@ public class BackupServiceTests
setting.Value = BackupDirectory;
_context.ServerSetting.Update(setting);
-
- _context.Library.Add(new Library()
- {
- Name = "Manga",
- Folders = new List<FolderPath>()
- {
- new FolderPath()
- {
- Path = "C:/data/"
- }
- }
- });
+ _context.Library.Add(new LibraryBuilder("Manga")
+ .WithFolderPath(new FolderPathBuilder("C:/data/").Build())
+ .Build());
return await _context.SaveChangesAsync() > 0;
}
diff --git a/API.Tests/Services/BookmarkServiceTests.cs b/API.Tests/Services/BookmarkServiceTests.cs
index 97c07a281..a96d8be46 100644
--- a/API.Tests/Services/BookmarkServiceTests.cs
+++ b/API.Tests/Services/BookmarkServiceTests.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.Data.Common;
using System.IO;
using System.IO.Abstractions.TestingHelpers;
@@ -10,7 +9,10 @@ using API.Data.Repositories;
using API.DTOs.Reader;
using API.Entities;
using API.Entities.Enums;
+using API.Entities.Metadata;
+using API.Extensions;
using API.Helpers;
+using API.Helpers.Builders;
using API.Services;
using API.SignalR;
using AutoMapper;
@@ -85,17 +87,9 @@ public class BookmarkServiceTests
_context.ServerSetting.Update(setting);
- _context.Library.Add(new Library()
- {
- Name = "Manga",
- Folders = new List<FolderPath>()
- {
- new FolderPath()
- {
- Path = "C:/data/"
- }
- }
- });
+ _context.Library.Add(new LibraryBuilder("Manga")
+ .WithFolderPath(new FolderPathBuilder("C:/data/").Build())
+ .Build());
return await _context.SaveChangesAsync() > 0;
}
@@ -136,27 +130,16 @@ public class BookmarkServiceTests
// Delete all Series to reset state
await ResetDB();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- new Volume()
- {
- Chapters = new List<Chapter>()
- {
- new Chapter()
- {
+ var series = new SeriesBuilder("Test")
+ .WithFormat(MangaFormat.Epub)
+ .WithVolume(new VolumeBuilder("0")
+ .WithChapter(new ChapterBuilder("1")
+ .Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb").Build();
+ _context.Series.Add(series);
- }
- }
- }
- }
- });
_context.AppUser.Add(new AppUser()
{
@@ -194,27 +177,17 @@ public class BookmarkServiceTests
// Delete all Series to reset state
await ResetDB();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- new Volume()
- {
- Chapters = new List<Chapter>()
- {
- new Chapter()
- {
+ var series = new SeriesBuilder("Test")
+ .WithFormat(MangaFormat.Epub)
+ .WithVolume(new VolumeBuilder("1")
+ .WithNumber(1)
+ .WithChapter(new ChapterBuilder("0")
+ .Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb").Build();
- }
- }
- }
- }
- });
+ _context.Series.Add(series);
_context.AppUser.Add(new AppUser()
@@ -270,28 +243,17 @@ public class BookmarkServiceTests
// Delete all Series to reset state
await ResetDB();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- new Volume()
- {
- Chapters = new List<Chapter>()
- {
- new Chapter()
- {
-
- }
- }
- }
- }
- });
+ var series = new SeriesBuilder("Test")
+ .WithFormat(MangaFormat.Epub)
+ .WithVolume(new VolumeBuilder("1")
+ .WithNumber(1)
+ .WithChapter(new ChapterBuilder("1")
+ .Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb").Build();
+ _context.Series.Add(series);
_context.AppUser.Add(new AppUser()
{
@@ -342,7 +304,7 @@ public class BookmarkServiceTests
Assert.Equal(2, ds.GetFiles(BookmarkDirectory, searchOption:SearchOption.AllDirectories).Count());
- Assert.False(ds.FileSystem.FileInfo.FromFileName(Path.Join(BookmarkDirectory, "1/1/1/0001.jpg")).Exists);
+ Assert.False(ds.FileSystem.FileInfo.New(Path.Join(BookmarkDirectory, "1/1/1/0001.jpg")).Exists);
}
#endregion
@@ -357,27 +319,18 @@ public class BookmarkServiceTests
// Delete all Series to reset state
await ResetDB();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- new Volume()
- {
- Chapters = new List<Chapter>()
- {
- new Chapter()
- {
+ var series = new SeriesBuilder("Test")
+ .WithFormat(MangaFormat.Epub)
+ .WithVolume(new VolumeBuilder("1")
+ .WithNumber(1)
+ .WithChapter(new ChapterBuilder("1")
+ .Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb").Build();
+
+ _context.Series.Add(series);
- }
- }
- }
- }
- });
_context.AppUser.Add(new AppUser()
{
@@ -419,28 +372,17 @@ public class BookmarkServiceTests
// Delete all Series to reset state
await ResetDB();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- new Volume()
- {
- Chapters = new List<Chapter>()
- {
- new Chapter()
- {
-
- }
- }
- }
- }
- });
+ var series = new SeriesBuilder("Test")
+ .WithFormat(MangaFormat.Epub)
+ .WithVolume(new VolumeBuilder("1")
+ .WithNumber(1)
+ .WithChapter(new ChapterBuilder("1")
+ .Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb").Build();
+ _context.Series.Add(series);
_context.AppUser.Add(new AppUser()
{
@@ -483,28 +425,15 @@ public class BookmarkServiceTests
// Delete all Series to reset state
await ResetDB();
- var series = new Series()
- {
- Name = "Test",
- Library = new Library()
- {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- new Volume()
- {
- Chapters = new List<Chapter>()
- {
- new Chapter()
- {
-
- }
- }
- }
- }
- };
+ var series = new SeriesBuilder("Test")
+ .WithFormat(MangaFormat.Epub)
+ .WithVolume(new VolumeBuilder("1")
+ .WithNumber(1)
+ .WithChapter(new ChapterBuilder("1")
+ .Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb").Build();
_context.Series.Add(series);
@@ -528,7 +457,7 @@ public class BookmarkServiceTests
await _context.SaveChangesAsync();
var user = await _unitOfWork.UserRepository.GetUserByIdAsync(1, AppUserIncludes.Bookmarks);
- Assert.NotEmpty(user.Bookmarks);
+ Assert.NotEmpty(user!.Bookmarks);
series.Volumes = new List<Volume>();
_unitOfWork.SeriesRepository.Update(series);
diff --git a/API.Tests/Services/CacheServiceTests.cs b/API.Tests/Services/CacheServiceTests.cs
index 6d973aecf..4bf31f386 100644
--- a/API.Tests/Services/CacheServiceTests.cs
+++ b/API.Tests/Services/CacheServiceTests.cs
@@ -8,8 +8,9 @@ using API.Data;
using API.Data.Metadata;
using API.Entities;
using API.Entities.Enums;
-using API.Parser;
+using API.Helpers.Builders;
using API.Services;
+using API.Services.Tasks.Scanner.Parser;
using API.SignalR;
using AutoMapper;
using Microsoft.AspNetCore.SignalR;
@@ -116,17 +117,9 @@ public class CacheServiceTests
_context.ServerSetting.Update(setting);
- _context.Library.Add(new Library()
- {
- Name = "Manga",
- Folders = new List<FolderPath>()
- {
- new FolderPath()
- {
- Path = "C:/data/"
- }
- }
- });
+ _context.Library.Add(new LibraryBuilder("Manga")
+ .WithFolderPath(new FolderPathBuilder("C:/data/").Build())
+ .Build());
return await _context.SaveChangesAsync() > 0;
}
@@ -166,20 +159,11 @@ public class CacheServiceTests
Substitute.For<IBookService>(), Substitute.For<IImageService>(), ds), Substitute.For<IBookmarkService>());
await ResetDB();
- var s = DbFactory.Series("Test");
- var v = DbFactory.Volume("1");
- var c = new Chapter()
- {
- Number = "1",
- Files = new List<MangaFile>()
- {
- new MangaFile()
- {
- Format = MangaFormat.Archive,
- FilePath = $"{DataDirectory}Test v1.zip",
- }
- }
- };
+ var s = new SeriesBuilder("Test").Build();
+ var v = new VolumeBuilder("1").Build();
+ var c = new ChapterBuilder("1")
+ .WithFile(new MangaFileBuilder($"{DataDirectory}Test v1.zip", MangaFormat.Archive).Build())
+ .Build();
v.Chapters.Add(c);
s.Volumes.Add(v);
s.LibraryId = 1;
@@ -206,8 +190,8 @@ public class CacheServiceTests
// new ReadingItemService(archiveService, Substitute.For<IBookService>(), Substitute.For<IImageService>(), ds));
//
// await ResetDB();
- // var s = DbFactory.Series("Test");
- // var v = DbFactory.Volume("1");
+ // var s = new SeriesBuilder("Test").Build();
+ // var v = new VolumeBuilder("1").Build();
// var c = new Chapter()
// {
// Number = "1",
@@ -270,20 +254,10 @@ public class CacheServiceTests
new ReadingItemService(Substitute.For<IArchiveService>(),
Substitute.For<IBookService>(), Substitute.For<IImageService>(), ds), Substitute.For<IBookmarkService>());
- var c = new Chapter()
- {
- Files = new List<MangaFile>()
- {
- new MangaFile()
- {
- FilePath = $"{DataDirectory}1.epub"
- },
- new MangaFile()
- {
- FilePath = $"{DataDirectory}2.epub"
- }
- }
- };
+ var c = new ChapterBuilder("1")
+ .WithFile(new MangaFileBuilder($"{DataDirectory}1.epub", MangaFormat.Epub).Build())
+ .WithFile(new MangaFileBuilder($"{DataDirectory}2.epub", MangaFormat.Epub).Build())
+ .Build();
cs.GetCachedFile(c);
Assert.Same($"{DataDirectory}1.epub", cs.GetCachedFile(c));
}
@@ -300,11 +274,9 @@ public class CacheServiceTests
filesystem.AddFile($"{DataDirectory}1.zip", new MockFileData(""));
filesystem.AddFile($"{DataDirectory}2.zip", new MockFileData(""));
- var c = new Chapter()
- {
- Id = 1,
- Files = new List<MangaFile>()
- };
+ var c = new ChapterBuilder("1")
+ .WithId(1)
+ .Build();
var fileIndex = 0;
foreach (var file in c.Files)
@@ -337,26 +309,17 @@ public class CacheServiceTests
filesystem.AddFile($"{DataDirectory}1.zip", new MockFileData(""));
filesystem.AddFile($"{DataDirectory}2.zip", new MockFileData(""));
- var c = new Chapter()
- {
- Id = 1,
- Files = new List<MangaFile>()
- {
- new MangaFile()
- {
- Id = 1,
- FilePath = $"{DataDirectory}1.zip",
- Pages = 10
-
- },
- new MangaFile()
- {
- Id = 2,
- FilePath = $"{DataDirectory}2.zip",
- Pages = 5
- }
- }
- };
+ var c = new ChapterBuilder("1")
+ .WithId(1)
+ .WithFile(new MangaFileBuilder($"{DataDirectory}1.zip", MangaFormat.Archive)
+ .WithPages(10)
+ .WithId(1)
+ .Build())
+ .WithFile(new MangaFileBuilder($"{DataDirectory}2.zip", MangaFormat.Archive)
+ .WithPages(5)
+ .WithId(2)
+ .Build())
+ .Build();
var fileIndex = 0;
foreach (var file in c.Files)
@@ -389,20 +352,13 @@ public class CacheServiceTests
filesystem.AddDirectory($"{CacheDirectory}1/");
filesystem.AddFile($"{DataDirectory}1.zip", new MockFileData(""));
- var c = new Chapter()
- {
- Id = 1,
- Files = new List<MangaFile>()
- {
- new MangaFile()
- {
- Id = 1,
- FilePath = $"{DataDirectory}1.zip",
- Pages = 10
-
- }
- }
- };
+ var c = new ChapterBuilder("1")
+ .WithId(1)
+ .WithFile(new MangaFileBuilder($"{DataDirectory}1.zip", MangaFormat.Archive)
+ .WithPages(10)
+ .WithId(1)
+ .Build())
+ .Build();
c.Pages = c.Files.Sum(f => f.Pages);
var fileIndex = 0;
@@ -437,26 +393,17 @@ public class CacheServiceTests
filesystem.AddFile($"{DataDirectory}1.zip", new MockFileData(""));
filesystem.AddFile($"{DataDirectory}2.zip", new MockFileData(""));
- var c = new Chapter()
- {
- Id = 1,
- Files = new List<MangaFile>()
- {
- new MangaFile()
- {
- Id = 1,
- FilePath = $"{DataDirectory}1.zip",
- Pages = 10
-
- },
- new MangaFile()
- {
- Id = 2,
- FilePath = $"{DataDirectory}2.zip",
- Pages = 5
- }
- }
- };
+ var c = new ChapterBuilder("1")
+ .WithId(1)
+ .WithFile(new MangaFileBuilder($"{DataDirectory}1.zip", MangaFormat.Archive)
+ .WithPages(10)
+ .WithId(1)
+ .Build())
+ .WithFile(new MangaFileBuilder($"{DataDirectory}2.zip", MangaFormat.Archive)
+ .WithPages(5)
+ .WithId(2)
+ .Build())
+ .Build();
var fileIndex = 0;
foreach (var file in c.Files)
diff --git a/API.Tests/Services/CleanupServiceTests.cs b/API.Tests/Services/CleanupServiceTests.cs
index 84e4d5fd5..4b7d30b71 100644
--- a/API.Tests/Services/CleanupServiceTests.cs
+++ b/API.Tests/Services/CleanupServiceTests.cs
@@ -1,28 +1,22 @@
using System;
using System.Collections.Generic;
-using System.Data.Common;
using System.IO;
+using System.IO.Abstractions;
using System.IO.Abstractions.TestingHelpers;
using System.Linq;
using System.Threading.Tasks;
using API.Data;
using API.Data.Repositories;
using API.DTOs.Filtering;
-using API.DTOs.Settings;
using API.Entities;
using API.Entities.Enums;
using API.Entities.Metadata;
+using API.Extensions;
using API.Helpers;
-using API.Helpers.Converters;
+using API.Helpers.Builders;
using API.Services;
using API.Services.Tasks;
using API.SignalR;
-using API.Tests.Helpers;
-using AutoMapper;
-using Microsoft.AspNetCore.SignalR;
-using Microsoft.Data.Sqlite;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.Extensions.Logging;
using NSubstitute;
using Xunit;
@@ -33,21 +27,18 @@ public class CleanupServiceTests : AbstractDbTest
{
private readonly ILogger<CleanupService> _logger = Substitute.For<ILogger<CleanupService>>();
private readonly IEventHub _messageHub = Substitute.For<IEventHub>();
+ private readonly IReaderService _readerService;
public CleanupServiceTests() : base()
{
- _context.Library.Add(new Library()
- {
- Name = "Manga",
- Folders = new List<FolderPath>()
- {
- new FolderPath()
- {
- Path = "C:/data/"
- }
- }
- });
+ _context.Library.Add(new LibraryBuilder("Manga")
+ .WithFolderPath(new FolderPathBuilder("C:/data/").Build())
+ .Build());
+
+ _readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>(),
+ Substitute.For<IImageService>(),
+ new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), new MockFileSystem()));
}
#region Setup
@@ -77,15 +68,15 @@ public class CleanupServiceTests : AbstractDbTest
// Delete all Series to reset state
await ResetDb();
- var s = DbFactory.Series("Test 1");
+ var s = new SeriesBuilder("Test 1").Build();
s.CoverImage = $"{ImageService.GetSeriesFormat(1)}.jpg";
s.LibraryId = 1;
_context.Series.Add(s);
- s = DbFactory.Series("Test 2");
+ s = new SeriesBuilder("Test 2").Build();
s.CoverImage = $"{ImageService.GetSeriesFormat(3)}.jpg";
s.LibraryId = 1;
_context.Series.Add(s);
- s = DbFactory.Series("Test 3");
+ s = new SeriesBuilder("Test 3").Build();
s.CoverImage = $"{ImageService.GetSeriesFormat(1000)}.jpg";
s.LibraryId = 1;
_context.Series.Add(s);
@@ -111,11 +102,11 @@ public class CleanupServiceTests : AbstractDbTest
await ResetDb();
// Add 2 series with cover images
- var s = DbFactory.Series("Test 1");
+ var s = new SeriesBuilder("Test 1").Build();
s.CoverImage = $"{ImageService.GetSeriesFormat(1)}.jpg";
s.LibraryId = 1;
_context.Series.Add(s);
- s = DbFactory.Series("Test 2");
+ s = new SeriesBuilder("Test 2").Build();
s.CoverImage = $"{ImageService.GetSeriesFormat(3)}.jpg";
s.LibraryId = 1;
_context.Series.Add(s);
@@ -145,29 +136,23 @@ public class CleanupServiceTests : AbstractDbTest
await ResetDb();
// Add 2 series with cover images
- var s = DbFactory.Series("Test 1");
- var v = DbFactory.Volume("1");
- v.Chapters.Add(new Chapter()
- {
- CoverImage = "v01_c01.jpg"
- });
- v.CoverImage = "v01_c01.jpg";
- s.Volumes.Add(v);
- s.CoverImage = "series_01.jpg";
- s.LibraryId = 1;
- _context.Series.Add(s);
-
- s = DbFactory.Series("Test 2");
- v = DbFactory.Volume("1");
- v.Chapters.Add(new Chapter()
- {
- CoverImage = "v01_c03.jpg"
- });
- v.CoverImage = "v01_c03jpg";
- s.Volumes.Add(v);
- s.CoverImage = "series_03.jpg";
- s.LibraryId = 1;
- _context.Series.Add(s);
+ _context.Series.Add(new SeriesBuilder("Test 1")
+ .WithVolume(new VolumeBuilder("1")
+ .WithChapter(new ChapterBuilder("0").WithCoverImage("v01_c01.jpg").Build())
+ .WithCoverImage("v01_c01.jpg")
+ .Build())
+ .WithCoverImage("series_01.jpg")
+ .WithLibraryId(1)
+ .Build());
+
+ _context.Series.Add(new SeriesBuilder("Test 2")
+ .WithVolume(new VolumeBuilder("1")
+ .WithChapter(new ChapterBuilder("0").WithCoverImage("v01_c03.jpg").Build())
+ .WithCoverImage("v01_c03.jpg")
+ .Build())
+ .WithCoverImage("series_03.jpg")
+ .WithLibraryId(1)
+ .Build());
await _context.SaveChangesAsync();
@@ -195,27 +180,26 @@ public class CleanupServiceTests : AbstractDbTest
await ResetDb();
// Add 2 series with cover images
- var s = DbFactory.Series("Test 1");
- s.Metadata.CollectionTags = new List<CollectionTag>();
- s.Metadata.CollectionTags.Add(new CollectionTag()
- {
- Title = "Something",
- CoverImage = $"{ImageService.GetCollectionTagFormat(1)}.jpg"
- });
- s.CoverImage = $"{ImageService.GetSeriesFormat(1)}.jpg";
- s.LibraryId = 1;
- _context.Series.Add(s);
- s = DbFactory.Series("Test 2");
- s.Metadata.CollectionTags = new List<CollectionTag>();
- s.Metadata.CollectionTags.Add(new CollectionTag()
- {
- Title = "Something 2",
- CoverImage = $"{ImageService.GetCollectionTagFormat(2)}.jpg"
- });
- s.CoverImage = $"{ImageService.GetSeriesFormat(3)}.jpg";
- s.LibraryId = 1;
- _context.Series.Add(s);
+ _context.Series.Add(new SeriesBuilder("Test 1")
+ .WithMetadata(new SeriesMetadataBuilder()
+ .WithCollectionTag(new CollectionTagBuilder("Something")
+ .WithCoverImage($"{ImageService.GetCollectionTagFormat(1)}.jpg")
+ .Build())
+ .Build())
+ .WithCoverImage($"{ImageService.GetSeriesFormat(1)}.jpg")
+ .WithLibraryId(1)
+ .Build());
+
+ _context.Series.Add(new SeriesBuilder("Test 2")
+ .WithMetadata(new SeriesMetadataBuilder()
+ .WithCollectionTag(new CollectionTagBuilder("Something")
+ .WithCoverImage($"{ImageService.GetCollectionTagFormat(2)}.jpg")
+ .Build())
+ .Build())
+ .WithCoverImage($"{ImageService.GetSeriesFormat(3)}.jpg")
+ .WithLibraryId(1)
+ .Build());
await _context.SaveChangesAsync();
@@ -247,18 +231,14 @@ public class CleanupServiceTests : AbstractDbTest
UserName = "Joe",
ReadingLists = new List<ReadingList>()
{
- new ReadingList()
- {
- Title = "Something",
- NormalizedTitle = API.Services.Tasks.Scanner.Parser.Parser.Normalize("Something"),
- CoverImage = $"{ImageService.GetReadingListFormat(1)}.jpg"
- },
- new ReadingList()
- {
- Title = "Something 2",
- NormalizedTitle = API.Services.Tasks.Scanner.Parser.Parser.Normalize("Something 2"),
- CoverImage = $"{ImageService.GetReadingListFormat(2)}.jpg"
- }
+ new ReadingListBuilder("Something")
+ .WithRating(AgeRating.Unknown)
+ .WithCoverImage($"{ImageService.GetReadingListFormat(1)}.jpg")
+ .Build(),
+ new ReadingListBuilder("Something 2")
+ .WithRating(AgeRating.Unknown)
+ .WithCoverImage($"{ImageService.GetReadingListFormat(2)}.jpg")
+ .Build(),
}
});
@@ -408,22 +388,20 @@ public class CleanupServiceTests : AbstractDbTest
[Fact]
public async Task CleanupDbEntries_CleanupAbandonedChapters()
{
- var c = EntityFactory.CreateChapter("1", false, new List<MangaFile>(), 1);
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- c,
- }),
- }
- });
+ var c = new ChapterBuilder("0")
+ .WithPages(1)
+ .Build();
+ var series = new SeriesBuilder("Test")
+ .WithFormat(MangaFormat.Epub)
+ .WithVolume(new VolumeBuilder("0")
+ .WithNumber(1)
+ .WithChapter(c)
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb").Build();
+
+ _context.Series.Add(series);
+
_context.AppUser.Add(new AppUser()
{
@@ -432,10 +410,8 @@ public class CleanupServiceTests : AbstractDbTest
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
-
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync("majora2007", AppUserIncludes.Progress);
- await readerService.MarkChaptersUntilAsRead(user, 1, 5);
+ await _readerService.MarkChaptersUntilAsRead(user, 1, 5);
await _context.SaveChangesAsync();
// Validate correct chapters have read status
@@ -461,25 +437,15 @@ public class CleanupServiceTests : AbstractDbTest
{
var c = new CollectionTag()
{
- Title = "Test Tag"
- };
- var s = new Series()
- {
- Name = "Test",
- Library = new Library()
- {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>(),
- Metadata = new SeriesMetadata()
- {
- CollectionTags = new List<CollectionTag>()
- {
- c
- }
- }
+ Title = "Test Tag",
+ NormalizedTitle = "Test Tag".ToNormalized(),
};
+ var s = new SeriesBuilder("Test")
+ .WithFormat(MangaFormat.Epub)
+ .WithMetadata(new SeriesMetadataBuilder().WithCollectionTag(c).Build())
+ .Build();
+ s.Library = new LibraryBuilder("Test LIb").Build();
+
_context.Series.Add(s);
_context.AppUser.Add(new AppUser()
@@ -511,20 +477,11 @@ public class CleanupServiceTests : AbstractDbTest
{
await ResetDb();
- var s = new Series()
- {
- Name = "Test CleanupWantToRead_ShouldRemoveFullyReadSeries",
- Library = new Library()
- {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>(),
- Metadata = new SeriesMetadata()
- {
- PublicationStatus = PublicationStatus.Completed
- }
- };
+ var s = new SeriesBuilder("Test CleanupWantToRead_ShouldRemoveFullyReadSeries")
+ .WithMetadata(new SeriesMetadataBuilder().WithPublicationStatus(PublicationStatus.Completed).Build())
+ .Build();
+
+ s.Library = new LibraryBuilder("Test LIb").Build();
_context.Series.Add(s);
var user = new AppUser()
@@ -539,10 +496,7 @@ public class CleanupServiceTests : AbstractDbTest
await _unitOfWork.CommitAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(),
- Substitute.For<IEventHub>());
-
- await readerService.MarkSeriesAsRead(user, s.Id);
+ await _readerService.MarkSeriesAsRead(user, s.Id);
await _unitOfWork.CommitAsync();
var cleanupService = new CleanupService(Substitute.For<ILogger<CleanupService>>(), _unitOfWork,
diff --git a/API.Tests/Services/CollectionTagServiceTests.cs b/API.Tests/Services/CollectionTagServiceTests.cs
index bb8da9ad0..88bc04d18 100644
--- a/API.Tests/Services/CollectionTagServiceTests.cs
+++ b/API.Tests/Services/CollectionTagServiceTests.cs
@@ -2,14 +2,14 @@
using System.Linq;
using System.Threading.Tasks;
using API.Data;
+using API.Data.Repositories;
using API.DTOs.CollectionTags;
using API.Entities;
using API.Entities.Enums;
+using API.Helpers.Builders;
using API.Services;
-using API.Services.Tasks.Metadata;
using API.SignalR;
using API.Tests.Helpers;
-using Microsoft.Extensions.Logging;
using NSubstitute;
using Xunit;
@@ -34,19 +34,14 @@ public class CollectionTagServiceTests : AbstractDbTest
private async Task SeedSeries()
{
if (_context.CollectionTag.Any()) return;
- _context.Library.Add(new Library()
- {
- Name = "Library 2",
- Type = LibraryType.Manga,
- Series = new List<Series>()
- {
- EntityFactory.CreateSeries("Series 1"),
- EntityFactory.CreateSeries("Series 2"),
- }
- });
- _context.CollectionTag.Add(DbFactory.CollectionTag(0, "Tag 1", string.Empty, false));
- _context.CollectionTag.Add(DbFactory.CollectionTag(0, "Tag 2", string.Empty, true));
+ _context.Library.Add(new LibraryBuilder("Library 2", LibraryType.Manga)
+ .WithSeries(new SeriesBuilder("Series 1").Build())
+ .WithSeries(new SeriesBuilder("Series 2").Build())
+ .Build());
+
+ _context.CollectionTag.Add(new CollectionTagBuilder("Tag 1").Build());
+ _context.CollectionTag.Add(new CollectionTagBuilder("Tag 2").WithIsPromoted(true).Build());
await _unitOfWork.CommitAsync();
}
@@ -64,8 +59,8 @@ public class CollectionTagServiceTests : AbstractDbTest
public async Task UpdateTag_ShouldUpdateFields()
{
await SeedSeries();
- _context.CollectionTag.Add(EntityFactory.CreateCollectionTag(3, "UpdateTag_ShouldUpdateFields",
- string.Empty, true));
+
+ _context.CollectionTag.Add(new CollectionTagBuilder("UpdateTag_ShouldUpdateFields").WithId(3).WithIsPromoted(true).Build());
await _unitOfWork.CommitAsync();
await _service.UpdateTag(new CollectionTagDto()
@@ -87,7 +82,7 @@ public class CollectionTagServiceTests : AbstractDbTest
{
await SeedSeries();
var ids = new[] {1, 2};
- await _service.AddTagToSeries(await _unitOfWork.CollectionTagRepository.GetFullTagAsync(1), ids);
+ await _service.AddTagToSeries(await _unitOfWork.CollectionTagRepository.GetTagAsync(1, CollectionTagIncludes.SeriesMetadata), ids);
var metadatas = await _unitOfWork.SeriesRepository.GetSeriesMetadataForIdsAsync(ids);
Assert.True(metadatas.ElementAt(0).CollectionTags.Any(t => t.Title.Equals("Tag 1")));
@@ -99,7 +94,7 @@ public class CollectionTagServiceTests : AbstractDbTest
{
await SeedSeries();
var ids = new[] {1, 2};
- var tag = await _unitOfWork.CollectionTagRepository.GetFullTagAsync(2);
+ var tag = await _unitOfWork.CollectionTagRepository.GetTagAsync(2, CollectionTagIncludes.SeriesMetadata);
await _service.AddTagToSeries(tag, ids);
await _service.RemoveTagFromSeries(tag, new[] {1});
diff --git a/API.Tests/Services/DeviceServiceTests.cs b/API.Tests/Services/DeviceServiceTests.cs
index 78ec8cfd2..1d021c76d 100644
--- a/API.Tests/Services/DeviceServiceTests.cs
+++ b/API.Tests/Services/DeviceServiceTests.cs
@@ -5,7 +5,6 @@ using API.DTOs.Device;
using API.Entities;
using API.Entities.Enums.Device;
using API.Services;
-using API.Services.Tasks;
using Microsoft.Extensions.Logging;
using NSubstitute;
using Xunit;
diff --git a/API.Tests/Services/DirectoryServiceTests.cs b/API.Tests/Services/DirectoryServiceTests.cs
index 134dc2361..b790de6e1 100644
--- a/API.Tests/Services/DirectoryServiceTests.cs
+++ b/API.Tests/Services/DirectoryServiceTests.cs
@@ -75,7 +75,7 @@ public class DirectoryServiceTests
[Fact]
public void TraverseTreeParallelForEach_DontCountExcludedDirectories_ShouldBe28()
{
- var testDirectory = "/manga/";
+ const string testDirectory = "/manga/";
var fileSystem = new MockFileSystem();
for (var i = 0; i < 28; i++)
{
@@ -85,6 +85,7 @@ public class DirectoryServiceTests
fileSystem.AddFile($"{Path.Join(testDirectory, "@eaDir")}file_{29}.jpg", new MockFileData(""));
fileSystem.AddFile($"{Path.Join(testDirectory, ".DS_Store")}file_{30}.jpg", new MockFileData(""));
fileSystem.AddFile($"{Path.Join(testDirectory, ".qpkg")}file_{30}.jpg", new MockFileData(""));
+ fileSystem.AddFile($"{Path.Join(testDirectory, ".@_thumb")}file_{30}.jpg", new MockFileData(""));
var ds = new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), fileSystem);
var files = new List<string>();
@@ -151,7 +152,7 @@ public class DirectoryServiceTests
var ds = new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), fileSystem);
var files = ds.GetFiles(testDirectory, API.Services.Tasks.Scanner.Parser.Parser.ArchiveFileExtensions).ToList();
- Assert.Equal(10, files.Count());
+ Assert.Equal(10, files.Count);
Assert.All(files, s => fileSystem.Path.GetExtension(s).Equals(".zip"));
}
@@ -170,7 +171,7 @@ public class DirectoryServiceTests
var ds = new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), fileSystem);
var files = ds.GetFiles(testDirectory).ToList();
- Assert.Equal(11, files.Count());
+ Assert.Equal(11, files.Count);
}
[Fact]
@@ -188,7 +189,7 @@ public class DirectoryServiceTests
var ds = new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), fileSystem);
var files = ds.GetFiles(testDirectory).ToList();
- Assert.Equal(11, files.Count());
+ Assert.Equal(11, files.Count);
}
[Fact]
@@ -206,7 +207,7 @@ public class DirectoryServiceTests
var ds = new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), fileSystem);
var files = ds.GetFiles(testDirectory).ToList();
- Assert.Equal(10, files.Count());
+ Assert.Equal(10, files.Count);
}
[Fact]
@@ -224,7 +225,7 @@ public class DirectoryServiceTests
var ds = new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), fileSystem);
var files = ds.GetFiles(testDirectory).ToList();
- Assert.Equal(10, files.Count());
+ Assert.Equal(10, files.Count);
}
[Fact]
@@ -242,7 +243,7 @@ public class DirectoryServiceTests
var ds = new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), fileSystem);
var files = ds.GetFiles(testDirectory).ToList();
- Assert.Equal(10, files.Count());
+ Assert.Equal(10, files.Count);
}
[Fact]
@@ -324,7 +325,7 @@ public class DirectoryServiceTests
ds.CopyFileToDirectory($"{testDirectory}file/data-0.txt", "/manga/output/");
Assert.True(fileSystem.FileExists("/manga/output/data-0.txt"));
Assert.True(fileSystem.FileExists("/manga/file/data-0.txt"));
- Assert.True(fileSystem.FileInfo.FromFileName("/manga/file/data-0.txt").Length == fileSystem.FileInfo.FromFileName("/manga/output/data-0.txt").Length);
+ Assert.True(fileSystem.FileInfo.New("/manga/file/data-0.txt").Length == fileSystem.FileInfo.New("/manga/output/data-0.txt").Length);
}
#endregion
@@ -339,7 +340,7 @@ public class DirectoryServiceTests
var ds = new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), fileSystem);
var ex = Assert.Throws<DirectoryNotFoundException>(() => ds.CopyDirectoryToDirectory("/comics/", "/manga/output/"));
- Assert.Equal(ex.Message, "Source directory does not exist or could not be found: " + "/comics/");
+ Assert.Equal("Source directory does not exist or could not be found: " + "/comics/", ex.Message);
}
[Fact]
@@ -352,7 +353,7 @@ public class DirectoryServiceTests
var ds = new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), fileSystem);
ds.CopyDirectoryToDirectory($"{testDirectory}empty/", "/manga/output/");
- Assert.Empty(fileSystem.DirectoryInfo.FromDirectoryName("/manga/output/").GetFiles());
+ Assert.Empty(fileSystem.DirectoryInfo.New("/manga/output/").GetFiles());
}
[Fact]
@@ -426,7 +427,7 @@ public class DirectoryServiceTests
var ds = new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), fileSystem);
ds.ExistOrCreate("c:/manga/output/");
- Assert.True(ds.FileSystem.DirectoryInfo.FromDirectoryName("c:/manga/output/").Exists);
+ Assert.True(ds.FileSystem.DirectoryInfo.New("c:/manga/output/").Exists);
}
#endregion
@@ -447,9 +448,9 @@ public class DirectoryServiceTests
var ds = new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), fileSystem);
ds.ClearAndDeleteDirectory($"{testDirectory}");
Assert.Empty(ds.GetFiles("/manga/", searchOption: SearchOption.AllDirectories));
- Assert.Empty(ds.FileSystem.DirectoryInfo.FromDirectoryName("/manga/").GetDirectories());
- Assert.True(ds.FileSystem.DirectoryInfo.FromDirectoryName("/manga/").Exists);
- Assert.False(ds.FileSystem.DirectoryInfo.FromDirectoryName("/manga/base").Exists);
+ Assert.Empty(ds.FileSystem.DirectoryInfo.New("/manga/").GetDirectories());
+ Assert.True(ds.FileSystem.DirectoryInfo.New("/manga/").Exists);
+ Assert.False(ds.FileSystem.DirectoryInfo.New("/manga/base").Exists);
}
#endregion
@@ -469,9 +470,9 @@ public class DirectoryServiceTests
var ds = new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), fileSystem);
ds.ClearDirectory($"{testDirectory}file/");
- Assert.Empty(ds.FileSystem.DirectoryInfo.FromDirectoryName($"{testDirectory}file/").GetDirectories());
- Assert.True(ds.FileSystem.DirectoryInfo.FromDirectoryName("/manga/").Exists);
- Assert.True(ds.FileSystem.DirectoryInfo.FromDirectoryName($"{testDirectory}file/").Exists);
+ Assert.Empty(ds.FileSystem.DirectoryInfo.New($"{testDirectory}file/").GetDirectories());
+ Assert.True(ds.FileSystem.DirectoryInfo.New("/manga/").Exists);
+ Assert.True(ds.FileSystem.DirectoryInfo.New($"{testDirectory}file/").Exists);
}
[Fact]
@@ -486,9 +487,9 @@ public class DirectoryServiceTests
var ds = new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), fileSystem);
ds.ClearDirectory($"{testDirectory}");
- Assert.Empty(ds.FileSystem.DirectoryInfo.FromDirectoryName($"{testDirectory}").GetDirectories());
- Assert.True(ds.FileSystem.DirectoryInfo.FromDirectoryName(testDirectory).Exists);
- Assert.False(ds.FileSystem.DirectoryInfo.FromDirectoryName($"{testDirectory}file/").Exists);
+ Assert.Empty(ds.FileSystem.DirectoryInfo.New($"{testDirectory}").GetDirectories());
+ Assert.True(ds.FileSystem.DirectoryInfo.New(testDirectory).Exists);
+ Assert.False(ds.FileSystem.DirectoryInfo.New($"{testDirectory}file/").Exists);
}
#endregion
@@ -586,7 +587,7 @@ public class DirectoryServiceTests
ds.CopyFilesToDirectory(new []{MockUnixSupport.Path($"{testDirectory}file.zip")}, "/manga/output/");
ds.CopyFilesToDirectory(new []{MockUnixSupport.Path($"{testDirectory}file.zip")}, "/manga/output/");
var outputFiles = ds.GetFiles("/manga/output/").Select(API.Services.Tasks.Scanner.Parser.Parser.NormalizePath).ToList();
- Assert.Equal(4, outputFiles.Count()); // we have 2 already there and 2 copies
+ Assert.Equal(4, outputFiles.Count); // we have 2 already there and 2 copies
// For some reason, this has C:/ on directory even though everything is emulated (System.IO.Abstractions issue, not changing)
// https://github.com/TestableIO/System.IO.Abstractions/issues/831
Assert.True(outputFiles.Contains(API.Services.Tasks.Scanner.Parser.Parser.NormalizePath("/manga/output/file (3).zip"))
@@ -644,10 +645,10 @@ public class DirectoryServiceTests
const string testDirectory = "/manga/";
var fileSystem = new MockFileSystem();
fileSystem.AddDirectory($"{testDirectory}dir1");
- var di = fileSystem.DirectoryInfo.FromDirectoryName($"{testDirectory}dir1");
+ var di = fileSystem.DirectoryInfo.New($"{testDirectory}dir1");
di.Attributes |= FileAttributes.System;
fileSystem.AddDirectory($"{testDirectory}dir2");
- di = fileSystem.DirectoryInfo.FromDirectoryName($"{testDirectory}dir2");
+ di = fileSystem.DirectoryInfo.New($"{testDirectory}dir2");
di.Attributes |= FileAttributes.Hidden;
fileSystem.AddDirectory($"{testDirectory}dir3");
fileSystem.AddFile($"{testDirectory}file_0.zip", new MockFileData(""));
diff --git a/API.Tests/Services/ParseScannedFilesTests.cs b/API.Tests/Services/ParseScannedFilesTests.cs
index 5ead303ae..ff9ca3ae4 100644
--- a/API.Tests/Services/ParseScannedFilesTests.cs
+++ b/API.Tests/Services/ParseScannedFilesTests.cs
@@ -1,5 +1,4 @@
using System;
-using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Data.Common;
using System.IO.Abstractions.TestingHelpers;
@@ -9,15 +8,13 @@ using API.Data;
using API.Data.Metadata;
using API.Entities;
using API.Entities.Enums;
-using API.Parser;
+using API.Extensions;
+using API.Helpers.Builders;
using API.Services;
using API.Services.Tasks.Scanner;
using API.Services.Tasks.Scanner.Parser;
using API.SignalR;
-using API.Tests.Helpers;
using AutoMapper;
-using DotNet.Globbing;
-using Flurl.Util;
using Microsoft.Data.Sqlite;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
@@ -121,17 +118,9 @@ public class ParseScannedFilesTests
_context.ServerSetting.Update(setting);
- _context.Library.Add(new Library()
- {
- Name = "Manga",
- Folders = new List<FolderPath>()
- {
- new FolderPath()
- {
- Path = DataDirectory
- }
- }
- });
+ _context.Library.Add(new LibraryBuilder("Manga")
+ .WithFolderPath(new FolderPathBuilder(DataDirectory).Build())
+ .Build());
return await _context.SaveChangesAsync() > 0;
}
@@ -254,7 +243,7 @@ public class ParseScannedFilesTests
var foundParsedSeries = new ParsedSeries()
{
Name = parsedFiles.First().Series,
- NormalizedName = API.Services.Tasks.Scanner.Parser.Parser.Normalize(parsedFiles.First().Series),
+ NormalizedName = parsedFiles.First().Series.ToNormalized(),
Format = parsedFiles.First().Format
};
diff --git a/API.Tests/Services/ProcessSeriesTests.cs b/API.Tests/Services/ProcessSeriesTests.cs
new file mode 100644
index 000000000..ef5c45007
--- /dev/null
+++ b/API.Tests/Services/ProcessSeriesTests.cs
@@ -0,0 +1,72 @@
+using System.IO;
+using API.Data;
+using API.Data.Metadata;
+using API.Entities;
+using API.Entities.Enums;
+using API.Helpers;
+using API.Helpers.Builders;
+using API.Services;
+using API.Services.Tasks.Metadata;
+using API.Services.Tasks.Scanner;
+using API.SignalR;
+using Microsoft.Extensions.Logging;
+using NSubstitute;
+using Xunit;
+
+namespace API.Tests.Services;
+
+public class ProcessSeriesTests
+{
+
+
+ #region UpdateSeriesMetadata
+
+
+
+ #endregion
+
+ #region UpdateVolumes
+
+
+
+ #endregion
+
+ #region UpdateChapters
+
+
+
+ #endregion
+
+ #region AddOrUpdateFileForChapter
+
+
+
+ #endregion
+
+ #region UpdateChapterFromComicInfo
+
+ // public void UpdateChapterFromComicInfo_()
+ // {
+ // // TODO: Do this
+ // var file = Path.Join(Directory.GetCurrentDirectory(), "../../../Services/Test Data/ScannerService/Library/Manga/Hajime no Ippo/Hajime no Ippo Chapter 1.cbz");
+ // // Chapter and ComicInfo
+ // var chapter = new ChapterBuilder("1")
+ // .WithId(0)
+ // .WithFile(new MangaFileBuilder(file, MangaFormat.Archive).Build())
+ // .Build();
+ //
+ // var ps = new ProcessSeries(Substitute.For<IUnitOfWork>(), Substitute.For<ILogger<ProcessSeries>>(),
+ // Substitute.For<IEventHub>(), Substitute.For<IDirectoryService>()
+ // , Substitute.For<ICacheHelper>(), Substitute.For<IReadingItemService>(), Substitute.For<IFileService>(),
+ // Substitute.For<IMetadataService>(),
+ // Substitute.For<IWordCountAnalyzerService>(),
+ // Substitute.For<ICollectionTagService>(), Substitute.For<IReadingListService>());
+ //
+ // ps.UpdateChapterFromComicInfo(chapter, new ComicInfo()
+ // {
+ //
+ // });
+ // }
+
+ #endregion
+}
diff --git a/API.Tests/Services/ReaderServiceTests.cs b/API.Tests/Services/ReaderServiceTests.cs
index 417a87e42..01f94feae 100644
--- a/API.Tests/Services/ReaderServiceTests.cs
+++ b/API.Tests/Services/ReaderServiceTests.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.Data.Common;
using System.IO.Abstractions.TestingHelpers;
using System.Linq;
@@ -10,8 +9,12 @@ using API.DTOs;
using API.DTOs.Reader;
using API.Entities;
using API.Entities.Enums;
+using API.Entities.Metadata;
+using API.Extensions;
using API.Helpers;
+using API.Helpers.Builders;
using API.Services;
+using API.Services.Tasks;
using API.SignalR;
using API.Tests.Helpers;
using AutoMapper;
@@ -27,10 +30,9 @@ namespace API.Tests.Services;
public class ReaderServiceTests
{
private readonly ITestOutputHelper _testOutputHelper;
-
private readonly IUnitOfWork _unitOfWork;
-
private readonly DataContext _context;
+ private readonly ReaderService _readerService;
private const string CacheDirectory = "C:/kavita/config/cache/";
private const string CoverImageDirectory = "C:/kavita/config/covers/";
@@ -48,6 +50,9 @@ public class ReaderServiceTests
var config = new MapperConfiguration(cfg => cfg.AddProfile<AutoMapperProfiles>());
var mapper = config.CreateMapper();
_unitOfWork = new UnitOfWork(_context, mapper, null);
+ _readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(),
+ Substitute.For<IEventHub>(), Substitute.For<IImageService>(),
+ new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), new MockFileSystem()));
}
#region Setup
@@ -77,10 +82,9 @@ public class ReaderServiceTests
_context.ServerSetting.Update(setting);
- _context.Library.Add(new Library()
- {
- Name = "Manga", Folders = new List<FolderPath>() {new FolderPath() {Path = "C:/data/"}}
- });
+ _context.Library.Add(new LibraryBuilder("Manga")
+ .WithFolderPath(new FolderPathBuilder("C:/data/").Build())
+ .Build());
return await _context.SaveChangesAsync() > 0;
}
@@ -125,34 +129,25 @@ public class ReaderServiceTests
{
await ResetDb();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- new Volume()
- {
- Chapters = new List<Chapter>()
- {
- new Chapter()
- {
- Pages = 1
- }
- }
- }
- }
- });
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("0")
+ .WithNumber(0)
+ .WithChapter(new ChapterBuilder("0")
+ .WithPages(1)
+ .Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+
+
+ _context.Series.Add(series);
+
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
- Assert.Equal(0, await readerService.CapPageToChapter(1, -1));
- Assert.Equal(1, await readerService.CapPageToChapter(1, 10));
+ Assert.Equal(0, await _readerService.CapPageToChapter(1, -1));
+ Assert.Equal(1, await _readerService.CapPageToChapter(1, 10));
}
#endregion
@@ -164,27 +159,17 @@ public class ReaderServiceTests
{
await ResetDb();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- new Volume()
- {
- Chapters = new List<Chapter>()
- {
- new Chapter()
- {
- Pages = 1
- }
- }
- }
- }
- });
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("0")
+ .WithNumber(0)
+ .WithChapter(new ChapterBuilder("0")
+ .WithPages(1)
+ .Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+
+ _context.Series.Add(series);
_context.AppUser.Add(new AppUser()
{
@@ -193,9 +178,9 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
- var successful = await readerService.SaveReadingProgress(new ProgressDto()
+
+ var successful = await _readerService.SaveReadingProgress(new ProgressDto()
{
ChapterId = 1,
PageNum = 1,
@@ -213,27 +198,17 @@ public class ReaderServiceTests
{
await ResetDb();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- new Volume()
- {
- Chapters = new List<Chapter>()
- {
- new Chapter()
- {
- Pages = 1
- }
- }
- }
- }
- });
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("0")
+ .WithNumber(0)
+ .WithChapter(new ChapterBuilder("0")
+ .WithPages(1)
+ .Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+
+ _context.Series.Add(series);
_context.AppUser.Add(new AppUser()
{
@@ -242,9 +217,9 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
- var successful = await readerService.SaveReadingProgress(new ProgressDto()
+
+ var successful = await _readerService.SaveReadingProgress(new ProgressDto()
{
ChapterId = 1,
PageNum = 1,
@@ -256,7 +231,7 @@ public class ReaderServiceTests
Assert.True(successful);
Assert.NotNull(await _unitOfWork.AppUserProgressRepository.GetUserProgressAsync(1, 1));
- Assert.True(await readerService.SaveReadingProgress(new ProgressDto()
+ Assert.True(await _readerService.SaveReadingProgress(new ProgressDto()
{
ChapterId = 1,
PageNum = 1,
@@ -279,31 +254,20 @@ public class ReaderServiceTests
{
await ResetDb();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- new Volume()
- {
- Chapters = new List<Chapter>()
- {
- new Chapter()
- {
- Pages = 1
- },
- new Chapter()
- {
- Pages = 2
- }
- }
- }
- }
- });
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("0")
+ .WithNumber(0)
+ .WithChapter(new ChapterBuilder("0")
+ .WithPages(1)
+ .Build())
+ .WithChapter(new ChapterBuilder("0")
+ .WithPages(2)
+ .Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+
+ _context.Series.Add(series);
_context.AppUser.Add(new AppUser()
{
@@ -312,10 +276,10 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
+
var volumes = await _unitOfWork.VolumeRepository.GetVolumes(1);
- await readerService.MarkChaptersAsRead(await _unitOfWork.UserRepository.GetUserByIdAsync(1, AppUserIncludes.Progress), 1, volumes.First().Chapters);
+ await _readerService.MarkChaptersAsRead(await _unitOfWork.UserRepository.GetUserByIdAsync(1, AppUserIncludes.Progress), 1, volumes.First().Chapters);
await _context.SaveChangesAsync();
Assert.Equal(2, (await _unitOfWork.UserRepository.GetUserByIdAsync(1, AppUserIncludes.Progress)).Progresses.Count);
@@ -329,31 +293,20 @@ public class ReaderServiceTests
{
await ResetDb();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- new Volume()
- {
- Chapters = new List<Chapter>()
- {
- new Chapter()
- {
- Pages = 1
- },
- new Chapter()
- {
- Pages = 2
- }
- }
- }
- }
- });
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("0")
+ .WithNumber(0)
+ .WithChapter(new ChapterBuilder("0")
+ .WithPages(1)
+ .Build())
+ .WithChapter(new ChapterBuilder("0")
+ .WithPages(2)
+ .Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+
+ _context.Series.Add(series);
_context.AppUser.Add(new AppUser()
{
@@ -362,15 +315,15 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
+
var volumes = (await _unitOfWork.VolumeRepository.GetVolumes(1)).ToList();
- await readerService.MarkChaptersAsRead(await _unitOfWork.UserRepository.GetUserByIdAsync(1, AppUserIncludes.Progress), 1, volumes.First().Chapters);
+ await _readerService.MarkChaptersAsRead(await _unitOfWork.UserRepository.GetUserByIdAsync(1, AppUserIncludes.Progress), 1, volumes.First().Chapters);
await _context.SaveChangesAsync();
Assert.Equal(2, (await _unitOfWork.UserRepository.GetUserByIdAsync(1, AppUserIncludes.Progress)).Progresses.Count);
- await readerService.MarkChaptersAsUnread(await _unitOfWork.UserRepository.GetUserByIdAsync(1, AppUserIncludes.Progress), 1, volumes.First().Chapters);
+ await _readerService.MarkChaptersAsUnread(await _unitOfWork.UserRepository.GetUserByIdAsync(1, AppUserIncludes.Progress), 1, volumes.First().Chapters);
await _context.SaveChangesAsync();
var progresses = (await _unitOfWork.UserRepository.GetUserByIdAsync(1, AppUserIncludes.Progress)).Progresses;
@@ -388,32 +341,28 @@ public class ReaderServiceTests
// V1 -> V2
await ResetDb();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("2", false, new List<MangaFile>()),
- }),
- EntityFactory.CreateVolume("2", new List<Chapter>()
- {
- EntityFactory.CreateChapter("21", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("22", false, new List<MangaFile>()),
- }),
- EntityFactory.CreateVolume("3", new List<Chapter>()
- {
- EntityFactory.CreateChapter("31", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("32", false, new List<MangaFile>()),
- }),
- }
- });
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("1")
+ .WithNumber(1)
+ .WithChapter(new ChapterBuilder("1").Build())
+ .WithChapter(new ChapterBuilder("2").Build())
+ .Build())
+
+ .WithVolume(new VolumeBuilder("2")
+ .WithNumber(2)
+ .WithChapter(new ChapterBuilder("21").Build())
+ .WithChapter(new ChapterBuilder("22").Build())
+ .Build())
+
+ .WithVolume(new VolumeBuilder("3")
+ .WithNumber(3)
+ .WithChapter(new ChapterBuilder("31").Build())
+ .WithChapter(new ChapterBuilder("32").Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+
+ _context.Series.Add(series);
_context.AppUser.Add(new AppUser()
{
@@ -422,9 +371,9 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
- var nextChapter = await readerService.GetNextChapterIdAsync(1, 1, 1, 1);
+
+ var nextChapter = await _readerService.GetNextChapterIdAsync(1, 1, 1, 1);
var actualChapter = await _unitOfWork.ChapterRepository.GetChapterAsync(nextChapter);
Assert.Equal("2", actualChapter.Range);
}
@@ -434,32 +383,29 @@ public class ReaderServiceTests
{
await ResetDb();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("2", false, new List<MangaFile>()),
- }),
- EntityFactory.CreateVolume("2", new List<Chapter>()
- {
- EntityFactory.CreateChapter("21", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("22", false, new List<MangaFile>()),
- }),
- EntityFactory.CreateVolume("3", new List<Chapter>()
- {
- EntityFactory.CreateChapter("31", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("32", false, new List<MangaFile>()),
- }),
- }
- });
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("1")
+ .WithNumber(1)
+ .WithChapter(new ChapterBuilder("1").Build())
+ .WithChapter(new ChapterBuilder("2").Build())
+ .Build())
+
+ .WithVolume(new VolumeBuilder("2")
+ .WithNumber(2)
+ .WithChapter(new ChapterBuilder("21").Build())
+ .WithChapter(new ChapterBuilder("22").Build())
+ .Build())
+
+ .WithVolume(new VolumeBuilder("3")
+ .WithNumber(3)
+ .WithChapter(new ChapterBuilder("31").Build())
+ .WithChapter(new ChapterBuilder("32").Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+
+ _context.Series.Add(series);
+
_context.AppUser.Add(new AppUser()
{
@@ -468,10 +414,7 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
-
-
- var nextChapter = await readerService.GetNextChapterIdAsync(1, 1, 2, 1);
+ var nextChapter = await _readerService.GetNextChapterIdAsync(1, 1, 2, 1);
var actualChapter = await _unitOfWork.ChapterRepository.GetChapterAsync(nextChapter);
Assert.Equal("21", actualChapter.Range);
}
@@ -481,32 +424,29 @@ public class ReaderServiceTests
{
await ResetDb();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("2", false, new List<MangaFile>()),
- }),
- EntityFactory.CreateVolume("1.5", new List<Chapter>()
- {
- EntityFactory.CreateChapter("21", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("22", false, new List<MangaFile>()),
- }),
- EntityFactory.CreateVolume("2", new List<Chapter>()
- {
- EntityFactory.CreateChapter("31", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("32", false, new List<MangaFile>()),
- }),
- }
- });
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("1")
+ .WithNumber(1)
+ .WithChapter(new ChapterBuilder("1").Build())
+ .WithChapter(new ChapterBuilder("2").Build())
+ .Build())
+
+ .WithVolume(new VolumeBuilder("1.5")
+ .WithNumber(2)
+ .WithChapter(new ChapterBuilder("21").Build())
+ .WithChapter(new ChapterBuilder("22").Build())
+ .Build())
+
+ .WithVolume(new VolumeBuilder("3")
+ .WithNumber(3)
+ .WithChapter(new ChapterBuilder("31").Build())
+ .WithChapter(new ChapterBuilder("32").Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+
+ _context.Series.Add(series);
+
_context.AppUser.Add(new AppUser()
{
@@ -515,10 +455,10 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
- var nextChapter = await readerService.GetNextChapterIdAsync(1, 1, 2, 1);
+
+ var nextChapter = await _readerService.GetNextChapterIdAsync(1, 1, 2, 1);
var actualChapter = await _unitOfWork.ChapterRepository.GetChapterAsync(nextChapter);
Assert.Equal("21", actualChapter.Range);
}
@@ -528,27 +468,22 @@ public class ReaderServiceTests
{
await ResetDb();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("2", false, new List<MangaFile>()),
- }),
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("21", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("22", false, new List<MangaFile>()),
- }),
- }
- });
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("0")
+ .WithNumber(0)
+ .WithChapter(new ChapterBuilder("1").Build())
+ .WithChapter(new ChapterBuilder("2").Build())
+ .Build())
+
+ .WithVolume(new VolumeBuilder("1")
+ .WithNumber(1)
+ .WithChapter(new ChapterBuilder("21").Build())
+ .WithChapter(new ChapterBuilder("22").Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+
+ _context.Series.Add(series);
_context.AppUser.Add(new AppUser()
{
@@ -557,10 +492,10 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
- var nextChapter = await readerService.GetNextChapterIdAsync(1, 2, 4, 1);
+
+ var nextChapter = await _readerService.GetNextChapterIdAsync(1, 2, 4, 1);
Assert.NotEqual(-1, nextChapter);
var actualChapter = await _unitOfWork.ChapterRepository.GetChapterAsync(nextChapter);
Assert.Equal("1", actualChapter.Range);
@@ -571,30 +506,27 @@ public class ReaderServiceTests
{
await ResetDb();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("66", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("67", false, new List<MangaFile>()),
- }),
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, new List<MangaFile>()),
- }),
- EntityFactory.CreateVolume("2", new List<Chapter>()
- {
- EntityFactory.CreateChapter("0", false, new List<MangaFile>()),
- }),
- }
- });
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("0")
+ .WithNumber(0)
+ .WithChapter(new ChapterBuilder("66").Build())
+ .WithChapter(new ChapterBuilder("67").Build())
+ .Build())
+
+ .WithVolume(new VolumeBuilder("1")
+ .WithNumber(1)
+ .WithChapter(new ChapterBuilder("1").Build())
+ .Build())
+
+ .WithVolume(new VolumeBuilder("2")
+ .WithNumber(2)
+ .WithChapter(new ChapterBuilder("0").Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+
+ _context.Series.Add(series);
+
_context.AppUser.Add(new AppUser()
{
@@ -603,9 +535,9 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
- var nextChapter = await readerService.GetNextChapterIdAsync(1, 2, 3, 1);
+
+ var nextChapter = await _readerService.GetNextChapterIdAsync(1, 2, 3, 1);
Assert.NotEqual(-1, nextChapter);
var actualChapter = await _unitOfWork.ChapterRepository.GetChapterAsync(nextChapter);
Assert.Equal("0", actualChapter.Range);
@@ -616,27 +548,24 @@ public class ReaderServiceTests
{
await ResetDb();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("2", false, new List<MangaFile>()),
- }),
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("A.cbz", true, new List<MangaFile>()),
- EntityFactory.CreateChapter("B.cbz", true, new List<MangaFile>()),
- }),
- }
- });
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("1")
+ .WithNumber(1)
+ .WithChapter(new ChapterBuilder("1").Build())
+ .WithChapter(new ChapterBuilder("2").Build())
+ .Build())
+
+ .WithVolume(new VolumeBuilder("0")
+ .WithNumber(0)
+ .WithChapter(new ChapterBuilder("A.cbz").WithIsSpecial(true).Build())
+ .WithChapter(new ChapterBuilder("B.cbz").WithIsSpecial(true).Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+
+ _context.Series.Add(series);
+
+
_context.AppUser.Add(new AppUser()
{
@@ -645,10 +574,10 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
- var nextChapter = await readerService.GetNextChapterIdAsync(1, 2, 4, 1);
+
+ var nextChapter = await _readerService.GetNextChapterIdAsync(1, 2, 4, 1);
Assert.Equal(-1, nextChapter);
}
@@ -657,22 +586,16 @@ public class ReaderServiceTests
{
await ResetDb();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("2", false, new List<MangaFile>()),
- }),
- }
- });
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("1")
+ .WithNumber(1)
+ .WithChapter(new ChapterBuilder("1").Build())
+ .WithChapter(new ChapterBuilder("2").Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+
+ _context.Series.Add(series);
_context.AppUser.Add(new AppUser()
{
@@ -681,10 +604,10 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
- var nextChapter = await readerService.GetNextChapterIdAsync(1, 1, 2, 1);
+
+ var nextChapter = await _readerService.GetNextChapterIdAsync(1, 1, 2, 1);
Assert.Equal(-1, nextChapter);
}
@@ -693,27 +616,23 @@ public class ReaderServiceTests
{
await ResetDb();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("2", false, new List<MangaFile>()),
- }),
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("2", false, new List<MangaFile>()),
- }),
- }
- });
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("0")
+ .WithNumber(0)
+ .WithChapter(new ChapterBuilder("1").Build())
+ .WithChapter(new ChapterBuilder("2").Build())
+ .Build())
+
+ .WithVolume(new VolumeBuilder("1")
+ .WithNumber(1)
+ .WithChapter(new ChapterBuilder("1").WithIsSpecial(true).Build())
+ .WithChapter(new ChapterBuilder("2").WithIsSpecial(true).Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+
+ _context.Series.Add(series);
+
_context.AppUser.Add(new AppUser()
{
@@ -722,10 +641,10 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
- var nextChapter = await readerService.GetNextChapterIdAsync(1, 1, 2, 1);
+
+ var nextChapter = await _readerService.GetNextChapterIdAsync(1, 1, 2, 1);
Assert.Equal(-1, nextChapter);
}
@@ -734,27 +653,23 @@ public class ReaderServiceTests
{
await ResetDb();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("2", false, new List<MangaFile>()),
- }),
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("A.cbz", true, new List<MangaFile>()),
- EntityFactory.CreateChapter("B.cbz", true, new List<MangaFile>()),
- }),
- }
- });
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("1")
+ .WithNumber(1)
+ .WithChapter(new ChapterBuilder("1").Build())
+ .WithChapter(new ChapterBuilder("2").Build())
+ .Build())
+
+ .WithVolume(new VolumeBuilder("0")
+ .WithNumber(0)
+ .WithChapter(new ChapterBuilder("A.cbz").WithIsSpecial(true).Build())
+ .WithChapter(new ChapterBuilder("B.cbz").WithIsSpecial(true).Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+
+ _context.Series.Add(series);
+
_context.AppUser.Add(new AppUser()
{
@@ -763,10 +678,7 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
-
-
- var nextChapter = await readerService.GetNextChapterIdAsync(1, 1, 2, 1);
+ var nextChapter = await _readerService.GetNextChapterIdAsync(1, 1, 2, 1);
Assert.NotEqual(-1, nextChapter);
var actualChapter = await _unitOfWork.ChapterRepository.GetChapterAsync(nextChapter);
Assert.Equal("A.cbz", actualChapter.Range);
@@ -777,23 +689,17 @@ public class ReaderServiceTests
{
await ResetDb();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("2", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("A.cbz", true, new List<MangaFile>()),
- }),
- }
- });
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("0")
+ .WithNumber(0)
+ .WithChapter(new ChapterBuilder("1").Build())
+ .WithChapter(new ChapterBuilder("2").Build())
+ .WithChapter(new ChapterBuilder("A.cbz").WithIsSpecial(true).Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+
+ _context.Series.Add(series);
_context.AppUser.Add(new AppUser()
{
@@ -802,10 +708,8 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
-
- var nextChapter = await readerService.GetNextChapterIdAsync(1, 1, 2, 1);
+ var nextChapter = await _readerService.GetNextChapterIdAsync(1, 1, 2, 1);
Assert.NotEqual(-1, nextChapter);
var actualChapter = await _unitOfWork.ChapterRepository.GetChapterAsync(nextChapter);
Assert.Equal("A.cbz", actualChapter.Range);
@@ -816,27 +720,21 @@ public class ReaderServiceTests
{
await ResetDb();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("2", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("A.cbz", true, new List<MangaFile>()),
- }),
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("0", false, new List<MangaFile>()),
- }),
- }
- });
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("0")
+ .WithNumber(0)
+ .WithChapter(new ChapterBuilder("1").Build())
+ .WithChapter(new ChapterBuilder("2").Build())
+ .WithChapter(new ChapterBuilder("A.cbz").WithIsSpecial(true).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("1")
+ .WithNumber(1)
+ .WithChapter(new ChapterBuilder("0").Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+
+ _context.Series.Add(series);
_context.AppUser.Add(new AppUser()
{
@@ -845,10 +743,7 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
-
-
- var nextChapter = await readerService.GetNextChapterIdAsync(1, 1, 3, 1);
+ var nextChapter = await _readerService.GetNextChapterIdAsync(1, 1, 3, 1);
Assert.Equal(-1, nextChapter);
}
@@ -858,27 +753,21 @@ public class ReaderServiceTests
{
await ResetDb();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("2", false, new List<MangaFile>()),
- }),
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("A.cbz", true, new List<MangaFile>()),
- EntityFactory.CreateChapter("B.cbz", true, new List<MangaFile>()),
- }),
- }
- });
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("1")
+ .WithNumber(1)
+ .WithChapter(new ChapterBuilder("1").Build())
+ .WithChapter(new ChapterBuilder("2").Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("0")
+ .WithNumber(0)
+ .WithChapter(new ChapterBuilder("A.cbz").WithIsSpecial(true).Build())
+ .WithChapter(new ChapterBuilder("B.cbz").WithIsSpecial(true).Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+
+ _context.Series.Add(series);
_context.AppUser.Add(new AppUser()
{
@@ -887,15 +776,49 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
-
- var nextChapter = await readerService.GetNextChapterIdAsync(1, 2, 3, 1);
+ var nextChapter = await _readerService.GetNextChapterIdAsync(1, 2, 3, 1);
Assert.NotEqual(-1, nextChapter);
var actualChapter = await _unitOfWork.ChapterRepository.GetChapterAsync(nextChapter);
Assert.Equal("B.cbz", actualChapter.Range);
}
+ [Fact]
+ public async Task GetNextChapterIdAsync_ShouldRollIntoNextVolume_WhenAllVolumesHaveAChapterToo()
+ {
+ await ResetDb();
+
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("1")
+ .WithNumber(1)
+ .WithChapter(new ChapterBuilder("12").Build())
+ .Build())
+
+ .WithVolume(new VolumeBuilder("2")
+ .WithNumber(2)
+ .WithChapter(new ChapterBuilder("12").Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+
+ _context.Series.Add(series);
+
+ var user = new AppUserBuilder("majora2007", "fake").Build();
+
+ _context.AppUser.Add(user);
+
+ await _context.SaveChangesAsync();
+
+ await _readerService.MarkChaptersAsRead(user, 1, new List<Chapter>()
+ {
+ series.Volumes.First().Chapters.First()
+ });
+
+ var nextChapter = await _readerService.GetNextChapterIdAsync(1, 1, 1, 1);
+ var actualChapter = await _unitOfWork.ChapterRepository.GetChapterAsync(nextChapter, ChapterIncludes.Volumes);
+ Assert.Equal(2, actualChapter.Volume.Number);
+ }
+
#endregion
#region GetPrevChapterIdAsync
@@ -906,32 +829,28 @@ public class ReaderServiceTests
// V1 -> V2
await ResetDb();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("2", false, new List<MangaFile>()),
- }),
- EntityFactory.CreateVolume("2", new List<Chapter>()
- {
- EntityFactory.CreateChapter("21", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("22", false, new List<MangaFile>()),
- }),
- EntityFactory.CreateVolume("3", new List<Chapter>()
- {
- EntityFactory.CreateChapter("31", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("32", false, new List<MangaFile>()),
- }),
- }
- });
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("1")
+ .WithNumber(1)
+ .WithChapter(new ChapterBuilder("1").Build())
+ .WithChapter(new ChapterBuilder("2").Build())
+ .Build())
+
+ .WithVolume(new VolumeBuilder("2")
+ .WithNumber(2)
+ .WithChapter(new ChapterBuilder("21").Build())
+ .WithChapter(new ChapterBuilder("22").Build())
+ .Build())
+
+ .WithVolume(new VolumeBuilder("3")
+ .WithNumber(3)
+ .WithChapter(new ChapterBuilder("31").Build())
+ .WithChapter(new ChapterBuilder("32").Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+
+ _context.Series.Add(series);
_context.AppUser.Add(new AppUser()
{
@@ -940,9 +859,9 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
- var prevChapter = await readerService.GetPrevChapterIdAsync(1, 1, 2, 1);
+
+ var prevChapter = await _readerService.GetPrevChapterIdAsync(1, 1, 2, 1);
var actualChapter = await _unitOfWork.ChapterRepository.GetChapterAsync(prevChapter);
Assert.Equal("1", actualChapter.Range);
}
@@ -953,33 +872,27 @@ public class ReaderServiceTests
// V1 -> V2
await ResetDb();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("2", false, new List<MangaFile>()),
- }),
- EntityFactory.CreateVolume("1.5", new List<Chapter>()
- {
- EntityFactory.CreateChapter("21", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("22", false, new List<MangaFile>()),
- }),
- EntityFactory.CreateVolume("3", new List<Chapter>()
- {
- EntityFactory.CreateChapter("31", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("32", false, new List<MangaFile>()),
- }),
- }
- });
-
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("1")
+ .WithNumber(1)
+ .WithChapter(new ChapterBuilder("1").Build())
+ .WithChapter(new ChapterBuilder("2").Build())
+ .Build())
+
+ .WithVolume(new VolumeBuilder("1.5")
+ .WithNumber(2)
+ .WithChapter(new ChapterBuilder("21").Build())
+ .WithChapter(new ChapterBuilder("22").Build())
+ .Build())
+
+ .WithVolume(new VolumeBuilder("3")
+ .WithNumber(3)
+ .WithChapter(new ChapterBuilder("31").Build())
+ .WithChapter(new ChapterBuilder("32").Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+ _context.Series.Add(series);
_context.AppUser.Add(new AppUser()
{
UserName = "majora2007"
@@ -987,9 +900,9 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
- var prevChapter = await readerService.GetPrevChapterIdAsync(1, 3, 5, 1);
+
+ var prevChapter = await _readerService.GetPrevChapterIdAsync(1, 3, 5, 1);
var actualChapter = await _unitOfWork.ChapterRepository.GetChapterAsync(prevChapter);
Assert.Equal("22", actualChapter.Range);
}
@@ -999,49 +912,39 @@ public class ReaderServiceTests
{
await ResetDb();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("40", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("50", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("60", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("Some Special Title", true, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("1997", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("2001", new List<Chapter>()
- {
- EntityFactory.CreateChapter("21", false, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("2005", new List<Chapter>()
- {
- EntityFactory.CreateChapter("31", false, new List<MangaFile>(), 1),
- }),
- }
- });
-
-
- _context.AppUser.Add(new AppUser()
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("0")
+ .WithChapter(new ChapterBuilder("40").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("50").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("60").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("Some Special Title").WithPages(1).WithIsSpecial(true).Build())
+ .Build())
+
+ .WithVolume(new VolumeBuilder("1997")
+ .WithChapter(new ChapterBuilder("1").WithPages(1).Build())
+ .Build())
+
+ .WithVolume(new VolumeBuilder("2001")
+ .WithChapter(new ChapterBuilder("21").WithPages(1).Build())
+ .Build())
+
+ .WithVolume(new VolumeBuilder("2005")
+ .WithChapter(new ChapterBuilder("31").WithPages(1).Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+ _context.Series.Add(series);
+ _context.AppUser.Add(new AppUser()
{
UserName = "majora2007"
});
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
+
// prevChapter should be id from ch.21 from volume 2001
- var prevChapter = await readerService.GetPrevChapterIdAsync(1, 4, 7, 1);
+ var prevChapter = await _readerService.GetPrevChapterIdAsync(1, 4, 7, 1);
var actualChapter = await _unitOfWork.ChapterRepository.GetChapterAsync(prevChapter);
Assert.NotNull(actualChapter);
@@ -1053,32 +956,25 @@ public class ReaderServiceTests
{
await ResetDb();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("2", false, new List<MangaFile>()),
- }),
- EntityFactory.CreateVolume("2", new List<Chapter>()
- {
- EntityFactory.CreateChapter("21", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("22", false, new List<MangaFile>()),
- }),
- EntityFactory.CreateVolume("3", new List<Chapter>()
- {
- EntityFactory.CreateChapter("31", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("32", false, new List<MangaFile>()),
- }),
- }
- });
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("1")
+ .WithChapter(new ChapterBuilder("1").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("2").WithPages(1).Build())
+ .Build())
+
+ .WithVolume(new VolumeBuilder("2")
+ .WithChapter(new ChapterBuilder("21").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("22").WithPages(1).Build())
+ .Build())
+
+ .WithVolume(new VolumeBuilder("3")
+ .WithChapter(new ChapterBuilder("31").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("32").WithPages(1).Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+
+ _context.Series.Add(series);
_context.AppUser.Add(new AppUser()
{
@@ -1087,10 +983,10 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
- var prevChapter = await readerService.GetPrevChapterIdAsync(1, 2, 3, 1);
+
+ var prevChapter = await _readerService.GetPrevChapterIdAsync(1, 2, 3, 1);
var actualChapter = await _unitOfWork.ChapterRepository.GetChapterAsync(prevChapter);
Assert.Equal("2", actualChapter.Range);
}
@@ -1100,27 +996,22 @@ public class ReaderServiceTests
{
await ResetDb();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("2", false, new List<MangaFile>()),
- }),
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("A.cbz", true, new List<MangaFile>()),
- EntityFactory.CreateChapter("B.cbz", true, new List<MangaFile>()),
- }),
- }
- });
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("1")
+ .WithNumber(1)
+ .WithChapter(new ChapterBuilder("1").Build())
+ .WithChapter(new ChapterBuilder("2").Build())
+ .Build())
+
+ .WithVolume(new VolumeBuilder("0")
+ .WithNumber(0)
+ .WithChapter(new ChapterBuilder("A.cbz").WithIsSpecial(true).Build())
+ .WithChapter(new ChapterBuilder("B.cbz").WithIsSpecial(true).Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+
+ _context.Series.Add(series);
_context.AppUser.Add(new AppUser()
{
@@ -1129,10 +1020,10 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
- var prevChapter = await readerService.GetPrevChapterIdAsync(1, 2, 3, 1);
+
+ var prevChapter = await _readerService.GetPrevChapterIdAsync(1, 2, 3, 1);
Assert.Equal(2, prevChapter);
var actualChapter = await _unitOfWork.ChapterRepository.GetChapterAsync(prevChapter);
Assert.Equal("2", actualChapter.Range);
@@ -1143,22 +1034,16 @@ public class ReaderServiceTests
{
await ResetDb();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("2", false, new List<MangaFile>()),
- }),
- }
- });
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("1")
+ .WithNumber(1)
+ .WithChapter(new ChapterBuilder("1").Build())
+ .WithChapter(new ChapterBuilder("2").Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+
+ _context.Series.Add(series);
_context.AppUser.Add(new AppUser()
{
@@ -1167,10 +1052,10 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
- var prevChapter = await readerService.GetPrevChapterIdAsync(1, 1, 1, 1);
+
+ var prevChapter = await _readerService.GetPrevChapterIdAsync(1, 1, 1, 1);
Assert.Equal(-1, prevChapter);
}
@@ -1179,21 +1064,15 @@ public class ReaderServiceTests
{
await ResetDb();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("0", false, new List<MangaFile>()),
- }),
- }
- });
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("1")
+ .WithNumber(1)
+ .WithChapter(new ChapterBuilder("0").Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+
+ _context.Series.Add(series);
_context.AppUser.Add(new AppUser()
{
@@ -1202,10 +1081,10 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
- var prevChapter = await readerService.GetPrevChapterIdAsync(1, 1, 1, 1);
+
+ var prevChapter = await _readerService.GetPrevChapterIdAsync(1, 1, 1, 1);
Assert.Equal(-1, prevChapter);
}
@@ -1214,26 +1093,21 @@ public class ReaderServiceTests
{
await ResetDb();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("2", false, new List<MangaFile>()),
- }),
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("0", false, new List<MangaFile>()),
- }),
- }
- });
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("0")
+ .WithNumber(0)
+ .WithChapter(new ChapterBuilder("1").Build())
+ .WithChapter(new ChapterBuilder("2").Build())
+ .Build())
+
+ .WithVolume(new VolumeBuilder("1")
+ .WithNumber(1)
+ .WithChapter(new ChapterBuilder("0").Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+
+ _context.Series.Add(series);
_context.AppUser.Add(new AppUser()
{
@@ -1242,10 +1116,10 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
- var prevChapter = await readerService.GetPrevChapterIdAsync(1, 1, 1, 1);
+
+ var prevChapter = await _readerService.GetPrevChapterIdAsync(1, 1, 1, 1);
Assert.Equal(-1, prevChapter);
}
@@ -1254,34 +1128,30 @@ public class ReaderServiceTests
{
await ResetDb();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("5", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("6", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("7", false, new List<MangaFile>()),
-
- }),
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("2", false, new List<MangaFile>()),
- }),
- EntityFactory.CreateVolume("2", new List<Chapter>()
- {
- EntityFactory.CreateChapter("3", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("4", false, new List<MangaFile>()),
- }),
- }
- });
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("0")
+ .WithNumber(0)
+ .WithChapter(new ChapterBuilder("5").Build())
+ .WithChapter(new ChapterBuilder("6").Build())
+ .WithChapter(new ChapterBuilder("7").Build())
+ .Build())
+
+ .WithVolume(new VolumeBuilder("1")
+ .WithNumber(1)
+ .WithChapter(new ChapterBuilder("1").WithIsSpecial(true).Build())
+ .WithChapter(new ChapterBuilder("2").WithIsSpecial(true).Build())
+ .Build())
+
+ .WithVolume(new VolumeBuilder("2")
+ .WithNumber(2)
+ .WithChapter(new ChapterBuilder("3").WithIsSpecial(true).Build())
+ .WithChapter(new ChapterBuilder("4").WithIsSpecial(true).Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+
+ _context.Series.Add(series);
+
_context.AppUser.Add(new AppUser()
{
@@ -1290,14 +1160,14 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
- var prevChapter = await readerService.GetPrevChapterIdAsync(1, 2,5, 1);
+
+ var prevChapter = await _readerService.GetPrevChapterIdAsync(1, 2,5, 1);
var chapterInfoDto = await _unitOfWork.ChapterRepository.GetChapterInfoDtoAsync(prevChapter);
Assert.Equal(1, float.Parse(chapterInfoDto.ChapterNumber));
// This is first chapter of first volume
- prevChapter = await readerService.GetPrevChapterIdAsync(1, 2,4, 1);
+ prevChapter = await _readerService.GetPrevChapterIdAsync(1, 2,4, 1);
Assert.Equal(-1, prevChapter);
}
@@ -1306,22 +1176,16 @@ public class ReaderServiceTests
{
await ResetDb();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("2", false, new List<MangaFile>()),
- }),
- }
- });
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("0")
+ .WithNumber(0)
+ .WithChapter(new ChapterBuilder("1").Build())
+ .WithChapter(new ChapterBuilder("2").Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+
+ _context.Series.Add(series);
_context.AppUser.Add(new AppUser()
{
@@ -1330,10 +1194,10 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
- var prevChapter = await readerService.GetPrevChapterIdAsync(1, 1, 1, 1);
+
+ var prevChapter = await _readerService.GetPrevChapterIdAsync(1, 1, 1, 1);
Assert.Equal(-1, prevChapter);
}
@@ -1342,27 +1206,22 @@ public class ReaderServiceTests
{
await ResetDb();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("2", false, new List<MangaFile>()),
- }),
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("A.cbz", true, new List<MangaFile>()),
- EntityFactory.CreateChapter("B.cbz", true, new List<MangaFile>()),
- }),
- }
- });
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("1")
+ .WithNumber(1)
+ .WithChapter(new ChapterBuilder("1").Build())
+ .WithChapter(new ChapterBuilder("2").Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("0")
+ .WithNumber(0)
+ .WithChapter(new ChapterBuilder("A.cbz").WithIsSpecial(true).Build())
+ .WithChapter(new ChapterBuilder("B.cbz").WithIsSpecial(true).Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+
+ _context.Series.Add(series);
+
_context.AppUser.Add(new AppUser()
{
@@ -1371,10 +1230,10 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
- var prevChapter = await readerService.GetPrevChapterIdAsync(1, 2, 4, 1);
+
+ var prevChapter = await _readerService.GetPrevChapterIdAsync(1, 2, 4, 1);
Assert.NotEqual(-1, prevChapter);
var actualChapter = await _unitOfWork.ChapterRepository.GetChapterAsync(prevChapter);
Assert.Equal("A.cbz", actualChapter.Range);
@@ -1385,27 +1244,22 @@ public class ReaderServiceTests
{
await ResetDb();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("2", false, new List<MangaFile>()),
- }),
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("21", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("22", false, new List<MangaFile>()),
- }),
- }
- });
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("0")
+ .WithNumber(0)
+ .WithChapter(new ChapterBuilder("1").Build())
+ .WithChapter(new ChapterBuilder("2").Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("1")
+ .WithNumber(1)
+ .WithChapter(new ChapterBuilder("21").Build())
+ .WithChapter(new ChapterBuilder("22").Build())
+ .Build())
+
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+
+ _context.Series.Add(series);
_context.AppUser.Add(new AppUser()
{
@@ -1414,14 +1268,46 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
- var prevChapter = await readerService.GetPrevChapterIdAsync(1, 1, 1, 1);
+
+ var prevChapter = await _readerService.GetPrevChapterIdAsync(1, 1, 1, 1);
Assert.NotEqual(-1, prevChapter);
var actualChapter = await _unitOfWork.ChapterRepository.GetChapterAsync(prevChapter);
Assert.Equal("22", actualChapter.Range);
}
+
+ [Fact]
+ public async Task GetPrevChapterIdAsync_ShouldRollIntoPrevVolume_WhenAllVolumesHaveAChapterToo()
+ {
+ await ResetDb();
+
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("1")
+ .WithNumber(1)
+ .WithChapter(new ChapterBuilder("12").Build())
+ .Build())
+
+ .WithVolume(new VolumeBuilder("2")
+ .WithNumber(2)
+ .WithChapter(new ChapterBuilder("12").Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+
+ _context.Series.Add(series);
+
+ var user = new AppUserBuilder("majora2007", "fake").Build();
+
+ _context.AppUser.Add(user);
+
+ await _context.SaveChangesAsync();
+
+ var nextChapter = await _readerService.GetPrevChapterIdAsync(1, 2, 2, 1);
+ var actualChapter = await _unitOfWork.ChapterRepository.GetChapterAsync(nextChapter, ChapterIncludes.Volumes);
+ Assert.Equal(1, actualChapter.Volume.Number);
+ }
+
#endregion
#region GetContinuePoint
@@ -1430,37 +1316,29 @@ public class ReaderServiceTests
public async Task GetContinuePoint_ShouldReturnFirstVolume_NoProgress()
{
await ResetDb();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("95", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("96", false, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("2", false, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("2", new List<Chapter>()
- {
- EntityFactory.CreateChapter("21", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("22", false, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("3", new List<Chapter>()
- {
- EntityFactory.CreateChapter("31", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("32", false, new List<MangaFile>(), 1),
- }),
- }
- });
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("0")
+ .WithChapter(new ChapterBuilder("95").Build())
+ .WithChapter(new ChapterBuilder("96").Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("1")
+ .WithChapter(new ChapterBuilder("1").Build())
+ .WithChapter(new ChapterBuilder("2").Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("2")
+ .WithChapter(new ChapterBuilder("21").Build())
+ .WithChapter(new ChapterBuilder("22").Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("3")
+ .WithChapter(new ChapterBuilder("31").Build())
+ .WithChapter(new ChapterBuilder("32").Build())
+ .Build())
+
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+
+ _context.Series.Add(series);
+
_context.AppUser.Add(new AppUser()
{
@@ -1470,9 +1348,9 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
- var nextChapter = await readerService.GetContinuePoint(1, 1);
+
+ var nextChapter = await _readerService.GetContinuePoint(1, 1);
Assert.Equal("1", nextChapter.Range);
}
@@ -1481,25 +1359,18 @@ public class ReaderServiceTests
public async Task GetContinuePoint_ShouldReturnFirstVolume_WhenFirstVolumeIsAlsoTaggedAsChapter1_WithProgress()
{
await ResetDb();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, new List<MangaFile>(), 3),
- }),
- EntityFactory.CreateVolume("2", new List<Chapter>()
- {
- EntityFactory.CreateChapter("0", false, new List<MangaFile>(), 1),
- }),
- }
- });
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("1")
+ .WithChapter(new ChapterBuilder("1").WithPages(3).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("2")
+ .WithChapter(new ChapterBuilder("0").WithPages(1).Build())
+ .Build())
+ .WithPages(4)
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+
+ _context.Series.Add(series);
_context.AppUser.Add(new AppUser()
{
@@ -1510,50 +1381,81 @@ public class ReaderServiceTests
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
- await readerService.SaveReadingProgress(new ProgressDto()
+
+ await _readerService.SaveReadingProgress(new ProgressDto()
{
PageNum = 2,
ChapterId = 1,
SeriesId = 1,
VolumeId = 1
}, 1);
- var nextChapter = await readerService.GetContinuePoint(1, 1);
+ var nextChapter = await _readerService.GetContinuePoint(1, 1);
Assert.Equal("1", nextChapter.Range);
}
[Fact]
- public async Task GetContinuePoint_ShouldReturnFirstNonSpecial()
+ public async Task GetContinuePoint_ShouldReturnFirstVolume_WhenFirstVolumeIsAlsoTaggedAsChapter1Through11_WithProgress()
{
await ResetDb();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("2", false, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("2", new List<Chapter>()
- {
- EntityFactory.CreateChapter("21", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("22", false, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("3", new List<Chapter>()
- {
- EntityFactory.CreateChapter("31", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("32", false, new List<MangaFile>(), 1),
- }),
- }
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("1")
+ .WithChapter(new ChapterBuilder("1", "1-11").WithPages(3).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("2")
+ .WithChapter(new ChapterBuilder("0").WithPages(1).Build())
+ .Build())
+ .WithPages(4)
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+
+ _context.Series.Add(series);
+
+ _context.AppUser.Add(new AppUser()
+ {
+ UserName = "majora2007"
});
+ await _context.SaveChangesAsync();
+
+
+
+
+ await _readerService.SaveReadingProgress(new ProgressDto()
+ {
+ PageNum = 2,
+ ChapterId = 1,
+ SeriesId = 1,
+ VolumeId = 1
+ }, 1);
+ var nextChapter = await _readerService.GetContinuePoint(1, 1);
+
+ Assert.Equal("1-11", nextChapter.Range);
+ }
+
+ [Fact]
+ public async Task GetContinuePoint_ShouldReturnFirstNonSpecial()
+ {
+ await ResetDb();
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("1")
+ .WithChapter(new ChapterBuilder("1").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("2").WithPages(1).Build())
+ .Build())
+
+ .WithVolume(new VolumeBuilder("2")
+ .WithChapter(new ChapterBuilder("21").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("22").WithPages(1).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("3")
+ .WithChapter(new ChapterBuilder("31").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("32").WithPages(1).Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+
+ _context.Series.Add(series);
+
_context.AppUser.Add(new AppUser()
{
UserName = "majora2007"
@@ -1562,24 +1464,24 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
+
// Save progress on first volume chapters and 1st of second volume
- await readerService.SaveReadingProgress(new ProgressDto()
+ await _readerService.SaveReadingProgress(new ProgressDto()
{
PageNum = 1,
ChapterId = 1,
SeriesId = 1,
VolumeId = 1
}, 1);
- await readerService.SaveReadingProgress(new ProgressDto()
+ await _readerService.SaveReadingProgress(new ProgressDto()
{
PageNum = 1,
ChapterId = 2,
SeriesId = 1,
VolumeId = 1
}, 1);
- await readerService.SaveReadingProgress(new ProgressDto()
+ await _readerService.SaveReadingProgress(new ProgressDto()
{
PageNum = 1,
ChapterId = 3,
@@ -1589,7 +1491,7 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var nextChapter = await readerService.GetContinuePoint(1, 1);
+ var nextChapter = await _readerService.GetContinuePoint(1, 1);
Assert.Equal("22", nextChapter.Range);
@@ -1600,44 +1502,33 @@ public class ReaderServiceTests
public async Task GetContinuePoint_ShouldReturnFirstNonSpecial2()
{
await ResetDb();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- // Loose chapters
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("45", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("46", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("47", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("48", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("Some Special Title", true, new List<MangaFile>(), 1),
- }),
-
- // One file volume
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("0", false, new List<MangaFile>(), 1), // Read
- }),
- // Chapter-based volume
- EntityFactory.CreateVolume("2", new List<Chapter>()
- {
- EntityFactory.CreateChapter("21", false, new List<MangaFile>(), 1), // Read
- EntityFactory.CreateChapter("22", false, new List<MangaFile>(), 1),
- }),
- // Chapter-based volume
- EntityFactory.CreateVolume("3", new List<Chapter>()
- {
- EntityFactory.CreateChapter("31", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("32", false, new List<MangaFile>(), 1),
- }),
- }
- });
+ var series = new SeriesBuilder("Test")
+ // Loose chapters
+ .WithVolume(new VolumeBuilder("0")
+ .WithChapter(new ChapterBuilder("45").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("46").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("47").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("48").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("Some Special Title").WithIsSpecial(true).WithPages(1).Build())
+ .Build())
+ // One file volume
+ .WithVolume(new VolumeBuilder("1")
+ .WithChapter(new ChapterBuilder("0").WithPages(1).Build()) // Read
+ .Build())
+ // Chapter-based volume
+ .WithVolume(new VolumeBuilder("2")
+ .WithChapter(new ChapterBuilder("21").WithPages(1).Build()) // Read
+ .WithChapter(new ChapterBuilder("22").WithPages(1).Build())
+ .Build())
+ // Chapter-based volume
+ .WithVolume(new VolumeBuilder("3")
+ .WithChapter(new ChapterBuilder("31").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("32").WithPages(1).Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+
+ _context.Series.Add(series);
_context.AppUser.Add(new AppUser()
{
@@ -1646,10 +1537,10 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
+
// Save progress on first volume and 1st chapter of second volume
- await readerService.SaveReadingProgress(new ProgressDto()
+ await _readerService.SaveReadingProgress(new ProgressDto()
{
PageNum = 1,
ChapterId = 6, // Chapter 0 volume 1 id
@@ -1658,7 +1549,7 @@ public class ReaderServiceTests
}, 1);
- await readerService.SaveReadingProgress(new ProgressDto()
+ await _readerService.SaveReadingProgress(new ProgressDto()
{
PageNum = 1,
ChapterId = 7, // Chapter 21 volume 2 id
@@ -1668,7 +1559,7 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var nextChapter = await readerService.GetContinuePoint(1, 1);
+ var nextChapter = await _readerService.GetContinuePoint(1, 1);
Assert.Equal("22", nextChapter.Range);
@@ -1679,31 +1570,22 @@ public class ReaderServiceTests
public async Task GetContinuePoint_ShouldReturnFirstSpecial()
{
await ResetDb();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("2", false, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("2", new List<Chapter>()
- {
- EntityFactory.CreateChapter("21", false, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("31", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("32", false, new List<MangaFile>(), 1),
- }),
- }
- });
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("1")
+ .WithChapter(new ChapterBuilder("1").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("2").WithPages(1).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("2")
+ .WithChapter(new ChapterBuilder("21").WithPages(1).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("0")
+ .WithChapter(new ChapterBuilder("31").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("32").WithPages(1).Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+
+ _context.Series.Add(series);
_context.AppUser.Add(new AppUser()
{
@@ -1713,24 +1595,24 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
+
// Save progress on first volume chapters and 1st of second volume
- await readerService.SaveReadingProgress(new ProgressDto()
+ await _readerService.SaveReadingProgress(new ProgressDto()
{
PageNum = 1,
ChapterId = 1,
SeriesId = 1,
VolumeId = 1
}, 1);
- await readerService.SaveReadingProgress(new ProgressDto()
+ await _readerService.SaveReadingProgress(new ProgressDto()
{
PageNum = 1,
ChapterId = 2,
SeriesId = 1,
VolumeId = 1
}, 1);
- await readerService.SaveReadingProgress(new ProgressDto()
+ await _readerService.SaveReadingProgress(new ProgressDto()
{
PageNum = 1,
ChapterId = 3,
@@ -1740,7 +1622,7 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var nextChapter = await readerService.GetContinuePoint(1, 1);
+ var nextChapter = await _readerService.GetContinuePoint(1, 1);
Assert.Equal("31", nextChapter.Range);
}
@@ -1749,31 +1631,24 @@ public class ReaderServiceTests
public async Task GetContinuePoint_ShouldReturnFirstChapter_WhenNonRead_LooseLeafChaptersAndVolumes()
{
await ResetDb();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("230", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("231", false, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("2", false, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("2", new List<Chapter>()
- {
- EntityFactory.CreateChapter("21", false, new List<MangaFile>(), 1),
- }),
- }
- });
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("0")
+ .WithChapter(new ChapterBuilder("230").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("231").WithPages(1).Build())
+ .Build())
+
+ .WithVolume(new VolumeBuilder("1")
+ .WithChapter(new ChapterBuilder("1").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("2").WithPages(1).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("2")
+ .WithChapter(new ChapterBuilder("21").WithPages(1).Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+
+ _context.Series.Add(series);
+
_context.AppUser.Add(new AppUser()
{
@@ -1782,8 +1657,8 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
- var nextChapter = await readerService.GetContinuePoint(1, 1);
+
+ var nextChapter = await _readerService.GetContinuePoint(1, 1);
Assert.Equal("1", nextChapter.Range);
}
@@ -1792,32 +1667,24 @@ public class ReaderServiceTests
public async Task GetContinuePoint_ShouldReturnLooseChapter_WhenAllVolumesAndAFewLooseChaptersRead()
{
await ResetDb();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("100", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("101", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("102", false, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("2", false, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("2", new List<Chapter>()
- {
- EntityFactory.CreateChapter("21", false, new List<MangaFile>(), 1),
- }),
- }
- });
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("0")
+ .WithChapter(new ChapterBuilder("100").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("101").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("102").WithPages(1).Build())
+ .Build())
+
+ .WithVolume(new VolumeBuilder("1")
+ .WithChapter(new ChapterBuilder("1").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("2").WithPages(1).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("2")
+ .WithChapter(new ChapterBuilder("21").WithPages(1).Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+
+ _context.Series.Add(series);
var user = new AppUser()
{
@@ -1827,21 +1694,21 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
+
// Mark everything but chapter 101 as read
- await readerService.MarkSeriesAsRead(user, 1);
+ await _readerService.MarkSeriesAsRead(user, 1);
await _unitOfWork.CommitAsync();
// Unmark last chapter as read
- await readerService.SaveReadingProgress(new ProgressDto()
+ await _readerService.SaveReadingProgress(new ProgressDto()
{
PageNum = 0,
ChapterId = (await _unitOfWork.VolumeRepository.GetVolumeByIdAsync(1)).Chapters.ElementAt(1).Id,
SeriesId = 1,
VolumeId = 1
}, 1);
- await readerService.SaveReadingProgress(new ProgressDto()
+ await _readerService.SaveReadingProgress(new ProgressDto()
{
PageNum = 0,
ChapterId = (await _unitOfWork.VolumeRepository.GetVolumeByIdAsync(1)).Chapters.ElementAt(2).Id,
@@ -1850,7 +1717,7 @@ public class ReaderServiceTests
}, 1);
await _context.SaveChangesAsync();
- var nextChapter = await readerService.GetContinuePoint(1, 1);
+ var nextChapter = await _readerService.GetContinuePoint(1, 1);
Assert.Equal("101", nextChapter.Range);
}
@@ -1859,26 +1726,19 @@ public class ReaderServiceTests
public async Task GetContinuePoint_ShouldReturnFirstChapter_WhenAllRead()
{
await ResetDb();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("2", false, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("2", new List<Chapter>()
- {
- EntityFactory.CreateChapter("21", false, new List<MangaFile>(), 1),
- }),
- }
- });
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("1")
+ .WithChapter(new ChapterBuilder("1").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("2").WithPages(1).Build())
+ .Build())
+
+ .WithVolume(new VolumeBuilder("2")
+ .WithChapter(new ChapterBuilder("21").WithPages(1).Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+
+ _context.Series.Add(series);
_context.AppUser.Add(new AppUser()
{
@@ -1887,24 +1747,24 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
+
// Save progress on first volume chapters and 1st of second volume
- await readerService.SaveReadingProgress(new ProgressDto()
+ await _readerService.SaveReadingProgress(new ProgressDto()
{
PageNum = 1,
ChapterId = 1,
SeriesId = 1,
VolumeId = 1
}, 1);
- await readerService.SaveReadingProgress(new ProgressDto()
+ await _readerService.SaveReadingProgress(new ProgressDto()
{
PageNum = 1,
ChapterId = 2,
SeriesId = 1,
VolumeId = 1
}, 1);
- await readerService.SaveReadingProgress(new ProgressDto()
+ await _readerService.SaveReadingProgress(new ProgressDto()
{
PageNum = 1,
ChapterId = 3,
@@ -1914,7 +1774,7 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var nextChapter = await readerService.GetContinuePoint(1, 1);
+ var nextChapter = await _readerService.GetContinuePoint(1, 1);
Assert.Equal("1", nextChapter.Range);
}
@@ -1923,28 +1783,22 @@ public class ReaderServiceTests
public async Task GetContinuePoint_ShouldReturnFirstChapter_WhenAllReadAndAllChapters()
{
await ResetDb();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("2", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("3", false, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("11", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("22", false, new List<MangaFile>(), 1),
- }),
- }
- });
+ var series = new SeriesBuilder("Test")
+
+ .WithVolume(new VolumeBuilder("0")
+ .WithChapter(new ChapterBuilder("1").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("2").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("3").WithPages(1).Build())
+ .Build())
+
+ .WithVolume(new VolumeBuilder("1")
+ .WithChapter(new ChapterBuilder("11").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("22").WithPages(1).Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+
+ _context.Series.Add(series);
_context.AppUser.Add(new AppUser()
{
@@ -1953,14 +1807,14 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
+
// Save progress on first volume chapters and 1st of second volume
var user = await _unitOfWork.UserRepository.GetUserByIdAsync(1, AppUserIncludes.Progress);
- await readerService.MarkSeriesAsRead(user, 1);
+ await _readerService.MarkSeriesAsRead(user, 1);
await _context.SaveChangesAsync();
- var nextChapter = await readerService.GetContinuePoint(1, 1);
+ var nextChapter = await _readerService.GetContinuePoint(1, 1);
Assert.Equal("11", nextChapter.Range);
}
@@ -1969,24 +1823,18 @@ public class ReaderServiceTests
public async Task GetContinuePoint_ShouldReturnFirstSpecial_WhenAllReadAndAllChapters()
{
await ResetDb();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("2", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("3", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("Some Special Title", true, new List<MangaFile>(), 1),
- }),
- }
- });
+ var series = new SeriesBuilder("Test")
+
+ .WithVolume(new VolumeBuilder("0")
+ .WithChapter(new ChapterBuilder("1").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("2").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("3").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("Some Special Title").WithIsSpecial(true).WithPages(1).Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+
+ _context.Series.Add(series);
_context.AppUser.Add(new AppUser()
{
@@ -1995,24 +1843,24 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
+
// Save progress on first volume chapters and 1st of second volume
- await readerService.SaveReadingProgress(new ProgressDto()
+ await _readerService.SaveReadingProgress(new ProgressDto()
{
PageNum = 1,
ChapterId = 1,
SeriesId = 1,
VolumeId = 1
}, 1);
- await readerService.SaveReadingProgress(new ProgressDto()
+ await _readerService.SaveReadingProgress(new ProgressDto()
{
PageNum = 1,
ChapterId = 2,
SeriesId = 1,
VolumeId = 1
}, 1);
- await readerService.SaveReadingProgress(new ProgressDto()
+ await _readerService.SaveReadingProgress(new ProgressDto()
{
PageNum = 1,
ChapterId = 3,
@@ -2022,7 +1870,7 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var nextChapter = await readerService.GetContinuePoint(1, 1);
+ var nextChapter = await _readerService.GetContinuePoint(1, 1);
Assert.Equal("Some Special Title", nextChapter.Range);
}
@@ -2031,33 +1879,24 @@ public class ReaderServiceTests
public async Task GetContinuePoint_ShouldReturnFirstVolumeChapter_WhenPreExistingProgress()
{
await ResetDb();
- var series = new Series()
- {
- Name = "Test",
- Library = new Library()
- {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("230", false, new List<MangaFile>(), 1),
- //EntityFactory.CreateChapter("231", false, new List<MangaFile>(), 1), (added later)
- }),
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("2", false, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("2", new List<Chapter>()
- {
- EntityFactory.CreateChapter("0", false, new List<MangaFile>(), 1),
- //EntityFactory.CreateChapter("14.9", false, new List<MangaFile>(), 1), (added later)
- }),
- }
- };
+ var series = new SeriesBuilder("Test")
+
+ .WithVolume(new VolumeBuilder("0")
+ .WithChapter(new ChapterBuilder("230").WithPages(1).Build())
+ //.WithChapter(new ChapterBuilder("231").WithPages(1).Build()) (Added later)
+ .Build())
+
+ .WithVolume(new VolumeBuilder("1")
+ .WithChapter(new ChapterBuilder("1").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("2").WithPages(1).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("2")
+ .WithChapter(new ChapterBuilder("0").WithPages(1).Build())
+ //.WithChapter(new ChapterBuilder("14.9").WithPages(1).Build()) (added later)
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+
_context.Series.Add(series);
_context.AppUser.Add(new AppUser()
@@ -2068,19 +1907,23 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
+
var user = await _unitOfWork.UserRepository.GetUserByIdAsync(1, AppUserIncludes.Progress);
- await readerService.MarkSeriesAsRead(user, 1);
+ await _readerService.MarkSeriesAsRead(user, 1);
await _context.SaveChangesAsync();
// Add 2 new unread series to the Series
- series.Volumes[0].Chapters.Add(EntityFactory.CreateChapter("231", false, new List<MangaFile>(), 1));
- series.Volumes[2].Chapters.Add(EntityFactory.CreateChapter("14.9", false, new List<MangaFile>(), 1));
+ series.Volumes[0].Chapters.Add(new ChapterBuilder("231")
+ .WithPages(1)
+ .Build());
+ series.Volumes[2].Chapters.Add(new ChapterBuilder("14.9")
+ .WithPages(1)
+ .Build());
_context.Series.Attach(series);
await _context.SaveChangesAsync();
// This tests that if you add a series later to a volume and a loose leaf chapter, we continue from that volume, rather than loose leaf
- var nextChapter = await readerService.GetContinuePoint(1, 1);
+ var nextChapter = await _readerService.GetContinuePoint(1, 1);
Assert.Equal("14.9", nextChapter.Range);
}
@@ -2088,50 +1931,36 @@ public class ReaderServiceTests
public async Task GetContinuePoint_ShouldReturnUnreadSingleVolume_WhenThereAreSomeSingleVolumesBeforeLooseLeafChapters()
{
await ResetDb();
- var readChapter1 = EntityFactory.CreateChapter("0", false, new List<MangaFile>(), 1);
- var readChapter2 = EntityFactory.CreateChapter("0", false, new List<MangaFile>(), 1);
+ var readChapter1 = new ChapterBuilder("0").WithPages(1).Build();
+ var readChapter2 = new ChapterBuilder("0").WithPages(1).Build();
+ var volume = new VolumeBuilder("3").WithChapter(new ChapterBuilder("0").WithPages(1).Build()).Build();
+
+ var series = new SeriesBuilder("Test")
+
+ .WithVolume(new VolumeBuilder("0")
+ .WithChapter(new ChapterBuilder("51").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("52").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("53").WithPages(1).Build())
+ .Build())
+
+ .WithVolume(new VolumeBuilder("1")
+ .WithChapter(readChapter1)
+ .Build())
+ .WithVolume(new VolumeBuilder("2")
+ .WithChapter(readChapter2)
+ .Build())
+ // 3, 4, and all loose leafs are unread should be unread
+ .WithVolume(new VolumeBuilder("3")
+ .WithChapter(new ChapterBuilder("0").WithPages(1).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("4")
+ .WithChapter(new ChapterBuilder("40").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("41").WithPages(1).Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
- var volume = EntityFactory.CreateVolume("3", new List<Chapter>()
- {
- EntityFactory.CreateChapter("0", false, new List<MangaFile>(), 1),
- });
-
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("51", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("52", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("53", false, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- readChapter1
- }),
- EntityFactory.CreateVolume("2", new List<Chapter>()
- {
- readChapter2
- }),
- volume,
- // 3, 4, and all loose leafs are unread should be unread
- EntityFactory.CreateVolume("3", new List<Chapter>()
- {
- EntityFactory.CreateChapter("0", false, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("4", new List<Chapter>()
- {
- EntityFactory.CreateChapter("40", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("41", false, new List<MangaFile>(), 1),
- }),
- }
- });
+ _context.Series.Add(series);
_context.AppUser.Add(new AppUser()
@@ -2141,18 +1970,18 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
+
// Save progress on first volume chapters and 1st of second volume
var user = await _unitOfWork.UserRepository.GetUserByIdAsync(1, AppUserIncludes.Progress);
- await readerService.MarkChaptersAsRead(user, 1,
+ await _readerService.MarkChaptersAsRead(user, 1,
new List<Chapter>()
{
readChapter1, readChapter2
});
await _context.SaveChangesAsync();
- var nextChapter = await readerService.GetContinuePoint(1, 1);
+ var nextChapter = await _readerService.GetContinuePoint(1, 1);
Assert.Equal(4, nextChapter.VolumeId);
}
@@ -2165,24 +1994,18 @@ public class ReaderServiceTests
public async Task MarkChaptersUntilAsRead_ShouldMarkAllChaptersAsRead()
{
await ResetDb();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("2", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("3", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("Some Special Title", true, new List<MangaFile>(), 1),
- }),
- }
- });
+ var series = new SeriesBuilder("Test")
+
+ .WithVolume(new VolumeBuilder("0")
+ .WithChapter(new ChapterBuilder("1").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("2").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("3").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("Some Special Title").WithIsSpecial(true).WithPages(1).Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+
+ _context.Series.Add(series);
_context.AppUser.Add(new AppUser()
{
@@ -2191,10 +2014,10 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
+
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync("majora2007", AppUserIncludes.Progress);
- await readerService.MarkChaptersUntilAsRead(user, 1, 5);
+ await _readerService.MarkChaptersUntilAsRead(user, 1, 5);
await _context.SaveChangesAsync();
// Validate correct chapters have read status
@@ -2208,25 +2031,19 @@ public class ReaderServiceTests
public async Task MarkChaptersUntilAsRead_ShouldMarkUptTillChapterNumberAsRead()
{
await ResetDb();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("2", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("2.5", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("3", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("Some Special Title", true, new List<MangaFile>(), 1),
- }),
- }
- });
+ var series = new SeriesBuilder("Test")
+
+ .WithVolume(new VolumeBuilder("0")
+ .WithChapter(new ChapterBuilder("1").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("2").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("2.5").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("3").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("Some Special Title").WithIsSpecial(true).WithPages(1).Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+
+ _context.Series.Add(series);
_context.AppUser.Add(new AppUser()
{
@@ -2235,10 +2052,10 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
+
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync("majora2007", AppUserIncludes.Progress);
- await readerService.MarkChaptersUntilAsRead(user, 1, 2.5f);
+ await _readerService.MarkChaptersUntilAsRead(user, 1, 2.5f);
await _context.SaveChangesAsync();
// Validate correct chapters have read status
@@ -2253,25 +2070,18 @@ public class ReaderServiceTests
public async Task MarkChaptersUntilAsRead_ShouldMarkAsRead_OnlyVolumesWithChapter0()
{
await ResetDb();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("0", false, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("2", new List<Chapter>()
- {
- EntityFactory.CreateChapter("0", false, new List<MangaFile>(), 1),
- }),
- }
- });
+ var series = new SeriesBuilder("Test")
+
+ .WithVolume(new VolumeBuilder("1")
+ .WithChapter(new ChapterBuilder("0").WithPages(1).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("2")
+ .WithChapter(new ChapterBuilder("0").WithPages(1).Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+
+ _context.Series.Add(series);
_context.AppUser.Add(new AppUser()
{
@@ -2280,10 +2090,10 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
+
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync("majora2007", AppUserIncludes.Progress);
- await readerService.MarkChaptersUntilAsRead(user, 1, 2);
+ await _readerService.MarkChaptersUntilAsRead(user, 1, 2);
await _context.SaveChangesAsync();
// Validate correct chapters have read status
@@ -2294,43 +2104,33 @@ public class ReaderServiceTests
public async Task MarkChaptersUntilAsRead_ShouldMarkAsReadAnythingUntil()
{
await ResetDb();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library()
- {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("45", false, new List<MangaFile>(), 5),
-
- EntityFactory.CreateChapter("46", false, new List<MangaFile>(), 46),
- EntityFactory.CreateChapter("47", false, new List<MangaFile>(), 47),
- EntityFactory.CreateChapter("48", false, new List<MangaFile>(), 48),
- EntityFactory.CreateChapter("49", false, new List<MangaFile>(), 49),
- EntityFactory.CreateChapter("50", false, new List<MangaFile>(), 50),
- EntityFactory.CreateChapter("Some Special Title", true, new List<MangaFile>(), 10),
- }),
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("0", false, new List<MangaFile>(), 6),
- }),
- EntityFactory.CreateVolume("2", new List<Chapter>()
- {
- EntityFactory.CreateChapter("0", false, new List<MangaFile>(), 7),
- }),
- EntityFactory.CreateVolume("3", new List<Chapter>()
- {
- EntityFactory.CreateChapter("12", false, new List<MangaFile>(), 5),
- EntityFactory.CreateChapter("13", false, new List<MangaFile>(), 5),
- EntityFactory.CreateChapter("14", false, new List<MangaFile>(), 5),
- }),
- }
- });
+ var series = new SeriesBuilder("Test")
+
+ .WithVolume(new VolumeBuilder("0")
+ .WithChapter(new ChapterBuilder("45").WithPages(5).Build())
+ .WithChapter(new ChapterBuilder("46").WithPages(46).Build())
+ .WithChapter(new ChapterBuilder("47").WithPages(47).Build())
+ .WithChapter(new ChapterBuilder("48").WithPages(48).Build())
+ .WithChapter(new ChapterBuilder("49").WithPages(49).Build())
+ .WithChapter(new ChapterBuilder("50").WithPages(50).Build())
+ .WithChapter(new ChapterBuilder("Some Special Title").WithIsSpecial(true).WithPages(10).Build())
+ .Build())
+
+ .WithVolume(new VolumeBuilder("1")
+ .WithChapter(new ChapterBuilder("0").WithPages(6).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("2")
+ .WithChapter(new ChapterBuilder("0").WithPages(7).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("3")
+ .WithChapter(new ChapterBuilder("12").WithPages(5).Build())
+ .WithChapter(new ChapterBuilder("13").WithPages(5).Build())
+ .WithChapter(new ChapterBuilder("14").WithPages(5).Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+
+ _context.Series.Add(series);
_context.AppUser.Add(new AppUser()
{
@@ -2339,12 +2139,12 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
+
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync("majora2007", AppUserIncludes.Progress);
const int markReadUntilNumber = 47;
- await readerService.MarkChaptersUntilAsRead(user, 1, markReadUntilNumber);
+ await _readerService.MarkChaptersUntilAsRead(user, 1, markReadUntilNumber);
await _context.SaveChangesAsync();
var volumes = await _unitOfWork.VolumeRepository.GetVolumesDtoAsync(1, 1);
@@ -2370,46 +2170,21 @@ public class ReaderServiceTests
public async Task MarkSeriesAsReadTest()
{
await ResetDb();
+ // TODO: Validate this is correct, shouldn't be possible to have 2 Volume 0's in a series
+ var series = new SeriesBuilder("Test")
+
+ .WithVolume(new VolumeBuilder("0")
+ .WithChapter(new ChapterBuilder("0").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("1").WithPages(2).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("0")
+ .WithChapter(new ChapterBuilder("0").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("1").WithPages(2).Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- new Volume()
- {
- Chapters = new List<Chapter>()
- {
- new Chapter()
- {
- Pages = 1
- },
- new Chapter()
- {
- Pages = 2
- }
- }
- },
- new Volume()
- {
- Chapters = new List<Chapter>()
- {
- new Chapter()
- {
- Pages = 1
- },
- new Chapter()
- {
- Pages = 2
- }
- }
- }
- }
- });
+ _context.Series.Add(series);
_context.AppUser.Add(new AppUser()
{
@@ -2418,9 +2193,9 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
- await readerService.MarkSeriesAsRead(await _unitOfWork.UserRepository.GetUserByIdAsync(1, AppUserIncludes.Progress), 1);
+
+ await _readerService.MarkSeriesAsRead(await _unitOfWork.UserRepository.GetUserByIdAsync(1, AppUserIncludes.Progress), 1);
await _context.SaveChangesAsync();
Assert.Equal(4, (await _unitOfWork.UserRepository.GetUserByIdAsync(1, AppUserIncludes.Progress)).Progresses.Count);
@@ -2435,32 +2210,16 @@ public class ReaderServiceTests
public async Task MarkSeriesAsUnreadTest()
{
await ResetDb();
+ var series = new SeriesBuilder("Test")
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- new Volume()
- {
- Chapters = new List<Chapter>()
- {
- new Chapter()
- {
- Pages = 1
- },
- new Chapter()
- {
- Pages = 2
- }
- }
- }
- }
- });
+ .WithVolume(new VolumeBuilder("0")
+ .WithChapter(new ChapterBuilder("0").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("1").WithPages(2).Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
+
+ _context.Series.Add(series);
_context.AppUser.Add(new AppUser()
{
@@ -2469,15 +2228,15 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
+
var volumes = (await _unitOfWork.VolumeRepository.GetVolumes(1)).ToList();
- await readerService.MarkChaptersAsRead(await _unitOfWork.UserRepository.GetUserByIdAsync(1, AppUserIncludes.Progress), 1, volumes.First().Chapters);
+ await _readerService.MarkChaptersAsRead(await _unitOfWork.UserRepository.GetUserByIdAsync(1, AppUserIncludes.Progress), 1, volumes.First().Chapters);
await _context.SaveChangesAsync();
Assert.Equal(2, (await _unitOfWork.UserRepository.GetUserByIdAsync(1, AppUserIncludes.Progress)).Progresses.Count);
- await readerService.MarkSeriesAsUnread(await _unitOfWork.UserRepository.GetUserByIdAsync(1, AppUserIncludes.Progress), 1);
+ await _readerService.MarkSeriesAsUnread(await _unitOfWork.UserRepository.GetUserByIdAsync(1, AppUserIncludes.Progress), 1);
await _context.SaveChangesAsync();
var progresses = (await _unitOfWork.UserRepository.GetUserByIdAsync(1, AppUserIncludes.Progress)).Progresses;
@@ -2524,38 +2283,29 @@ public class ReaderServiceTests
public async Task MarkVolumesUntilAsRead_ShouldMarkVolumesAsRead()
{
await ResetDb();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
+ var series = new SeriesBuilder("Test")
+
+ .WithVolume(new VolumeBuilder("0")
+ .WithChapter(new ChapterBuilder("10").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("20").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("30").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("Some Special Title").WithIsSpecial(true).WithPages(1).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("1997")
+ .WithChapter(new ChapterBuilder("0").WithPages(1).Build())
+ .Build())
+
+ .WithVolume(new VolumeBuilder("2002")
+ .WithChapter(new ChapterBuilder("0").WithPages(1).Build())
+ .Build())
+
+ .WithVolume(new VolumeBuilder("2003")
+ .WithChapter(new ChapterBuilder("0").WithPages(1).Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
- {
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("10", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("20", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("30", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("Some Special Title", true, new List<MangaFile>(), 1),
- }),
-
- EntityFactory.CreateVolume("1997", new List<Chapter>()
- {
- EntityFactory.CreateChapter("0", false, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("2002", new List<Chapter>()
- {
- EntityFactory.CreateChapter("0", false, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("2003", new List<Chapter>()
- {
- EntityFactory.CreateChapter("0", false, new List<MangaFile>(), 1),
- }),
- }
- });
+ _context.Series.Add(series);
_context.AppUser.Add(new AppUser()
{
@@ -2564,10 +2314,10 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
+
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync("majora2007", AppUserIncludes.Progress);
- await readerService.MarkVolumesUntilAsRead(user, 1, 2002);
+ await _readerService.MarkVolumesUntilAsRead(user, 1, 2002);
await _context.SaveChangesAsync();
// Validate loose leaf chapters don't get marked as read
@@ -2587,38 +2337,28 @@ public class ReaderServiceTests
public async Task MarkVolumesUntilAsRead_ShouldMarkChapterBasedVolumesAsRead()
{
await ResetDb();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("0")
+ .WithChapter(new ChapterBuilder("10").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("20").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("30").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("Some Special Title").WithIsSpecial(true).WithPages(1).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("1997")
+ .WithChapter(new ChapterBuilder("1").WithPages(1).Build())
+ .Build())
+
+ .WithVolume(new VolumeBuilder("2002")
+ .WithChapter(new ChapterBuilder("2").WithPages(1).Build())
+ .Build())
+
+ .WithVolume(new VolumeBuilder("2003")
+ .WithChapter(new ChapterBuilder("3").WithPages(1).Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Manga).Build();
- {
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("10", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("20", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("30", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("Some Special Title", true, new List<MangaFile>(), 1),
- }),
-
- EntityFactory.CreateVolume("1997", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("2002", new List<Chapter>()
- {
- EntityFactory.CreateChapter("2", false, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("2003", new List<Chapter>()
- {
- EntityFactory.CreateChapter("3", false, new List<MangaFile>(), 1),
- }),
- }
- });
+ _context.Series.Add(series);
_context.AppUser.Add(new AppUser()
{
@@ -2627,10 +2367,10 @@ public class ReaderServiceTests
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
+
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync("majora2007", AppUserIncludes.Progress);
- await readerService.MarkVolumesUntilAsRead(user, 1, 2002);
+ await _readerService.MarkVolumesUntilAsRead(user, 1, 2002);
await _context.SaveChangesAsync();
// Validate loose leaf chapters don't get marked as read
@@ -2670,9 +2410,9 @@ public class ReaderServiceTests
new [] {"0,0", "1,1", "2,1", "3,3", "4,3", "5,5", "6,6", "7,6", "8,8", "9,9"})]
public void GetPairs_ShouldReturnPairsForNoWideImages(string caseName, IList<bool> wides, IList<string> expectedPairs)
{
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
+
var files = wides.Select((b, i) => new FileDimensionDto() {PageNumber = i, Height = 1, Width = 1, FileName = string.Empty, IsWide = b}).ToList();
- var pairs = readerService.GetPairs(files);
+ var pairs = _readerService.GetPairs(files);
var expectedDict = new Dictionary<int, int>();
foreach (var pair in expectedPairs)
{
diff --git a/API.Tests/Services/ReadingListServiceTests.cs b/API.Tests/Services/ReadingListServiceTests.cs
index 817890885..dbfe1129d 100644
--- a/API.Tests/Services/ReadingListServiceTests.cs
+++ b/API.Tests/Services/ReadingListServiceTests.cs
@@ -11,8 +11,12 @@ using API.DTOs.ReadingLists;
using API.DTOs.ReadingLists.CBL;
using API.Entities;
using API.Entities.Enums;
+using API.Entities.Metadata;
+using API.Extensions;
using API.Helpers;
+using API.Helpers.Builders;
using API.Services;
+using API.Services.Tasks;
using API.SignalR;
using API.Tests.Helpers;
using AutoMapper;
@@ -29,6 +33,7 @@ public class ReadingListServiceTests
private readonly IUnitOfWork _unitOfWork;
private readonly IReadingListService _readingListService;
private readonly DataContext _context;
+ private readonly IReaderService _readerService;
private const string CacheDirectory = "C:/kavita/config/cache/";
private const string CoverImageDirectory = "C:/kavita/config/covers/";
@@ -44,9 +49,13 @@ public class ReadingListServiceTests
var config = new MapperConfiguration(cfg => cfg.AddProfile<AutoMapperProfiles>());
var mapper = config.CreateMapper();
- _unitOfWork = new UnitOfWork(_context, mapper, null);
+ _unitOfWork = new UnitOfWork(_context, mapper, null!);
_readingListService = new ReadingListService(_unitOfWork, Substitute.For<ILogger<ReadingListService>>(), Substitute.For<IEventHub>());
+
+ _readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(),
+ Substitute.For<IEventHub>(), Substitute.For<IImageService>(),
+ new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), new MockFileSystem()));
}
#region Setup
@@ -76,10 +85,10 @@ public class ReadingListServiceTests
_context.ServerSetting.Update(setting);
- _context.Library.Add(new Library()
- {
- Name = "Manga", Folders = new List<FolderPath>() {new FolderPath() {Path = "C:/data/"}}
- });
+ _context.Library.Add(new LibraryBuilder("Manga")
+ .WithFolderPath(new FolderPathBuilder("C:/data/").Build())
+ .Build());
+
return await _context.SaveChangesAsync() > 0;
}
@@ -112,58 +121,38 @@ public class ReadingListServiceTests
public async Task AddChaptersToReadingList_ShouldAddFirstItem_AsOrderZero()
{
await ResetDb();
- _context.AppUser.Add(new AppUser()
- {
- UserName = "majora2007",
- ReadingLists = new List<ReadingList>(),
- Libraries = new List<Library>()
- {
- new Library()
- {
- Name = "Test LIb",
- Type = LibraryType.Book,
- Series = new List<Series>()
+ _context.AppUser.Add(new AppUserBuilder("majora2007", "")
+ .WithLibrary(new LibraryBuilder("Test LIb", LibraryType.Book)
+ .WithSeries(new SeriesBuilder("Test")
+ .WithMetadata(new SeriesMetadataBuilder().Build())
+ .WithVolumes(new List<Volume>()
{
- new Series()
- {
- Name = "Test",
- Metadata = DbFactory.SeriesMetadata(new List<CollectionTag>()),
- Volumes = new List<Volume>()
- {
- new Volume()
- {
- Name = "0",
- Chapters = new List<Chapter>()
- {
- new Chapter()
- {
- Number = "1",
- AgeRating = AgeRating.Everyone,
- },
- new Chapter()
- {
- Number = "2",
- AgeRating = AgeRating.X18Plus
- },
- new Chapter()
- {
- Number = "3",
- AgeRating = AgeRating.X18Plus
- }
- }
- }
- }
- }
- }
- },
- }
- });
+ new VolumeBuilder("0")
+ .WithChapter(new ChapterBuilder("1")
+ .WithAgeRating(AgeRating.Everyone)
+ .Build()
+ )
+ .WithChapter(new ChapterBuilder("2")
+ .WithAgeRating(AgeRating.X18Plus)
+ .Build()
+ )
+ .WithChapter(new ChapterBuilder("3")
+ .WithAgeRating(AgeRating.X18Plus)
+ .Build()
+ )
+ .Build()
+ })
+ .Build())
+ .Build()
+ )
+ .Build()
+ );
await _context.SaveChangesAsync();
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync("majora2007", AppUserIncludes.ReadingLists);
- var readingList = new ReadingList();
- user.ReadingLists = new List<ReadingList>()
+ var readingList = new ReadingListBuilder("test").Build();
+ user!.ReadingLists = new List<ReadingList>()
{
readingList
};
@@ -179,58 +168,37 @@ public class ReadingListServiceTests
public async Task AddChaptersToReadingList_ShouldNewItems_AfterLastOrder()
{
await ResetDb();
- _context.AppUser.Add(new AppUser()
- {
- UserName = "majora2007",
- ReadingLists = new List<ReadingList>(),
- Libraries = new List<Library>()
- {
- new Library()
- {
- Name = "Test LIb",
- Type = LibraryType.Book,
- Series = new List<Series>()
+ _context.AppUser.Add(new AppUserBuilder("majora2007", "")
+ .WithLibrary(new LibraryBuilder("Test LIb", LibraryType.Book)
+ .WithSeries(new SeriesBuilder("Test")
+ .WithVolumes(new List<Volume>()
{
- new Series()
- {
- Name = "Test",
- Metadata = DbFactory.SeriesMetadata(new List<CollectionTag>()),
- Volumes = new List<Volume>()
- {
- new Volume()
- {
- Name = "0",
- Chapters = new List<Chapter>()
- {
- new Chapter()
- {
- Number = "1",
- AgeRating = AgeRating.Everyone,
- },
- new Chapter()
- {
- Number = "2",
- AgeRating = AgeRating.X18Plus
- },
- new Chapter()
- {
- Number = "3",
- AgeRating = AgeRating.X18Plus
- }
- }
- }
- }
- }
- }
- },
- }
- });
+ new VolumeBuilder("0")
+ .WithChapter(new ChapterBuilder("1")
+ .WithAgeRating(AgeRating.Everyone)
+ .Build()
+ )
+ .WithChapter(new ChapterBuilder("2")
+ .WithAgeRating(AgeRating.X18Plus)
+ .Build()
+ )
+ .WithChapter(new ChapterBuilder("3")
+ .WithAgeRating(AgeRating.X18Plus)
+ .Build()
+ )
+ .Build()
+ })
+ .Build())
+ .Build()
+ )
+ .Build()
+ );
await _context.SaveChangesAsync();
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync("majora2007", AppUserIncludes.ReadingLists);
- var readingList = new ReadingList();
- user.ReadingLists = new List<ReadingList>()
+ var readingList = new ReadingListBuilder("test").Build();
+ user!.ReadingLists = new List<ReadingList>()
{
readingList
};
@@ -259,51 +227,35 @@ public class ReadingListServiceTests
ReadingLists = new List<ReadingList>(),
Libraries = new List<Library>()
{
- new Library()
- {
- Name = "Test LIb",
- Type = LibraryType.Book,
- Series = new List<Series>()
- {
- new Series()
+ new LibraryBuilder("Test LIb", LibraryType.Book)
+ .WithSeries(new SeriesBuilder("Test")
+ .WithMetadata(new SeriesMetadataBuilder().Build())
+ .WithVolumes(new List<Volume>()
{
- Name = "Test",
- Metadata = DbFactory.SeriesMetadata(new List<CollectionTag>()),
- Volumes = new List<Volume>()
- {
- new Volume()
- {
- Name = "0",
- Chapters = new List<Chapter>()
- {
- new Chapter()
- {
- Number = "1",
- AgeRating = AgeRating.Everyone,
- },
- new Chapter()
- {
- Number = "2",
- AgeRating = AgeRating.X18Plus
- },
- new Chapter()
- {
- Number = "3",
- AgeRating = AgeRating.X18Plus
- }
- }
- }
- }
- }
- }
- },
+ new VolumeBuilder("0")
+ .WithChapter(new ChapterBuilder("1")
+ .WithAgeRating(AgeRating.Everyone)
+ .Build()
+ )
+ .WithChapter(new ChapterBuilder("2")
+ .WithAgeRating(AgeRating.X18Plus)
+ .Build()
+ )
+ .WithChapter(new ChapterBuilder("3")
+ .WithAgeRating(AgeRating.X18Plus)
+ .Build()
+ )
+ .Build()
+ })
+ .Build())
+ .Build()
}
});
await _context.SaveChangesAsync();
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync("majora2007", AppUserIncludes.ReadingLists);
- var readingList = new ReadingList();
+ var readingList = new ReadingListBuilder("test").Build();
user.ReadingLists = new List<ReadingList>()
{
readingList
@@ -335,52 +287,36 @@ public class ReadingListServiceTests
ReadingLists = new List<ReadingList>(),
Libraries = new List<Library>()
{
- new Library()
- {
- Name = "Test LIb",
- Type = LibraryType.Book,
- Series = new List<Series>()
- {
- new Series()
+ new LibraryBuilder("Test LIb", LibraryType.Book)
+ .WithSeries(new SeriesBuilder("Test")
+ .WithMetadata(new SeriesMetadataBuilder().Build())
+ .WithVolumes(new List<Volume>()
{
- Name = "Test",
- Metadata = DbFactory.SeriesMetadata(new List<CollectionTag>()),
- Volumes = new List<Volume>()
- {
- new Volume()
- {
- Name = "0",
- Chapters = new List<Chapter>()
- {
- new Chapter()
- {
- Number = "1",
- AgeRating = AgeRating.Everyone,
- },
- new Chapter()
- {
- Number = "2",
- AgeRating = AgeRating.X18Plus
- },
- new Chapter()
- {
- Number = "3",
- AgeRating = AgeRating.X18Plus
- }
- }
- }
- }
- }
- }
- },
+ new VolumeBuilder("0")
+ .WithChapter(new ChapterBuilder("1")
+ .WithAgeRating(AgeRating.Everyone)
+ .Build()
+ )
+ .WithChapter(new ChapterBuilder("2")
+ .WithAgeRating(AgeRating.X18Plus)
+ .Build()
+ )
+ .WithChapter(new ChapterBuilder("3")
+ .WithAgeRating(AgeRating.X18Plus)
+ .Build()
+ )
+ .Build()
+ })
+ .Build())
+ .Build()
}
});
await _context.SaveChangesAsync();
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync("majora2007", AppUserIncludes.ReadingLists);
- var readingList = new ReadingList();
- user.ReadingLists = new List<ReadingList>()
+ var readingList = new ReadingListBuilder("test").Build();
+ user!.ReadingLists = new List<ReadingList>()
{
readingList
};
@@ -430,46 +366,31 @@ public class ReadingListServiceTests
ReadingLists = new List<ReadingList>(),
Libraries = new List<Library>()
{
- new Library()
- {
- Name = "Test LIb",
- Type = LibraryType.Book,
- Series = new List<Series>()
- {
- new Series()
+ new LibraryBuilder("Test LIb", LibraryType.Book)
+ .WithSeries(new SeriesBuilder("Test")
+ .WithMetadata(new SeriesMetadataBuilder().Build())
+ .WithVolumes(new List<Volume>()
{
- Name = "Test",
- Metadata = DbFactory.SeriesMetadata(new List<CollectionTag>()),
- Volumes = new List<Volume>()
- {
- new Volume()
- {
- Name = "0",
- Chapters = new List<Chapter>()
- {
- new Chapter()
- {
- Number = "1",
- AgeRating = AgeRating.Everyone
- },
- new Chapter()
- {
- Number = "2",
- AgeRating = AgeRating.X18Plus
- }
- }
- }
- }
- }
- }
- },
+ new VolumeBuilder("0")
+ .WithChapter(new ChapterBuilder("1")
+ .WithAgeRating(AgeRating.Everyone)
+ .Build()
+ )
+ .WithChapter(new ChapterBuilder("2")
+ .WithAgeRating(AgeRating.X18Plus)
+ .Build()
+ )
+ .Build()
+ })
+ .Build())
+ .Build()
}
});
await _context.SaveChangesAsync();
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync("majora2007", AppUserIncludes.ReadingLists);
- var readingList = new ReadingList();
+ var readingList = new ReadingListBuilder("test").Build();
user.ReadingLists = new List<ReadingList>()
{
readingList
@@ -502,54 +423,35 @@ public class ReadingListServiceTests
ReadingLists = new List<ReadingList>(),
Libraries = new List<Library>()
{
- new Library()
- {
- Name = "Test LIb",
- Type = LibraryType.Book,
- Series = new List<Series>()
- {
- new Series()
+ new LibraryBuilder("Test LIb", LibraryType.Book)
+ .WithSeries(new SeriesBuilder("Test")
+ .WithMetadata(new SeriesMetadataBuilder().Build())
+ .WithVolumes(new List<Volume>()
{
- Name = "Test",
- Metadata = DbFactory.SeriesMetadata(new List<CollectionTag>()),
- Volumes = new List<Volume>()
- {
- new Volume()
- {
- Name = "0",
- Chapters = new List<Chapter>()
- {
- new Chapter()
- {
- Number = "1",
- AgeRating = AgeRating.Everyone,
- Pages = 1
- },
- new Chapter()
- {
- Number = "2",
- AgeRating = AgeRating.X18Plus,
- Pages = 1
- },
- new Chapter()
- {
- Number = "3",
- AgeRating = AgeRating.X18Plus,
- Pages = 1
- }
- }
- }
- }
- }
- }
- },
+ new VolumeBuilder("0")
+ .WithChapter(new ChapterBuilder("1")
+ .WithAgeRating(AgeRating.Everyone)
+ .Build()
+ )
+ .WithChapter(new ChapterBuilder("2")
+ .WithAgeRating(AgeRating.X18Plus)
+ .Build()
+ )
+ .WithChapter(new ChapterBuilder("3")
+ .WithAgeRating(AgeRating.X18Plus)
+ .Build()
+ )
+ .Build()
+ })
+ .Build())
+ .Build()
}
});
await _context.SaveChangesAsync();
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync("majora2007", AppUserIncludes.ReadingLists | AppUserIncludes.Progress);
- var readingList = new ReadingList();
+ var readingList = new ReadingListBuilder("test").Build();
user.ReadingLists = new List<ReadingList>()
{
readingList
@@ -559,10 +461,8 @@ public class ReadingListServiceTests
await _unitOfWork.CommitAsync();
Assert.Equal(3, readingList.Items.Count);
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(),
- Substitute.For<IEventHub>());
// Mark 2 as fully read
- await readerService.MarkChaptersAsRead(user, 1,
+ await _readerService.MarkChaptersAsRead(user, 1,
(await _unitOfWork.ChapterRepository.GetChaptersByIdsAsync(new List<int>() {2})).ToList());
await _unitOfWork.CommitAsync();
@@ -588,45 +488,30 @@ public class ReadingListServiceTests
ReadingLists = new List<ReadingList>(),
Libraries = new List<Library>()
{
- new Library()
- {
- Name = "Test LIb",
- Type = LibraryType.Book,
- Series = new List<Series>()
- {
- new Series()
+ new LibraryBuilder("Test LIb", LibraryType.Book)
+ .WithSeries(new SeriesBuilder("Test")
+ .WithMetadata(new SeriesMetadataBuilder().Build())
+ .WithVolumes(new List<Volume>()
{
- Name = "Test",
- Metadata = DbFactory.SeriesMetadata(new List<CollectionTag>()),
- Volumes = new List<Volume>()
- {
- new Volume()
- {
- Name = "0",
- Chapters = new List<Chapter>()
- {
- new Chapter()
- {
- Number = "1",
- },
- new Chapter()
- {
- Number = "2",
- }
- }
- }
- }
- }
- }
- },
+ new VolumeBuilder("0")
+ .WithChapter(new ChapterBuilder("1")
+ .Build()
+ )
+ .WithChapter(new ChapterBuilder("2")
+ .Build()
+ )
+ .Build()
+ })
+ .Build())
+ .Build()
}
});
await _context.SaveChangesAsync();
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync("majora2007", AppUserIncludes.ReadingLists);
- var readingList = new ReadingList();
- user.ReadingLists = new List<ReadingList>()
+ var readingList = new ReadingListBuilder("test").Build();
+ user!.ReadingLists = new List<ReadingList>()
{
readingList
};
@@ -645,44 +530,29 @@ public class ReadingListServiceTests
public async Task CalculateAgeRating_ShouldUpdateToMax()
{
await ResetDb();
- var s = new Series()
- {
- Name = "Test",
- Metadata = DbFactory.SeriesMetadata(new List<CollectionTag>()),
- Volumes = new List<Volume>()
+ var s = new SeriesBuilder("Test")
+ .WithMetadata(new SeriesMetadataBuilder().Build())
+ .WithVolumes(new List<Volume>()
{
- new Volume()
- {
- Name = "0",
- Chapters = new List<Chapter>()
- {
- new Chapter()
- {
- Number = "1",
- },
- new Chapter()
- {
- Number = "2",
- }
- }
- }
- }
- };
+ new VolumeBuilder("0")
+ .WithChapter(new ChapterBuilder("1")
+ .Build()
+ )
+ .WithChapter(new ChapterBuilder("2")
+ .Build()
+ )
+ .Build()
+ })
+ .Build();
_context.AppUser.Add(new AppUser()
{
UserName = "majora2007",
ReadingLists = new List<ReadingList>(),
Libraries = new List<Library>()
{
- new Library()
- {
- Name = "Test LIb",
- Type = LibraryType.Book,
- Series = new List<Series>()
- {
- s
- }
- },
+ new LibraryBuilder("Test LIb 2", LibraryType.Book)
+ .WithSeries(s)
+ .Build()
}
});
@@ -691,7 +561,7 @@ public class ReadingListServiceTests
await _context.SaveChangesAsync();
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync("majora2007", AppUserIncludes.ReadingLists);
- var readingList = new ReadingList();
+ var readingList = new ReadingListBuilder("test").Build();
user.ReadingLists = new List<ReadingList>()
{
readingList
@@ -709,6 +579,116 @@ public class ReadingListServiceTests
#endregion
+ #region CalculateStartAndEndDates
+
+ [Fact]
+ public async Task CalculateStartAndEndDates_ShouldBeNothing_IfNothing()
+ {
+ await ResetDb();
+ var s = new SeriesBuilder("Test")
+ .WithMetadata(new SeriesMetadataBuilder().Build())
+ .WithVolumes(new List<Volume>()
+ {
+ new VolumeBuilder("0")
+ .WithChapter(new ChapterBuilder("1")
+ .Build()
+ )
+ .WithChapter(new ChapterBuilder("2")
+ .Build()
+ )
+ .Build()
+ })
+ .Build();
+ _context.AppUser.Add(new AppUser()
+ {
+ UserName = "majora2007",
+ ReadingLists = new List<ReadingList>(),
+ Libraries = new List<Library>()
+ {
+ new LibraryBuilder("Test LIb 2", LibraryType.Book)
+ .WithSeries(s)
+ .Build()
+ }
+ });
+
+ await _context.SaveChangesAsync();
+
+ var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync("majora2007", AppUserIncludes.ReadingLists);
+ var readingList = new ReadingListBuilder("test").Build();
+ user.ReadingLists = new List<ReadingList>()
+ {
+ readingList
+ };
+
+ await _readingListService.AddChaptersToReadingList(1, new List<int>() {1, 2}, readingList);
+
+
+ _unitOfWork.UserRepository.Update(user);
+ await _unitOfWork.CommitAsync();
+
+ await _readingListService.CalculateStartAndEndDates(readingList);
+ Assert.Equal(0, readingList.StartingMonth);
+ Assert.Equal(0, readingList.StartingYear);
+ Assert.Equal(0, readingList.EndingMonth);
+ Assert.Equal(0, readingList.EndingYear);
+ }
+
+ [Fact]
+ public async Task CalculateStartAndEndDates_ShouldBeSomething_IfChapterHasSet()
+ {
+ await ResetDb();
+ var s = new SeriesBuilder("Test")
+ .WithMetadata(new SeriesMetadataBuilder().Build())
+ .WithVolumes(new List<Volume>()
+ {
+ new VolumeBuilder("0")
+ .WithChapter(new ChapterBuilder("1")
+ .WithReleaseDate(new DateTime(2005, 03, 01))
+ .Build()
+ )
+ .WithChapter(new ChapterBuilder("2")
+ .WithReleaseDate(new DateTime(2002, 03, 01))
+ .Build()
+ )
+ .Build()
+ })
+ .Build();
+ _context.AppUser.Add(new AppUser()
+ {
+ UserName = "majora2007",
+ ReadingLists = new List<ReadingList>(),
+ Libraries = new List<Library>()
+ {
+ new LibraryBuilder("Test LIb 2", LibraryType.Book)
+ .WithSeries(s)
+ .Build()
+ }
+ });
+
+ await _context.SaveChangesAsync();
+
+ var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync("majora2007", AppUserIncludes.ReadingLists);
+ var readingList = new ReadingListBuilder("test").Build();
+ user.ReadingLists = new List<ReadingList>()
+ {
+ readingList
+ };
+
+ await _readingListService.AddChaptersToReadingList(1, new List<int>() {1, 2}, readingList);
+
+
+ _unitOfWork.UserRepository.Update(user);
+ await _unitOfWork.CommitAsync();
+
+ await _readingListService.CalculateStartAndEndDates(readingList);
+ Assert.Equal(3, readingList.StartingMonth);
+ Assert.Equal(2002, readingList.StartingYear);
+ Assert.Equal(3, readingList.EndingMonth);
+ Assert.Equal(2005, readingList.EndingYear);
+ }
+
+ #endregion
+
#region FormatTitle
[Fact]
@@ -772,51 +752,27 @@ public class ReadingListServiceTests
private async Task CreateReadingList_SetupBaseData()
{
- var fablesSeries = DbFactory.Series("Fables");
- fablesSeries.Volumes.Add(new Volume()
- {
- Number = 1,
- Name = "2002",
- Chapters = new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false),
- }
- });
-
- _context.AppUser.Add(new AppUser()
- {
- UserName = "majora2007",
- ReadingLists = new List<ReadingList>(),
- Libraries = new List<Library>()
- {
- new Library()
- {
- Name = "Test Lib",
- Type = LibraryType.Book,
- Series = new List<Series>()
- {
- fablesSeries,
- },
- },
- },
- });
- _context.AppUser.Add(new AppUser()
- {
- UserName = "admin",
- ReadingLists = new List<ReadingList>(),
- Libraries = new List<Library>()
- {
- new Library()
- {
- Name = "Test Lib 2",
- Type = LibraryType.Book,
- Series = new List<Series>()
- {
- fablesSeries,
- },
- },
- }
- });
+ var fablesSeries = new SeriesBuilder("Fables").Build();
+ fablesSeries.Volumes.Add(
+ new VolumeBuilder("1")
+ .WithNumber(1)
+ .WithName("2002")
+ .WithChapter(new ChapterBuilder("1").Build())
+ .Build()
+ );
+
+ _context.AppUser.Add(new AppUserBuilder("majora2007", string.Empty)
+ .WithLibrary(new LibraryBuilder("Test LIb 2", LibraryType.Book)
+ .WithSeries(fablesSeries)
+ .Build())
+ .Build()
+ );
+ _context.AppUser.Add(new AppUserBuilder("admin", string.Empty)
+ .WithLibrary(new LibraryBuilder("Test LIb 2", LibraryType.Book)
+ .WithSeries(fablesSeries)
+ .Build())
+ .Build()
+ );
await _unitOfWork.CommitAsync();
}
@@ -961,322 +917,354 @@ public class ReadingListServiceTests
Assert.Single(userWithList.ReadingLists);
}
#endregion
- //
- // #region CreateReadingListFromCBL
- //
- // private static CblReadingList LoadCblFromPath(string path)
- // {
- // var testDirectory = Path.Join(Directory.GetCurrentDirectory(), "../../../Services/Test Data/ReadingListService/");
- //
- // var reader = new System.Xml.Serialization.XmlSerializer(typeof(CblReadingList));
- // using var file = new StreamReader(Path.Join(testDirectory, path));
- // var cblReadingList = (CblReadingList) reader.Deserialize(file);
- // file.Close();
- // return cblReadingList;
- // }
- //
- // [Fact]
- // public async Task CreateReadingListFromCBL_ShouldCreateList()
- // {
- // await ResetDb();
- // var cblReadingList = LoadCblFromPath("Fables.cbl");
- //
- // // Mock up our series
- // var fablesSeries = DbFactory.Series("Fables");
- // var fables2Series = DbFactory.Series("Fables: The Last Castle");
- //
- // fablesSeries.Volumes.Add(new Volume()
- // {
- // Number = 1,
- // Name = "2002",
- // Chapters = new List<Chapter>()
- // {
- // EntityFactory.CreateChapter("1", false),
- // EntityFactory.CreateChapter("2", false),
- // EntityFactory.CreateChapter("3", false),
- //
- // }
- // });
- // fables2Series.Volumes.Add(new Volume()
- // {
- // Number = 1,
- // Name = "2003",
- // Chapters = new List<Chapter>()
- // {
- // EntityFactory.CreateChapter("1", false),
- // EntityFactory.CreateChapter("2", false),
- // EntityFactory.CreateChapter("3", false),
- //
- // }
- // });
- //
- // _context.AppUser.Add(new AppUser()
- // {
- // UserName = "majora2007",
- // ReadingLists = new List<ReadingList>(),
- // Libraries = new List<Library>()
- // {
- // new Library()
- // {
- // Name = "Test LIb",
- // Type = LibraryType.Book,
- // Series = new List<Series>()
- // {
- // fablesSeries,
- // fables2Series
- // },
- // },
- // },
- // });
- // await _unitOfWork.CommitAsync();
- //
- // var importSummary = await _readingListService.CreateReadingListFromCbl(1, cblReadingList);
- //
- // Assert.Equal(CblImportResult.Partial, importSummary.Success);
- // Assert.NotEmpty(importSummary.Results);
- //
- // var createdList = await _unitOfWork.ReadingListRepository.GetReadingListByIdAsync(1);
- //
- // Assert.NotNull(createdList);
- // Assert.Equal("Fables", createdList.Title);
- //
- // Assert.Equal(4, createdList.Items.Count);
- // Assert.Equal(1, createdList.Items.First(item => item.Order == 0).ChapterId);
- // Assert.Equal(2, createdList.Items.First(item => item.Order == 1).ChapterId);
- // Assert.Equal(3, createdList.Items.First(item => item.Order == 2).ChapterId);
- // Assert.Equal(4, createdList.Items.First(item => item.Order == 3).ChapterId);
- // }
- //
- // [Fact]
- // public async Task CreateReadingListFromCBL_ShouldCreateList_ButOnlyIncludeSeriesThatUserHasAccessTo()
- // {
- // await ResetDb();
- // var cblReadingList = LoadCblFromPath("Fables.cbl");
- //
- // // Mock up our series
- // var fablesSeries = DbFactory.Series("Fables");
- // var fables2Series = DbFactory.Series("Fables: The Last Castle");
- //
- // fablesSeries.Volumes.Add(new Volume()
- // {
- // Number = 1,
- // Name = "2002",
- // Chapters = new List<Chapter>()
- // {
- // EntityFactory.CreateChapter("1", false),
- // EntityFactory.CreateChapter("2", false),
- // EntityFactory.CreateChapter("3", false),
- //
- // }
- // });
- // fables2Series.Volumes.Add(new Volume()
- // {
- // Number = 1,
- // Name = "2003",
- // Chapters = new List<Chapter>()
- // {
- // EntityFactory.CreateChapter("1", false),
- // EntityFactory.CreateChapter("2", false),
- // EntityFactory.CreateChapter("3", false),
- //
- // }
- // });
- //
- // _context.AppUser.Add(new AppUser()
- // {
- // UserName = "majora2007",
- // ReadingLists = new List<ReadingList>(),
- // Libraries = new List<Library>()
- // {
- // new Library()
- // {
- // Name = "Test LIb",
- // Type = LibraryType.Book,
- // Series = new List<Series>()
- // {
- // fablesSeries,
- // },
- // },
- // },
- // });
- //
- // _context.Library.Add(new Library()
- // {
- // Name = "Test Lib 2",
- // Type = LibraryType.Book,
- // Series = new List<Series>()
- // {
- // fables2Series,
- // },
- // });
- //
- // await _unitOfWork.CommitAsync();
- //
- // var importSummary = await _readingListService.CreateReadingListFromCbl(1, cblReadingList);
- //
- // Assert.Equal(CblImportResult.Partial, importSummary.Success);
- // Assert.NotEmpty(importSummary.Results);
- //
- // var createdList = await _unitOfWork.ReadingListRepository.GetReadingListByIdAsync(1);
- //
- // Assert.NotNull(createdList);
- // Assert.Equal("Fables", createdList.Title);
- //
- // Assert.Equal(3, createdList.Items.Count);
- // Assert.Equal(1, createdList.Items.First(item => item.Order == 0).ChapterId);
- // Assert.Equal(2, createdList.Items.First(item => item.Order == 1).ChapterId);
- // Assert.Equal(3, createdList.Items.First(item => item.Order == 2).ChapterId);
- // Assert.NotNull(importSummary.Results.SingleOrDefault(r => r.Series == "Fables: The Last Castle"
- // && r.Reason == CblImportReason.SeriesMissing));
- // }
- //
- // [Fact]
- // public async Task CreateReadingListFromCBL_ShouldFail_UserHasAccessToNoSeries()
- // {
- // await ResetDb();
- // var cblReadingList = LoadCblFromPath("Fables.cbl");
- //
- // // Mock up our series
- // var fablesSeries = DbFactory.Series("Fables");
- // var fables2Series = DbFactory.Series("Fables: The Last Castle");
- //
- // fablesSeries.Volumes.Add(new Volume()
- // {
- // Number = 1,
- // Name = "2002",
- // Chapters = new List<Chapter>()
- // {
- // EntityFactory.CreateChapter("1", false),
- // EntityFactory.CreateChapter("2", false),
- // EntityFactory.CreateChapter("3", false),
- //
- // }
- // });
- // fables2Series.Volumes.Add(new Volume()
- // {
- // Number = 1,
- // Name = "2003",
- // Chapters = new List<Chapter>()
- // {
- // EntityFactory.CreateChapter("1", false),
- // EntityFactory.CreateChapter("2", false),
- // EntityFactory.CreateChapter("3", false),
- //
- // }
- // });
- //
- // _context.AppUser.Add(new AppUser()
- // {
- // UserName = "majora2007",
- // ReadingLists = new List<ReadingList>(),
- // Libraries = new List<Library>(),
- // });
- //
- // _context.Library.Add(new Library()
- // {
- // Name = "Test Lib 2",
- // Type = LibraryType.Book,
- // Series = new List<Series>()
- // {
- // fablesSeries,
- // fables2Series,
- // },
- // });
- //
- // await _unitOfWork.CommitAsync();
- //
- // var importSummary = await _readingListService.CreateReadingListFromCbl(1, cblReadingList);
- //
- // Assert.Equal(CblImportResult.Fail, importSummary.Success);
- // Assert.NotEmpty(importSummary.Results);
- //
- // var createdList = await _unitOfWork.ReadingListRepository.GetReadingListByIdAsync(1);
- //
- // Assert.Null(createdList);
- // }
- //
- //
+
+ #region ValidateCBL
+
+ [Fact]
+ public async Task ValidateCblFile_ShouldFail_UserHasAccessToNoSeries()
+ {
+ await ResetDb();
+ var cblReadingList = LoadCblFromPath("Fables.cbl");
+
+ // Mock up our series
+ var fablesSeries = new SeriesBuilder("Fables").Build();
+ var fables2Series = new SeriesBuilder("Fables: The Last Castle").Build();
+
+ fablesSeries.Volumes.Add(new VolumeBuilder("1")
+ .WithNumber(1)
+ .WithName("2002")
+ .WithChapter(new ChapterBuilder("1").Build())
+ .WithChapter(new ChapterBuilder("2").Build())
+ .WithChapter(new ChapterBuilder("3").Build())
+ .Build()
+ );
+ fables2Series.Volumes.Add(new VolumeBuilder("1")
+ .WithNumber(1)
+ .WithName("2003")
+ .WithChapter(new ChapterBuilder("1").Build())
+ .WithChapter(new ChapterBuilder("2").Build())
+ .WithChapter(new ChapterBuilder("3").Build())
+ .Build()
+ );
+
+ _context.AppUser.Add(new AppUserBuilder("majora2007", string.Empty).Build());
+
+ _context.Library.Add(new LibraryBuilder("Test LIb 2", LibraryType.Book)
+ .WithSeries(fablesSeries)
+ .WithSeries(fables2Series)
+ .Build()
+ );
+
+ await _unitOfWork.CommitAsync();
+
+ var importSummary = await _readingListService.ValidateCblFile(1, cblReadingList);
+
+ Assert.Equal(CblImportResult.Fail, importSummary.Success);
+ Assert.NotEmpty(importSummary.Results);
+ }
+
+ [Fact]
+ public async Task ValidateCblFile_ShouldFail_ServerHasNoSeries()
+ {
+ await ResetDb();
+ var cblReadingList = LoadCblFromPath("Fables.cbl");
+
+ // Mock up our series
+ var fablesSeries = new SeriesBuilder("Fablesa").Build();
+ var fables2Series = new SeriesBuilder("Fablesa: The Last Castle").Build();
+
+ fablesSeries.Volumes.Add(new VolumeBuilder("2002")
+ .WithNumber(1)
+ .WithChapter(new ChapterBuilder("1").Build())
+ .WithChapter(new ChapterBuilder("2").Build())
+ .WithChapter(new ChapterBuilder("3").Build())
+ .Build());
+ fables2Series.Volumes.Add(new VolumeBuilder("2003")
+ .WithNumber(1)
+ .WithChapter(new ChapterBuilder("1").Build())
+ .WithChapter(new ChapterBuilder("2").Build())
+ .WithChapter(new ChapterBuilder("3").Build())
+ .Build());
+
+ _context.AppUser.Add(new AppUser()
+ {
+ UserName = "majora2007",
+ ReadingLists = new List<ReadingList>(),
+ Libraries = new List<Library>(),
+ });
+
+ _context.Library.Add(new LibraryBuilder("Test LIb 2", LibraryType.Book)
+ .WithSeries(fablesSeries)
+ .WithSeries(fables2Series)
+ .Build());
+
+ await _unitOfWork.CommitAsync();
+
+ var importSummary = await _readingListService.ValidateCblFile(1, cblReadingList);
+
+ Assert.Equal(CblImportResult.Fail, importSummary.Success);
+ Assert.NotEmpty(importSummary.Results);
+ }
+
+ #endregion
+
+ #region CreateReadingListFromCBL
+
+ private static CblReadingList LoadCblFromPath(string path)
+ {
+ var testDirectory = Path.Join(Directory.GetCurrentDirectory(), "../../../Services/Test Data/ReadingListService/");
+
+ var reader = new System.Xml.Serialization.XmlSerializer(typeof(CblReadingList));
+ using var file = new StreamReader(Path.Join(testDirectory, path));
+ var cblReadingList = (CblReadingList) reader.Deserialize(file);
+ file.Close();
+ return cblReadingList;
+ }
+
+ [Fact]
+ public async Task CreateReadingListFromCBL_ShouldCreateList()
+ {
+ await ResetDb();
+ var cblReadingList = LoadCblFromPath("Fables.cbl");
+
+ // Mock up our series
+ var fablesSeries = new SeriesBuilder("Fables")
+ .WithVolume(new VolumeBuilder("2002")
+ .WithNumber(1)
+ .WithChapter(new ChapterBuilder("1").Build())
+ .WithChapter(new ChapterBuilder("2").Build())
+ .WithChapter(new ChapterBuilder("3").Build())
+ .Build())
+ .Build();
+
+ var fables2Series = new SeriesBuilder("Fables: The Last Castle")
+ .WithVolume(new VolumeBuilder("2003")
+ .WithNumber(1)
+ .WithChapter(new ChapterBuilder("1").Build())
+ .WithChapter(new ChapterBuilder("2").Build())
+ .WithChapter(new ChapterBuilder("3").Build())
+ .Build())
+ .Build();
+
+ _context.AppUser.Add(new AppUser()
+ {
+ UserName = "majora2007",
+ ReadingLists = new List<ReadingList>(),
+ Libraries = new List<Library>()
+ {
+ new LibraryBuilder("Test LIb 2", LibraryType.Book)
+ .WithSeries(fablesSeries)
+ .WithSeries(fables2Series)
+ .Build()
+ },
+ });
+ await _unitOfWork.CommitAsync();
+
+ var importSummary = await _readingListService.CreateReadingListFromCbl(1, cblReadingList);
+
+ Assert.Equal(CblImportResult.Partial, importSummary.Success);
+ Assert.NotEmpty(importSummary.Results);
+
+ var createdList = await _unitOfWork.ReadingListRepository.GetReadingListByIdAsync(1);
+
+ Assert.NotNull(createdList);
+ Assert.Equal("Fables", createdList.Title);
+
+ Assert.Equal(4, createdList.Items.Count);
+ Assert.Equal(1, createdList.Items.First(item => item.Order == 0).ChapterId);
+ Assert.Equal(2, createdList.Items.First(item => item.Order == 1).ChapterId);
+ Assert.Equal(3, createdList.Items.First(item => item.Order == 2).ChapterId);
+ Assert.Equal(4, createdList.Items.First(item => item.Order == 3).ChapterId);
+ }
+
+ [Fact]
+ public async Task CreateReadingListFromCBL_ShouldCreateList_ButOnlyIncludeSeriesThatUserHasAccessTo()
+ {
+ await ResetDb();
+ var cblReadingList = LoadCblFromPath("Fables.cbl");
+
+ // Mock up our series
+ var fablesSeries = new SeriesBuilder("Fables").Build();
+ var fables2Series = new SeriesBuilder("Fables: The Last Castle").Build();
+
+ fablesSeries.Volumes.Add(new VolumeBuilder("2002")
+ .WithNumber(1)
+ .WithChapter(new ChapterBuilder("1").Build())
+ .WithChapter(new ChapterBuilder("2").Build())
+ .WithChapter(new ChapterBuilder("3").Build())
+ .Build());
+ fables2Series.Volumes.Add(new VolumeBuilder("2003")
+ .WithNumber(1)
+ .WithChapter(new ChapterBuilder("1").Build())
+ .WithChapter(new ChapterBuilder("2").Build())
+ .WithChapter(new ChapterBuilder("3").Build())
+ .Build());
+
+ _context.AppUser.Add(new AppUser()
+ {
+ UserName = "majora2007",
+ ReadingLists = new List<ReadingList>(),
+ Libraries = new List<Library>()
+ {
+ new LibraryBuilder("Test LIb 2", LibraryType.Book)
+ .WithSeries(fablesSeries)
+ .Build()
+ },
+ });
+
+ _context.Library.Add(new LibraryBuilder("Test LIb 2", LibraryType.Book)
+ .WithSeries(fables2Series)
+ .Build());
+
+ await _unitOfWork.CommitAsync();
+
+ var importSummary = await _readingListService.CreateReadingListFromCbl(1, cblReadingList);
+
+ Assert.Equal(CblImportResult.Partial, importSummary.Success);
+ Assert.NotEmpty(importSummary.Results);
+
+ var createdList = await _unitOfWork.ReadingListRepository.GetReadingListByIdAsync(1);
+
+ Assert.NotNull(createdList);
+ Assert.Equal("Fables", createdList.Title);
+
+ Assert.Equal(3, createdList.Items.Count);
+ Assert.Equal(1, createdList.Items.First(item => item.Order == 0).ChapterId);
+ Assert.Equal(2, createdList.Items.First(item => item.Order == 1).ChapterId);
+ Assert.Equal(3, createdList.Items.First(item => item.Order == 2).ChapterId);
+ Assert.NotNull(importSummary.Results.SingleOrDefault(r => r.Series == "Fables: The Last Castle"
+ && r.Reason == CblImportReason.SeriesMissing));
+ }
+
+ [Fact]
+ public async Task CreateReadingListFromCBL_ShouldUpdateAnExistingList()
+ {
+ await ResetDb();
+ var cblReadingList = LoadCblFromPath("Fables.cbl");
+
+ // Mock up our series
+ var fablesSeries = new SeriesBuilder("Fables").Build();
+ var fables2Series = new SeriesBuilder("Fables: The Last Castle").Build();
+
+ fablesSeries.Volumes.Add(new VolumeBuilder("2002")
+ .WithNumber(1)
+ .WithChapter(new ChapterBuilder("1").Build())
+ .WithChapter(new ChapterBuilder("2").Build())
+ .WithChapter(new ChapterBuilder("3").Build())
+ .Build());
+ fables2Series.Volumes.Add(new VolumeBuilder("2003")
+ .WithNumber(1)
+ .WithChapter(new ChapterBuilder("1").Build())
+ .WithChapter(new ChapterBuilder("2").Build())
+ .WithChapter(new ChapterBuilder("3").Build())
+ .Build());
+
+ _context.AppUser.Add(new AppUser()
+ {
+ UserName = "majora2007",
+ ReadingLists = new List<ReadingList>(),
+ Libraries = new List<Library>()
+ {
+ new LibraryBuilder("Test LIb 2", LibraryType.Book)
+ .WithSeries(fablesSeries)
+ .WithSeries(fables2Series)
+ .Build()
+ },
+ });
+
+ await _unitOfWork.CommitAsync();
+
+ // Create a reading list named Fables and add 2 chapters to it
+ var user = await _unitOfWork.UserRepository.GetUserByIdAsync(1, AppUserIncludes.ReadingLists);
+ var readingList = await _readingListService.CreateReadingListForUser(user, "Fables");
+ Assert.True(await _readingListService.AddChaptersToReadingList(1, new List<int>() {1, 3}, readingList));
+ Assert.Equal(2, readingList.Items.Count);
+
+ // Attempt to import a Cbl with same reading list name
+ var importSummary = await _readingListService.CreateReadingListFromCbl(1, cblReadingList);
+
+ Assert.Equal(CblImportResult.Partial, importSummary.Success);
+ Assert.NotEmpty(importSummary.Results);
+
+ var createdList = await _unitOfWork.ReadingListRepository.GetReadingListByIdAsync(1);
+
+ Assert.NotNull(createdList);
+ Assert.Equal("Fables", createdList.Title);
+
+ Assert.Equal(4, createdList.Items.Count);
+ Assert.Equal(4, importSummary.SuccessfulInserts.Count);
+
+ Assert.Equal(1, createdList.Items.First(item => item.Order == 0).ChapterId);
+ Assert.Equal(3, createdList.Items.First(item => item.Order == 1).ChapterId); // we inserted 3 first
+ Assert.Equal(2, createdList.Items.First(item => item.Order == 2).ChapterId);
+ Assert.Equal(4, createdList.Items.First(item => item.Order == 3).ChapterId);
+ }
+ #endregion
+
+ #region CreateReadingListsFromSeries
+
+ private async Task<Tuple<Series, Series>> SetupData()
+ {
+ // Setup 2 series, only do this once tho
+ if (await _unitOfWork.SeriesRepository.DoesSeriesNameExistInLibrary("Series 1", 1, MangaFormat.Archive))
+ {
+ return new Tuple<Series, Series>(await _unitOfWork.SeriesRepository.GetFullSeriesForSeriesIdAsync(1),
+ await _unitOfWork.SeriesRepository.GetFullSeriesForSeriesIdAsync(2));
+ }
+
+ var library =
+ await _unitOfWork.LibraryRepository.GetLibraryForIdAsync(1,
+ LibraryIncludes.Series | LibraryIncludes.AppUser);
+ var user = new AppUserBuilder("majora2007", "[email protected]").Build();
+ library!.AppUsers.Add(user);
+ library.ManageReadingLists = true;
+
+ // Setup the series for CreateReadingListsFromSeries
+ var series1 = new SeriesBuilder("Series 1")
+ .WithFormat(MangaFormat.Archive)
+ .WithVolume(new VolumeBuilder("1")
+ .WithChapter(new ChapterBuilder("1")
+ .WithStoryArc("CreateReadingListsFromSeries")
+ .WithStoryArcNumber("1")
+ .Build())
+ .WithChapter(new ChapterBuilder("2").Build())
+ .Build())
+ .Build();
+
+ var series2 = new SeriesBuilder("Series 2")
+ .WithFormat(MangaFormat.Archive)
+ .WithVolume(new VolumeBuilder(API.Services.Tasks.Scanner.Parser.Parser.DefaultVolume)
+ .WithChapter(new ChapterBuilder("1").Build())
+ .WithChapter(new ChapterBuilder("2").Build())
+ .Build())
+ .Build();
+
+ library!.Series.Add(series1);
+ library!.Series.Add(series2);
+
+ await _unitOfWork.CommitAsync();
+
+ return new Tuple<Series, Series>(series1, series2);
+ }
+
// [Fact]
- // public async Task CreateReadingListFromCBL_ShouldUpdateAnExistingList()
+ // public async Task CreateReadingListsFromSeries_ShouldCreateFromSinglePair()
// {
- // await ResetDb();
- // var cblReadingList = LoadCblFromPath("Fables.cbl");
- //
- // // Mock up our series
- // var fablesSeries = DbFactory.Series("Fables");
- // var fables2Series = DbFactory.Series("Fables: The Last Castle");
- //
- // fablesSeries.Volumes.Add(new Volume()
- // {
- // Number = 1,
- // Name = "2002",
- // Chapters = new List<Chapter>()
- // {
- // EntityFactory.CreateChapter("1", false),
- // EntityFactory.CreateChapter("2", false),
- // EntityFactory.CreateChapter("3", false),
- //
- // }
- // });
- // fables2Series.Volumes.Add(new Volume()
- // {
- // Number = 1,
- // Name = "2003",
- // Chapters = new List<Chapter>()
- // {
- // EntityFactory.CreateChapter("1", false),
- // EntityFactory.CreateChapter("2", false),
- // EntityFactory.CreateChapter("3", false),
- //
- // }
- // });
- //
- // _context.AppUser.Add(new AppUser()
- // {
- // UserName = "majora2007",
- // ReadingLists = new List<ReadingList>(),
- // Libraries = new List<Library>()
- // {
- // new Library()
- // {
- // Name = "Test LIb",
- // Type = LibraryType.Book,
- // Series = new List<Series>()
- // {
- // fablesSeries,
- // fables2Series
- // },
- // },
- // },
- // });
+ // //await SetupData();
//
- // await _unitOfWork.CommitAsync();
+ // var series1 = new SeriesBuilder("Series 1")
+ // .WithFormat(MangaFormat.Archive)
+ // .WithVolume(new VolumeBuilder("1")
+ // .WithChapter(new ChapterBuilder("1")
+ // .WithStoryArc("CreateReadingListsFromSeries")
+ // .WithStoryArcNumber("1")
+ // .Build())
+ // .WithChapter(new ChapterBuilder("2").Build())
+ // .Build())
+ // .Build();
//
- // // Create a reading list named Fables and add 2 chapters to it
- // var user = await _unitOfWork.UserRepository.GetUserByIdAsync(1, AppUserIncludes.ReadingLists);
- // var readingList = await _readingListService.CreateReadingListForUser(user, "Fables");
- // Assert.True(await _readingListService.AddChaptersToReadingList(1, new List<int>() {1, 3}, readingList));
- // Assert.Equal(2, readingList.Items.Count);
- //
- // // Attempt to import a Cbl with same reading list name
- // var importSummary = await _readingListService.CreateReadingListFromCbl(1, cblReadingList);
- //
- // Assert.Equal(CblImportResult.Partial, importSummary.Success);
- // Assert.NotEmpty(importSummary.Results);
- //
- // var createdList = await _unitOfWork.ReadingListRepository.GetReadingListByIdAsync(1);
- //
- // Assert.NotNull(createdList);
- // Assert.Equal("Fables", createdList.Title);
- //
- // Assert.Equal(4, createdList.Items.Count);
- // Assert.Equal(4, importSummary.SuccessfulInserts.Count);
- //
- // Assert.Equal(1, createdList.Items.First(item => item.Order == 0).ChapterId);
- // Assert.Equal(3, createdList.Items.First(item => item.Order == 1).ChapterId); // we inserted 3 first
- // Assert.Equal(2, createdList.Items.First(item => item.Order == 2).ChapterId);
- // Assert.Equal(4, createdList.Items.First(item => item.Order == 3).ChapterId);
+ // _readingListService.CreateReadingListsFromSeries(series.Item1)
// }
- // #endregion
- //
+
+ #endregion
}
diff --git a/API.Tests/Services/ScannerServiceTests.cs b/API.Tests/Services/ScannerServiceTests.cs
index 2298aa003..c40c0d95b 100644
--- a/API.Tests/Services/ScannerServiceTests.cs
+++ b/API.Tests/Services/ScannerServiceTests.cs
@@ -3,9 +3,11 @@ using System.Linq;
using API.Entities;
using API.Entities.Enums;
using API.Entities.Metadata;
-using API.Parser;
+using API.Extensions;
+using API.Helpers.Builders;
using API.Services.Tasks;
using API.Services.Tasks.Scanner;
+using API.Services.Tasks.Scanner.Parser;
using API.Tests.Helpers;
using Xunit;
@@ -23,23 +25,14 @@ public class ScannerServiceTests
var existingSeries = new List<Series>
{
- new Series()
- {
- Name = "Darker Than Black",
- LocalizedName = "Darker Than Black",
- OriginalName = "Darker Than Black",
- Volumes = new List<Volume>()
- {
- new Volume()
- {
- Number = 1,
- Name = "1"
- }
- },
- NormalizedName = API.Services.Tasks.Scanner.Parser.Parser.Normalize("Darker Than Black"),
- Metadata = new SeriesMetadata(),
- Format = MangaFormat.Epub
- }
+ new SeriesBuilder("Darker Than Black")
+ .WithFormat(MangaFormat.Epub)
+
+ .WithVolume(new VolumeBuilder("1")
+ .WithName("1")
+ .Build())
+ .WithLocalizedName("Darker Than Black")
+ .Build()
};
Assert.Equal(1, ScannerService.FindSeriesNotOnDisk(existingSeries, infos).Count());
@@ -56,76 +49,23 @@ public class ScannerServiceTests
var existingSeries = new List<Series>
{
- new Series()
- {
- Name = "Cage of Eden",
- LocalizedName = "Cage of Eden",
- OriginalName = "Cage of Eden",
- NormalizedName = API.Services.Tasks.Scanner.Parser.Parser.Normalize("Cage of Eden"),
- Metadata = new SeriesMetadata(),
- Format = MangaFormat.Archive
- },
- new Series()
- {
- Name = "Darker Than Black",
- LocalizedName = "Darker Than Black",
- OriginalName = "Darker Than Black",
- NormalizedName = API.Services.Tasks.Scanner.Parser.Parser.Normalize("Darker Than Black"),
- Metadata = new SeriesMetadata(),
- Format = MangaFormat.Archive
- }
+ new SeriesBuilder("Cage of Eden")
+ .WithFormat(MangaFormat.Archive)
+
+ .WithVolume(new VolumeBuilder("1")
+ .WithName("1")
+ .Build())
+ .WithLocalizedName("Darker Than Black")
+ .Build(),
+ new SeriesBuilder("Darker Than Black")
+ .WithFormat(MangaFormat.Archive)
+ .WithVolume(new VolumeBuilder("1")
+ .WithName("1")
+ .Build())
+ .WithLocalizedName("Darker Than Black")
+ .Build(),
};
-
-
Assert.Empty(ScannerService.FindSeriesNotOnDisk(existingSeries, infos));
}
-
-
- // TODO: Figure out how to do this with ParseScannedFiles
- // [Theory]
- // [InlineData(new [] {"Darker than Black"}, "Darker than Black", "Darker than Black")]
- // [InlineData(new [] {"Darker than Black"}, "Darker Than Black", "Darker than Black")]
- // [InlineData(new [] {"Darker than Black"}, "Darker Than Black!", "Darker than Black")]
- // [InlineData(new [] {""}, "Runaway Jack", "Runaway Jack")]
- // public void MergeNameTest(string[] existingSeriesNames, string parsedInfoName, string expected)
- // {
- // var collectedSeries = new ConcurrentDictionary<ParsedSeries, List<ParserInfo>>();
- // foreach (var seriesName in existingSeriesNames)
- // {
- // AddToParsedInfo(collectedSeries, new ParserInfo() {Series = seriesName, Format = MangaFormat.Archive});
- // }
- //
- // var actualName = new ParseScannedFiles(_bookService, _logger).MergeName(collectedSeries, new ParserInfo()
- // {
- // Series = parsedInfoName,
- // Format = MangaFormat.Archive
- // });
- //
- // Assert.Equal(expected, actualName);
- // }
-
- // [Fact]
- // public void RemoveMissingSeries_Should_RemoveSeries()
- // {
- // var existingSeries = new List<Series>()
- // {
- // EntityFactory.CreateSeries("Darker than Black Vol 1"),
- // EntityFactory.CreateSeries("Darker than Black"),
- // EntityFactory.CreateSeries("Beastars"),
- // };
- // var missingSeries = new List<Series>()
- // {
- // EntityFactory.CreateSeries("Darker than Black Vol 1"),
- // };
- // existingSeries = ScannerService.RemoveMissingSeries(existingSeries, missingSeries, out var removeCount).ToList();
- //
- // Assert.DoesNotContain(missingSeries[0].Name, existingSeries.Select(s => s.Name));
- // Assert.Equal(missingSeries.Count, removeCount);
- // }
-
-
- // TODO: I want a test for UpdateSeries where if I have chapter 10 and now it's mapping into Vol 2 Chapter 10,
- // if I can do it without deleting the underlying chapter (aka id change)
-
}
diff --git a/API.Tests/Services/SeriesServiceTests.cs b/API.Tests/Services/SeriesServiceTests.cs
index e0b24c812..1ab48ed3e 100644
--- a/API.Tests/Services/SeriesServiceTests.cs
+++ b/API.Tests/Services/SeriesServiceTests.cs
@@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Data.Common;
-using System.IO.Abstractions.TestingHelpers;
using System.Linq;
using System.Threading.Tasks;
using API.Data;
@@ -14,14 +12,10 @@ using API.Entities;
using API.Entities.Enums;
using API.Entities.Metadata;
using API.Extensions;
-using API.Helpers;
+using API.Helpers.Builders;
using API.Services;
using API.SignalR;
using API.Tests.Helpers;
-using AutoMapper;
-using Microsoft.Data.Sqlite;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.Extensions.Logging;
using NSubstitute;
using Xunit;
@@ -80,43 +74,25 @@ public class SeriesServiceTests : AbstractDbTest
{
await ResetDb();
- _context.Library.Add(new Library()
- {
- AppUsers = new List<AppUser>()
- {
- new AppUser()
- {
- UserName = "majora2007"
- }
- },
- Name = "Test LIb",
- Type = LibraryType.Book,
- Series = new List<Series>()
- {
- new Series()
- {
- Name = "Test",
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("Omake", true, new List<MangaFile>()),
- EntityFactory.CreateChapter("Something SP02", true, new List<MangaFile>()),
- }),
- EntityFactory.CreateVolume("2", new List<Chapter>()
- {
- EntityFactory.CreateChapter("21", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("22", false, new List<MangaFile>()),
- }),
- EntityFactory.CreateVolume("3", new List<Chapter>()
- {
- EntityFactory.CreateChapter("31", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("32", false, new List<MangaFile>()),
- }),
- }
- }
- }
- });
+ _context.Library.Add(new LibraryBuilder("Test LIb")
+ .WithAppUser(new AppUserBuilder("majora2007", string.Empty).Build())
+ .WithSeries(new SeriesBuilder("Test")
+
+ .WithVolume(new VolumeBuilder("0")
+ .WithChapter(new ChapterBuilder("Omake").WithIsSpecial(true).WithTitle("Omake").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("Something SP02").WithIsSpecial(true).WithTitle("Something").WithPages(1).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("2")
+ .WithChapter(new ChapterBuilder("21").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("21").WithPages(1).Build())
+ .Build())
+
+ .WithVolume(new VolumeBuilder("3")
+ .WithChapter(new ChapterBuilder("31").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("32").WithPages(1).Build())
+ .Build())
+ .Build())
+ .Build());
await _context.SaveChangesAsync();
@@ -134,43 +110,26 @@ public class SeriesServiceTests : AbstractDbTest
{
await ResetDb();
- _context.Library.Add(new Library()
- {
- AppUsers = new List<AppUser>()
- {
- new AppUser()
- {
- UserName = "majora2007"
- }
- },
- Name = "Test LIb",
- Type = LibraryType.Manga,
- Series = new List<Series>()
- {
- new Series()
- {
- Name = "Test",
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("2", false, new List<MangaFile>()),
- }),
- EntityFactory.CreateVolume("2", new List<Chapter>()
- {
- EntityFactory.CreateChapter("21", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("22", false, new List<MangaFile>()),
- }),
- EntityFactory.CreateVolume("3", new List<Chapter>()
- {
- EntityFactory.CreateChapter("31", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("32", false, new List<MangaFile>()),
- }),
- }
- }
- }
- });
+ _context.Library.Add(new LibraryBuilder("Test LIb")
+ .WithAppUser(new AppUserBuilder("majora2007", string.Empty).Build())
+ .WithSeries(new SeriesBuilder("Test")
+
+ .WithVolume(new VolumeBuilder("0")
+ .WithChapter(new ChapterBuilder("1").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("2").WithPages(1).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("2")
+ .WithChapter(new ChapterBuilder("21").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("21").WithPages(1).Build())
+ .Build())
+
+ .WithVolume(new VolumeBuilder("3")
+ .WithChapter(new ChapterBuilder("31").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("32").WithPages(1).Build())
+ .Build())
+ .Build())
+ .Build()
+ );
await _context.SaveChangesAsync();
@@ -188,41 +147,23 @@ public class SeriesServiceTests : AbstractDbTest
{
await ResetDb();
- _context.Library.Add(new Library()
- {
- AppUsers = new List<AppUser>()
- {
- new AppUser()
- {
- UserName = "majora2007"
- }
- },
- Name = "Test LIb",
- Type = LibraryType.Manga,
- Series = new List<Series>()
- {
- new Series()
- {
- Name = "Test",
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("2", false, new List<MangaFile>()),
- }),
- EntityFactory.CreateVolume("2", new List<Chapter>()
- {
- EntityFactory.CreateChapter("0", false, new List<MangaFile>()),
- }),
- EntityFactory.CreateVolume("3", new List<Chapter>()
- {
- EntityFactory.CreateChapter("31", false, new List<MangaFile>()),
- }),
- }
- }
- }
- });
+ _context.Library.Add(new LibraryBuilder("Test LIb")
+ .WithAppUser(new AppUserBuilder("majora2007", string.Empty).Build())
+ .WithSeries(new SeriesBuilder("Test")
+
+ .WithVolume(new VolumeBuilder("0")
+ .WithChapter(new ChapterBuilder("1").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("2").WithPages(1).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("2")
+ .WithChapter(new ChapterBuilder("0").WithPages(1).Build())
+ .Build())
+
+ .WithVolume(new VolumeBuilder("3")
+ .WithChapter(new ChapterBuilder("31").WithPages(1).Build())
+ .Build())
+ .Build())
+ .Build());
await _context.SaveChangesAsync();
@@ -240,41 +181,22 @@ public class SeriesServiceTests : AbstractDbTest
{
await ResetDb();
- _context.Library.Add(new Library()
- {
- AppUsers = new List<AppUser>()
- {
- new AppUser()
- {
- UserName = "majora2007"
- }
- },
- Name = "Test LIb",
- Type = LibraryType.Manga,
- Series = new List<Series>()
- {
- new Series()
- {
- Name = "Test",
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, new List<MangaFile>()),
- EntityFactory.CreateChapter("2", false, new List<MangaFile>()),
- }),
- EntityFactory.CreateVolume("2", new List<Chapter>()
- {
- EntityFactory.CreateChapter("0", false, new List<MangaFile>()),
- }),
- EntityFactory.CreateVolume("3", new List<Chapter>()
- {
- EntityFactory.CreateChapter("31", false, new List<MangaFile>()),
- }),
- }
- }
- }
- });
+ _context.Library.Add(new LibraryBuilder("Test LIb")
+ .WithAppUser(new AppUserBuilder("majora2007", string.Empty).Build())
+ .WithSeries(new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("0")
+ .WithChapter(new ChapterBuilder("1").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("2").WithPages(1).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("2")
+ .WithChapter(new ChapterBuilder("0").WithPages(1).Build())
+ .Build())
+
+ .WithVolume(new VolumeBuilder("3")
+ .WithChapter(new ChapterBuilder("31").WithPages(1).Build())
+ .Build())
+ .Build())
+ .Build());
await _context.SaveChangesAsync();
@@ -295,36 +217,19 @@ public class SeriesServiceTests : AbstractDbTest
{
await ResetDb();
- _context.Library.Add(new Library()
- {
- AppUsers = new List<AppUser>()
- {
- new AppUser()
- {
- UserName = "majora2007"
- }
- },
- Name = "Test LIb",
- Type = LibraryType.Book,
- Series = new List<Series>()
- {
- new Series()
- {
- Name = "Test",
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("2", new List<Chapter>()
- {
- EntityFactory.CreateChapter("0", false, new List<MangaFile>()),
- }),
- EntityFactory.CreateVolume("3", new List<Chapter>()
- {
- EntityFactory.CreateChapter("0", false, new List<MangaFile>()),
- }),
- }
- }
- }
- });
+ _context.Library.Add(new LibraryBuilder("Test LIb", LibraryType.Book)
+ .WithAppUser(new AppUserBuilder("majora2007", string.Empty).Build())
+ .WithSeries(new SeriesBuilder("Test")
+
+ .WithVolume(new VolumeBuilder("2")
+ .WithChapter(new ChapterBuilder("0").WithPages(1).Build())
+ .Build())
+
+ .WithVolume(new VolumeBuilder("3")
+ .WithChapter(new ChapterBuilder("0").WithPages(1).Build())
+ .Build())
+ .Build())
+ .Build());
await _context.SaveChangesAsync();
@@ -341,36 +246,18 @@ public class SeriesServiceTests : AbstractDbTest
{
await ResetDb();
- _context.Library.Add(new Library()
- {
- AppUsers = new List<AppUser>()
- {
- new AppUser()
- {
- UserName = "majora2007"
- }
- },
- Name = "Test LIb",
- Type = LibraryType.Book,
- Series = new List<Series>()
- {
- new Series()
- {
- Name = "Test",
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("Ano Orokamono ni mo Kyakkou wo! - Volume 1.epub", true, new List<MangaFile>()),
- }),
- EntityFactory.CreateVolume("2", new List<Chapter>()
- {
- EntityFactory.CreateChapter("Ano Orokamono ni mo Kyakkou wo! - Volume 2.epub", false, new List<MangaFile>()),
- }),
- }
- }
- }
- });
+ _context.Library.Add(new LibraryBuilder("Test LIb", LibraryType.Book)
+ .WithAppUser(new AppUserBuilder("majora2007", string.Empty).Build())
+ .WithSeries(new SeriesBuilder("Test")
+
+ .WithVolume(new VolumeBuilder("0")
+ .WithChapter(new ChapterBuilder("Ano Orokamono ni mo Kyakkou wo! - Volume 1.epub", "Ano Orokamono ni mo Kyakkou wo! - Volume 1.epub").WithIsSpecial(true).WithPages(1).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("2")
+ .WithChapter(new ChapterBuilder("Ano Orokamono ni mo Kyakkou wo! - Volume 2.epub", "Ano Orokamono ni mo Kyakkou wo! - Volume 2.epub").WithPages(1).Build())
+ .Build())
+ .Build())
+ .Build());
@@ -394,40 +281,22 @@ public class SeriesServiceTests : AbstractDbTest
{
await ResetDb();
- _context.Library.Add(new Library()
- {
- AppUsers = new List<AppUser>()
- {
- new AppUser()
- {
- UserName = "majora2007"
- }
- },
- Name = "Test LIb",
- Type = LibraryType.Manga,
- Series = new List<Series>()
- {
- new Series()
- {
- Name = "Test",
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("2", new List<Chapter>()
- {
- EntityFactory.CreateChapter("0", false, new List<MangaFile>()),
- }),
- EntityFactory.CreateVolume("1.2", new List<Chapter>()
- {
- EntityFactory.CreateChapter("0", false, new List<MangaFile>()),
- }),
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("0", false, new List<MangaFile>()),
- }),
- }
- }
- }
- });
+ _context.Library.Add(new LibraryBuilder("Test LIb", LibraryType.Manga)
+ .WithAppUser(new AppUserBuilder("majora2007", string.Empty).Build())
+ .WithSeries(new SeriesBuilder("Test")
+
+ .WithVolume(new VolumeBuilder("2")
+ .WithChapter(new ChapterBuilder("0").WithPages(1).Build())
+ .Build())
+
+ .WithVolume(new VolumeBuilder("1.2")
+ .WithChapter(new ChapterBuilder("0").WithPages(1).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("1")
+ .WithChapter(new ChapterBuilder("0").WithPages(1).Build())
+ .Build())
+ .Build())
+ .Build());
await _context.SaveChangesAsync();
@@ -449,32 +318,15 @@ public class SeriesServiceTests : AbstractDbTest
{
await ResetDb();
- _context.Library.Add(new Library()
- {
- AppUsers = new List<AppUser>()
- {
- new AppUser()
- {
- UserName = "majora2007"
- }
- },
- Name = "Test LIb",
- Type = LibraryType.Manga,
- Series = new List<Series>()
- {
- new Series()
- {
- Name = "Test",
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, new List<MangaFile>(), 1),
- }),
- }
- }
- }
- });
+ _context.Library.Add(new LibraryBuilder("Test LIb", LibraryType.Manga)
+ .WithAppUser(new AppUserBuilder("majora2007", string.Empty).Build())
+ .WithSeries(new SeriesBuilder("Test")
+
+ .WithVolume(new VolumeBuilder("1")
+ .WithChapter(new ChapterBuilder("1").WithPages(1).Build())
+ .Build())
+ .Build())
+ .Build());
await _context.SaveChangesAsync();
@@ -503,32 +355,15 @@ public class SeriesServiceTests : AbstractDbTest
{
await ResetDb();
- _context.Library.Add(new Library()
- {
- AppUsers = new List<AppUser>()
- {
- new AppUser()
- {
- UserName = "majora2007"
- }
- },
- Name = "Test LIb",
- Type = LibraryType.Manga,
- Series = new List<Series>()
- {
- new Series()
- {
- Name = "Test",
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, new List<MangaFile>(), 1),
- }),
- }
- }
- }
- });
+ _context.Library.Add(new LibraryBuilder("Test LIb")
+ .WithAppUser(new AppUserBuilder("majora2007", string.Empty).Build())
+ .WithSeries(new SeriesBuilder("Test")
+
+ .WithVolume(new VolumeBuilder("1")
+ .WithChapter(new ChapterBuilder("1").WithPages(1).Build())
+ .Build())
+ .Build())
+ .Build());
await _context.SaveChangesAsync();
@@ -574,32 +409,15 @@ public class SeriesServiceTests : AbstractDbTest
{
await ResetDb();
- _context.Library.Add(new Library()
- {
- AppUsers = new List<AppUser>()
- {
- new AppUser()
- {
- UserName = "majora2007"
- }
- },
- Name = "Test LIb",
- Type = LibraryType.Manga,
- Series = new List<Series>()
- {
- new Series()
- {
- Name = "Test",
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, new List<MangaFile>(), 1),
- }),
- }
- }
- }
- });
+ _context.Library.Add(new LibraryBuilder("Test LIb")
+ .WithAppUser(new AppUserBuilder("majora2007", string.Empty).Build())
+ .WithSeries(new SeriesBuilder("Test")
+
+ .WithVolume(new VolumeBuilder("1")
+ .WithChapter(new ChapterBuilder("1").WithPages(1).Build())
+ .Build())
+ .Build())
+ .Build());
await _context.SaveChangesAsync();
@@ -626,32 +444,15 @@ public class SeriesServiceTests : AbstractDbTest
{
await ResetDb();
- _context.Library.Add(new Library()
- {
- AppUsers = new List<AppUser>()
- {
- new AppUser()
- {
- UserName = "majora2007"
- }
- },
- Name = "Test LIb",
- Type = LibraryType.Manga,
- Series = new List<Series>()
- {
- new Series()
- {
- Name = "Test",
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, new List<MangaFile>(), 1),
- }),
- }
- }
- }
- });
+ _context.Library.Add(new LibraryBuilder("Test LIb", LibraryType.Book)
+ .WithAppUser(new AppUserBuilder("majora2007", string.Empty).Build())
+ .WithSeries(new SeriesBuilder("Test")
+
+ .WithVolume(new VolumeBuilder("1")
+ .WithChapter(new ChapterBuilder("1").WithPages(1).Build())
+ .Build())
+ .Build())
+ .Build());
await _context.SaveChangesAsync();
@@ -678,14 +479,11 @@ public class SeriesServiceTests : AbstractDbTest
public async Task UpdateSeriesMetadata_ShouldCreateEmptyMetadata_IfDoesntExist()
{
await ResetDb();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Book,
- }
- });
+ var s = new SeriesBuilder("Test")
+ .Build();
+ s.Library = new LibraryBuilder("Test LIb", LibraryType.Book).Build();
+
+ _context.Series.Add(s);
await _context.SaveChangesAsync();
var success = await _seriesService.UpdateSeriesMetadata(new UpdateSeriesMetadataDto()
@@ -710,14 +508,11 @@ public class SeriesServiceTests : AbstractDbTest
public async Task UpdateSeriesMetadata_ShouldCreateNewTags_IfNoneExist()
{
await ResetDb();
- _context.Series.Add(new Series()
- {
- Name = "Test",
- Library = new Library() {
- Name = "Test LIb",
- Type = LibraryType.Book,
- }
- });
+ var s = new SeriesBuilder("Test")
+ .Build();
+ s.Library = new LibraryBuilder("Test LIb", LibraryType.Book).Build();
+
+ _context.Series.Add(s);
await _context.SaveChangesAsync();
var success = await _seriesService.UpdateSeriesMetadata(new UpdateSeriesMetadataDto()
@@ -752,17 +547,12 @@ public class SeriesServiceTests : AbstractDbTest
public async Task UpdateSeriesMetadata_ShouldRemoveExistingTags()
{
await ResetDb();
- var s = new Series()
- {
- Name = "Test",
- Library = new Library()
- {
- Name = "Test LIb",
- Type = LibraryType.Book,
- },
- Metadata = DbFactory.SeriesMetadata(new List<CollectionTag>())
- };
- var g = DbFactory.Genre("Existing Genre");
+ var s = new SeriesBuilder("Test")
+ .WithMetadata(new SeriesMetadataBuilder().Build())
+ .Build();
+ s.Library = new LibraryBuilder("Test LIb", LibraryType.Book).Build();
+
+ var g = new GenreBuilder("Existing Genre").Build();
s.Metadata.Genres = new List<Genre>() {g};
_context.Series.Add(s);
@@ -791,17 +581,12 @@ public class SeriesServiceTests : AbstractDbTest
public async Task UpdateSeriesMetadata_ShouldAddNewPerson_NoExistingPeople()
{
await ResetDb();
- var s = new Series()
- {
- Name = "Test",
- Library = new Library()
- {
- Name = "Test LIb",
- Type = LibraryType.Book,
- },
- Metadata = DbFactory.SeriesMetadata(new List<CollectionTag>())
- };
- var g = DbFactory.Person("Existing Person", PersonRole.Publisher);
+ var s = new SeriesBuilder("Test")
+ .WithMetadata(new SeriesMetadataBuilder().Build())
+ .Build();
+ s.Library = new LibraryBuilder("Test LIb", LibraryType.Book).Build();
+
+ var g = new PersonBuilder("Existing Person", PersonRole.Publisher).Build();
_context.Series.Add(s);
_context.Person.Add(g);
@@ -829,19 +614,13 @@ public class SeriesServiceTests : AbstractDbTest
public async Task UpdateSeriesMetadata_ShouldAddNewPerson_ExistingPeople()
{
await ResetDb();
- var s = new Series()
- {
- Name = "Test",
- Library = new Library()
- {
- Name = "Test LIb",
- Type = LibraryType.Book,
- },
- Metadata = DbFactory.SeriesMetadata(new List<CollectionTag>())
- };
- var g = DbFactory.Person("Existing Person", PersonRole.Publisher);
- s.Metadata.People = new List<Person>() {DbFactory.Person("Existing Writer", PersonRole.Writer),
- DbFactory.Person("Existing Translator", PersonRole.Translator), DbFactory.Person("Existing Publisher 2", PersonRole.Publisher)};
+ var s = new SeriesBuilder("Test")
+ .WithMetadata(new SeriesMetadataBuilder().Build())
+ .Build();
+ s.Library = new LibraryBuilder("Test LIb", LibraryType.Book).Build();
+ var g = new PersonBuilder("Existing Person", PersonRole.Publisher).Build();
+ s.Metadata.People = new List<Person>() {new PersonBuilder("Existing Writer", PersonRole.Writer).Build(),
+ new PersonBuilder("Existing Translator", PersonRole.Translator).Build(), new PersonBuilder("Existing Publisher 2", PersonRole.Publisher).Build()};
_context.Series.Add(s);
_context.Person.Add(g);
@@ -871,17 +650,11 @@ public class SeriesServiceTests : AbstractDbTest
public async Task UpdateSeriesMetadata_ShouldRemoveExistingPerson()
{
await ResetDb();
- var s = new Series()
- {
- Name = "Test",
- Library = new Library()
- {
- Name = "Test LIb",
- Type = LibraryType.Book,
- },
- Metadata = DbFactory.SeriesMetadata(new List<CollectionTag>())
- };
- var g = DbFactory.Person("Existing Person", PersonRole.Publisher);
+ var s = new SeriesBuilder("Test")
+ .WithMetadata(new SeriesMetadataBuilder().Build())
+ .Build();
+ s.Library = new LibraryBuilder("Test LIb", LibraryType.Book).Build();
+ var g = new PersonBuilder("Existing Person", PersonRole.Publisher).Build();
_context.Series.Add(s);
_context.Person.Add(g);
@@ -908,17 +681,11 @@ public class SeriesServiceTests : AbstractDbTest
public async Task UpdateSeriesMetadata_ShouldLockIfTold()
{
await ResetDb();
- var s = new Series()
- {
- Name = "Test",
- Library = new Library()
- {
- Name = "Test LIb",
- Type = LibraryType.Book,
- },
- Metadata = DbFactory.SeriesMetadata(new List<CollectionTag>())
- };
- var g = DbFactory.Genre("Existing Genre");
+ var s = new SeriesBuilder("Test")
+ .WithMetadata(new SeriesMetadataBuilder().Build())
+ .Build();
+ s.Library = new LibraryBuilder("Test LIb", LibraryType.Book).Build();
+ var g = new GenreBuilder("Existing Genre").Build();
s.Metadata.Genres = new List<Genre>() {g};
s.Metadata.GenresLocked = true;
_context.Series.Add(s);
@@ -949,16 +716,10 @@ public class SeriesServiceTests : AbstractDbTest
public async Task UpdateSeriesMetadata_ShouldNotUpdateReleaseYear_IfLessThan1000()
{
await ResetDb();
- var s = new Series()
- {
- Name = "Test",
- Library = new Library()
- {
- Name = "Test LIb",
- Type = LibraryType.Book,
- },
- Metadata = DbFactory.SeriesMetadata(new List<CollectionTag>())
- };
+ var s = new SeriesBuilder("Test")
+ .WithMetadata(new SeriesMetadataBuilder().Build())
+ .Build();
+ s.Library = new LibraryBuilder("Test LIb", LibraryType.Book).Build();
_context.Series.Add(s);
await _context.SaveChangesAsync();
@@ -986,43 +747,32 @@ public class SeriesServiceTests : AbstractDbTest
private static Series CreateSeriesMock()
{
- var files = new List<MangaFile>()
- {
- EntityFactory.CreateMangaFile("Test.cbz", MangaFormat.Archive, 1)
- };
- return new Series()
- {
- Name = "Test",
- Library = new Library()
- {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- },
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("95", false, files, 1),
- EntityFactory.CreateChapter("96", false, files, 1),
- EntityFactory.CreateChapter("A Special Case", true, files, 1),
- }),
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, files, 1),
- EntityFactory.CreateChapter("2", false, files, 1),
- }),
- EntityFactory.CreateVolume("2", new List<Chapter>()
- {
- EntityFactory.CreateChapter("21", false, files, 1),
- EntityFactory.CreateChapter("22", false, files, 1),
- }),
- EntityFactory.CreateVolume("3", new List<Chapter>()
- {
- EntityFactory.CreateChapter("31", false, files, 1),
- EntityFactory.CreateChapter("32", false, files, 1),
- }),
- }
- };
+ var file = new MangaFileBuilder("Test.cbz", MangaFormat.Archive, 1).Build();
+
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("0")
+ .WithChapter(new ChapterBuilder("95").WithPages(1).WithFile(file).Build())
+ .WithChapter(new ChapterBuilder("96").WithPages(1).WithFile(file).Build())
+ .WithChapter(new ChapterBuilder("A Special Case").WithIsSpecial(true).WithFile(file).WithPages(1).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("1")
+ .WithChapter(new ChapterBuilder("1").WithPages(1).WithFile(file).Build())
+ .WithChapter(new ChapterBuilder("2").WithPages(1).WithFile(file).Build())
+ .Build())
+
+ .WithVolume(new VolumeBuilder("2")
+ .WithChapter(new ChapterBuilder("21").WithPages(1).WithFile(file).Build())
+ .WithChapter(new ChapterBuilder("22").WithPages(1).WithFile(file).Build())
+ .Build())
+
+ .WithVolume(new VolumeBuilder("3")
+ .WithChapter(new ChapterBuilder("31").WithPages(1).WithFile(file).Build())
+ .WithChapter(new ChapterBuilder("32").WithPages(1).WithFile(file).Build())
+ .Build())
+ .Build();
+ series.Library = new LibraryBuilder("Test LIb", LibraryType.Book).Build();
+
+ return series;
}
[Fact]
@@ -1049,13 +799,13 @@ public class SeriesServiceTests : AbstractDbTest
var series = CreateSeriesMock();
var files = new List<MangaFile>()
{
- EntityFactory.CreateMangaFile("Test.cbz", MangaFormat.Archive, 1)
+ new MangaFileBuilder("Test.cbz", MangaFormat.Archive, 1).Build()
};
series.Volumes[1].Chapters = new List<Chapter>()
{
- EntityFactory.CreateChapter("2", false, files, 1),
- EntityFactory.CreateChapter("1.1", false, files, 1),
- EntityFactory.CreateChapter("1.2", false, files, 1),
+ new ChapterBuilder("2").WithFiles(files).WithPages(1).Build(),
+ new ChapterBuilder("1.1").WithFiles(files).WithPages(1).Build(),
+ new ChapterBuilder("1.2").WithFiles(files).WithPages(1).Build(),
};
var firstChapter = SeriesService.GetFirstChapterForMetadata(series, false);
@@ -1082,21 +832,9 @@ public class SeriesServiceTests : AbstractDbTest
Type = LibraryType.Book,
Series = new List<Series>()
{
- new Series()
- {
- Name = "Test Series",
- Volumes = new List<Volume>(){}
- },
- new Series()
- {
- Name = "Test Series Prequels",
- Volumes = new List<Volume>(){}
- },
- new Series()
- {
- Name = "Test Series Sequels",
- Volumes = new List<Volume>(){}
- }
+ new SeriesBuilder("Test Series").Build(),
+ new SeriesBuilder("Test Series Prequels").Build(),
+ new SeriesBuilder("Test Series Sequels").Build(),
}
});
@@ -1129,21 +867,9 @@ public class SeriesServiceTests : AbstractDbTest
Type = LibraryType.Book,
Series = new List<Series>()
{
- new Series()
- {
- Name = "Test Series",
- Volumes = new List<Volume>(){}
- },
- new Series()
- {
- Name = "Test Series Prequels",
- Volumes = new List<Volume>(){}
- },
- new Series()
- {
- Name = "Test Series Sequels",
- Volumes = new List<Volume>(){}
- }
+ new SeriesBuilder("Test Series").Build(),
+ new SeriesBuilder("Test Series Prequels").Build(),
+ new SeriesBuilder("Test Series Sequels").Build(),
}
});
@@ -1183,16 +909,8 @@ public class SeriesServiceTests : AbstractDbTest
Type = LibraryType.Book,
Series = new List<Series>()
{
- new Series()
- {
- Name = "Series A",
- Volumes = new List<Volume>(){}
- },
- new Series()
- {
- Name = "Series B",
- Volumes = new List<Volume>(){}
- },
+ new SeriesBuilder("Series A").Build(),
+ new SeriesBuilder("Series B").Build(),
}
});
@@ -1236,16 +954,8 @@ public class SeriesServiceTests : AbstractDbTest
Type = LibraryType.Book,
Series = new List<Series>()
{
- new Series()
- {
- Name = "Series A",
- Volumes = new List<Volume>(){}
- },
- new Series()
- {
- Name = "Series B",
- Volumes = new List<Volume>(){}
- },
+ new SeriesBuilder("Series A").Build(),
+ new SeriesBuilder("Series B").Build(),
}
});
@@ -1289,16 +999,8 @@ public class SeriesServiceTests : AbstractDbTest
Type = LibraryType.Book,
Series = new List<Series>()
{
- new Series()
- {
- Name = "Test Series",
- Volumes = new List<Volume>(){}
- },
- new Series()
- {
- Name = "Test Series Prequels",
- Volumes = new List<Volume>(){}
- }
+ new SeriesBuilder("Test Series").Build(),
+ new SeriesBuilder("Test Series Prequels").Build(),
}
});
@@ -1342,31 +1044,11 @@ public class SeriesServiceTests : AbstractDbTest
Type = LibraryType.Book,
Series = new List<Series>()
{
- new Series()
- {
- Name = "Test Series",
- Volumes = new List<Volume>(){}
- },
- new Series()
- {
- Name = "Test Series Editions",
- Volumes = new List<Volume>(){}
- },
- new Series()
- {
- Name = "Test Series Prequels",
- Volumes = new List<Volume>(){}
- },
- new Series()
- {
- Name = "Test Series Sequels",
- Volumes = new List<Volume>(){}
- },
- new Series()
- {
- Name = "Test Series Adaption",
- Volumes = new List<Volume>(){}
- }
+ new SeriesBuilder("Test Series").Build(),
+ new SeriesBuilder("Test Series Editions").Build(),
+ new SeriesBuilder("Test Series Prequels").Build(),
+ new SeriesBuilder("Test Series Sequels").Build(),
+ new SeriesBuilder("Test Series Adaption").Build(),
}
});
await _context.SaveChangesAsync();
@@ -1390,36 +1072,12 @@ public class SeriesServiceTests : AbstractDbTest
public async Task SeriesRelation_ShouldAllowDeleteOnLibrary()
{
await ResetDb();
- var lib = new Library()
- {
- AppUsers = new List<AppUser>()
- {
- new AppUser()
- {
- UserName = "majora2007"
- }
- },
- Name = "Test LIb",
- Type = LibraryType.Book,
- Series = new List<Series>()
- {
- new Series()
- {
- Name = "Test Series",
- Volumes = new List<Volume>() { }
- },
- new Series()
- {
- Name = "Test Series Prequels",
- Volumes = new List<Volume>() { }
- },
- new Series()
- {
- Name = "Test Series Sequels",
- Volumes = new List<Volume>() { }
- }
- }
- };
+ var lib = new LibraryBuilder("Test LIb")
+ .WithSeries(new SeriesBuilder("Test Series").Build())
+ .WithSeries(new SeriesBuilder("Test Series Prequels").Build())
+ .WithSeries(new SeriesBuilder("Test Series Sequels").Build())
+ .WithAppUser(new AppUserBuilder("majora2007", string.Empty).Build())
+ .Build();
_context.Library.Add(lib);
await _context.SaveChangesAsync();
@@ -1450,86 +1108,28 @@ public class SeriesServiceTests : AbstractDbTest
public async Task SeriesRelation_ShouldAllowDeleteOnLibrary_WhenSeriesCrossLibraries()
{
await ResetDb();
- var lib1 = new Library()
- {
- AppUsers = new List<AppUser>()
- {
- new AppUser()
- {
- UserName = "majora2007"
- }
- },
- Name = "Test LIb",
- Type = LibraryType.Book,
- Series = new List<Series>()
- {
- new Series()
- {
- Name = "Test Series",
- Volumes = new List<Volume>()
- {
- new Volume()
- {
- Chapters = new List<Chapter>()
- {
- new Chapter()
- {
- Files = new List<MangaFile>()
- {
- new MangaFile()
- {
- Pages = 1,
- FilePath = "fake file"
- }
- }
- }
- }
- }
- }
- },
- new Series()
- {
- Name = "Test Series Prequels",
- Volumes = new List<Volume>() { }
- },
- new Series()
- {
- Name = "Test Series Sequels",
- Volumes = new List<Volume>() { }
- }
- }
- };
+ var lib1 = new LibraryBuilder("Test LIb")
+ .WithSeries(new SeriesBuilder("Test Series")
+ .WithVolume(new VolumeBuilder("0")
+ .WithChapter(new ChapterBuilder("1").WithFile(
+ new MangaFileBuilder($"{DataDirectory}1.zip", MangaFormat.Archive)
+ .WithPages(1)
+ .Build()
+ ).Build())
+ .Build())
+ .Build())
+ .WithSeries(new SeriesBuilder("Test Series Prequels").Build())
+ .WithSeries(new SeriesBuilder("Test Series Sequels").Build())
+ .WithAppUser(new AppUserBuilder("majora2007", string.Empty).Build())
+ .Build();
_context.Library.Add(lib1);
- var lib2 = new Library()
- {
- AppUsers = new List<AppUser>()
- {
- new AppUser()
- {
- UserName = "majora2007"
- }
- },
- Name = "Test LIb 2",
- Type = LibraryType.Book,
- Series = new List<Series>()
- {
- new Series()
- {
- Name = "Test Series 2",
- Volumes = new List<Volume>() { }
- },
- new Series()
- {
- Name = "Test Series Prequels 2",
- Volumes = new List<Volume>() { }
- },
- new Series()
- {
- Name = "Test Series Sequels 2",
- Volumes = new List<Volume>() { }
- }
- }
- };
+
+ var lib2 = new LibraryBuilder("Test LIb 2", LibraryType.Book)
+ .WithSeries(new SeriesBuilder("Test Series 2").Build())
+ .WithSeries(new SeriesBuilder("Test Series Prequels 2").Build())
+ .WithSeries(new SeriesBuilder("Test Series Prequels 2").Build())// TODO: Is this a bug
+ .WithAppUser(new AppUserBuilder("majora2007", string.Empty).Build())
+ .Build();
_context.Library.Add(lib2);
await _context.SaveChangesAsync();
@@ -1559,7 +1159,81 @@ public class SeriesServiceTests : AbstractDbTest
#region UpdateRelatedList
+ // TODO: Implement UpdateRelatedList
+
+ #endregion
+
+ #region FormatChapterName
+
+ [Theory]
+ [InlineData(LibraryType.Manga, false, "Chapter")]
+ [InlineData(LibraryType.Comic, false, "Issue")]
+ [InlineData(LibraryType.Comic, true, "Issue #")]
+ [InlineData(LibraryType.Book, false, "Book")]
+ public void FormatChapterNameTest(LibraryType libraryType, bool withHash, string expected )
+ {
+ Assert.Equal(expected, SeriesService.FormatChapterName(libraryType, withHash));
+ }
+
+ #endregion
+
+ #region FormatChapterTitle
+
+ [Fact]
+ public void FormatChapterTitle_Manga_NonSpecial()
+ {
+ var chapter = new ChapterBuilder("1").WithTitle("Some title").WithIsSpecial(false).Build();
+ Assert.Equal("Chapter Some title", SeriesService.FormatChapterTitle(chapter, LibraryType.Manga, false));
+ }
+
+ [Fact]
+ public void FormatChapterTitle_Manga_Special()
+ {
+ var chapter = new ChapterBuilder("1").WithTitle("Some title").WithIsSpecial(true).Build();
+ Assert.Equal("Some title", SeriesService.FormatChapterTitle(chapter, LibraryType.Manga, false));
+ }
+
+ [Fact]
+ public void FormatChapterTitle_Comic_NonSpecial_WithoutHash()
+ {
+ var chapter = new ChapterBuilder("1").WithTitle("Some title").WithIsSpecial(false).Build();
+ Assert.Equal("Issue Some title", SeriesService.FormatChapterTitle(chapter, LibraryType.Comic, false));
+ }
+
+ [Fact]
+ public void FormatChapterTitle_Comic_Special_WithoutHash()
+ {
+ var chapter = new ChapterBuilder("1").WithTitle("Some title").WithIsSpecial(true).Build();
+ Assert.Equal("Some title", SeriesService.FormatChapterTitle(chapter, LibraryType.Comic, false));
+ }
+
+ [Fact]
+ public void FormatChapterTitle_Comic_NonSpecial_WithHash()
+ {
+ var chapter = new ChapterBuilder("1").WithTitle("Some title").WithIsSpecial(false).Build();
+ Assert.Equal("Issue #Some title", SeriesService.FormatChapterTitle(chapter, LibraryType.Comic, true));
+ }
+ [Fact]
+ public void FormatChapterTitle_Comic_Special_WithHash()
+ {
+ var chapter = new ChapterBuilder("1").WithTitle("Some title").WithIsSpecial(true).Build();
+ Assert.Equal("Some title", SeriesService.FormatChapterTitle(chapter, LibraryType.Comic, true));
+ }
+
+ [Fact]
+ public void FormatChapterTitle_Book_NonSpecial()
+ {
+ var chapter = new ChapterBuilder("1").WithTitle("Some title").WithIsSpecial(false).Build();
+ Assert.Equal("Book Some title", SeriesService.FormatChapterTitle(chapter, LibraryType.Book, false));
+ }
+
+ [Fact]
+ public void FormatChapterTitle_Book_Special()
+ {
+ var chapter = new ChapterBuilder("1").WithTitle("Some title").WithIsSpecial(true).Build();
+ Assert.Equal("Some title", SeriesService.FormatChapterTitle(chapter, LibraryType.Book, false));
+ }
#endregion
}
diff --git a/API.Tests/Services/SiteThemeServiceTests.cs b/API.Tests/Services/SiteThemeServiceTests.cs
index 2ab523e59..8bf32a0c1 100644
--- a/API.Tests/Services/SiteThemeServiceTests.cs
+++ b/API.Tests/Services/SiteThemeServiceTests.cs
@@ -1,138 +1,71 @@
-using System.Collections.Generic;
-using System.Data.Common;
-using System.IO.Abstractions.TestingHelpers;
+using System.IO.Abstractions.TestingHelpers;
using System.Linq;
using System.Threading.Tasks;
using API.Data;
using API.Entities;
-using API.Entities.Enums;
using API.Entities.Enums.Theme;
-using API.Entities.Enums.UserPreferences;
-using API.Helpers;
+using API.Extensions;
using API.Services;
using API.Services.Tasks;
using API.SignalR;
-using AutoMapper;
using Kavita.Common;
-using Microsoft.AspNetCore.SignalR;
-using Microsoft.Data.Sqlite;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.Extensions.Logging;
using NSubstitute;
using Xunit;
+using Xunit.Abstractions;
namespace API.Tests.Services;
-public class SiteThemeServiceTests
+
+public abstract class SiteThemeServiceTest : AbstractDbTest
{
- private readonly ILogger<ThemeService> _logger = Substitute.For<ILogger<ThemeService>>();
+ private readonly ITestOutputHelper _testOutputHelper;
private readonly IEventHub _messageHub = Substitute.For<IEventHub>();
- private readonly DbConnection _connection;
- private readonly DataContext _context;
- private readonly IUnitOfWork _unitOfWork;
-
- private const string CacheDirectory = "C:/kavita/config/cache/";
- private const string CoverImageDirectory = "C:/kavita/config/covers/";
- private const string BackupDirectory = "C:/kavita/config/backups/";
- private const string BookmarkDirectory = "C:/kavita/config/bookmarks/";
- private const string SiteThemeDirectory = "C:/kavita/config/themes/";
- public SiteThemeServiceTests()
+ protected SiteThemeServiceTest(ITestOutputHelper testOutputHelper) : base()
{
- var contextOptions = new DbContextOptionsBuilder()
- .UseSqlite(CreateInMemoryDatabase())
- .Options;
- _connection = RelationalOptionsExtension.Extract(contextOptions).Connection;
-
- _context = new DataContext(contextOptions);
- Task.Run(SeedDb).GetAwaiter().GetResult();
-
- var config = new MapperConfiguration(cfg => cfg.AddProfile<AutoMapperProfiles>());
- var mapper = config.CreateMapper();
- _unitOfWork = new UnitOfWork(_context, mapper, null);
+ _testOutputHelper = testOutputHelper;
}
- #region Setup
-
- private static DbConnection CreateInMemoryDatabase()
+ protected override async Task ResetDb()
{
- var connection = new SqliteConnection("Filename=:memory:");
-
- connection.Open();
-
- return connection;
+ _context.SiteTheme.RemoveRange(_context.SiteTheme);
+ await _context.SaveChangesAsync();
+ // Recreate defaults
+ await Seed.SeedThemes(_context);
}
- private async Task<bool> SeedDb()
+ [Fact]
+ public async Task UpdateDefault_ShouldThrowOnInvalidId()
{
- await _context.Database.MigrateAsync();
+ await ResetDb();
+ _testOutputHelper.WriteLine($"[UpdateDefault_ShouldThrowOnInvalidId] All Themes: {(await _unitOfWork.SiteThemeRepository.GetThemes()).Count(t => t.IsDefault)}");
var filesystem = CreateFileSystem();
+ filesystem.AddFile($"{SiteThemeDirectory}custom.css", new MockFileData("123"));
+ var ds = new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), filesystem);
+ var siteThemeService = new ThemeService(ds, _unitOfWork, _messageHub);
- await Seed.SeedSettings(_context, new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), filesystem));
-
- var setting = await _context.ServerSetting.Where(s => s.Key == ServerSettingKey.CacheDirectory).SingleAsync();
- setting.Value = CacheDirectory;
-
- setting = await _context.ServerSetting.Where(s => s.Key == ServerSettingKey.BackupDirectory).SingleAsync();
- setting.Value = BackupDirectory;
-
- setting = await _context.ServerSetting.Where(s => s.Key == ServerSettingKey.BookmarkDirectory).SingleAsync();
- setting.Value = BookmarkDirectory;
-
- _context.ServerSetting.Update(setting);
-
- _context.AppUser.Add(new AppUser()
+ _context.SiteTheme.Add(new SiteTheme()
{
- UserName = "Joe",
- UserPreferences = new AppUserPreferences
- {
- Theme = Seed.DefaultThemes[0]
- }
+ Name = "Custom",
+ NormalizedName = "Custom".ToNormalized(),
+ Provider = ThemeProvider.User,
+ FileName = "custom.css",
+ IsDefault = false
});
+ await _context.SaveChangesAsync();
- _context.Library.Add(new Library()
- {
- Name = "Manga",
- Folders = new List<FolderPath>()
- {
- new FolderPath()
- {
- Path = "C:/data/"
- }
- }
- });
- return await _context.SaveChangesAsync() > 0;
- }
+ var ex = await Assert.ThrowsAsync<KavitaException>(async () => await siteThemeService.UpdateDefault(10));
+ Assert.Equal("Theme file missing or invalid", ex.Message);
- private static MockFileSystem CreateFileSystem()
- {
- var fileSystem = new MockFileSystem();
- fileSystem.Directory.SetCurrentDirectory("C:/kavita/");
- fileSystem.AddDirectory("C:/kavita/config/");
- fileSystem.AddDirectory(CacheDirectory);
- fileSystem.AddDirectory(CoverImageDirectory);
- fileSystem.AddDirectory(BackupDirectory);
- fileSystem.AddDirectory(BookmarkDirectory);
- fileSystem.AddDirectory(SiteThemeDirectory);
- fileSystem.AddDirectory("C:/data/");
-
- return fileSystem;
}
- private async Task ResetDb()
- {
- _context.SiteTheme.RemoveRange(_context.SiteTheme);
- await _context.SaveChangesAsync();
- }
-
- #endregion
-
[Fact]
public async Task Scan_ShouldFindCustomFile()
{
await ResetDb();
+ _testOutputHelper.WriteLine($"[Scan_ShouldOnlyInsertOnceOnSecondScan] All Themes: {(await _unitOfWork.SiteThemeRepository.GetThemes()).Count(t => t.IsDefault)}");
var filesystem = CreateFileSystem();
filesystem.AddFile($"{SiteThemeDirectory}custom.css", new MockFileData(""));
var ds = new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), filesystem);
@@ -146,6 +79,8 @@ public class SiteThemeServiceTests
public async Task Scan_ShouldOnlyInsertOnceOnSecondScan()
{
await ResetDb();
+ _testOutputHelper.WriteLine(
+ $"[Scan_ShouldOnlyInsertOnceOnSecondScan] All Themes: {(await _unitOfWork.SiteThemeRepository.GetThemes()).Count(t => t.IsDefault)}");
var filesystem = CreateFileSystem();
filesystem.AddFile($"{SiteThemeDirectory}custom.css", new MockFileData(""));
var ds = new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), filesystem);
@@ -157,7 +92,8 @@ public class SiteThemeServiceTests
await siteThemeService.Scan();
var customThemes = (await _unitOfWork.SiteThemeRepository.GetThemeDtos()).Where(t =>
- API.Services.Tasks.Scanner.Parser.Parser.Normalize(t.Name).Equals(API.Services.Tasks.Scanner.Parser.Parser.Normalize("custom")));
+ t.Name.ToNormalized().Equals("custom".ToNormalized()));
+
Assert.Single(customThemes);
}
@@ -165,6 +101,7 @@ public class SiteThemeServiceTests
public async Task Scan_ShouldDeleteWhenFileDoesntExistOnSecondScan()
{
await ResetDb();
+ _testOutputHelper.WriteLine($"[Scan_ShouldDeleteWhenFileDoesntExistOnSecondScan] All Themes: {(await _unitOfWork.SiteThemeRepository.GetThemes()).Count(t => t.IsDefault)}");
var filesystem = CreateFileSystem();
filesystem.AddFile($"{SiteThemeDirectory}custom.css", new MockFileData(""));
var ds = new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), filesystem);
@@ -176,16 +113,17 @@ public class SiteThemeServiceTests
filesystem.RemoveFile($"{SiteThemeDirectory}custom.css");
await siteThemeService.Scan();
- var customThemes = (await _unitOfWork.SiteThemeRepository.GetThemeDtos()).Where(t =>
- API.Services.Tasks.Scanner.Parser.Parser.Normalize(t.Name).Equals(API.Services.Tasks.Scanner.Parser.Parser.Normalize("custom")));
+ var themes = (await _unitOfWork.SiteThemeRepository.GetThemeDtos());
- Assert.Empty(customThemes);
+ Assert.Equal(0, themes.Count(t =>
+ t.Name.ToNormalized().Equals("custom".ToNormalized())));
}
[Fact]
public async Task GetContent_ShouldReturnContent()
{
await ResetDb();
+ _testOutputHelper.WriteLine($"[GetContent_ShouldReturnContent] All Themes: {(await _unitOfWork.SiteThemeRepository.GetThemes()).Count(t => t.IsDefault)}");
var filesystem = CreateFileSystem();
filesystem.AddFile($"{SiteThemeDirectory}custom.css", new MockFileData("123"));
var ds = new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), filesystem);
@@ -194,7 +132,7 @@ public class SiteThemeServiceTests
_context.SiteTheme.Add(new SiteTheme()
{
Name = "Custom",
- NormalizedName = API.Services.Tasks.Scanner.Parser.Parser.Normalize("Custom"),
+ NormalizedName = "Custom".ToNormalized(),
Provider = ThemeProvider.User,
FileName = "custom.css",
IsDefault = false
@@ -211,6 +149,7 @@ public class SiteThemeServiceTests
public async Task UpdateDefault_ShouldHaveOneDefault()
{
await ResetDb();
+ _testOutputHelper.WriteLine($"[UpdateDefault_ShouldHaveOneDefault] All Themes: {(await _unitOfWork.SiteThemeRepository.GetThemes()).Count(t => t.IsDefault)}");
var filesystem = CreateFileSystem();
filesystem.AddFile($"{SiteThemeDirectory}custom.css", new MockFileData("123"));
var ds = new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), filesystem);
@@ -219,7 +158,7 @@ public class SiteThemeServiceTests
_context.SiteTheme.Add(new SiteTheme()
{
Name = "Custom",
- NormalizedName = API.Services.Tasks.Scanner.Parser.Parser.Normalize("Custom"),
+ NormalizedName = "Custom".ToNormalized(),
Provider = ThemeProvider.User,
FileName = "custom.css",
IsDefault = false
@@ -228,6 +167,7 @@ public class SiteThemeServiceTests
var customTheme = (await _unitOfWork.SiteThemeRepository.GetThemeDtoByName("Custom"));
+ Assert.NotNull(customTheme);
await siteThemeService.UpdateDefault(customTheme.Id);
@@ -235,31 +175,5 @@ public class SiteThemeServiceTests
Assert.Equal(customTheme.Id, (await _unitOfWork.SiteThemeRepository.GetDefaultTheme()).Id);
}
- [Fact]
- public async Task UpdateDefault_ShouldThrowOnInvalidId()
- {
- await ResetDb();
- var filesystem = CreateFileSystem();
- filesystem.AddFile($"{SiteThemeDirectory}custom.css", new MockFileData("123"));
- var ds = new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), filesystem);
- var siteThemeService = new ThemeService(ds, _unitOfWork, _messageHub);
-
- _context.SiteTheme.Add(new SiteTheme()
- {
- Name = "Custom",
- NormalizedName = API.Services.Tasks.Scanner.Parser.Parser.Normalize("Custom"),
- Provider = ThemeProvider.User,
- FileName = "custom.css",
- IsDefault = false
- });
- await _context.SaveChangesAsync();
-
-
-
- var ex = await Assert.ThrowsAsync<KavitaException>(async () => await siteThemeService.UpdateDefault(10));
- Assert.Equal("Theme file missing or invalid", ex.Message);
-
- }
-
-
}
+
diff --git a/API.Tests/Services/TachiyomiServiceTests.cs b/API.Tests/Services/TachiyomiServiceTests.cs
index f623890d6..45ac36495 100644
--- a/API.Tests/Services/TachiyomiServiceTests.cs
+++ b/API.Tests/Services/TachiyomiServiceTests.cs
@@ -1,4 +1,8 @@
-namespace API.Tests.Services;
+using API.Extensions;
+using API.Helpers.Builders;
+using API.Services.Tasks;
+
+namespace API.Tests.Services;
using System.Collections.Generic;
using System.Data.Common;
using System.IO.Abstractions.TestingHelpers;
@@ -24,6 +28,8 @@ public class TachiyomiServiceTests
private readonly IUnitOfWork _unitOfWork;
private readonly IMapper _mapper;
private readonly DataContext _context;
+ private readonly ReaderService _readerService;
+ private readonly TachiyomiService _tachiyomiService;
private const string CacheDirectory = "C:/kavita/config/cache/";
private const string CoverImageDirectory = "C:/kavita/config/covers/";
private const string BackupDirectory = "C:/kavita/config/backups/";
@@ -41,6 +47,10 @@ public class TachiyomiServiceTests
_mapper = config.CreateMapper();
_unitOfWork = new UnitOfWork(_context, _mapper, null);
+ _readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(),
+ Substitute.For<IEventHub>(), Substitute.For<IImageService>(),
+ new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), new MockFileSystem()));
+ _tachiyomiService = new TachiyomiService(_unitOfWork, _mapper, Substitute.For<ILogger<ReaderService>>(), _readerService);
}
@@ -72,10 +82,11 @@ public class TachiyomiServiceTests
_context.ServerSetting.Update(setting);
- _context.Library.Add(new Library()
- {
- Name = "Manga", Folders = new List<FolderPath>() {new FolderPath() {Path = "C:/data/"}}
- });
+ _context.Library.Add(
+ new LibraryBuilder("Manga")
+ .WithFolderPath(new FolderPathBuilder("C:/data/").Build())
+ .Build()
+ );
return await _context.SaveChangesAsync() > 0;
}
@@ -111,39 +122,29 @@ public class TachiyomiServiceTests
{
await ResetDb();
- var series = new Series
- {
- Name = "Test",
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("95", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("96", false, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", true, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("2", new List<Chapter>()
- {
- EntityFactory.CreateChapter("3", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("4", false, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("3", new List<Chapter>()
- {
- EntityFactory.CreateChapter("31", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("32", false, new List<MangaFile>(), 1),
- }),
- },
- Pages = 7
- };
- var library = new Library()
- {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- Series = new List<Series>() { series }
- };
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("0")
+ .WithChapter(new ChapterBuilder("95").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("96").WithPages(1).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("1")
+ .WithChapter(new ChapterBuilder("1").WithIsSpecial(true).WithPages(1).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("2")
+ .WithChapter(new ChapterBuilder("3").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("4").WithPages(1).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("3")
+ .WithChapter(new ChapterBuilder("31").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("32").WithPages(1).Build())
+ .Build())
+ .WithPages(7)
+ .Build();
+
+ var library = new LibraryBuilder("Test LIb", LibraryType.Manga)
+ .WithSeries(series)
+ .Build();
+
_context.AppUser.Add(new AppUser()
{
@@ -156,10 +157,7 @@ public class TachiyomiServiceTests
});
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
- var tachiyomiService = new TachiyomiService(_unitOfWork, _mapper, Substitute.For<ILogger<ReaderService>>(), readerService);
-
- var latestChapter = await tachiyomiService.GetLatestChapter(1, 1);
+ var latestChapter = await _tachiyomiService.GetLatestChapter(1, 1);
Assert.Null(latestChapter);
}
@@ -169,39 +167,28 @@ public class TachiyomiServiceTests
{
await ResetDb();
- var series = new Series
- {
- Name = "Test",
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("95", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("96", false, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", true, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("2", new List<Chapter>()
- {
- EntityFactory.CreateChapter("3", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("4", false, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("3", new List<Chapter>()
- {
- EntityFactory.CreateChapter("31", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("32", false, new List<MangaFile>(), 1),
- }),
- },
- Pages = 7
- };
- var library = new Library()
- {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- Series = new List<Series>() { series }
- };
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("0")
+ .WithChapter(new ChapterBuilder("95").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("96").WithPages(1).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("1")
+ .WithChapter(new ChapterBuilder("1").WithIsSpecial(true).WithPages(1).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("2")
+ .WithChapter(new ChapterBuilder("3").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("4").WithPages(1).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("3")
+ .WithChapter(new ChapterBuilder("31").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("32").WithPages(1).Build())
+ .Build())
+ .WithPages(7)
+ .Build();
+
+ var library = new LibraryBuilder("Test LIb", LibraryType.Manga)
+ .WithSeries(series)
+ .Build();
_context.AppUser.Add(new AppUser()
{
@@ -214,16 +201,14 @@ public class TachiyomiServiceTests
});
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
- var tachiyomiService = new TachiyomiService(_unitOfWork, _mapper, Substitute.For<ILogger<ReaderService>>(), readerService);
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync("majora2007", AppUserIncludes.Progress);
- await readerService.MarkSeriesAsRead(user,1);
+ await _readerService.MarkSeriesAsRead(user,1);
await _context.SaveChangesAsync();
- var latestChapter = await tachiyomiService.GetLatestChapter(1, 1);
+ var latestChapter = await _tachiyomiService.GetLatestChapter(1, 1);
Assert.Equal("96", latestChapter.Number);
}
@@ -233,39 +218,28 @@ public class TachiyomiServiceTests
{
await ResetDb();
- var series = new Series
- {
- Name = "Test",
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("95", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("96", false, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("2", new List<Chapter>()
- {
- EntityFactory.CreateChapter("21", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("23", false, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("3", new List<Chapter>()
- {
- EntityFactory.CreateChapter("31", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("32", false, new List<MangaFile>(), 1),
- }),
- },
- Pages = 7
- };
- var library = new Library()
- {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- Series = new List<Series>() { series }
- };
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("0")
+ .WithChapter(new ChapterBuilder("95").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("96").WithPages(1).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("1")
+ .WithChapter(new ChapterBuilder("1").WithPages(1).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("2")
+ .WithChapter(new ChapterBuilder("21").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("22").WithPages(1).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("3")
+ .WithChapter(new ChapterBuilder("31").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("32").WithPages(1).Build())
+ .Build())
+ .WithPages(7)
+ .Build();
+
+ var library = new LibraryBuilder("Test LIb", LibraryType.Manga)
+ .WithSeries(series)
+ .Build();
_context.AppUser.Add(new AppUser()
{
@@ -278,16 +252,14 @@ public class TachiyomiServiceTests
});
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
- var tachiyomiService = new TachiyomiService(_unitOfWork, _mapper, Substitute.For<ILogger<ReaderService>>(), readerService);
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync("majora2007", AppUserIncludes.Progress);
- await tachiyomiService.MarkChaptersUntilAsRead(user,1,21);
+ await _tachiyomiService.MarkChaptersUntilAsRead(user,1,21);
await _context.SaveChangesAsync();
- var latestChapter = await tachiyomiService.GetLatestChapter(1, 1);
+ var latestChapter = await _tachiyomiService.GetLatestChapter(1, 1);
Assert.Equal("21", latestChapter.Number);
}
@@ -296,39 +268,28 @@ public class TachiyomiServiceTests
{
await ResetDb();
- var series = new Series
- {
- Name = "Test",
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("95", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("96", false, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", true, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("2", new List<Chapter>()
- {
- EntityFactory.CreateChapter("21", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("23", false, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("3", new List<Chapter>()
- {
- EntityFactory.CreateChapter("31", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("32", false, new List<MangaFile>(), 1),
- }),
- },
- Pages = 7
- };
- var library = new Library()
- {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- Series = new List<Series>() { series }
- };
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("0")
+ .WithChapter(new ChapterBuilder("95").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("96").WithPages(1).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("1")
+ .WithChapter(new ChapterBuilder("1").WithIsSpecial(true).WithPages(1).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("2")
+ .WithChapter(new ChapterBuilder("21").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("22").WithPages(1).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("3")
+ .WithChapter(new ChapterBuilder("31").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("32").WithPages(1).Build())
+ .Build())
+ .WithPages(7)
+ .Build();
+
+ var library = new LibraryBuilder("Test LIb", LibraryType.Manga)
+ .WithSeries(series)
+ .Build();
_context.AppUser.Add(new AppUser()
{
@@ -341,17 +302,15 @@ public class TachiyomiServiceTests
});
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
- var tachiyomiService = new TachiyomiService(_unitOfWork, _mapper, Substitute.For<ILogger<ReaderService>>(), readerService);
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync("majora2007", AppUserIncludes.Progress);
- await tachiyomiService.MarkChaptersUntilAsRead(user,1,1/10_000F);
+ await _tachiyomiService.MarkChaptersUntilAsRead(user,1,1/10_000F);
await _context.SaveChangesAsync();
- var latestChapter = await tachiyomiService.GetLatestChapter(1, 1);
+ var latestChapter = await _tachiyomiService.GetLatestChapter(1, 1);
Assert.Equal("0.0001", latestChapter.Number);
}
@@ -360,32 +319,22 @@ public class TachiyomiServiceTests
{
await ResetDb();
- var series = new Series
- {
- Name = "Test",
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("0", false, new List<MangaFile>(), 199),
- }),
- EntityFactory.CreateVolume("2", new List<Chapter>()
- {
- EntityFactory.CreateChapter("0", false, new List<MangaFile>(), 192),
- }),
- EntityFactory.CreateVolume("3", new List<Chapter>()
- {
- EntityFactory.CreateChapter("0", false, new List<MangaFile>(), 255),
- }),
- },
- Pages = 646
- };
- var library = new Library()
- {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- Series = new List<Series>() { series }
- };
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("1")
+ .WithChapter(new ChapterBuilder("0").WithPages(199).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("2")
+ .WithChapter(new ChapterBuilder("0").WithPages(192).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("3")
+ .WithChapter(new ChapterBuilder("0").WithPages(255).Build())
+ .Build())
+ .WithPages(646)
+ .Build();
+
+ var library = new LibraryBuilder("Test LIb", LibraryType.Manga)
+ .WithSeries(series)
+ .Build();
_context.AppUser.Add(new AppUser()
{
@@ -398,17 +347,15 @@ public class TachiyomiServiceTests
});
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
- var tachiyomiService = new TachiyomiService(_unitOfWork, _mapper, Substitute.For<ILogger<ReaderService>>(), readerService);
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync("majora2007", AppUserIncludes.Progress);
- await readerService.MarkSeriesAsRead(user, 1);
+ await _readerService.MarkSeriesAsRead(user, 1);
await _context.SaveChangesAsync();
- var latestChapter = await tachiyomiService.GetLatestChapter(1, 1);
+ var latestChapter = await _tachiyomiService.GetLatestChapter(1, 1);
Assert.Equal("0.0003", latestChapter.Number);
}
@@ -418,37 +365,26 @@ public class TachiyomiServiceTests
{
await ResetDb();
- var series = new Series
- {
- Name = "Test",
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("95", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("96", false, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("1997", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("2002", new List<Chapter>()
- {
- EntityFactory.CreateChapter("2", false, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("2005", new List<Chapter>()
- {
- EntityFactory.CreateChapter("3", false, new List<MangaFile>(), 1),
- }),
- },
- Pages = 7
- };
- var library = new Library()
- {
- Name = "Test LIb",
- Type = LibraryType.Comic,
- Series = new List<Series>() { series }
- };
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("0")
+ .WithChapter(new ChapterBuilder("95").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("96").WithPages(1).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("1997")
+ .WithChapter(new ChapterBuilder("1").WithPages(1).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("2002")
+ .WithChapter(new ChapterBuilder("2").WithPages(1).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("2005")
+ .WithChapter(new ChapterBuilder("3").WithPages(1).Build())
+ .Build())
+ .WithPages(7)
+ .Build();
+
+ var library = new LibraryBuilder("Test LIb", LibraryType.Manga)
+ .WithSeries(series)
+ .Build();
_context.AppUser.Add(new AppUser()
{
@@ -461,17 +397,14 @@ public class TachiyomiServiceTests
});
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
- var tachiyomiService = new TachiyomiService(_unitOfWork, _mapper, Substitute.For<ILogger<ReaderService>>(), readerService);
-
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync("majora2007", AppUserIncludes.Progress);
- await tachiyomiService.MarkChaptersUntilAsRead(user,1,2002/10_000F);
+ await _tachiyomiService.MarkChaptersUntilAsRead(user,1,2002/10_000F);
await _context.SaveChangesAsync();
- var latestChapter = await tachiyomiService.GetLatestChapter(1, 1);
+ var latestChapter = await _tachiyomiService.GetLatestChapter(1, 1);
Assert.Equal("0.2002", latestChapter.Number);
}
@@ -485,39 +418,28 @@ public class TachiyomiServiceTests
{
await ResetDb();
- var series = new Series
- {
- Name = "Test",
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("95", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("96", false, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", true, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("2", new List<Chapter>()
- {
- EntityFactory.CreateChapter("3", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("4", false, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("3", new List<Chapter>()
- {
- EntityFactory.CreateChapter("31", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("32", false, new List<MangaFile>(), 1),
- }),
- },
- Pages = 7
- };
- var library = new Library()
- {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- Series = new List<Series>() { series }
- };
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("0")
+ .WithChapter(new ChapterBuilder("95").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("96").WithPages(1).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("1")
+ .WithChapter(new ChapterBuilder("1").WithIsSpecial(true).WithPages(1).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("2")
+ .WithChapter(new ChapterBuilder("3").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("4").WithPages(1).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("3")
+ .WithChapter(new ChapterBuilder("31").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("32").WithPages(1).Build())
+ .Build())
+ .WithPages(7)
+ .Build();
+
+ var library = new LibraryBuilder("Test LIb", LibraryType.Manga)
+ .WithSeries(series)
+ .Build();
_context.AppUser.Add(new AppUser()
{
@@ -530,10 +452,7 @@ public class TachiyomiServiceTests
});
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
- var tachiyomiService = new TachiyomiService(_unitOfWork, _mapper, Substitute.For<ILogger<ReaderService>>(), readerService);
-
- var latestChapter = await tachiyomiService.GetLatestChapter(1, 1);
+ var latestChapter = await _tachiyomiService.GetLatestChapter(1, 1);
Assert.Null(latestChapter);
}
@@ -542,39 +461,28 @@ public class TachiyomiServiceTests
{
await ResetDb();
- var series = new Series
- {
- Name = "Test",
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("95", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("96", false, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", true, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("2", new List<Chapter>()
- {
- EntityFactory.CreateChapter("3", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("4", false, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("3", new List<Chapter>()
- {
- EntityFactory.CreateChapter("31", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("32", false, new List<MangaFile>(), 1),
- }),
- },
- Pages = 7
- };
- var library = new Library()
- {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- Series = new List<Series>() { series }
- };
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("0")
+ .WithChapter(new ChapterBuilder("95").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("96").WithPages(1).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("1")
+ .WithChapter(new ChapterBuilder("1").WithIsSpecial(true).WithPages(1).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("2")
+ .WithChapter(new ChapterBuilder("3").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("4").WithPages(1).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("3")
+ .WithChapter(new ChapterBuilder("31").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("32").WithPages(1).Build())
+ .Build())
+ .WithPages(7)
+ .Build();
+
+ var library = new LibraryBuilder("Test LIb", LibraryType.Manga)
+ .WithSeries(series)
+ .Build();
_context.AppUser.Add(new AppUser()
{
@@ -587,16 +495,13 @@ public class TachiyomiServiceTests
});
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
- var tachiyomiService = new TachiyomiService(_unitOfWork, _mapper, Substitute.For<ILogger<ReaderService>>(), readerService);
-
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync("majora2007", AppUserIncludes.Progress);
- await readerService.MarkSeriesAsRead(user,1);
+ await _readerService.MarkSeriesAsRead(user,1);
await _context.SaveChangesAsync();
- var latestChapter = await tachiyomiService.GetLatestChapter(1, 1);
+ var latestChapter = await _tachiyomiService.GetLatestChapter(1, 1);
Assert.Equal("96", latestChapter.Number);
}
@@ -606,39 +511,28 @@ public class TachiyomiServiceTests
{
await ResetDb();
- var series = new Series
- {
- Name = "Test",
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("95", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("96", false, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", false, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("2", new List<Chapter>()
- {
- EntityFactory.CreateChapter("21", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("23", false, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("3", new List<Chapter>()
- {
- EntityFactory.CreateChapter("31", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("32", false, new List<MangaFile>(), 1),
- }),
- },
- Pages = 7
- };
- var library = new Library()
- {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- Series = new List<Series>() { series }
- };
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("0")
+ .WithChapter(new ChapterBuilder("95").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("96").WithPages(1).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("1")
+ .WithChapter(new ChapterBuilder("1").WithPages(1).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("2")
+ .WithChapter(new ChapterBuilder("21").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("23").WithPages(1).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("3")
+ .WithChapter(new ChapterBuilder("31").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("32").WithPages(1).Build())
+ .Build())
+ .WithPages(7)
+ .Build();
+
+ var library = new LibraryBuilder("Test LIb", LibraryType.Manga)
+ .WithSeries(series)
+ .Build();
_context.AppUser.Add(new AppUser()
{
@@ -651,16 +545,13 @@ public class TachiyomiServiceTests
});
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
- var tachiyomiService = new TachiyomiService(_unitOfWork, _mapper, Substitute.For<ILogger<ReaderService>>(), readerService);
-
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync("majora2007", AppUserIncludes.Progress);
- await tachiyomiService.MarkChaptersUntilAsRead(user,1,21);
+ await _tachiyomiService.MarkChaptersUntilAsRead(user,1,21);
await _context.SaveChangesAsync();
- var latestChapter = await tachiyomiService.GetLatestChapter(1, 1);
+ var latestChapter = await _tachiyomiService.GetLatestChapter(1, 1);
Assert.Equal("21", latestChapter.Number);
}
@@ -668,40 +559,28 @@ public class TachiyomiServiceTests
public async Task MarkChaptersUntilAsRead_ShouldReturnEncodedVolume_Progress()
{
await ResetDb();
-
- var series = new Series
- {
- Name = "Test",
- Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("0", new List<Chapter>()
- {
- EntityFactory.CreateChapter("95", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("96", false, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("1", new List<Chapter>()
- {
- EntityFactory.CreateChapter("1", true, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("2", new List<Chapter>()
- {
- EntityFactory.CreateChapter("21", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("23", false, new List<MangaFile>(), 1),
- }),
- EntityFactory.CreateVolume("3", new List<Chapter>()
- {
- EntityFactory.CreateChapter("31", false, new List<MangaFile>(), 1),
- EntityFactory.CreateChapter("32", false, new List<MangaFile>(), 1),
- }),
- },
- Pages = 7
- };
- var library = new Library()
- {
- Name = "Test LIb",
- Type = LibraryType.Manga,
- Series = new List<Series>() { series }
- };
+ var series = new SeriesBuilder("Test")
+ .WithVolume(new VolumeBuilder("0")
+ .WithChapter(new ChapterBuilder("95").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("96").WithPages(1).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("1")
+ .WithChapter(new ChapterBuilder("1").WithIsSpecial(true).WithPages(1).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("2")
+ .WithChapter(new ChapterBuilder("21").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("23").WithPages(1).Build())
+ .Build())
+ .WithVolume(new VolumeBuilder("3")
+ .WithChapter(new ChapterBuilder("31").WithPages(1).Build())
+ .WithChapter(new ChapterBuilder("32").WithPages(1).Build())
+ .Build())
+ .WithPages(7)
+ .Build();
+
+ var library = new LibraryBuilder("Test LIb", LibraryType.Manga)
+ .WithSeries(series)
+ .Build();
_context.AppUser.Add(new AppUser()
{
@@ -714,17 +593,14 @@ public class TachiyomiServiceTests
});
await _context.SaveChangesAsync();
- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
- var tachiyomiService = new TachiyomiService(_unitOfWork, _mapper, Substitute.For<ILogger<ReaderService>>(), readerService);
-
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync("majora2007", AppUserIncludes.Progress);
- await tachiyomiService.MarkChaptersUntilAsRead(user,1,1/10_000F);
+ await _tachiyomiService.MarkChaptersUntilAsRead(user,1,1/10_000F);
await _context.SaveChangesAsync();
- var latestChapter = await tachiyomiService.GetLatestChapter(1, 1);
+ var latestChapter = await _tachiyomiService.GetLatestChapter(1, 1);
Assert.Equal("0.0001", latestChapter.Number);
}
diff --git a/API.Tests/Services/Test Data/ArchiveService/ComicInfos/Umlaut.zip b/API.Tests/Services/Test Data/ArchiveService/ComicInfos/Umlaut.zip
new file mode 100644
index 000000000..9c8a8c6fc
Binary files /dev/null and b/API.Tests/Services/Test Data/ArchiveService/ComicInfos/Umlaut.zip differ
diff --git a/API.Tests/Services/Test Data/ArchiveService/CoverImages/sorting.expected.png b/API.Tests/Services/Test Data/ArchiveService/CoverImages/sorting.expected.png
index 3ef55227f..74dc020e6 100644
Binary files a/API.Tests/Services/Test Data/ArchiveService/CoverImages/sorting.expected.png and b/API.Tests/Services/Test Data/ArchiveService/CoverImages/sorting.expected.png differ
diff --git a/API.Tests/Services/Test Data/ArchiveService/CoverImages/v10 - duplicate covers.expected.png b/API.Tests/Services/Test Data/ArchiveService/CoverImages/v10 - duplicate covers.expected.png
index b6560f796..1b7cd30b3 100644
Binary files a/API.Tests/Services/Test Data/ArchiveService/CoverImages/v10 - duplicate covers.expected.png and b/API.Tests/Services/Test Data/ArchiveService/CoverImages/v10 - duplicate covers.expected.png differ
diff --git a/API.Tests/Services/Test Data/ArchiveService/CoverImages/v10 - nested folder.expected.old.png b/API.Tests/Services/Test Data/ArchiveService/CoverImages/v10 - nested folder.expected.old.png
new file mode 100644
index 000000000..b6560f796
Binary files /dev/null and b/API.Tests/Services/Test Data/ArchiveService/CoverImages/v10 - nested folder.expected.old.png differ
diff --git a/API.Tests/Services/Test Data/ArchiveService/CoverImages/v10 - nested folder.expected.png b/API.Tests/Services/Test Data/ArchiveService/CoverImages/v10 - nested folder.expected.png
index b6560f796..1b7cd30b3 100644
Binary files a/API.Tests/Services/Test Data/ArchiveService/CoverImages/v10 - nested folder.expected.png and b/API.Tests/Services/Test Data/ArchiveService/CoverImages/v10 - nested folder.expected.png differ
diff --git a/API.Tests/Services/Test Data/ArchiveService/CoverImages/v10 - with folder.expected.png b/API.Tests/Services/Test Data/ArchiveService/CoverImages/v10 - with folder.expected.png
index b33c2ea13..29bfc801f 100644
Binary files a/API.Tests/Services/Test Data/ArchiveService/CoverImages/v10 - with folder.expected.png and b/API.Tests/Services/Test Data/ArchiveService/CoverImages/v10 - with folder.expected.png differ
diff --git a/API.Tests/Services/Test Data/ScannerService/Library/Books/PDFs/Rollo at Work SP01.pdf b/API.Tests/Services/Test Data/ScannerService/Library/Books/PDFs/Rollo at Work SP01.pdf
new file mode 100644
index 000000000..35983f4e0
Binary files /dev/null and b/API.Tests/Services/Test Data/ScannerService/Library/Books/PDFs/Rollo at Work SP01.pdf differ
diff --git a/API.Tests/Services/Test Data/ScannerService/Library/Books/The Golden Harpoon/The Golden Harpoon.epub b/API.Tests/Services/Test Data/ScannerService/Library/Books/The Golden Harpoon/The Golden Harpoon.epub
new file mode 100644
index 000000000..7388bc85e
Binary files /dev/null and b/API.Tests/Services/Test Data/ScannerService/Library/Books/The Golden Harpoon/The Golden Harpoon.epub differ
diff --git a/API.Tests/Services/Test Data/ScannerService/Library/Books/Vertical Reading/01.epub b/API.Tests/Services/Test Data/ScannerService/Library/Books/Vertical Reading/01.epub
new file mode 100644
index 000000000..2850eed96
Binary files /dev/null and b/API.Tests/Services/Test Data/ScannerService/Library/Books/Vertical Reading/01.epub differ
diff --git a/API.Tests/Services/Test Data/ScannerService/Library/Manga/Accel World/Accel World Vol 1 Chapter 1.cbz b/API.Tests/Services/Test Data/ScannerService/Library/Manga/Accel World/Accel World Vol 1 Chapter 1.cbz
new file mode 100644
index 000000000..d1eb76880
Binary files /dev/null and b/API.Tests/Services/Test Data/ScannerService/Library/Manga/Accel World/Accel World Vol 1 Chapter 1.cbz differ
diff --git a/API.Tests/Services/Test Data/ScannerService/Library/Manga/Accel World/Accel World Vol 1 Chapter 2.zip b/API.Tests/Services/Test Data/ScannerService/Library/Manga/Accel World/Accel World Vol 1 Chapter 2.zip
new file mode 100644
index 000000000..40ebeb13e
Binary files /dev/null and b/API.Tests/Services/Test Data/ScannerService/Library/Manga/Accel World/Accel World Vol 1 Chapter 2.zip differ
diff --git a/API.Tests/Services/Test Data/ScannerService/Library/Manga/Accel World/Accel World Vol 2 Chapter 3.zip b/API.Tests/Services/Test Data/ScannerService/Library/Manga/Accel World/Accel World Vol 2 Chapter 3.zip
new file mode 100644
index 000000000..40ebeb13e
Binary files /dev/null and b/API.Tests/Services/Test Data/ScannerService/Library/Manga/Accel World/Accel World Vol 2 Chapter 3.zip differ
diff --git a/API.Tests/Services/Test Data/ScannerService/Library/Manga/Accel World/ComicInfo.xml b/API.Tests/Services/Test Data/ScannerService/Library/Manga/Accel World/ComicInfo.xml
new file mode 100644
index 000000000..6bc41f434
--- /dev/null
+++ b/API.Tests/Services/Test Data/ScannerService/Library/Manga/Accel World/ComicInfo.xml
@@ -0,0 +1,5 @@
+<?xml version='1.0' encoding='utf-8'?>
+<ComicInfo>
+ <Series>Accel World</Series>
+ <Number>2</Number>
+</ComicInfo>
\ No newline at end of file
diff --git a/API.Tests/Services/Test Data/ScannerService/Library/Manga/Hajime no Ippo/ComicInfo.xml b/API.Tests/Services/Test Data/ScannerService/Library/Manga/Hajime no Ippo/ComicInfo.xml
new file mode 100644
index 000000000..d0494448f
--- /dev/null
+++ b/API.Tests/Services/Test Data/ScannerService/Library/Manga/Hajime no Ippo/ComicInfo.xml
@@ -0,0 +1,6 @@
+<?xml version='1.0' encoding='utf-8'?>
+<ComicInfo>
+ <Series>Hajime no Ippo</Series>
+ <Number>3</Number>
+ <AgeRating>M</AgeRating>
+</ComicInfo>
\ No newline at end of file
diff --git a/API.Tests/Services/Test Data/ScannerService/Library/Manga/Hajime no Ippo/Hajime no Ippo Chapter 1.cbz b/API.Tests/Services/Test Data/ScannerService/Library/Manga/Hajime no Ippo/Hajime no Ippo Chapter 1.cbz
new file mode 100644
index 000000000..895cfc415
Binary files /dev/null and b/API.Tests/Services/Test Data/ScannerService/Library/Manga/Hajime no Ippo/Hajime no Ippo Chapter 1.cbz differ
diff --git a/API.Tests/Services/Test Data/ScannerService/Library/Manga/Hajime no Ippo/Hajime no Ippo Chapter 2.zip b/API.Tests/Services/Test Data/ScannerService/Library/Manga/Hajime no Ippo/Hajime no Ippo Chapter 2.zip
new file mode 100644
index 000000000..40ebeb13e
Binary files /dev/null and b/API.Tests/Services/Test Data/ScannerService/Library/Manga/Hajime no Ippo/Hajime no Ippo Chapter 2.zip differ
diff --git a/API.Tests/Services/Test Data/ScannerService/Library/Manga/Hajime no Ippo/Hajime no Ippo Chapter 3.zip b/API.Tests/Services/Test Data/ScannerService/Library/Manga/Hajime no Ippo/Hajime no Ippo Chapter 3.zip
new file mode 100644
index 000000000..40ebeb13e
Binary files /dev/null and b/API.Tests/Services/Test Data/ScannerService/Library/Manga/Hajime no Ippo/Hajime no Ippo Chapter 3.zip differ
diff --git a/API.Tests/Services/Test Data/ScannerService/Library/Manga/Pumpkin Night (images)/Chapter 01/001.jpg b/API.Tests/Services/Test Data/ScannerService/Library/Manga/Pumpkin Night (images)/Chapter 01/001.jpg
new file mode 100644
index 000000000..b5c6de2aa
Binary files /dev/null and b/API.Tests/Services/Test Data/ScannerService/Library/Manga/Pumpkin Night (images)/Chapter 01/001.jpg differ
diff --git a/API.Tests/Services/Test Data/ScannerService/Library/Manga/Pumpkin Night (images)/Chapter 01/002.jpg b/API.Tests/Services/Test Data/ScannerService/Library/Manga/Pumpkin Night (images)/Chapter 01/002.jpg
new file mode 100644
index 000000000..b5c6de2aa
Binary files /dev/null and b/API.Tests/Services/Test Data/ScannerService/Library/Manga/Pumpkin Night (images)/Chapter 01/002.jpg differ
diff --git a/API.Tests/Services/Test Data/ScannerService/Library/Manga/Pumpkin Night (images)/Chapter 01/003.jpg b/API.Tests/Services/Test Data/ScannerService/Library/Manga/Pumpkin Night (images)/Chapter 01/003.jpg
new file mode 100644
index 000000000..b5c6de2aa
Binary files /dev/null and b/API.Tests/Services/Test Data/ScannerService/Library/Manga/Pumpkin Night (images)/Chapter 01/003.jpg differ
diff --git a/API.Tests/Services/Test Data/ScannerService/Library/Manga/Pumpkin Night (images)/Chapter 01/004.jpg b/API.Tests/Services/Test Data/ScannerService/Library/Manga/Pumpkin Night (images)/Chapter 01/004.jpg
new file mode 100644
index 000000000..b5c6de2aa
Binary files /dev/null and b/API.Tests/Services/Test Data/ScannerService/Library/Manga/Pumpkin Night (images)/Chapter 01/004.jpg differ
diff --git a/API.Tests/Services/Test Data/ScannerService/Library/README.md b/API.Tests/Services/Test Data/ScannerService/Library/README.md
new file mode 100644
index 000000000..2969111b4
--- /dev/null
+++ b/API.Tests/Services/Test Data/ScannerService/Library/README.md
@@ -0,0 +1 @@
+This is an example of a layout. All files in here have non-copyrighted data but emulate real series to ensure the Process series Works as expected.
\ No newline at end of file
diff --git a/API.Tests/Services/WordCountAnalysisTests.cs b/API.Tests/Services/WordCountAnalysisTests.cs
index 845f729de..0b8c53331 100644
--- a/API.Tests/Services/WordCountAnalysisTests.cs
+++ b/API.Tests/Services/WordCountAnalysisTests.cs
@@ -1,13 +1,15 @@
-using System;
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.IO;
+using System.IO.Abstractions;
using System.IO.Abstractions.TestingHelpers;
using System.Linq;
using System.Threading.Tasks;
using API.Entities;
using API.Entities.Enums;
using API.Helpers;
+using API.Helpers.Builders;
using API.Services;
+using API.Services.Tasks;
using API.Services.Tasks.Metadata;
using API.SignalR;
using API.Tests.Helpers;
@@ -28,7 +30,8 @@ public class WordCountAnalysisTests : AbstractDbTest
public WordCountAnalysisTests() : base()
{
_readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(),
- Substitute.For<IEventHub>());
+ Substitute.For<IEventHub>(), Substitute.For<IImageService>(),
+ new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), new MockFileSystem()));
}
protected override async Task ResetDb()
@@ -42,25 +45,26 @@ public class WordCountAnalysisTests : AbstractDbTest
public async Task ReadingTimeShouldBeNonZero()
{
await ResetDb();
- var series = EntityFactory.CreateSeries("Test Series");
- series.Format = MangaFormat.Epub;
- var chapter = EntityFactory.CreateChapter("", false, new List<MangaFile>()
- {
- EntityFactory.CreateMangaFile(
- Path.Join(_testDirectory, "The Golden Harpoon; Or, Lost Among the Floes A Story of the Whaling Grounds.epub"),
- MangaFormat.Epub, 0)
- });
+ var series = new SeriesBuilder("Test Series")
+ .WithFormat(MangaFormat.Epub)
+ .Build();
- _context.Library.Add(new Library()
- {
- Name = "Test",
- Type = LibraryType.Book,
- Series = new List<Series>() {series}
- });
+ var chapter = new ChapterBuilder("")
+ .WithFile(new MangaFileBuilder(
+ Path.Join(_testDirectory,
+ "The Golden Harpoon; Or, Lost Among the Floes A Story of the Whaling Grounds.epub"),
+ MangaFormat.Epub).Build())
+ .Build();
+
+ _context.Library.Add(new LibraryBuilder("Test LIb", LibraryType.Book)
+ .WithSeries(series)
+ .Build());
series.Volumes = new List<Volume>()
{
- EntityFactory.CreateVolume("0", new List<Chapter>() {chapter})
+ new VolumeBuilder("0")
+ .WithChapter(chapter)
+ .Build(),
};
await _context.SaveChangesAsync();
@@ -97,26 +101,23 @@ public class WordCountAnalysisTests : AbstractDbTest
public async Task ReadingTimeShouldIncreaseWhenNewBookAdded()
{
await ResetDb();
- var series = EntityFactory.CreateSeries("Test Series");
- series.Format = MangaFormat.Epub;
- var chapter = EntityFactory.CreateChapter("", false, new List<MangaFile>()
- {
- EntityFactory.CreateMangaFile(
- Path.Join(_testDirectory, "The Golden Harpoon; Or, Lost Among the Floes A Story of the Whaling Grounds.epub"),
- MangaFormat.Epub, 0)
- });
+ var chapter = new ChapterBuilder("")
+ .WithFile(new MangaFileBuilder(
+ Path.Join(_testDirectory,
+ "The Golden Harpoon; Or, Lost Among the Floes A Story of the Whaling Grounds.epub"),
+ MangaFormat.Epub).Build())
+ .Build();
+ var series = new SeriesBuilder("Test Series")
+ .WithFormat(MangaFormat.Epub)
+ .WithVolume(new VolumeBuilder("0")
+ .WithChapter(chapter)
+ .Build())
+ .Build();
+
+ _context.Library.Add(new LibraryBuilder("Test", LibraryType.Book)
+ .WithSeries(series)
+ .Build());
- _context.Library.Add(new Library()
- {
- Name = "Test",
- Type = LibraryType.Book,
- Series = new List<Series>() {series}
- });
-
- series.Volumes = new List<Volume>()
- {
- EntityFactory.CreateVolume("0", new List<Chapter>() {chapter})
- };
await _context.SaveChangesAsync();
@@ -124,18 +125,19 @@ public class WordCountAnalysisTests : AbstractDbTest
var cacheService = new CacheHelper(new FileService());
var service = new WordCountAnalyzerService(Substitute.For<ILogger<WordCountAnalyzerService>>(), _unitOfWork,
Substitute.For<IEventHub>(), cacheService, _readerService);
-
-
await service.ScanSeries(1, 1);
- var chapter2 = EntityFactory.CreateChapter("2", false, new List<MangaFile>()
- {
- EntityFactory.CreateMangaFile(
- Path.Join(_testDirectory, "The Golden Harpoon; Or, Lost Among the Floes A Story of the Whaling Grounds.epub"),
- MangaFormat.Epub, 0)
- });
+ var chapter2 = new ChapterBuilder("2")
+ .WithFile(new MangaFileBuilder(
+ Path.Join(_testDirectory,
+ "The Golden Harpoon; Or, Lost Among the Floes A Story of the Whaling Grounds.epub"),
+ MangaFormat.Epub).Build())
+ .Build();
+
- series.Volumes.Add(EntityFactory.CreateVolume("1", new List<Chapter>() {chapter2}));
+ series.Volumes.Add(new VolumeBuilder("1")
+ .WithChapter(chapter2)
+ .Build());
series.Volumes.First().Chapters.Add(chapter2);
await _unitOfWork.CommitAsync();
diff --git a/API/API.csproj b/API/API.csproj
index 24df972e2..2d77c9ea6 100644
--- a/API/API.csproj
+++ b/API/API.csproj
@@ -2,12 +2,14 @@
<PropertyGroup>
<AnalysisMode>Default</AnalysisMode>
- <TargetFramework>net6.0</TargetFramework>
+ <TargetFramework>net7.0</TargetFramework>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<TieredPGO>true</TieredPGO>
<TieredCompilation>true</TieredCompilation>
<ApplicationIcon>../favicon.ico</ApplicationIcon>
+ <Nullable>warnings</Nullable>
+ <LangVersion>latestmajor</LangVersion>
</PropertyGroup>
<Target Name="PostBuild" AfterTargets="Build" Condition=" '$(Configuration)' == 'Debug' ">
@@ -51,36 +53,37 @@
</PropertyGroup>
<ItemGroup>
- <PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.0" />
+ <PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
<PackageReference Include="CsvHelper" Version="30.0.1" />
<PackageReference Include="Docnet.Core" Version="2.4.0-alpha.4" />
<PackageReference Include="ExCSS" Version="4.1.0" />
- <PackageReference Include="Flurl" Version="3.0.6" />
+ <PackageReference Include="Flurl" Version="3.0.7" />
<PackageReference Include="Flurl.Http" Version="3.2.4" />
- <PackageReference Include="Hangfire" Version="1.7.31" />
- <PackageReference Include="Hangfire.AspNetCore" Version="1.7.31" />
- <PackageReference Include="Hangfire.InMemory" Version="0.3.4" />
+ <PackageReference Include="Hangfire" Version="1.7.34" />
+ <PackageReference Include="Hangfire.AspNetCore" Version="1.7.34" />
+ <PackageReference Include="Hangfire.InMemory" Version="0.3.7" />
<PackageReference Include="Hangfire.MaximumConcurrentExecutions" Version="1.1.0" />
<PackageReference Include="Hangfire.MemoryStorage.Core" Version="1.4.0" />
- <PackageReference Include="Hangfire.Storage.SQLite" Version="0.3.2" />
+ <PackageReference Include="Hangfire.Storage.SQLite" Version="0.3.3" />
<PackageReference Include="HtmlAgilityPack" Version="1.11.46" />
<PackageReference Include="MarkdownDeep.NET.Core" Version="1.5.0.4" />
- <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.10" />
- <PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="6.0.10" />
- <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.10" />
+ <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.5" />
+ <PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="7.0.5" />
+ <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="7.0.5" />
<PackageReference Include="Microsoft.AspNetCore.SignalR" Version="1.1.0" />
- <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.10">
+ <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
- <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.10" />
- <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.1" />
- <PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="2.2.1" />
- <PackageReference Include="NetVips" Version="2.2.0" />
- <PackageReference Include="NetVips.Native" Version="8.13.1" />
- <PackageReference Include="NReco.Logging.File" Version="1.1.5" />
+ <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.5" />
+ <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
+ <PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="2.3.2" />
+ <PackageReference Include="MimeTypeMapOfficial" Version="1.0.17" />
+ <PackageReference Include="NetVips" Version="2.3.0" />
+ <PackageReference Include="NetVips.Native" Version="8.14.2" />
+ <PackageReference Include="NReco.Logging.File" Version="1.1.6" />
<PackageReference Include="Serilog" Version="2.12.0" />
- <PackageReference Include="Serilog.AspNetCore" Version="6.0.1" />
+ <PackageReference Include="Serilog.AspNetCore" Version="6.1.0" />
<PackageReference Include="Serilog.Enrichers.Thread" Version="3.2.0-dev-00752" />
<PackageReference Include="Serilog.Extensions.Hosting" Version="5.0.1" />
<PackageReference Include="Serilog.Settings.Configuration" Version="3.4.0" />
@@ -88,17 +91,17 @@
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="Serilog.Sinks.SignalR.Core" Version="0.1.2" />
- <PackageReference Include="SharpCompress" Version="0.32.2" />
- <PackageReference Include="SixLabors.ImageSharp" Version="2.1.3" />
- <PackageReference Include="SonarAnalyzer.CSharp" Version="8.47.0.55603">
+ <PackageReference Include="SharpCompress" Version="0.33.0" />
+ <PackageReference Include="SixLabors.ImageSharp" Version="3.0.1" />
+ <PackageReference Include="SonarAnalyzer.CSharp" Version="8.55.0.65544">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
- <PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
+ <PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Filters" Version="7.0.6" />
- <PackageReference Include="System.Drawing.Common" Version="6.0.0" />
- <PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.24.0" />
- <PackageReference Include="System.IO.Abstractions" Version="17.2.3" />
+ <PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.29.0" />
+ <PackageReference Include="System.IO.Abstractions" Version="19.2.11" />
+ <PackageReference Include="System.Drawing.Common" Version="7.0.0" />
<PackageReference Include="VersOne.Epub" Version="3.3.0-alpha1" />
</ItemGroup>
@@ -119,6 +122,12 @@
<None Remove="kavita.db" />
<None Remove="covers\**" />
<None Remove="wwwroot\**" />
+ <None Remove="config\cache\**" />
+ <None Remove="config\logs\**" />
+ <None Remove="config\covers\**" />
+ <None Remove="config\bookmarks\**" />
+ <None Remove="config\backups\**" />
+ <None Remove="config\temp\**" />
</ItemGroup>
<ItemGroup>
@@ -129,6 +138,12 @@
<Compile Remove="temp\**" />
<Compile Remove="covers\**" />
<Compile Remove="wwwroot\**" />
+ <Compile Remove="config\cache\**" />
+ <Compile Remove="config\logs\**" />
+ <Compile Remove="config\covers\**" />
+ <Compile Remove="config\bookmarks\**" />
+ <Compile Remove="config\backups\**" />
+ <Compile Remove="config\temp\**" />
</ItemGroup>
<ItemGroup>
@@ -144,6 +159,8 @@
<EmbeddedResource Remove="config\temp\**" />
<EmbeddedResource Remove="config\stats\**" />
<EmbeddedResource Remove="wwwroot\**" />
+ <EmbeddedResource Remove="config\cache\**" />
+ <EmbeddedResource Remove="config\bookmarks\**" />
</ItemGroup>
<ItemGroup>
@@ -167,6 +184,7 @@
<Content Update="bin\$(Configuration)\$(AssemblyName).xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
+ <Content Remove="config\bookmarks\**" />
</ItemGroup>
<ItemGroup>
diff --git a/API/Comparators/NumericComparer.cs b/API/Comparators/NumericComparer.cs
index ae603e71b..194d013ea 100644
--- a/API/Comparators/NumericComparer.cs
+++ b/API/Comparators/NumericComparer.cs
@@ -5,7 +5,7 @@ namespace API.Comparators;
public class NumericComparer : IComparer
{
- public int Compare(object x, object y)
+ public int Compare(object? x, object? y)
{
if((x is string xs) && (y is string ys))
{
diff --git a/API/Constants/PolicyConstants.cs b/API/Constants/PolicyConstants.cs
index 546ad4158..69de1821b 100644
--- a/API/Constants/PolicyConstants.cs
+++ b/API/Constants/PolicyConstants.cs
@@ -31,7 +31,11 @@ public static class PolicyConstants
/// Used to give a user ability to Change Restrictions on their account
/// </summary>
public const string ChangeRestrictionRole = "Change Restriction";
+ /// <summary>
+ /// Used to give a user ability to Login to their account
+ /// </summary>
+ public const string LoginRole = "Login";
public static readonly ImmutableArray<string> ValidRoles =
- ImmutableArray.Create(AdminRole, PlebRole, DownloadRole, ChangePasswordRole, BookmarkRole, ChangeRestrictionRole);
+ ImmutableArray.Create(AdminRole, PlebRole, DownloadRole, ChangePasswordRole, BookmarkRole, ChangeRestrictionRole, LoginRole);
}
diff --git a/API/Controllers/AccountController.cs b/API/Controllers/AccountController.cs
index a5815250c..ea9159d1c 100644
--- a/API/Controllers/AccountController.cs
+++ b/API/Controllers/AccountController.cs
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
-using System.Web;
using API.Constants;
using API.Data;
using API.Data.Repositories;
@@ -14,16 +13,19 @@ using API.Entities;
using API.Entities.Enums;
using API.Errors;
using API.Extensions;
+using API.Helpers.Builders;
+using API.Middleware.RateLimit;
using API.Services;
using API.SignalR;
using AutoMapper;
+using Hangfire;
using Kavita.Common;
using Kavita.Common.EnvironmentInfo;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.RateLimiting;
using Microsoft.EntityFrameworkCore;
-using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
namespace API.Controllers;
@@ -125,16 +127,9 @@ public class AccountController : BaseApiController
return BadRequest(usernameValidation);
}
- var user = new AppUser()
- {
- UserName = registerDto.Username,
- Email = registerDto.Email,
- UserPreferences = new AppUserPreferences
- {
- Theme = await _unitOfWork.SiteThemeRepository.GetDefaultTheme()
- },
- ApiKey = HashUtil.ApiKey()
- };
+ var user = new AppUserBuilder(registerDto.Username, registerDto.Email,
+ await _unitOfWork.SiteThemeRepository.GetDefaultTheme()).Build();
+
var result = await _userManager.CreateAsync(user, registerDto.Password);
if (!result.Succeeded) return BadRequest(result.Errors);
@@ -146,6 +141,7 @@ public class AccountController : BaseApiController
var roleResult = await _userManager.AddToRoleAsync(user, PolicyConstants.AdminRole);
if (!roleResult.Succeeded) return BadRequest(result.Errors);
+ await _userManager.AddToRoleAsync(user, PolicyConstants.LoginRole);
return new UserDto
{
@@ -154,7 +150,8 @@ public class AccountController : BaseApiController
Token = await _tokenService.CreateToken(user),
RefreshToken = await _tokenService.CreateRefreshToken(user),
ApiKey = user.ApiKey,
- Preferences = _mapper.Map<UserPreferencesDto>(user.UserPreferences)
+ Preferences = _mapper.Map<UserPreferencesDto>(user.UserPreferences),
+ KavitaVersion = (await _unitOfWork.SettingsRepository.GetSettingAsync(ServerSettingKey.InstallVersion)).Value
};
}
catch (Exception ex)
@@ -184,6 +181,8 @@ public class AccountController : BaseApiController
.SingleOrDefaultAsync(x => x.NormalizedUserName == loginDto.Username.ToUpper());
if (user == null) return Unauthorized("Your credentials are not correct");
+ var roles = await _userManager.GetRolesAsync(user);
+ if (!roles.Contains(PolicyConstants.LoginRole)) return Unauthorized("Your account is disabled. Contact the server admin.");
var result = await _signInManager
.CheckPasswordSignInAsync(user, loginDto.Password, true);
@@ -200,6 +199,8 @@ public class AccountController : BaseApiController
// Update LastActive on account
user.UpdateLastActive();
+
+ // NOTE: This can likely be removed
user.UserPreferences ??= new AppUserPreferences
{
Theme = await _unitOfWork.SiteThemeRepository.GetDefaultTheme()
@@ -213,10 +214,15 @@ public class AccountController : BaseApiController
var dto = _mapper.Map<UserDto>(user);
dto.Token = await _tokenService.CreateToken(user);
dto.RefreshToken = await _tokenService.CreateRefreshToken(user);
- var pref = await _unitOfWork.UserRepository.GetPreferencesAsync(user.UserName);
+ dto.KavitaVersion = (await _unitOfWork.SettingsRepository.GetSettingAsync(ServerSettingKey.InstallVersion))
+ .Value;
+ var pref = await _unitOfWork.UserRepository.GetPreferencesAsync(user.UserName!);
+ if (pref == null) return Ok(dto);
+
pref.Theme ??= await _unitOfWork.SiteThemeRepository.GetDefaultTheme();
dto.Preferences = _mapper.Map<UserPreferencesDto>(pref);
- return dto;
+
+ return Ok(dto);
}
/// <summary>
@@ -248,7 +254,7 @@ public class AccountController : BaseApiController
.GetFields(BindingFlags.Public | BindingFlags.Static)
.Where(f => f.FieldType == typeof(string))
.ToDictionary(f => f.Name,
- f => (string) f.GetValue(null)).Values.ToList();
+ f => (string) f.GetValue(null)!).Values.ToList();
}
@@ -260,6 +266,7 @@ public class AccountController : BaseApiController
public async Task<ActionResult<string>> ResetApiKey()
{
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername());
+ if (user == null) return Unauthorized();
user.ApiKey = HashUtil.ApiKey();
@@ -281,7 +288,7 @@ public class AccountController : BaseApiController
/// <param name="dto"></param>
/// <returns>Returns just if the email was sent or server isn't reachable</returns>
[HttpPost("update/email")]
- public async Task<ActionResult> UpdateEmail(UpdateEmailDto dto)
+ public async Task<ActionResult> UpdateEmail(UpdateEmailDto? dto)
{
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername());
if (user == null) return Unauthorized("You do not have permission");
@@ -297,7 +304,7 @@ public class AccountController : BaseApiController
}
// Validate no other users exist with this email
- if (user.Email.Equals(dto.Email)) return Ok("Nothing to do");
+ if (user.Email!.Equals(dto.Email)) return Ok("Nothing to do");
// Check if email is used by another user
var existingUserEmail = await _unitOfWork.UserRepository.GetUserByEmailAsync(dto.Email);
@@ -335,7 +342,7 @@ public class AccountController : BaseApiController
{
EmailAddress = string.IsNullOrEmpty(user.Email) ? dto.Email : user.Email,
InstallId = BuildInfo.Version.ToString(),
- InvitingUser = (await _unitOfWork.UserRepository.GetAdminUsersAsync()).First().UserName,
+ InvitingUser = (await _unitOfWork.UserRepository.GetAdminUsersAsync()).First().UserName!,
ServerConfirmationLink = emailLink
});
}
@@ -357,7 +364,7 @@ public class AccountController : BaseApiController
}
- await _eventHub.SendMessageToAsync(MessageFactory.UserUpdate, MessageFactory.UserUpdateEvent(user.Id, user.UserName), user.Id);
+ await _eventHub.SendMessageToAsync(MessageFactory.UserUpdate, MessageFactory.UserUpdateEvent(user.Id, user.UserName!), user.Id);
return Ok();
}
@@ -367,9 +374,9 @@ public class AccountController : BaseApiController
{
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername());
if (user == null) return Unauthorized("You do not have permission");
- if (dto == null) return BadRequest("Invalid payload");
var isAdmin = await _unitOfWork.UserRepository.IsUserAdminAsync(user);
+ if (!await _accountService.HasChangeRestrictionRole(user)) return BadRequest("You do not have permission");
user.AgeRestriction = isAdmin ? AgeRating.NotApplicable : dto.AgeRating;
user.AgeRestrictionIncludeUnknowns = isAdmin || dto.IncludeUnknowns;
@@ -387,7 +394,7 @@ public class AccountController : BaseApiController
return BadRequest("There was an error updating the age restriction");
}
- await _eventHub.SendMessageToAsync(MessageFactory.UserUpdate, MessageFactory.UserUpdateEvent(user.Id, user.UserName), user.Id);
+ await _eventHub.SendMessageToAsync(MessageFactory.UserUpdate, MessageFactory.UserUpdateEvent(user.Id, user.UserName!), user.Id);
return Ok();
}
@@ -402,13 +409,14 @@ public class AccountController : BaseApiController
public async Task<ActionResult> UpdateAccount(UpdateUserDto dto)
{
var adminUser = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername());
+ if (adminUser == null) return Unauthorized();
if (!await _unitOfWork.UserRepository.IsUserAdminAsync(adminUser)) return Unauthorized("You do not have permission");
var user = await _unitOfWork.UserRepository.GetUserByIdAsync(dto.UserId);
if (user == null) return BadRequest("User does not exist");
// Check if username is changing
- if (!user.UserName.Equals(dto.Username))
+ if (!user.UserName!.Equals(dto.Username))
{
// Validate username change
var errors = await _accountService.ValidateUsername(dto.Username);
@@ -488,12 +496,13 @@ public class AccountController : BaseApiController
public async Task<ActionResult<string>> GetInviteUrl(int userId, bool withBaseUrl)
{
var user = await _unitOfWork.UserRepository.GetUserByIdAsync(userId);
+ if (user == null) return Unauthorized();
if (user.EmailConfirmed)
return BadRequest("User is already confirmed");
if (string.IsNullOrEmpty(user.ConfirmationToken))
return BadRequest("Manual setup is unable to be completed. Please cancel and recreate the invite.");
- return await _accountService.GenerateEmailLink(Request, user.ConfirmationToken, "confirm-email", user.Email, withBaseUrl);
+ return await _accountService.GenerateEmailLink(Request, user.ConfirmationToken, "confirm-email", user.Email!, withBaseUrl);
}
@@ -520,23 +529,14 @@ public class AccountController : BaseApiController
if (emailValidationErrors.Any())
{
var invitedUser = await _unitOfWork.UserRepository.GetUserByEmailAsync(dto.Email);
- if (await _userManager.IsEmailConfirmedAsync(invitedUser))
- return BadRequest($"User is already registered as {invitedUser.UserName}");
+ if (await _userManager.IsEmailConfirmedAsync(invitedUser!))
+ return BadRequest($"User is already registered as {invitedUser!.UserName}");
return BadRequest("User is already invited under this email and has yet to accepted invite.");
}
}
// Create a new user
- var user = new AppUser()
- {
- UserName = dto.Email,
- Email = dto.Email,
- ApiKey = HashUtil.ApiKey(),
- UserPreferences = new AppUserPreferences
- {
- Theme = await _unitOfWork.SiteThemeRepository.GetDefaultTheme()
- }
- };
+ var user = new AppUserBuilder(dto.Email, dto.Email, await _unitOfWork.SiteThemeRepository.GetDefaultTheme()).Build();
try
{
@@ -607,19 +607,14 @@ public class AccountController : BaseApiController
var accessible = await _accountService.CheckIfAccessible(Request);
if (accessible)
{
- try
- {
- await _emailService.SendConfirmationEmail(new ConfirmationEmailDto()
- {
- EmailAddress = dto.Email,
- InvitingUser = adminUser.UserName,
- ServerConfirmationLink = emailLink
- });
- }
- catch (Exception)
+ // Do the email send on a background thread to ensure UI can move forward without having to wait for a timeout when users use fake emails
+ BackgroundJob.Enqueue(() => _emailService.SendConfirmationEmail(new ConfirmationEmailDto()
{
- /* Swallow exception */
- }
+ EmailAddress = dto.Email,
+ InvitingUser = adminUser.UserName!,
+ ServerConfirmationLink = emailLink
+ }));
+
}
return Ok(new InviteUserResponse
@@ -655,7 +650,11 @@ public class AccountController : BaseApiController
// Validate Password and Username
var validationErrors = new List<ApiException>();
- validationErrors.AddRange(await _accountService.ValidateUsername(dto.Username));
+ // This allows users that use a fake email with the same username to continue setting up the account
+ if (!dto.Username.Equals(dto.Email) && !user.UserName!.Equals(dto.Username))
+ {
+ validationErrors.AddRange(await _accountService.ValidateUsername(dto.Username));
+ }
validationErrors.AddRange(await _accountService.ValidatePassword(user, dto.Password));
if (validationErrors.Any())
@@ -680,18 +679,19 @@ public class AccountController : BaseApiController
await _unitOfWork.CommitAsync();
- user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(user.UserName,
- AppUserIncludes.UserPreferences);
+ user = (await _unitOfWork.UserRepository.GetUserByUsernameAsync(user.UserName,
+ AppUserIncludes.UserPreferences))!;
// Perform Login code
return new UserDto
{
- Username = user.UserName,
- Email = user.Email,
+ Username = user.UserName!,
+ Email = user.Email!,
Token = await _tokenService.CreateToken(user),
RefreshToken = await _tokenService.CreateRefreshToken(user),
ApiKey = user.ApiKey,
- Preferences = _mapper.Map<UserPreferencesDto>(user.UserPreferences)
+ Preferences = _mapper.Map<UserPreferencesDto>(user.UserPreferences),
+ KavitaVersion = (await _unitOfWork.SettingsRepository.GetSettingAsync(ServerSettingKey.InstallVersion)).Value
};
}
@@ -731,7 +731,7 @@ public class AccountController : BaseApiController
// For the user's connected devices to pull the new information in
await _eventHub.SendMessageToAsync(MessageFactory.UserUpdate,
- MessageFactory.UserUpdateEvent(user.Id, user.UserName), user.Id);
+ MessageFactory.UserUpdateEvent(user.Id, user.UserName!), user.Id);
// Perform Login code
return Ok();
@@ -775,6 +775,7 @@ public class AccountController : BaseApiController
/// <returns></returns>
[AllowAnonymous]
[HttpPost("forgot-password")]
+ [EnableRateLimiting("Authentication")]
public async Task<ActionResult<string>> ForgotPassword([FromQuery] string email)
{
var user = await _unitOfWork.UserRepository.GetUserByEmailAsync(email);
@@ -832,18 +833,19 @@ public class AccountController : BaseApiController
await _unitOfWork.CommitAsync();
- user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(user.UserName,
+ user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(user.UserName!,
AppUserIncludes.UserPreferences);
// Perform Login code
return new UserDto
{
- Username = user.UserName,
- Email = user.Email,
+ Username = user!.UserName!,
+ Email = user.Email!,
Token = await _tokenService.CreateToken(user),
RefreshToken = await _tokenService.CreateRefreshToken(user),
ApiKey = user.ApiKey,
- Preferences = _mapper.Map<UserPreferencesDto>(user.UserPreferences)
+ Preferences = _mapper.Map<UserPreferencesDto>(user.UserPreferences),
+ KavitaVersion = (await _unitOfWork.SettingsRepository.GetSettingAsync(ServerSettingKey.InstallVersion)).Value
};
}
@@ -853,6 +855,7 @@ public class AccountController : BaseApiController
/// <param name="userId"></param>
/// <returns></returns>
[HttpPost("resend-confirmation-email")]
+ [EnableRateLimiting("Authentication")]
public async Task<ActionResult<string>> ResendConfirmationSendEmail([FromQuery] int userId)
{
var user = await _unitOfWork.UserRepository.GetUserByIdAsync(userId);
@@ -873,8 +876,8 @@ public class AccountController : BaseApiController
{
await _emailService.SendMigrationEmail(new EmailMigrationDto()
{
- EmailAddress = user.Email,
- Username = user.UserName,
+ EmailAddress = user.Email!,
+ Username = user.UserName!,
ServerConfirmationLink = emailLink,
InstallId = (await _unitOfWork.SettingsRepository.GetSettingAsync(ServerSettingKey.InstallId)).Value
});
@@ -908,8 +911,8 @@ public class AccountController : BaseApiController
if (emailValidationErrors.Any())
{
var invitedUser = await _unitOfWork.UserRepository.GetUserByEmailAsync(dto.Email);
- if (await _userManager.IsEmailConfirmedAsync(invitedUser))
- return BadRequest($"User is already registered as {invitedUser.UserName}");
+ if (await _userManager.IsEmailConfirmedAsync(invitedUser!))
+ return BadRequest($"User is already registered as {invitedUser!.UserName}");
_logger.LogInformation("A user is attempting to login, but hasn't accepted email invite");
return BadRequest("User is already invited under this email and has yet to accepted invite.");
diff --git a/API/Controllers/BookController.cs b/API/Controllers/BookController.cs
index ea4ba9bdb..62cbcd436 100644
--- a/API/Controllers/BookController.cs
+++ b/API/Controllers/BookController.cs
@@ -37,6 +37,7 @@ public class BookController : BaseApiController
public async Task<ActionResult<BookInfoDto>> GetBookInfo(int chapterId)
{
var dto = await _unitOfWork.ChapterRepository.GetChapterInfoDtoAsync(chapterId);
+ if (dto == null) return BadRequest("Chapter does not exist");
var bookTitle = string.Empty;
switch (dto.SeriesFormat)
{
@@ -93,6 +94,7 @@ public class BookController : BaseApiController
{
if (chapterId <= 0) return BadRequest("Chapter is not valid");
var chapter = await _unitOfWork.ChapterRepository.GetChapterAsync(chapterId);
+ if (chapter == null) return BadRequest("Chapter is not valid");
using var book = await EpubReader.OpenBookAsync(chapter.Files.ElementAt(0).FilePath, BookService.BookReaderOptions);
var key = BookService.CoalesceKeyForAnyFile(book, file);
@@ -116,8 +118,9 @@ public class BookController : BaseApiController
public async Task<ActionResult<ICollection<BookChapterItem>>> GetBookChapters(int chapterId)
{
if (chapterId <= 0) return BadRequest("Chapter is not valid");
-
var chapter = await _unitOfWork.ChapterRepository.GetChapterAsync(chapterId);
+ if (chapter == null) return BadRequest("Chapter is not valid");
+
try
{
return Ok(await _bookService.GenerateTableOfContents(chapter));
@@ -140,6 +143,7 @@ public class BookController : BaseApiController
public async Task<ActionResult<string>> GetBookPage(int chapterId, [FromQuery] int page)
{
var chapter = await _cacheService.Ensure(chapterId);
+ if (chapter == null) return BadRequest("Could not find Chapter");
var path = _cacheService.GetCachedFile(chapter);
var baseUrl = "//" + Request.Host + Request.PathBase + "/api/";
diff --git a/API/Controllers/CBLController.cs b/API/Controllers/CBLController.cs
new file mode 100644
index 000000000..5ff82edb7
--- /dev/null
+++ b/API/Controllers/CBLController.cs
@@ -0,0 +1,135 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Threading.Tasks;
+using API.DTOs.ReadingLists.CBL;
+using API.Extensions;
+using API.Services;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+
+namespace API.Controllers;
+
+/// <summary>
+/// Responsible for the CBL import flow
+/// </summary>
+public class CblController : BaseApiController
+{
+ private readonly IReadingListService _readingListService;
+ private readonly IDirectoryService _directoryService;
+
+ public CblController(IReadingListService readingListService, IDirectoryService directoryService)
+ {
+ _readingListService = readingListService;
+ _directoryService = directoryService;
+ }
+
+ /// <summary>
+ /// The first step in a cbl import. This validates the cbl file that if an import occured, would it be successful.
+ /// If this returns errors, the cbl will always be rejected by Kavita.
+ /// </summary>
+ /// <param name="file">FormBody with parameter name of cbl</param>
+ /// <returns></returns>
+ [HttpPost("validate")]
+ public async Task<ActionResult<CblImportSummaryDto>> ValidateCbl([FromForm(Name = "cbl")] IFormFile file)
+ {
+ var userId = User.GetUserId();
+ try
+ {
+ var cbl = await SaveAndLoadCblFile(file);
+ var importSummary = await _readingListService.ValidateCblFile(userId, cbl);
+ importSummary.FileName = file.FileName;
+ return Ok(importSummary);
+ }
+ catch (ArgumentNullException)
+ {
+ return Ok(new CblImportSummaryDto()
+ {
+ FileName = file.FileName,
+ Success = CblImportResult.Fail,
+ Results = new List<CblBookResult>()
+ {
+ new CblBookResult()
+ {
+ Reason = CblImportReason.InvalidFile
+ }
+ }
+ });
+ }
+ catch (InvalidOperationException)
+ {
+ return Ok(new CblImportSummaryDto()
+ {
+ FileName = file.FileName,
+ Success = CblImportResult.Fail,
+ Results = new List<CblBookResult>()
+ {
+ new CblBookResult()
+ {
+ Reason = CblImportReason.InvalidFile
+ }
+ }
+ });
+ }
+ }
+
+
+ /// <summary>
+ /// Performs the actual import (assuming dryRun = false)
+ /// </summary>
+ /// <param name="file">FormBody with parameter name of cbl</param>
+ /// <param name="dryRun">If true, will only emulate the import but not perform. This should be done to preview what will happen</param>
+ /// <returns></returns>
+ [HttpPost("import")]
+ public async Task<ActionResult<CblImportSummaryDto>> ImportCbl([FromForm(Name = "cbl")] IFormFile file, [FromForm(Name = "dryRun")] bool dryRun = false)
+ {
+ try
+ {
+ var userId = User.GetUserId();
+ var cbl = await SaveAndLoadCblFile(file);
+ var importSummary = await _readingListService.CreateReadingListFromCbl(userId, cbl, dryRun);
+ importSummary.FileName = file.FileName;
+ return Ok(importSummary);
+ } catch (ArgumentNullException)
+ {
+ return Ok(new CblImportSummaryDto()
+ {
+ FileName = file.FileName,
+ Success = CblImportResult.Fail,
+ Results = new List<CblBookResult>()
+ {
+ new CblBookResult()
+ {
+ Reason = CblImportReason.InvalidFile
+ }
+ }
+ });
+ }
+ catch (InvalidOperationException)
+ {
+ return Ok(new CblImportSummaryDto()
+ {
+ FileName = file.FileName,
+ Success = CblImportResult.Fail,
+ Results = new List<CblBookResult>()
+ {
+ new CblBookResult()
+ {
+ Reason = CblImportReason.InvalidFile
+ }
+ }
+ });
+ }
+
+ }
+
+ private async Task<CblReadingList> SaveAndLoadCblFile(IFormFile file)
+ {
+ var filename = Path.GetRandomFileName();
+ var outputFile = Path.Join(_directoryService.TempDirectory, filename);
+ await using var stream = System.IO.File.Create(outputFile);
+ await file.CopyToAsync(stream);
+ stream.Close();
+ return ReadingListService.LoadCblFromPath(outputFile);
+ }
+}
diff --git a/API/Controllers/CollectionController.cs b/API/Controllers/CollectionController.cs
index 0800f3977..e6dc91f5b 100644
--- a/API/Controllers/CollectionController.cs
+++ b/API/Controllers/CollectionController.cs
@@ -1,14 +1,12 @@
using System;
using System.Collections.Generic;
-using System.Linq;
using System.Threading.Tasks;
using API.Data;
+using API.Data.Repositories;
using API.DTOs.CollectionTags;
using API.Entities.Metadata;
using API.Extensions;
using API.Services;
-using API.Services.Tasks.Metadata;
-using API.SignalR;
using Kavita.Common;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
@@ -35,16 +33,17 @@ public class CollectionController : BaseApiController
/// </summary>
/// <returns></returns>
[HttpGet]
- public async Task<IEnumerable<CollectionTagDto>> GetAllTags()
+ public async Task<ActionResult<IEnumerable<CollectionTagDto>>> GetAllTags()
{
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername());
+ if (user == null) return Unauthorized();
var isAdmin = await _unitOfWork.UserRepository.IsUserAdminAsync(user);
if (isAdmin)
{
- return await _unitOfWork.CollectionTagRepository.GetAllTagDtosAsync();
+ return Ok(await _unitOfWork.CollectionTagRepository.GetAllTagDtosAsync());
}
- return await _unitOfWork.CollectionTagRepository.GetAllPromotedTagDtosAsync(user.Id);
+ return Ok(await _unitOfWork.CollectionTagRepository.GetAllPromotedTagDtosAsync(user.Id));
}
/// <summary>
@@ -55,13 +54,13 @@ public class CollectionController : BaseApiController
/// <returns></returns>
[Authorize(Policy = "RequireAdminRole")]
[HttpGet("search")]
- public async Task<IEnumerable<CollectionTagDto>> SearchTags(string queryString)
+ public async Task<ActionResult<IEnumerable<CollectionTagDto>>> SearchTags(string queryString)
{
queryString ??= string.Empty;
queryString = queryString.Replace(@"%", string.Empty);
if (queryString.Length == 0) return await GetAllTags();
- return await _unitOfWork.CollectionTagRepository.SearchTagDtosAsync(queryString, User.GetUserId());
+ return Ok(await _unitOfWork.CollectionTagRepository.SearchTagDtosAsync(queryString, User.GetUserId()));
}
/// <summary>
@@ -126,7 +125,7 @@ public class CollectionController : BaseApiController
{
try
{
- var tag = await _unitOfWork.CollectionTagRepository.GetFullTagAsync(updateSeriesForTagDto.Tag.Id);
+ var tag = await _unitOfWork.CollectionTagRepository.GetTagAsync(updateSeriesForTagDto.Tag.Id, CollectionTagIncludes.SeriesMetadata);
if (tag == null) return BadRequest("Not a valid Tag");
tag.SeriesMetadatas ??= new List<SeriesMetadata>();
diff --git a/API/Controllers/DeviceController.cs b/API/Controllers/DeviceController.cs
index 3d67d2d7f..d709020eb 100644
--- a/API/Controllers/DeviceController.cs
+++ b/API/Controllers/DeviceController.cs
@@ -1,7 +1,5 @@
-using System;
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.Linq;
-using System.Threading;
using System.Threading.Tasks;
using API.Data;
using API.Data.Repositories;
@@ -9,9 +7,7 @@ using API.DTOs.Device;
using API.Extensions;
using API.Services;
using API.SignalR;
-using ExCSS;
using Kavita.Common;
-using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace API.Controllers;
@@ -39,6 +35,7 @@ public class DeviceController : BaseApiController
public async Task<ActionResult> CreateOrUpdateDevice(CreateDeviceDto dto)
{
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername(), AppUserIncludes.Devices);
+ if (user == null) return Unauthorized();
var device = await _deviceService.Create(dto, user);
if (device == null) return BadRequest("There was an error when creating the device");
@@ -50,6 +47,7 @@ public class DeviceController : BaseApiController
public async Task<ActionResult> UpdateDevice(UpdateDeviceDto dto)
{
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername(), AppUserIncludes.Devices);
+ if (user == null) return Unauthorized();
var device = await _deviceService.Update(dto, user);
if (device == null) return BadRequest("There was an error when updating the device");
@@ -67,6 +65,7 @@ public class DeviceController : BaseApiController
{
if (deviceId <= 0) return BadRequest("Not a valid deviceId");
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername(), AppUserIncludes.Devices);
+ if (user == null) return Unauthorized();
if (await _deviceService.Delete(user, deviceId)) return Ok();
return BadRequest("Could not delete device");
diff --git a/API/Controllers/DownloadController.cs b/API/Controllers/DownloadController.cs
index 6c44c2659..be1db4969 100644
--- a/API/Controllers/DownloadController.cs
+++ b/API/Controllers/DownloadController.cs
@@ -93,13 +93,13 @@ public class DownloadController : BaseApiController
public async Task<ActionResult> DownloadVolume(int volumeId)
{
if (!await HasDownloadPermission()) return BadRequest("You do not have permission");
-
- var files = await _unitOfWork.VolumeRepository.GetFilesForVolume(volumeId);
var volume = await _unitOfWork.VolumeRepository.GetVolumeByIdAsync(volumeId);
+ if (volume == null) return BadRequest("Volume doesn't exist");
+ var files = await _unitOfWork.VolumeRepository.GetFilesForVolume(volumeId);
var series = await _unitOfWork.SeriesRepository.GetSeriesByIdAsync(volume.SeriesId);
try
{
- return await DownloadFiles(files, $"download_{User.GetUsername()}_v{volumeId}", $"{series.Name} - Volume {volume.Number}.zip");
+ return await DownloadFiles(files, $"download_{User.GetUsername()}_v{volumeId}", $"{series!.Name} - Volume {volume.Number}.zip");
}
catch (KavitaException ex)
{
@@ -110,6 +110,7 @@ public class DownloadController : BaseApiController
private async Task<bool> HasDownloadPermission()
{
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername());
+ if (user == null) return false;
return await _accountService.HasDownloadPermission(user);
}
@@ -130,11 +131,12 @@ public class DownloadController : BaseApiController
if (!await HasDownloadPermission()) return BadRequest("You do not have permission");
var files = await _unitOfWork.ChapterRepository.GetFilesForChapterAsync(chapterId);
var chapter = await _unitOfWork.ChapterRepository.GetChapterAsync(chapterId);
+ if (chapter == null) return BadRequest("Invalid chapter");
var volume = await _unitOfWork.VolumeRepository.GetVolumeByIdAsync(chapter.VolumeId);
- var series = await _unitOfWork.SeriesRepository.GetSeriesByIdAsync(volume.SeriesId);
+ var series = await _unitOfWork.SeriesRepository.GetSeriesByIdAsync(volume!.SeriesId);
try
{
- return await DownloadFiles(files, $"download_{User.GetUsername()}_c{chapterId}", $"{series.Name} - Chapter {chapter.Number}.zip");
+ return await DownloadFiles(files, $"download_{User.GetUsername()}_c{chapterId}", $"{series!.Name} - Chapter {chapter.Number}.zip");
}
catch (KavitaException ex)
{
@@ -177,8 +179,9 @@ public class DownloadController : BaseApiController
public async Task<ActionResult> DownloadSeries(int seriesId)
{
if (!await HasDownloadPermission()) return BadRequest("You do not have permission");
- var files = await _unitOfWork.SeriesRepository.GetFilesForSeries(seriesId);
var series = await _unitOfWork.SeriesRepository.GetSeriesByIdAsync(seriesId);
+ if (series == null) return BadRequest("Invalid Series");
+ var files = await _unitOfWork.SeriesRepository.GetFilesForSeries(seriesId);
try
{
return await DownloadFiles(files, $"download_{User.GetUsername()}_s{seriesId}", $"{series.Name}.zip");
@@ -201,13 +204,13 @@ public class DownloadController : BaseApiController
if (!downloadBookmarkDto.Bookmarks.Any()) return BadRequest("Bookmarks cannot be empty");
// We know that all bookmarks will be for one single seriesId
- var userId = User.GetUserId();
- var username = User.GetUsername();
+ var userId = User.GetUserId()!;
+ var username = User.GetUsername()!;
var series = await _unitOfWork.SeriesRepository.GetSeriesByIdAsync(downloadBookmarkDto.Bookmarks.First().SeriesId);
var files = await _bookmarkService.GetBookmarkFilesById(downloadBookmarkDto.Bookmarks.Select(b => b.Id));
- var filename = $"{series.Name} - Bookmarks.zip";
+ var filename = $"{series!.Name} - Bookmarks.zip";
await _eventHub.SendMessageAsync(MessageFactory.NotificationProgress,
MessageFactory.DownloadProgressEvent(username, Path.GetFileNameWithoutExtension(filename), 0F));
var seriesIds = string.Join("_", downloadBookmarkDto.Bookmarks.Select(b => b.SeriesId).Distinct());
diff --git a/API/Controllers/FallbackController.cs b/API/Controllers/FallbackController.cs
index 2f5d7fceb..a765269b8 100644
--- a/API/Controllers/FallbackController.cs
+++ b/API/Controllers/FallbackController.cs
@@ -1,9 +1,7 @@
-using System;
-using System.IO;
+using System.IO;
using API.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
-using Microsoft.Extensions.Logging;
namespace API.Controllers;
diff --git a/API/Controllers/HealthController.cs b/API/Controllers/HealthController.cs
index c0d44582f..27fe060ea 100644
--- a/API/Controllers/HealthController.cs
+++ b/API/Controllers/HealthController.cs
@@ -1,5 +1,3 @@
-using System;
-using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
diff --git a/API/Controllers/ImageController.cs b/API/Controllers/ImageController.cs
index 03fbc335e..a158c3bfb 100644
--- a/API/Controllers/ImageController.cs
+++ b/API/Controllers/ImageController.cs
@@ -1,4 +1,5 @@
using System.IO;
+using System.Linq;
using System.Threading.Tasks;
using API.Constants;
using API.Data;
@@ -7,6 +8,7 @@ using API.Extensions;
using API.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
+using MimeTypes;
namespace API.Controllers;
@@ -32,14 +34,15 @@ public class ImageController : BaseApiController
/// <param name="chapterId"></param>
/// <returns></returns>
[HttpGet("chapter-cover")]
- [ResponseCache(CacheProfileName = ResponseCacheProfiles.Images, VaryByQueryKeys = new []{"chapterId"})]
- public async Task<ActionResult> GetChapterCoverImage(int chapterId)
+ [ResponseCache(CacheProfileName = ResponseCacheProfiles.Images, VaryByQueryKeys = new []{"chapterId", "apiKey"})]
+ public async Task<ActionResult> GetChapterCoverImage(int chapterId, string apiKey)
{
+ if (await _unitOfWork.UserRepository.GetUserIdByApiKeyAsync(apiKey) == 0) return BadRequest();
var path = Path.Join(_directoryService.CoverImageDirectory, await _unitOfWork.ChapterRepository.GetChapterCoverImageAsync(chapterId));
if (string.IsNullOrEmpty(path) || !_directoryService.FileSystem.File.Exists(path)) return BadRequest($"No cover image");
- var format = _directoryService.FileSystem.Path.GetExtension(path).Replace(".", string.Empty);
+ var format = _directoryService.FileSystem.Path.GetExtension(path);
- return PhysicalFile(path, "image/" + format, _directoryService.FileSystem.Path.GetFileName(path));
+ return PhysicalFile(path, MimeTypeMap.GetMimeType(format), _directoryService.FileSystem.Path.GetFileName(path));
}
/// <summary>
@@ -48,14 +51,15 @@ public class ImageController : BaseApiController
/// <param name="libraryId"></param>
/// <returns></returns>
[HttpGet("library-cover")]
- [ResponseCache(CacheProfileName = ResponseCacheProfiles.Images, VaryByQueryKeys = new []{"libraryId"})]
- public async Task<ActionResult> GetLibraryCoverImage(int libraryId)
+ [ResponseCache(CacheProfileName = ResponseCacheProfiles.Images, VaryByQueryKeys = new []{"libraryId", "apiKey"})]
+ public async Task<ActionResult> GetLibraryCoverImage(int libraryId, string apiKey)
{
+ if (await _unitOfWork.UserRepository.GetUserIdByApiKeyAsync(apiKey) == 0) return BadRequest();
var path = Path.Join(_directoryService.CoverImageDirectory, await _unitOfWork.LibraryRepository.GetLibraryCoverImageAsync(libraryId));
if (string.IsNullOrEmpty(path) || !_directoryService.FileSystem.File.Exists(path)) return BadRequest($"No cover image");
- var format = _directoryService.FileSystem.Path.GetExtension(path).Replace(".", string.Empty);
+ var format = _directoryService.FileSystem.Path.GetExtension(path);
- return PhysicalFile(path, "image/" + format, _directoryService.FileSystem.Path.GetFileName(path));
+ return PhysicalFile(path, MimeTypeMap.GetMimeType(format), _directoryService.FileSystem.Path.GetFileName(path));
}
/// <summary>
@@ -64,14 +68,15 @@ public class ImageController : BaseApiController
/// <param name="volumeId"></param>
/// <returns></returns>
[HttpGet("volume-cover")]
- [ResponseCache(CacheProfileName = ResponseCacheProfiles.Images, VaryByQueryKeys = new []{"volumeId"})]
- public async Task<ActionResult> GetVolumeCoverImage(int volumeId)
+ [ResponseCache(CacheProfileName = ResponseCacheProfiles.Images, VaryByQueryKeys = new []{"volumeId", "apiKey"})]
+ public async Task<ActionResult> GetVolumeCoverImage(int volumeId, string apiKey)
{
+ if (await _unitOfWork.UserRepository.GetUserIdByApiKeyAsync(apiKey) == 0) return BadRequest();
var path = Path.Join(_directoryService.CoverImageDirectory, await _unitOfWork.VolumeRepository.GetVolumeCoverImageAsync(volumeId));
if (string.IsNullOrEmpty(path) || !_directoryService.FileSystem.File.Exists(path)) return BadRequest($"No cover image");
- var format = _directoryService.FileSystem.Path.GetExtension(path).Replace(".", string.Empty);
+ var format = _directoryService.FileSystem.Path.GetExtension(path);
- return PhysicalFile(path, "image/" + format, _directoryService.FileSystem.Path.GetFileName(path));
+ return PhysicalFile(path, MimeTypeMap.GetMimeType(format), _directoryService.FileSystem.Path.GetFileName(path));
}
/// <summary>
@@ -79,17 +84,18 @@ public class ImageController : BaseApiController
/// </summary>
/// <param name="seriesId">Id of Series</param>
/// <returns></returns>
- [ResponseCache(CacheProfileName = ResponseCacheProfiles.Images, VaryByQueryKeys = new []{"seriesId"})]
+ [ResponseCache(CacheProfileName = ResponseCacheProfiles.Images, VaryByQueryKeys = new []{"seriesId", "apiKey"})]
[HttpGet("series-cover")]
- public async Task<ActionResult> GetSeriesCoverImage(int seriesId)
+ public async Task<ActionResult> GetSeriesCoverImage(int seriesId, string apiKey)
{
+ if (await _unitOfWork.UserRepository.GetUserIdByApiKeyAsync(apiKey) == 0) return BadRequest();
var path = Path.Join(_directoryService.CoverImageDirectory, await _unitOfWork.SeriesRepository.GetSeriesCoverImageAsync(seriesId));
if (string.IsNullOrEmpty(path) || !_directoryService.FileSystem.File.Exists(path)) return BadRequest($"No cover image");
- var format = _directoryService.FileSystem.Path.GetExtension(path).Replace(".", string.Empty);
+ var format = _directoryService.FileSystem.Path.GetExtension(path);
Response.AddCacheHeader(path);
- return PhysicalFile(path, "image/" + format, _directoryService.FileSystem.Path.GetFileName(path));
+ return PhysicalFile(path, MimeTypeMap.GetMimeType(format), _directoryService.FileSystem.Path.GetFileName(path));
}
/// <summary>
@@ -98,14 +104,15 @@ public class ImageController : BaseApiController
/// <param name="collectionTagId"></param>
/// <returns></returns>
[HttpGet("collection-cover")]
- [ResponseCache(CacheProfileName = ResponseCacheProfiles.Images, VaryByQueryKeys = new []{"collectionTagId"})]
- public async Task<ActionResult> GetCollectionCoverImage(int collectionTagId)
+ [ResponseCache(CacheProfileName = ResponseCacheProfiles.Images, VaryByQueryKeys = new []{"collectionTagId", "apiKey"})]
+ public async Task<ActionResult> GetCollectionCoverImage(int collectionTagId, string apiKey)
{
+ if (await _unitOfWork.UserRepository.GetUserIdByApiKeyAsync(apiKey) == 0) return BadRequest();
var path = Path.Join(_directoryService.CoverImageDirectory, await _unitOfWork.CollectionTagRepository.GetCoverImageAsync(collectionTagId));
if (string.IsNullOrEmpty(path) || !_directoryService.FileSystem.File.Exists(path)) return BadRequest($"No cover image");
- var format = _directoryService.FileSystem.Path.GetExtension(path).Replace(".", string.Empty);
+ var format = _directoryService.FileSystem.Path.GetExtension(path);
- return PhysicalFile(path, "image/" + format, _directoryService.FileSystem.Path.GetFileName(path));
+ return PhysicalFile(path, MimeTypeMap.GetMimeType(format), _directoryService.FileSystem.Path.GetFileName(path));
}
/// <summary>
@@ -114,14 +121,15 @@ public class ImageController : BaseApiController
/// <param name="readingListId"></param>
/// <returns></returns>
[HttpGet("readinglist-cover")]
- [ResponseCache(CacheProfileName = ResponseCacheProfiles.Images, VaryByQueryKeys = new []{"readingListId"})]
- public async Task<ActionResult> GetReadingListCoverImage(int readingListId)
+ [ResponseCache(CacheProfileName = ResponseCacheProfiles.Images, VaryByQueryKeys = new []{"readingListId", "apiKey"})]
+ public async Task<ActionResult> GetReadingListCoverImage(int readingListId, string apiKey)
{
+ if (await _unitOfWork.UserRepository.GetUserIdByApiKeyAsync(apiKey) == 0) return BadRequest();
var path = Path.Join(_directoryService.CoverImageDirectory, await _unitOfWork.ReadingListRepository.GetCoverImageAsync(readingListId));
if (string.IsNullOrEmpty(path) || !_directoryService.FileSystem.File.Exists(path)) return BadRequest($"No cover image");
- var format = _directoryService.FileSystem.Path.GetExtension(path).Replace(".", string.Empty);
+ var format = _directoryService.FileSystem.Path.GetExtension(path);
- return PhysicalFile(path, "image/" + format, _directoryService.FileSystem.Path.GetFileName(path));
+ return PhysicalFile(path, MimeTypeMap.GetMimeType(format), _directoryService.FileSystem.Path.GetFileName(path));
}
/// <summary>
@@ -137,15 +145,16 @@ public class ImageController : BaseApiController
public async Task<ActionResult> GetBookmarkImage(int chapterId, int pageNum, string apiKey)
{
var userId = await _unitOfWork.UserRepository.GetUserIdByApiKeyAsync(apiKey);
+ if (userId == 0) return BadRequest();
var bookmark = await _unitOfWork.UserRepository.GetBookmarkForPage(pageNum, chapterId, userId);
if (bookmark == null) return BadRequest("Bookmark does not exist");
var bookmarkDirectory =
(await _unitOfWork.SettingsRepository.GetSettingAsync(ServerSettingKey.BookmarkDirectory)).Value;
var file = new FileInfo(Path.Join(bookmarkDirectory, bookmark.FileName));
- var format = Path.GetExtension(file.FullName).Replace(".", string.Empty);
+ var format = Path.GetExtension(file.FullName);
- return PhysicalFile(file.FullName, "image/" + format, Path.GetFileName(file.FullName));
+ return PhysicalFile(file.FullName, MimeTypeMap.GetMimeType(format), Path.GetFileName(file.FullName));
}
/// <summary>
@@ -155,15 +164,16 @@ public class ImageController : BaseApiController
/// <returns></returns>
[Authorize(Policy="RequireAdminRole")]
[HttpGet("cover-upload")]
- [ResponseCache(CacheProfileName = ResponseCacheProfiles.Images, VaryByQueryKeys = new []{"filename"})]
- public ActionResult GetCoverUploadImage(string filename)
+ [ResponseCache(CacheProfileName = ResponseCacheProfiles.Images, VaryByQueryKeys = new []{"filename", "apiKey"})]
+ public async Task<ActionResult> GetCoverUploadImage(string filename, string apiKey)
{
+ if (await _unitOfWork.UserRepository.GetUserIdByApiKeyAsync(apiKey) == 0) return BadRequest();
if (filename.Contains("..")) return BadRequest("Invalid Filename");
var path = Path.Join(_directoryService.TempDirectory, filename);
if (string.IsNullOrEmpty(path) || !_directoryService.FileSystem.File.Exists(path)) return BadRequest($"File does not exist");
- var format = _directoryService.FileSystem.Path.GetExtension(path).Replace(".", string.Empty);
+ var format = _directoryService.FileSystem.Path.GetExtension(path);
- return PhysicalFile(path, "image/" + format, _directoryService.FileSystem.Path.GetFileName(path));
+ return PhysicalFile(path, MimeTypeMap.GetMimeType(format), _directoryService.FileSystem.Path.GetFileName(path));
}
}
diff --git a/API/Controllers/LibraryController.cs b/API/Controllers/LibraryController.cs
index acb275fa3..9f93eb033 100644
--- a/API/Controllers/LibraryController.cs
+++ b/API/Controllers/LibraryController.cs
@@ -7,7 +7,6 @@ using API.Data;
using API.Data.Repositories;
using API.DTOs;
using API.DTOs.JumpBar;
-using API.DTOs.Search;
using API.DTOs.System;
using API.Entities;
using API.Entities.Enums;
@@ -17,7 +16,6 @@ using API.Services;
using API.Services.Tasks.Scanner;
using API.SignalR;
using AutoMapper;
-using Kavita.Common;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
@@ -113,13 +111,21 @@ public class LibraryController : BaseApiController
return Ok(_directoryService.ListDirectory(path));
}
-
+ /// <summary>
+ /// Return all libraries in the Server
+ /// </summary>
+ /// <returns></returns>
[HttpGet]
public async Task<ActionResult<IEnumerable<LibraryDto>>> GetLibraries()
{
return Ok(await _unitOfWork.LibraryRepository.GetLibraryDtosForUsernameAsync(User.GetUsername()));
}
+ /// <summary>
+ /// For a given library, generate the jump bar information
+ /// </summary>
+ /// <param name="libraryId"></param>
+ /// <returns></returns>
[HttpGet("jump-bar")]
public async Task<ActionResult<IEnumerable<JumpKeyDto>>> GetJumpBar(int libraryId)
{
@@ -129,7 +135,11 @@ public class LibraryController : BaseApiController
return Ok(_unitOfWork.LibraryRepository.GetJumpBarAsync(libraryId));
}
-
+ /// <summary>
+ /// Grants a user account access to a Library
+ /// </summary>
+ /// <param name="updateLibraryForUserDto"></param>
+ /// <returns></returns>
[Authorize(Policy = "RequireAdminRole")]
[HttpPost("grant-access")]
public async Task<ActionResult<MemberDto>> UpdateUserLibraries(UpdateLibraryForUserDto updateLibraryForUserDto)
@@ -174,14 +184,34 @@ public class LibraryController : BaseApiController
return BadRequest("There was a critical issue. Please try again.");
}
+ /// <summary>
+ /// Scans a given library for file changes.
+ /// </summary>
+ /// <param name="libraryId"></param>
+ /// <param name="force">If true, will ignore any optimizations to avoid file I/O and will treat similar to a first scan</param>
+ /// <returns></returns>
[Authorize(Policy = "RequireAdminRole")]
[HttpPost("scan")]
public ActionResult Scan(int libraryId, bool force = false)
{
+ if (libraryId <= 0) return BadRequest("Invalid libraryId");
_taskScheduler.ScanLibrary(libraryId, force);
return Ok();
}
+ /// <summary>
+ /// Scans a given library for file changes. If another scan task is in progress, will reschedule the invocation for 3 hours in future.
+ /// </summary>
+ /// <param name="force">If true, will ignore any optimizations to avoid file I/O and will treat similar to a first scan</param>
+ /// <returns></returns>
+ [Authorize(Policy = "RequireAdminRole")]
+ [HttpPost("scan-all")]
+ public ActionResult ScanAll(bool force = false)
+ {
+ _taskScheduler.ScanLibraries(force);
+ return Ok();
+ }
+
[Authorize(Policy = "RequireAdminRole")]
[HttpPost("refresh-metadata")]
public ActionResult RefreshMetadata(int libraryId, bool force = true)
@@ -209,6 +239,7 @@ public class LibraryController : BaseApiController
{
var userId = await _unitOfWork.UserRepository.GetUserIdByApiKeyAsync(dto.ApiKey);
var user = await _unitOfWork.UserRepository.GetUserByIdAsync(userId);
+ if (user == null) return Unauthorized();
// Validate user has Admin privileges
var isAdmin = await _unitOfWork.UserRepository.IsUserAdminAsync(user);
@@ -244,7 +275,6 @@ public class LibraryController : BaseApiController
try
{
- var library = await _unitOfWork.LibraryRepository.GetLibraryForIdAsync(libraryId, LibraryIncludes.None);
if (TaskScheduler.HasScanTaskRunningForLibrary(libraryId))
{
_logger.LogInformation("User is attempting to delete a library while a scan is in progress");
@@ -252,6 +282,9 @@ public class LibraryController : BaseApiController
"You cannot delete a library while a scan is in progress. Please wait for scan to complete or restart Kavita then try to delete");
}
+ var library = await _unitOfWork.LibraryRepository.GetLibraryForIdAsync(libraryId);
+ if (library == null) return BadRequest("Library no longer exists");
+
// Due to a bad schema that I can't figure out how to fix, we need to erase all RelatedSeries before we delete the library
// Aka SeriesRelation has an invalid foreign key
foreach (var s in await _unitOfWork.SeriesRepository.GetSeriesForLibraryIdAsync(library.Id,
@@ -317,8 +350,10 @@ public class LibraryController : BaseApiController
[HttpPost("update")]
public async Task<ActionResult> UpdateLibrary(UpdateLibraryDto dto)
{
- var newName = dto.Name.Trim();
var library = await _unitOfWork.LibraryRepository.GetLibraryForIdAsync(dto.Id, LibraryIncludes.Folders);
+ if (library == null) return BadRequest("Library doesn't exist");
+
+ var newName = dto.Name.Trim();
if (await _unitOfWork.LibraryRepository.LibraryExists(newName) && !library.Name.Equals(newName))
return BadRequest("Library name already exists");
@@ -335,6 +370,8 @@ public class LibraryController : BaseApiController
library.IncludeInRecommended = dto.IncludeInRecommended;
library.IncludeInSearch = dto.IncludeInSearch;
library.ManageCollections = dto.ManageCollections;
+ library.ManageReadingLists = dto.ManageReadingLists;
+
_unitOfWork.LibraryRepository.Update(library);
diff --git a/API/Controllers/MetadataController.cs b/API/Controllers/MetadataController.cs
index 9b3c5876a..3891b788d 100644
--- a/API/Controllers/MetadataController.cs
+++ b/API/Controllers/MetadataController.cs
@@ -31,6 +31,7 @@ public class MetadataController : BaseApiController
/// <param name="libraryIds">String separated libraryIds or null for all genres</param>
/// <returns></returns>
[HttpGet("genres")]
+ [ResponseCache(CacheProfileName = ResponseCacheProfiles.Instant, VaryByQueryKeys = new []{"libraryIds"})]
public async Task<ActionResult<IList<GenreTagDto>>> GetAllGenres(string? libraryIds)
{
var userId = await _unitOfWork.UserRepository.GetUserIdByUsernameAsync(User.GetUsername());
@@ -51,6 +52,7 @@ public class MetadataController : BaseApiController
/// <param name="libraryIds">String separated libraryIds or null for all people</param>
/// <returns></returns>
[HttpGet("people")]
+ [ResponseCache(CacheProfileName = ResponseCacheProfiles.Instant, VaryByQueryKeys = new []{"libraryIds"})]
public async Task<ActionResult<IList<PersonDto>>> GetAllPeople(string? libraryIds)
{
var userId = await _unitOfWork.UserRepository.GetUserIdByUsernameAsync(User.GetUsername());
@@ -68,6 +70,7 @@ public class MetadataController : BaseApiController
/// <param name="libraryIds">String separated libraryIds or null for all tags</param>
/// <returns></returns>
[HttpGet("tags")]
+ [ResponseCache(CacheProfileName = ResponseCacheProfiles.Instant, VaryByQueryKeys = new []{"libraryIds"})]
public async Task<ActionResult<IList<TagDto>>> GetAllTags(string? libraryIds)
{
var userId = await _unitOfWork.UserRepository.GetUserIdByUsernameAsync(User.GetUsername());
@@ -132,6 +135,7 @@ public class MetadataController : BaseApiController
/// <param name="libraryIds">String separated libraryIds or null for all ratings</param>
/// <returns></returns>
[HttpGet("languages")]
+ [ResponseCache(CacheProfileName = ResponseCacheProfiles.Instant, VaryByQueryKeys = new []{"libraryIds"})]
public async Task<ActionResult<IList<LanguageDto>>> GetAllLanguages(string? libraryIds)
{
var ids = libraryIds?.Split(",").Select(int.Parse).ToList();
@@ -145,6 +149,7 @@ public class MetadataController : BaseApiController
}
[HttpGet("all-languages")]
+ [ResponseCache(CacheProfileName = ResponseCacheProfiles.Hour)]
public IEnumerable<LanguageDto> GetAllValidLanguages()
{
return CultureInfo.GetCultures(CultureTypes.AllCultures).Select(c =>
diff --git a/API/Controllers/OPDSController.cs b/API/Controllers/OPDSController.cs
index e39825893..9925bb417 100644
--- a/API/Controllers/OPDSController.cs
+++ b/API/Controllers/OPDSController.cs
@@ -20,6 +20,7 @@ using API.Services;
using Kavita.Common;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
+using MimeTypes;
namespace API.Controllers;
@@ -37,7 +38,6 @@ public class OpdsController : BaseApiController
private readonly XmlSerializer _xmlSerializer;
private readonly XmlSerializer _xmlOpenSearchSerializer;
- private const string Prefix = "/api/opds/";
private readonly FilterDto _filterDto = new FilterDto()
{
Formats = new List<MangaFormat>(),
@@ -62,7 +62,8 @@ public class OpdsController : BaseApiController
SortOptions = null,
PublicationStatus = new List<PublicationStatus>()
};
- private readonly ChapterSortComparer _chapterSortComparer = new ChapterSortComparer();
+ private readonly ChapterSortComparer _chapterSortComparer = ChapterSortComparer.Default;
+ private const int PageSize = 20;
public OpdsController(IUnitOfWork unitOfWork, IDownloadService downloadService,
IDirectoryService directoryService, ICacheService cacheService,
@@ -79,7 +80,6 @@ public class OpdsController : BaseApiController
_xmlSerializer = new XmlSerializer(typeof(Feed));
_xmlOpenSearchSerializer = new XmlSerializer(typeof(OpenSearchDescription));
-
}
[HttpPost("{apiKey}")]
@@ -89,7 +89,10 @@ public class OpdsController : BaseApiController
{
if (!(await _unitOfWork.SettingsRepository.GetSettingsDtoAsync()).EnableOpds)
return BadRequest("OPDS is not enabled on this server");
- var feed = CreateFeed("Kavita", string.Empty, apiKey);
+
+ var (baseUrl, prefix) = await GetPrefix();
+
+ var feed = CreateFeed("Kavita", string.Empty, apiKey, prefix, baseUrl);
SetFeedId(feed, "root");
feed.Entries.Add(new FeedEntry()
{
@@ -101,7 +104,7 @@ public class OpdsController : BaseApiController
},
Links = new List<FeedLink>()
{
- CreateLink(FeedLinkRelation.SubSection, FeedLinkType.AtomNavigation, Prefix + $"{apiKey}/on-deck"),
+ CreateLink(FeedLinkRelation.SubSection, FeedLinkType.AtomNavigation, $"{prefix}{apiKey}/on-deck"),
}
});
feed.Entries.Add(new FeedEntry()
@@ -114,7 +117,7 @@ public class OpdsController : BaseApiController
},
Links = new List<FeedLink>()
{
- CreateLink(FeedLinkRelation.SubSection, FeedLinkType.AtomNavigation, Prefix + $"{apiKey}/recently-added"),
+ CreateLink(FeedLinkRelation.SubSection, FeedLinkType.AtomNavigation, $"{prefix}{apiKey}/recently-added"),
}
});
feed.Entries.Add(new FeedEntry()
@@ -127,7 +130,7 @@ public class OpdsController : BaseApiController
},
Links = new List<FeedLink>()
{
- CreateLink(FeedLinkRelation.SubSection, FeedLinkType.AtomNavigation, Prefix + $"{apiKey}/reading-list"),
+ CreateLink(FeedLinkRelation.SubSection, FeedLinkType.AtomNavigation, $"{prefix}{apiKey}/reading-list"),
}
});
feed.Entries.Add(new FeedEntry()
@@ -140,7 +143,7 @@ public class OpdsController : BaseApiController
},
Links = new List<FeedLink>()
{
- CreateLink(FeedLinkRelation.SubSection, FeedLinkType.AtomNavigation, Prefix + $"{apiKey}/libraries"),
+ CreateLink(FeedLinkRelation.SubSection, FeedLinkType.AtomNavigation, $"{prefix}{apiKey}/libraries"),
}
});
feed.Entries.Add(new FeedEntry()
@@ -153,12 +156,25 @@ public class OpdsController : BaseApiController
},
Links = new List<FeedLink>()
{
- CreateLink(FeedLinkRelation.SubSection, FeedLinkType.AtomNavigation, Prefix + $"{apiKey}/collections"),
+ CreateLink(FeedLinkRelation.SubSection, FeedLinkType.AtomNavigation, $"{prefix}{apiKey}/collections"),
}
});
return CreateXmlResult(SerializeXml(feed));
}
+ private async Task<Tuple<string, string>> GetPrefix()
+ {
+ var baseUrl = (await _unitOfWork.SettingsRepository.GetSettingAsync(ServerSettingKey.BaseUrl)).Value;
+ var prefix = "/api/opds/";
+ if (!Configuration.DefaultBaseUrl.Equals(baseUrl))
+ {
+ // We need to update the Prefix to account for baseUrl
+ prefix = baseUrl + "api/opds/";
+ }
+
+ return new Tuple<string, string>(baseUrl, prefix);
+ }
+
[HttpGet("{apiKey}/libraries")]
[Produces("application/xml")]
@@ -166,9 +182,10 @@ public class OpdsController : BaseApiController
{
if (!(await _unitOfWork.SettingsRepository.GetSettingsDtoAsync()).EnableOpds)
return BadRequest("OPDS is not enabled on this server");
+ var (baseUrl, prefix) = await GetPrefix();
var userId = await GetUser(apiKey);
var libraries = await _unitOfWork.LibraryRepository.GetLibrariesForUserIdAsync(userId);
- var feed = CreateFeed("All Libraries", $"{apiKey}/libraries", apiKey);
+ var feed = CreateFeed("All Libraries", $"{prefix}{apiKey}/libraries", apiKey, prefix, baseUrl);
SetFeedId(feed, "libraries");
foreach (var library in libraries)
{
@@ -178,7 +195,7 @@ public class OpdsController : BaseApiController
Title = library.Name,
Links = new List<FeedLink>()
{
- CreateLink(FeedLinkRelation.SubSection, FeedLinkType.AtomNavigation, Prefix + $"{apiKey}/libraries/{library.Id}"),
+ CreateLink(FeedLinkRelation.SubSection, FeedLinkType.AtomNavigation, $"{prefix}{apiKey}/libraries/{library.Id}"),
}
});
}
@@ -192,15 +209,17 @@ public class OpdsController : BaseApiController
{
if (!(await _unitOfWork.SettingsRepository.GetSettingsDtoAsync()).EnableOpds)
return BadRequest("OPDS is not enabled on this server");
+ var (baseUrl, prefix) = await GetPrefix();
var userId = await GetUser(apiKey);
var user = await _unitOfWork.UserRepository.GetUserByIdAsync(userId);
+ if (user == null) return Unauthorized();
var isAdmin = await _unitOfWork.UserRepository.IsUserAdminAsync(user);
- IEnumerable<CollectionTagDto> tags = isAdmin ? (await _unitOfWork.CollectionTagRepository.GetAllTagDtosAsync())
+ var tags = isAdmin ? (await _unitOfWork.CollectionTagRepository.GetAllTagDtosAsync())
: (await _unitOfWork.CollectionTagRepository.GetAllPromotedTagDtosAsync(userId));
- var feed = CreateFeed("All Collections", $"{apiKey}/collections", apiKey);
+ var feed = CreateFeed("All Collections", $"{prefix}{apiKey}/collections", apiKey, prefix, baseUrl);
SetFeedId(feed, "collections");
foreach (var tag in tags)
{
@@ -211,9 +230,9 @@ public class OpdsController : BaseApiController
Summary = tag.Summary,
Links = new List<FeedLink>()
{
- CreateLink(FeedLinkRelation.SubSection, FeedLinkType.AtomNavigation, Prefix + $"{apiKey}/collections/{tag.Id}"),
- CreateLink(FeedLinkRelation.Image, FeedLinkType.Image, $"/api/image/collection-cover?collectionId={tag.Id}"),
- CreateLink(FeedLinkRelation.Thumbnail, FeedLinkType.Image, $"/api/image/collection-cover?collectionId={tag.Id}")
+ CreateLink(FeedLinkRelation.SubSection, FeedLinkType.AtomNavigation, $"{prefix}{apiKey}/collections/{tag.Id}"),
+ CreateLink(FeedLinkRelation.Image, FeedLinkType.Image, $"{baseUrl}api/image/collection-cover?collectionId={tag.Id}&apiKey={apiKey}"),
+ CreateLink(FeedLinkRelation.Thumbnail, FeedLinkType.Image, $"{baseUrl}api/image/collection-cover?collectionId={tag.Id}&apiKey={apiKey}")
}
});
}
@@ -228,8 +247,10 @@ public class OpdsController : BaseApiController
{
if (!(await _unitOfWork.SettingsRepository.GetSettingsDtoAsync()).EnableOpds)
return BadRequest("OPDS is not enabled on this server");
+ var (baseUrl, prefix) = await GetPrefix();
var userId = await GetUser(apiKey);
var user = await _unitOfWork.UserRepository.GetUserByIdAsync(userId);
+ if (user == null) return Unauthorized();
var isAdmin = await _unitOfWork.UserRepository.IsUserAdminAsync(user);
IEnumerable <CollectionTagDto> tags;
@@ -248,20 +269,16 @@ public class OpdsController : BaseApiController
return BadRequest("Collection does not exist or you don't have access");
}
- var series = await _unitOfWork.SeriesRepository.GetSeriesDtoForCollectionAsync(collectionId, userId, new UserParams()
- {
- PageNumber = pageNumber,
- PageSize = 20
- });
+ var series = await _unitOfWork.SeriesRepository.GetSeriesDtoForCollectionAsync(collectionId, userId, GetUserParams(pageNumber));
var seriesMetadatas = await _unitOfWork.SeriesRepository.GetSeriesMetadataForIds(series.Select(s => s.Id));
- var feed = CreateFeed(tag.Title + " Collection", $"{apiKey}/collections/{collectionId}", apiKey);
+ var feed = CreateFeed(tag.Title + " Collection", $"{prefix}{apiKey}/collections/{collectionId}", apiKey, prefix, baseUrl);
SetFeedId(feed, $"collections-{collectionId}");
- AddPagination(feed, series, $"{Prefix}{apiKey}/collections/{collectionId}");
+ AddPagination(feed, series, $"{prefix}{apiKey}/collections/{collectionId}");
foreach (var seriesDto in series)
{
- feed.Entries.Add(CreateSeries(seriesDto, seriesMetadatas.First(s => s.SeriesId == seriesDto.Id), apiKey));
+ feed.Entries.Add(CreateSeries(seriesDto, seriesMetadatas.First(s => s.SeriesId == seriesDto.Id), apiKey, prefix, baseUrl));
}
@@ -274,15 +291,14 @@ public class OpdsController : BaseApiController
{
if (!(await _unitOfWork.SettingsRepository.GetSettingsDtoAsync()).EnableOpds)
return BadRequest("OPDS is not enabled on this server");
+ var (baseUrl, prefix) = await GetPrefix();
var userId = await GetUser(apiKey);
- var readingLists = await _unitOfWork.ReadingListRepository.GetReadingListDtosForUserAsync(userId, true, new UserParams()
- {
- PageNumber = pageNumber
- });
+ var readingLists = await _unitOfWork.ReadingListRepository.GetReadingListDtosForUserAsync(userId,
+ true, GetUserParams(pageNumber), false);
- var feed = CreateFeed("All Reading Lists", $"{apiKey}/reading-list", apiKey);
+ var feed = CreateFeed("All Reading Lists", $"{prefix}{apiKey}/reading-list", apiKey, prefix, baseUrl);
SetFeedId(feed, "reading-list");
foreach (var readingListDto in readingLists)
{
@@ -293,7 +309,7 @@ public class OpdsController : BaseApiController
Summary = readingListDto.Summary,
Links = new List<FeedLink>()
{
- CreateLink(FeedLinkRelation.SubSection, FeedLinkType.AtomNavigation, Prefix + $"{apiKey}/reading-list/{readingListDto.Id}"),
+ CreateLink(FeedLinkRelation.SubSection, FeedLinkType.AtomNavigation, $"{prefix}{apiKey}/reading-list/{readingListDto.Id}"),
}
});
}
@@ -301,29 +317,42 @@ public class OpdsController : BaseApiController
return CreateXmlResult(SerializeXml(feed));
}
+ private static UserParams GetUserParams(int pageNumber)
+ {
+ return new UserParams()
+ {
+ PageNumber = pageNumber,
+ PageSize = PageSize
+ };
+ }
+
[HttpGet("{apiKey}/reading-list/{readingListId}")]
[Produces("application/xml")]
public async Task<IActionResult> GetReadingListItems(int readingListId, string apiKey)
{
if (!(await _unitOfWork.SettingsRepository.GetSettingsDtoAsync()).EnableOpds)
return BadRequest("OPDS is not enabled on this server");
+ var (baseUrl, prefix) = await GetPrefix();
var userId = await GetUser(apiKey);
var user = await _unitOfWork.UserRepository.GetUserByIdAsync(userId);
- var userWithLists = await _unitOfWork.UserRepository.GetUserByUsernameAsync(user.UserName, AppUserIncludes.ReadingListsWithItems);
+ var userWithLists = await _unitOfWork.UserRepository.GetUserByUsernameAsync(user!.UserName!, AppUserIncludes.ReadingListsWithItems);
+ if (userWithLists == null) return Unauthorized();
var readingList = userWithLists.ReadingLists.SingleOrDefault(t => t.Id == readingListId);
if (readingList == null)
{
return BadRequest("Reading list does not exist or you don't have access");
}
- var feed = CreateFeed(readingList.Title + " Reading List", $"{apiKey}/reading-list/{readingListId}", apiKey);
+ var feed = CreateFeed(readingList.Title + " Reading List", $"{prefix}{apiKey}/reading-list/{readingListId}", apiKey, prefix, baseUrl);
SetFeedId(feed, $"reading-list-{readingListId}");
var items = (await _unitOfWork.ReadingListRepository.GetReadingListItemDtosByIdAsync(readingListId, userId)).ToList();
foreach (var item in items)
{
- feed.Entries.Add(CreateChapter(apiKey, $"{item.Order} - {item.SeriesName}: {item.Title}", string.Empty, item.ChapterId, item.VolumeId, item.SeriesId));
+ feed.Entries.Add(
+ CreateChapter(apiKey, $"{item.Order} - {item.SeriesName}: {item.Title}",
+ string.Empty, item.ChapterId, item.VolumeId, item.SeriesId, prefix, baseUrl));
}
return CreateXmlResult(SerializeXml(feed));
}
@@ -334,6 +363,7 @@ public class OpdsController : BaseApiController
{
if (!(await _unitOfWork.SettingsRepository.GetSettingsDtoAsync()).EnableOpds)
return BadRequest("OPDS is not enabled on this server");
+ var (baseUrl, prefix) = await GetPrefix();
var userId = await GetUser(apiKey);
var library =
(await _unitOfWork.LibraryRepository.GetLibrariesForUserIdAsync(userId)).SingleOrDefault(l =>
@@ -343,20 +373,16 @@ public class OpdsController : BaseApiController
return BadRequest("User does not have access to this library");
}
- var series = await _unitOfWork.SeriesRepository.GetSeriesDtoForLibraryIdAsync(libraryId, userId, new UserParams()
- {
- PageNumber = pageNumber,
- PageSize = 20
- }, _filterDto);
+ var series = await _unitOfWork.SeriesRepository.GetSeriesDtoForLibraryIdAsync(libraryId, userId, GetUserParams(pageNumber), _filterDto);
var seriesMetadatas = await _unitOfWork.SeriesRepository.GetSeriesMetadataForIds(series.Select(s => s.Id));
- var feed = CreateFeed(library.Name, $"{apiKey}/libraries/{libraryId}", apiKey);
+ var feed = CreateFeed(library.Name, $"{apiKey}/libraries/{libraryId}", apiKey, prefix, baseUrl);
SetFeedId(feed, $"library-{library.Name}");
- AddPagination(feed, series, $"{Prefix}{apiKey}/libraries/{libraryId}");
+ AddPagination(feed, series, $"{prefix}{apiKey}/libraries/{libraryId}");
foreach (var seriesDto in series)
{
- feed.Entries.Add(CreateSeries(seriesDto, seriesMetadatas.First(s => s.SeriesId == seriesDto.Id), apiKey));
+ feed.Entries.Add(CreateSeries(seriesDto, seriesMetadatas.First(s => s.SeriesId == seriesDto.Id), apiKey, prefix, baseUrl));
}
return CreateXmlResult(SerializeXml(feed));
@@ -368,21 +394,18 @@ public class OpdsController : BaseApiController
{
if (!(await _unitOfWork.SettingsRepository.GetSettingsDtoAsync()).EnableOpds)
return BadRequest("OPDS is not enabled on this server");
+ var (baseUrl, prefix) = await GetPrefix();
var userId = await GetUser(apiKey);
- var recentlyAdded = await _unitOfWork.SeriesRepository.GetRecentlyAdded(0, userId, new UserParams()
- {
- PageNumber = pageNumber,
- PageSize = 20
- }, _filterDto);
+ var recentlyAdded = await _unitOfWork.SeriesRepository.GetRecentlyAdded(0, userId, GetUserParams(pageNumber), _filterDto);
var seriesMetadatas = await _unitOfWork.SeriesRepository.GetSeriesMetadataForIds(recentlyAdded.Select(s => s.Id));
- var feed = CreateFeed("Recently Added", $"{apiKey}/recently-added", apiKey);
+ var feed = CreateFeed("Recently Added", $"{prefix}{apiKey}/recently-added", apiKey, prefix, baseUrl);
SetFeedId(feed, "recently-added");
- AddPagination(feed, recentlyAdded, $"{Prefix}{apiKey}/recently-added");
+ AddPagination(feed, recentlyAdded, $"{prefix}{apiKey}/recently-added");
foreach (var seriesDto in recentlyAdded)
{
- feed.Entries.Add(CreateSeries(seriesDto, seriesMetadatas.First(s => s.SeriesId == seriesDto.Id), apiKey));
+ feed.Entries.Add(CreateSeries(seriesDto, seriesMetadatas.First(s => s.SeriesId == seriesDto.Id), apiKey, prefix, baseUrl));
}
return CreateXmlResult(SerializeXml(feed));
@@ -394,23 +417,23 @@ public class OpdsController : BaseApiController
{
if (!(await _unitOfWork.SettingsRepository.GetSettingsDtoAsync()).EnableOpds)
return BadRequest("OPDS is not enabled on this server");
+
+ var (baseUrl, prefix) = await GetPrefix();
+
var userId = await GetUser(apiKey);
- var userParams = new UserParams()
- {
- PageNumber = pageNumber,
- };
+ var userParams = GetUserParams(pageNumber);
var pagedList = await _unitOfWork.SeriesRepository.GetOnDeck(userId, 0, userParams, _filterDto);
var seriesMetadatas = await _unitOfWork.SeriesRepository.GetSeriesMetadataForIds(pagedList.Select(s => s.Id));
Response.AddPaginationHeader(pagedList.CurrentPage, pagedList.PageSize, pagedList.TotalCount, pagedList.TotalPages);
- var feed = CreateFeed("On Deck", $"{apiKey}/on-deck", apiKey);
+ var feed = CreateFeed("On Deck", $"{prefix}{apiKey}/on-deck", apiKey, prefix, baseUrl);
SetFeedId(feed, "on-deck");
- AddPagination(feed, pagedList, $"{Prefix}{apiKey}/on-deck");
+ AddPagination(feed, pagedList, $"{prefix}{apiKey}/on-deck");
foreach (var seriesDto in pagedList)
{
- feed.Entries.Add(CreateSeries(seriesDto, seriesMetadatas.First(s => s.SeriesId == seriesDto.Id), apiKey));
+ feed.Entries.Add(CreateSeries(seriesDto, seriesMetadatas.First(s => s.SeriesId == seriesDto.Id), apiKey, prefix, baseUrl));
}
return CreateXmlResult(SerializeXml(feed));
@@ -422,6 +445,7 @@ public class OpdsController : BaseApiController
{
if (!(await _unitOfWork.SettingsRepository.GetSettingsDtoAsync()).EnableOpds)
return BadRequest("OPDS is not enabled on this server");
+ var (baseUrl, prefix) = await GetPrefix();
var userId = await GetUser(apiKey);
var user = await _unitOfWork.UserRepository.GetUserByIdAsync(userId);
@@ -432,18 +456,17 @@ public class OpdsController : BaseApiController
query = query.Replace(@"%", string.Empty);
// Get libraries user has access to
var libraries = (await _unitOfWork.LibraryRepository.GetLibrariesForUserIdAsync(userId)).ToList();
-
if (!libraries.Any()) return BadRequest("User does not have access to any libraries");
var isAdmin = await _unitOfWork.UserRepository.IsUserAdminAsync(user);
var series = await _unitOfWork.SeriesRepository.SearchSeries(userId, isAdmin, libraries.Select(l => l.Id).ToArray(), query);
- var feed = CreateFeed(query, $"{apiKey}/series?query=" + query, apiKey);
+ var feed = CreateFeed(query, $"{prefix}{apiKey}/series?query=" + query, apiKey, prefix, baseUrl);
SetFeedId(feed, "search-series");
foreach (var seriesDto in series.Series)
{
- feed.Entries.Add(CreateSeries(seriesDto, apiKey));
+ feed.Entries.Add(CreateSeries(seriesDto, apiKey, prefix, baseUrl));
}
foreach (var collection in series.Collections)
@@ -456,11 +479,11 @@ public class OpdsController : BaseApiController
Links = new List<FeedLink>()
{
CreateLink(FeedLinkRelation.SubSection, FeedLinkType.AtomNavigation,
- Prefix + $"{apiKey}/collections/{collection.Id}"),
+ $"{prefix}{apiKey}/collections/{collection.Id}"),
CreateLink(FeedLinkRelation.Image, FeedLinkType.Image,
- $"/api/image/collection-cover?collectionId={collection.Id}"),
+ $"{baseUrl}api/image/collection-cover?collectionId={collection.Id}&apiKey={apiKey}"),
CreateLink(FeedLinkRelation.Thumbnail, FeedLinkType.Image,
- $"/api/image/collection-cover?collectionId={collection.Id}")
+ $"{baseUrl}api/image/collection-cover?collectionId={collection.Id}&apiKey={apiKey}")
}
});
}
@@ -474,7 +497,7 @@ public class OpdsController : BaseApiController
Summary = readingListDto.Summary,
Links = new List<FeedLink>()
{
- CreateLink(FeedLinkRelation.SubSection, FeedLinkType.AtomNavigation, Prefix + $"{apiKey}/reading-list/{readingListDto.Id}"),
+ CreateLink(FeedLinkRelation.SubSection, FeedLinkType.AtomNavigation, $"{prefix}{apiKey}/reading-list/{readingListDto.Id}"),
}
});
}
@@ -494,6 +517,7 @@ public class OpdsController : BaseApiController
{
if (!(await _unitOfWork.SettingsRepository.GetSettingsDtoAsync()).EnableOpds)
return BadRequest("OPDS is not enabled on this server");
+ var (baseUrl, prefix) = await GetPrefix();
var feed = new OpenSearchDescription()
{
ShortName = "Search",
@@ -501,7 +525,7 @@ public class OpdsController : BaseApiController
Url = new SearchLink()
{
Type = FeedLinkType.AtomAcquisition,
- Template = $"{Prefix}{apiKey}/series?query=" + "{searchTerms}"
+ Template = $"{prefix}{apiKey}/series?query=" + "{searchTerms}"
}
};
@@ -517,39 +541,50 @@ public class OpdsController : BaseApiController
{
if (!(await _unitOfWork.SettingsRepository.GetSettingsDtoAsync()).EnableOpds)
return BadRequest("OPDS is not enabled on this server");
+ var (baseUrl, prefix) = await GetPrefix();
var userId = await GetUser(apiKey);
var series = await _unitOfWork.SeriesRepository.GetSeriesDtoByIdAsync(seriesId, userId);
- var feed = CreateFeed(series.Name + " - Storyline", $"{apiKey}/series/{series.Id}", apiKey);
+ var feed = CreateFeed(series.Name + " - Storyline", $"{prefix}{apiKey}/series/{series.Id}", apiKey, prefix, baseUrl);
SetFeedId(feed, $"series-{series.Id}");
- feed.Links.Add(CreateLink(FeedLinkRelation.Image, FeedLinkType.Image, $"/api/image/series-cover?seriesId={seriesId}"));
+ feed.Links.Add(CreateLink(FeedLinkRelation.Image, FeedLinkType.Image, $"{baseUrl}api/image/series-cover?seriesId={seriesId}&apiKey={apiKey}"));
var seriesDetail = await _seriesService.GetSeriesDetail(seriesId, userId);
foreach (var volume in seriesDetail.Volumes)
{
- // If there is only one chapter to the Volume, we will emulate a volume to flatten the amount of hops a user must go through
- if (volume.Chapters.Count == 1)
- {
- var firstChapter = volume.Chapters.First();
- var chapter = CreateChapter(apiKey, volume.Name, firstChapter.Summary, firstChapter.Id, volume.Id, seriesId);
- chapter.Id = firstChapter.Id.ToString();
- feed.Entries.Add(chapter);
- }
- else
+ var chapters = (await _unitOfWork.ChapterRepository.GetChaptersAsync(volume.Id)).OrderBy(x => double.Parse(x.Number),
+ _chapterSortComparer);
+
+ foreach (var chapter in chapters)
{
- feed.Entries.Add(CreateVolume(volume, seriesId, apiKey));
+ var files = await _unitOfWork.ChapterRepository.GetFilesForChapterAsync(chapter.Id);
+ var chapterTest = await _unitOfWork.ChapterRepository.GetChapterDtoAsync(chapter.Id);
+ foreach (var mangaFile in files)
+ {
+ feed.Entries.Add(await CreateChapterWithFile(seriesId, volume.Id, chapter.Id, mangaFile, series, chapterTest, apiKey, prefix, baseUrl));
+ }
}
}
foreach (var storylineChapter in seriesDetail.StorylineChapters.Where(c => !c.IsSpecial))
{
- feed.Entries.Add(CreateChapter(apiKey, storylineChapter.Title, storylineChapter.Summary, storylineChapter.Id, storylineChapter.VolumeId, seriesId));
+ var files = await _unitOfWork.ChapterRepository.GetFilesForChapterAsync(storylineChapter.Id);
+ var chapterTest = await _unitOfWork.ChapterRepository.GetChapterDtoAsync(storylineChapter.Id);
+ foreach (var mangaFile in files)
+ {
+ feed.Entries.Add(await CreateChapterWithFile(seriesId, storylineChapter.VolumeId, storylineChapter.Id, mangaFile, series, chapterTest, apiKey, prefix, baseUrl));
+ }
}
foreach (var special in seriesDetail.Specials)
{
- feed.Entries.Add(CreateChapter(apiKey, special.Title, special.Summary, special.Id, special.VolumeId, seriesId));
+ var files = await _unitOfWork.ChapterRepository.GetFilesForChapterAsync(special.Id);
+ var chapterTest = await _unitOfWork.ChapterRepository.GetChapterDtoAsync(special.Id);
+ foreach (var mangaFile in files)
+ {
+ feed.Entries.Add(await CreateChapterWithFile(seriesId, special.VolumeId, special.Id, mangaFile, series, chapterTest, apiKey, prefix, baseUrl));
+ }
}
return CreateXmlResult(SerializeXml(feed));
@@ -561,6 +596,7 @@ public class OpdsController : BaseApiController
{
if (!(await _unitOfWork.SettingsRepository.GetSettingsDtoAsync()).EnableOpds)
return BadRequest("OPDS is not enabled on this server");
+ var (baseUrl, prefix) = await GetPrefix();
var userId = await GetUser(apiKey);
var series = await _unitOfWork.SeriesRepository.GetSeriesDtoByIdAsync(seriesId, userId);
var libraryType = await _unitOfWork.LibraryRepository.GetLibraryTypeAsync(series.LibraryId);
@@ -568,21 +604,17 @@ public class OpdsController : BaseApiController
var chapters =
(await _unitOfWork.ChapterRepository.GetChaptersAsync(volumeId)).OrderBy(x => double.Parse(x.Number),
_chapterSortComparer);
-
- var feed = CreateFeed(series.Name + " - Volume " + volume.Name + $" - {SeriesService.FormatChapterName(libraryType)}s ", $"{apiKey}/series/{seriesId}/volume/{volumeId}", apiKey);
+ var feed = CreateFeed(series.Name + " - Volume " + volume!.Name + $" - {SeriesService.FormatChapterName(libraryType)}s ",
+ $"{prefix}{apiKey}/series/{seriesId}/volume/{volumeId}", apiKey, prefix, baseUrl);
SetFeedId(feed, $"series-{series.Id}-volume-{volume.Id}-{SeriesService.FormatChapterName(libraryType)}s");
foreach (var chapter in chapters)
{
- feed.Entries.Add(new FeedEntry()
+ var files = await _unitOfWork.ChapterRepository.GetFilesForChapterAsync(chapter.Id);
+ var chapterTest = await _unitOfWork.ChapterRepository.GetChapterDtoAsync(chapter.Id);
+ foreach (var mangaFile in files)
{
- Id = chapter.Id.ToString(),
- Title = SeriesService.FormatChapterTitle(chapter, libraryType),
- Links = new List<FeedLink>()
- {
- CreateLink(FeedLinkRelation.SubSection, FeedLinkType.AtomNavigation, Prefix + $"{apiKey}/series/{seriesId}/volume/{volumeId}/chapter/{chapter.Id}"),
- CreateLink(FeedLinkRelation.Image, FeedLinkType.Image, $"/api/image/chapter-cover?chapterId={chapter.Id}")
- }
- });
+ feed.Entries.Add(await CreateChapterWithFile(seriesId, volumeId, chapter.Id, mangaFile, series, chapterTest, apiKey, prefix, baseUrl));
+ }
}
return CreateXmlResult(SerializeXml(feed));
@@ -594,18 +626,21 @@ public class OpdsController : BaseApiController
{
if (!(await _unitOfWork.SettingsRepository.GetSettingsDtoAsync()).EnableOpds)
return BadRequest("OPDS is not enabled on this server");
+ var (baseUrl, prefix) = await GetPrefix();
var userId = await GetUser(apiKey);
var series = await _unitOfWork.SeriesRepository.GetSeriesDtoByIdAsync(seriesId, userId);
var libraryType = await _unitOfWork.LibraryRepository.GetLibraryTypeAsync(series.LibraryId);
- var volume = await _unitOfWork.VolumeRepository.GetVolumeAsync(volumeId);
var chapter = await _unitOfWork.ChapterRepository.GetChapterDtoAsync(chapterId);
+ if (chapter == null) return BadRequest("Chapter doesn't exist");
+ var volume = await _unitOfWork.VolumeRepository.GetVolumeAsync(volumeId);
var files = await _unitOfWork.ChapterRepository.GetFilesForChapterAsync(chapterId);
- var feed = CreateFeed(series.Name + " - Volume " + volume.Name + $" - {SeriesService.FormatChapterName(libraryType)}s", $"{apiKey}/series/{seriesId}/volume/{volumeId}/chapter/{chapterId}", apiKey);
+ var feed = CreateFeed(series.Name + " - Volume " + volume!.Name + $" - {SeriesService.FormatChapterName(libraryType)}s",
+ $"{prefix}{apiKey}/series/{seriesId}/volume/{volumeId}/chapter/{chapterId}", apiKey, prefix, baseUrl);
SetFeedId(feed, $"series-{series.Id}-volume-{volumeId}-{SeriesService.FormatChapterName(libraryType)}-{chapterId}-files");
foreach (var mangaFile in files)
{
- feed.Entries.Add(await CreateChapterWithFile(seriesId, volumeId, chapterId, mangaFile, series, chapter, apiKey));
+ feed.Entries.Add(await CreateChapterWithFile(seriesId, volumeId, chapterId, mangaFile, series, chapter, apiKey, prefix, baseUrl));
}
return CreateXmlResult(SerializeXml(feed));
@@ -683,7 +718,7 @@ public class OpdsController : BaseApiController
feed.StartIndex = (Math.Max(list.CurrentPage - 1, 0) * list.PageSize) + 1;
}
- private static FeedEntry CreateSeries(SeriesDto seriesDto, SeriesMetadataDto metadata, string apiKey)
+ private static FeedEntry CreateSeries(SeriesDto seriesDto, SeriesMetadataDto metadata, string apiKey, string prefix, string baseUrl)
{
return new FeedEntry()
{
@@ -693,7 +728,7 @@ public class OpdsController : BaseApiController
Authors = metadata.Writers.Select(p => new FeedAuthor()
{
Name = p.Name,
- Uri = "http://opds-spec.org/author"
+ Uri = "http://opds-spec.org/author/" + p.Id
}).ToList(),
Categories = metadata.Genres.Select(g => new FeedCategory()
{
@@ -702,14 +737,14 @@ public class OpdsController : BaseApiController
}).ToList(),
Links = new List<FeedLink>()
{
- CreateLink(FeedLinkRelation.SubSection, FeedLinkType.AtomNavigation, Prefix + $"{apiKey}/series/{seriesDto.Id}"),
- CreateLink(FeedLinkRelation.Image, FeedLinkType.Image, $"/api/image/series-cover?seriesId={seriesDto.Id}"),
- CreateLink(FeedLinkRelation.Thumbnail, FeedLinkType.Image, $"/api/image/series-cover?seriesId={seriesDto.Id}")
+ CreateLink(FeedLinkRelation.SubSection, FeedLinkType.AtomNavigation, $"{prefix}{apiKey}/series/{seriesDto.Id}"),
+ CreateLink(FeedLinkRelation.Image, FeedLinkType.Image, $"{baseUrl}api/image/series-cover?seriesId={seriesDto.Id}&apiKey={apiKey}"),
+ CreateLink(FeedLinkRelation.Thumbnail, FeedLinkType.Image, $"{baseUrl}api/image/series-cover?seriesId={seriesDto.Id}&apiKey={apiKey}")
}
};
}
- private static FeedEntry CreateSeries(SearchResultDto searchResultDto, string apiKey)
+ private static FeedEntry CreateSeries(SearchResultDto searchResultDto, string apiKey, string prefix, string baseUrl)
{
return new FeedEntry()
{
@@ -717,33 +752,14 @@ public class OpdsController : BaseApiController
Title = $"{searchResultDto.Name} ({searchResultDto.Format})",
Links = new List<FeedLink>()
{
- CreateLink(FeedLinkRelation.SubSection, FeedLinkType.AtomNavigation, Prefix + $"{apiKey}/series/{searchResultDto.SeriesId}"),
- CreateLink(FeedLinkRelation.Image, FeedLinkType.Image, $"/api/image/series-cover?seriesId={searchResultDto.SeriesId}"),
- CreateLink(FeedLinkRelation.Thumbnail, FeedLinkType.Image, $"/api/image/series-cover?seriesId={searchResultDto.SeriesId}")
- }
- };
- }
-
- private static FeedEntry CreateVolume(VolumeDto volumeDto, int seriesId, string apiKey)
- {
- return new FeedEntry()
- {
- Id = volumeDto.Id.ToString(),
- Title = volumeDto.Name,
- Summary = volumeDto.Chapters.First().Summary ?? string.Empty,
- Links = new List<FeedLink>()
- {
- CreateLink(FeedLinkRelation.SubSection, FeedLinkType.AtomNavigation,
- Prefix + $"{apiKey}/series/{seriesId}/volume/{volumeDto.Id}"),
- CreateLink(FeedLinkRelation.Image, FeedLinkType.Image,
- $"/api/image/volume-cover?volumeId={volumeDto.Id}"),
- CreateLink(FeedLinkRelation.Thumbnail, FeedLinkType.Image,
- $"/api/image/volume-cover?volumeId={volumeDto.Id}")
+ CreateLink(FeedLinkRelation.SubSection, FeedLinkType.AtomNavigation, $"{prefix}{apiKey}/series/{searchResultDto.SeriesId}"),
+ CreateLink(FeedLinkRelation.Image, FeedLinkType.Image, $"{baseUrl}api/image/series-cover?seriesId={searchResultDto.SeriesId}&apiKey={apiKey}"),
+ CreateLink(FeedLinkRelation.Thumbnail, FeedLinkType.Image, $"{baseUrl}api/image/series-cover?seriesId={searchResultDto.SeriesId}&apiKey={apiKey}")
}
};
}
- private static FeedEntry CreateChapter(string apiKey, string title, string summary, int chapterId, int volumeId, int seriesId)
+ private static FeedEntry CreateChapter(string apiKey, string title, string summary, int chapterId, int volumeId, int seriesId, string prefix, string baseUrl)
{
return new FeedEntry()
{
@@ -753,30 +769,40 @@ public class OpdsController : BaseApiController
Links = new List<FeedLink>()
{
CreateLink(FeedLinkRelation.SubSection, FeedLinkType.AtomNavigation,
- Prefix + $"{apiKey}/series/{seriesId}/volume/{volumeId}/chapter/{chapterId}"),
+ $"{prefix}{apiKey}/series/{seriesId}/volume/{volumeId}/chapter/{chapterId}"),
CreateLink(FeedLinkRelation.Image, FeedLinkType.Image,
- $"/api/image/chapter-cover?chapterId={chapterId}"),
+ $"{baseUrl}api/image/chapter-cover?chapterId={chapterId}&apiKey={apiKey}"),
CreateLink(FeedLinkRelation.Thumbnail, FeedLinkType.Image,
- $"/api/image/chapter-cover?chapterId={chapterId}")
+ $"{baseUrl}api/image/chapter-cover?chapterId={chapterId}&apiKey={apiKey}")
}
};
}
- private async Task<FeedEntry> CreateChapterWithFile(int seriesId, int volumeId, int chapterId, MangaFile mangaFile, SeriesDto series, ChapterDto chapter, string apiKey)
+ private async Task<FeedEntry> CreateChapterWithFile(int seriesId, int volumeId, int chapterId, MangaFile mangaFile, SeriesDto series, ChapterDto chapter, string apiKey, string prefix, string baseUrl)
{
var fileSize =
+ mangaFile.Bytes > 0 ? DirectoryService.GetHumanReadableBytes(mangaFile.Bytes) :
DirectoryService.GetHumanReadableBytes(_directoryService.GetTotalSize(new List<string>()
{mangaFile.FilePath}));
var fileType = _downloadService.GetContentTypeFromFile(mangaFile.FilePath);
- var filename = Uri.EscapeDataString(Path.GetFileName(mangaFile.FilePath) ?? string.Empty);
+ var filename = Uri.EscapeDataString(Path.GetFileName(mangaFile.FilePath));
var libraryType = await _unitOfWork.LibraryRepository.GetLibraryTypeAsync(series.LibraryId);
var volume = await _unitOfWork.VolumeRepository.GetVolumeDtoAsync(volumeId, await GetUser(apiKey));
- var title = $"{series.Name} - ";
- if (volume.Chapters.Count == 1)
+
+ var title = $"{series.Name}";
+
+ if (volume!.Chapters.Count == 1)
{
SeriesService.RenameVolumeName(volume.Chapters.First(), volume, libraryType);
- title += $"{volume.Name}";
+ if (volume.Name != "0")
+ {
+ title += $" - {volume.Name}";
+ }
+ }
+ else if (volume.Number != 0)
+ {
+ title = $"{series.Name} - Volume {volume.Name} - {SeriesService.FormatChapterTitle(chapter, libraryType)}";
}
else
{
@@ -786,7 +812,7 @@ public class OpdsController : BaseApiController
// Chunky requires a file at the end. Our API ignores this
var accLink =
CreateLink(FeedLinkRelation.Acquisition, fileType,
- $"{Prefix}{apiKey}/series/{seriesId}/volume/{volumeId}/chapter/{chapterId}/download/{filename}",
+ $"{prefix}{apiKey}/series/{seriesId}/volume/{volumeId}/chapter/{chapterId}/download/{filename}",
filename);
accLink.TotalPages = chapter.Pages;
@@ -799,11 +825,11 @@ public class OpdsController : BaseApiController
Format = mangaFile.Format.ToString(),
Links = new List<FeedLink>()
{
- CreateLink(FeedLinkRelation.Image, FeedLinkType.Image, $"/api/image/chapter-cover?chapterId={chapterId}"),
- CreateLink(FeedLinkRelation.Thumbnail, FeedLinkType.Image, $"/api/image/chapter-cover?chapterId={chapterId}"),
+ CreateLink(FeedLinkRelation.Image, FeedLinkType.Image, $"{baseUrl}api/image/chapter-cover?chapterId={chapterId}&apiKey={apiKey}"),
+ CreateLink(FeedLinkRelation.Thumbnail, FeedLinkType.Image, $"{baseUrl}api/image/chapter-cover?chapterId={chapterId}&apiKey={apiKey}"),
// We can't not include acc link in the feed, panels doesn't work with just page streaming option. We have to block download directly
accLink,
- CreatePageStreamLink(series.LibraryId,seriesId, volumeId, chapterId, mangaFile, apiKey)
+ await CreatePageStreamLink(series.LibraryId, seriesId, volumeId, chapterId, mangaFile, apiKey, prefix)
},
Content = new FeedEntryContent()
{
@@ -815,6 +841,16 @@ public class OpdsController : BaseApiController
return entry;
}
+ /// <summary>
+ /// This returns a streamed image following OPDS-PS v1.2
+ /// </summary>
+ /// <param name="apiKey"></param>
+ /// <param name="libraryId"></param>
+ /// <param name="seriesId"></param>
+ /// <param name="volumeId"></param>
+ /// <param name="chapterId"></param>
+ /// <param name="pageNumber"></param>
+ /// <returns></returns>
[HttpGet("{apiKey}/image")]
public async Task<ActionResult> GetPageStreamedImage(string apiKey, [FromQuery] int libraryId, [FromQuery] int seriesId, [FromQuery] int volumeId,[FromQuery] int chapterId, [FromQuery] int pageNumber)
{
@@ -828,7 +864,7 @@ public class OpdsController : BaseApiController
if (string.IsNullOrEmpty(path) || !System.IO.File.Exists(path)) return BadRequest($"No such image for page {pageNumber}");
var content = await _directoryService.ReadFileAsync(path);
- var format = Path.GetExtension(path).Replace(".", string.Empty);
+ var format = Path.GetExtension(path);
// Calculates SHA1 Hash for byte[]
Response.AddCacheHeader(content);
@@ -843,7 +879,7 @@ public class OpdsController : BaseApiController
LibraryId =libraryId
}, await GetUser(apiKey));
- return File(content, "image/" + format);
+ return File(content, MimeTypeMap.GetMimeType(format));
}
catch (Exception)
{
@@ -860,9 +896,9 @@ public class OpdsController : BaseApiController
if (files.Length == 0) return BadRequest("Cannot find icon");
var path = files[0];
var content = await _directoryService.ReadFileAsync(path);
- var format = Path.GetExtension(path).Replace(".", string.Empty);
+ var format = Path.GetExtension(path);
- return File(content, "image/" + format);
+ return File(content, MimeTypeMap.GetMimeType(format));
}
/// <summary>
@@ -883,14 +919,25 @@ public class OpdsController : BaseApiController
throw new KavitaException("User does not exist");
}
- private static FeedLink CreatePageStreamLink(int libraryId, int seriesId, int volumeId, int chapterId, MangaFile mangaFile, string apiKey)
+ private async Task<FeedLink> CreatePageStreamLink(int libraryId, int seriesId, int volumeId, int chapterId, MangaFile mangaFile, string apiKey, string prefix)
{
- var link = CreateLink(FeedLinkRelation.Stream, "image/jpeg", $"{Prefix}{apiKey}/image?libraryId={libraryId}&seriesId={seriesId}&volumeId={volumeId}&chapterId={chapterId}&pageNumber=" + "{pageNumber}");
+ var userId = await GetUser(apiKey);
+ var progress = await _unitOfWork.AppUserProgressRepository.GetUserProgressDtoAsync(chapterId, userId);
+
+ // TODO: Type could be wrong
+ var link = CreateLink(FeedLinkRelation.Stream, "image/jpeg",
+ $"{prefix}{apiKey}/image?libraryId={libraryId}&seriesId={seriesId}&volumeId={volumeId}&chapterId={chapterId}&pageNumber=" + "{pageNumber}");
link.TotalPages = mangaFile.Pages;
+ if (progress != null)
+ {
+ link.LastRead = progress.PageNum;
+ link.LastReadDate = progress.LastModifiedUtc;
+ }
+ link.IsPageStream = true;
return link;
}
- private static FeedLink CreateLink(string rel, string type, string href, string title = null)
+ private static FeedLink CreateLink(string rel, string type, string href, string? title = null)
{
return new FeedLink()
{
@@ -901,21 +948,21 @@ public class OpdsController : BaseApiController
};
}
- private static Feed CreateFeed(string title, string href, string apiKey)
+ private static Feed CreateFeed(string title, string href, string apiKey, string prefix, string baseUrl)
{
var link = CreateLink(FeedLinkRelation.Self, string.IsNullOrEmpty(href) ?
FeedLinkType.AtomNavigation :
- FeedLinkType.AtomAcquisition, Prefix + href);
+ FeedLinkType.AtomAcquisition, prefix + href);
return new Feed()
{
Title = title,
- Icon = Prefix + $"{apiKey}/favicon",
+ Icon = $"{prefix}{apiKey}/favicon",
Links = new List<FeedLink>()
{
link,
- CreateLink(FeedLinkRelation.Start, FeedLinkType.AtomNavigation, Prefix + apiKey),
- CreateLink(FeedLinkRelation.Search, FeedLinkType.AtomSearch, Prefix + $"{apiKey}/search")
+ CreateLink(FeedLinkRelation.Start, FeedLinkType.AtomNavigation, $"{prefix}{apiKey}"),
+ CreateLink(FeedLinkRelation.Search, FeedLinkType.AtomSearch, $"{prefix}{apiKey}/search")
},
};
}
diff --git a/API/Controllers/PluginController.cs b/API/Controllers/PluginController.cs
index 39f396985..8e1e6027f 100644
--- a/API/Controllers/PluginController.cs
+++ b/API/Controllers/PluginController.cs
@@ -2,7 +2,9 @@
using System.Threading.Tasks;
using API.Data;
using API.DTOs;
+using API.Entities.Enums;
using API.Services;
+using Kavita.Common;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
@@ -38,12 +40,14 @@ public class PluginController : BaseApiController
var userId = await _unitOfWork.UserRepository.GetUserIdByApiKeyAsync(apiKey);
if (userId <= 0) return Unauthorized();
var user = await _unitOfWork.UserRepository.GetUserByIdAsync(userId);
- _logger.LogInformation("Plugin {PluginName} has authenticated with {UserName} ({UserId})'s API Key", pluginName, user.UserName, userId);
+ _logger.LogInformation("Plugin {PluginName} has authenticated with {UserName} ({UserId})'s API Key", pluginName, user!.UserName, userId);
return new UserDto
{
- Username = user.UserName,
+ Username = user.UserName!,
Token = await _tokenService.CreateToken(user),
+ RefreshToken = await _tokenService.CreateRefreshToken(user),
ApiKey = user.ApiKey,
+ KavitaVersion = (await _unitOfWork.SettingsRepository.GetSettingAsync(ServerSettingKey.InstallVersion)).Value
};
}
}
diff --git a/API/Controllers/ReaderController.cs b/API/Controllers/ReaderController.cs
index 79948ce60..5060a1a36 100644
--- a/API/Controllers/ReaderController.cs
+++ b/API/Controllers/ReaderController.cs
@@ -13,13 +13,13 @@ using API.Entities;
using API.Entities.Enums;
using API.Extensions;
using API.Services;
-using API.Services.Tasks;
using API.SignalR;
using Hangfire;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Microsoft.IdentityModel.Tokens;
+using MimeTypes;
namespace API.Controllers;
@@ -57,9 +57,10 @@ public class ReaderController : BaseApiController
/// <param name="chapterId"></param>
/// <returns></returns>
[HttpGet("pdf")]
- [ResponseCache(CacheProfileName = ResponseCacheProfiles.Hour)]
- public async Task<ActionResult> GetPdf(int chapterId)
+ [ResponseCache(CacheProfileName = ResponseCacheProfiles.Hour, VaryByQueryKeys = new []{"chapterId", "apiKey"})]
+ public async Task<ActionResult> GetPdf(int chapterId, string apiKey)
{
+ if (await _unitOfWork.UserRepository.GetUserIdByApiKeyAsync(apiKey) == 0) return BadRequest();
var chapter = await _cacheService.Ensure(chapterId);
if (chapter == null) return BadRequest("There was an issue finding pdf file for reading");
@@ -89,14 +90,16 @@ public class ReaderController : BaseApiController
/// <remarks>This will cache the chapter images for reading</remarks>
/// <param name="chapterId">Chapter Id</param>
/// <param name="page">Page in question</param>
+ /// <param name="apiKey">User's API Key for authentication</param>
/// <param name="extractPdf">Should Kavita extract pdf into images. Defaults to false.</param>
/// <returns></returns>
[HttpGet("image")]
- [ResponseCache(CacheProfileName = ResponseCacheProfiles.Hour)]
+ [ResponseCache(CacheProfileName = ResponseCacheProfiles.Hour, VaryByQueryKeys = new []{"chapterId","page", "extractPdf", "apiKey"})]
[AllowAnonymous]
- public async Task<ActionResult> GetImage(int chapterId, int page, bool extractPdf = false)
+ public async Task<ActionResult> GetImage(int chapterId, int page, string apiKey, bool extractPdf = false)
{
if (page < 0) page = 0;
+ if (await _unitOfWork.UserRepository.GetUserIdByApiKeyAsync(apiKey) == 0) return BadRequest();
var chapter = await _cacheService.Ensure(chapterId, extractPdf);
if (chapter == null) return BadRequest("There was an issue finding image file for reading");
@@ -104,9 +107,9 @@ public class ReaderController : BaseApiController
{
var path = _cacheService.GetCachedPagePath(chapter.Id, page);
if (string.IsNullOrEmpty(path) || !System.IO.File.Exists(path)) return BadRequest($"No such image for page {page}. Try refreshing to allow re-cache.");
- var format = Path.GetExtension(path).Replace(".", "");
+ var format = Path.GetExtension(path);
- return PhysicalFile(path, "image/" + format, Path.GetFileName(path), true);
+ return PhysicalFile(path, MimeTypeMap.GetMimeType(format), Path.GetFileName(path), true);
}
catch (Exception)
{
@@ -115,6 +118,21 @@ public class ReaderController : BaseApiController
}
}
+ [HttpGet("thumbnail")]
+ [ResponseCache(CacheProfileName = ResponseCacheProfiles.Hour, VaryByQueryKeys = new []{"chapterId", "pageNum", "apiKey"})]
+ [AllowAnonymous]
+ public async Task<ActionResult> GetThumbnail(int chapterId, int pageNum, string apiKey)
+ {
+ if (await _unitOfWork.UserRepository.GetUserIdByApiKeyAsync(apiKey) == 0) return BadRequest();
+ var chapter = await _cacheService.Ensure(chapterId, true);
+ if (chapter == null) return BadRequest("There was an issue extracting images from chapter");
+ var images = _cacheService.GetCachedPages(chapterId);
+
+ var path = await _readerService.GetThumbnail(chapter, pageNum, images);
+ var format = Path.GetExtension(path);
+ return PhysicalFile(path, MimeTypeMap.GetMimeType(format), Path.GetFileName(path), true);
+ }
+
/// <summary>
/// Returns an image for a given bookmark series. Side effect: This will cache the bookmark images for reading.
/// </summary>
@@ -124,12 +142,13 @@ public class ReaderController : BaseApiController
/// <remarks>We must use api key as bookmarks could be leaked to other users via the API</remarks>
/// <returns></returns>
[HttpGet("bookmark-image")]
- [ResponseCache(CacheProfileName = ResponseCacheProfiles.Hour)]
+ [ResponseCache(CacheProfileName = ResponseCacheProfiles.Hour, VaryByQueryKeys = new []{"seriesId", "page", "apiKey"})]
[AllowAnonymous]
public async Task<ActionResult> GetBookmarkImage(int seriesId, string apiKey, int page)
{
if (page < 0) page = 0;
var userId = await _unitOfWork.UserRepository.GetUserIdByApiKeyAsync(apiKey);
+ if (userId == 0) return BadRequest();
var totalPages = await _cacheService.CacheBookmarkForSeries(userId, seriesId);
if (page > totalPages)
@@ -141,9 +160,9 @@ public class ReaderController : BaseApiController
{
var path = _cacheService.GetCachedBookmarkPagePath(seriesId, page);
if (string.IsNullOrEmpty(path) || !System.IO.File.Exists(path)) return BadRequest($"No such image for page {page}");
- var format = Path.GetExtension(path).Replace(".", string.Empty);
+ var format = Path.GetExtension(path);
- return PhysicalFile(path, "image/" + format, Path.GetFileName(path));
+ return PhysicalFile(path, MimeTypeMap.GetMimeType(format), Path.GetFileName(path));
}
catch (Exception)
{
@@ -164,15 +183,16 @@ public class ReaderController : BaseApiController
[ResponseCache(CacheProfileName = ResponseCacheProfiles.Hour, VaryByQueryKeys = new []{"chapterId", "extractPdf"})]
public async Task<ActionResult<IEnumerable<FileDimensionDto>>> GetFileDimensions(int chapterId, bool extractPdf = false)
{
- if (chapterId <= 0) return null;
+ if (chapterId <= 0) return ArraySegment<FileDimensionDto>.Empty;
var chapter = await _cacheService.Ensure(chapterId, extractPdf);
if (chapter == null) return BadRequest("Could not find Chapter");
- return Ok(_cacheService.GetCachedFileDimensions(chapterId));
+ return Ok(_cacheService.GetCachedFileDimensions(_cacheService.GetCachePath(chapterId)));
}
/// <summary>
/// Returns various information about a Chapter. Side effect: This will cache the chapter images for reading.
/// </summary>
+ /// <remarks>This is generally the first call when attempting to read to allow pre-generation of assets needed for reading</remarks>
/// <param name="chapterId"></param>
/// <param name="extractPdf">Should Kavita extract pdf into images. Defaults to false.</param>
/// <param name="includeDimensions">Include file dimensions. Only useful for image based reading</param>
@@ -181,7 +201,7 @@ public class ReaderController : BaseApiController
[ResponseCache(CacheProfileName = ResponseCacheProfiles.Hour, VaryByQueryKeys = new []{"chapterId", "extractPdf", "includeDimensions"})]
public async Task<ActionResult<ChapterInfoDto>> GetChapterInfo(int chapterId, bool extractPdf = false, bool includeDimensions = false)
{
- if (chapterId <= 0) return null; // This can happen occasionally from UI, we should just ignore
+ if (chapterId <= 0) return Ok(null); // This can happen occasionally from UI, we should just ignore
var chapter = await _cacheService.Ensure(chapterId, extractPdf);
if (chapter == null) return BadRequest("Could not find Chapter");
@@ -208,7 +228,7 @@ public class ReaderController : BaseApiController
if (includeDimensions)
{
- info.PageDimensions = _cacheService.GetCachedFileDimensions(chapterId);
+ info.PageDimensions = _cacheService.GetCachedFileDimensions(_cacheService.GetCachePath(chapterId));
info.DoublePairs = _readerService.GetPairs(info.PageDimensions);
}
@@ -240,21 +260,31 @@ public class ReaderController : BaseApiController
/// Returns various information about all bookmark files for a Series. Side effect: This will cache the bookmark images for reading.
/// </summary>
/// <param name="seriesId">Series Id for all bookmarks</param>
+ /// <param name="includeDimensions">Include file dimensions (extra I/O). Defaults to true.</param>
/// <returns></returns>
[HttpGet("bookmark-info")]
- public async Task<ActionResult<BookmarkInfoDto>> GetBookmarkInfo(int seriesId)
+ [ResponseCache(CacheProfileName = ResponseCacheProfiles.Hour, VaryByQueryKeys = new []{"seriesId", "includeDimensions"})]
+ public async Task<ActionResult<BookmarkInfoDto>> GetBookmarkInfo(int seriesId, bool includeDimensions = true)
{
var totalPages = await _cacheService.CacheBookmarkForSeries(User.GetUserId(), seriesId);
var series = await _unitOfWork.SeriesRepository.GetSeriesByIdAsync(seriesId, SeriesIncludes.None);
- return Ok(new BookmarkInfoDto()
+ var info = new BookmarkInfoDto()
{
- SeriesName = series.Name,
+ SeriesName = series!.Name,
SeriesFormat = series.Format,
SeriesId = series.Id,
LibraryId = series.LibraryId,
Pages = totalPages,
- });
+ };
+
+ if (includeDimensions)
+ {
+ info.PageDimensions = _cacheService.GetCachedFileDimensions(_cacheService.GetBookmarkCachePath(seriesId));
+ info.DoublePairs = _readerService.GetPairs(info.PageDimensions);
+ }
+
+ return Ok(info);
}
@@ -267,6 +297,7 @@ public class ReaderController : BaseApiController
public async Task<ActionResult> MarkRead(MarkReadDto markReadDto)
{
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername(), AppUserIncludes.Progress);
+ if (user == null) return Unauthorized();
await _readerService.MarkSeriesAsRead(user, markReadDto.SeriesId);
if (!await _unitOfWork.CommitAsync()) return BadRequest("There was an issue saving progress");
@@ -284,6 +315,7 @@ public class ReaderController : BaseApiController
public async Task<ActionResult> MarkUnread(MarkReadDto markReadDto)
{
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername(), AppUserIncludes.Progress);
+ if (user == null) return Unauthorized();
await _readerService.MarkSeriesAsUnread(user, markReadDto.SeriesId);
if (!await _unitOfWork.CommitAsync()) return BadRequest("There was an issue saving progress");
@@ -300,6 +332,7 @@ public class ReaderController : BaseApiController
public async Task<ActionResult> MarkVolumeAsUnread(MarkVolumeReadDto markVolumeReadDto)
{
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername(), AppUserIncludes.Progress);
+ if (user == null) return Unauthorized();
var chapters = await _unitOfWork.ChapterRepository.GetChaptersAsync(markVolumeReadDto.VolumeId);
await _readerService.MarkChaptersAsUnread(user, markVolumeReadDto.SeriesId, chapters);
@@ -323,9 +356,10 @@ public class ReaderController : BaseApiController
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername(), AppUserIncludes.Progress);
var chapters = await _unitOfWork.ChapterRepository.GetChaptersAsync(markVolumeReadDto.VolumeId);
+ if (user == null) return Unauthorized();
await _readerService.MarkChaptersAsRead(user, markVolumeReadDto.SeriesId, chapters);
await _eventHub.SendMessageAsync(MessageFactory.UserProgressUpdate,
- MessageFactory.UserProgressUpdateEvent(user.Id, user.UserName, markVolumeReadDto.SeriesId,
+ MessageFactory.UserProgressUpdateEvent(user.Id, user.UserName!, markVolumeReadDto.SeriesId,
markVolumeReadDto.VolumeId, 0, chapters.Sum(c => c.Pages)));
if (await _unitOfWork.CommitAsync())
@@ -346,6 +380,7 @@ public class ReaderController : BaseApiController
public async Task<ActionResult> MarkMultipleAsRead(MarkVolumesReadDto dto)
{
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername(), AppUserIncludes.Progress);
+ if (user == null) return Unauthorized();
user.Progresses ??= new List<AppUserProgress>();
var chapterIds = await _unitOfWork.VolumeRepository.GetChapterIdsByVolumeIds(dto.VolumeIds);
@@ -374,6 +409,7 @@ public class ReaderController : BaseApiController
public async Task<ActionResult> MarkMultipleAsUnread(MarkVolumesReadDto dto)
{
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername(), AppUserIncludes.Progress);
+ if (user == null) return Unauthorized();
user.Progresses ??= new List<AppUserProgress>();
var chapterIds = await _unitOfWork.VolumeRepository.GetChapterIdsByVolumeIds(dto.VolumeIds);
@@ -401,6 +437,7 @@ public class ReaderController : BaseApiController
public async Task<ActionResult> MarkMultipleSeriesAsRead(MarkMultipleSeriesAsReadDto dto)
{
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername(), AppUserIncludes.Progress);
+ if (user == null) return Unauthorized();
user.Progresses ??= new List<AppUserProgress>();
var volumes = await _unitOfWork.VolumeRepository.GetVolumesForSeriesAsync(dto.SeriesIds.ToArray(), true);
@@ -426,6 +463,7 @@ public class ReaderController : BaseApiController
public async Task<ActionResult> MarkMultipleSeriesAsUnread(MarkMultipleSeriesAsReadDto dto)
{
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername(), AppUserIncludes.Progress);
+ if (user == null) return Unauthorized();
user.Progresses ??= new List<AppUserProgress>();
var volumes = await _unitOfWork.VolumeRepository.GetVolumesForSeriesAsync(dto.SeriesIds.ToArray(), true);
@@ -499,44 +537,6 @@ public class ReaderController : BaseApiController
return Ok(await _unitOfWork.AppUserProgressRepository.HasAnyProgressOnSeriesAsync(seriesId, userId));
}
- /// <summary>
- /// Marks every chapter that is sorted below the passed number as Read. This will not mark any specials as read.
- /// </summary>
- /// <remarks>This is built for Tachiyomi and is not expected to be called by any other place</remarks>
- /// <returns></returns>
- [Obsolete("Deprecated. Use 'Tachiyomi/mark-chapter-until-as-read'")]
- [HttpPost("mark-chapter-until-as-read")]
- public async Task<ActionResult<bool>> MarkChaptersUntilAsRead(int seriesId, float chapterNumber)
- {
- var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername(), AppUserIncludes.Progress);
- user.Progresses ??= new List<AppUserProgress>();
-
- // Tachiyomi sends chapter 0.0f when there's no chapters read.
- // Due to the encoding for volumes this marks all chapters in volume 0 (loose chapters) as read so we ignore it
- if (chapterNumber == 0.0f) return true;
-
- if (chapterNumber < 1.0f)
- {
- // This is a hack to track volume number. We need to map it back by x100
- var volumeNumber = int.Parse($"{chapterNumber * 100f}");
- await _readerService.MarkVolumesUntilAsRead(user, seriesId, volumeNumber);
- }
- else
- {
- await _readerService.MarkChaptersUntilAsRead(user, seriesId, chapterNumber);
- }
-
-
- _unitOfWork.UserRepository.Update(user);
-
- if (!_unitOfWork.HasChanges()) return Ok(true);
- if (await _unitOfWork.CommitAsync()) return Ok(true);
-
- await _unitOfWork.RollbackAsync();
- return Ok(false);
- }
-
-
/// <summary>
/// Returns a list of bookmarked pages for a given Chapter
/// </summary>
@@ -546,6 +546,7 @@ public class ReaderController : BaseApiController
public async Task<ActionResult<IEnumerable<BookmarkDto>>> GetBookmarks(int chapterId)
{
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername(), AppUserIncludes.Bookmarks);
+ if (user == null) return Unauthorized();
if (user.Bookmarks == null) return Ok(Array.Empty<BookmarkDto>());
return Ok(await _unitOfWork.UserRepository.GetBookmarkDtosForChapter(user.Id, chapterId));
}
@@ -559,6 +560,7 @@ public class ReaderController : BaseApiController
public async Task<ActionResult<IEnumerable<BookmarkDto>>> GetAllBookmarks(FilterDto filterDto)
{
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername(), AppUserIncludes.Bookmarks);
+ if (user == null) return Unauthorized();
if (user.Bookmarks == null) return Ok(Array.Empty<BookmarkDto>());
return Ok(await _unitOfWork.UserRepository.GetAllBookmarkDtos(user.Id, filterDto));
@@ -573,6 +575,7 @@ public class ReaderController : BaseApiController
public async Task<ActionResult> RemoveBookmarks(RemoveBookmarkForSeriesDto dto)
{
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername(), AppUserIncludes.Bookmarks);
+ if (user == null) return Unauthorized();
if (user.Bookmarks == null) return Ok("Nothing to remove");
try
@@ -612,6 +615,7 @@ public class ReaderController : BaseApiController
public async Task<ActionResult> BulkRemoveBookmarks(BulkRemoveBookmarkForSeriesDto dto)
{
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername(), AppUserIncludes.Bookmarks);
+ if (user == null) return Unauthorized();
if (user.Bookmarks == null) return Ok("Nothing to remove");
try
@@ -648,6 +652,7 @@ public class ReaderController : BaseApiController
public async Task<ActionResult<IEnumerable<BookmarkDto>>> GetBookmarksForVolume(int volumeId)
{
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername(), AppUserIncludes.Bookmarks);
+ if (user == null) return Unauthorized();
if (user.Bookmarks == null) return Ok(Array.Empty<BookmarkDto>());
return Ok(await _unitOfWork.UserRepository.GetBookmarkDtosForVolume(user.Id, volumeId));
}
@@ -661,6 +666,7 @@ public class ReaderController : BaseApiController
public async Task<ActionResult<IEnumerable<BookmarkDto>>> GetBookmarksForSeries(int seriesId)
{
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername(), AppUserIncludes.Bookmarks);
+ if (user == null) return Unauthorized();
if (user.Bookmarks == null) return Ok(Array.Empty<BookmarkDto>());
return Ok(await _unitOfWork.UserRepository.GetBookmarkDtosForSeries(user.Id, seriesId));
@@ -725,7 +731,7 @@ public class ReaderController : BaseApiController
/// <param name="volumeId"></param>
/// <param name="currentChapterId"></param>
/// <returns>chapter id for next manga</returns>
- [ResponseCache(CacheProfileName = "Hour", VaryByQueryKeys = new string[] { "seriesId", "volumeId", "currentChapterId"})]
+ [ResponseCache(CacheProfileName = "Hour", VaryByQueryKeys = new [] { "seriesId", "volumeId", "currentChapterId"})]
[HttpGet("next-chapter")]
public async Task<ActionResult<int>> GetNextChapter(int seriesId, int volumeId, int currentChapterId)
{
@@ -744,7 +750,7 @@ public class ReaderController : BaseApiController
/// <param name="volumeId"></param>
/// <param name="currentChapterId"></param>
/// <returns>chapter id for next manga</returns>
- [ResponseCache(CacheProfileName = "Hour", VaryByQueryKeys = new string[] { "seriesId", "volumeId", "currentChapterId"})]
+ [ResponseCache(CacheProfileName = "Hour", VaryByQueryKeys = new [] { "seriesId", "volumeId", "currentChapterId"})]
[HttpGet("prev-chapter")]
public async Task<ActionResult<int>> GetPreviousChapter(int seriesId, int volumeId, int currentChapterId)
{
@@ -759,6 +765,7 @@ public class ReaderController : BaseApiController
/// <param name="seriesId"></param>
/// <returns></returns>
[HttpGet("time-left")]
+ [ResponseCache(CacheProfileName = "Hour", VaryByQueryKeys = new [] { "seriesId"})]
public async Task<ActionResult<HourEstimateRangeDto>> GetEstimateToCompletion(int seriesId)
{
var userId = await _unitOfWork.UserRepository.GetUserIdByUsernameAsync(User.GetUsername());
diff --git a/API/Controllers/ReadingListController.cs b/API/Controllers/ReadingListController.cs
index 8809ed43f..060e54cd6 100644
--- a/API/Controllers/ReadingListController.cs
+++ b/API/Controllers/ReadingListController.cs
@@ -1,22 +1,17 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.IO.Abstractions;
+using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
-using API.Comparators;
+using API.Constants;
using API.Data;
using API.Data.Repositories;
+using API.DTOs;
using API.DTOs.ReadingLists;
-using API.DTOs.ReadingLists.CBL;
-using API.Entities;
using API.Extensions;
using API.Helpers;
using API.Services;
using API.SignalR;
using Kavita.Common;
using Microsoft.AspNetCore.Authorization;
-using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace API.Controllers;
@@ -27,14 +22,12 @@ public class ReadingListController : BaseApiController
private readonly IUnitOfWork _unitOfWork;
private readonly IEventHub _eventHub;
private readonly IReadingListService _readingListService;
- private readonly IDirectoryService _directoryService;
- public ReadingListController(IUnitOfWork unitOfWork, IEventHub eventHub, IReadingListService readingListService, IDirectoryService directoryService)
+ public ReadingListController(IUnitOfWork unitOfWork, IEventHub eventHub, IReadingListService readingListService)
{
_unitOfWork = unitOfWork;
_eventHub = eventHub;
_readingListService = readingListService;
- _directoryService = directoryService;
}
/// <summary>
@@ -54,13 +47,15 @@ public class ReadingListController : BaseApiController
/// </summary>
/// <param name="includePromoted">Include Promoted Reading Lists along with user's Reading Lists. Defaults to true</param>
/// <param name="userParams">Pagination parameters</param>
+ /// <param name="sortByLastModified">Sort by last modified (most recent first) or by title (alphabetical)</param>
/// <returns></returns>
[HttpPost("lists")]
- public async Task<ActionResult<IEnumerable<ReadingListDto>>> GetListsForUser([FromQuery] UserParams userParams, bool includePromoted = true)
+ public async Task<ActionResult<IEnumerable<ReadingListDto>>> GetListsForUser([FromQuery] UserParams userParams,
+ bool includePromoted = true, bool sortByLastModified = false)
{
var userId = await _unitOfWork.UserRepository.GetUserIdByUsernameAsync(User.GetUsername());
var items = await _unitOfWork.ReadingListRepository.GetReadingListDtosForUserAsync(userId, includePromoted,
- userParams);
+ userParams, sortByLastModified);
Response.AddPaginationHeader(items.CurrentPage, items.PageSize, items.TotalCount, items.TotalPages);
return Ok(items);
@@ -186,8 +181,8 @@ public class ReadingListController : BaseApiController
[HttpPost("create")]
public async Task<ActionResult<ReadingListDto>> CreateList(CreateReadingListDto dto)
{
-
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername(), AppUserIncludes.ReadingLists);
+ if (user == null) return Unauthorized();
try
{
@@ -428,6 +423,18 @@ public class ReadingListController : BaseApiController
return Ok("Nothing to do");
}
+ /// <summary>
+ /// Returns a list of characters associated with the reading list
+ /// </summary>
+ /// <param name="readingListId"></param>
+ /// <returns></returns>
+ [HttpGet("characters")]
+ [ResponseCache(CacheProfileName = ResponseCacheProfiles.TenMinute)]
+ public ActionResult<IEnumerable<PersonDto>> GetCharactersForList(int readingListId)
+ {
+ return Ok(_unitOfWork.ReadingListRepository.GetReadingListCharactersAsync(readingListId));
+ }
+
/// <summary>
@@ -484,22 +491,4 @@ public class ReadingListController : BaseApiController
if (string.IsNullOrEmpty(name)) return true;
return Ok(await _unitOfWork.ReadingListRepository.ReadingListExists(name));
}
-
- // [HttpPost("import-cbl")]
- // public async Task<ActionResult<CblImportSummaryDto>> ImportCbl([FromForm(Name = "cbl")] IFormFile file, [FromForm(Name = "dryRun")] bool dryRun = false)
- // {
- // var userId = User.GetUserId();
- // var filename = Path.GetRandomFileName();
- // var outputFile = Path.Join(_directoryService.TempDirectory, filename);
- //
- // await using var stream = System.IO.File.Create(outputFile);
- // await file.CopyToAsync(stream);
- // stream.Close();
- // var cbl = ReadingListService.LoadCblFromPath(outputFile);
- //
- // // We need to pass the temp file back
- //
- // var importSummary = await _readingListService.ValidateCblFile(userId, cbl);
- // return importSummary.Results.Any() ? Ok(importSummary) : Ok(await _readingListService.CreateReadingListFromCbl(userId, cbl, dryRun));
- // }
}
diff --git a/API/Controllers/RecommendedController.cs b/API/Controllers/RecommendedController.cs
index f945c735d..a8726e9c1 100644
--- a/API/Controllers/RecommendedController.cs
+++ b/API/Controllers/RecommendedController.cs
@@ -58,7 +58,7 @@ public class RecommendedController : BaseApiController
[HttpGet("highly-rated")]
public async Task<ActionResult<PagedList<SeriesDto>>> GetHighlyRated(int libraryId, [FromQuery] UserParams userParams)
{
- var userId = User.GetUserId();
+ var userId = User.GetUserId()!;
userParams ??= new UserParams();
var series = await _unitOfWork.SeriesRepository.GetHighlyRated(userId, libraryId, userParams);
await _unitOfWork.SeriesRepository.AddSeriesModifiers(userId, series);
diff --git a/API/Controllers/SearchController.cs b/API/Controllers/SearchController.cs
index 62ad278c5..84d2bbf3b 100644
--- a/API/Controllers/SearchController.cs
+++ b/API/Controllers/SearchController.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Linq;
+using System.Linq;
using System.Threading.Tasks;
using API.Data;
using API.Data.Repositories;
@@ -54,6 +53,7 @@ public class SearchController : BaseApiController
queryString = Services.Tasks.Scanner.Parser.Parser.CleanQuery(queryString);
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername());
+ if (user == null) return Unauthorized();
var libraries = _unitOfWork.LibraryRepository.GetLibraryIdsForUserIdAsync(user.Id, QueryContext.Search).ToList();
if (!libraries.Any()) return BadRequest("User does not have access to any libraries");
diff --git a/API/Controllers/SeriesController.cs b/API/Controllers/SeriesController.cs
index 6a04a129c..c729e7017 100644
--- a/API/Controllers/SeriesController.cs
+++ b/API/Controllers/SeriesController.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Linq;
using System.Threading.Tasks;
using API.Constants;
using API.Data;
@@ -11,7 +10,6 @@ using API.DTOs.Metadata;
using API.DTOs.SeriesDetail;
using API.Entities;
using API.Entities.Enums;
-using API.Entities.Metadata;
using API.Extensions;
using API.Helpers;
using API.Services;
@@ -113,7 +111,7 @@ public class SeriesController : BaseApiController
}
[HttpGet("volume")]
- public async Task<ActionResult<VolumeDto>> GetVolume(int volumeId)
+ public async Task<ActionResult<VolumeDto?>> GetVolume(int volumeId)
{
var userId = await _unitOfWork.UserRepository.GetUserIdByUsernameAsync(User.GetUsername());
return Ok(await _unitOfWork.VolumeRepository.GetVolumeDtoAsync(volumeId, userId));
@@ -137,7 +135,7 @@ public class SeriesController : BaseApiController
public async Task<ActionResult> UpdateSeriesRating(UpdateSeriesRatingDto updateSeriesRatingDto)
{
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername(), AppUserIncludes.Ratings);
- if (!await _seriesService.UpdateRating(user, updateSeriesRatingDto)) return BadRequest("There was a critical error.");
+ if (!await _seriesService.UpdateRating(user!, updateSeriesRatingDto)) return BadRequest("There was a critical error.");
return Ok();
}
@@ -159,14 +157,14 @@ public class SeriesController : BaseApiController
}
series.Name = updateSeries.Name.Trim();
- series.NormalizedName = Services.Tasks.Scanner.Parser.Parser.Normalize(series.Name);
- if (!string.IsNullOrEmpty(updateSeries.SortName.Trim()))
+ series.NormalizedName = series.Name.ToNormalized();
+ if (!string.IsNullOrEmpty(updateSeries.SortName?.Trim()))
{
series.SortName = updateSeries.SortName.Trim();
}
- series.LocalizedName = updateSeries.LocalizedName.Trim();
- series.NormalizedLocalizedName = Services.Tasks.Scanner.Parser.Parser.Normalize(series.LocalizedName);
+ series.LocalizedName = updateSeries.LocalizedName?.Trim();
+ series.NormalizedLocalizedName = series.LocalizedName?.ToNormalized();
series.NameLocked = updateSeries.NameLocked;
series.SortNameLocked = updateSeries.SortNameLocked;
diff --git a/API/Controllers/ServerController.cs b/API/Controllers/ServerController.cs
index 0cae64323..e8221e3fb 100644
--- a/API/Controllers/ServerController.cs
+++ b/API/Controllers/ServerController.cs
@@ -1,5 +1,4 @@
using System;
-using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@@ -8,7 +7,6 @@ using API.DTOs.Jobs;
using API.DTOs.Stats;
using API.DTOs.Update;
using API.Extensions;
-using API.Logging;
using API.Services;
using API.Services.Tasks;
using Hangfire;
@@ -16,7 +14,6 @@ using Hangfire.Storage;
using Kavita.Common;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
-using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using TaskScheduler = API.Services.TaskScheduler;
@@ -33,14 +30,15 @@ public class ServerController : BaseApiController
private readonly IVersionUpdaterService _versionUpdaterService;
private readonly IStatsService _statsService;
private readonly ICleanupService _cleanupService;
- private readonly IEmailService _emailService;
private readonly IBookmarkService _bookmarkService;
private readonly IScannerService _scannerService;
private readonly IAccountService _accountService;
+ private readonly ITaskScheduler _taskScheduler;
public ServerController(IHostApplicationLifetime applicationLifetime, ILogger<ServerController> logger,
IBackupService backupService, IArchiveService archiveService, IVersionUpdaterService versionUpdaterService, IStatsService statsService,
- ICleanupService cleanupService, IEmailService emailService, IBookmarkService bookmarkService, IScannerService scannerService, IAccountService accountService)
+ ICleanupService cleanupService, IBookmarkService bookmarkService, IScannerService scannerService, IAccountService accountService,
+ ITaskScheduler taskScheduler)
{
_applicationLifetime = applicationLifetime;
_logger = logger;
@@ -49,23 +47,10 @@ public class ServerController : BaseApiController
_versionUpdaterService = versionUpdaterService;
_statsService = statsService;
_cleanupService = cleanupService;
- _emailService = emailService;
_bookmarkService = bookmarkService;
_scannerService = scannerService;
_accountService = accountService;
- }
-
- /// <summary>
- /// Attempts to Restart the server. Does not work, will shutdown the instance.
- /// </summary>
- /// <returns></returns>
- [HttpPost("restart")]
- public ActionResult RestartServer()
- {
- _logger.LogInformation("{UserName} is restarting server from admin dashboard", User.GetUsername());
-
- _applicationLifetime.StopApplication();
- return Ok();
+ _taskScheduler = taskScheduler;
}
/// <summary>
@@ -154,10 +139,14 @@ public class ServerController : BaseApiController
{
if (TaskScheduler.HasAlreadyEnqueuedTask(BookmarkService.Name, "ConvertAllCoverToWebP", Array.Empty<object>(),
TaskScheduler.DefaultQueue, true)) return Ok();
- BackgroundJob.Enqueue(() => _bookmarkService.ConvertAllCoverToWebP());
+ BackgroundJob.Enqueue(() => _taskScheduler.CovertAllCoversToWebP());
return Ok();
}
+ /// <summary>
+ /// Downloads all the log files via a zip
+ /// </summary>
+ /// <returns></returns>
[HttpGet("logs")]
public ActionResult GetLogs()
{
@@ -182,6 +171,10 @@ public class ServerController : BaseApiController
return Ok(await _versionUpdaterService.CheckForUpdate());
}
+ /// <summary>
+ /// Pull the Changelog for Kavita from Github and display
+ /// </summary>
+ /// <returns></returns>
[HttpGet("changelog")]
public async Task<ActionResult<IEnumerable<UpdateNotificationDto>>> GetChangelog()
{
@@ -200,6 +193,10 @@ public class ServerController : BaseApiController
return Ok(await _accountService.CheckIfAccessible(Request));
}
+ /// <summary>
+ /// Returns a list of reoccurring jobs. Scheduled ad-hoc jobs will not be returned.
+ /// </summary>
+ /// <returns></returns>
[HttpGet("jobs")]
public ActionResult<IEnumerable<JobDto>> GetJobs()
{
@@ -214,6 +211,7 @@ public class ServerController : BaseApiController
});
return Ok(recurringJobs);
-
}
+
+
}
diff --git a/API/Controllers/SettingsController.cs b/API/Controllers/SettingsController.cs
index 374a1a4a5..11ec8de31 100644
--- a/API/Controllers/SettingsController.cs
+++ b/API/Controllers/SettingsController.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.IO;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
@@ -46,7 +45,6 @@ public class SettingsController : BaseApiController
_libraryWatcher = libraryWatcher;
}
- [AllowAnonymous]
[HttpGet("base-url")]
public async Task<ActionResult<string>> GetBaseUrl()
{
@@ -77,11 +75,11 @@ public class SettingsController : BaseApiController
/// <returns></returns>
[Authorize(Policy = "RequireAdminRole")]
[HttpPost("reset-ip-addresses")]
- public async Task<ActionResult<ServerSettingDto>> ResetIPAddressesSettings()
+ public async Task<ActionResult<ServerSettingDto>> ResetIpAddressesSettings()
{
_logger.LogInformation("{UserName} is resetting IP Addresses Setting", User.GetUsername());
var ipAddresses = await _unitOfWork.SettingsRepository.GetSettingAsync(ServerSettingKey.IpAddresses);
- ipAddresses.Value = Configuration.DefaultIPAddresses;
+ ipAddresses.Value = Configuration.DefaultIpAddresses;
_unitOfWork.SettingsRepository.Update(ipAddresses);
if (!await _unitOfWork.CommitAsync())
@@ -92,6 +90,28 @@ public class SettingsController : BaseApiController
return Ok(await _unitOfWork.SettingsRepository.GetSettingsDtoAsync());
}
+ /// <summary>
+ /// Resets the Base url
+ /// </summary>
+ /// <returns></returns>
+ [Authorize(Policy = "RequireAdminRole")]
+ [HttpPost("reset-base-url")]
+ public async Task<ActionResult<ServerSettingDto>> ResetBaseUrlSettings()
+ {
+ _logger.LogInformation("{UserName} is resetting Base Url Setting", User.GetUsername());
+ var baseUrl = await _unitOfWork.SettingsRepository.GetSettingAsync(ServerSettingKey.BaseUrl);
+ baseUrl.Value = Configuration.DefaultBaseUrl;
+ _unitOfWork.SettingsRepository.Update(baseUrl);
+
+ if (!await _unitOfWork.CommitAsync())
+ {
+ await _unitOfWork.RollbackAsync();
+ }
+
+ Configuration.BaseUrl = baseUrl.Value;
+ return Ok(await _unitOfWork.SettingsRepository.GetSettingsDtoAsync());
+ }
+
/// <summary>
/// Resets the email service url
/// </summary>
@@ -117,7 +137,9 @@ public class SettingsController : BaseApiController
[HttpPost("test-email-url")]
public async Task<ActionResult<EmailTestResultDto>> TestEmailServiceUrl(TestEmailDto dto)
{
- return Ok(await _emailService.TestConnectivity(dto.Url));
+ var user = await _unitOfWork.UserRepository.GetUserByIdAsync(User.GetUserId());
+ var emailService = (await _unitOfWork.SettingsRepository.GetSettingAsync(ServerSettingKey.EmailServiceUrl)).Value;
+ return Ok(await _emailService.TestConnectivity(dto.Url, user!.Email, !emailService.Equals(EmailService.DefaultApiUrl)));
}
@@ -178,7 +200,7 @@ public class SettingsController : BaseApiController
}
setting.Value = updateSettingsDto.IpAddresses;
- // IpAddesses is managed in appSetting.json
+ // IpAddresses is managed in appSetting.json
Configuration.IpAddresses = updateSettingsDto.IpAddresses;
_unitOfWork.SettingsRepository.Update(setting);
}
@@ -192,6 +214,7 @@ public class SettingsController : BaseApiController
? $"{path}/"
: path;
setting.Value = path;
+ Configuration.BaseUrl = updateSettingsDto.BaseUrl;
_unitOfWork.SettingsRepository.Update(setting);
}
diff --git a/API/Controllers/StatsController.cs b/API/Controllers/StatsController.cs
index f315b6f3f..ec8588d56 100644
--- a/API/Controllers/StatsController.cs
+++ b/API/Controllers/StatsController.cs
@@ -32,7 +32,7 @@ public class StatsController : BaseApiController
public async Task<ActionResult<UserReadStatistics>> GetUserReadStatistics(int userId)
{
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername());
- if (user.Id != userId && !await _userManager.IsInRoleAsync(user, PolicyConstants.AdminRole))
+ if (user!.Id != userId && !await _userManager.IsInRoleAsync(user, PolicyConstants.AdminRole))
return Unauthorized("You are not authorized to view another user's statistics");
return Ok(await _statService.GetUserReadStatistics(userId, new List<int>()));
@@ -116,7 +116,7 @@ public class StatsController : BaseApiController
{
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername());
var isAdmin = User.IsInRole(PolicyConstants.AdminRole);
- if (!isAdmin && userId != user.Id) return BadRequest();
+ if (!isAdmin && userId != user!.Id) return BadRequest();
return Ok(await _statService.ReadCountByDay(userId, days));
}
@@ -136,7 +136,7 @@ public class StatsController : BaseApiController
{
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername());
var isAdmin = User.IsInRole(PolicyConstants.AdminRole);
- if (!isAdmin && userId != user.Id) return BadRequest();
+ if (!isAdmin && userId != user!.Id) return BadRequest();
return Ok(await _statService.GetReadingHistory(userId));
}
diff --git a/API/Controllers/TachiyomiController.cs b/API/Controllers/TachiyomiController.cs
index 84bde35d1..ef24d05ff 100644
--- a/API/Controllers/TachiyomiController.cs
+++ b/API/Controllers/TachiyomiController.cs
@@ -43,7 +43,8 @@ public class TachiyomiController : BaseApiController
[HttpPost("mark-chapter-until-as-read")]
public async Task<ActionResult<bool>> MarkChaptersUntilAsRead(int seriesId, float chapterNumber)
{
- var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername(), AppUserIncludes.Progress);
+ var user = (await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername(),
+ AppUserIncludes.Progress))!;
return Ok(await _tachiyomiService.MarkChaptersUntilAsRead(user, seriesId, chapterNumber));
}
}
diff --git a/API/Controllers/ThemeController.cs b/API/Controllers/ThemeController.cs
index d6a9b526e..dc697a89d 100644
--- a/API/Controllers/ThemeController.cs
+++ b/API/Controllers/ThemeController.cs
@@ -2,7 +2,6 @@
using System.Threading.Tasks;
using API.Data;
using API.DTOs.Theme;
-using API.Extensions;
using API.Services;
using API.Services.Tasks;
using Kavita.Common;
diff --git a/API/Controllers/UploadController.cs b/API/Controllers/UploadController.cs
index 5a7ed5403..946b61933 100644
--- a/API/Controllers/UploadController.cs
+++ b/API/Controllers/UploadController.cs
@@ -1,5 +1,4 @@
using System;
-using System.IO;
using System.Threading.Tasks;
using API.Data;
using API.DTOs.Uploads;
@@ -10,7 +9,6 @@ using Flurl.Http;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
-using NetVips;
namespace API.Controllers;
@@ -93,8 +91,9 @@ public class UploadController : BaseApiController
try
{
- var filePath = _imageService.CreateThumbnailFromBase64(uploadFileDto.Url, ImageService.GetSeriesFormat(uploadFileDto.Id));
var series = await _unitOfWork.SeriesRepository.GetSeriesByIdAsync(uploadFileDto.Id);
+ if (series == null) return BadRequest("Invalid Series");
+ var filePath = await CreateThumbnail(uploadFileDto, $"{ImageService.GetSeriesFormat(uploadFileDto.Id)}");
if (!string.IsNullOrEmpty(filePath))
{
@@ -140,8 +139,9 @@ public class UploadController : BaseApiController
try
{
- var filePath = _imageService.CreateThumbnailFromBase64(uploadFileDto.Url, $"{ImageService.GetCollectionTagFormat(uploadFileDto.Id)}");
var tag = await _unitOfWork.CollectionTagRepository.GetTagAsync(uploadFileDto.Id);
+ if (tag == null) return BadRequest("Invalid Tag id");
+ var filePath = await CreateThumbnail(uploadFileDto, $"{ImageService.GetCollectionTagFormat(uploadFileDto.Id)}");
if (!string.IsNullOrEmpty(filePath))
{
@@ -190,8 +190,9 @@ public class UploadController : BaseApiController
try
{
- var filePath = _imageService.CreateThumbnailFromBase64(uploadFileDto.Url, $"{ImageService.GetReadingListFormat(uploadFileDto.Id)}");
var readingList = await _unitOfWork.ReadingListRepository.GetReadingListByIdAsync(uploadFileDto.Id);
+ if (readingList == null) return BadRequest("Reading list is not valid");
+ var filePath = await CreateThumbnail(uploadFileDto, $"{ImageService.GetReadingListFormat(uploadFileDto.Id)}");
if (!string.IsNullOrEmpty(filePath))
{
@@ -218,6 +219,19 @@ public class UploadController : BaseApiController
return BadRequest("Unable to save cover image to Reading List");
}
+ private async Task<string> CreateThumbnail(UploadFileDto uploadFileDto, string filename, int thumbnailSize = 0)
+ {
+ var convertToWebP = (await _unitOfWork.SettingsRepository.GetSettingsDtoAsync()).ConvertCoverToWebP;
+ if (thumbnailSize > 0)
+ {
+ return _imageService.CreateThumbnailFromBase64(uploadFileDto.Url,
+ filename, convertToWebP, thumbnailSize);
+ }
+
+ return _imageService.CreateThumbnailFromBase64(uploadFileDto.Url,
+ filename, convertToWebP);
+ }
+
/// <summary>
/// Replaces chapter cover image and locks it with a base64 encoded image. This will update the parent volume's cover image.
/// </summary>
@@ -238,7 +252,8 @@ public class UploadController : BaseApiController
try
{
var chapter = await _unitOfWork.ChapterRepository.GetChapterAsync(uploadFileDto.Id);
- var filePath = _imageService.CreateThumbnailFromBase64(uploadFileDto.Url, $"{ImageService.GetChapterFormat(uploadFileDto.Id, chapter.VolumeId)}");
+ if (chapter == null) return BadRequest("Invalid Chapter");
+ var filePath = await CreateThumbnail(uploadFileDto, $"{ImageService.GetChapterFormat(uploadFileDto.Id, chapter.VolumeId)}");
if (!string.IsNullOrEmpty(filePath))
{
@@ -246,8 +261,11 @@ public class UploadController : BaseApiController
chapter.CoverImageLocked = true;
_unitOfWork.ChapterRepository.Update(chapter);
var volume = await _unitOfWork.VolumeRepository.GetVolumeAsync(chapter.VolumeId);
- volume.CoverImage = chapter.CoverImage;
- _unitOfWork.VolumeRepository.Update(volume);
+ if (volume != null)
+ {
+ volume.CoverImage = chapter.CoverImage;
+ _unitOfWork.VolumeRepository.Update(volume);
+ }
}
if (_unitOfWork.HasChanges())
@@ -301,8 +319,7 @@ public class UploadController : BaseApiController
try
{
- var filePath = _imageService.CreateThumbnailFromBase64(uploadFileDto.Url,
- $"{ImageService.GetLibraryFormat(uploadFileDto.Id)}", ImageService.LibraryThumbnailWidth);
+ var filePath = await CreateThumbnail(uploadFileDto, $"{ImageService.GetLibraryFormat(uploadFileDto.Id)}", ImageService.LibraryThumbnailWidth);
if (!string.IsNullOrEmpty(filePath))
{
@@ -340,19 +357,20 @@ public class UploadController : BaseApiController
try
{
var chapter = await _unitOfWork.ChapterRepository.GetChapterAsync(uploadFileDto.Id);
+ if (chapter == null) return BadRequest("Chapter no longer exists");
var originalFile = chapter.CoverImage;
chapter.CoverImage = string.Empty;
chapter.CoverImageLocked = false;
_unitOfWork.ChapterRepository.Update(chapter);
- var volume = await _unitOfWork.VolumeRepository.GetVolumeAsync(chapter.VolumeId);
+ var volume = (await _unitOfWork.VolumeRepository.GetVolumeAsync(chapter.VolumeId))!;
volume.CoverImage = chapter.CoverImage;
_unitOfWork.VolumeRepository.Update(volume);
- var series = await _unitOfWork.SeriesRepository.GetSeriesByIdAsync(volume.SeriesId);
+ var series = (await _unitOfWork.SeriesRepository.GetSeriesByIdAsync(volume.SeriesId))!;
if (_unitOfWork.HasChanges())
{
await _unitOfWork.CommitAsync();
- System.IO.File.Delete(originalFile);
+ if (originalFile != null) System.IO.File.Delete(originalFile);
_taskScheduler.RefreshSeriesMetadata(series.LibraryId, series.Id, true);
return Ok();
}
diff --git a/API/Controllers/UsersController.cs b/API/Controllers/UsersController.cs
index 6fd8249e4..1a6373ba2 100644
--- a/API/Controllers/UsersController.cs
+++ b/API/Controllers/UsersController.cs
@@ -4,10 +4,7 @@ using System.Threading.Tasks;
using API.Data;
using API.Data.Repositories;
using API.DTOs;
-using API.DTOs.Filtering;
-using API.Entities.Enums;
using API.Extensions;
-using API.Helpers;
using API.SignalR;
using AutoMapper;
using Microsoft.AspNetCore.Authorization;
@@ -41,18 +38,16 @@ public class UsersController : BaseApiController
return BadRequest("Could not delete the user.");
}
+ /// <summary>
+ /// Returns all users of this server
+ /// </summary>
+ /// <param name="includePending">This will include pending members</param>
+ /// <returns></returns>
[Authorize(Policy = "RequireAdminRole")]
[HttpGet]
- public async Task<ActionResult<IEnumerable<MemberDto>>> GetUsers()
- {
- return Ok(await _unitOfWork.UserRepository.GetEmailConfirmedMemberDtosAsync());
- }
-
- [Authorize(Policy = "RequireAdminRole")]
- [HttpGet("pending")]
- public async Task<ActionResult<IEnumerable<MemberDto>>> GetPendingUsers()
+ public async Task<ActionResult<IEnumerable<MemberDto>>> GetUsers(bool includePending = false)
{
- return Ok(await _unitOfWork.UserRepository.GetPendingMemberDtosAsync());
+ return Ok(await _unitOfWork.UserRepository.GetEmailConfirmedMemberDtosAsync(!includePending));
}
[HttpGet("myself")]
@@ -68,6 +63,7 @@ public class UsersController : BaseApiController
{
var userId = await _unitOfWork.UserRepository.GetUserIdByUsernameAsync(User.GetUsername());
var library = await _unitOfWork.LibraryRepository.GetLibraryForIdAsync(libraryId);
+ if (library == null) return BadRequest("Library does not exist");
return Ok(await _unitOfWork.AppUserProgressRepository.UserHasProgress(library.Type, userId));
}
@@ -83,9 +79,8 @@ public class UsersController : BaseApiController
{
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername(),
AppUserIncludes.UserPreferences);
- var existingPreferences = user.UserPreferences;
-
- preferencesDto.Theme ??= await _unitOfWork.SiteThemeRepository.GetDefaultTheme();
+ if (user == null) return Unauthorized();
+ var existingPreferences = user!.UserPreferences;
existingPreferences.ReadingDirection = preferencesDto.ReadingDirection;
existingPreferences.ScalingOption = preferencesDto.ScalingOption;
@@ -102,22 +97,24 @@ public class UsersController : BaseApiController
existingPreferences.BookReaderFontSize = preferencesDto.BookReaderFontSize;
existingPreferences.BookReaderTapToPaginate = preferencesDto.BookReaderTapToPaginate;
existingPreferences.BookReaderReadingDirection = preferencesDto.BookReaderReadingDirection;
+ existingPreferences.BookReaderWritingStyle = preferencesDto.BookReaderWritingStyle;
existingPreferences.BookThemeName = preferencesDto.BookReaderThemeName;
existingPreferences.BookReaderLayoutMode = preferencesDto.BookReaderLayoutMode;
existingPreferences.BookReaderImmersiveMode = preferencesDto.BookReaderImmersiveMode;
existingPreferences.GlobalPageLayoutMode = preferencesDto.GlobalPageLayoutMode;
existingPreferences.BlurUnreadSummaries = preferencesDto.BlurUnreadSummaries;
- existingPreferences.Theme = await _unitOfWork.SiteThemeRepository.GetThemeById(preferencesDto.Theme.Id);
existingPreferences.LayoutMode = preferencesDto.LayoutMode;
+ existingPreferences.Theme = preferencesDto.Theme ?? await _unitOfWork.SiteThemeRepository.GetDefaultTheme();
existingPreferences.PromptForDownloadSize = preferencesDto.PromptForDownloadSize;
existingPreferences.NoTransitions = preferencesDto.NoTransitions;
existingPreferences.SwipeToPaginate = preferencesDto.SwipeToPaginate;
+ existingPreferences.CollapseSeriesRelationships = preferencesDto.CollapseSeriesRelationships;
_unitOfWork.UserRepository.Update(existingPreferences);
if (await _unitOfWork.CommitAsync())
{
- await _eventHub.SendMessageToAsync(MessageFactory.UserUpdate, MessageFactory.UserUpdateEvent(user.Id, user.UserName), user.Id);
+ await _eventHub.SendMessageToAsync(MessageFactory.UserUpdate, MessageFactory.UserUpdateEvent(user.Id, user.UserName!), user.Id);
return Ok(preferencesDto);
}
diff --git a/API/Controllers/WantToReadController.cs b/API/Controllers/WantToReadController.cs
index 424681cf4..64d22703f 100644
--- a/API/Controllers/WantToReadController.cs
+++ b/API/Controllers/WantToReadController.cs
@@ -1,5 +1,4 @@
-using System.Collections.Generic;
-using System.Linq;
+using System.Linq;
using System.Threading.Tasks;
using API.Data;
using API.Data.Repositories;
@@ -37,6 +36,9 @@ public class WantToReadController : BaseApiController
userParams ??= new UserParams();
var pagedList = await _unitOfWork.SeriesRepository.GetWantToReadForUserAsync(User.GetUserId(), userParams, filterDto);
Response.AddPaginationHeader(pagedList.CurrentPage, pagedList.PageSize, pagedList.TotalCount, pagedList.TotalPages);
+
+ await _unitOfWork.SeriesRepository.AddSeriesModifiers(User.GetUserId(), pagedList);
+
return Ok(pagedList);
}
@@ -56,6 +58,7 @@ public class WantToReadController : BaseApiController
{
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername(),
AppUserIncludes.WantToRead);
+ if (user == null) return Unauthorized();
var existingIds = user.WantToRead.Select(s => s.Id).ToList();
existingIds.AddRange(dto.SeriesIds);
@@ -84,6 +87,7 @@ public class WantToReadController : BaseApiController
{
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername(),
AppUserIncludes.WantToRead);
+ if (user == null) return Unauthorized();
user.WantToRead = user.WantToRead.Where(s => !dto.SeriesIds.Contains(s.Id)).ToList();
diff --git a/API/DTOs/Account/AgeRestrictionDto.cs b/API/DTOs/Account/AgeRestrictionDto.cs
index ad4534b35..0aaec9b97 100644
--- a/API/DTOs/Account/AgeRestrictionDto.cs
+++ b/API/DTOs/Account/AgeRestrictionDto.cs
@@ -7,10 +7,10 @@ public class AgeRestrictionDto
/// <summary>
/// The maximum age rating a user has access to. -1 if not applicable
/// </summary>
- public AgeRating AgeRating { get; set; } = AgeRating.NotApplicable;
+ public required AgeRating AgeRating { get; set; } = AgeRating.NotApplicable;
/// <summary>
/// Are Unknowns explicitly allowed against age rating
/// </summary>
/// <remarks>Unknown is always lowest and default age rating. Setting this to false will ensure Teen age rating applies and unknowns are still filtered</remarks>
- public bool IncludeUnknowns { get; set; } = false;
+ public required bool IncludeUnknowns { get; set; } = false;
}
diff --git a/API/DTOs/Account/ConfirmEmailDto.cs b/API/DTOs/Account/ConfirmEmailDto.cs
index 225835796..fb9a7c470 100644
--- a/API/DTOs/Account/ConfirmEmailDto.cs
+++ b/API/DTOs/Account/ConfirmEmailDto.cs
@@ -5,12 +5,12 @@ namespace API.DTOs.Account;
public class ConfirmEmailDto
{
[Required]
- public string Email { get; set; }
+ public string Email { get; set; } = default!;
[Required]
- public string Token { get; set; }
+ public string Token { get; set; } = default!;
[Required]
[StringLength(32, MinimumLength = 6)]
- public string Password { get; set; }
+ public string Password { get; set; } = default!;
[Required]
- public string Username { get; set; }
+ public string Username { get; set; } = default!;
}
diff --git a/API/DTOs/Account/ConfirmEmailUpdateDto.cs b/API/DTOs/Account/ConfirmEmailUpdateDto.cs
index 63d31340a..42abb1295 100644
--- a/API/DTOs/Account/ConfirmEmailUpdateDto.cs
+++ b/API/DTOs/Account/ConfirmEmailUpdateDto.cs
@@ -5,7 +5,7 @@ namespace API.DTOs.Account;
public class ConfirmEmailUpdateDto
{
[Required]
- public string Email { get; set; }
+ public string Email { get; set; } = default!;
[Required]
- public string Token { get; set; }
+ public string Token { get; set; } = default!;
}
diff --git a/API/DTOs/Account/ConfirmMigrationEmailDto.cs b/API/DTOs/Account/ConfirmMigrationEmailDto.cs
index 07e0aa1ca..efb42b8fd 100644
--- a/API/DTOs/Account/ConfirmMigrationEmailDto.cs
+++ b/API/DTOs/Account/ConfirmMigrationEmailDto.cs
@@ -2,6 +2,6 @@
public class ConfirmMigrationEmailDto
{
- public string Email { get; set; }
- public string Token { get; set; }
+ public string Email { get; set; } = default!;
+ public string Token { get; set; } = default!;
}
diff --git a/API/DTOs/Account/ConfirmPasswordResetDto.cs b/API/DTOs/Account/ConfirmPasswordResetDto.cs
index 603508ac4..862a18986 100644
--- a/API/DTOs/Account/ConfirmPasswordResetDto.cs
+++ b/API/DTOs/Account/ConfirmPasswordResetDto.cs
@@ -5,10 +5,10 @@ namespace API.DTOs.Account;
public class ConfirmPasswordResetDto
{
[Required]
- public string Email { get; set; }
+ public string Email { get; set; } = default!;
[Required]
- public string Token { get; set; }
+ public string Token { get; set; } = default!;
[Required]
[StringLength(32, MinimumLength = 6)]
- public string Password { get; set; }
+ public string Password { get; set; } = default!;
}
diff --git a/API/DTOs/Account/InviteUserDto.cs b/API/DTOs/Account/InviteUserDto.cs
index 9532b86dd..112013053 100644
--- a/API/DTOs/Account/InviteUserDto.cs
+++ b/API/DTOs/Account/InviteUserDto.cs
@@ -1,24 +1,23 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
-using API.Entities.Enums;
namespace API.DTOs.Account;
public class InviteUserDto
{
[Required]
- public string Email { get; set; }
+ public string Email { get; set; } = default!;
/// <summary>
/// List of Roles to assign to user. If admin not present, Pleb will be applied.
/// If admin present, all libraries will be granted access and will ignore those from DTO.
/// </summary>
- public ICollection<string> Roles { get; init; }
+ public ICollection<string> Roles { get; init; } = default!;
/// <summary>
/// A list of libraries to grant access to
/// </summary>
- public IList<int> Libraries { get; init; }
+ public IList<int> Libraries { get; init; } = default!;
/// <summary>
/// An Age Rating which will limit the account to seeing everything equal to or below said rating.
/// </summary>
- public AgeRestrictionDto AgeRestriction { get; set; }
+ public AgeRestrictionDto AgeRestriction { get; set; } = default!;
}
diff --git a/API/DTOs/Account/InviteUserResponse.cs b/API/DTOs/Account/InviteUserResponse.cs
index 9387b5492..97d7f408c 100644
--- a/API/DTOs/Account/InviteUserResponse.cs
+++ b/API/DTOs/Account/InviteUserResponse.cs
@@ -5,9 +5,9 @@ public class InviteUserResponse
/// <summary>
/// Email link used to setup the user account
/// </summary>
- public string EmailLink { get; set; }
+ public string EmailLink { get; set; } = default!;
/// <summary>
/// Was an email sent (ie is this server accessible)
/// </summary>
- public bool EmailSent { get; set; }
+ public bool EmailSent { get; set; } = default!;
}
diff --git a/API/DTOs/Account/LoginDto.cs b/API/DTOs/Account/LoginDto.cs
index 44ccc5fc5..111db06d3 100644
--- a/API/DTOs/Account/LoginDto.cs
+++ b/API/DTOs/Account/LoginDto.cs
@@ -2,6 +2,6 @@
public class LoginDto
{
- public string Username { get; init; }
- public string Password { get; set; }
+ public string Username { get; init; } = default!;
+ public string Password { get; set; } = default!;
}
diff --git a/API/DTOs/Account/MigrateUserEmailDto.cs b/API/DTOs/Account/MigrateUserEmailDto.cs
index aa947d5d1..60d042165 100644
--- a/API/DTOs/Account/MigrateUserEmailDto.cs
+++ b/API/DTOs/Account/MigrateUserEmailDto.cs
@@ -2,8 +2,7 @@
public class MigrateUserEmailDto
{
- public string Email { get; set; }
- public string Username { get; set; }
- public string Password { get; set; }
- public bool SendEmail { get; set; }
+ public string Email { get; set; } = default!;
+ public string Username { get; set; } = default!;
+ public string Password { get; set; } = default!;
}
diff --git a/API/DTOs/Account/ResetPasswordDto.cs b/API/DTOs/Account/ResetPasswordDto.cs
index 9fa42d8ac..fc7147f62 100644
--- a/API/DTOs/Account/ResetPasswordDto.cs
+++ b/API/DTOs/Account/ResetPasswordDto.cs
@@ -8,15 +8,15 @@ public class ResetPasswordDto
/// The Username of the User
/// </summary>
[Required]
- public string UserName { get; init; }
+ public string UserName { get; init; } = default!;
/// <summary>
/// The new password
/// </summary>
[Required]
[StringLength(32, MinimumLength = 6)]
- public string Password { get; init; }
+ public string Password { get; init; } = default!;
/// <summary>
/// The old, existing password. If an admin is performing the change, this is not required. Otherwise, it is.
/// </summary>
- public string OldPassword { get; init; }
+ public string OldPassword { get; init; } = default!;
}
diff --git a/API/DTOs/Account/TokenRequestDto.cs b/API/DTOs/Account/TokenRequestDto.cs
index 508e0c75c..85ab9f87a 100644
--- a/API/DTOs/Account/TokenRequestDto.cs
+++ b/API/DTOs/Account/TokenRequestDto.cs
@@ -2,6 +2,6 @@
public class TokenRequestDto
{
- public string Token { get; init; }
- public string RefreshToken { get; init; }
+ public string Token { get; init; } = default!;
+ public string RefreshToken { get; init; } = default!;
}
diff --git a/API/DTOs/Account/UpdateEmailDto.cs b/API/DTOs/Account/UpdateEmailDto.cs
index 2363790f6..eac06be53 100644
--- a/API/DTOs/Account/UpdateEmailDto.cs
+++ b/API/DTOs/Account/UpdateEmailDto.cs
@@ -2,6 +2,6 @@
public class UpdateEmailDto
{
- public string Email { get; set; }
- public string Password { get; set; }
+ public string Email { get; set; } = default!;
+ public string Password { get; set; } = default!;
}
diff --git a/API/DTOs/Account/UpdateUserDto.cs b/API/DTOs/Account/UpdateUserDto.cs
index 7a928690c..bda664bdb 100644
--- a/API/DTOs/Account/UpdateUserDto.cs
+++ b/API/DTOs/Account/UpdateUserDto.cs
@@ -1,24 +1,21 @@
using System.Collections.Generic;
-using System.Text.Json.Serialization;
-using API.Entities.Enums;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion.Internal;
+using System.ComponentModel.DataAnnotations;
namespace API.DTOs.Account;
public record UpdateUserDto
{
public int UserId { get; set; }
- public string Username { get; set; }
+ public string Username { get; set; } = default!;
/// List of Roles to assign to user. If admin not present, Pleb will be applied.
/// If admin present, all libraries will be granted access and will ignore those from DTO.
- public IList<string> Roles { get; init; }
+ public IList<string> Roles { get; init; } = default!;
/// <summary>
/// A list of libraries to grant access to
/// </summary>
- public IList<int> Libraries { get; init; }
+ public IList<int> Libraries { get; init; } = default!;
/// <summary>
/// An Age Rating which will limit the account to seeing everything equal to or below said rating.
/// </summary>
- public AgeRestrictionDto AgeRestriction { get; init; }
-
+ public AgeRestrictionDto AgeRestriction { get; init; } = default!;
}
diff --git a/API/DTOs/ChapterDto.cs b/API/DTOs/ChapterDto.cs
index 48d05ad2e..4804554e8 100644
--- a/API/DTOs/ChapterDto.cs
+++ b/API/DTOs/ChapterDto.cs
@@ -2,7 +2,6 @@
using System.Collections.Generic;
using API.Entities.Enums;
using API.Entities.Interfaces;
-using Microsoft.AspNetCore.Mvc.RazorPages;
namespace API.DTOs;
@@ -16,11 +15,11 @@ public class ChapterDto : IHasReadTimeEstimate, IEntityDate
/// <summary>
/// Range of chapters. Chapter 2-4 -> "2-4". Chapter 2 -> "2".
/// </summary>
- public string Range { get; init; }
+ public string Range { get; init; } = default!;
/// <summary>
/// Smallest number of the Range.
/// </summary>
- public string Number { get; init; }
+ public string Number { get; init; } = default!;
/// <summary>
/// Total number of pages in all MangaFiles
/// </summary>
@@ -32,11 +31,11 @@ public class ChapterDto : IHasReadTimeEstimate, IEntityDate
/// <summary>
/// Used for books/specials to display custom title. For non-specials/books, will be set to <see cref="Range"/>
/// </summary>
- public string Title { get; set; }
+ public string Title { get; set; } = default!;
/// <summary>
/// The files that represent this Chapter
/// </summary>
- public ICollection<MangaFileDto> Files { get; init; }
+ public ICollection<MangaFileDto> Files { get; init; } = default!;
/// <summary>
/// Calculated at API time. Number of pages read for this Chapter for logged in user.
/// </summary>
@@ -69,12 +68,12 @@ public class ChapterDto : IHasReadTimeEstimate, IEntityDate
/// Title of the Chapter/Issue
/// </summary>
/// <remarks>Metadata field</remarks>
- public string TitleName { get; set; }
+ public string TitleName { get; set; } = default!;
/// <summary>
/// Summary of the Chapter
/// </summary>
/// <remarks>This is not set normally, only for Series Detail</remarks>
- public string Summary { get; init; }
+ public string Summary { get; init; } = default!;
/// <summary>
/// Age Rating for the issue/chapter
/// </summary>
diff --git a/API/DTOs/CollectionTags/CollectionTagBulkAddDto.cs b/API/DTOs/CollectionTags/CollectionTagBulkAddDto.cs
index 7b9ebc94d..1d078959d 100644
--- a/API/DTOs/CollectionTags/CollectionTagBulkAddDto.cs
+++ b/API/DTOs/CollectionTags/CollectionTagBulkAddDto.cs
@@ -9,9 +9,9 @@ public class CollectionTagBulkAddDto
/// </summary>
/// <remarks>Can be 0 which then will use Title to create a tag</remarks>
public int CollectionTagId { get; init; }
- public string CollectionTagTitle { get; init; }
+ public string CollectionTagTitle { get; init; } = default!;
/// <summary>
/// Series Ids to add onto Collection Tag
/// </summary>
- public IEnumerable<int> SeriesIds { get; init; }
+ public IEnumerable<int> SeriesIds { get; init; } = default!;
}
diff --git a/API/DTOs/CollectionTags/CollectionTagDto.cs b/API/DTOs/CollectionTags/CollectionTagDto.cs
index 8cb68cc06..2a1279a35 100644
--- a/API/DTOs/CollectionTags/CollectionTagDto.cs
+++ b/API/DTOs/CollectionTags/CollectionTagDto.cs
@@ -3,12 +3,12 @@
public class CollectionTagDto
{
public int Id { get; set; }
- public string Title { get; set; }
- public string Summary { get; set; }
+ public string Title { get; set; } = default!;
+ public string Summary { get; set; } = default!;
public bool Promoted { get; set; }
/// <summary>
/// The cover image string. This is used on Frontend to show or hide the Cover Image
/// </summary>
- public string CoverImage { get; set; }
+ public string CoverImage { get; set; } = default!;
public bool CoverImageLocked { get; set; }
}
diff --git a/API/DTOs/CollectionTags/UpdateSeriesForTagDto.cs b/API/DTOs/CollectionTags/UpdateSeriesForTagDto.cs
index 2381df285..9d6f2a035 100644
--- a/API/DTOs/CollectionTags/UpdateSeriesForTagDto.cs
+++ b/API/DTOs/CollectionTags/UpdateSeriesForTagDto.cs
@@ -4,6 +4,6 @@ namespace API.DTOs.CollectionTags;
public class UpdateSeriesForTagDto
{
- public CollectionTagDto Tag { get; init; }
- public IEnumerable<int> SeriesIdsToRemove { get; init; }
+ public CollectionTagDto Tag { get; init; } = default!;
+ public IEnumerable<int> SeriesIdsToRemove { get; init; } = default!;
}
diff --git a/API/DTOs/CreateLibraryDto.cs b/API/DTOs/CreateLibraryDto.cs
index 151bcfeba..76584eaff 100644
--- a/API/DTOs/CreateLibraryDto.cs
+++ b/API/DTOs/CreateLibraryDto.cs
@@ -7,10 +7,10 @@ namespace API.DTOs;
public class CreateLibraryDto
{
[Required]
- public string Name { get; init; }
+ public string Name { get; init; } = default!;
[Required]
public LibraryType Type { get; init; }
[Required]
[MinLength(1)]
- public IEnumerable<string> Folders { get; init; }
+ public IEnumerable<string> Folders { get; init; } = default!;
}
diff --git a/API/DTOs/DeleteSeriesDto.cs b/API/DTOs/DeleteSeriesDto.cs
index a363d0568..12687fc25 100644
--- a/API/DTOs/DeleteSeriesDto.cs
+++ b/API/DTOs/DeleteSeriesDto.cs
@@ -4,5 +4,5 @@ namespace API.DTOs;
public class DeleteSeriesDto
{
- public IList<int> SeriesIds { get; set; }
+ public IList<int> SeriesIds { get; set; } = default!;
}
diff --git a/API/DTOs/Device/CreateDeviceDto.cs b/API/DTOs/Device/CreateDeviceDto.cs
index bdcdde194..7e59483fa 100644
--- a/API/DTOs/Device/CreateDeviceDto.cs
+++ b/API/DTOs/Device/CreateDeviceDto.cs
@@ -1,5 +1,4 @@
using System.ComponentModel.DataAnnotations;
-using System.Runtime.InteropServices;
using API.Entities.Enums.Device;
namespace API.DTOs.Device;
@@ -7,14 +6,14 @@ namespace API.DTOs.Device;
public class CreateDeviceDto
{
[Required]
- public string Name { get; set; }
+ public string Name { get; set; } = default!;
/// <summary>
/// Platform of the device. If not know, defaults to "Custom"
/// </summary>
[Required]
public DevicePlatform Platform { get; set; }
[Required]
- public string EmailAddress { get; set; }
+ public string EmailAddress { get; set; } = default!;
}
diff --git a/API/DTOs/Device/DeviceDto.cs b/API/DTOs/Device/DeviceDto.cs
index c05671113..069a7a4d2 100644
--- a/API/DTOs/Device/DeviceDto.cs
+++ b/API/DTOs/Device/DeviceDto.cs
@@ -17,11 +17,11 @@ public class DeviceDto
/// </summary>
/// <remarks>If this device is web, this will be the browser name</remarks>
/// <example>Pixel 3a, John's Kindle</example>
- public string Name { get; set; }
+ public string Name { get; set; } = default!;
/// <summary>
/// An email address associated with the device (ie Kindle). Will be used with Send to functionality
/// </summary>
- public string EmailAddress { get; set; }
+ public string EmailAddress { get; set; } = default!;
/// <summary>
/// Platform (ie) Windows 10
/// </summary>
diff --git a/API/DTOs/Device/SendToDeviceDto.cs b/API/DTOs/Device/SendToDeviceDto.cs
index 411f20ea0..fd88eaf59 100644
--- a/API/DTOs/Device/SendToDeviceDto.cs
+++ b/API/DTOs/Device/SendToDeviceDto.cs
@@ -5,5 +5,5 @@ namespace API.DTOs.Device;
public class SendToDeviceDto
{
public int DeviceId { get; set; }
- public IReadOnlyList<int> ChapterIds { get; set; }
+ public IReadOnlyList<int> ChapterIds { get; set; } = default!;
}
diff --git a/API/DTOs/Device/UpdateDeviceDto.cs b/API/DTOs/Device/UpdateDeviceDto.cs
index 201adcb5d..d28d372c3 100644
--- a/API/DTOs/Device/UpdateDeviceDto.cs
+++ b/API/DTOs/Device/UpdateDeviceDto.cs
@@ -8,12 +8,12 @@ public class UpdateDeviceDto
[Required]
public int Id { get; set; }
[Required]
- public string Name { get; set; }
+ public string Name { get; set; } = default!;
/// <summary>
/// Platform of the device. If not know, defaults to "Custom"
/// </summary>
[Required]
public DevicePlatform Platform { get; set; }
[Required]
- public string EmailAddress { get; set; }
+ public string EmailAddress { get; set; } = default!;
}
diff --git a/API/DTOs/Downloads/DownloadBookmarkDto.cs b/API/DTOs/Downloads/DownloadBookmarkDto.cs
index d70cd25ac..5b7240b68 100644
--- a/API/DTOs/Downloads/DownloadBookmarkDto.cs
+++ b/API/DTOs/Downloads/DownloadBookmarkDto.cs
@@ -7,5 +7,5 @@ namespace API.DTOs.Downloads;
public class DownloadBookmarkDto
{
[Required]
- public IEnumerable<BookmarkDto> Bookmarks { get; set; }
+ public IEnumerable<BookmarkDto> Bookmarks { get; set; } = default!;
}
diff --git a/API/DTOs/Email/ConfirmationEmailDto.cs b/API/DTOs/Email/ConfirmationEmailDto.cs
index a64d92f91..1a48c9974 100644
--- a/API/DTOs/Email/ConfirmationEmailDto.cs
+++ b/API/DTOs/Email/ConfirmationEmailDto.cs
@@ -2,11 +2,11 @@
public class ConfirmationEmailDto
{
- public string InvitingUser { get; init; }
- public string EmailAddress { get; init; }
- public string ServerConfirmationLink { get; init; }
+ public string InvitingUser { get; init; } = default!;
+ public string EmailAddress { get; init; } = default!;
+ public string ServerConfirmationLink { get; init; } = default!;
/// <summary>
/// InstallId of this Kavita Instance
/// </summary>
- public string InstallId { get; init; }
+ public string InstallId { get; init; } = default!;
}
diff --git a/API/DTOs/Email/EmailMigrationDto.cs b/API/DTOs/Email/EmailMigrationDto.cs
index e7a941405..f051e7337 100644
--- a/API/DTOs/Email/EmailMigrationDto.cs
+++ b/API/DTOs/Email/EmailMigrationDto.cs
@@ -2,11 +2,11 @@
public class EmailMigrationDto
{
- public string EmailAddress { get; init; }
- public string Username { get; init; }
- public string ServerConfirmationLink { get; init; }
+ public string EmailAddress { get; init; } = default!;
+ public string Username { get; init; } = default!;
+ public string ServerConfirmationLink { get; init; } = default!;
/// <summary>
/// InstallId of this Kavita Instance
/// </summary>
- public string InstallId { get; init; }
+ public string InstallId { get; init; } = default!;
}
diff --git a/API/DTOs/Email/EmailTestResultDto.cs b/API/DTOs/Email/EmailTestResultDto.cs
index a41a6027d..6659e3a45 100644
--- a/API/DTOs/Email/EmailTestResultDto.cs
+++ b/API/DTOs/Email/EmailTestResultDto.cs
@@ -6,5 +6,5 @@
public class EmailTestResultDto
{
public bool Successful { get; set; }
- public string ErrorMessage { get; set; }
+ public string ErrorMessage { get; set; } = default!;
}
diff --git a/API/DTOs/Email/PasswordResetEmailDto.cs b/API/DTOs/Email/PasswordResetEmailDto.cs
index 503a9c5e3..06abba171 100644
--- a/API/DTOs/Email/PasswordResetEmailDto.cs
+++ b/API/DTOs/Email/PasswordResetEmailDto.cs
@@ -2,10 +2,10 @@
public class PasswordResetEmailDto
{
- public string EmailAddress { get; init; }
- public string ServerConfirmationLink { get; init; }
+ public string EmailAddress { get; init; } = default!;
+ public string ServerConfirmationLink { get; init; } = default!;
/// <summary>
/// InstallId of this Kavita Instance
/// </summary>
- public string InstallId { get; init; }
+ public string InstallId { get; init; } = default!;
}
diff --git a/API/DTOs/Email/SendToDto.cs b/API/DTOs/Email/SendToDto.cs
index 254f7fd09..1261d110c 100644
--- a/API/DTOs/Email/SendToDto.cs
+++ b/API/DTOs/Email/SendToDto.cs
@@ -4,6 +4,6 @@ namespace API.DTOs.Email;
public class SendToDto
{
- public string DestinationEmail { get; set; }
- public IEnumerable<string> FilePaths { get; set; }
+ public string DestinationEmail { get; set; } = default!;
+ public IEnumerable<string> FilePaths { get; set; } = default!;
}
diff --git a/API/DTOs/Email/TestEmailDto.cs b/API/DTOs/Email/TestEmailDto.cs
index dba9d05f0..37c12ed30 100644
--- a/API/DTOs/Email/TestEmailDto.cs
+++ b/API/DTOs/Email/TestEmailDto.cs
@@ -2,5 +2,5 @@
public class TestEmailDto
{
- public string Url { get; set; }
+ public string Url { get; set; } = default!;
}
diff --git a/API/DTOs/Filtering/FilterDto.cs b/API/DTOs/Filtering/FilterDto.cs
index f6c47f71f..1b8cffc9e 100644
--- a/API/DTOs/Filtering/FilterDto.cs
+++ b/API/DTOs/Filtering/FilterDto.cs
@@ -1,5 +1,4 @@
using System.Collections.Generic;
-using System.Runtime.InteropServices;
using API.Entities;
using API.Entities.Enums;
@@ -81,7 +80,7 @@ public class FilterDto
/// <summary>
/// Sorting Options for a query. Defaults to null, which uses the queries natural sorting order
/// </summary>
- public SortOptions SortOptions { get; set; } = null;
+ public SortOptions? SortOptions { get; set; } = null;
/// <summary>
/// Age Ratings. Empty list will return everything back
/// </summary>
@@ -99,10 +98,8 @@ public class FilterDto
/// An optional name string to filter by. Empty string will ignore.
/// </summary>
public string SeriesNameQuery { get; init; } = string.Empty;
- #nullable enable
/// <summary>
/// An optional release year to filter by. Null will ignore. You can pass 0 for an individual field to ignore it.
/// </summary>
public Range<int>? ReleaseYearRange { get; init; } = null;
- #nullable disable
}
diff --git a/API/DTOs/Filtering/LanguageDto.cs b/API/DTOs/Filtering/LanguageDto.cs
index b09aed5d1..bc7ebb5cc 100644
--- a/API/DTOs/Filtering/LanguageDto.cs
+++ b/API/DTOs/Filtering/LanguageDto.cs
@@ -2,6 +2,6 @@
public class LanguageDto
{
- public string IsoCode { get; set; }
- public string Title { get; set; }
+ public required string IsoCode { get; set; }
+ public required string Title { get; set; }
}
diff --git a/API/DTOs/Filtering/Range.cs b/API/DTOs/Filtering/Range.cs
index 383ce7887..b9e9a5e49 100644
--- a/API/DTOs/Filtering/Range.cs
+++ b/API/DTOs/Filtering/Range.cs
@@ -4,8 +4,8 @@
/// </summary>
public class Range<T>
{
- public T Min { get; set; }
- public T Max { get; set; }
+ public T? Min { get; init; }
+ public T? Max { get; init; }
public override string ToString()
{
diff --git a/API/DTOs/GroupedSeriesDto.cs b/API/DTOs/GroupedSeriesDto.cs
index 9795da16e..697ae3a53 100644
--- a/API/DTOs/GroupedSeriesDto.cs
+++ b/API/DTOs/GroupedSeriesDto.cs
@@ -7,7 +7,7 @@ namespace API.DTOs;
/// </summary>
public class GroupedSeriesDto
{
- public string SeriesName { get; set; }
+ public string SeriesName { get; set; } = default!;
public int SeriesId { get; set; }
public int LibraryId { get; set; }
public LibraryType LibraryType { get; set; }
diff --git a/API/DTOs/Jobs/JobDto.cs b/API/DTOs/Jobs/JobDto.cs
index dc566961e..89d7b30f9 100644
--- a/API/DTOs/Jobs/JobDto.cs
+++ b/API/DTOs/Jobs/JobDto.cs
@@ -7,11 +7,11 @@ public class JobDto
/// <summary>
/// Job Id
/// </summary>
- public string Id { get; set; }
+ public string Id { get; set; } = default!;
/// <summary>
/// Human Readable title for the Job
/// </summary>
- public string Title { get; set; }
+ public string Title { get; set; } = default!;
/// <summary>
/// When the job was created
/// </summary>
@@ -28,5 +28,5 @@ public class JobDto
/// Last time the job was run
/// </summary>
public DateTime? LastExecutionUtc { get; set; }
- public string Cron { get; set; }
+ public string Cron { get; set; } = default!;
}
diff --git a/API/DTOs/JumpBar/JumpKeyDto.cs b/API/DTOs/JumpBar/JumpKeyDto.cs
index 44545b65a..5a98a85ca 100644
--- a/API/DTOs/JumpBar/JumpKeyDto.cs
+++ b/API/DTOs/JumpBar/JumpKeyDto.cs
@@ -9,12 +9,13 @@ public class JumpKeyDto
/// Number of items in this Key
/// </summary>
public int Size { get; set; }
+
/// <summary>
/// Code to use in URL (url encoded)
/// </summary>
- public string Key { get; set; }
+ public string Key { get; set; } = default!;
/// <summary>
/// What is visible to user
/// </summary>
- public string Title { get; set; }
+ public string Title { get; set; } = default!;
}
diff --git a/API/DTOs/LibraryDto.cs b/API/DTOs/LibraryDto.cs
index 6d25409e6..fc0eed135 100644
--- a/API/DTOs/LibraryDto.cs
+++ b/API/DTOs/LibraryDto.cs
@@ -7,7 +7,7 @@ namespace API.DTOs;
public class LibraryDto
{
public int Id { get; init; }
- public string Name { get; init; }
+ public string? Name { get; init; }
/// <summary>
/// Last time Library was scanned
/// </summary>
@@ -16,7 +16,7 @@ public class LibraryDto
/// <summary>
/// An optional Cover Image or null
/// </summary>
- public string CoverImage { get; init; }
+ public string? CoverImage { get; init; }
/// <summary>
/// If Folder Watching is enabled for this library
/// </summary>
@@ -34,8 +34,16 @@ public class LibraryDto
/// </summary>
public bool ManageCollections { get; set; } = true;
/// <summary>
+ /// Should this library create and manage reading lists from Metadata
+ /// </summary>
+ public bool ManageReadingLists { get; set; } = true;
+ /// <summary>
/// Include library series in Search
/// </summary>
public bool IncludeInSearch { get; set; } = true;
- public ICollection<string> Folders { get; init; }
+ public ICollection<string> Folders { get; init; } = new List<string>();
+ /// <summary>
+ /// When showing series, only parent series or series with no relationships will be returned
+ /// </summary>
+ public bool CollapseSeriesRelationships { get; set; } = false;
}
diff --git a/API/DTOs/MangaFileDto.cs b/API/DTOs/MangaFileDto.cs
index 7945d1872..9be3c117f 100644
--- a/API/DTOs/MangaFileDto.cs
+++ b/API/DTOs/MangaFileDto.cs
@@ -6,7 +6,7 @@ namespace API.DTOs;
public class MangaFileDto
{
public int Id { get; init; }
- public string FilePath { get; init; }
+ public string FilePath { get; init; } = default!;
public int Pages { get; init; }
public long Bytes { get; init; }
public MangaFormat Format { get; init; }
diff --git a/API/DTOs/MemberDto.cs b/API/DTOs/MemberDto.cs
index 1805c1d24..31b5e62be 100644
--- a/API/DTOs/MemberDto.cs
+++ b/API/DTOs/MemberDto.cs
@@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
-using API.Data.Misc;
using API.DTOs.Account;
-using API.Entities.Enums;
namespace API.DTOs;
@@ -12,11 +10,15 @@ namespace API.DTOs;
public class MemberDto
{
public int Id { get; init; }
- public string Username { get; init; }
- public string Email { get; init; }
- public AgeRestrictionDto AgeRestriction { get; init; }
+ public string? Username { get; init; }
+ public string? Email { get; init; }
+ /// <summary>
+ /// If the member is still pending or not
+ /// </summary>
+ public bool IsPending { get; init; }
+ public AgeRestrictionDto? AgeRestriction { get; init; }
public DateTime Created { get; init; }
public DateTime LastActive { get; init; }
- public IEnumerable<LibraryDto> Libraries { get; init; }
- public IEnumerable<string> Roles { get; init; }
+ public IEnumerable<LibraryDto>? Libraries { get; init; }
+ public IEnumerable<string>? Roles { get; init; }
}
diff --git a/API/DTOs/Metadata/AgeRatingDto.cs b/API/DTOs/Metadata/AgeRatingDto.cs
index cbeb44e33..07523c3fe 100644
--- a/API/DTOs/Metadata/AgeRatingDto.cs
+++ b/API/DTOs/Metadata/AgeRatingDto.cs
@@ -5,5 +5,5 @@ namespace API.DTOs.Metadata;
public class AgeRatingDto
{
public AgeRating Value { get; set; }
- public string Title { get; set; }
+ public required string Title { get; set; }
}
diff --git a/API/DTOs/Metadata/ChapterMetadataDto.cs b/API/DTOs/Metadata/ChapterMetadataDto.cs
index cea8638d3..b9b04cfac 100644
--- a/API/DTOs/Metadata/ChapterMetadataDto.cs
+++ b/API/DTOs/Metadata/ChapterMetadataDto.cs
@@ -10,7 +10,7 @@ public class ChapterMetadataDto
{
public int Id { get; set; }
public int ChapterId { get; set; }
- public string Title { get; set; }
+ public string Title { get; set; } = default!;
public ICollection<PersonDto> Writers { get; set; } = new List<PersonDto>();
public ICollection<PersonDto> CoverArtists { get; set; } = new List<PersonDto>();
public ICollection<PersonDto> Publishers { get; set; } = new List<PersonDto>();
@@ -29,16 +29,16 @@ public class ChapterMetadataDto
/// </summary>
public ICollection<TagDto> Tags { get; set; } = new List<TagDto>();
public AgeRating AgeRating { get; set; }
- public string ReleaseDate { get; set; }
+ public string? ReleaseDate { get; set; }
public PublicationStatus PublicationStatus { get; set; }
/// <summary>
/// Summary for the Chapter/Issue
/// </summary>
- public string Summary { get; set; }
+ public string? Summary { get; set; }
/// <summary>
/// Language for the Chapter/Issue
/// </summary>
- public string Language { get; set; }
+ public string? Language { get; set; }
/// <summary>
/// Number in the TotalCount of issues
/// </summary>
diff --git a/API/DTOs/Metadata/GenreTagDto.cs b/API/DTOs/Metadata/GenreTagDto.cs
index 21d02273d..cf05ebbff 100644
--- a/API/DTOs/Metadata/GenreTagDto.cs
+++ b/API/DTOs/Metadata/GenreTagDto.cs
@@ -3,5 +3,5 @@
public class GenreTagDto
{
public int Id { get; set; }
- public string Title { get; set; }
+ public required string Title { get; set; }
}
diff --git a/API/DTOs/Metadata/PublicationStatusDto.cs b/API/DTOs/Metadata/PublicationStatusDto.cs
index 332223428..b8166a6e5 100644
--- a/API/DTOs/Metadata/PublicationStatusDto.cs
+++ b/API/DTOs/Metadata/PublicationStatusDto.cs
@@ -5,5 +5,5 @@ namespace API.DTOs.Metadata;
public class PublicationStatusDto
{
public PublicationStatus Value { get; set; }
- public string Title { get; set; }
+ public required string Title { get; set; }
}
diff --git a/API/DTOs/Metadata/TagDto.cs b/API/DTOs/Metadata/TagDto.cs
index 6e9b2f71e..59e03a279 100644
--- a/API/DTOs/Metadata/TagDto.cs
+++ b/API/DTOs/Metadata/TagDto.cs
@@ -3,5 +3,5 @@
public class TagDto
{
public int Id { get; set; }
- public string Title { get; set; }
+ public required string Title { get; set; }
}
diff --git a/API/DTOs/OPDS/Feed.cs b/API/DTOs/OPDS/Feed.cs
index 20f8897a8..76a740b89 100644
--- a/API/DTOs/OPDS/Feed.cs
+++ b/API/DTOs/OPDS/Feed.cs
@@ -26,7 +26,7 @@ public class Feed
public FeedAuthor Author { get; set; } = new FeedAuthor()
{
Name = "Kavita",
- Uri = "https://kavitareader.com"
+ Uri = "https://www.kavitareader.com"
};
[XmlElement("totalResults", Namespace = "http://a9.com/-/spec/opensearch/1.1/")]
diff --git a/API/DTOs/OPDS/FeedCategory.cs b/API/DTOs/OPDS/FeedCategory.cs
index 71684a257..3129fab60 100644
--- a/API/DTOs/OPDS/FeedCategory.cs
+++ b/API/DTOs/OPDS/FeedCategory.cs
@@ -8,11 +8,11 @@ public class FeedCategory
public string Scheme { get; } = "http://www.bisg.org/standards/bisac_subject/index.html";
[XmlAttribute("term")]
- public string Term { get; set; }
+ public string Term { get; set; } = default!;
/// <summary>
/// The actual genre
/// </summary>
[XmlAttribute("label")]
- public string Label { get; set; }
+ public string Label { get; set; } = default!;
}
diff --git a/API/DTOs/OPDS/FeedEntry.cs b/API/DTOs/OPDS/FeedEntry.cs
index 61594278c..e2210e2e8 100644
--- a/API/DTOs/OPDS/FeedEntry.cs
+++ b/API/DTOs/OPDS/FeedEntry.cs
@@ -10,13 +10,13 @@ public class FeedEntry
public string Updated { get; init; } = DateTime.UtcNow.ToString("s");
[XmlElement("id")]
- public string Id { get; set; }
+ public required string Id { get; set; }
[XmlElement("title")]
- public string Title { get; set; }
+ public required string Title { get; set; }
[XmlElement("summary")]
- public string Summary { get; set; }
+ public string? Summary { get; set; }
/// <summary>
/// Represents Size of the Entry
@@ -24,20 +24,20 @@ public class FeedEntry
/// <example>2 MB</example>
/// </summary>
[XmlElement("extent", Namespace = "http://purl.org/dc/terms/")]
- public string Extent { get; set; }
+ public string? Extent { get; set; }
/// <summary>
/// Format of the file
/// https://dublincore.org/specifications/dublin-core/dcmi-terms/
/// </summary>
[XmlElement("format", Namespace = "http://purl.org/dc/terms/format")]
- public string Format { get; set; }
+ public string? Format { get; set; }
[XmlElement("language", Namespace = "http://purl.org/dc/terms/")]
- public string Language { get; set; }
+ public string? Language { get; set; }
[XmlElement("content")]
- public FeedEntryContent Content { get; set; }
+ public FeedEntryContent? Content { get; set; }
[XmlElement("link")]
public List<FeedLink> Links { get; set; } = new List<FeedLink>();
diff --git a/API/DTOs/OPDS/FeedLink.cs b/API/DTOs/OPDS/FeedLink.cs
index b4ed730a8..2a9053f16 100644
--- a/API/DTOs/OPDS/FeedLink.cs
+++ b/API/DTOs/OPDS/FeedLink.cs
@@ -1,9 +1,12 @@
-using System.Xml.Serialization;
+using System;
+using System.Xml.Serialization;
namespace API.DTOs.OPDS;
public class FeedLink
{
+ [XmlIgnore]
+ public bool IsPageStream { get; set; }
/// <summary>
/// Relation on the Link
/// </summary>
@@ -25,6 +28,34 @@ public class FeedLink
[XmlAttribute("count", Namespace = "http://vaemendis.net/opds-pse/ns")]
public int TotalPages { get; set; }
+ /// <summary>
+ /// lastRead MUST provide the last page read for this document. The numbering starts at 1.
+ /// </summary>
+ [XmlAttribute("lastRead", Namespace = "http://vaemendis.net/opds-pse/ns")]
+ public int LastRead { get; set; } = -1;
+
+ /// <summary>
+ /// lastReadDate MAY provide the date of when the lastRead attribute was last updated.
+ /// </summary>
+ /// <remarks>Attribute MUST conform Atom's Date construct</remarks>
+ [XmlAttribute("lastReadDate", Namespace = "http://vaemendis.net/opds-pse/ns")]
+ public DateTime LastReadDate { get; set; }
+
+ public bool ShouldSerializeLastReadDate()
+ {
+ return IsPageStream;
+ }
+
+ public bool ShouldSerializeLastRead()
+ {
+ return LastRead >= 0;
+ }
+
+ public bool ShouldSerializeTitle()
+ {
+ return !string.IsNullOrEmpty(Title);
+ }
+
public bool ShouldSerializeTotalPages()
{
return TotalPages > 0;
diff --git a/API/DTOs/OPDS/OpenSearchDescription.cs b/API/DTOs/OPDS/OpenSearchDescription.cs
index 6ee043ac4..cc8392a88 100644
--- a/API/DTOs/OPDS/OpenSearchDescription.cs
+++ b/API/DTOs/OPDS/OpenSearchDescription.cs
@@ -8,29 +8,29 @@ public class OpenSearchDescription
/// <summary>
/// Contains a brief human-readable title that identifies this search engine.
/// </summary>
- public string ShortName { get; set; }
+ public string ShortName { get; set; } = default!;
/// <summary>
/// Contains an extended human-readable title that identifies this search engine.
/// </summary>
- public string LongName { get; set; }
+ public string LongName { get; set; } = default!;
/// <summary>
/// Contains a human-readable text description of the search engine.
/// </summary>
- public string Description { get; set; }
+ public string Description { get; set; } = default!;
/// <summary>
/// https://github.com/dewitt/opensearch/blob/master/opensearch-1-1-draft-6.md#the-url-element
/// </summary>
- public SearchLink Url { get; set; }
+ public SearchLink Url { get; set; } = default!;
/// <summary>
/// Contains a set of words that are used as keywords to identify and categorize this search content.
/// Tags must be a single word and are delimited by the space character (' ').
/// </summary>
- public string Tags { get; set; }
+ public string Tags { get; set; } = string.Empty;
/// <summary>
/// Contains a URL that identifies the location of an image that can be used in association with this search content.
/// <example><Image height="64" width="64" type="image/png">http://example.com/websearch.png</Image></example>
/// </summary>
- public string Image { get; set; }
+ public string Image { get; set; } = default!;
public string InputEncoding { get; set; } = "UTF-8";
public string OutputEncoding { get; set; } = "UTF-8";
/// <summary>
diff --git a/API/DTOs/OPDS/SearchLink.cs b/API/DTOs/OPDS/SearchLink.cs
index 6aeca506a..dba67f3bd 100644
--- a/API/DTOs/OPDS/SearchLink.cs
+++ b/API/DTOs/OPDS/SearchLink.cs
@@ -5,11 +5,11 @@ namespace API.DTOs.OPDS;
public class SearchLink
{
[XmlAttribute("type")]
- public string Type { get; set; }
+ public string Type { get; set; } = default!;
[XmlAttribute("rel")]
public string Rel { get; set; } = "results";
[XmlAttribute("template")]
- public string Template { get; set; }
+ public string Template { get; set; } = default!;
}
diff --git a/API/DTOs/PersonDto.cs b/API/DTOs/PersonDto.cs
index 92bd81924..85cc72bb0 100644
--- a/API/DTOs/PersonDto.cs
+++ b/API/DTOs/PersonDto.cs
@@ -5,6 +5,6 @@ namespace API.DTOs;
public class PersonDto
{
public int Id { get; set; }
- public string Name { get; set; }
+ public required string Name { get; set; }
public PersonRole Role { get; set; }
}
diff --git a/API/DTOs/ProgressDto.cs b/API/DTOs/ProgressDto.cs
index e5f796bcc..641714234 100644
--- a/API/DTOs/ProgressDto.cs
+++ b/API/DTOs/ProgressDto.cs
@@ -19,5 +19,7 @@ public class ProgressDto
/// For EPUB reader, this can be an optional string of the id of a part marker, to help resume reading position
/// on pages that combine multiple "chapters".
/// </summary>
- public string BookScrollId { get; set; }
+ public string? BookScrollId { get; set; }
+
+ public DateTime LastModifiedUtc { get; set; }
}
diff --git a/API/DTOs/Reader/BookChapterItem.cs b/API/DTOs/Reader/BookChapterItem.cs
index 3dabbd1ec..dcfb7b904 100644
--- a/API/DTOs/Reader/BookChapterItem.cs
+++ b/API/DTOs/Reader/BookChapterItem.cs
@@ -7,14 +7,14 @@ public class BookChapterItem
/// <summary>
/// Name of the Chapter
/// </summary>
- public string Title { get; set; }
+ public string Title { get; set; } = default!;
/// <summary>
/// A part represents the id of the anchor so we can scroll to it. 01_values.xhtml#h_sVZPaxUSy/
/// </summary>
- public string Part { get; set; }
+ public string Part { get; set; } = default!;
/// <summary>
/// Page Number to load for the chapter
/// </summary>
public int Page { get; set; }
- public ICollection<BookChapterItem> Children { get; set; }
+ public ICollection<BookChapterItem> Children { get; set; } = default!;
}
diff --git a/API/DTOs/Reader/BookInfoDto.cs b/API/DTOs/Reader/BookInfoDto.cs
index 78cfc39b0..c379f71f8 100644
--- a/API/DTOs/Reader/BookInfoDto.cs
+++ b/API/DTOs/Reader/BookInfoDto.cs
@@ -4,15 +4,15 @@ namespace API.DTOs.Reader;
public class BookInfoDto : IChapterInfoDto
{
- public string BookTitle { get; set; }
+ public string BookTitle { get; set; } = default! ;
public int SeriesId { get; set; }
public int VolumeId { get; set; }
public MangaFormat SeriesFormat { get; set; }
- public string SeriesName { get; set; }
- public string ChapterNumber { get; set; }
- public string VolumeNumber { get; set; }
+ public string SeriesName { get; set; } = default! ;
+ public string ChapterNumber { get; set; } = default! ;
+ public string VolumeNumber { get; set; } = default! ;
public int LibraryId { get; set; }
public int Pages { get; set; }
public bool IsSpecial { get; set; }
- public string ChapterTitle { get; set; }
+ public string ChapterTitle { get; set; } = default! ;
}
diff --git a/API/DTOs/Reader/BookmarkInfoDto.cs b/API/DTOs/Reader/BookmarkInfoDto.cs
index a34eb81c2..7583ee76d 100644
--- a/API/DTOs/Reader/BookmarkInfoDto.cs
+++ b/API/DTOs/Reader/BookmarkInfoDto.cs
@@ -1,13 +1,24 @@
-using API.Entities.Enums;
+using System.Collections.Generic;
+using API.Entities.Enums;
namespace API.DTOs.Reader;
public class BookmarkInfoDto
{
- public string SeriesName { get; set; }
+ public string SeriesName { get; set; } = default!;
public MangaFormat SeriesFormat { get; set; }
public int SeriesId { get; set; }
public int LibraryId { get; set; }
public LibraryType LibraryType { get; set; }
public int Pages { get; set; }
+ /// <summary>
+ /// List of all files with their inner archive structure maintained in filename and dimensions
+ /// </summary>
+ /// <remarks>This is optionally returned by includeDimensions</remarks>
+ public IEnumerable<FileDimensionDto>? PageDimensions { get; set; }
+ /// <summary>
+ /// For Double Page reader, this will contain snap points to ensure the reader always resumes on correct page
+ /// </summary>
+ /// <remarks>This is optionally returned by includeDimensions</remarks>
+ public IDictionary<int, int>? DoublePairs { get; set; }
}
diff --git a/API/DTOs/Reader/BulkRemoveBookmarkForSeriesDto.cs b/API/DTOs/Reader/BulkRemoveBookmarkForSeriesDto.cs
index 9cd22f958..7490f837c 100644
--- a/API/DTOs/Reader/BulkRemoveBookmarkForSeriesDto.cs
+++ b/API/DTOs/Reader/BulkRemoveBookmarkForSeriesDto.cs
@@ -4,5 +4,5 @@ namespace API.DTOs.Reader;
public class BulkRemoveBookmarkForSeriesDto
{
- public ICollection<int> SeriesIds { get; init; }
+ public ICollection<int> SeriesIds { get; init; } = default!;
}
diff --git a/API/DTOs/Reader/ChapterInfoDto.cs b/API/DTOs/Reader/ChapterInfoDto.cs
index 5ea7be7fd..36ddd554e 100644
--- a/API/DTOs/Reader/ChapterInfoDto.cs
+++ b/API/DTOs/Reader/ChapterInfoDto.cs
@@ -11,11 +11,11 @@ public class ChapterInfoDto : IChapterInfoDto
/// <summary>
/// The Chapter Number
/// </summary>
- public string ChapterNumber { get; set; }
+ public string ChapterNumber { get; set; } = default! ;
/// <summary>
/// The Volume Number
/// </summary>
- public string VolumeNumber { get; set; }
+ public string VolumeNumber { get; set; } = default! ;
/// <summary>
/// Volume entity Id
/// </summary>
@@ -23,7 +23,7 @@ public class ChapterInfoDto : IChapterInfoDto
/// <summary>
/// Series Name
/// </summary>
- public string SeriesName { get; set; }
+ public string SeriesName { get; set; } = null!;
/// <summary>
/// Series Format
/// </summary>
@@ -51,7 +51,7 @@ public class ChapterInfoDto : IChapterInfoDto
/// <summary>
/// File name of the chapter
/// </summary>
- public string FileName { get; set; }
+ public string? FileName { get; set; }
/// <summary>
/// If this is marked as a special in Kavita
/// </summary>
@@ -59,21 +59,22 @@ public class ChapterInfoDto : IChapterInfoDto
/// <summary>
/// The subtitle to render on the reader
/// </summary>
- public string Subtitle { get; set; }
+ public string? Subtitle { get; set; }
/// <summary>
/// Series Title
/// </summary>
/// <remarks>Usually just series name, but can include chapter title</remarks>
- public string Title { get; set; }
+ public string Title { get; set; } = default!;
+
/// <summary>
/// List of all files with their inner archive structure maintained in filename and dimensions
/// </summary>
/// <remarks>This is optionally returned by includeDimensions</remarks>
- public IEnumerable<FileDimensionDto> PageDimensions { get; set; }
+ public IEnumerable<FileDimensionDto>? PageDimensions { get; set; }
/// <summary>
/// For Double Page reader, this will contain snap points to ensure the reader always resumes on correct page
/// </summary>
/// <remarks>This is optionally returned by includeDimensions</remarks>
- public IDictionary<int, int> DoublePairs { get; set; }
+ public IDictionary<int, int>? DoublePairs { get; set; }
}
diff --git a/API/DTOs/Reader/MarkMultipleSeriesAsReadDto.cs b/API/DTOs/Reader/MarkMultipleSeriesAsReadDto.cs
index da36e44f5..50187ec81 100644
--- a/API/DTOs/Reader/MarkMultipleSeriesAsReadDto.cs
+++ b/API/DTOs/Reader/MarkMultipleSeriesAsReadDto.cs
@@ -4,5 +4,5 @@ namespace API.DTOs.Reader;
public class MarkMultipleSeriesAsReadDto
{
- public IReadOnlyList<int> SeriesIds { get; init; }
+ public IReadOnlyList<int> SeriesIds { get; init; } = default!;
}
diff --git a/API/DTOs/Reader/MarkVolumesReadDto.cs b/API/DTOs/Reader/MarkVolumesReadDto.cs
index 9f02af524..ebe1cd76c 100644
--- a/API/DTOs/Reader/MarkVolumesReadDto.cs
+++ b/API/DTOs/Reader/MarkVolumesReadDto.cs
@@ -11,9 +11,9 @@ public class MarkVolumesReadDto
/// <summary>
/// A list of Volumes to mark read
/// </summary>
- public IReadOnlyList<int> VolumeIds { get; set; }
+ public IReadOnlyList<int> VolumeIds { get; set; } = default!;
/// <summary>
/// A list of additional Chapters to mark as read
/// </summary>
- public IReadOnlyList<int> ChapterIds { get; set; }
+ public IReadOnlyList<int> ChapterIds { get; set; } = default!;
}
diff --git a/API/DTOs/ReadingLists/CBL/CblImportSummary.cs b/API/DTOs/ReadingLists/CBL/CblImportSummary.cs
index de5deb0c2..136a31aa8 100644
--- a/API/DTOs/ReadingLists/CBL/CblImportSummary.cs
+++ b/API/DTOs/ReadingLists/CBL/CblImportSummary.cs
@@ -1,8 +1,7 @@
using System.Collections.Generic;
using System.ComponentModel;
-using API.DTOs.ReadingLists.CBL;
-namespace API.DTOs.ReadingLists;
+namespace API.DTOs.ReadingLists.CBL;
public enum CblImportResult {
/// <summary>
@@ -64,13 +63,39 @@ public enum CblImportReason
/// </summary>
[Description("All Chapters Missing")]
AllChapterMissing = 7,
+ /// <summary>
+ /// The Chapter was imported
+ /// </summary>
+ [Description("Success")]
+ Success = 8,
+ /// <summary>
+ /// The file does not match the XML spec
+ /// </summary>
+ [Description("Invalid File")]
+ InvalidFile = 9,
}
public class CblBookResult
{
+ /// <summary>
+ /// Order in the CBL
+ /// </summary>
+ public int Order { get; set; }
public string Series { get; set; }
public string Volume { get; set; }
public string Number { get; set; }
+ /// <summary>
+ /// Used on Series conflict
+ /// </summary>
+ public int LibraryId { get; set; }
+ /// <summary>
+ /// Used on Series conflict
+ /// </summary>
+ public int SeriesId { get; set; }
+ /// <summary>
+ /// The name of the reading list
+ /// </summary>
+ public string ReadingListName { get; set; }
public CblImportReason Reason { get; set; }
public CblBookResult(CblBook book)
@@ -92,13 +117,12 @@ public class CblBookResult
public class CblImportSummaryDto
{
public string CblName { get; set; }
+ /// <summary>
+ /// Used only for Kavita's UI, the filename of the cbl
+ /// </summary>
+ public string FileName { get; set; }
public ICollection<CblBookResult> Results { get; set; }
public CblImportResult Success { get; set; }
public ICollection<CblBookResult> SuccessfulInserts { get; set; }
- /// <summary>
- /// A list of Series that are within the CBL but map to multiple libraries within Kavita
- /// </summary>
- public IList<SeriesDto> Conflicts { get; set; }
- public IList<CblConflictQuestion> Conflicts2 { get; set; }
}
diff --git a/API/DTOs/ReadingLists/CBL/CblReadingList.cs b/API/DTOs/ReadingLists/CBL/CblReadingList.cs
index e0dcc460d..001e6434b 100644
--- a/API/DTOs/ReadingLists/CBL/CblReadingList.cs
+++ b/API/DTOs/ReadingLists/CBL/CblReadingList.cs
@@ -21,6 +21,44 @@ public class CblReadingList
[XmlElement(ElementName="Name")]
public string Name { get; set; }
+ /// <summary>
+ /// Summary of the Reading List
+ /// </summary>
+ /// <remarks>This is not a standard, adding based on discussion with CBL Maintainers</remarks>
+ [XmlElement(ElementName="Summary")]
+ public string Summary { get; set; }
+
+ /// <summary>
+ /// Start Year of the Reading List. Overrides calculation
+ /// </summary>
+ /// <remarks>This is not a standard, adding based on discussion with CBL Maintainers</remarks>
+ [XmlElement(ElementName="StartYear")]
+ public int StartYear { get; set; } = -1;
+
+ /// <summary>
+ /// Start Year of the Reading List. Overrides calculation
+ /// </summary>
+ /// <remarks>This is not a standard, adding based on discussion with CBL Maintainers</remarks>
+ [XmlElement(ElementName = "StartMonth")]
+ public int StartMonth { get; set; } = -1;
+
+ /// <summary>
+ /// End Year of the Reading List. Overrides calculation
+ /// </summary>
+ /// <remarks>This is not a standard, adding based on discussion with CBL Maintainers</remarks>
+ [XmlElement(ElementName="EndYear")]
+ public int EndYear { get; set; } = -1;
+
+ /// <summary>
+ /// End Year of the Reading List. Overrides calculation
+ /// </summary>
+ /// <remarks>This is not a standard, adding based on discussion with CBL Maintainers</remarks>
+ [XmlElement(ElementName="EndMonth")]
+ public int EndMonth { get; set; } = -1;
+
+ /// <summary>
+ /// Issues of the Reading List
+ /// </summary>
[XmlElement(ElementName="Books")]
public CblBooks Books { get; set; }
}
diff --git a/API/DTOs/ReadingLists/CreateReadingListDto.cs b/API/DTOs/ReadingLists/CreateReadingListDto.cs
index 396c05e7c..783253007 100644
--- a/API/DTOs/ReadingLists/CreateReadingListDto.cs
+++ b/API/DTOs/ReadingLists/CreateReadingListDto.cs
@@ -2,5 +2,5 @@
public class CreateReadingListDto
{
- public string Title { get; init; }
+ public string Title { get; init; } = default!;
}
diff --git a/API/DTOs/ReadingLists/ReadingListDto.cs b/API/DTOs/ReadingLists/ReadingListDto.cs
index de212217e..f8791b0d6 100644
--- a/API/DTOs/ReadingLists/ReadingListDto.cs
+++ b/API/DTOs/ReadingLists/ReadingListDto.cs
@@ -1,10 +1,12 @@
-namespace API.DTOs.ReadingLists;
+using System;
+
+namespace API.DTOs.ReadingLists;
public class ReadingListDto
{
public int Id { get; init; }
- public string Title { get; set; }
- public string Summary { get; set; }
+ public string Title { get; set; } = default!;
+ public string Summary { get; set; } = default!;
/// <summary>
/// Reading lists that are promoted are only done by admins
/// </summary>
@@ -14,4 +16,21 @@ public class ReadingListDto
/// This is used to tell the UI if it should request a Cover Image or not. If null or empty, it has not been set.
/// </summary>
public string CoverImage { get; set; } = string.Empty;
+ /// <summary>
+ /// Minimum Year the Reading List starts
+ /// </summary>
+ public int StartingYear { get; set; }
+ /// <summary>
+ /// Minimum Month the Reading List starts
+ /// </summary>
+ public int StartingMonth { get; set; }
+ /// <summary>
+ /// Maximum Year the Reading List starts
+ /// </summary>
+ public int EndingYear { get; set; }
+ /// <summary>
+ /// Maximum Month the Reading List starts
+ /// </summary>
+ public int EndingMonth { get; set; }
+
}
diff --git a/API/DTOs/ReadingLists/ReadingListItemDto.cs b/API/DTOs/ReadingLists/ReadingListItemDto.cs
index 79fdd9d8f..6bcc462b7 100644
--- a/API/DTOs/ReadingLists/ReadingListItemDto.cs
+++ b/API/DTOs/ReadingLists/ReadingListItemDto.cs
@@ -9,18 +9,18 @@ public class ReadingListItemDto
public int Order { get; init; }
public int ChapterId { get; init; }
public int SeriesId { get; init; }
- public string SeriesName { get; set; }
+ public string? SeriesName { get; set; }
public MangaFormat SeriesFormat { get; set; }
public int PagesRead { get; set; }
public int PagesTotal { get; set; }
- public string ChapterNumber { get; set; }
- public string ChapterTitleName { get; set; }
- public string VolumeNumber { get; set; }
+ public string? ChapterNumber { get; set; }
+ public string? VolumeNumber { get; set; }
+ public string? ChapterTitleName { get; set; }
public int VolumeId { get; set; }
public int LibraryId { get; set; }
+ public string? Title { get; set; }
public LibraryType LibraryType { get; set; }
- public string LibraryName { get; set; }
- public string Title { get; set; }
+ public string? LibraryName { get; set; }
/// <summary>
/// Release Date from Chapter
/// </summary>
diff --git a/API/DTOs/ReadingLists/UpdateReadingListByMultipleDto.cs b/API/DTOs/ReadingLists/UpdateReadingListByMultipleDto.cs
index 0d4bfb0dd..408963529 100644
--- a/API/DTOs/ReadingLists/UpdateReadingListByMultipleDto.cs
+++ b/API/DTOs/ReadingLists/UpdateReadingListByMultipleDto.cs
@@ -6,6 +6,6 @@ public class UpdateReadingListByMultipleDto
{
public int SeriesId { get; init; }
public int ReadingListId { get; init; }
- public IReadOnlyList<int> VolumeIds { get; init; }
- public IReadOnlyList<int> ChapterIds { get; init; }
+ public IReadOnlyList<int> VolumeIds { get; init; } = default!;
+ public IReadOnlyList<int> ChapterIds { get; init; } = default!;
}
diff --git a/API/DTOs/ReadingLists/UpdateReadingListByMultipleSeriesDto.cs b/API/DTOs/ReadingLists/UpdateReadingListByMultipleSeriesDto.cs
index 944d4ff78..f910e9c06 100644
--- a/API/DTOs/ReadingLists/UpdateReadingListByMultipleSeriesDto.cs
+++ b/API/DTOs/ReadingLists/UpdateReadingListByMultipleSeriesDto.cs
@@ -5,5 +5,5 @@ namespace API.DTOs.ReadingLists;
public class UpdateReadingListByMultipleSeriesDto
{
public int ReadingListId { get; init; }
- public IReadOnlyList<int> SeriesIds { get; init; }
+ public IReadOnlyList<int> SeriesIds { get; init; } = default!;
}
diff --git a/API/DTOs/ReadingLists/UpdateReadingListDto.cs b/API/DTOs/ReadingLists/UpdateReadingListDto.cs
index 6be7b8f69..6b590707a 100644
--- a/API/DTOs/ReadingLists/UpdateReadingListDto.cs
+++ b/API/DTOs/ReadingLists/UpdateReadingListDto.cs
@@ -1,5 +1,4 @@
-using System;
-using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations;
namespace API.DTOs.ReadingLists;
@@ -11,4 +10,9 @@ public class UpdateReadingListDto
public string Summary { get; set; } = string.Empty;
public bool Promoted { get; set; }
public bool CoverImageLocked { get; set; }
+ public int StartingMonth { get; set; } = 0;
+ public int StartingYear { get; set; } = 0;
+ public int EndingMonth { get; set; } = 0;
+ public int EndingYear { get; set; } = 0;
+
}
diff --git a/API/DTOs/RecentlyAddedItemDto.cs b/API/DTOs/RecentlyAddedItemDto.cs
index 6c7df8b4d..93ef9ac9a 100644
--- a/API/DTOs/RecentlyAddedItemDto.cs
+++ b/API/DTOs/RecentlyAddedItemDto.cs
@@ -8,14 +8,14 @@ namespace API.DTOs;
/// </summary>
public class RecentlyAddedItemDto
{
- public string SeriesName { get; set; }
+ public string SeriesName { get; set; } = default!;
public int SeriesId { get; set; }
public int LibraryId { get; set; }
public LibraryType LibraryType { get; set; }
/// <summary>
/// This will automatically map to Volume X, Chapter Y, etc.
/// </summary>
- public string Title { get; set; }
+ public string Title { get; set; } = default!;
public DateTime Created { get; set; }
/// <summary>
/// Chapter Id if this is a chapter. Not guaranteed to be set.
diff --git a/API/DTOs/RegisterDto.cs b/API/DTOs/RegisterDto.cs
index 4e542f1c0..b6132046f 100644
--- a/API/DTOs/RegisterDto.cs
+++ b/API/DTOs/RegisterDto.cs
@@ -5,12 +5,12 @@ namespace API.DTOs;
public class RegisterDto
{
[Required]
- public string Username { get; init; }
+ public string Username { get; init; } = default!;
/// <summary>
/// An email to register with. Optional. Provides Forgot Password functionality
/// </summary>
- public string Email { get; init; }
+ public string Email { get; init; } = default!;
[Required]
[StringLength(32, MinimumLength = 6)]
- public string Password { get; set; }
+ public string Password { get; set; } = default!;
}
diff --git a/API/DTOs/ScanFolderDto.cs b/API/DTOs/ScanFolderDto.cs
index 59ce4d0b5..684de909e 100644
--- a/API/DTOs/ScanFolderDto.cs
+++ b/API/DTOs/ScanFolderDto.cs
@@ -8,10 +8,10 @@ public class ScanFolderDto
/// <summary>
/// Api key for a user with Admin permissions
/// </summary>
- public string ApiKey { get; set; }
+ public string ApiKey { get; set; } = default!;
/// <summary>
/// Folder Path to Scan
/// </summary>
/// <remarks>JSON cannot accept /, so you may need to use // escaping on paths</remarks>
- public string FolderPath { get; set; }
+ public string FolderPath { get; set; } = default!;
}
diff --git a/API/DTOs/Search/SearchResultDto.cs b/API/DTOs/Search/SearchResultDto.cs
index 4d9e300a5..6fcae3b5d 100644
--- a/API/DTOs/Search/SearchResultDto.cs
+++ b/API/DTOs/Search/SearchResultDto.cs
@@ -5,13 +5,13 @@ namespace API.DTOs.Search;
public class SearchResultDto
{
public int SeriesId { get; init; }
- public string Name { get; init; }
- public string OriginalName { get; init; }
- public string SortName { get; init; }
- public string LocalizedName { get; init; }
+ public string Name { get; init; } = default!;
+ public string OriginalName { get; init; } = default!;
+ public string SortName { get; init; } = default!;
+ public string LocalizedName { get; init; } = default!;
public MangaFormat Format { get; init; }
// Grouping information
- public string LibraryName { get; set; }
+ public string LibraryName { get; set; } = default!;
public int LibraryId { get; set; }
}
diff --git a/API/DTOs/Search/SearchResultGroupDto.cs b/API/DTOs/Search/SearchResultGroupDto.cs
index 0a1fac402..66370fb0a 100644
--- a/API/DTOs/Search/SearchResultGroupDto.cs
+++ b/API/DTOs/Search/SearchResultGroupDto.cs
@@ -10,15 +10,15 @@ namespace API.DTOs.Search;
/// </summary>
public class SearchResultGroupDto
{
- public IEnumerable<LibraryDto> Libraries { get; set; }
- public IEnumerable<SearchResultDto> Series { get; set; }
- public IEnumerable<CollectionTagDto> Collections { get; set; }
- public IEnumerable<ReadingListDto> ReadingLists { get; set; }
- public IEnumerable<PersonDto> Persons { get; set; }
- public IEnumerable<GenreTagDto> Genres { get; set; }
- public IEnumerable<TagDto> Tags { get; set; }
- public IEnumerable<MangaFileDto> Files { get; set; }
- public IEnumerable<ChapterDto> Chapters { get; set; }
+ public IEnumerable<LibraryDto> Libraries { get; set; } = default!;
+ public IEnumerable<SearchResultDto> Series { get; set; } = default!;
+ public IEnumerable<CollectionTagDto> Collections { get; set; } = default!;
+ public IEnumerable<ReadingListDto> ReadingLists { get; set; } = default!;
+ public IEnumerable<PersonDto> Persons { get; set; } = default!;
+ public IEnumerable<GenreTagDto> Genres { get; set; } = default!;
+ public IEnumerable<TagDto> Tags { get; set; } = default!;
+ public IEnumerable<MangaFileDto> Files { get; set; } = default!;
+ public IEnumerable<ChapterDto> Chapters { get; set; } = default!;
}
diff --git a/API/DTOs/SeriesByIdsDto.cs b/API/DTOs/SeriesByIdsDto.cs
index 29c028156..12e13d96f 100644
--- a/API/DTOs/SeriesByIdsDto.cs
+++ b/API/DTOs/SeriesByIdsDto.cs
@@ -2,5 +2,5 @@
public class SeriesByIdsDto
{
- public int[] SeriesIds { get; init; }
+ public int[] SeriesIds { get; init; } = default!;
}
diff --git a/API/DTOs/SeriesDetail/RelatedSeriesDto.cs b/API/DTOs/SeriesDetail/RelatedSeriesDto.cs
index 452da9cf5..72271ff73 100644
--- a/API/DTOs/SeriesDetail/RelatedSeriesDto.cs
+++ b/API/DTOs/SeriesDetail/RelatedSeriesDto.cs
@@ -1,5 +1,4 @@
using System.Collections.Generic;
-using API.Entities.Enums;
namespace API.DTOs.SeriesDetail;
@@ -10,17 +9,17 @@ public class RelatedSeriesDto
/// </summary>
public int SourceSeriesId { get; set; }
- public IEnumerable<SeriesDto> Sequels { get; set; }
- public IEnumerable<SeriesDto> Prequels { get; set; }
- public IEnumerable<SeriesDto> SpinOffs { get; set; }
- public IEnumerable<SeriesDto> Adaptations { get; set; }
- public IEnumerable<SeriesDto> SideStories { get; set; }
- public IEnumerable<SeriesDto> Characters { get; set; }
- public IEnumerable<SeriesDto> Contains { get; set; }
- public IEnumerable<SeriesDto> Others { get; set; }
- public IEnumerable<SeriesDto> AlternativeSettings { get; set; }
- public IEnumerable<SeriesDto> AlternativeVersions { get; set; }
- public IEnumerable<SeriesDto> Doujinshis { get; set; }
- public IEnumerable<SeriesDto> Parent { get; set; }
- public IEnumerable<SeriesDto> Editions { get; set; }
+ public IEnumerable<SeriesDto> Sequels { get; set; } = default!;
+ public IEnumerable<SeriesDto> Prequels { get; set; } = default!;
+ public IEnumerable<SeriesDto> SpinOffs { get; set; } = default!;
+ public IEnumerable<SeriesDto> Adaptations { get; set; } = default!;
+ public IEnumerable<SeriesDto> SideStories { get; set; } = default!;
+ public IEnumerable<SeriesDto> Characters { get; set; } = default!;
+ public IEnumerable<SeriesDto> Contains { get; set; } = default!;
+ public IEnumerable<SeriesDto> Others { get; set; } = default!;
+ public IEnumerable<SeriesDto> AlternativeSettings { get; set; } = default!;
+ public IEnumerable<SeriesDto> AlternativeVersions { get; set; } = default!;
+ public IEnumerable<SeriesDto> Doujinshis { get; set; } = default!;
+ public IEnumerable<SeriesDto> Parent { get; set; } = default!;
+ public IEnumerable<SeriesDto> Editions { get; set; } = default!;
}
diff --git a/API/DTOs/SeriesDetail/SeriesDetailDto.cs b/API/DTOs/SeriesDetail/SeriesDetailDto.cs
index 2438755c6..9fc067803 100644
--- a/API/DTOs/SeriesDetail/SeriesDetailDto.cs
+++ b/API/DTOs/SeriesDetail/SeriesDetailDto.cs
@@ -11,19 +11,19 @@ public class SeriesDetailDto
/// <summary>
/// Specials for the Series. These will have their title and range cleaned to remove the special marker and prepare
/// </summary>
- public IEnumerable<ChapterDto> Specials { get; set; }
+ public IEnumerable<ChapterDto> Specials { get; set; } = default!;
/// <summary>
/// All Chapters, excluding Specials and single chapters (0 chapter) for a volume
/// </summary>
- public IEnumerable<ChapterDto> Chapters { get; set; }
+ public IEnumerable<ChapterDto> Chapters { get; set; } = default!;
/// <summary>
/// Just the Volumes for the Series (Excludes Volume 0)
/// </summary>
- public IEnumerable<VolumeDto> Volumes { get; set; }
+ public IEnumerable<VolumeDto> Volumes { get; set; } = default!;
/// <summary>
/// These are chapters that are in Volume 0 and should be read AFTER the volumes
/// </summary>
- public IEnumerable<ChapterDto> StorylineChapters { get; set; }
+ public IEnumerable<ChapterDto> StorylineChapters { get; set; } = default!;
/// <summary>
/// How many chapters are unread
/// </summary>
diff --git a/API/DTOs/SeriesDetail/UpdateRelatedSeriesDto.cs b/API/DTOs/SeriesDetail/UpdateRelatedSeriesDto.cs
index d6976a05d..8a81f766e 100644
--- a/API/DTOs/SeriesDetail/UpdateRelatedSeriesDto.cs
+++ b/API/DTOs/SeriesDetail/UpdateRelatedSeriesDto.cs
@@ -5,16 +5,16 @@ namespace API.DTOs.SeriesDetail;
public class UpdateRelatedSeriesDto
{
public int SeriesId { get; set; }
- public IList<int> Adaptations { get; set; }
- public IList<int> Characters { get; set; }
- public IList<int> Contains { get; set; }
- public IList<int> Others { get; set; }
- public IList<int> Prequels { get; set; }
- public IList<int> Sequels { get; set; }
- public IList<int> SideStories { get; set; }
- public IList<int> SpinOffs { get; set; }
- public IList<int> AlternativeSettings { get; set; }
- public IList<int> AlternativeVersions { get; set; }
- public IList<int> Doujinshis { get; set; }
- public IList<int> Editions { get; set; }
+ public IList<int> Adaptations { get; set; } = default!;
+ public IList<int> Characters { get; set; } = default!;
+ public IList<int> Contains { get; set; } = default!;
+ public IList<int> Others { get; set; } = default!;
+ public IList<int> Prequels { get; set; } = default!;
+ public IList<int> Sequels { get; set; } = default!;
+ public IList<int> SideStories { get; set; } = default!;
+ public IList<int> SpinOffs { get; set; } = default!;
+ public IList<int> AlternativeSettings { get; set; } = default!;
+ public IList<int> AlternativeVersions { get; set; } = default!;
+ public IList<int> Doujinshis { get; set; } = default!;
+ public IList<int> Editions { get; set; } = default!;
}
diff --git a/API/DTOs/SeriesDto.cs b/API/DTOs/SeriesDto.cs
index b1b5a9f35..8ebd13303 100644
--- a/API/DTOs/SeriesDto.cs
+++ b/API/DTOs/SeriesDto.cs
@@ -7,11 +7,11 @@ namespace API.DTOs;
public class SeriesDto : IHasReadTimeEstimate
{
public int Id { get; init; }
- public string Name { get; init; }
- public string OriginalName { get; init; }
- public string LocalizedName { get; init; }
- public string SortName { get; init; }
- public string Summary { get; init; }
+ public string? Name { get; init; }
+ public string? OriginalName { get; init; }
+ public string? LocalizedName { get; init; }
+ public string? SortName { get; init; }
+ public string? Summary { get; init; }
public int Pages { get; init; }
public bool CoverImageLocked { get; set; }
/// <summary>
@@ -33,7 +33,7 @@ public class SeriesDto : IHasReadTimeEstimate
/// <summary>
/// Review from logged in user. Calculated at API-time.
/// </summary>
- public string UserReview { get; set; }
+ public string? UserReview { get; set; }
public MangaFormat Format { get; set; }
public DateTime Created { get; set; }
@@ -47,7 +47,7 @@ public class SeriesDto : IHasReadTimeEstimate
public long WordCount { get; set; }
public int LibraryId { get; set; }
- public string LibraryName { get; set; }
+ public string LibraryName { get; set; } = default!;
/// <inheritdoc cref="IHasReadTimeEstimate.MinHoursToRead"/>
public int MinHoursToRead { get; set; }
/// <inheritdoc cref="IHasReadTimeEstimate.MaxHoursToRead"/>
@@ -57,7 +57,7 @@ public class SeriesDto : IHasReadTimeEstimate
/// <summary>
/// The highest level folder for this Series
/// </summary>
- public string FolderPath { get; set; }
+ public string FolderPath { get; set; } = default!;
/// <summary>
/// The last time the folder for this series was scanned
/// </summary>
diff --git a/API/DTOs/SeriesMetadataDto.cs b/API/DTOs/SeriesMetadataDto.cs
index 8853fdb0b..441f58d36 100644
--- a/API/DTOs/SeriesMetadataDto.cs
+++ b/API/DTOs/SeriesMetadataDto.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Collections.Generic;
+using System.Collections.Generic;
using API.DTOs.CollectionTags;
using API.DTOs.Metadata;
using API.Entities.Enums;
@@ -10,18 +9,21 @@ public class SeriesMetadataDto
{
public int Id { get; set; }
public string Summary { get; set; } = string.Empty;
+
/// <summary>
/// Collections the Series belongs to
/// </summary>
- public ICollection<CollectionTagDto> CollectionTags { get; set; }
+ public ICollection<CollectionTagDto> CollectionTags { get; set; } = new List<CollectionTagDto>();
+
/// <summary>
/// Genres for the Series
/// </summary>
- public ICollection<GenreTagDto> Genres { get; set; }
+ public ICollection<GenreTagDto> Genres { get; set; } = new List<GenreTagDto>();
+
/// <summary>
/// Collection of all Tags from underlying chapters for a Series
/// </summary>
- public ICollection<TagDto> Tags { get; set; }
+ public ICollection<TagDto> Tags { get; set; } = new List<TagDto>();
public ICollection<PersonDto> Writers { get; set; } = new List<PersonDto>();
public ICollection<PersonDto> CoverArtists { get; set; } = new List<PersonDto>();
public ICollection<PersonDto> Publishers { get; set; } = new List<PersonDto>();
diff --git a/API/DTOs/Settings/ServerSettingDTO.cs b/API/DTOs/Settings/ServerSettingDTO.cs
index 07aa08ce6..90a0901b3 100644
--- a/API/DTOs/Settings/ServerSettingDTO.cs
+++ b/API/DTOs/Settings/ServerSettingDTO.cs
@@ -1,18 +1,16 @@
-using System;
-using System.ComponentModel.DataAnnotations;
-using API.Services;
+using API.Services;
namespace API.DTOs.Settings;
public class ServerSettingDto
{
- public string CacheDirectory { get; set; }
- public string TaskScan { get; set; }
+ public string CacheDirectory { get; set; } = default!;
+ public string TaskScan { get; set; } = default!;
/// <summary>
/// Logging level for server. Managed in appsettings.json.
/// </summary>
- public string LoggingLevel { get; set; }
- public string TaskBackup { get; set; }
+ public string LoggingLevel { get; set; } = default!;
+ public string TaskBackup { get; set; } = default!;
/// <summary>
/// Port the server listens on. Managed in appsettings.json.
/// </summary>
@@ -32,22 +30,22 @@ public class ServerSettingDto
/// <summary>
/// Base Url for the kavita. Requires restart to take effect.
/// </summary>
- public string BaseUrl { get; set; }
+ public string BaseUrl { get; set; } = default!;
/// <summary>
/// Where Bookmarks are stored.
/// </summary>
/// <remarks>If null or empty string, will default back to default install setting aka <see cref="DirectoryService.BookmarkDirectory"/></remarks>
- public string BookmarksDirectory { get; set; }
+ public string BookmarksDirectory { get; set; } = default!;
/// <summary>
/// Email service to use for the invite user flow, forgot password, etc.
/// </summary>
/// <remarks>If null or empty string, will default back to default install setting aka <see cref="EmailService.DefaultApiUrl"/></remarks>
- public string EmailServiceUrl { get; set; }
- public string InstallVersion { get; set; }
+ public string EmailServiceUrl { get; set; } = default!;
+ public string InstallVersion { get; set; } = default!;
/// <summary>
/// Represents a unique Id to this Kavita installation. Only used in Stats to identify unique installs.
/// </summary>
- public string InstallId { get; set; }
+ public string InstallId { get; set; } = default!;
/// <summary>
/// If the server should save bookmarks as WebP encoding
/// </summary>
diff --git a/API/DTOs/Statistics/Count.cs b/API/DTOs/Statistics/Count.cs
index dc9803a6f..411b44897 100644
--- a/API/DTOs/Statistics/Count.cs
+++ b/API/DTOs/Statistics/Count.cs
@@ -2,6 +2,6 @@
public class StatCount<T> : ICount<T>
{
- public T Value { get; set; }
+ public T Value { get; set; } = default!;
public long Count { get; set; }
}
diff --git a/API/DTOs/Statistics/FileExtensionBreakdownDto.cs b/API/DTOs/Statistics/FileExtensionBreakdownDto.cs
index 66e5f821b..c0d65fe7f 100644
--- a/API/DTOs/Statistics/FileExtensionBreakdownDto.cs
+++ b/API/DTOs/Statistics/FileExtensionBreakdownDto.cs
@@ -5,7 +5,7 @@ namespace API.DTOs.Statistics;
public class FileExtensionDto
{
- public string Extension { get; set; }
+ public string? Extension { get; set; }
public MangaFormat Format { get; set; }
public long TotalSize { get; set; }
public long TotalFiles { get; set; }
@@ -17,6 +17,7 @@ public class FileExtensionBreakdownDto
/// Total bytes for all files
/// </summary>
public long TotalFileSize { get; set; }
- public IList<FileExtensionDto> FileBreakdown { get; set; }
+
+ public IList<FileExtensionDto> FileBreakdown { get; set; } = default!;
}
diff --git a/API/DTOs/Statistics/PagesReadOnADayCount.cs b/API/DTOs/Statistics/PagesReadOnADayCount.cs
index c38a775c7..b1a6bb1ea 100644
--- a/API/DTOs/Statistics/PagesReadOnADayCount.cs
+++ b/API/DTOs/Statistics/PagesReadOnADayCount.cs
@@ -1,5 +1,4 @@
-using System;
-using API.Entities.Enums;
+using API.Entities.Enums;
namespace API.DTOs.Statistics;
@@ -8,7 +7,7 @@ public class PagesReadOnADayCount<T> : ICount<T>
/// <summary>
/// The day of the readings
/// </summary>
- public T Value { get; set; }
+ public T Value { get; set; } = default!;
/// <summary>
/// Number of pages read
/// </summary>
diff --git a/API/DTOs/Statistics/ReadHistoryEvent.cs b/API/DTOs/Statistics/ReadHistoryEvent.cs
index 72377c823..9e32aa792 100644
--- a/API/DTOs/Statistics/ReadHistoryEvent.cs
+++ b/API/DTOs/Statistics/ReadHistoryEvent.cs
@@ -8,11 +8,11 @@ namespace API.DTOs.Statistics;
public class ReadHistoryEvent
{
public int UserId { get; set; }
- public string UserName { get; set; }
+ public required string? UserName { get; set; } = default!;
public int LibraryId { get; set; }
public int SeriesId { get; set; }
- public string SeriesName { get; set; }
+ public required string SeriesName { get; set; } = default!;
public DateTime ReadDate { get; set; }
public int ChapterId { get; set; }
- public string ChapterNumber { get; set; }
+ public required string ChapterNumber { get; set; } = default!;
}
diff --git a/API/DTOs/Statistics/ServerStatisticsDto.cs b/API/DTOs/Statistics/ServerStatisticsDto.cs
index d727e3227..059b25204 100644
--- a/API/DTOs/Statistics/ServerStatisticsDto.cs
+++ b/API/DTOs/Statistics/ServerStatisticsDto.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Collections.Generic;
+using System.Collections.Generic;
namespace API.DTOs.Statistics;
@@ -14,17 +13,17 @@ public class ServerStatisticsDto
public long TotalTags { get; set; }
public long TotalPeople { get; set; }
public long TotalReadingTime { get; set; }
- public IEnumerable<ICount<SeriesDto>> MostReadSeries { get; set; }
+ public IEnumerable<ICount<SeriesDto>>? MostReadSeries { get; set; }
/// <summary>
/// Total users who have started/reading/read per series
/// </summary>
- public IEnumerable<ICount<SeriesDto>> MostPopularSeries { get; set; }
- public IEnumerable<ICount<UserDto>> MostActiveUsers { get; set; }
- public IEnumerable<ICount<LibraryDto>> MostActiveLibraries { get; set; }
+ public IEnumerable<ICount<SeriesDto>>? MostPopularSeries { get; set; }
+ public IEnumerable<ICount<UserDto>>? MostActiveUsers { get; set; }
+ public IEnumerable<ICount<LibraryDto>>? MostActiveLibraries { get; set; }
/// <summary>
/// Last 5 Series read
/// </summary>
- public IEnumerable<SeriesDto> RecentlyRead { get; set; }
+ public IEnumerable<SeriesDto>? RecentlyRead { get; set; }
}
diff --git a/API/DTOs/Statistics/TopReadsDto.cs b/API/DTOs/Statistics/TopReadsDto.cs
index dbcb718dc..819e55ad5 100644
--- a/API/DTOs/Statistics/TopReadsDto.cs
+++ b/API/DTOs/Statistics/TopReadsDto.cs
@@ -1,11 +1,9 @@
-using System.Collections.Generic;
-
-namespace API.DTOs.Statistics;
+namespace API.DTOs.Statistics;
public class TopReadDto
{
public int UserId { get; set; }
- public string Username { get; set; }
+ public string? Username { get; set; } = default!;
/// <summary>
/// Amount of time read on Comic libraries
/// </summary>
diff --git a/API/DTOs/Statistics/UserReadStatistics.cs b/API/DTOs/Statistics/UserReadStatistics.cs
index 686957e93..5e3f5aa5d 100644
--- a/API/DTOs/Statistics/UserReadStatistics.cs
+++ b/API/DTOs/Statistics/UserReadStatistics.cs
@@ -20,6 +20,6 @@ public class UserReadStatistics
public long ChaptersRead { get; set; }
public DateTime LastActive { get; set; }
public double AvgHoursPerWeekSpentReading { get; set; }
- public IEnumerable<StatCount<float>> PercentReadPerLibrary { get; set; }
+ public IEnumerable<StatCount<float>>? PercentReadPerLibrary { get; set; }
}
diff --git a/API/DTOs/Stats/FileFormatDto.cs b/API/DTOs/Stats/FileFormatDto.cs
index 67385e746..6319bd2a9 100644
--- a/API/DTOs/Stats/FileFormatDto.cs
+++ b/API/DTOs/Stats/FileFormatDto.cs
@@ -7,9 +7,9 @@ public class FileFormatDto
/// <summary>
/// The extension with the ., in lowercase
/// </summary>
- public string Extension { get; set; }
+ public required string Extension { get; set; }
/// <summary>
/// Format of extension
/// </summary>
- public MangaFormat Format { get; set; }
+ public required MangaFormat Format { get; set; }
}
diff --git a/API/DTOs/Stats/ServerInfoDto.cs b/API/DTOs/Stats/ServerInfoDto.cs
index 629b3da6d..d8c60920e 100644
--- a/API/DTOs/Stats/ServerInfoDto.cs
+++ b/API/DTOs/Stats/ServerInfoDto.cs
@@ -1,6 +1,5 @@
using System.Collections.Generic;
using API.Entities.Enums;
-using Microsoft.AspNetCore.Mvc.RazorPages;
namespace API.DTOs.Stats;
@@ -12,8 +11,8 @@ public class ServerInfoDto
/// <summary>
/// Unique Id that represents a unique install
/// </summary>
- public string InstallId { get; set; }
- public string Os { get; set; }
+ public required string InstallId { get; set; }
+ public required string Os { get; set; }
/// <summary>
/// If the Kavita install is using Docker
/// </summary>
@@ -21,11 +20,11 @@ public class ServerInfoDto
/// <summary>
/// Version of .NET instance is running
/// </summary>
- public string DotnetVersion { get; set; }
+ public required string DotnetVersion { get; set; }
/// <summary>
/// Version of Kavita
/// </summary>
- public string KavitaVersion { get; set; }
+ public required string KavitaVersion { get; set; }
/// <summary>
/// Number of Cores on the instance
/// </summary>
@@ -42,7 +41,7 @@ public class ServerInfoDto
/// The site theme the install is using
/// </summary>
/// <remarks>Introduced in v0.5.2</remarks>
- public string ActiveSiteTheme { get; set; }
+ public string? ActiveSiteTheme { get; set; }
/// <summary>
/// The reading mode the main user has as a preference
/// </summary>
@@ -124,22 +123,22 @@ public class ServerInfoDto
/// A list of background colors set on the instance
/// </summary>
/// <remarks>Introduced in v0.6.0</remarks>
- public IEnumerable<string> MangaReaderBackgroundColors { get; set; }
+ public required IEnumerable<string> MangaReaderBackgroundColors { get; set; }
/// <summary>
/// A list of Page Split defaults being used on the instance
/// </summary>
/// <remarks>Introduced in v0.6.0</remarks>
- public IEnumerable<PageSplitOption> MangaReaderPageSplittingModes { get; set; }
+ public required IEnumerable<PageSplitOption> MangaReaderPageSplittingModes { get; set; }
/// <summary>
/// A list of Layout Mode defaults being used on the instance
/// </summary>
/// <remarks>Introduced in v0.6.0</remarks>
- public IEnumerable<LayoutMode> MangaReaderLayoutModes { get; set; }
+ public required IEnumerable<LayoutMode> MangaReaderLayoutModes { get; set; }
/// <summary>
/// A list of file formats existing in the instance
/// </summary>
/// <remarks>Introduced in v0.6.0</remarks>
- public IEnumerable<FileFormatDto> FileFormats { get; set; }
+ public required IEnumerable<FileFormatDto> FileFormats { get; set; }
/// <summary>
/// If there is at least one user that is using an age restricted profile on the instance
/// </summary>
diff --git a/API/DTOs/System/DirectoryDto.cs b/API/DTOs/System/DirectoryDto.cs
index 7f254c649..e6e94f4e4 100644
--- a/API/DTOs/System/DirectoryDto.cs
+++ b/API/DTOs/System/DirectoryDto.cs
@@ -5,9 +5,9 @@ public class DirectoryDto
/// <summary>
/// Name of the directory
/// </summary>
- public string Name { get; set; }
+ public string Name { get; set; } = default!;
/// <summary>
/// Full Directory Path
/// </summary>
- public string FullPath { get; set; }
+ public string FullPath { get; set; } = default!;
}
diff --git a/API/DTOs/Theme/SiteThemeDto.cs b/API/DTOs/Theme/SiteThemeDto.cs
index 6e3650e21..b3d7659ea 100644
--- a/API/DTOs/Theme/SiteThemeDto.cs
+++ b/API/DTOs/Theme/SiteThemeDto.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using API.Entities.Enums.Theme;
using API.Entities.Interfaces;
using API.Services;
@@ -14,12 +14,16 @@ public class SiteThemeDto : IEntityDate
/// <summary>
/// Name of the Theme
/// </summary>
- public string Name { get; set; }
+ public required string Name { get; set; }
+ /// <summary>
+ /// Normalized name for lookups
+ /// </summary>
+ public required string NormalizedName { get; set; }
/// <summary>
/// File path to the content. Stored under <see cref="DirectoryService.SiteThemeDirectory"/>.
/// Must be a .css file
/// </summary>
- public string FileName { get; set; }
+ public required string FileName { get; set; }
/// <summary>
/// Only one theme can have this. Will auto-set this as default for new user accounts
/// </summary>
diff --git a/API/DTOs/Update/UpdateNotificationDto.cs b/API/DTOs/Update/UpdateNotificationDto.cs
index 030227a45..95719bb27 100644
--- a/API/DTOs/Update/UpdateNotificationDto.cs
+++ b/API/DTOs/Update/UpdateNotificationDto.cs
@@ -8,24 +8,24 @@ public class UpdateNotificationDto
/// <summary>
/// Current installed Version
/// </summary>
- public string CurrentVersion { get; init; }
+ public required string CurrentVersion { get; init; }
/// <summary>
/// Semver of the release version
/// <example>0.4.3</example>
/// </summary>
- public string UpdateVersion { get; init; }
+ public required string UpdateVersion { get; init; }
/// <summary>
/// Release body in HTML
/// </summary>
- public string UpdateBody { get; init; }
+ public required string UpdateBody { get; init; }
/// <summary>
/// Title of the release
/// </summary>
- public string UpdateTitle { get; init; }
+ public required string UpdateTitle { get; init; }
/// <summary>
/// Github Url
/// </summary>
- public string UpdateUrl { get; init; }
+ public required string UpdateUrl { get; init; }
/// <summary>
/// If this install is within Docker
/// </summary>
@@ -37,5 +37,5 @@ public class UpdateNotificationDto
/// <summary>
/// Date of the publish
/// </summary>
- public string PublishDate { get; init; }
+ public required string PublishDate { get; init; }
}
diff --git a/API/DTOs/UpdateLibraryDto.cs b/API/DTOs/UpdateLibraryDto.cs
index 977616497..46403ed81 100644
--- a/API/DTOs/UpdateLibraryDto.cs
+++ b/API/DTOs/UpdateLibraryDto.cs
@@ -9,11 +9,11 @@ public class UpdateLibraryDto
[Required]
public int Id { get; init; }
[Required]
- public string Name { get; init; }
+ public required string Name { get; init; }
[Required]
public LibraryType Type { get; set; }
[Required]
- public IEnumerable<string> Folders { get; init; }
+ public required IEnumerable<string> Folders { get; init; }
[Required]
public bool FolderWatching { get; init; }
[Required]
@@ -24,5 +24,6 @@ public class UpdateLibraryDto
public bool IncludeInSearch { get; init; }
[Required]
public bool ManageCollections { get; init; }
-
+ [Required]
+ public bool ManageReadingLists { get; init; }
}
diff --git a/API/DTOs/UpdateLibraryForUserDto.cs b/API/DTOs/UpdateLibraryForUserDto.cs
index b2c752b22..c90b697e2 100644
--- a/API/DTOs/UpdateLibraryForUserDto.cs
+++ b/API/DTOs/UpdateLibraryForUserDto.cs
@@ -4,6 +4,6 @@ namespace API.DTOs;
public class UpdateLibraryForUserDto
{
- public string Username { get; init; }
- public IEnumerable<LibraryDto> SelectedLibraries { get; init; }
+ public required string Username { get; init; }
+ public required IEnumerable<LibraryDto> SelectedLibraries { get; init; } = new List<LibraryDto>();
}
diff --git a/API/DTOs/UpdateRBSDto.cs b/API/DTOs/UpdateRBSDto.cs
index f23edf784..6fdce251c 100644
--- a/API/DTOs/UpdateRBSDto.cs
+++ b/API/DTOs/UpdateRBSDto.cs
@@ -4,6 +4,6 @@ namespace API.DTOs;
public class UpdateRbsDto
{
- public string Username { get; init; }
- public IList<string> Roles { get; init; }
+ public required string Username { get; init; }
+ public IList<string>? Roles { get; init; }
}
diff --git a/API/DTOs/UpdateSeriesDto.cs b/API/DTOs/UpdateSeriesDto.cs
index c5db42e78..a31152965 100644
--- a/API/DTOs/UpdateSeriesDto.cs
+++ b/API/DTOs/UpdateSeriesDto.cs
@@ -3,9 +3,9 @@
public class UpdateSeriesDto
{
public int Id { get; init; }
- public string Name { get; init; }
- public string LocalizedName { get; init; }
- public string SortName { get; init; }
+ public required string Name { get; init; }
+ public string? LocalizedName { get; init; }
+ public string? SortName { get; init; }
public bool CoverImageLocked { get; set; }
public bool NameLocked { get; set; }
diff --git a/API/DTOs/UpdateSeriesMetadataDto.cs b/API/DTOs/UpdateSeriesMetadataDto.cs
index f2724b628..cdd6c7502 100644
--- a/API/DTOs/UpdateSeriesMetadataDto.cs
+++ b/API/DTOs/UpdateSeriesMetadataDto.cs
@@ -5,6 +5,6 @@ namespace API.DTOs;
public class UpdateSeriesMetadataDto
{
- public SeriesMetadataDto SeriesMetadata { get; set; }
- public ICollection<CollectionTagDto> CollectionTags { get; set; }
+ public SeriesMetadataDto SeriesMetadata { get; set; } = default!;
+ public ICollection<CollectionTagDto> CollectionTags { get; set; } = default!;
}
diff --git a/API/DTOs/UpdateSeriesRatingDto.cs b/API/DTOs/UpdateSeriesRatingDto.cs
index 167d321bb..0b50aac78 100644
--- a/API/DTOs/UpdateSeriesRatingDto.cs
+++ b/API/DTOs/UpdateSeriesRatingDto.cs
@@ -7,5 +7,5 @@ public class UpdateSeriesRatingDto
public int SeriesId { get; init; }
public int UserRating { get; init; }
[MaxLength(1000)]
- public string UserReview { get; init; }
+ public string? UserReview { get; init; }
}
diff --git a/API/DTOs/Uploads/UploadFileDto.cs b/API/DTOs/Uploads/UploadFileDto.cs
index 374f43b23..236a554b8 100644
--- a/API/DTOs/Uploads/UploadFileDto.cs
+++ b/API/DTOs/Uploads/UploadFileDto.cs
@@ -5,9 +5,9 @@ public class UploadFileDto
/// <summary>
/// Id of the Entity
/// </summary>
- public int Id { get; set; }
+ public required int Id { get; set; }
/// <summary>
/// Base Url encoding of the file to upload from (can be null)
/// </summary>
- public string Url { get; set; }
+ public required string Url { get; set; }
}
diff --git a/API/DTOs/Uploads/UploadUrlDto.cs b/API/DTOs/Uploads/UploadUrlDto.cs
index cd44b78a2..f2699befd 100644
--- a/API/DTOs/Uploads/UploadUrlDto.cs
+++ b/API/DTOs/Uploads/UploadUrlDto.cs
@@ -1,9 +1,12 @@
-namespace API.DTOs.Uploads;
+using System.ComponentModel.DataAnnotations;
+
+namespace API.DTOs.Uploads;
public class UploadUrlDto
{
/// <summary>
/// External url
/// </summary>
- public string Url { get; set; }
+ [Required]
+ public required string Url { get; set; }
}
diff --git a/API/DTOs/UserDto.cs b/API/DTOs/UserDto.cs
index 1e9cba267..f63a021f1 100644
--- a/API/DTOs/UserDto.cs
+++ b/API/DTOs/UserDto.cs
@@ -1,16 +1,16 @@

using API.DTOs.Account;
-using API.Entities.Enums;
namespace API.DTOs;
public class UserDto
{
- public string Username { get; init; }
- public string Email { get; init; }
- public string Token { get; set; }
- public string RefreshToken { get; set; }
- public string ApiKey { get; init; }
- public UserPreferencesDto Preferences { get; set; }
- public AgeRestrictionDto AgeRestriction { get; init; }
+ public string Username { get; init; } = null!;
+ public string Email { get; init; } = null!;
+ public string Token { get; set; } = null!;
+ public string? RefreshToken { get; set; }
+ public string? ApiKey { get; init; }
+ public UserPreferencesDto? Preferences { get; set; }
+ public AgeRestrictionDto? AgeRestriction { get; init; }
+ public string KavitaVersion { get; set; }
}
diff --git a/API/DTOs/UserPreferencesDto.cs b/API/DTOs/UserPreferencesDto.cs
index b756534cb..cb738aa42 100644
--- a/API/DTOs/UserPreferencesDto.cs
+++ b/API/DTOs/UserPreferencesDto.cs
@@ -46,10 +46,10 @@ public class UserPreferencesDto
/// </summary>
[Required]
public string BackgroundColor { get; set; } = "#000000";
- [Required]
/// <summary>
/// Manga Reader Option: Should swiping trigger pagination
/// </summary>
+ [Required]
public bool SwipeToPaginate { get; set; }
/// <summary>
/// Manga Reader Option: Allow the menu to close after 6 seconds without interaction
@@ -80,7 +80,8 @@ public class UserPreferencesDto
/// Book Reader Option: Maps to the default Kavita font-family (inherit) or an override
/// </summary>
[Required]
- public string BookReaderFontFamily { get; set; }
+ public string BookReaderFontFamily { get; set; } = null!;
+
/// <summary>
/// Book Reader Option: Allows tapping on side of screens to paginate
/// </summary>
@@ -92,13 +93,20 @@ public class UserPreferencesDto
[Required]
public ReadingDirection BookReaderReadingDirection { get; set; }
+ /// <summary>
+ /// Book Reader Option: What writing style should be used, horizontal or vertical.
+ /// </summary>
+ [Required]
+ public WritingStyle BookReaderWritingStyle { get; set; }
+
/// <summary>
/// UI Site Global Setting: The UI theme the user should use.
/// </summary>
/// <remarks>Should default to Dark</remarks>
- public SiteTheme Theme { get; set; }
[Required]
- public string BookReaderThemeName { get; set; }
+ public SiteTheme? Theme { get; set; }
+
+ [Required] public string BookReaderThemeName { get; set; } = null!;
[Required]
public BookPageLayoutMode BookReaderLayoutMode { get; set; }
/// <summary>
@@ -129,4 +137,9 @@ public class UserPreferencesDto
/// </summary>
[Required]
public bool NoTransitions { get; set; } = false;
+ /// <summary>
+ /// When showing series, only parent series or series with no relationships will be returned
+ /// </summary>
+ [Required]
+ public bool CollapseSeriesRelationships { get; set; } = false;
}
diff --git a/API/DTOs/VolumeDto.cs b/API/DTOs/VolumeDto.cs
index 4ef20950a..8d5e615ee 100644
--- a/API/DTOs/VolumeDto.cs
+++ b/API/DTOs/VolumeDto.cs
@@ -11,14 +11,15 @@ public class VolumeDto : IHasReadTimeEstimate
public int Id { get; set; }
/// <inheritdoc cref="Volume.Number"/>
public int Number { get; set; }
+
/// <inheritdoc cref="Volume.Name"/>
- public string Name { get; set; }
+ public string Name { get; set; } = default!;
public int Pages { get; set; }
public int PagesRead { get; set; }
public DateTime LastModified { get; set; }
public DateTime Created { get; set; }
public int SeriesId { get; set; }
- public ICollection<ChapterDto> Chapters { get; set; }
+ public ICollection<ChapterDto> Chapters { get; set; } = new List<ChapterDto>();
/// <inheritdoc cref="IHasReadTimeEstimate.MinHoursToRead"/>
public int MinHoursToRead { get; set; }
/// <inheritdoc cref="IHasReadTimeEstimate.MaxHoursToRead"/>
diff --git a/API/DTOs/WantToRead/UpdateWantToReadDto.cs b/API/DTOs/WantToRead/UpdateWantToReadDto.cs
index 14a1a4710..f1b38cea2 100644
--- a/API/DTOs/WantToRead/UpdateWantToReadDto.cs
+++ b/API/DTOs/WantToRead/UpdateWantToReadDto.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
namespace API.DTOs.WantToRead;
@@ -10,5 +11,5 @@ public class UpdateWantToReadDto
/// <summary>
/// List of Series Ids that will be Added/Removed
/// </summary>
- public IList<int> SeriesIds { get; set; }
+ public IList<int> SeriesIds { get; set; } = ArraySegment<int>.Empty;
}
diff --git a/API/Data/DataContext.cs b/API/Data/DataContext.cs
index 9a6af8b3e..c1824d2b6 100644
--- a/API/Data/DataContext.cs
+++ b/API/Data/DataContext.cs
@@ -3,6 +3,7 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using API.Entities;
+using API.Entities.Enums;
using API.Entities.Enums.UserPreferences;
using API.Entities.Interfaces;
using API.Entities.Metadata;
@@ -23,29 +24,29 @@ public sealed class DataContext : IdentityDbContext<AppUser, AppRole, int,
ChangeTracker.StateChanged += OnEntityStateChanged;
}
- public DbSet<Library> Library { get; set; }
- public DbSet<Series> Series { get; set; }
- public DbSet<Chapter> Chapter { get; set; }
- public DbSet<Volume> Volume { get; set; }
- public DbSet<AppUser> AppUser { get; set; }
- public DbSet<MangaFile> MangaFile { get; set; }
- public DbSet<AppUserProgress> AppUserProgresses { get; set; }
- public DbSet<AppUserRating> AppUserRating { get; set; }
- public DbSet<ServerSetting> ServerSetting { get; set; }
- public DbSet<AppUserPreferences> AppUserPreferences { get; set; }
- public DbSet<SeriesMetadata> SeriesMetadata { get; set; }
- public DbSet<CollectionTag> CollectionTag { get; set; }
- public DbSet<AppUserBookmark> AppUserBookmark { get; set; }
- public DbSet<ReadingList> ReadingList { get; set; }
- public DbSet<ReadingListItem> ReadingListItem { get; set; }
- public DbSet<Person> Person { get; set; }
- public DbSet<Genre> Genre { get; set; }
- public DbSet<Tag> Tag { get; set; }
- public DbSet<SiteTheme> SiteTheme { get; set; }
- public DbSet<SeriesRelation> SeriesRelation { get; set; }
- public DbSet<FolderPath> FolderPath { get; set; }
- public DbSet<Device> Device { get; set; }
- public DbSet<ServerStatistics> ServerStatistics { get; set; }
+ public DbSet<Library> Library { get; set; } = null!;
+ public DbSet<Series> Series { get; set; } = null!;
+ public DbSet<Chapter> Chapter { get; set; } = null!;
+ public DbSet<Volume> Volume { get; set; } = null!;
+ public DbSet<AppUser> AppUser { get; set; } = null!;
+ public DbSet<MangaFile> MangaFile { get; set; } = null!;
+ public DbSet<AppUserProgress> AppUserProgresses { get; set; } = null!;
+ public DbSet<AppUserRating> AppUserRating { get; set; } = null!;
+ public DbSet<ServerSetting> ServerSetting { get; set; } = null!;
+ public DbSet<AppUserPreferences> AppUserPreferences { get; set; } = null!;
+ public DbSet<SeriesMetadata> SeriesMetadata { get; set; } = null!;
+ public DbSet<CollectionTag> CollectionTag { get; set; } = null!;
+ public DbSet<AppUserBookmark> AppUserBookmark { get; set; } = null!;
+ public DbSet<ReadingList> ReadingList { get; set; } = null!;
+ public DbSet<ReadingListItem> ReadingListItem { get; set; } = null!;
+ public DbSet<Person> Person { get; set; } = null!;
+ public DbSet<Genre> Genre { get; set; } = null!;
+ public DbSet<Tag> Tag { get; set; } = null!;
+ public DbSet<SiteTheme> SiteTheme { get; set; } = null!;
+ public DbSet<SeriesRelation> SeriesRelation { get; set; } = null!;
+ public DbSet<FolderPath> FolderPath { get; set; } = null!;
+ public DbSet<Device> Device { get; set; } = null!;
+ public DbSet<ServerStatistics> ServerStatistics { get; set; } = null!;
protected override void OnModelCreating(ModelBuilder builder)
@@ -86,10 +87,12 @@ public sealed class DataContext : IdentityDbContext<AppUser, AppRole, int,
builder.Entity<AppUserPreferences>()
.Property(b => b.BackgroundColor)
.HasDefaultValue("#000000");
-
builder.Entity<AppUserPreferences>()
.Property(b => b.GlobalPageLayoutMode)
.HasDefaultValue(PageLayoutMode.Cards);
+ builder.Entity<AppUserPreferences>()
+ .Property(b => b.BookReaderWritingStyle)
+ .HasDefaultValue(WritingStyle.Horizontal);
builder.Entity<Library>()
@@ -107,10 +110,13 @@ public sealed class DataContext : IdentityDbContext<AppUser, AppRole, int,
builder.Entity<Library>()
.Property(b => b.ManageCollections)
.HasDefaultValue(true);
+ builder.Entity<Library>()
+ .Property(b => b.ManageReadingLists)
+ .HasDefaultValue(true);
}
- private static void OnEntityTracked(object sender, EntityTrackedEventArgs e)
+ private static void OnEntityTracked(object? sender, EntityTrackedEventArgs e)
{
if (e.FromQuery || e.Entry.State != EntityState.Added || e.Entry.Entity is not IEntityDate entity) return;
@@ -120,7 +126,7 @@ public sealed class DataContext : IdentityDbContext<AppUser, AppRole, int,
entity.LastModifiedUtc = DateTime.UtcNow;
}
- private static void OnEntityStateChanged(object sender, EntityStateChangedEventArgs e)
+ private static void OnEntityStateChanged(object? sender, EntityStateChangedEventArgs e)
{
if (e.NewState != EntityState.Modified || e.Entry.Entity is not IEntityDate entity) return;
entity.LastModified = DateTime.Now;
@@ -142,28 +148,28 @@ public sealed class DataContext : IdentityDbContext<AppUser, AppRole, int,
public override int SaveChanges()
{
- this.OnSaveChanges();
+ OnSaveChanges();
return base.SaveChanges();
}
public override int SaveChanges(bool acceptAllChangesOnSuccess)
{
- this.OnSaveChanges();
+ OnSaveChanges();
return base.SaveChanges(acceptAllChangesOnSuccess);
}
public override Task<int> SaveChangesAsync(bool acceptAllChangesOnSuccess, CancellationToken cancellationToken = default(CancellationToken))
{
- this.OnSaveChanges();
+ OnSaveChanges();
return base.SaveChangesAsync(acceptAllChangesOnSuccess, cancellationToken);
}
public override Task<int> SaveChangesAsync(CancellationToken cancellationToken = default(CancellationToken))
{
- this.OnSaveChanges();
+ OnSaveChanges();
return base.SaveChangesAsync(cancellationToken);
}
diff --git a/API/Data/DbFactory.cs b/API/Data/DbFactory.cs
deleted file mode 100644
index 11304d05c..000000000
--- a/API/Data/DbFactory.cs
+++ /dev/null
@@ -1,172 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using API.Data.Metadata;
-using API.Entities;
-using API.Entities.Enums;
-using API.Entities.Metadata;
-using API.Extensions;
-using API.Parser;
-using API.Services.Tasks;
-
-namespace API.Data;
-
-/// <summary>
-/// Responsible for creating Series, Volume, Chapter, MangaFiles for use in <see cref="ScannerService"/>
-/// </summary>
-public static class DbFactory
-{
- public static Series Series(string name)
- {
- return new Series
- {
- Name = name,
- OriginalName = name,
- LocalizedName = name,
- NormalizedName = Services.Tasks.Scanner.Parser.Parser.Normalize(name),
- NormalizedLocalizedName = Services.Tasks.Scanner.Parser.Parser.Normalize(name),
- SortName = name,
- Volumes = new List<Volume>(),
- Metadata = SeriesMetadata(new List<CollectionTag>())
- };
- }
-
- public static Series Series(string name, string localizedName)
- {
- if (string.IsNullOrEmpty(localizedName))
- {
- localizedName = name;
- }
- return new Series
- {
- Name = name,
- OriginalName = name,
- LocalizedName = localizedName,
- NormalizedName = Services.Tasks.Scanner.Parser.Parser.Normalize(name),
- NormalizedLocalizedName = Services.Tasks.Scanner.Parser.Parser.Normalize(localizedName),
- SortName = name,
- Volumes = new List<Volume>(),
- Metadata = SeriesMetadata(new List<CollectionTag>())
- };
- }
-
- public static Volume Volume(string volumeNumber)
- {
- return new Volume()
- {
- Name = volumeNumber,
- Number = (int) Services.Tasks.Scanner.Parser.Parser.MinNumberFromRange(volumeNumber),
- Chapters = new List<Chapter>()
- };
- }
-
- public static Chapter Chapter(ParserInfo info)
- {
- var specialTreatment = info.IsSpecialInfo();
- var specialTitle = specialTreatment ? info.Filename : info.Chapters;
- return new Chapter()
- {
- Number = specialTreatment ? "0" : Services.Tasks.Scanner.Parser.Parser.MinNumberFromRange(info.Chapters) + string.Empty,
- Range = specialTreatment ? info.Filename : info.Chapters,
- Title = (specialTreatment && info.Format == MangaFormat.Epub)
- ? info.Title
- : specialTitle,
- Files = new List<MangaFile>(),
- IsSpecial = specialTreatment,
- };
- }
-
- public static SeriesMetadata SeriesMetadata(ICollection<CollectionTag> collectionTags)
- {
- return new SeriesMetadata()
- {
- CollectionTags = collectionTags,
- Summary = string.Empty
- };
- }
-
- public static CollectionTag CollectionTag(int id, string title, string summary, bool promoted)
- {
- return new CollectionTag()
- {
- Id = id,
- NormalizedTitle = Services.Tasks.Scanner.Parser.Parser.Normalize(title?.Trim()),
- Title = title?.Trim(),
- Summary = summary?.Trim(),
- Promoted = promoted,
- SeriesMetadatas = new List<SeriesMetadata>()
- };
- }
-
- public static ReadingList ReadingList(string title, string summary, bool promoted)
- {
- return new ReadingList()
- {
- NormalizedTitle = Services.Tasks.Scanner.Parser.Parser.Normalize(title?.Trim()),
- Title = title?.Trim(),
- Summary = summary?.Trim(),
- Promoted = promoted,
- Items = new List<ReadingListItem>()
- };
- }
-
- public static ReadingListItem ReadingListItem(int index, int seriesId, int volumeId, int chapterId)
- {
- return new ReadingListItem()
- {
- Order = index,
- ChapterId = chapterId,
- SeriesId = seriesId,
- VolumeId = volumeId
- };
- }
-
- public static Genre Genre(string name)
- {
- return new Genre()
- {
- Title = name.Trim().SentenceCase(),
- NormalizedTitle = Services.Tasks.Scanner.Parser.Parser.Normalize(name),
- };
- }
-
- public static Tag Tag(string name)
- {
- return new Tag()
- {
- Title = name.Trim().SentenceCase(),
- NormalizedTitle = Services.Tasks.Scanner.Parser.Parser.Normalize(name),
- };
- }
-
- public static Person Person(string name, PersonRole role)
- {
- return new Person()
- {
- Name = name.Trim(),
- NormalizedName = Services.Tasks.Scanner.Parser.Parser.Normalize(name),
- Role = role
- };
- }
-
- public static MangaFile MangaFile(string filePath, MangaFormat format, int pages)
- {
- return new MangaFile()
- {
- FilePath = filePath,
- Format = format,
- Pages = pages,
- LastModified = File.GetLastWriteTime(filePath),
- LastModifiedUtc = File.GetLastWriteTimeUtc(filePath),
- };
- }
-
- public static Device Device(string name)
- {
- return new Device()
- {
- Name = name,
- };
- }
-
-}
diff --git a/API/Data/Metadata/ComicInfo.cs b/API/Data/Metadata/ComicInfo.cs
index 1907878cb..9e29ca637 100644
--- a/API/Data/Metadata/ComicInfo.cs
+++ b/API/Data/Metadata/ComicInfo.cs
@@ -61,7 +61,7 @@ public class ComicInfo
public string SeriesGroup { get; set; } = string.Empty;
/// <summary>
- ///
+ /// Can contain multiple comma separated numbers that match with StoryArcNumber
/// </summary>
public string StoryArc { get; set; } = string.Empty;
/// <summary>
@@ -119,7 +119,7 @@ public class ComicInfo
.SingleOrDefault(t => t.ToDescription().ToUpperInvariant().Equals(value.ToUpperInvariant()), Entities.Enums.AgeRating.Unknown);
}
- public static void CleanComicInfo(ComicInfo info)
+ public static void CleanComicInfo(ComicInfo? info)
{
if (info == null) return;
@@ -154,7 +154,7 @@ public class ComicInfo
return Math.Max(Count, (int) Math.Floor(float.Parse(Volume)));
}
- return Count;
+ return 0;
}
diff --git a/API/Data/MigrateBrokenGMT1Dates.cs b/API/Data/MigrateBrokenGMT1Dates.cs
index 2427874d6..20939b1ef 100644
--- a/API/Data/MigrateBrokenGMT1Dates.cs
+++ b/API/Data/MigrateBrokenGMT1Dates.cs
@@ -9,6 +9,7 @@ namespace API.Data;
/// v0.7 introduced UTC dates and GMT+1 users would sometimes have dates stored as '0000-12-31 23:00:00'.
/// This Migration will update those dates.
/// </summary>
+// ReSharper disable once InconsistentNaming
public static class MigrateBrokenGMT1Dates
{
public static async Task Migrate(IUnitOfWork unitOfWork, DataContext dataContext, ILogger<Program> logger)
diff --git a/API/Data/MigrateLoginRole.cs b/API/Data/MigrateLoginRole.cs
new file mode 100644
index 000000000..93f839589
--- /dev/null
+++ b/API/Data/MigrateLoginRole.cs
@@ -0,0 +1,36 @@
+using System.Threading.Tasks;
+using API.Constants;
+using API.Entities;
+using Microsoft.AspNetCore.Identity;
+using Microsoft.Extensions.Logging;
+
+namespace API.Data;
+
+/// <summary>
+/// Added in v0.7.1.18
+/// </summary>
+public static class MigrateLoginRoles
+{
+ /// <summary>
+ /// Will not run if any users have the <see cref="PolicyConstants.LoginRole"/> role already
+ /// </summary>
+ /// <param name="unitOfWork"></param>
+ /// <param name="userManager"></param>
+ /// <param name="logger"></param>
+ public static async Task Migrate(IUnitOfWork unitOfWork, UserManager<AppUser> userManager, ILogger<Program> logger)
+ {
+ var usersWithRole = await userManager.GetUsersInRoleAsync(PolicyConstants.LoginRole);
+ if (usersWithRole.Count != 0) return;
+
+ logger.LogCritical("Running MigrateLoginRoles migration");
+
+ var allUsers = await unitOfWork.UserRepository.GetAllUsersAsync();
+ foreach (var user in allUsers)
+ {
+ await userManager.RemoveFromRoleAsync(user, PolicyConstants.LoginRole);
+ await userManager.AddToRoleAsync(user, PolicyConstants.LoginRole);
+ }
+
+ logger.LogInformation("MigrateLoginRoles migration complete");
+ }
+}
diff --git a/API/Data/MigrateNormalizedEverything.cs b/API/Data/MigrateNormalizedEverything.cs
index 675620225..69a3e2728 100644
--- a/API/Data/MigrateNormalizedEverything.cs
+++ b/API/Data/MigrateNormalizedEverything.cs
@@ -1,7 +1,5 @@
using System;
-using System.Linq;
using System.Threading.Tasks;
-using Kavita.Common.EnvironmentInfo;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
diff --git a/API/Data/MigrateReadingListAgeRating.cs b/API/Data/MigrateReadingListAgeRating.cs
index cc1ddfc3d..b057d702b 100644
--- a/API/Data/MigrateReadingListAgeRating.cs
+++ b/API/Data/MigrateReadingListAgeRating.cs
@@ -1,10 +1,8 @@
using System;
using System.Threading.Tasks;
-using API.Constants;
using API.Services;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
-using SQLitePCL;
namespace API.Data;
diff --git a/API/Data/MigrateSeriesRelationsExport.cs b/API/Data/MigrateSeriesRelationsExport.cs
index 874769708..f31688641 100644
--- a/API/Data/MigrateSeriesRelationsExport.cs
+++ b/API/Data/MigrateSeriesRelationsExport.cs
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
-using System.Text;
using System.Threading.Tasks;
using API.Entities.Enums;
using CsvHelper;
@@ -15,9 +14,9 @@ namespace API.Data;
internal sealed class SeriesRelationMigrationOutput
{
- public string SeriesName { get; set; }
+ public required string SeriesName { get; set; }
public int SeriesId { get; set; }
- public string TargetSeriesName { get; set; }
+ public required string TargetSeriesName { get; set; }
public int TargetId { get; set; }
public RelationKind Relationship { get; set; }
}
diff --git a/API/Data/MigrateSeriesRelationsImport.cs b/API/Data/MigrateSeriesRelationsImport.cs
index dc4938d8a..8035e8c4b 100644
--- a/API/Data/MigrateSeriesRelationsImport.cs
+++ b/API/Data/MigrateSeriesRelationsImport.cs
@@ -2,9 +2,7 @@
using System.Globalization;
using System.IO;
using System.Linq;
-using System.Text;
using System.Threading.Tasks;
-using API.Entities.Enums;
using API.Entities.Metadata;
using CsvHelper;
using Microsoft.EntityFrameworkCore;
diff --git a/API/Data/MigrateUserProgressLibraryId.cs b/API/Data/MigrateUserProgressLibraryId.cs
index 8b4d84f3f..78e9933da 100644
--- a/API/Data/MigrateUserProgressLibraryId.cs
+++ b/API/Data/MigrateUserProgressLibraryId.cs
@@ -1,13 +1,4 @@
-using System.Collections.Generic;
-using System.Globalization;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using API.Entities.Enums;
-using API.Entities.Metadata;
-using CsvHelper;
-using Microsoft.EntityFrameworkCore;
+using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
namespace API.Data;
diff --git a/API/Data/Migrations/20230220203128_CollapseSeriesRelationships.Designer.cs b/API/Data/Migrations/20230220203128_CollapseSeriesRelationships.Designer.cs
new file mode 100644
index 000000000..521ac509f
--- /dev/null
+++ b/API/Data/Migrations/20230220203128_CollapseSeriesRelationships.Designer.cs
@@ -0,0 +1,1854 @@
+// <auto-generated />
+using System;
+using API.Data;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace API.Data.Migrations
+{
+ [DbContext(typeof(DataContext))]
+ [Migration("20230220203128_CollapseSeriesRelationships")]
+ partial class CollapseSeriesRelationships
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder.HasAnnotation("ProductVersion", "6.0.10");
+
+ modelBuilder.Entity("API.Entities.AppRole", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedName")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedName")
+ .IsUnique()
+ .HasDatabaseName("RoleNameIndex");
+
+ b.ToTable("AspNetRoles", (string)null);
+ });
+
+ modelBuilder.Entity("API.Entities.AppUser", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AccessFailedCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AgeRestriction")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("AgeRestrictionIncludeUnknowns")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("ApiKey")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ConfirmationToken")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Email")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("EmailConfirmed")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastActive")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastActiveUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("LockoutEnabled")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTimeOffset?>("LockoutEnd")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedEmail")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedUserName")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property<string>("PasswordHash")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("PhoneNumber")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("PhoneNumberConfirmed")
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .IsConcurrencyToken()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("SecurityStamp")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("TwoFactorEnabled")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("UserName")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedEmail")
+ .HasDatabaseName("EmailIndex");
+
+ b.HasIndex("NormalizedUserName")
+ .IsUnique()
+ .HasDatabaseName("UserNameIndex");
+
+ b.ToTable("AspNetUsers", (string)null);
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserBookmark", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ChapterId")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("FileName")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Page")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("VolumeId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.ToTable("AppUserBookmark");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserPreferences", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("AutoCloseMenu")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("BackgroundColor")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("TEXT")
+ .HasDefaultValue("#000000");
+
+ b.Property<bool>("BlurUnreadSummaries")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("BookReaderFontFamily")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("BookReaderFontSize")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("BookReaderImmersiveMode")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("BookReaderLayoutMode")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("BookReaderLineSpacing")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("BookReaderMargin")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("BookReaderReadingDirection")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("BookReaderTapToPaginate")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("BookThemeName")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("TEXT")
+ .HasDefaultValue("Dark");
+
+ b.Property<bool>("EmulateBook")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("GlobalPageLayoutMode")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(0);
+
+ b.Property<int>("LayoutMode")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("NoTransitions")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("PageSplitOption")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("PromptForDownloadSize")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ReaderMode")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ReadingDirection")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ScalingOption")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("ShowScreenHints")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("SwipeToPaginate")
+ .HasColumnType("INTEGER");
+
+ b.Property<int?>("ThemeId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId")
+ .IsUnique();
+
+ b.HasIndex("ThemeId");
+
+ b.ToTable("AppUserPreferences");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserProgress", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("BookScrollId")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("ChapterId")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("LibraryId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("PagesRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("VolumeId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.HasIndex("ChapterId");
+
+ b.HasIndex("SeriesId");
+
+ b.ToTable("AppUserProgresses");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserRating", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Rating")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Review")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.HasIndex("SeriesId");
+
+ b.ToTable("AppUserRating");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserRole", b =>
+ {
+ b.Property<int>("UserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("RoleId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("UserId", "RoleId");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("AspNetUserRoles", (string)null);
+ });
+
+ modelBuilder.Entity("API.Entities.Chapter", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AgeRating")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AlternateCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("AlternateNumber")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("AlternateSeries")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("AvgHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Count")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("CoverImage")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("CoverImageLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("IsSpecial")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Language")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("MaxHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("MinHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Number")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Pages")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Range")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("ReleaseDate")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("SeriesGroup")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("StoryArc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("StoryArcNumber")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Summary")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("TitleName")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("TotalCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("VolumeId")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("WordCount")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("VolumeId");
+
+ b.ToTable("Chapter");
+ });
+
+ modelBuilder.Entity("API.Entities.CollectionTag", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("CoverImage")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("CoverImageLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("NormalizedTitle")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("Promoted")
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Summary")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("Id", "Promoted")
+ .IsUnique();
+
+ b.ToTable("CollectionTag");
+ });
+
+ modelBuilder.Entity("API.Entities.Device", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("EmailAddress")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("IpAddress")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastUsed")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastUsedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Platform")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.ToTable("Device");
+ });
+
+ modelBuilder.Entity("API.Entities.FolderPath", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastScanned")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("LibraryId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Path")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("LibraryId");
+
+ b.ToTable("FolderPath");
+ });
+
+ modelBuilder.Entity("API.Entities.Genre", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("NormalizedTitle")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedTitle")
+ .IsUnique();
+
+ b.ToTable("Genre");
+ });
+
+ modelBuilder.Entity("API.Entities.Library", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("CollapseSeriesRelationships")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("CoverImage")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("FolderWatching")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(true);
+
+ b.Property<bool>("IncludeInDashboard")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(true);
+
+ b.Property<bool>("IncludeInRecommended")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(true);
+
+ b.Property<bool>("IncludeInSearch")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(true);
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastScanned")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("ManageCollections")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(true);
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Type")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.ToTable("Library");
+ });
+
+ modelBuilder.Entity("API.Entities.MangaFile", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("Bytes")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ChapterId")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Extension")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("FilePath")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Format")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastFileAnalysis")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastFileAnalysisUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Pages")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ChapterId");
+
+ b.ToTable("MangaFile");
+ });
+
+ modelBuilder.Entity("API.Entities.Metadata.SeriesMetadata", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AgeRating")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("AgeRatingLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("CharacterLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("ColoristLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("CoverArtistLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("EditorLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("GenresLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("InkerLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Language")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("LanguageLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("LettererLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("MaxCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("PencillerLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("PublicationStatus")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("PublicationStatusLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("PublisherLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ReleaseYear")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("ReleaseYearLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .IsConcurrencyToken()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Summary")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("SummaryLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("TagsLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("TotalCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("TranslatorLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("WriterLocked")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("SeriesId")
+ .IsUnique();
+
+ b.HasIndex("Id", "SeriesId")
+ .IsUnique();
+
+ b.ToTable("SeriesMetadata");
+ });
+
+ modelBuilder.Entity("API.Entities.Metadata.SeriesRelation", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("RelationKind")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("TargetSeriesId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("SeriesId");
+
+ b.HasIndex("TargetSeriesId");
+
+ b.ToTable("SeriesRelation");
+ });
+
+ modelBuilder.Entity("API.Entities.Person", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedName")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Role")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.ToTable("Person");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingList", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AgeRating")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("CoverImage")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("CoverImageLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedTitle")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("Promoted")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Summary")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.ToTable("ReadingList");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingListItem", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ChapterId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Order")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ReadingListId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("VolumeId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ChapterId");
+
+ b.HasIndex("ReadingListId");
+
+ b.HasIndex("SeriesId");
+
+ b.HasIndex("VolumeId");
+
+ b.ToTable("ReadingListItem");
+ });
+
+ modelBuilder.Entity("API.Entities.Series", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int?>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AvgHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("CoverImage")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("CoverImageLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("FolderPath")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Format")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastChapterAdded")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastChapterAddedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastFolderScanned")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastFolderScannedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("LibraryId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("LocalizedName")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("LocalizedNameLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("MaxHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("MinHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("NameLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("NormalizedLocalizedName")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedName")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("OriginalName")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Pages")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("SortName")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("SortNameLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("WordCount")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.HasIndex("LibraryId");
+
+ b.ToTable("Series");
+ });
+
+ modelBuilder.Entity("API.Entities.ServerSetting", b =>
+ {
+ b.Property<int>("Key")
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .IsConcurrencyToken()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Value")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Key");
+
+ b.ToTable("ServerSetting");
+ });
+
+ modelBuilder.Entity("API.Entities.ServerStatistics", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("ChapterCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("FileCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("GenreCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("PersonCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("SeriesCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("TagCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("UserCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("VolumeCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Year")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.ToTable("ServerStatistics");
+ });
+
+ modelBuilder.Entity("API.Entities.SiteTheme", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("FileName")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("IsDefault")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedName")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Provider")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.ToTable("SiteTheme");
+ });
+
+ modelBuilder.Entity("API.Entities.Tag", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("NormalizedTitle")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedTitle")
+ .IsUnique();
+
+ b.ToTable("Tag");
+ });
+
+ modelBuilder.Entity("API.Entities.Volume", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AvgHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("CoverImage")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("MaxHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("MinHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Number")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Pages")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("WordCount")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("SeriesId");
+
+ b.ToTable("Volume");
+ });
+
+ modelBuilder.Entity("AppUserLibrary", b =>
+ {
+ b.Property<int>("AppUsersId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("LibrariesId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("AppUsersId", "LibrariesId");
+
+ b.HasIndex("LibrariesId");
+
+ b.ToTable("AppUserLibrary");
+ });
+
+ modelBuilder.Entity("ChapterGenre", b =>
+ {
+ b.Property<int>("ChaptersId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("GenresId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("ChaptersId", "GenresId");
+
+ b.HasIndex("GenresId");
+
+ b.ToTable("ChapterGenre");
+ });
+
+ modelBuilder.Entity("ChapterPerson", b =>
+ {
+ b.Property<int>("ChapterMetadatasId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("PeopleId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("ChapterMetadatasId", "PeopleId");
+
+ b.HasIndex("PeopleId");
+
+ b.ToTable("ChapterPerson");
+ });
+
+ modelBuilder.Entity("ChapterTag", b =>
+ {
+ b.Property<int>("ChaptersId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("TagsId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("ChaptersId", "TagsId");
+
+ b.HasIndex("TagsId");
+
+ b.ToTable("ChapterTag");
+ });
+
+ modelBuilder.Entity("CollectionTagSeriesMetadata", b =>
+ {
+ b.Property<int>("CollectionTagsId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesMetadatasId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("CollectionTagsId", "SeriesMetadatasId");
+
+ b.HasIndex("SeriesMetadatasId");
+
+ b.ToTable("CollectionTagSeriesMetadata");
+ });
+
+ modelBuilder.Entity("GenreSeriesMetadata", b =>
+ {
+ b.Property<int>("GenresId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesMetadatasId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("GenresId", "SeriesMetadatasId");
+
+ b.HasIndex("SeriesMetadatasId");
+
+ b.ToTable("GenreSeriesMetadata");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("ClaimType")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ClaimValue")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("RoleId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("AspNetRoleClaims", (string)null);
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("ClaimType")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ClaimValue")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("UserId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AspNetUserClaims", (string)null);
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
+ {
+ b.Property<string>("LoginProvider")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ProviderKey")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ProviderDisplayName")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("UserId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("LoginProvider", "ProviderKey");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AspNetUserLogins", (string)null);
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<int>", b =>
+ {
+ b.Property<int>("UserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("LoginProvider")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Value")
+ .HasColumnType("TEXT");
+
+ b.HasKey("UserId", "LoginProvider", "Name");
+
+ b.ToTable("AspNetUserTokens", (string)null);
+ });
+
+ modelBuilder.Entity("PersonSeriesMetadata", b =>
+ {
+ b.Property<int>("PeopleId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesMetadatasId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("PeopleId", "SeriesMetadatasId");
+
+ b.HasIndex("SeriesMetadatasId");
+
+ b.ToTable("PersonSeriesMetadata");
+ });
+
+ modelBuilder.Entity("SeriesMetadataTag", b =>
+ {
+ b.Property<int>("SeriesMetadatasId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("TagsId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("SeriesMetadatasId", "TagsId");
+
+ b.HasIndex("TagsId");
+
+ b.ToTable("SeriesMetadataTag");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserBookmark", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("Bookmarks")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserPreferences", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithOne("UserPreferences")
+ .HasForeignKey("API.Entities.AppUserPreferences", "AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.SiteTheme", "Theme")
+ .WithMany()
+ .HasForeignKey("ThemeId");
+
+ b.Navigation("AppUser");
+
+ b.Navigation("Theme");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserProgress", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("Progresses")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Chapter", null)
+ .WithMany("UserProgress")
+ .HasForeignKey("ChapterId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Series", null)
+ .WithMany("Progress")
+ .HasForeignKey("SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserRating", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("Ratings")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Series", null)
+ .WithMany("Ratings")
+ .HasForeignKey("SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserRole", b =>
+ {
+ b.HasOne("API.Entities.AppRole", "Role")
+ .WithMany("UserRoles")
+ .HasForeignKey("RoleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.AppUser", "User")
+ .WithMany("UserRoles")
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Role");
+
+ b.Navigation("User");
+ });
+
+ modelBuilder.Entity("API.Entities.Chapter", b =>
+ {
+ b.HasOne("API.Entities.Volume", "Volume")
+ .WithMany("Chapters")
+ .HasForeignKey("VolumeId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Volume");
+ });
+
+ modelBuilder.Entity("API.Entities.Device", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("Devices")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.FolderPath", b =>
+ {
+ b.HasOne("API.Entities.Library", "Library")
+ .WithMany("Folders")
+ .HasForeignKey("LibraryId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Library");
+ });
+
+ modelBuilder.Entity("API.Entities.MangaFile", b =>
+ {
+ b.HasOne("API.Entities.Chapter", "Chapter")
+ .WithMany("Files")
+ .HasForeignKey("ChapterId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Chapter");
+ });
+
+ modelBuilder.Entity("API.Entities.Metadata.SeriesMetadata", b =>
+ {
+ b.HasOne("API.Entities.Series", "Series")
+ .WithOne("Metadata")
+ .HasForeignKey("API.Entities.Metadata.SeriesMetadata", "SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Series");
+ });
+
+ modelBuilder.Entity("API.Entities.Metadata.SeriesRelation", b =>
+ {
+ b.HasOne("API.Entities.Series", "Series")
+ .WithMany("Relations")
+ .HasForeignKey("SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Series", "TargetSeries")
+ .WithMany("RelationOf")
+ .HasForeignKey("TargetSeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Series");
+
+ b.Navigation("TargetSeries");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingList", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("ReadingLists")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingListItem", b =>
+ {
+ b.HasOne("API.Entities.Chapter", "Chapter")
+ .WithMany()
+ .HasForeignKey("ChapterId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.ReadingList", "ReadingList")
+ .WithMany("Items")
+ .HasForeignKey("ReadingListId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Series", "Series")
+ .WithMany()
+ .HasForeignKey("SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Volume", "Volume")
+ .WithMany()
+ .HasForeignKey("VolumeId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Chapter");
+
+ b.Navigation("ReadingList");
+
+ b.Navigation("Series");
+
+ b.Navigation("Volume");
+ });
+
+ modelBuilder.Entity("API.Entities.Series", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany("WantToRead")
+ .HasForeignKey("AppUserId");
+
+ b.HasOne("API.Entities.Library", "Library")
+ .WithMany("Series")
+ .HasForeignKey("LibraryId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Library");
+ });
+
+ modelBuilder.Entity("API.Entities.Volume", b =>
+ {
+ b.HasOne("API.Entities.Series", "Series")
+ .WithMany("Volumes")
+ .HasForeignKey("SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Series");
+ });
+
+ modelBuilder.Entity("AppUserLibrary", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany()
+ .HasForeignKey("AppUsersId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Library", null)
+ .WithMany()
+ .HasForeignKey("LibrariesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("ChapterGenre", b =>
+ {
+ b.HasOne("API.Entities.Chapter", null)
+ .WithMany()
+ .HasForeignKey("ChaptersId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Genre", null)
+ .WithMany()
+ .HasForeignKey("GenresId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("ChapterPerson", b =>
+ {
+ b.HasOne("API.Entities.Chapter", null)
+ .WithMany()
+ .HasForeignKey("ChapterMetadatasId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Person", null)
+ .WithMany()
+ .HasForeignKey("PeopleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("ChapterTag", b =>
+ {
+ b.HasOne("API.Entities.Chapter", null)
+ .WithMany()
+ .HasForeignKey("ChaptersId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Tag", null)
+ .WithMany()
+ .HasForeignKey("TagsId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("CollectionTagSeriesMetadata", b =>
+ {
+ b.HasOne("API.Entities.CollectionTag", null)
+ .WithMany()
+ .HasForeignKey("CollectionTagsId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Metadata.SeriesMetadata", null)
+ .WithMany()
+ .HasForeignKey("SeriesMetadatasId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("GenreSeriesMetadata", b =>
+ {
+ b.HasOne("API.Entities.Genre", null)
+ .WithMany()
+ .HasForeignKey("GenresId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Metadata.SeriesMetadata", null)
+ .WithMany()
+ .HasForeignKey("SeriesMetadatasId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
+ {
+ b.HasOne("API.Entities.AppRole", null)
+ .WithMany()
+ .HasForeignKey("RoleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<int>", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("PersonSeriesMetadata", b =>
+ {
+ b.HasOne("API.Entities.Person", null)
+ .WithMany()
+ .HasForeignKey("PeopleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Metadata.SeriesMetadata", null)
+ .WithMany()
+ .HasForeignKey("SeriesMetadatasId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("SeriesMetadataTag", b =>
+ {
+ b.HasOne("API.Entities.Metadata.SeriesMetadata", null)
+ .WithMany()
+ .HasForeignKey("SeriesMetadatasId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Tag", null)
+ .WithMany()
+ .HasForeignKey("TagsId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("API.Entities.AppRole", b =>
+ {
+ b.Navigation("UserRoles");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUser", b =>
+ {
+ b.Navigation("Bookmarks");
+
+ b.Navigation("Devices");
+
+ b.Navigation("Progresses");
+
+ b.Navigation("Ratings");
+
+ b.Navigation("ReadingLists");
+
+ b.Navigation("UserPreferences");
+
+ b.Navigation("UserRoles");
+
+ b.Navigation("WantToRead");
+ });
+
+ modelBuilder.Entity("API.Entities.Chapter", b =>
+ {
+ b.Navigation("Files");
+
+ b.Navigation("UserProgress");
+ });
+
+ modelBuilder.Entity("API.Entities.Library", b =>
+ {
+ b.Navigation("Folders");
+
+ b.Navigation("Series");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingList", b =>
+ {
+ b.Navigation("Items");
+ });
+
+ modelBuilder.Entity("API.Entities.Series", b =>
+ {
+ b.Navigation("Metadata");
+
+ b.Navigation("Progress");
+
+ b.Navigation("Ratings");
+
+ b.Navigation("RelationOf");
+
+ b.Navigation("Relations");
+
+ b.Navigation("Volumes");
+ });
+
+ modelBuilder.Entity("API.Entities.Volume", b =>
+ {
+ b.Navigation("Chapters");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/API/Data/Migrations/20230220203128_CollapseSeriesRelationships.cs b/API/Data/Migrations/20230220203128_CollapseSeriesRelationships.cs
new file mode 100644
index 000000000..2e06924cd
--- /dev/null
+++ b/API/Data/Migrations/20230220203128_CollapseSeriesRelationships.cs
@@ -0,0 +1,26 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace API.Data.Migrations
+{
+ public partial class CollapseSeriesRelationships : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.AddColumn<bool>(
+ name: "CollapseSeriesRelationships",
+ table: "Library",
+ type: "INTEGER",
+ nullable: false,
+ defaultValue: false);
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropColumn(
+ name: "CollapseSeriesRelationships",
+ table: "Library");
+ }
+ }
+}
diff --git a/API/Data/Migrations/20230304202540_BookWritingStylePref.Designer.cs b/API/Data/Migrations/20230304202540_BookWritingStylePref.Designer.cs
new file mode 100644
index 000000000..37cc255ae
--- /dev/null
+++ b/API/Data/Migrations/20230304202540_BookWritingStylePref.Designer.cs
@@ -0,0 +1,1854 @@
+// <auto-generated />
+using System;
+using API.Data;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace API.Data.Migrations
+{
+ [DbContext(typeof(DataContext))]
+ [Migration("20230304202540_BookWritingStylePref")]
+ partial class BookWritingStylePref
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder.HasAnnotation("ProductVersion", "6.0.10");
+
+ modelBuilder.Entity("API.Entities.AppRole", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedName")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedName")
+ .IsUnique()
+ .HasDatabaseName("RoleNameIndex");
+
+ b.ToTable("AspNetRoles", (string)null);
+ });
+
+ modelBuilder.Entity("API.Entities.AppUser", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AccessFailedCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AgeRestriction")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("AgeRestrictionIncludeUnknowns")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("ApiKey")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ConfirmationToken")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Email")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("EmailConfirmed")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastActive")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastActiveUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("LockoutEnabled")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTimeOffset?>("LockoutEnd")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedEmail")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedUserName")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property<string>("PasswordHash")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("PhoneNumber")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("PhoneNumberConfirmed")
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .IsConcurrencyToken()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("SecurityStamp")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("TwoFactorEnabled")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("UserName")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedEmail")
+ .HasDatabaseName("EmailIndex");
+
+ b.HasIndex("NormalizedUserName")
+ .IsUnique()
+ .HasDatabaseName("UserNameIndex");
+
+ b.ToTable("AspNetUsers", (string)null);
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserBookmark", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ChapterId")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("FileName")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Page")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("VolumeId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.ToTable("AppUserBookmark");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserPreferences", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("AutoCloseMenu")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("BackgroundColor")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("TEXT")
+ .HasDefaultValue("#000000");
+
+ b.Property<bool>("BlurUnreadSummaries")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("BookReaderFontFamily")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("BookReaderFontSize")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("BookReaderImmersiveMode")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("BookReaderLayoutMode")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("BookReaderLineSpacing")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("BookReaderMargin")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("BookReaderReadingDirection")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("BookReaderTapToPaginate")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("BookReaderWritingStyle")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("BookThemeName")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("TEXT")
+ .HasDefaultValue("Dark");
+
+ b.Property<bool>("EmulateBook")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("GlobalPageLayoutMode")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(0);
+
+ b.Property<int>("LayoutMode")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("NoTransitions")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("PageSplitOption")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("PromptForDownloadSize")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ReaderMode")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ReadingDirection")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ScalingOption")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("ShowScreenHints")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("SwipeToPaginate")
+ .HasColumnType("INTEGER");
+
+ b.Property<int?>("ThemeId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId")
+ .IsUnique();
+
+ b.HasIndex("ThemeId");
+
+ b.ToTable("AppUserPreferences");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserProgress", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("BookScrollId")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("ChapterId")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("LibraryId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("PagesRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("VolumeId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.HasIndex("ChapterId");
+
+ b.HasIndex("SeriesId");
+
+ b.ToTable("AppUserProgresses");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserRating", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Rating")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Review")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.HasIndex("SeriesId");
+
+ b.ToTable("AppUserRating");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserRole", b =>
+ {
+ b.Property<int>("UserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("RoleId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("UserId", "RoleId");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("AspNetUserRoles", (string)null);
+ });
+
+ modelBuilder.Entity("API.Entities.Chapter", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AgeRating")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AlternateCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("AlternateNumber")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("AlternateSeries")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("AvgHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Count")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("CoverImage")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("CoverImageLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("IsSpecial")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Language")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("MaxHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("MinHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Number")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Pages")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Range")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("ReleaseDate")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("SeriesGroup")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("StoryArc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("StoryArcNumber")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Summary")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("TitleName")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("TotalCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("VolumeId")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("WordCount")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("VolumeId");
+
+ b.ToTable("Chapter");
+ });
+
+ modelBuilder.Entity("API.Entities.CollectionTag", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("CoverImage")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("CoverImageLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("NormalizedTitle")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("Promoted")
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Summary")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("Id", "Promoted")
+ .IsUnique();
+
+ b.ToTable("CollectionTag");
+ });
+
+ modelBuilder.Entity("API.Entities.Device", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("EmailAddress")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("IpAddress")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastUsed")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastUsedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Platform")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.ToTable("Device");
+ });
+
+ modelBuilder.Entity("API.Entities.FolderPath", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastScanned")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("LibraryId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Path")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("LibraryId");
+
+ b.ToTable("FolderPath");
+ });
+
+ modelBuilder.Entity("API.Entities.Genre", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("NormalizedTitle")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedTitle")
+ .IsUnique();
+
+ b.ToTable("Genre");
+ });
+
+ modelBuilder.Entity("API.Entities.Library", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("CoverImage")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("FolderWatching")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(true);
+
+ b.Property<bool>("IncludeInDashboard")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(true);
+
+ b.Property<bool>("IncludeInRecommended")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(true);
+
+ b.Property<bool>("IncludeInSearch")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(true);
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastScanned")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("ManageCollections")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(true);
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Type")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.ToTable("Library");
+ });
+
+ modelBuilder.Entity("API.Entities.MangaFile", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("Bytes")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ChapterId")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Extension")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("FilePath")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Format")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastFileAnalysis")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastFileAnalysisUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Pages")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ChapterId");
+
+ b.ToTable("MangaFile");
+ });
+
+ modelBuilder.Entity("API.Entities.Metadata.SeriesMetadata", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AgeRating")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("AgeRatingLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("CharacterLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("ColoristLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("CoverArtistLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("EditorLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("GenresLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("InkerLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Language")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("LanguageLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("LettererLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("MaxCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("PencillerLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("PublicationStatus")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("PublicationStatusLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("PublisherLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ReleaseYear")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("ReleaseYearLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .IsConcurrencyToken()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Summary")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("SummaryLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("TagsLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("TotalCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("TranslatorLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("WriterLocked")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("SeriesId")
+ .IsUnique();
+
+ b.HasIndex("Id", "SeriesId")
+ .IsUnique();
+
+ b.ToTable("SeriesMetadata");
+ });
+
+ modelBuilder.Entity("API.Entities.Metadata.SeriesRelation", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("RelationKind")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("TargetSeriesId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("SeriesId");
+
+ b.HasIndex("TargetSeriesId");
+
+ b.ToTable("SeriesRelation");
+ });
+
+ modelBuilder.Entity("API.Entities.Person", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedName")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Role")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.ToTable("Person");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingList", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AgeRating")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("CoverImage")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("CoverImageLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedTitle")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("Promoted")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Summary")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.ToTable("ReadingList");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingListItem", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ChapterId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Order")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ReadingListId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("VolumeId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ChapterId");
+
+ b.HasIndex("ReadingListId");
+
+ b.HasIndex("SeriesId");
+
+ b.HasIndex("VolumeId");
+
+ b.ToTable("ReadingListItem");
+ });
+
+ modelBuilder.Entity("API.Entities.Series", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int?>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AvgHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("CoverImage")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("CoverImageLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("FolderPath")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Format")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastChapterAdded")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastChapterAddedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastFolderScanned")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastFolderScannedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("LibraryId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("LocalizedName")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("LocalizedNameLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("MaxHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("MinHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("NameLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("NormalizedLocalizedName")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedName")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("OriginalName")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Pages")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("SortName")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("SortNameLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("WordCount")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.HasIndex("LibraryId");
+
+ b.ToTable("Series");
+ });
+
+ modelBuilder.Entity("API.Entities.ServerSetting", b =>
+ {
+ b.Property<int>("Key")
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .IsConcurrencyToken()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Value")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Key");
+
+ b.ToTable("ServerSetting");
+ });
+
+ modelBuilder.Entity("API.Entities.ServerStatistics", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("ChapterCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("FileCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("GenreCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("PersonCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("SeriesCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("TagCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("UserCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("VolumeCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Year")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.ToTable("ServerStatistics");
+ });
+
+ modelBuilder.Entity("API.Entities.SiteTheme", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("FileName")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("IsDefault")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedName")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Provider")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.ToTable("SiteTheme");
+ });
+
+ modelBuilder.Entity("API.Entities.Tag", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("NormalizedTitle")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedTitle")
+ .IsUnique();
+
+ b.ToTable("Tag");
+ });
+
+ modelBuilder.Entity("API.Entities.Volume", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AvgHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("CoverImage")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("MaxHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("MinHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Number")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Pages")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("WordCount")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("SeriesId");
+
+ b.ToTable("Volume");
+ });
+
+ modelBuilder.Entity("AppUserLibrary", b =>
+ {
+ b.Property<int>("AppUsersId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("LibrariesId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("AppUsersId", "LibrariesId");
+
+ b.HasIndex("LibrariesId");
+
+ b.ToTable("AppUserLibrary");
+ });
+
+ modelBuilder.Entity("ChapterGenre", b =>
+ {
+ b.Property<int>("ChaptersId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("GenresId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("ChaptersId", "GenresId");
+
+ b.HasIndex("GenresId");
+
+ b.ToTable("ChapterGenre");
+ });
+
+ modelBuilder.Entity("ChapterPerson", b =>
+ {
+ b.Property<int>("ChapterMetadatasId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("PeopleId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("ChapterMetadatasId", "PeopleId");
+
+ b.HasIndex("PeopleId");
+
+ b.ToTable("ChapterPerson");
+ });
+
+ modelBuilder.Entity("ChapterTag", b =>
+ {
+ b.Property<int>("ChaptersId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("TagsId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("ChaptersId", "TagsId");
+
+ b.HasIndex("TagsId");
+
+ b.ToTable("ChapterTag");
+ });
+
+ modelBuilder.Entity("CollectionTagSeriesMetadata", b =>
+ {
+ b.Property<int>("CollectionTagsId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesMetadatasId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("CollectionTagsId", "SeriesMetadatasId");
+
+ b.HasIndex("SeriesMetadatasId");
+
+ b.ToTable("CollectionTagSeriesMetadata");
+ });
+
+ modelBuilder.Entity("GenreSeriesMetadata", b =>
+ {
+ b.Property<int>("GenresId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesMetadatasId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("GenresId", "SeriesMetadatasId");
+
+ b.HasIndex("SeriesMetadatasId");
+
+ b.ToTable("GenreSeriesMetadata");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("ClaimType")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ClaimValue")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("RoleId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("AspNetRoleClaims", (string)null);
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("ClaimType")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ClaimValue")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("UserId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AspNetUserClaims", (string)null);
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
+ {
+ b.Property<string>("LoginProvider")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ProviderKey")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ProviderDisplayName")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("UserId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("LoginProvider", "ProviderKey");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AspNetUserLogins", (string)null);
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<int>", b =>
+ {
+ b.Property<int>("UserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("LoginProvider")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Value")
+ .HasColumnType("TEXT");
+
+ b.HasKey("UserId", "LoginProvider", "Name");
+
+ b.ToTable("AspNetUserTokens", (string)null);
+ });
+
+ modelBuilder.Entity("PersonSeriesMetadata", b =>
+ {
+ b.Property<int>("PeopleId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesMetadatasId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("PeopleId", "SeriesMetadatasId");
+
+ b.HasIndex("SeriesMetadatasId");
+
+ b.ToTable("PersonSeriesMetadata");
+ });
+
+ modelBuilder.Entity("SeriesMetadataTag", b =>
+ {
+ b.Property<int>("SeriesMetadatasId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("TagsId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("SeriesMetadatasId", "TagsId");
+
+ b.HasIndex("TagsId");
+
+ b.ToTable("SeriesMetadataTag");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserBookmark", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("Bookmarks")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserPreferences", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithOne("UserPreferences")
+ .HasForeignKey("API.Entities.AppUserPreferences", "AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.SiteTheme", "Theme")
+ .WithMany()
+ .HasForeignKey("ThemeId");
+
+ b.Navigation("AppUser");
+
+ b.Navigation("Theme");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserProgress", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("Progresses")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Chapter", null)
+ .WithMany("UserProgress")
+ .HasForeignKey("ChapterId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Series", null)
+ .WithMany("Progress")
+ .HasForeignKey("SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserRating", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("Ratings")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Series", null)
+ .WithMany("Ratings")
+ .HasForeignKey("SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserRole", b =>
+ {
+ b.HasOne("API.Entities.AppRole", "Role")
+ .WithMany("UserRoles")
+ .HasForeignKey("RoleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.AppUser", "User")
+ .WithMany("UserRoles")
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Role");
+
+ b.Navigation("User");
+ });
+
+ modelBuilder.Entity("API.Entities.Chapter", b =>
+ {
+ b.HasOne("API.Entities.Volume", "Volume")
+ .WithMany("Chapters")
+ .HasForeignKey("VolumeId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Volume");
+ });
+
+ modelBuilder.Entity("API.Entities.Device", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("Devices")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.FolderPath", b =>
+ {
+ b.HasOne("API.Entities.Library", "Library")
+ .WithMany("Folders")
+ .HasForeignKey("LibraryId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Library");
+ });
+
+ modelBuilder.Entity("API.Entities.MangaFile", b =>
+ {
+ b.HasOne("API.Entities.Chapter", "Chapter")
+ .WithMany("Files")
+ .HasForeignKey("ChapterId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Chapter");
+ });
+
+ modelBuilder.Entity("API.Entities.Metadata.SeriesMetadata", b =>
+ {
+ b.HasOne("API.Entities.Series", "Series")
+ .WithOne("Metadata")
+ .HasForeignKey("API.Entities.Metadata.SeriesMetadata", "SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Series");
+ });
+
+ modelBuilder.Entity("API.Entities.Metadata.SeriesRelation", b =>
+ {
+ b.HasOne("API.Entities.Series", "Series")
+ .WithMany("Relations")
+ .HasForeignKey("SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Series", "TargetSeries")
+ .WithMany("RelationOf")
+ .HasForeignKey("TargetSeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Series");
+
+ b.Navigation("TargetSeries");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingList", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("ReadingLists")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingListItem", b =>
+ {
+ b.HasOne("API.Entities.Chapter", "Chapter")
+ .WithMany()
+ .HasForeignKey("ChapterId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.ReadingList", "ReadingList")
+ .WithMany("Items")
+ .HasForeignKey("ReadingListId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Series", "Series")
+ .WithMany()
+ .HasForeignKey("SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Volume", "Volume")
+ .WithMany()
+ .HasForeignKey("VolumeId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Chapter");
+
+ b.Navigation("ReadingList");
+
+ b.Navigation("Series");
+
+ b.Navigation("Volume");
+ });
+
+ modelBuilder.Entity("API.Entities.Series", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany("WantToRead")
+ .HasForeignKey("AppUserId");
+
+ b.HasOne("API.Entities.Library", "Library")
+ .WithMany("Series")
+ .HasForeignKey("LibraryId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Library");
+ });
+
+ modelBuilder.Entity("API.Entities.Volume", b =>
+ {
+ b.HasOne("API.Entities.Series", "Series")
+ .WithMany("Volumes")
+ .HasForeignKey("SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Series");
+ });
+
+ modelBuilder.Entity("AppUserLibrary", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany()
+ .HasForeignKey("AppUsersId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Library", null)
+ .WithMany()
+ .HasForeignKey("LibrariesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("ChapterGenre", b =>
+ {
+ b.HasOne("API.Entities.Chapter", null)
+ .WithMany()
+ .HasForeignKey("ChaptersId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Genre", null)
+ .WithMany()
+ .HasForeignKey("GenresId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("ChapterPerson", b =>
+ {
+ b.HasOne("API.Entities.Chapter", null)
+ .WithMany()
+ .HasForeignKey("ChapterMetadatasId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Person", null)
+ .WithMany()
+ .HasForeignKey("PeopleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("ChapterTag", b =>
+ {
+ b.HasOne("API.Entities.Chapter", null)
+ .WithMany()
+ .HasForeignKey("ChaptersId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Tag", null)
+ .WithMany()
+ .HasForeignKey("TagsId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("CollectionTagSeriesMetadata", b =>
+ {
+ b.HasOne("API.Entities.CollectionTag", null)
+ .WithMany()
+ .HasForeignKey("CollectionTagsId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Metadata.SeriesMetadata", null)
+ .WithMany()
+ .HasForeignKey("SeriesMetadatasId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("GenreSeriesMetadata", b =>
+ {
+ b.HasOne("API.Entities.Genre", null)
+ .WithMany()
+ .HasForeignKey("GenresId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Metadata.SeriesMetadata", null)
+ .WithMany()
+ .HasForeignKey("SeriesMetadatasId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
+ {
+ b.HasOne("API.Entities.AppRole", null)
+ .WithMany()
+ .HasForeignKey("RoleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<int>", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("PersonSeriesMetadata", b =>
+ {
+ b.HasOne("API.Entities.Person", null)
+ .WithMany()
+ .HasForeignKey("PeopleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Metadata.SeriesMetadata", null)
+ .WithMany()
+ .HasForeignKey("SeriesMetadatasId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("SeriesMetadataTag", b =>
+ {
+ b.HasOne("API.Entities.Metadata.SeriesMetadata", null)
+ .WithMany()
+ .HasForeignKey("SeriesMetadatasId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Tag", null)
+ .WithMany()
+ .HasForeignKey("TagsId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("API.Entities.AppRole", b =>
+ {
+ b.Navigation("UserRoles");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUser", b =>
+ {
+ b.Navigation("Bookmarks");
+
+ b.Navigation("Devices");
+
+ b.Navigation("Progresses");
+
+ b.Navigation("Ratings");
+
+ b.Navigation("ReadingLists");
+
+ b.Navigation("UserPreferences");
+
+ b.Navigation("UserRoles");
+
+ b.Navigation("WantToRead");
+ });
+
+ modelBuilder.Entity("API.Entities.Chapter", b =>
+ {
+ b.Navigation("Files");
+
+ b.Navigation("UserProgress");
+ });
+
+ modelBuilder.Entity("API.Entities.Library", b =>
+ {
+ b.Navigation("Folders");
+
+ b.Navigation("Series");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingList", b =>
+ {
+ b.Navigation("Items");
+ });
+
+ modelBuilder.Entity("API.Entities.Series", b =>
+ {
+ b.Navigation("Metadata");
+
+ b.Navigation("Progress");
+
+ b.Navigation("Ratings");
+
+ b.Navigation("RelationOf");
+
+ b.Navigation("Relations");
+
+ b.Navigation("Volumes");
+ });
+
+ modelBuilder.Entity("API.Entities.Volume", b =>
+ {
+ b.Navigation("Chapters");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/API/Data/Migrations/20230304202540_BookWritingStylePref.cs b/API/Data/Migrations/20230304202540_BookWritingStylePref.cs
new file mode 100644
index 000000000..fd6703060
--- /dev/null
+++ b/API/Data/Migrations/20230304202540_BookWritingStylePref.cs
@@ -0,0 +1,26 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace API.Data.Migrations
+{
+ public partial class BookWritingStylePref : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.AddColumn<int>(
+ name: "BookReaderWritingStyle",
+ table: "AppUserPreferences",
+ type: "INTEGER",
+ nullable: false,
+ defaultValue: 0);
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropColumn(
+ name: "BookReaderWritingStyle",
+ table: "AppUserPreferences");
+ }
+ }
+}
diff --git a/API/Data/Migrations/20230310142630_MoveCollapseSeriesToUserPref.Designer.cs b/API/Data/Migrations/20230310142630_MoveCollapseSeriesToUserPref.Designer.cs
new file mode 100644
index 000000000..2edee6323
--- /dev/null
+++ b/API/Data/Migrations/20230310142630_MoveCollapseSeriesToUserPref.Designer.cs
@@ -0,0 +1,1858 @@
+// <auto-generated />
+using System;
+using API.Data;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace API.Data.Migrations
+{
+ [DbContext(typeof(DataContext))]
+ [Migration("20230310142630_MoveCollapseSeriesToUserPref")]
+ partial class MoveCollapseSeriesToUserPref
+ {
+ /// <inheritdoc />
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder.HasAnnotation("ProductVersion", "7.0.3");
+
+ modelBuilder.Entity("API.Entities.AppRole", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedName")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedName")
+ .IsUnique()
+ .HasDatabaseName("RoleNameIndex");
+
+ b.ToTable("AspNetRoles", (string)null);
+ });
+
+ modelBuilder.Entity("API.Entities.AppUser", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AccessFailedCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AgeRestriction")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("AgeRestrictionIncludeUnknowns")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("ApiKey")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ConfirmationToken")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Email")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("EmailConfirmed")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastActive")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastActiveUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("LockoutEnabled")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTimeOffset?>("LockoutEnd")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedEmail")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedUserName")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property<string>("PasswordHash")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("PhoneNumber")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("PhoneNumberConfirmed")
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .IsConcurrencyToken()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("SecurityStamp")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("TwoFactorEnabled")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("UserName")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedEmail")
+ .HasDatabaseName("EmailIndex");
+
+ b.HasIndex("NormalizedUserName")
+ .IsUnique()
+ .HasDatabaseName("UserNameIndex");
+
+ b.ToTable("AspNetUsers", (string)null);
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserBookmark", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ChapterId")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("FileName")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Page")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("VolumeId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.ToTable("AppUserBookmark");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserPreferences", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("AutoCloseMenu")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("BackgroundColor")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("TEXT")
+ .HasDefaultValue("#000000");
+
+ b.Property<bool>("BlurUnreadSummaries")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("BookReaderFontFamily")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("BookReaderFontSize")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("BookReaderImmersiveMode")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("BookReaderLayoutMode")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("BookReaderLineSpacing")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("BookReaderMargin")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("BookReaderReadingDirection")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("BookReaderTapToPaginate")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("BookReaderWritingStyle")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("BookThemeName")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("TEXT")
+ .HasDefaultValue("Dark");
+
+ b.Property<bool>("CollapseSeriesRelationships")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("EmulateBook")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("GlobalPageLayoutMode")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(0);
+
+ b.Property<int>("LayoutMode")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("NoTransitions")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("PageSplitOption")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("PromptForDownloadSize")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ReaderMode")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ReadingDirection")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ScalingOption")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("ShowScreenHints")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("SwipeToPaginate")
+ .HasColumnType("INTEGER");
+
+ b.Property<int?>("ThemeId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId")
+ .IsUnique();
+
+ b.HasIndex("ThemeId");
+
+ b.ToTable("AppUserPreferences");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserProgress", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("BookScrollId")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("ChapterId")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("LibraryId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("PagesRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("VolumeId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.HasIndex("ChapterId");
+
+ b.HasIndex("SeriesId");
+
+ b.ToTable("AppUserProgresses");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserRating", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Rating")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Review")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.HasIndex("SeriesId");
+
+ b.ToTable("AppUserRating");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserRole", b =>
+ {
+ b.Property<int>("UserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("RoleId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("UserId", "RoleId");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("AspNetUserRoles", (string)null);
+ });
+
+ modelBuilder.Entity("API.Entities.Chapter", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AgeRating")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AlternateCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("AlternateNumber")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("AlternateSeries")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("AvgHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Count")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("CoverImage")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("CoverImageLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("IsSpecial")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Language")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("MaxHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("MinHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Number")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Pages")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Range")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("ReleaseDate")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("SeriesGroup")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("StoryArc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("StoryArcNumber")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Summary")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("TitleName")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("TotalCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("VolumeId")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("WordCount")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("VolumeId");
+
+ b.ToTable("Chapter");
+ });
+
+ modelBuilder.Entity("API.Entities.CollectionTag", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("CoverImage")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("CoverImageLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("NormalizedTitle")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("Promoted")
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Summary")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("Id", "Promoted")
+ .IsUnique();
+
+ b.ToTable("CollectionTag");
+ });
+
+ modelBuilder.Entity("API.Entities.Device", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("EmailAddress")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("IpAddress")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastUsed")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastUsedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Platform")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.ToTable("Device");
+ });
+
+ modelBuilder.Entity("API.Entities.FolderPath", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastScanned")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("LibraryId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Path")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("LibraryId");
+
+ b.ToTable("FolderPath");
+ });
+
+ modelBuilder.Entity("API.Entities.Genre", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("NormalizedTitle")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedTitle")
+ .IsUnique();
+
+ b.ToTable("Genre");
+ });
+
+ modelBuilder.Entity("API.Entities.Library", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("CoverImage")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("FolderWatching")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(true);
+
+ b.Property<bool>("IncludeInDashboard")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(true);
+
+ b.Property<bool>("IncludeInRecommended")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(true);
+
+ b.Property<bool>("IncludeInSearch")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(true);
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastScanned")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("ManageCollections")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(true);
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Type")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.ToTable("Library");
+ });
+
+ modelBuilder.Entity("API.Entities.MangaFile", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("Bytes")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ChapterId")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Extension")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("FilePath")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Format")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastFileAnalysis")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastFileAnalysisUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Pages")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ChapterId");
+
+ b.ToTable("MangaFile");
+ });
+
+ modelBuilder.Entity("API.Entities.Metadata.SeriesMetadata", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AgeRating")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("AgeRatingLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("CharacterLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("ColoristLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("CoverArtistLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("EditorLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("GenresLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("InkerLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Language")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("LanguageLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("LettererLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("MaxCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("PencillerLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("PublicationStatus")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("PublicationStatusLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("PublisherLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ReleaseYear")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("ReleaseYearLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .IsConcurrencyToken()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Summary")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("SummaryLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("TagsLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("TotalCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("TranslatorLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("WriterLocked")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("SeriesId")
+ .IsUnique();
+
+ b.HasIndex("Id", "SeriesId")
+ .IsUnique();
+
+ b.ToTable("SeriesMetadata");
+ });
+
+ modelBuilder.Entity("API.Entities.Metadata.SeriesRelation", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("RelationKind")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("TargetSeriesId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("SeriesId");
+
+ b.HasIndex("TargetSeriesId");
+
+ b.ToTable("SeriesRelation");
+ });
+
+ modelBuilder.Entity("API.Entities.Person", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedName")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Role")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.ToTable("Person");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingList", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AgeRating")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("CoverImage")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("CoverImageLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedTitle")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("Promoted")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Summary")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.ToTable("ReadingList");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingListItem", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ChapterId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Order")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ReadingListId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("VolumeId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ChapterId");
+
+ b.HasIndex("ReadingListId");
+
+ b.HasIndex("SeriesId");
+
+ b.HasIndex("VolumeId");
+
+ b.ToTable("ReadingListItem");
+ });
+
+ modelBuilder.Entity("API.Entities.Series", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int?>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AvgHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("CoverImage")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("CoverImageLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("FolderPath")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Format")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastChapterAdded")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastChapterAddedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastFolderScanned")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastFolderScannedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("LibraryId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("LocalizedName")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("LocalizedNameLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("MaxHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("MinHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("NameLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("NormalizedLocalizedName")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedName")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("OriginalName")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Pages")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("SortName")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("SortNameLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("WordCount")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.HasIndex("LibraryId");
+
+ b.ToTable("Series");
+ });
+
+ modelBuilder.Entity("API.Entities.ServerSetting", b =>
+ {
+ b.Property<int>("Key")
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .IsConcurrencyToken()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Value")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Key");
+
+ b.ToTable("ServerSetting");
+ });
+
+ modelBuilder.Entity("API.Entities.ServerStatistics", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("ChapterCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("FileCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("GenreCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("PersonCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("SeriesCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("TagCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("UserCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("VolumeCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Year")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.ToTable("ServerStatistics");
+ });
+
+ modelBuilder.Entity("API.Entities.SiteTheme", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("FileName")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("IsDefault")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedName")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Provider")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.ToTable("SiteTheme");
+ });
+
+ modelBuilder.Entity("API.Entities.Tag", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("NormalizedTitle")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedTitle")
+ .IsUnique();
+
+ b.ToTable("Tag");
+ });
+
+ modelBuilder.Entity("API.Entities.Volume", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AvgHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("CoverImage")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("MaxHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("MinHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Number")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Pages")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("WordCount")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("SeriesId");
+
+ b.ToTable("Volume");
+ });
+
+ modelBuilder.Entity("AppUserLibrary", b =>
+ {
+ b.Property<int>("AppUsersId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("LibrariesId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("AppUsersId", "LibrariesId");
+
+ b.HasIndex("LibrariesId");
+
+ b.ToTable("AppUserLibrary");
+ });
+
+ modelBuilder.Entity("ChapterGenre", b =>
+ {
+ b.Property<int>("ChaptersId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("GenresId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("ChaptersId", "GenresId");
+
+ b.HasIndex("GenresId");
+
+ b.ToTable("ChapterGenre");
+ });
+
+ modelBuilder.Entity("ChapterPerson", b =>
+ {
+ b.Property<int>("ChapterMetadatasId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("PeopleId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("ChapterMetadatasId", "PeopleId");
+
+ b.HasIndex("PeopleId");
+
+ b.ToTable("ChapterPerson");
+ });
+
+ modelBuilder.Entity("ChapterTag", b =>
+ {
+ b.Property<int>("ChaptersId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("TagsId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("ChaptersId", "TagsId");
+
+ b.HasIndex("TagsId");
+
+ b.ToTable("ChapterTag");
+ });
+
+ modelBuilder.Entity("CollectionTagSeriesMetadata", b =>
+ {
+ b.Property<int>("CollectionTagsId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesMetadatasId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("CollectionTagsId", "SeriesMetadatasId");
+
+ b.HasIndex("SeriesMetadatasId");
+
+ b.ToTable("CollectionTagSeriesMetadata");
+ });
+
+ modelBuilder.Entity("GenreSeriesMetadata", b =>
+ {
+ b.Property<int>("GenresId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesMetadatasId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("GenresId", "SeriesMetadatasId");
+
+ b.HasIndex("SeriesMetadatasId");
+
+ b.ToTable("GenreSeriesMetadata");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("ClaimType")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ClaimValue")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("RoleId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("AspNetRoleClaims", (string)null);
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("ClaimType")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ClaimValue")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("UserId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AspNetUserClaims", (string)null);
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
+ {
+ b.Property<string>("LoginProvider")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ProviderKey")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ProviderDisplayName")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("UserId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("LoginProvider", "ProviderKey");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AspNetUserLogins", (string)null);
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<int>", b =>
+ {
+ b.Property<int>("UserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("LoginProvider")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Value")
+ .HasColumnType("TEXT");
+
+ b.HasKey("UserId", "LoginProvider", "Name");
+
+ b.ToTable("AspNetUserTokens", (string)null);
+ });
+
+ modelBuilder.Entity("PersonSeriesMetadata", b =>
+ {
+ b.Property<int>("PeopleId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesMetadatasId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("PeopleId", "SeriesMetadatasId");
+
+ b.HasIndex("SeriesMetadatasId");
+
+ b.ToTable("PersonSeriesMetadata");
+ });
+
+ modelBuilder.Entity("SeriesMetadataTag", b =>
+ {
+ b.Property<int>("SeriesMetadatasId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("TagsId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("SeriesMetadatasId", "TagsId");
+
+ b.HasIndex("TagsId");
+
+ b.ToTable("SeriesMetadataTag");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserBookmark", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("Bookmarks")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserPreferences", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithOne("UserPreferences")
+ .HasForeignKey("API.Entities.AppUserPreferences", "AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.SiteTheme", "Theme")
+ .WithMany()
+ .HasForeignKey("ThemeId");
+
+ b.Navigation("AppUser");
+
+ b.Navigation("Theme");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserProgress", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("Progresses")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Chapter", null)
+ .WithMany("UserProgress")
+ .HasForeignKey("ChapterId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Series", null)
+ .WithMany("Progress")
+ .HasForeignKey("SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserRating", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("Ratings")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Series", null)
+ .WithMany("Ratings")
+ .HasForeignKey("SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserRole", b =>
+ {
+ b.HasOne("API.Entities.AppRole", "Role")
+ .WithMany("UserRoles")
+ .HasForeignKey("RoleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.AppUser", "User")
+ .WithMany("UserRoles")
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Role");
+
+ b.Navigation("User");
+ });
+
+ modelBuilder.Entity("API.Entities.Chapter", b =>
+ {
+ b.HasOne("API.Entities.Volume", "Volume")
+ .WithMany("Chapters")
+ .HasForeignKey("VolumeId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Volume");
+ });
+
+ modelBuilder.Entity("API.Entities.Device", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("Devices")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.FolderPath", b =>
+ {
+ b.HasOne("API.Entities.Library", "Library")
+ .WithMany("Folders")
+ .HasForeignKey("LibraryId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Library");
+ });
+
+ modelBuilder.Entity("API.Entities.MangaFile", b =>
+ {
+ b.HasOne("API.Entities.Chapter", "Chapter")
+ .WithMany("Files")
+ .HasForeignKey("ChapterId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Chapter");
+ });
+
+ modelBuilder.Entity("API.Entities.Metadata.SeriesMetadata", b =>
+ {
+ b.HasOne("API.Entities.Series", "Series")
+ .WithOne("Metadata")
+ .HasForeignKey("API.Entities.Metadata.SeriesMetadata", "SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Series");
+ });
+
+ modelBuilder.Entity("API.Entities.Metadata.SeriesRelation", b =>
+ {
+ b.HasOne("API.Entities.Series", "Series")
+ .WithMany("Relations")
+ .HasForeignKey("SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Series", "TargetSeries")
+ .WithMany("RelationOf")
+ .HasForeignKey("TargetSeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Series");
+
+ b.Navigation("TargetSeries");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingList", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("ReadingLists")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingListItem", b =>
+ {
+ b.HasOne("API.Entities.Chapter", "Chapter")
+ .WithMany()
+ .HasForeignKey("ChapterId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.ReadingList", "ReadingList")
+ .WithMany("Items")
+ .HasForeignKey("ReadingListId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Series", "Series")
+ .WithMany()
+ .HasForeignKey("SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Volume", "Volume")
+ .WithMany()
+ .HasForeignKey("VolumeId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Chapter");
+
+ b.Navigation("ReadingList");
+
+ b.Navigation("Series");
+
+ b.Navigation("Volume");
+ });
+
+ modelBuilder.Entity("API.Entities.Series", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany("WantToRead")
+ .HasForeignKey("AppUserId");
+
+ b.HasOne("API.Entities.Library", "Library")
+ .WithMany("Series")
+ .HasForeignKey("LibraryId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Library");
+ });
+
+ modelBuilder.Entity("API.Entities.Volume", b =>
+ {
+ b.HasOne("API.Entities.Series", "Series")
+ .WithMany("Volumes")
+ .HasForeignKey("SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Series");
+ });
+
+ modelBuilder.Entity("AppUserLibrary", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany()
+ .HasForeignKey("AppUsersId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Library", null)
+ .WithMany()
+ .HasForeignKey("LibrariesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("ChapterGenre", b =>
+ {
+ b.HasOne("API.Entities.Chapter", null)
+ .WithMany()
+ .HasForeignKey("ChaptersId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Genre", null)
+ .WithMany()
+ .HasForeignKey("GenresId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("ChapterPerson", b =>
+ {
+ b.HasOne("API.Entities.Chapter", null)
+ .WithMany()
+ .HasForeignKey("ChapterMetadatasId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Person", null)
+ .WithMany()
+ .HasForeignKey("PeopleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("ChapterTag", b =>
+ {
+ b.HasOne("API.Entities.Chapter", null)
+ .WithMany()
+ .HasForeignKey("ChaptersId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Tag", null)
+ .WithMany()
+ .HasForeignKey("TagsId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("CollectionTagSeriesMetadata", b =>
+ {
+ b.HasOne("API.Entities.CollectionTag", null)
+ .WithMany()
+ .HasForeignKey("CollectionTagsId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Metadata.SeriesMetadata", null)
+ .WithMany()
+ .HasForeignKey("SeriesMetadatasId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("GenreSeriesMetadata", b =>
+ {
+ b.HasOne("API.Entities.Genre", null)
+ .WithMany()
+ .HasForeignKey("GenresId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Metadata.SeriesMetadata", null)
+ .WithMany()
+ .HasForeignKey("SeriesMetadatasId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
+ {
+ b.HasOne("API.Entities.AppRole", null)
+ .WithMany()
+ .HasForeignKey("RoleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<int>", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("PersonSeriesMetadata", b =>
+ {
+ b.HasOne("API.Entities.Person", null)
+ .WithMany()
+ .HasForeignKey("PeopleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Metadata.SeriesMetadata", null)
+ .WithMany()
+ .HasForeignKey("SeriesMetadatasId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("SeriesMetadataTag", b =>
+ {
+ b.HasOne("API.Entities.Metadata.SeriesMetadata", null)
+ .WithMany()
+ .HasForeignKey("SeriesMetadatasId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Tag", null)
+ .WithMany()
+ .HasForeignKey("TagsId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("API.Entities.AppRole", b =>
+ {
+ b.Navigation("UserRoles");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUser", b =>
+ {
+ b.Navigation("Bookmarks");
+
+ b.Navigation("Devices");
+
+ b.Navigation("Progresses");
+
+ b.Navigation("Ratings");
+
+ b.Navigation("ReadingLists");
+
+ b.Navigation("UserPreferences");
+
+ b.Navigation("UserRoles");
+
+ b.Navigation("WantToRead");
+ });
+
+ modelBuilder.Entity("API.Entities.Chapter", b =>
+ {
+ b.Navigation("Files");
+
+ b.Navigation("UserProgress");
+ });
+
+ modelBuilder.Entity("API.Entities.Library", b =>
+ {
+ b.Navigation("Folders");
+
+ b.Navigation("Series");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingList", b =>
+ {
+ b.Navigation("Items");
+ });
+
+ modelBuilder.Entity("API.Entities.Series", b =>
+ {
+ b.Navigation("Metadata");
+
+ b.Navigation("Progress");
+
+ b.Navigation("Ratings");
+
+ b.Navigation("RelationOf");
+
+ b.Navigation("Relations");
+
+ b.Navigation("Volumes");
+ });
+
+ modelBuilder.Entity("API.Entities.Volume", b =>
+ {
+ b.Navigation("Chapters");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/API/Data/Migrations/20230310142630_MoveCollapseSeriesToUserPref.cs b/API/Data/Migrations/20230310142630_MoveCollapseSeriesToUserPref.cs
new file mode 100644
index 000000000..db5920d0a
--- /dev/null
+++ b/API/Data/Migrations/20230310142630_MoveCollapseSeriesToUserPref.cs
@@ -0,0 +1,29 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace API.Data.Migrations
+{
+ /// <inheritdoc />
+ public partial class MoveCollapseSeriesToUserPref : Migration
+ {
+ /// <inheritdoc />
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.AddColumn<bool>(
+ name: "CollapseSeriesRelationships",
+ table: "AppUserPreferences",
+ type: "INTEGER",
+ nullable: false,
+ defaultValue: false);
+ }
+
+ /// <inheritdoc />
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropColumn(
+ name: "CollapseSeriesRelationships",
+ table: "AppUserPreferences");
+ }
+ }
+}
diff --git a/API/Data/Migrations/20230313125914_ReadingListDateRange.Designer.cs b/API/Data/Migrations/20230313125914_ReadingListDateRange.Designer.cs
new file mode 100644
index 000000000..3500a3080
--- /dev/null
+++ b/API/Data/Migrations/20230313125914_ReadingListDateRange.Designer.cs
@@ -0,0 +1,1872 @@
+// <auto-generated />
+using System;
+using API.Data;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace API.Data.Migrations
+{
+ [DbContext(typeof(DataContext))]
+ [Migration("20230313125914_ReadingListDateRange")]
+ partial class ReadingListDateRange
+ {
+ /// <inheritdoc />
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder.HasAnnotation("ProductVersion", "7.0.3");
+
+ modelBuilder.Entity("API.Entities.AppRole", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedName")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedName")
+ .IsUnique()
+ .HasDatabaseName("RoleNameIndex");
+
+ b.ToTable("AspNetRoles", (string)null);
+ });
+
+ modelBuilder.Entity("API.Entities.AppUser", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AccessFailedCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AgeRestriction")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("AgeRestrictionIncludeUnknowns")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("ApiKey")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ConfirmationToken")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Email")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("EmailConfirmed")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastActive")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastActiveUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("LockoutEnabled")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTimeOffset?>("LockoutEnd")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedEmail")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedUserName")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property<string>("PasswordHash")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("PhoneNumber")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("PhoneNumberConfirmed")
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .IsConcurrencyToken()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("SecurityStamp")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("TwoFactorEnabled")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("UserName")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedEmail")
+ .HasDatabaseName("EmailIndex");
+
+ b.HasIndex("NormalizedUserName")
+ .IsUnique()
+ .HasDatabaseName("UserNameIndex");
+
+ b.ToTable("AspNetUsers", (string)null);
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserBookmark", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ChapterId")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("FileName")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Page")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("VolumeId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.ToTable("AppUserBookmark");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserPreferences", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("AutoCloseMenu")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("BackgroundColor")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("TEXT")
+ .HasDefaultValue("#000000");
+
+ b.Property<bool>("BlurUnreadSummaries")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("BookReaderFontFamily")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("BookReaderFontSize")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("BookReaderImmersiveMode")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("BookReaderLayoutMode")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("BookReaderLineSpacing")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("BookReaderMargin")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("BookReaderReadingDirection")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("BookReaderTapToPaginate")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("BookReaderWritingStyle")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(0);
+
+ b.Property<string>("BookThemeName")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("TEXT")
+ .HasDefaultValue("Dark");
+
+ b.Property<bool>("CollapseSeriesRelationships")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("EmulateBook")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("GlobalPageLayoutMode")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(0);
+
+ b.Property<int>("LayoutMode")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("NoTransitions")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("PageSplitOption")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("PromptForDownloadSize")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ReaderMode")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ReadingDirection")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ScalingOption")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("ShowScreenHints")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("SwipeToPaginate")
+ .HasColumnType("INTEGER");
+
+ b.Property<int?>("ThemeId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId")
+ .IsUnique();
+
+ b.HasIndex("ThemeId");
+
+ b.ToTable("AppUserPreferences");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserProgress", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("BookScrollId")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("ChapterId")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("LibraryId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("PagesRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("VolumeId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.HasIndex("ChapterId");
+
+ b.HasIndex("SeriesId");
+
+ b.ToTable("AppUserProgresses");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserRating", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Rating")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Review")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.HasIndex("SeriesId");
+
+ b.ToTable("AppUserRating");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserRole", b =>
+ {
+ b.Property<int>("UserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("RoleId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("UserId", "RoleId");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("AspNetUserRoles", (string)null);
+ });
+
+ modelBuilder.Entity("API.Entities.Chapter", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AgeRating")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AlternateCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("AlternateNumber")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("AlternateSeries")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("AvgHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Count")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("CoverImage")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("CoverImageLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("IsSpecial")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Language")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("MaxHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("MinHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Number")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Pages")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Range")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("ReleaseDate")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("SeriesGroup")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("StoryArc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("StoryArcNumber")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Summary")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("TitleName")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("TotalCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("VolumeId")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("WordCount")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("VolumeId");
+
+ b.ToTable("Chapter");
+ });
+
+ modelBuilder.Entity("API.Entities.CollectionTag", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("CoverImage")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("CoverImageLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("NormalizedTitle")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("Promoted")
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Summary")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("Id", "Promoted")
+ .IsUnique();
+
+ b.ToTable("CollectionTag");
+ });
+
+ modelBuilder.Entity("API.Entities.Device", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("EmailAddress")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("IpAddress")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastUsed")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastUsedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Platform")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.ToTable("Device");
+ });
+
+ modelBuilder.Entity("API.Entities.FolderPath", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastScanned")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("LibraryId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Path")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("LibraryId");
+
+ b.ToTable("FolderPath");
+ });
+
+ modelBuilder.Entity("API.Entities.Genre", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("NormalizedTitle")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedTitle")
+ .IsUnique();
+
+ b.ToTable("Genre");
+ });
+
+ modelBuilder.Entity("API.Entities.Library", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("CoverImage")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("FolderWatching")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(true);
+
+ b.Property<bool>("IncludeInDashboard")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(true);
+
+ b.Property<bool>("IncludeInRecommended")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(true);
+
+ b.Property<bool>("IncludeInSearch")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(true);
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastScanned")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("ManageCollections")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(true);
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Type")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.ToTable("Library");
+ });
+
+ modelBuilder.Entity("API.Entities.MangaFile", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("Bytes")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ChapterId")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Extension")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("FilePath")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Format")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastFileAnalysis")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastFileAnalysisUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Pages")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ChapterId");
+
+ b.ToTable("MangaFile");
+ });
+
+ modelBuilder.Entity("API.Entities.Metadata.SeriesMetadata", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AgeRating")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("AgeRatingLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("CharacterLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("ColoristLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("CoverArtistLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("EditorLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("GenresLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("InkerLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Language")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("LanguageLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("LettererLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("MaxCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("PencillerLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("PublicationStatus")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("PublicationStatusLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("PublisherLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ReleaseYear")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("ReleaseYearLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .IsConcurrencyToken()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Summary")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("SummaryLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("TagsLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("TotalCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("TranslatorLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("WriterLocked")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("SeriesId")
+ .IsUnique();
+
+ b.HasIndex("Id", "SeriesId")
+ .IsUnique();
+
+ b.ToTable("SeriesMetadata");
+ });
+
+ modelBuilder.Entity("API.Entities.Metadata.SeriesRelation", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("RelationKind")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("TargetSeriesId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("SeriesId");
+
+ b.HasIndex("TargetSeriesId");
+
+ b.ToTable("SeriesRelation");
+ });
+
+ modelBuilder.Entity("API.Entities.Person", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedName")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Role")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.ToTable("Person");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingList", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AgeRating")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("CoverImage")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("CoverImageLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("EndingMonth")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("EndingYear")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedTitle")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("Promoted")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("StartingMonth")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("StartingYear")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Summary")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.ToTable("ReadingList");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingListItem", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ChapterId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Order")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ReadingListId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("VolumeId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ChapterId");
+
+ b.HasIndex("ReadingListId");
+
+ b.HasIndex("SeriesId");
+
+ b.HasIndex("VolumeId");
+
+ b.ToTable("ReadingListItem");
+ });
+
+ modelBuilder.Entity("API.Entities.Series", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int?>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AvgHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("CoverImage")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("CoverImageLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("FolderPath")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Format")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastChapterAdded")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastChapterAddedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastFolderScanned")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastFolderScannedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("LibraryId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("LocalizedName")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("LocalizedNameLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("MaxHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("MinHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("NameLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("NormalizedLocalizedName")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedName")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("OriginalName")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Pages")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("SortName")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("SortNameLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("WordCount")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.HasIndex("LibraryId");
+
+ b.ToTable("Series");
+ });
+
+ modelBuilder.Entity("API.Entities.ServerSetting", b =>
+ {
+ b.Property<int>("Key")
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .IsConcurrencyToken()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Value")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Key");
+
+ b.ToTable("ServerSetting");
+ });
+
+ modelBuilder.Entity("API.Entities.ServerStatistics", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("ChapterCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("FileCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("GenreCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("PersonCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("SeriesCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("TagCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("UserCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("VolumeCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Year")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.ToTable("ServerStatistics");
+ });
+
+ modelBuilder.Entity("API.Entities.SiteTheme", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("FileName")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("IsDefault")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedName")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Provider")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.ToTable("SiteTheme");
+ });
+
+ modelBuilder.Entity("API.Entities.Tag", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("NormalizedTitle")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedTitle")
+ .IsUnique();
+
+ b.ToTable("Tag");
+ });
+
+ modelBuilder.Entity("API.Entities.Volume", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AvgHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("CoverImage")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("MaxHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("MinHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Number")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Pages")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("WordCount")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("SeriesId");
+
+ b.ToTable("Volume");
+ });
+
+ modelBuilder.Entity("AppUserLibrary", b =>
+ {
+ b.Property<int>("AppUsersId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("LibrariesId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("AppUsersId", "LibrariesId");
+
+ b.HasIndex("LibrariesId");
+
+ b.ToTable("AppUserLibrary");
+ });
+
+ modelBuilder.Entity("ChapterGenre", b =>
+ {
+ b.Property<int>("ChaptersId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("GenresId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("ChaptersId", "GenresId");
+
+ b.HasIndex("GenresId");
+
+ b.ToTable("ChapterGenre");
+ });
+
+ modelBuilder.Entity("ChapterPerson", b =>
+ {
+ b.Property<int>("ChapterMetadatasId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("PeopleId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("ChapterMetadatasId", "PeopleId");
+
+ b.HasIndex("PeopleId");
+
+ b.ToTable("ChapterPerson");
+ });
+
+ modelBuilder.Entity("ChapterTag", b =>
+ {
+ b.Property<int>("ChaptersId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("TagsId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("ChaptersId", "TagsId");
+
+ b.HasIndex("TagsId");
+
+ b.ToTable("ChapterTag");
+ });
+
+ modelBuilder.Entity("CollectionTagSeriesMetadata", b =>
+ {
+ b.Property<int>("CollectionTagsId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesMetadatasId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("CollectionTagsId", "SeriesMetadatasId");
+
+ b.HasIndex("SeriesMetadatasId");
+
+ b.ToTable("CollectionTagSeriesMetadata");
+ });
+
+ modelBuilder.Entity("GenreSeriesMetadata", b =>
+ {
+ b.Property<int>("GenresId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesMetadatasId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("GenresId", "SeriesMetadatasId");
+
+ b.HasIndex("SeriesMetadatasId");
+
+ b.ToTable("GenreSeriesMetadata");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("ClaimType")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ClaimValue")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("RoleId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("AspNetRoleClaims", (string)null);
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("ClaimType")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ClaimValue")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("UserId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AspNetUserClaims", (string)null);
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
+ {
+ b.Property<string>("LoginProvider")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ProviderKey")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ProviderDisplayName")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("UserId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("LoginProvider", "ProviderKey");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AspNetUserLogins", (string)null);
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<int>", b =>
+ {
+ b.Property<int>("UserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("LoginProvider")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Value")
+ .HasColumnType("TEXT");
+
+ b.HasKey("UserId", "LoginProvider", "Name");
+
+ b.ToTable("AspNetUserTokens", (string)null);
+ });
+
+ modelBuilder.Entity("PersonSeriesMetadata", b =>
+ {
+ b.Property<int>("PeopleId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesMetadatasId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("PeopleId", "SeriesMetadatasId");
+
+ b.HasIndex("SeriesMetadatasId");
+
+ b.ToTable("PersonSeriesMetadata");
+ });
+
+ modelBuilder.Entity("SeriesMetadataTag", b =>
+ {
+ b.Property<int>("SeriesMetadatasId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("TagsId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("SeriesMetadatasId", "TagsId");
+
+ b.HasIndex("TagsId");
+
+ b.ToTable("SeriesMetadataTag");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserBookmark", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("Bookmarks")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserPreferences", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithOne("UserPreferences")
+ .HasForeignKey("API.Entities.AppUserPreferences", "AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.SiteTheme", "Theme")
+ .WithMany()
+ .HasForeignKey("ThemeId");
+
+ b.Navigation("AppUser");
+
+ b.Navigation("Theme");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserProgress", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("Progresses")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Chapter", null)
+ .WithMany("UserProgress")
+ .HasForeignKey("ChapterId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Series", null)
+ .WithMany("Progress")
+ .HasForeignKey("SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserRating", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("Ratings")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Series", null)
+ .WithMany("Ratings")
+ .HasForeignKey("SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserRole", b =>
+ {
+ b.HasOne("API.Entities.AppRole", "Role")
+ .WithMany("UserRoles")
+ .HasForeignKey("RoleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.AppUser", "User")
+ .WithMany("UserRoles")
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Role");
+
+ b.Navigation("User");
+ });
+
+ modelBuilder.Entity("API.Entities.Chapter", b =>
+ {
+ b.HasOne("API.Entities.Volume", "Volume")
+ .WithMany("Chapters")
+ .HasForeignKey("VolumeId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Volume");
+ });
+
+ modelBuilder.Entity("API.Entities.Device", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("Devices")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.FolderPath", b =>
+ {
+ b.HasOne("API.Entities.Library", "Library")
+ .WithMany("Folders")
+ .HasForeignKey("LibraryId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Library");
+ });
+
+ modelBuilder.Entity("API.Entities.MangaFile", b =>
+ {
+ b.HasOne("API.Entities.Chapter", "Chapter")
+ .WithMany("Files")
+ .HasForeignKey("ChapterId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Chapter");
+ });
+
+ modelBuilder.Entity("API.Entities.Metadata.SeriesMetadata", b =>
+ {
+ b.HasOne("API.Entities.Series", "Series")
+ .WithOne("Metadata")
+ .HasForeignKey("API.Entities.Metadata.SeriesMetadata", "SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Series");
+ });
+
+ modelBuilder.Entity("API.Entities.Metadata.SeriesRelation", b =>
+ {
+ b.HasOne("API.Entities.Series", "Series")
+ .WithMany("Relations")
+ .HasForeignKey("SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Series", "TargetSeries")
+ .WithMany("RelationOf")
+ .HasForeignKey("TargetSeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Series");
+
+ b.Navigation("TargetSeries");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingList", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("ReadingLists")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingListItem", b =>
+ {
+ b.HasOne("API.Entities.Chapter", "Chapter")
+ .WithMany()
+ .HasForeignKey("ChapterId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.ReadingList", "ReadingList")
+ .WithMany("Items")
+ .HasForeignKey("ReadingListId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Series", "Series")
+ .WithMany()
+ .HasForeignKey("SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Volume", "Volume")
+ .WithMany()
+ .HasForeignKey("VolumeId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Chapter");
+
+ b.Navigation("ReadingList");
+
+ b.Navigation("Series");
+
+ b.Navigation("Volume");
+ });
+
+ modelBuilder.Entity("API.Entities.Series", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany("WantToRead")
+ .HasForeignKey("AppUserId");
+
+ b.HasOne("API.Entities.Library", "Library")
+ .WithMany("Series")
+ .HasForeignKey("LibraryId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Library");
+ });
+
+ modelBuilder.Entity("API.Entities.Volume", b =>
+ {
+ b.HasOne("API.Entities.Series", "Series")
+ .WithMany("Volumes")
+ .HasForeignKey("SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Series");
+ });
+
+ modelBuilder.Entity("AppUserLibrary", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany()
+ .HasForeignKey("AppUsersId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Library", null)
+ .WithMany()
+ .HasForeignKey("LibrariesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("ChapterGenre", b =>
+ {
+ b.HasOne("API.Entities.Chapter", null)
+ .WithMany()
+ .HasForeignKey("ChaptersId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Genre", null)
+ .WithMany()
+ .HasForeignKey("GenresId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("ChapterPerson", b =>
+ {
+ b.HasOne("API.Entities.Chapter", null)
+ .WithMany()
+ .HasForeignKey("ChapterMetadatasId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Person", null)
+ .WithMany()
+ .HasForeignKey("PeopleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("ChapterTag", b =>
+ {
+ b.HasOne("API.Entities.Chapter", null)
+ .WithMany()
+ .HasForeignKey("ChaptersId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Tag", null)
+ .WithMany()
+ .HasForeignKey("TagsId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("CollectionTagSeriesMetadata", b =>
+ {
+ b.HasOne("API.Entities.CollectionTag", null)
+ .WithMany()
+ .HasForeignKey("CollectionTagsId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Metadata.SeriesMetadata", null)
+ .WithMany()
+ .HasForeignKey("SeriesMetadatasId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("GenreSeriesMetadata", b =>
+ {
+ b.HasOne("API.Entities.Genre", null)
+ .WithMany()
+ .HasForeignKey("GenresId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Metadata.SeriesMetadata", null)
+ .WithMany()
+ .HasForeignKey("SeriesMetadatasId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
+ {
+ b.HasOne("API.Entities.AppRole", null)
+ .WithMany()
+ .HasForeignKey("RoleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<int>", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("PersonSeriesMetadata", b =>
+ {
+ b.HasOne("API.Entities.Person", null)
+ .WithMany()
+ .HasForeignKey("PeopleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Metadata.SeriesMetadata", null)
+ .WithMany()
+ .HasForeignKey("SeriesMetadatasId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("SeriesMetadataTag", b =>
+ {
+ b.HasOne("API.Entities.Metadata.SeriesMetadata", null)
+ .WithMany()
+ .HasForeignKey("SeriesMetadatasId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Tag", null)
+ .WithMany()
+ .HasForeignKey("TagsId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("API.Entities.AppRole", b =>
+ {
+ b.Navigation("UserRoles");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUser", b =>
+ {
+ b.Navigation("Bookmarks");
+
+ b.Navigation("Devices");
+
+ b.Navigation("Progresses");
+
+ b.Navigation("Ratings");
+
+ b.Navigation("ReadingLists");
+
+ b.Navigation("UserPreferences");
+
+ b.Navigation("UserRoles");
+
+ b.Navigation("WantToRead");
+ });
+
+ modelBuilder.Entity("API.Entities.Chapter", b =>
+ {
+ b.Navigation("Files");
+
+ b.Navigation("UserProgress");
+ });
+
+ modelBuilder.Entity("API.Entities.Library", b =>
+ {
+ b.Navigation("Folders");
+
+ b.Navigation("Series");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingList", b =>
+ {
+ b.Navigation("Items");
+ });
+
+ modelBuilder.Entity("API.Entities.Series", b =>
+ {
+ b.Navigation("Metadata");
+
+ b.Navigation("Progress");
+
+ b.Navigation("Ratings");
+
+ b.Navigation("RelationOf");
+
+ b.Navigation("Relations");
+
+ b.Navigation("Volumes");
+ });
+
+ modelBuilder.Entity("API.Entities.Volume", b =>
+ {
+ b.Navigation("Chapters");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/API/Data/Migrations/20230313125914_ReadingListDateRange.cs b/API/Data/Migrations/20230313125914_ReadingListDateRange.cs
new file mode 100644
index 000000000..e4de75aa2
--- /dev/null
+++ b/API/Data/Migrations/20230313125914_ReadingListDateRange.cs
@@ -0,0 +1,80 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace API.Data.Migrations
+{
+ /// <inheritdoc />
+ public partial class ReadingListDateRange : Migration
+ {
+ /// <inheritdoc />
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.AddColumn<int>(
+ name: "EndingMonth",
+ table: "ReadingList",
+ type: "INTEGER",
+ nullable: false,
+ defaultValue: 0);
+
+ migrationBuilder.AddColumn<int>(
+ name: "EndingYear",
+ table: "ReadingList",
+ type: "INTEGER",
+ nullable: false,
+ defaultValue: 0);
+
+ migrationBuilder.AddColumn<int>(
+ name: "StartingMonth",
+ table: "ReadingList",
+ type: "INTEGER",
+ nullable: false,
+ defaultValue: 0);
+
+ migrationBuilder.AddColumn<int>(
+ name: "StartingYear",
+ table: "ReadingList",
+ type: "INTEGER",
+ nullable: false,
+ defaultValue: 0);
+
+ migrationBuilder.AlterColumn<int>(
+ name: "BookReaderWritingStyle",
+ table: "AppUserPreferences",
+ type: "INTEGER",
+ nullable: false,
+ defaultValue: 0,
+ oldClrType: typeof(int),
+ oldType: "INTEGER");
+ }
+
+ /// <inheritdoc />
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropColumn(
+ name: "EndingMonth",
+ table: "ReadingList");
+
+ migrationBuilder.DropColumn(
+ name: "EndingYear",
+ table: "ReadingList");
+
+ migrationBuilder.DropColumn(
+ name: "StartingMonth",
+ table: "ReadingList");
+
+ migrationBuilder.DropColumn(
+ name: "StartingYear",
+ table: "ReadingList");
+
+ migrationBuilder.AlterColumn<int>(
+ name: "BookReaderWritingStyle",
+ table: "AppUserPreferences",
+ type: "INTEGER",
+ nullable: false,
+ oldClrType: typeof(int),
+ oldType: "INTEGER",
+ oldDefaultValue: 0);
+ }
+ }
+}
diff --git a/API/Data/Migrations/20230316123908_SecurityEvent.Designer.cs b/API/Data/Migrations/20230316123908_SecurityEvent.Designer.cs
new file mode 100644
index 000000000..e0c1b3bfb
--- /dev/null
+++ b/API/Data/Migrations/20230316123908_SecurityEvent.Designer.cs
@@ -0,0 +1,1901 @@
+// <auto-generated />
+using System;
+using API.Data;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace API.Data.Migrations
+{
+ [DbContext(typeof(DataContext))]
+ [Migration("20230316123908_SecurityEvent")]
+ partial class SecurityEvent
+ {
+ /// <inheritdoc />
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder.HasAnnotation("ProductVersion", "7.0.4");
+
+ modelBuilder.Entity("API.Entities.AppRole", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedName")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedName")
+ .IsUnique()
+ .HasDatabaseName("RoleNameIndex");
+
+ b.ToTable("AspNetRoles", (string)null);
+ });
+
+ modelBuilder.Entity("API.Entities.AppUser", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AccessFailedCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AgeRestriction")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("AgeRestrictionIncludeUnknowns")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("ApiKey")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ConfirmationToken")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Email")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("EmailConfirmed")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastActive")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastActiveUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("LockoutEnabled")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTimeOffset?>("LockoutEnd")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedEmail")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedUserName")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property<string>("PasswordHash")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("PhoneNumber")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("PhoneNumberConfirmed")
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .IsConcurrencyToken()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("SecurityStamp")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("TwoFactorEnabled")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("UserName")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedEmail")
+ .HasDatabaseName("EmailIndex");
+
+ b.HasIndex("NormalizedUserName")
+ .IsUnique()
+ .HasDatabaseName("UserNameIndex");
+
+ b.ToTable("AspNetUsers", (string)null);
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserBookmark", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ChapterId")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("FileName")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Page")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("VolumeId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.ToTable("AppUserBookmark");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserPreferences", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("AutoCloseMenu")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("BackgroundColor")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("TEXT")
+ .HasDefaultValue("#000000");
+
+ b.Property<bool>("BlurUnreadSummaries")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("BookReaderFontFamily")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("BookReaderFontSize")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("BookReaderImmersiveMode")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("BookReaderLayoutMode")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("BookReaderLineSpacing")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("BookReaderMargin")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("BookReaderReadingDirection")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("BookReaderTapToPaginate")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("BookReaderWritingStyle")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(0);
+
+ b.Property<string>("BookThemeName")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("TEXT")
+ .HasDefaultValue("Dark");
+
+ b.Property<bool>("CollapseSeriesRelationships")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("EmulateBook")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("GlobalPageLayoutMode")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(0);
+
+ b.Property<int>("LayoutMode")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("NoTransitions")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("PageSplitOption")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("PromptForDownloadSize")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ReaderMode")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ReadingDirection")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ScalingOption")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("ShowScreenHints")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("SwipeToPaginate")
+ .HasColumnType("INTEGER");
+
+ b.Property<int?>("ThemeId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId")
+ .IsUnique();
+
+ b.HasIndex("ThemeId");
+
+ b.ToTable("AppUserPreferences");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserProgress", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("BookScrollId")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("ChapterId")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("LibraryId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("PagesRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("VolumeId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.HasIndex("ChapterId");
+
+ b.HasIndex("SeriesId");
+
+ b.ToTable("AppUserProgresses");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserRating", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Rating")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Review")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.HasIndex("SeriesId");
+
+ b.ToTable("AppUserRating");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserRole", b =>
+ {
+ b.Property<int>("UserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("RoleId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("UserId", "RoleId");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("AspNetUserRoles", (string)null);
+ });
+
+ modelBuilder.Entity("API.Entities.Chapter", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AgeRating")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AlternateCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("AlternateNumber")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("AlternateSeries")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("AvgHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Count")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("CoverImage")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("CoverImageLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("IsSpecial")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Language")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("MaxHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("MinHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Number")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Pages")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Range")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("ReleaseDate")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("SeriesGroup")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("StoryArc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("StoryArcNumber")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Summary")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("TitleName")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("TotalCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("VolumeId")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("WordCount")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("VolumeId");
+
+ b.ToTable("Chapter");
+ });
+
+ modelBuilder.Entity("API.Entities.CollectionTag", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("CoverImage")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("CoverImageLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("NormalizedTitle")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("Promoted")
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Summary")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("Id", "Promoted")
+ .IsUnique();
+
+ b.ToTable("CollectionTag");
+ });
+
+ modelBuilder.Entity("API.Entities.Device", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("EmailAddress")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("IpAddress")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastUsed")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastUsedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Platform")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.ToTable("Device");
+ });
+
+ modelBuilder.Entity("API.Entities.FolderPath", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastScanned")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("LibraryId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Path")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("LibraryId");
+
+ b.ToTable("FolderPath");
+ });
+
+ modelBuilder.Entity("API.Entities.Genre", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("NormalizedTitle")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedTitle")
+ .IsUnique();
+
+ b.ToTable("Genre");
+ });
+
+ modelBuilder.Entity("API.Entities.Library", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("CoverImage")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("FolderWatching")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(true);
+
+ b.Property<bool>("IncludeInDashboard")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(true);
+
+ b.Property<bool>("IncludeInRecommended")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(true);
+
+ b.Property<bool>("IncludeInSearch")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(true);
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastScanned")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("ManageCollections")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(true);
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Type")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.ToTable("Library");
+ });
+
+ modelBuilder.Entity("API.Entities.MangaFile", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("Bytes")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ChapterId")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Extension")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("FilePath")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Format")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastFileAnalysis")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastFileAnalysisUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Pages")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ChapterId");
+
+ b.ToTable("MangaFile");
+ });
+
+ modelBuilder.Entity("API.Entities.Metadata.SeriesMetadata", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AgeRating")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("AgeRatingLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("CharacterLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("ColoristLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("CoverArtistLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("EditorLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("GenresLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("InkerLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Language")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("LanguageLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("LettererLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("MaxCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("PencillerLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("PublicationStatus")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("PublicationStatusLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("PublisherLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ReleaseYear")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("ReleaseYearLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .IsConcurrencyToken()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Summary")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("SummaryLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("TagsLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("TotalCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("TranslatorLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("WriterLocked")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("SeriesId")
+ .IsUnique();
+
+ b.HasIndex("Id", "SeriesId")
+ .IsUnique();
+
+ b.ToTable("SeriesMetadata");
+ });
+
+ modelBuilder.Entity("API.Entities.Metadata.SeriesRelation", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("RelationKind")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("TargetSeriesId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("SeriesId");
+
+ b.HasIndex("TargetSeriesId");
+
+ b.ToTable("SeriesRelation");
+ });
+
+ modelBuilder.Entity("API.Entities.Person", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedName")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Role")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.ToTable("Person");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingList", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AgeRating")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("CoverImage")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("CoverImageLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("EndingMonth")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("EndingYear")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedTitle")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("Promoted")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("StartingMonth")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("StartingYear")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Summary")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.ToTable("ReadingList");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingListItem", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ChapterId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Order")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ReadingListId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("VolumeId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ChapterId");
+
+ b.HasIndex("ReadingListId");
+
+ b.HasIndex("SeriesId");
+
+ b.HasIndex("VolumeId");
+
+ b.ToTable("ReadingListItem");
+ });
+
+ modelBuilder.Entity("API.Entities.SecurityEvent", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("CreatedAt")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedAtUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("IpAddress")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("RequestMethod")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("RequestPath")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("UserAgent")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.ToTable("SecurityEvent");
+ });
+
+ modelBuilder.Entity("API.Entities.Series", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int?>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AvgHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("CoverImage")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("CoverImageLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("FolderPath")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Format")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastChapterAdded")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastChapterAddedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastFolderScanned")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastFolderScannedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("LibraryId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("LocalizedName")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("LocalizedNameLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("MaxHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("MinHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("NameLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("NormalizedLocalizedName")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedName")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("OriginalName")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Pages")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("SortName")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("SortNameLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("WordCount")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.HasIndex("LibraryId");
+
+ b.ToTable("Series");
+ });
+
+ modelBuilder.Entity("API.Entities.ServerSetting", b =>
+ {
+ b.Property<int>("Key")
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .IsConcurrencyToken()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Value")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Key");
+
+ b.ToTable("ServerSetting");
+ });
+
+ modelBuilder.Entity("API.Entities.ServerStatistics", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("ChapterCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("FileCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("GenreCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("PersonCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("SeriesCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("TagCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("UserCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("VolumeCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Year")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.ToTable("ServerStatistics");
+ });
+
+ modelBuilder.Entity("API.Entities.SiteTheme", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("FileName")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("IsDefault")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedName")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Provider")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.ToTable("SiteTheme");
+ });
+
+ modelBuilder.Entity("API.Entities.Tag", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("NormalizedTitle")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedTitle")
+ .IsUnique();
+
+ b.ToTable("Tag");
+ });
+
+ modelBuilder.Entity("API.Entities.Volume", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AvgHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("CoverImage")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("MaxHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("MinHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Number")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Pages")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("WordCount")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("SeriesId");
+
+ b.ToTable("Volume");
+ });
+
+ modelBuilder.Entity("AppUserLibrary", b =>
+ {
+ b.Property<int>("AppUsersId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("LibrariesId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("AppUsersId", "LibrariesId");
+
+ b.HasIndex("LibrariesId");
+
+ b.ToTable("AppUserLibrary");
+ });
+
+ modelBuilder.Entity("ChapterGenre", b =>
+ {
+ b.Property<int>("ChaptersId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("GenresId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("ChaptersId", "GenresId");
+
+ b.HasIndex("GenresId");
+
+ b.ToTable("ChapterGenre");
+ });
+
+ modelBuilder.Entity("ChapterPerson", b =>
+ {
+ b.Property<int>("ChapterMetadatasId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("PeopleId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("ChapterMetadatasId", "PeopleId");
+
+ b.HasIndex("PeopleId");
+
+ b.ToTable("ChapterPerson");
+ });
+
+ modelBuilder.Entity("ChapterTag", b =>
+ {
+ b.Property<int>("ChaptersId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("TagsId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("ChaptersId", "TagsId");
+
+ b.HasIndex("TagsId");
+
+ b.ToTable("ChapterTag");
+ });
+
+ modelBuilder.Entity("CollectionTagSeriesMetadata", b =>
+ {
+ b.Property<int>("CollectionTagsId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesMetadatasId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("CollectionTagsId", "SeriesMetadatasId");
+
+ b.HasIndex("SeriesMetadatasId");
+
+ b.ToTable("CollectionTagSeriesMetadata");
+ });
+
+ modelBuilder.Entity("GenreSeriesMetadata", b =>
+ {
+ b.Property<int>("GenresId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesMetadatasId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("GenresId", "SeriesMetadatasId");
+
+ b.HasIndex("SeriesMetadatasId");
+
+ b.ToTable("GenreSeriesMetadata");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("ClaimType")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ClaimValue")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("RoleId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("AspNetRoleClaims", (string)null);
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("ClaimType")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ClaimValue")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("UserId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AspNetUserClaims", (string)null);
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
+ {
+ b.Property<string>("LoginProvider")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ProviderKey")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ProviderDisplayName")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("UserId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("LoginProvider", "ProviderKey");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AspNetUserLogins", (string)null);
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<int>", b =>
+ {
+ b.Property<int>("UserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("LoginProvider")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Value")
+ .HasColumnType("TEXT");
+
+ b.HasKey("UserId", "LoginProvider", "Name");
+
+ b.ToTable("AspNetUserTokens", (string)null);
+ });
+
+ modelBuilder.Entity("PersonSeriesMetadata", b =>
+ {
+ b.Property<int>("PeopleId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesMetadatasId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("PeopleId", "SeriesMetadatasId");
+
+ b.HasIndex("SeriesMetadatasId");
+
+ b.ToTable("PersonSeriesMetadata");
+ });
+
+ modelBuilder.Entity("SeriesMetadataTag", b =>
+ {
+ b.Property<int>("SeriesMetadatasId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("TagsId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("SeriesMetadatasId", "TagsId");
+
+ b.HasIndex("TagsId");
+
+ b.ToTable("SeriesMetadataTag");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserBookmark", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("Bookmarks")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserPreferences", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithOne("UserPreferences")
+ .HasForeignKey("API.Entities.AppUserPreferences", "AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.SiteTheme", "Theme")
+ .WithMany()
+ .HasForeignKey("ThemeId");
+
+ b.Navigation("AppUser");
+
+ b.Navigation("Theme");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserProgress", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("Progresses")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Chapter", null)
+ .WithMany("UserProgress")
+ .HasForeignKey("ChapterId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Series", null)
+ .WithMany("Progress")
+ .HasForeignKey("SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserRating", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("Ratings")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Series", null)
+ .WithMany("Ratings")
+ .HasForeignKey("SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserRole", b =>
+ {
+ b.HasOne("API.Entities.AppRole", "Role")
+ .WithMany("UserRoles")
+ .HasForeignKey("RoleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.AppUser", "User")
+ .WithMany("UserRoles")
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Role");
+
+ b.Navigation("User");
+ });
+
+ modelBuilder.Entity("API.Entities.Chapter", b =>
+ {
+ b.HasOne("API.Entities.Volume", "Volume")
+ .WithMany("Chapters")
+ .HasForeignKey("VolumeId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Volume");
+ });
+
+ modelBuilder.Entity("API.Entities.Device", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("Devices")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.FolderPath", b =>
+ {
+ b.HasOne("API.Entities.Library", "Library")
+ .WithMany("Folders")
+ .HasForeignKey("LibraryId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Library");
+ });
+
+ modelBuilder.Entity("API.Entities.MangaFile", b =>
+ {
+ b.HasOne("API.Entities.Chapter", "Chapter")
+ .WithMany("Files")
+ .HasForeignKey("ChapterId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Chapter");
+ });
+
+ modelBuilder.Entity("API.Entities.Metadata.SeriesMetadata", b =>
+ {
+ b.HasOne("API.Entities.Series", "Series")
+ .WithOne("Metadata")
+ .HasForeignKey("API.Entities.Metadata.SeriesMetadata", "SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Series");
+ });
+
+ modelBuilder.Entity("API.Entities.Metadata.SeriesRelation", b =>
+ {
+ b.HasOne("API.Entities.Series", "Series")
+ .WithMany("Relations")
+ .HasForeignKey("SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Series", "TargetSeries")
+ .WithMany("RelationOf")
+ .HasForeignKey("TargetSeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Series");
+
+ b.Navigation("TargetSeries");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingList", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("ReadingLists")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingListItem", b =>
+ {
+ b.HasOne("API.Entities.Chapter", "Chapter")
+ .WithMany()
+ .HasForeignKey("ChapterId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.ReadingList", "ReadingList")
+ .WithMany("Items")
+ .HasForeignKey("ReadingListId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Series", "Series")
+ .WithMany()
+ .HasForeignKey("SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Volume", "Volume")
+ .WithMany()
+ .HasForeignKey("VolumeId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Chapter");
+
+ b.Navigation("ReadingList");
+
+ b.Navigation("Series");
+
+ b.Navigation("Volume");
+ });
+
+ modelBuilder.Entity("API.Entities.Series", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany("WantToRead")
+ .HasForeignKey("AppUserId");
+
+ b.HasOne("API.Entities.Library", "Library")
+ .WithMany("Series")
+ .HasForeignKey("LibraryId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Library");
+ });
+
+ modelBuilder.Entity("API.Entities.Volume", b =>
+ {
+ b.HasOne("API.Entities.Series", "Series")
+ .WithMany("Volumes")
+ .HasForeignKey("SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Series");
+ });
+
+ modelBuilder.Entity("AppUserLibrary", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany()
+ .HasForeignKey("AppUsersId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Library", null)
+ .WithMany()
+ .HasForeignKey("LibrariesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("ChapterGenre", b =>
+ {
+ b.HasOne("API.Entities.Chapter", null)
+ .WithMany()
+ .HasForeignKey("ChaptersId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Genre", null)
+ .WithMany()
+ .HasForeignKey("GenresId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("ChapterPerson", b =>
+ {
+ b.HasOne("API.Entities.Chapter", null)
+ .WithMany()
+ .HasForeignKey("ChapterMetadatasId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Person", null)
+ .WithMany()
+ .HasForeignKey("PeopleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("ChapterTag", b =>
+ {
+ b.HasOne("API.Entities.Chapter", null)
+ .WithMany()
+ .HasForeignKey("ChaptersId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Tag", null)
+ .WithMany()
+ .HasForeignKey("TagsId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("CollectionTagSeriesMetadata", b =>
+ {
+ b.HasOne("API.Entities.CollectionTag", null)
+ .WithMany()
+ .HasForeignKey("CollectionTagsId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Metadata.SeriesMetadata", null)
+ .WithMany()
+ .HasForeignKey("SeriesMetadatasId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("GenreSeriesMetadata", b =>
+ {
+ b.HasOne("API.Entities.Genre", null)
+ .WithMany()
+ .HasForeignKey("GenresId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Metadata.SeriesMetadata", null)
+ .WithMany()
+ .HasForeignKey("SeriesMetadatasId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
+ {
+ b.HasOne("API.Entities.AppRole", null)
+ .WithMany()
+ .HasForeignKey("RoleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<int>", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("PersonSeriesMetadata", b =>
+ {
+ b.HasOne("API.Entities.Person", null)
+ .WithMany()
+ .HasForeignKey("PeopleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Metadata.SeriesMetadata", null)
+ .WithMany()
+ .HasForeignKey("SeriesMetadatasId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("SeriesMetadataTag", b =>
+ {
+ b.HasOne("API.Entities.Metadata.SeriesMetadata", null)
+ .WithMany()
+ .HasForeignKey("SeriesMetadatasId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Tag", null)
+ .WithMany()
+ .HasForeignKey("TagsId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("API.Entities.AppRole", b =>
+ {
+ b.Navigation("UserRoles");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUser", b =>
+ {
+ b.Navigation("Bookmarks");
+
+ b.Navigation("Devices");
+
+ b.Navigation("Progresses");
+
+ b.Navigation("Ratings");
+
+ b.Navigation("ReadingLists");
+
+ b.Navigation("UserPreferences");
+
+ b.Navigation("UserRoles");
+
+ b.Navigation("WantToRead");
+ });
+
+ modelBuilder.Entity("API.Entities.Chapter", b =>
+ {
+ b.Navigation("Files");
+
+ b.Navigation("UserProgress");
+ });
+
+ modelBuilder.Entity("API.Entities.Library", b =>
+ {
+ b.Navigation("Folders");
+
+ b.Navigation("Series");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingList", b =>
+ {
+ b.Navigation("Items");
+ });
+
+ modelBuilder.Entity("API.Entities.Series", b =>
+ {
+ b.Navigation("Metadata");
+
+ b.Navigation("Progress");
+
+ b.Navigation("Ratings");
+
+ b.Navigation("RelationOf");
+
+ b.Navigation("Relations");
+
+ b.Navigation("Volumes");
+ });
+
+ modelBuilder.Entity("API.Entities.Volume", b =>
+ {
+ b.Navigation("Chapters");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/API/Data/Migrations/20230316123908_SecurityEvent.cs b/API/Data/Migrations/20230316123908_SecurityEvent.cs
new file mode 100644
index 000000000..ec4eab520
--- /dev/null
+++ b/API/Data/Migrations/20230316123908_SecurityEvent.cs
@@ -0,0 +1,40 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace API.Data.Migrations
+{
+ /// <inheritdoc />
+ public partial class SecurityEvent : Migration
+ {
+ /// <inheritdoc />
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateTable(
+ name: "SecurityEvent",
+ columns: table => new
+ {
+ Id = table.Column<int>(type: "INTEGER", nullable: false)
+ .Annotation("Sqlite:Autoincrement", true),
+ IpAddress = table.Column<string>(type: "TEXT", nullable: true),
+ RequestMethod = table.Column<string>(type: "TEXT", nullable: true),
+ RequestPath = table.Column<string>(type: "TEXT", nullable: true),
+ UserAgent = table.Column<string>(type: "TEXT", nullable: true),
+ CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false),
+ CreatedAtUtc = table.Column<DateTime>(type: "TEXT", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_SecurityEvent", x => x.Id);
+ });
+ }
+
+ /// <inheritdoc />
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "SecurityEvent");
+ }
+ }
+}
diff --git a/API/Data/Migrations/20230316233133_RemoveSecurityEvent.Designer.cs b/API/Data/Migrations/20230316233133_RemoveSecurityEvent.Designer.cs
new file mode 100644
index 000000000..f6da45449
--- /dev/null
+++ b/API/Data/Migrations/20230316233133_RemoveSecurityEvent.Designer.cs
@@ -0,0 +1,1872 @@
+// <auto-generated />
+using System;
+using API.Data;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace API.Data.Migrations
+{
+ [DbContext(typeof(DataContext))]
+ [Migration("20230316233133_RemoveSecurityEvent")]
+ partial class RemoveSecurityEvent
+ {
+ /// <inheritdoc />
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder.HasAnnotation("ProductVersion", "7.0.4");
+
+ modelBuilder.Entity("API.Entities.AppRole", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedName")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedName")
+ .IsUnique()
+ .HasDatabaseName("RoleNameIndex");
+
+ b.ToTable("AspNetRoles", (string)null);
+ });
+
+ modelBuilder.Entity("API.Entities.AppUser", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AccessFailedCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AgeRestriction")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("AgeRestrictionIncludeUnknowns")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("ApiKey")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ConfirmationToken")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Email")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("EmailConfirmed")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastActive")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastActiveUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("LockoutEnabled")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTimeOffset?>("LockoutEnd")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedEmail")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedUserName")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property<string>("PasswordHash")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("PhoneNumber")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("PhoneNumberConfirmed")
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .IsConcurrencyToken()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("SecurityStamp")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("TwoFactorEnabled")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("UserName")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedEmail")
+ .HasDatabaseName("EmailIndex");
+
+ b.HasIndex("NormalizedUserName")
+ .IsUnique()
+ .HasDatabaseName("UserNameIndex");
+
+ b.ToTable("AspNetUsers", (string)null);
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserBookmark", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ChapterId")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("FileName")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Page")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("VolumeId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.ToTable("AppUserBookmark");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserPreferences", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("AutoCloseMenu")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("BackgroundColor")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("TEXT")
+ .HasDefaultValue("#000000");
+
+ b.Property<bool>("BlurUnreadSummaries")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("BookReaderFontFamily")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("BookReaderFontSize")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("BookReaderImmersiveMode")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("BookReaderLayoutMode")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("BookReaderLineSpacing")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("BookReaderMargin")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("BookReaderReadingDirection")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("BookReaderTapToPaginate")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("BookReaderWritingStyle")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(0);
+
+ b.Property<string>("BookThemeName")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("TEXT")
+ .HasDefaultValue("Dark");
+
+ b.Property<bool>("CollapseSeriesRelationships")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("EmulateBook")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("GlobalPageLayoutMode")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(0);
+
+ b.Property<int>("LayoutMode")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("NoTransitions")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("PageSplitOption")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("PromptForDownloadSize")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ReaderMode")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ReadingDirection")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ScalingOption")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("ShowScreenHints")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("SwipeToPaginate")
+ .HasColumnType("INTEGER");
+
+ b.Property<int?>("ThemeId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId")
+ .IsUnique();
+
+ b.HasIndex("ThemeId");
+
+ b.ToTable("AppUserPreferences");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserProgress", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("BookScrollId")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("ChapterId")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("LibraryId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("PagesRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("VolumeId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.HasIndex("ChapterId");
+
+ b.HasIndex("SeriesId");
+
+ b.ToTable("AppUserProgresses");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserRating", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Rating")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Review")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.HasIndex("SeriesId");
+
+ b.ToTable("AppUserRating");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserRole", b =>
+ {
+ b.Property<int>("UserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("RoleId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("UserId", "RoleId");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("AspNetUserRoles", (string)null);
+ });
+
+ modelBuilder.Entity("API.Entities.Chapter", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AgeRating")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AlternateCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("AlternateNumber")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("AlternateSeries")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("AvgHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Count")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("CoverImage")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("CoverImageLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("IsSpecial")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Language")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("MaxHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("MinHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Number")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Pages")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Range")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("ReleaseDate")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("SeriesGroup")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("StoryArc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("StoryArcNumber")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Summary")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("TitleName")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("TotalCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("VolumeId")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("WordCount")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("VolumeId");
+
+ b.ToTable("Chapter");
+ });
+
+ modelBuilder.Entity("API.Entities.CollectionTag", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("CoverImage")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("CoverImageLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("NormalizedTitle")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("Promoted")
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Summary")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("Id", "Promoted")
+ .IsUnique();
+
+ b.ToTable("CollectionTag");
+ });
+
+ modelBuilder.Entity("API.Entities.Device", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("EmailAddress")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("IpAddress")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastUsed")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastUsedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Platform")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.ToTable("Device");
+ });
+
+ modelBuilder.Entity("API.Entities.FolderPath", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastScanned")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("LibraryId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Path")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("LibraryId");
+
+ b.ToTable("FolderPath");
+ });
+
+ modelBuilder.Entity("API.Entities.Genre", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("NormalizedTitle")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedTitle")
+ .IsUnique();
+
+ b.ToTable("Genre");
+ });
+
+ modelBuilder.Entity("API.Entities.Library", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("CoverImage")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("FolderWatching")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(true);
+
+ b.Property<bool>("IncludeInDashboard")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(true);
+
+ b.Property<bool>("IncludeInRecommended")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(true);
+
+ b.Property<bool>("IncludeInSearch")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(true);
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastScanned")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("ManageCollections")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(true);
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Type")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.ToTable("Library");
+ });
+
+ modelBuilder.Entity("API.Entities.MangaFile", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("Bytes")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ChapterId")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Extension")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("FilePath")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Format")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastFileAnalysis")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastFileAnalysisUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Pages")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ChapterId");
+
+ b.ToTable("MangaFile");
+ });
+
+ modelBuilder.Entity("API.Entities.Metadata.SeriesMetadata", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AgeRating")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("AgeRatingLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("CharacterLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("ColoristLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("CoverArtistLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("EditorLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("GenresLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("InkerLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Language")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("LanguageLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("LettererLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("MaxCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("PencillerLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("PublicationStatus")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("PublicationStatusLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("PublisherLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ReleaseYear")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("ReleaseYearLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .IsConcurrencyToken()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Summary")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("SummaryLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("TagsLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("TotalCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("TranslatorLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("WriterLocked")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("SeriesId")
+ .IsUnique();
+
+ b.HasIndex("Id", "SeriesId")
+ .IsUnique();
+
+ b.ToTable("SeriesMetadata");
+ });
+
+ modelBuilder.Entity("API.Entities.Metadata.SeriesRelation", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("RelationKind")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("TargetSeriesId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("SeriesId");
+
+ b.HasIndex("TargetSeriesId");
+
+ b.ToTable("SeriesRelation");
+ });
+
+ modelBuilder.Entity("API.Entities.Person", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedName")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Role")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.ToTable("Person");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingList", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AgeRating")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("CoverImage")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("CoverImageLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("EndingMonth")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("EndingYear")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedTitle")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("Promoted")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("StartingMonth")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("StartingYear")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Summary")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.ToTable("ReadingList");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingListItem", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ChapterId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Order")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ReadingListId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("VolumeId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ChapterId");
+
+ b.HasIndex("ReadingListId");
+
+ b.HasIndex("SeriesId");
+
+ b.HasIndex("VolumeId");
+
+ b.ToTable("ReadingListItem");
+ });
+
+ modelBuilder.Entity("API.Entities.Series", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int?>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AvgHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("CoverImage")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("CoverImageLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("FolderPath")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Format")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastChapterAdded")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastChapterAddedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastFolderScanned")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastFolderScannedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("LibraryId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("LocalizedName")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("LocalizedNameLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("MaxHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("MinHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("NameLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("NormalizedLocalizedName")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedName")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("OriginalName")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Pages")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("SortName")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("SortNameLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("WordCount")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.HasIndex("LibraryId");
+
+ b.ToTable("Series");
+ });
+
+ modelBuilder.Entity("API.Entities.ServerSetting", b =>
+ {
+ b.Property<int>("Key")
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .IsConcurrencyToken()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Value")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Key");
+
+ b.ToTable("ServerSetting");
+ });
+
+ modelBuilder.Entity("API.Entities.ServerStatistics", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("ChapterCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("FileCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("GenreCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("PersonCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("SeriesCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("TagCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("UserCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("VolumeCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Year")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.ToTable("ServerStatistics");
+ });
+
+ modelBuilder.Entity("API.Entities.SiteTheme", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("FileName")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("IsDefault")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedName")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Provider")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.ToTable("SiteTheme");
+ });
+
+ modelBuilder.Entity("API.Entities.Tag", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("NormalizedTitle")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedTitle")
+ .IsUnique();
+
+ b.ToTable("Tag");
+ });
+
+ modelBuilder.Entity("API.Entities.Volume", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AvgHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("CoverImage")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("MaxHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("MinHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Number")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Pages")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("WordCount")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("SeriesId");
+
+ b.ToTable("Volume");
+ });
+
+ modelBuilder.Entity("AppUserLibrary", b =>
+ {
+ b.Property<int>("AppUsersId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("LibrariesId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("AppUsersId", "LibrariesId");
+
+ b.HasIndex("LibrariesId");
+
+ b.ToTable("AppUserLibrary");
+ });
+
+ modelBuilder.Entity("ChapterGenre", b =>
+ {
+ b.Property<int>("ChaptersId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("GenresId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("ChaptersId", "GenresId");
+
+ b.HasIndex("GenresId");
+
+ b.ToTable("ChapterGenre");
+ });
+
+ modelBuilder.Entity("ChapterPerson", b =>
+ {
+ b.Property<int>("ChapterMetadatasId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("PeopleId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("ChapterMetadatasId", "PeopleId");
+
+ b.HasIndex("PeopleId");
+
+ b.ToTable("ChapterPerson");
+ });
+
+ modelBuilder.Entity("ChapterTag", b =>
+ {
+ b.Property<int>("ChaptersId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("TagsId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("ChaptersId", "TagsId");
+
+ b.HasIndex("TagsId");
+
+ b.ToTable("ChapterTag");
+ });
+
+ modelBuilder.Entity("CollectionTagSeriesMetadata", b =>
+ {
+ b.Property<int>("CollectionTagsId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesMetadatasId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("CollectionTagsId", "SeriesMetadatasId");
+
+ b.HasIndex("SeriesMetadatasId");
+
+ b.ToTable("CollectionTagSeriesMetadata");
+ });
+
+ modelBuilder.Entity("GenreSeriesMetadata", b =>
+ {
+ b.Property<int>("GenresId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesMetadatasId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("GenresId", "SeriesMetadatasId");
+
+ b.HasIndex("SeriesMetadatasId");
+
+ b.ToTable("GenreSeriesMetadata");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("ClaimType")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ClaimValue")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("RoleId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("AspNetRoleClaims", (string)null);
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("ClaimType")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ClaimValue")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("UserId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AspNetUserClaims", (string)null);
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
+ {
+ b.Property<string>("LoginProvider")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ProviderKey")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ProviderDisplayName")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("UserId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("LoginProvider", "ProviderKey");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AspNetUserLogins", (string)null);
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<int>", b =>
+ {
+ b.Property<int>("UserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("LoginProvider")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Value")
+ .HasColumnType("TEXT");
+
+ b.HasKey("UserId", "LoginProvider", "Name");
+
+ b.ToTable("AspNetUserTokens", (string)null);
+ });
+
+ modelBuilder.Entity("PersonSeriesMetadata", b =>
+ {
+ b.Property<int>("PeopleId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesMetadatasId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("PeopleId", "SeriesMetadatasId");
+
+ b.HasIndex("SeriesMetadatasId");
+
+ b.ToTable("PersonSeriesMetadata");
+ });
+
+ modelBuilder.Entity("SeriesMetadataTag", b =>
+ {
+ b.Property<int>("SeriesMetadatasId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("TagsId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("SeriesMetadatasId", "TagsId");
+
+ b.HasIndex("TagsId");
+
+ b.ToTable("SeriesMetadataTag");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserBookmark", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("Bookmarks")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserPreferences", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithOne("UserPreferences")
+ .HasForeignKey("API.Entities.AppUserPreferences", "AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.SiteTheme", "Theme")
+ .WithMany()
+ .HasForeignKey("ThemeId");
+
+ b.Navigation("AppUser");
+
+ b.Navigation("Theme");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserProgress", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("Progresses")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Chapter", null)
+ .WithMany("UserProgress")
+ .HasForeignKey("ChapterId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Series", null)
+ .WithMany("Progress")
+ .HasForeignKey("SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserRating", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("Ratings")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Series", null)
+ .WithMany("Ratings")
+ .HasForeignKey("SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserRole", b =>
+ {
+ b.HasOne("API.Entities.AppRole", "Role")
+ .WithMany("UserRoles")
+ .HasForeignKey("RoleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.AppUser", "User")
+ .WithMany("UserRoles")
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Role");
+
+ b.Navigation("User");
+ });
+
+ modelBuilder.Entity("API.Entities.Chapter", b =>
+ {
+ b.HasOne("API.Entities.Volume", "Volume")
+ .WithMany("Chapters")
+ .HasForeignKey("VolumeId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Volume");
+ });
+
+ modelBuilder.Entity("API.Entities.Device", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("Devices")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.FolderPath", b =>
+ {
+ b.HasOne("API.Entities.Library", "Library")
+ .WithMany("Folders")
+ .HasForeignKey("LibraryId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Library");
+ });
+
+ modelBuilder.Entity("API.Entities.MangaFile", b =>
+ {
+ b.HasOne("API.Entities.Chapter", "Chapter")
+ .WithMany("Files")
+ .HasForeignKey("ChapterId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Chapter");
+ });
+
+ modelBuilder.Entity("API.Entities.Metadata.SeriesMetadata", b =>
+ {
+ b.HasOne("API.Entities.Series", "Series")
+ .WithOne("Metadata")
+ .HasForeignKey("API.Entities.Metadata.SeriesMetadata", "SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Series");
+ });
+
+ modelBuilder.Entity("API.Entities.Metadata.SeriesRelation", b =>
+ {
+ b.HasOne("API.Entities.Series", "Series")
+ .WithMany("Relations")
+ .HasForeignKey("SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Series", "TargetSeries")
+ .WithMany("RelationOf")
+ .HasForeignKey("TargetSeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Series");
+
+ b.Navigation("TargetSeries");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingList", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("ReadingLists")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingListItem", b =>
+ {
+ b.HasOne("API.Entities.Chapter", "Chapter")
+ .WithMany()
+ .HasForeignKey("ChapterId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.ReadingList", "ReadingList")
+ .WithMany("Items")
+ .HasForeignKey("ReadingListId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Series", "Series")
+ .WithMany()
+ .HasForeignKey("SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Volume", "Volume")
+ .WithMany()
+ .HasForeignKey("VolumeId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Chapter");
+
+ b.Navigation("ReadingList");
+
+ b.Navigation("Series");
+
+ b.Navigation("Volume");
+ });
+
+ modelBuilder.Entity("API.Entities.Series", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany("WantToRead")
+ .HasForeignKey("AppUserId");
+
+ b.HasOne("API.Entities.Library", "Library")
+ .WithMany("Series")
+ .HasForeignKey("LibraryId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Library");
+ });
+
+ modelBuilder.Entity("API.Entities.Volume", b =>
+ {
+ b.HasOne("API.Entities.Series", "Series")
+ .WithMany("Volumes")
+ .HasForeignKey("SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Series");
+ });
+
+ modelBuilder.Entity("AppUserLibrary", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany()
+ .HasForeignKey("AppUsersId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Library", null)
+ .WithMany()
+ .HasForeignKey("LibrariesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("ChapterGenre", b =>
+ {
+ b.HasOne("API.Entities.Chapter", null)
+ .WithMany()
+ .HasForeignKey("ChaptersId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Genre", null)
+ .WithMany()
+ .HasForeignKey("GenresId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("ChapterPerson", b =>
+ {
+ b.HasOne("API.Entities.Chapter", null)
+ .WithMany()
+ .HasForeignKey("ChapterMetadatasId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Person", null)
+ .WithMany()
+ .HasForeignKey("PeopleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("ChapterTag", b =>
+ {
+ b.HasOne("API.Entities.Chapter", null)
+ .WithMany()
+ .HasForeignKey("ChaptersId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Tag", null)
+ .WithMany()
+ .HasForeignKey("TagsId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("CollectionTagSeriesMetadata", b =>
+ {
+ b.HasOne("API.Entities.CollectionTag", null)
+ .WithMany()
+ .HasForeignKey("CollectionTagsId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Metadata.SeriesMetadata", null)
+ .WithMany()
+ .HasForeignKey("SeriesMetadatasId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("GenreSeriesMetadata", b =>
+ {
+ b.HasOne("API.Entities.Genre", null)
+ .WithMany()
+ .HasForeignKey("GenresId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Metadata.SeriesMetadata", null)
+ .WithMany()
+ .HasForeignKey("SeriesMetadatasId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
+ {
+ b.HasOne("API.Entities.AppRole", null)
+ .WithMany()
+ .HasForeignKey("RoleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<int>", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("PersonSeriesMetadata", b =>
+ {
+ b.HasOne("API.Entities.Person", null)
+ .WithMany()
+ .HasForeignKey("PeopleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Metadata.SeriesMetadata", null)
+ .WithMany()
+ .HasForeignKey("SeriesMetadatasId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("SeriesMetadataTag", b =>
+ {
+ b.HasOne("API.Entities.Metadata.SeriesMetadata", null)
+ .WithMany()
+ .HasForeignKey("SeriesMetadatasId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Tag", null)
+ .WithMany()
+ .HasForeignKey("TagsId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("API.Entities.AppRole", b =>
+ {
+ b.Navigation("UserRoles");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUser", b =>
+ {
+ b.Navigation("Bookmarks");
+
+ b.Navigation("Devices");
+
+ b.Navigation("Progresses");
+
+ b.Navigation("Ratings");
+
+ b.Navigation("ReadingLists");
+
+ b.Navigation("UserPreferences");
+
+ b.Navigation("UserRoles");
+
+ b.Navigation("WantToRead");
+ });
+
+ modelBuilder.Entity("API.Entities.Chapter", b =>
+ {
+ b.Navigation("Files");
+
+ b.Navigation("UserProgress");
+ });
+
+ modelBuilder.Entity("API.Entities.Library", b =>
+ {
+ b.Navigation("Folders");
+
+ b.Navigation("Series");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingList", b =>
+ {
+ b.Navigation("Items");
+ });
+
+ modelBuilder.Entity("API.Entities.Series", b =>
+ {
+ b.Navigation("Metadata");
+
+ b.Navigation("Progress");
+
+ b.Navigation("Ratings");
+
+ b.Navigation("RelationOf");
+
+ b.Navigation("Relations");
+
+ b.Navigation("Volumes");
+ });
+
+ modelBuilder.Entity("API.Entities.Volume", b =>
+ {
+ b.Navigation("Chapters");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/API/Data/Migrations/20230316233133_RemoveSecurityEvent.cs b/API/Data/Migrations/20230316233133_RemoveSecurityEvent.cs
new file mode 100644
index 000000000..d0d4c5c73
--- /dev/null
+++ b/API/Data/Migrations/20230316233133_RemoveSecurityEvent.cs
@@ -0,0 +1,40 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace API.Data.Migrations
+{
+ /// <inheritdoc />
+ public partial class RemoveSecurityEvent : Migration
+ {
+ /// <inheritdoc />
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "SecurityEvent");
+ }
+
+ /// <inheritdoc />
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateTable(
+ name: "SecurityEvent",
+ columns: table => new
+ {
+ Id = table.Column<int>(type: "INTEGER", nullable: false)
+ .Annotation("Sqlite:Autoincrement", true),
+ CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false),
+ CreatedAtUtc = table.Column<DateTime>(type: "TEXT", nullable: false),
+ IpAddress = table.Column<string>(type: "TEXT", nullable: true),
+ RequestMethod = table.Column<string>(type: "TEXT", nullable: true),
+ RequestPath = table.Column<string>(type: "TEXT", nullable: true),
+ UserAgent = table.Column<string>(type: "TEXT", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_SecurityEvent", x => x.Id);
+ });
+ }
+ }
+}
diff --git a/API/Data/Migrations/20230415123449_ManageReadingListOnLibrary.Designer.cs b/API/Data/Migrations/20230415123449_ManageReadingListOnLibrary.Designer.cs
new file mode 100644
index 000000000..3ef88948b
--- /dev/null
+++ b/API/Data/Migrations/20230415123449_ManageReadingListOnLibrary.Designer.cs
@@ -0,0 +1,1877 @@
+// <auto-generated />
+using System;
+using API.Data;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace API.Data.Migrations
+{
+ [DbContext(typeof(DataContext))]
+ [Migration("20230415123449_ManageReadingListOnLibrary")]
+ partial class ManageReadingListOnLibrary
+ {
+ /// <inheritdoc />
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder.HasAnnotation("ProductVersion", "7.0.5");
+
+ modelBuilder.Entity("API.Entities.AppRole", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedName")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedName")
+ .IsUnique()
+ .HasDatabaseName("RoleNameIndex");
+
+ b.ToTable("AspNetRoles", (string)null);
+ });
+
+ modelBuilder.Entity("API.Entities.AppUser", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AccessFailedCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AgeRestriction")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("AgeRestrictionIncludeUnknowns")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("ApiKey")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ConfirmationToken")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Email")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("EmailConfirmed")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastActive")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastActiveUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("LockoutEnabled")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTimeOffset?>("LockoutEnd")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedEmail")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedUserName")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.Property<string>("PasswordHash")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("PhoneNumber")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("PhoneNumberConfirmed")
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .IsConcurrencyToken()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("SecurityStamp")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("TwoFactorEnabled")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("UserName")
+ .HasMaxLength(256)
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedEmail")
+ .HasDatabaseName("EmailIndex");
+
+ b.HasIndex("NormalizedUserName")
+ .IsUnique()
+ .HasDatabaseName("UserNameIndex");
+
+ b.ToTable("AspNetUsers", (string)null);
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserBookmark", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ChapterId")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("FileName")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Page")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("VolumeId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.ToTable("AppUserBookmark");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserPreferences", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("AutoCloseMenu")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("BackgroundColor")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("TEXT")
+ .HasDefaultValue("#000000");
+
+ b.Property<bool>("BlurUnreadSummaries")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("BookReaderFontFamily")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("BookReaderFontSize")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("BookReaderImmersiveMode")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("BookReaderLayoutMode")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("BookReaderLineSpacing")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("BookReaderMargin")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("BookReaderReadingDirection")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("BookReaderTapToPaginate")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("BookReaderWritingStyle")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(0);
+
+ b.Property<string>("BookThemeName")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("TEXT")
+ .HasDefaultValue("Dark");
+
+ b.Property<bool>("CollapseSeriesRelationships")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("EmulateBook")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("GlobalPageLayoutMode")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(0);
+
+ b.Property<int>("LayoutMode")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("NoTransitions")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("PageSplitOption")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("PromptForDownloadSize")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ReaderMode")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ReadingDirection")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ScalingOption")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("ShowScreenHints")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("SwipeToPaginate")
+ .HasColumnType("INTEGER");
+
+ b.Property<int?>("ThemeId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId")
+ .IsUnique();
+
+ b.HasIndex("ThemeId");
+
+ b.ToTable("AppUserPreferences");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserProgress", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("BookScrollId")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("ChapterId")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("LibraryId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("PagesRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("VolumeId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.HasIndex("ChapterId");
+
+ b.HasIndex("SeriesId");
+
+ b.ToTable("AppUserProgresses");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserRating", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Rating")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Review")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.HasIndex("SeriesId");
+
+ b.ToTable("AppUserRating");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserRole", b =>
+ {
+ b.Property<int>("UserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("RoleId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("UserId", "RoleId");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("AspNetUserRoles", (string)null);
+ });
+
+ modelBuilder.Entity("API.Entities.Chapter", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AgeRating")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AlternateCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("AlternateNumber")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("AlternateSeries")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("AvgHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Count")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("CoverImage")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("CoverImageLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("IsSpecial")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Language")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("MaxHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("MinHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Number")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Pages")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Range")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("ReleaseDate")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("SeriesGroup")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("StoryArc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("StoryArcNumber")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Summary")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("TitleName")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("TotalCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("VolumeId")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("WordCount")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("VolumeId");
+
+ b.ToTable("Chapter");
+ });
+
+ modelBuilder.Entity("API.Entities.CollectionTag", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("CoverImage")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("CoverImageLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("NormalizedTitle")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("Promoted")
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Summary")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("Id", "Promoted")
+ .IsUnique();
+
+ b.ToTable("CollectionTag");
+ });
+
+ modelBuilder.Entity("API.Entities.Device", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("EmailAddress")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("IpAddress")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastUsed")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastUsedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Platform")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.ToTable("Device");
+ });
+
+ modelBuilder.Entity("API.Entities.FolderPath", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastScanned")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("LibraryId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Path")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("LibraryId");
+
+ b.ToTable("FolderPath");
+ });
+
+ modelBuilder.Entity("API.Entities.Genre", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("NormalizedTitle")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedTitle")
+ .IsUnique();
+
+ b.ToTable("Genre");
+ });
+
+ modelBuilder.Entity("API.Entities.Library", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("CoverImage")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("FolderWatching")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(true);
+
+ b.Property<bool>("IncludeInDashboard")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(true);
+
+ b.Property<bool>("IncludeInRecommended")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(true);
+
+ b.Property<bool>("IncludeInSearch")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(true);
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastScanned")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("ManageCollections")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(true);
+
+ b.Property<bool>("ManageReadingLists")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(true);
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Type")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.ToTable("Library");
+ });
+
+ modelBuilder.Entity("API.Entities.MangaFile", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("Bytes")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ChapterId")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Extension")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("FilePath")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Format")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastFileAnalysis")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastFileAnalysisUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Pages")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ChapterId");
+
+ b.ToTable("MangaFile");
+ });
+
+ modelBuilder.Entity("API.Entities.Metadata.SeriesMetadata", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AgeRating")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("AgeRatingLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("CharacterLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("ColoristLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("CoverArtistLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("EditorLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("GenresLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("InkerLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Language")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("LanguageLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("LettererLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("MaxCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("PencillerLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("PublicationStatus")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("PublicationStatusLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("PublisherLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ReleaseYear")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("ReleaseYearLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .IsConcurrencyToken()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Summary")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("SummaryLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("TagsLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("TotalCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("TranslatorLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<bool>("WriterLocked")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("SeriesId")
+ .IsUnique();
+
+ b.HasIndex("Id", "SeriesId")
+ .IsUnique();
+
+ b.ToTable("SeriesMetadata");
+ });
+
+ modelBuilder.Entity("API.Entities.Metadata.SeriesRelation", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("RelationKind")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("TargetSeriesId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("SeriesId");
+
+ b.HasIndex("TargetSeriesId");
+
+ b.ToTable("SeriesRelation");
+ });
+
+ modelBuilder.Entity("API.Entities.Person", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedName")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Role")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.ToTable("Person");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingList", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AgeRating")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("CoverImage")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("CoverImageLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("EndingMonth")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("EndingYear")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedTitle")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("Promoted")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("StartingMonth")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("StartingYear")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Summary")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.ToTable("ReadingList");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingListItem", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ChapterId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Order")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("ReadingListId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("VolumeId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ChapterId");
+
+ b.HasIndex("ReadingListId");
+
+ b.HasIndex("SeriesId");
+
+ b.HasIndex("VolumeId");
+
+ b.ToTable("ReadingListItem");
+ });
+
+ modelBuilder.Entity("API.Entities.Series", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int?>("AppUserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AvgHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("CoverImage")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("CoverImageLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("FolderPath")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Format")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastChapterAdded")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastChapterAddedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastFolderScanned")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastFolderScannedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("LibraryId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("LocalizedName")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("LocalizedNameLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("MaxHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("MinHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("NameLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("NormalizedLocalizedName")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedName")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("OriginalName")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Pages")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("SortName")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("SortNameLocked")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("WordCount")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AppUserId");
+
+ b.HasIndex("LibraryId");
+
+ b.ToTable("Series");
+ });
+
+ modelBuilder.Entity("API.Entities.ServerSetting", b =>
+ {
+ b.Property<int>("Key")
+ .HasColumnType("INTEGER");
+
+ b.Property<uint>("RowVersion")
+ .IsConcurrencyToken()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Value")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Key");
+
+ b.ToTable("ServerSetting");
+ });
+
+ modelBuilder.Entity("API.Entities.ServerStatistics", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("ChapterCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("FileCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("GenreCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("PersonCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("SeriesCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("TagCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("UserCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("VolumeCount")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Year")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.ToTable("ServerStatistics");
+ });
+
+ modelBuilder.Entity("API.Entities.SiteTheme", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("FileName")
+ .HasColumnType("TEXT");
+
+ b.Property<bool>("IsDefault")
+ .HasColumnType("INTEGER");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("NormalizedName")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Provider")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.ToTable("SiteTheme");
+ });
+
+ modelBuilder.Entity("API.Entities.Tag", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("NormalizedTitle")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Title")
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedTitle")
+ .IsUnique();
+
+ b.ToTable("Tag");
+ });
+
+ modelBuilder.Entity("API.Entities.Volume", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("AvgHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("CoverImage")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("Created")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("CreatedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModified")
+ .HasColumnType("TEXT");
+
+ b.Property<DateTime>("LastModifiedUtc")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("MaxHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("MinHoursToRead")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("Number")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("Pages")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesId")
+ .HasColumnType("INTEGER");
+
+ b.Property<long>("WordCount")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("SeriesId");
+
+ b.ToTable("Volume");
+ });
+
+ modelBuilder.Entity("AppUserLibrary", b =>
+ {
+ b.Property<int>("AppUsersId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("LibrariesId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("AppUsersId", "LibrariesId");
+
+ b.HasIndex("LibrariesId");
+
+ b.ToTable("AppUserLibrary");
+ });
+
+ modelBuilder.Entity("ChapterGenre", b =>
+ {
+ b.Property<int>("ChaptersId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("GenresId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("ChaptersId", "GenresId");
+
+ b.HasIndex("GenresId");
+
+ b.ToTable("ChapterGenre");
+ });
+
+ modelBuilder.Entity("ChapterPerson", b =>
+ {
+ b.Property<int>("ChapterMetadatasId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("PeopleId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("ChapterMetadatasId", "PeopleId");
+
+ b.HasIndex("PeopleId");
+
+ b.ToTable("ChapterPerson");
+ });
+
+ modelBuilder.Entity("ChapterTag", b =>
+ {
+ b.Property<int>("ChaptersId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("TagsId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("ChaptersId", "TagsId");
+
+ b.HasIndex("TagsId");
+
+ b.ToTable("ChapterTag");
+ });
+
+ modelBuilder.Entity("CollectionTagSeriesMetadata", b =>
+ {
+ b.Property<int>("CollectionTagsId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesMetadatasId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("CollectionTagsId", "SeriesMetadatasId");
+
+ b.HasIndex("SeriesMetadatasId");
+
+ b.ToTable("CollectionTagSeriesMetadata");
+ });
+
+ modelBuilder.Entity("GenreSeriesMetadata", b =>
+ {
+ b.Property<int>("GenresId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesMetadatasId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("GenresId", "SeriesMetadatasId");
+
+ b.HasIndex("SeriesMetadatasId");
+
+ b.ToTable("GenreSeriesMetadata");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("ClaimType")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ClaimValue")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("RoleId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("AspNetRoleClaims", (string)null);
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
+ {
+ b.Property<int>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("ClaimType")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ClaimValue")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("UserId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AspNetUserClaims", (string)null);
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
+ {
+ b.Property<string>("LoginProvider")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ProviderKey")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("ProviderDisplayName")
+ .HasColumnType("TEXT");
+
+ b.Property<int>("UserId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("LoginProvider", "ProviderKey");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AspNetUserLogins", (string)null);
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<int>", b =>
+ {
+ b.Property<int>("UserId")
+ .HasColumnType("INTEGER");
+
+ b.Property<string>("LoginProvider")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Name")
+ .HasColumnType("TEXT");
+
+ b.Property<string>("Value")
+ .HasColumnType("TEXT");
+
+ b.HasKey("UserId", "LoginProvider", "Name");
+
+ b.ToTable("AspNetUserTokens", (string)null);
+ });
+
+ modelBuilder.Entity("PersonSeriesMetadata", b =>
+ {
+ b.Property<int>("PeopleId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("SeriesMetadatasId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("PeopleId", "SeriesMetadatasId");
+
+ b.HasIndex("SeriesMetadatasId");
+
+ b.ToTable("PersonSeriesMetadata");
+ });
+
+ modelBuilder.Entity("SeriesMetadataTag", b =>
+ {
+ b.Property<int>("SeriesMetadatasId")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("TagsId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("SeriesMetadatasId", "TagsId");
+
+ b.HasIndex("TagsId");
+
+ b.ToTable("SeriesMetadataTag");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserBookmark", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("Bookmarks")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserPreferences", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithOne("UserPreferences")
+ .HasForeignKey("API.Entities.AppUserPreferences", "AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.SiteTheme", "Theme")
+ .WithMany()
+ .HasForeignKey("ThemeId");
+
+ b.Navigation("AppUser");
+
+ b.Navigation("Theme");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserProgress", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("Progresses")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Chapter", null)
+ .WithMany("UserProgress")
+ .HasForeignKey("ChapterId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Series", null)
+ .WithMany("Progress")
+ .HasForeignKey("SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserRating", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("Ratings")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Series", null)
+ .WithMany("Ratings")
+ .HasForeignKey("SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUserRole", b =>
+ {
+ b.HasOne("API.Entities.AppRole", "Role")
+ .WithMany("UserRoles")
+ .HasForeignKey("RoleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.AppUser", "User")
+ .WithMany("UserRoles")
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Role");
+
+ b.Navigation("User");
+ });
+
+ modelBuilder.Entity("API.Entities.Chapter", b =>
+ {
+ b.HasOne("API.Entities.Volume", "Volume")
+ .WithMany("Chapters")
+ .HasForeignKey("VolumeId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Volume");
+ });
+
+ modelBuilder.Entity("API.Entities.Device", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("Devices")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.FolderPath", b =>
+ {
+ b.HasOne("API.Entities.Library", "Library")
+ .WithMany("Folders")
+ .HasForeignKey("LibraryId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Library");
+ });
+
+ modelBuilder.Entity("API.Entities.MangaFile", b =>
+ {
+ b.HasOne("API.Entities.Chapter", "Chapter")
+ .WithMany("Files")
+ .HasForeignKey("ChapterId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Chapter");
+ });
+
+ modelBuilder.Entity("API.Entities.Metadata.SeriesMetadata", b =>
+ {
+ b.HasOne("API.Entities.Series", "Series")
+ .WithOne("Metadata")
+ .HasForeignKey("API.Entities.Metadata.SeriesMetadata", "SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Series");
+ });
+
+ modelBuilder.Entity("API.Entities.Metadata.SeriesRelation", b =>
+ {
+ b.HasOne("API.Entities.Series", "Series")
+ .WithMany("Relations")
+ .HasForeignKey("SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Series", "TargetSeries")
+ .WithMany("RelationOf")
+ .HasForeignKey("TargetSeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Series");
+
+ b.Navigation("TargetSeries");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingList", b =>
+ {
+ b.HasOne("API.Entities.AppUser", "AppUser")
+ .WithMany("ReadingLists")
+ .HasForeignKey("AppUserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("AppUser");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingListItem", b =>
+ {
+ b.HasOne("API.Entities.Chapter", "Chapter")
+ .WithMany()
+ .HasForeignKey("ChapterId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.ReadingList", "ReadingList")
+ .WithMany("Items")
+ .HasForeignKey("ReadingListId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Series", "Series")
+ .WithMany()
+ .HasForeignKey("SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Volume", "Volume")
+ .WithMany()
+ .HasForeignKey("VolumeId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Chapter");
+
+ b.Navigation("ReadingList");
+
+ b.Navigation("Series");
+
+ b.Navigation("Volume");
+ });
+
+ modelBuilder.Entity("API.Entities.Series", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany("WantToRead")
+ .HasForeignKey("AppUserId");
+
+ b.HasOne("API.Entities.Library", "Library")
+ .WithMany("Series")
+ .HasForeignKey("LibraryId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Library");
+ });
+
+ modelBuilder.Entity("API.Entities.Volume", b =>
+ {
+ b.HasOne("API.Entities.Series", "Series")
+ .WithMany("Volumes")
+ .HasForeignKey("SeriesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Series");
+ });
+
+ modelBuilder.Entity("AppUserLibrary", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany()
+ .HasForeignKey("AppUsersId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Library", null)
+ .WithMany()
+ .HasForeignKey("LibrariesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("ChapterGenre", b =>
+ {
+ b.HasOne("API.Entities.Chapter", null)
+ .WithMany()
+ .HasForeignKey("ChaptersId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Genre", null)
+ .WithMany()
+ .HasForeignKey("GenresId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("ChapterPerson", b =>
+ {
+ b.HasOne("API.Entities.Chapter", null)
+ .WithMany()
+ .HasForeignKey("ChapterMetadatasId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Person", null)
+ .WithMany()
+ .HasForeignKey("PeopleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("ChapterTag", b =>
+ {
+ b.HasOne("API.Entities.Chapter", null)
+ .WithMany()
+ .HasForeignKey("ChaptersId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Tag", null)
+ .WithMany()
+ .HasForeignKey("TagsId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("CollectionTagSeriesMetadata", b =>
+ {
+ b.HasOne("API.Entities.CollectionTag", null)
+ .WithMany()
+ .HasForeignKey("CollectionTagsId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Metadata.SeriesMetadata", null)
+ .WithMany()
+ .HasForeignKey("SeriesMetadatasId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("GenreSeriesMetadata", b =>
+ {
+ b.HasOne("API.Entities.Genre", null)
+ .WithMany()
+ .HasForeignKey("GenresId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Metadata.SeriesMetadata", null)
+ .WithMany()
+ .HasForeignKey("SeriesMetadatasId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
+ {
+ b.HasOne("API.Entities.AppRole", null)
+ .WithMany()
+ .HasForeignKey("RoleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<int>", b =>
+ {
+ b.HasOne("API.Entities.AppUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("PersonSeriesMetadata", b =>
+ {
+ b.HasOne("API.Entities.Person", null)
+ .WithMany()
+ .HasForeignKey("PeopleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Metadata.SeriesMetadata", null)
+ .WithMany()
+ .HasForeignKey("SeriesMetadatasId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("SeriesMetadataTag", b =>
+ {
+ b.HasOne("API.Entities.Metadata.SeriesMetadata", null)
+ .WithMany()
+ .HasForeignKey("SeriesMetadatasId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("API.Entities.Tag", null)
+ .WithMany()
+ .HasForeignKey("TagsId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("API.Entities.AppRole", b =>
+ {
+ b.Navigation("UserRoles");
+ });
+
+ modelBuilder.Entity("API.Entities.AppUser", b =>
+ {
+ b.Navigation("Bookmarks");
+
+ b.Navigation("Devices");
+
+ b.Navigation("Progresses");
+
+ b.Navigation("Ratings");
+
+ b.Navigation("ReadingLists");
+
+ b.Navigation("UserPreferences");
+
+ b.Navigation("UserRoles");
+
+ b.Navigation("WantToRead");
+ });
+
+ modelBuilder.Entity("API.Entities.Chapter", b =>
+ {
+ b.Navigation("Files");
+
+ b.Navigation("UserProgress");
+ });
+
+ modelBuilder.Entity("API.Entities.Library", b =>
+ {
+ b.Navigation("Folders");
+
+ b.Navigation("Series");
+ });
+
+ modelBuilder.Entity("API.Entities.ReadingList", b =>
+ {
+ b.Navigation("Items");
+ });
+
+ modelBuilder.Entity("API.Entities.Series", b =>
+ {
+ b.Navigation("Metadata");
+
+ b.Navigation("Progress");
+
+ b.Navigation("Ratings");
+
+ b.Navigation("RelationOf");
+
+ b.Navigation("Relations");
+
+ b.Navigation("Volumes");
+ });
+
+ modelBuilder.Entity("API.Entities.Volume", b =>
+ {
+ b.Navigation("Chapters");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/API/Data/Migrations/20230415123449_ManageReadingListOnLibrary.cs b/API/Data/Migrations/20230415123449_ManageReadingListOnLibrary.cs
new file mode 100644
index 000000000..3c57d3de3
--- /dev/null
+++ b/API/Data/Migrations/20230415123449_ManageReadingListOnLibrary.cs
@@ -0,0 +1,29 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace API.Data.Migrations
+{
+ /// <inheritdoc />
+ public partial class ManageReadingListOnLibrary : Migration
+ {
+ /// <inheritdoc />
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.AddColumn<bool>(
+ name: "ManageReadingLists",
+ table: "Library",
+ type: "INTEGER",
+ nullable: false,
+ defaultValue: true);
+ }
+
+ /// <inheritdoc />
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropColumn(
+ name: "ManageReadingLists",
+ table: "Library");
+ }
+ }
+}
diff --git a/API/Data/Migrations/DataContextModelSnapshot.cs b/API/Data/Migrations/DataContextModelSnapshot.cs
index e916cd58d..a097d63dc 100644
--- a/API/Data/Migrations/DataContextModelSnapshot.cs
+++ b/API/Data/Migrations/DataContextModelSnapshot.cs
@@ -15,7 +15,7 @@ namespace API.Data.Migrations
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
- modelBuilder.HasAnnotation("ProductVersion", "6.0.10");
+ modelBuilder.HasAnnotation("ProductVersion", "7.0.5");
modelBuilder.Entity("API.Entities.AppRole", b =>
{
@@ -224,11 +224,19 @@ namespace API.Data.Migrations
b.Property<bool>("BookReaderTapToPaginate")
.HasColumnType("INTEGER");
+ b.Property<int>("BookReaderWritingStyle")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(0);
+
b.Property<string>("BookThemeName")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasDefaultValue("Dark");
+ b.Property<bool>("CollapseSeriesRelationships")
+ .HasColumnType("INTEGER");
+
b.Property<bool>("EmulateBook")
.HasColumnType("INTEGER");
@@ -641,6 +649,11 @@ namespace API.Data.Migrations
.HasColumnType("INTEGER")
.HasDefaultValue(true);
+ b.Property<bool>("ManageReadingLists")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER")
+ .HasDefaultValue(true);
+
b.Property<string>("Name")
.HasColumnType("TEXT");
@@ -865,6 +878,12 @@ namespace API.Data.Migrations
b.Property<DateTime>("CreatedUtc")
.HasColumnType("TEXT");
+ b.Property<int>("EndingMonth")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("EndingYear")
+ .HasColumnType("INTEGER");
+
b.Property<DateTime>("LastModified")
.HasColumnType("TEXT");
@@ -877,6 +896,12 @@ namespace API.Data.Migrations
b.Property<bool>("Promoted")
.HasColumnType("INTEGER");
+ b.Property<int>("StartingMonth")
+ .HasColumnType("INTEGER");
+
+ b.Property<int>("StartingYear")
+ .HasColumnType("INTEGER");
+
b.Property<string>("Summary")
.HasColumnType("TEXT");
diff --git a/API/Data/Misc/RecentlyAddedSeries.cs b/API/Data/Misc/RecentlyAddedSeries.cs
index 24100ca0f..684247d9c 100644
--- a/API/Data/Misc/RecentlyAddedSeries.cs
+++ b/API/Data/Misc/RecentlyAddedSeries.cs
@@ -9,13 +9,13 @@ public class RecentlyAddedSeries
public LibraryType LibraryType { get; init; }
public DateTime Created { get; init; }
public int SeriesId { get; init; }
- public string SeriesName { get; init; }
+ public string? SeriesName { get; init; }
public MangaFormat Format { get; init; }
public int ChapterId { get; init; }
public int VolumeId { get; init; }
- public string ChapterNumber { get; init; }
- public string ChapterRange { get; init; }
- public string ChapterTitle { get; init; }
+ public string? ChapterNumber { get; init; }
+ public string? ChapterRange { get; init; }
+ public string? ChapterTitle { get; init; }
public bool IsSpecial { get; init; }
public int VolumeNumber { get; init; }
public AgeRating AgeRating { get; init; }
diff --git a/API/Data/Repositories/AppUserProgressRepository.cs b/API/Data/Repositories/AppUserProgressRepository.cs
index af442081e..fdd48b649 100644
--- a/API/Data/Repositories/AppUserProgressRepository.cs
+++ b/API/Data/Repositories/AppUserProgressRepository.cs
@@ -15,13 +15,13 @@ public interface IAppUserProgressRepository
void Update(AppUserProgress userProgress);
Task<int> CleanupAbandonedChapters();
Task<bool> UserHasProgress(LibraryType libraryType, int userId);
- Task<AppUserProgress> GetUserProgressAsync(int chapterId, int userId);
+ Task<AppUserProgress?> GetUserProgressAsync(int chapterId, int userId);
Task<bool> HasAnyProgressOnSeriesAsync(int seriesId, int userId);
/// <summary>
/// This is built exclusively for <see cref="MigrateUserProgressLibraryId"/>
/// </summary>
/// <returns></returns>
- Task<AppUserProgress> GetAnyProgress();
+ Task<AppUserProgress?> GetAnyProgress();
Task<IEnumerable<AppUserProgress>> GetUserProgressForSeriesAsync(int seriesId, int userId);
Task<IEnumerable<AppUserProgress>> GetAllProgress();
Task<ProgressDto> GetUserProgressDtoAsync(int chapterId, int userId);
@@ -97,7 +97,7 @@ public class AppUserProgressRepository : IAppUserProgressRepository
.AnyAsync(aup => aup.PagesRead > 0 && aup.AppUserId == userId && aup.SeriesId == seriesId);
}
- public async Task<AppUserProgress> GetAnyProgress()
+ public async Task<AppUserProgress?> GetAnyProgress()
{
return await _context.AppUserProgresses.FirstOrDefaultAsync();
}
@@ -128,7 +128,7 @@ public class AppUserProgressRepository : IAppUserProgressRepository
.FirstOrDefaultAsync();
}
- public async Task<AppUserProgress> GetUserProgressAsync(int chapterId, int userId)
+ public async Task<AppUserProgress?> GetUserProgressAsync(int chapterId, int userId)
{
return await _context.AppUserProgresses
.Where(p => p.ChapterId == chapterId && p.AppUserId == userId)
diff --git a/API/Data/Repositories/ChapterRepository.cs b/API/Data/Repositories/ChapterRepository.cs
index 82944fe77..f10f036fc 100644
--- a/API/Data/Repositories/ChapterRepository.cs
+++ b/API/Data/Repositories/ChapterRepository.cs
@@ -7,6 +7,7 @@ using API.DTOs.Metadata;
using API.DTOs.Reader;
using API.Entities;
using API.Extensions;
+using API.Extensions.QueryExtensions;
using AutoMapper;
using AutoMapper.QueryableExtensions;
using Microsoft.EntityFrameworkCore;
@@ -25,15 +26,15 @@ public interface IChapterRepository
{
void Update(Chapter chapter);
Task<IEnumerable<Chapter>> GetChaptersByIdsAsync(IList<int> chapterIds, ChapterIncludes includes = ChapterIncludes.None);
- Task<IChapterInfoDto> GetChapterInfoDtoAsync(int chapterId);
+ Task<IChapterInfoDto?> GetChapterInfoDtoAsync(int chapterId);
Task<int> GetChapterTotalPagesAsync(int chapterId);
- Task<Chapter> GetChapterAsync(int chapterId, ChapterIncludes includes = ChapterIncludes.Files);
- Task<ChapterDto> GetChapterDtoAsync(int chapterId, ChapterIncludes includes = ChapterIncludes.Files);
- Task<ChapterMetadataDto> GetChapterMetadataDtoAsync(int chapterId, ChapterIncludes includes = ChapterIncludes.Files);
+ Task<Chapter?> GetChapterAsync(int chapterId, ChapterIncludes includes = ChapterIncludes.Files);
+ Task<ChapterDto?> GetChapterDtoAsync(int chapterId, ChapterIncludes includes = ChapterIncludes.Files);
+ Task<ChapterMetadataDto?> GetChapterMetadataDtoAsync(int chapterId, ChapterIncludes includes = ChapterIncludes.Files);
Task<IList<MangaFile>> GetFilesForChapterAsync(int chapterId);
Task<IList<Chapter>> GetChaptersAsync(int volumeId);
Task<IList<MangaFile>> GetFilesForChaptersAsync(IReadOnlyList<int> chapterIds);
- Task<string> GetChapterCoverImageAsync(int chapterId);
+ Task<string?> GetChapterCoverImageAsync(int chapterId);
Task<IList<string>> GetAllCoverImagesAsync();
Task<IList<Chapter>> GetAllChaptersWithNonWebPCovers();
Task<IEnumerable<string>> GetCoverImagesForLockedChaptersAsync();
@@ -68,7 +69,7 @@ public class ChapterRepository : IChapterRepository
/// Populates a partial IChapterInfoDto
/// </summary>
/// <returns></returns>
- public async Task<IChapterInfoDto> GetChapterInfoDtoAsync(int chapterId)
+ public async Task<IChapterInfoDto?> GetChapterInfoDtoAsync(int chapterId)
{
var chapterInfo = await _context.Chapter
.Where(c => c.Id == chapterId)
@@ -124,7 +125,7 @@ public class ChapterRepository : IChapterRepository
.Select(c => c.Pages)
.FirstOrDefaultAsync();
}
- public async Task<ChapterDto> GetChapterDtoAsync(int chapterId, ChapterIncludes includes = ChapterIncludes.Files)
+ public async Task<ChapterDto?> GetChapterDtoAsync(int chapterId, ChapterIncludes includes = ChapterIncludes.Files)
{
var chapter = await _context.Chapter
.Includes(includes)
@@ -136,7 +137,7 @@ public class ChapterRepository : IChapterRepository
return chapter;
}
- public async Task<ChapterMetadataDto> GetChapterMetadataDtoAsync(int chapterId, ChapterIncludes includes = ChapterIncludes.Files)
+ public async Task<ChapterMetadataDto?> GetChapterMetadataDtoAsync(int chapterId, ChapterIncludes includes = ChapterIncludes.Files)
{
var chapter = await _context.Chapter
.Includes(includes)
@@ -167,7 +168,7 @@ public class ChapterRepository : IChapterRepository
/// <param name="chapterId"></param>
/// <param name="includes"></param>
/// <returns></returns>
- public async Task<Chapter> GetChapterAsync(int chapterId, ChapterIncludes includes = ChapterIncludes.Files)
+ public async Task<Chapter?> GetChapterAsync(int chapterId, ChapterIncludes includes = ChapterIncludes.Files)
{
return await _context.Chapter
.Includes(includes)
@@ -191,23 +192,20 @@ public class ChapterRepository : IChapterRepository
/// </summary>
/// <param name="chapterId"></param>
/// <returns></returns>
- public async Task<string> GetChapterCoverImageAsync(int chapterId)
+ public async Task<string?> GetChapterCoverImageAsync(int chapterId)
{
-
return await _context.Chapter
.Where(c => c.Id == chapterId)
.Select(c => c.CoverImage)
- .AsNoTracking()
.SingleOrDefaultAsync();
}
public async Task<IList<string>> GetAllCoverImagesAsync()
{
- return await _context.Chapter
+ return (await _context.Chapter
.Select(c => c.CoverImage)
.Where(t => !string.IsNullOrEmpty(t))
- .AsNoTracking()
- .ToListAsync();
+ .ToListAsync())!;
}
public async Task<IList<Chapter>> GetAllChaptersWithNonWebPCovers()
@@ -223,12 +221,11 @@ public class ChapterRepository : IChapterRepository
/// <returns></returns>
public async Task<IEnumerable<string>> GetCoverImagesForLockedChaptersAsync()
{
- return await _context.Chapter
+ return (await _context.Chapter
.Where(c => c.CoverImageLocked)
.Select(c => c.CoverImage)
.Where(t => !string.IsNullOrEmpty(t))
- .AsNoTracking()
- .ToListAsync();
+ .ToListAsync())!;
}
/// <summary>
diff --git a/API/Data/Repositories/CollectionTagRepository.cs b/API/Data/Repositories/CollectionTagRepository.cs
index 5038a5892..dd9d375b4 100644
--- a/API/Data/Repositories/CollectionTagRepository.cs
+++ b/API/Data/Repositories/CollectionTagRepository.cs
@@ -6,6 +6,7 @@ using API.Data.Misc;
using API.DTOs.CollectionTags;
using API.Entities;
using API.Extensions;
+using API.Extensions.QueryExtensions;
using AutoMapper;
using AutoMapper.QueryableExtensions;
using Microsoft.EntityFrameworkCore;
@@ -25,15 +26,15 @@ public interface ICollectionTagRepository
void Remove(CollectionTag tag);
Task<IEnumerable<CollectionTagDto>> GetAllTagDtosAsync();
Task<IEnumerable<CollectionTagDto>> SearchTagDtosAsync(string searchQuery, int userId);
- Task<string> GetCoverImageAsync(int collectionTagId);
+ Task<string?> GetCoverImageAsync(int collectionTagId);
Task<IEnumerable<CollectionTagDto>> GetAllPromotedTagDtosAsync(int userId);
- Task<CollectionTag> GetTagAsync(int tagId);
- Task<CollectionTag> GetFullTagAsync(int tagId, CollectionTagIncludes includes = CollectionTagIncludes.SeriesMetadata);
+ Task<CollectionTag?> GetTagAsync(int tagId, CollectionTagIncludes includes = CollectionTagIncludes.None);
void Update(CollectionTag tag);
Task<int> RemoveTagsWithoutSeries();
Task<IEnumerable<CollectionTag>> GetAllTagsAsync(CollectionTagIncludes includes = CollectionTagIncludes.None);
Task<IList<string>> GetAllCoverImagesAsync();
Task<bool> TagExists(string title);
+ Task<IList<CollectionTag>> GetAllWithNonWebPCovers();
}
public class CollectionTagRepository : ICollectionTagRepository
{
@@ -84,29 +85,34 @@ public class CollectionTagRepository : ICollectionTagRepository
.ToListAsync();
}
- public async Task<string> GetCoverImageAsync(int collectionTagId)
+ public async Task<string?> GetCoverImageAsync(int collectionTagId)
{
return await _context.CollectionTag
.Where(c => c.Id == collectionTagId)
.Select(c => c.CoverImage)
- .AsNoTracking()
.SingleOrDefaultAsync();
}
public async Task<IList<string>> GetAllCoverImagesAsync()
{
- return await _context.CollectionTag
+ return (await _context.CollectionTag
.Select(t => t.CoverImage)
.Where(t => !string.IsNullOrEmpty(t))
- .AsNoTracking()
- .ToListAsync();
+ .ToListAsync())!;
}
public async Task<bool> TagExists(string title)
{
- var normalized = Services.Tasks.Scanner.Parser.Parser.Normalize(title);
+ var normalized = title.ToNormalized();
+ return await _context.CollectionTag
+ .AnyAsync(x => x.NormalizedTitle != null && x.NormalizedTitle.Equals(normalized));
+ }
+
+ public async Task<IList<CollectionTag>> GetAllWithNonWebPCovers()
+ {
return await _context.CollectionTag
- .AnyAsync(x => x.NormalizedTitle.Equals(normalized));
+ .Where(c => !string.IsNullOrEmpty(c.CoverImage) && !c.CoverImage.EndsWith(".webp"))
+ .ToListAsync();
}
public async Task<IEnumerable<CollectionTagDto>> GetAllTagDtosAsync()
@@ -131,14 +137,8 @@ public class CollectionTagRepository : ICollectionTagRepository
.ToListAsync();
}
- public async Task<CollectionTag> GetTagAsync(int tagId)
- {
- return await _context.CollectionTag
- .Where(c => c.Id == tagId)
- .SingleOrDefaultAsync();
- }
- public async Task<CollectionTag> GetFullTagAsync(int tagId, CollectionTagIncludes includes = CollectionTagIncludes.SeriesMetadata)
+ public async Task<CollectionTag?> GetTagAsync(int tagId, CollectionTagIncludes includes = CollectionTagIncludes.None)
{
return await _context.CollectionTag
.Where(c => c.Id == tagId)
@@ -164,8 +164,8 @@ public class CollectionTagRepository : ICollectionTagRepository
{
var userRating = await GetUserAgeRestriction(userId);
return await _context.CollectionTag
- .Where(s => EF.Functions.Like(s.Title, $"%{searchQuery}%")
- || EF.Functions.Like(s.NormalizedTitle, $"%{searchQuery}%"))
+ .Where(s => EF.Functions.Like(s.Title!, $"%{searchQuery}%")
+ || EF.Functions.Like(s.NormalizedTitle!, $"%{searchQuery}%"))
.RestrictAgainstAgeRestriction(userRating)
.OrderBy(s => s.NormalizedTitle)
.AsNoTracking()
diff --git a/API/Data/Repositories/DeviceRepository.cs b/API/Data/Repositories/DeviceRepository.cs
index b6f139bc1..479f5604b 100644
--- a/API/Data/Repositories/DeviceRepository.cs
+++ b/API/Data/Repositories/DeviceRepository.cs
@@ -13,7 +13,7 @@ public interface IDeviceRepository
{
void Update(Device device);
Task<IEnumerable<DeviceDto>> GetDevicesForUserAsync(int userId);
- Task<Device> GetDeviceById(int deviceId);
+ Task<Device?> GetDeviceById(int deviceId);
}
public class DeviceRepository : IDeviceRepository
@@ -41,7 +41,7 @@ public class DeviceRepository : IDeviceRepository
.ToListAsync();
}
- public async Task<Device> GetDeviceById(int deviceId)
+ public async Task<Device?> GetDeviceById(int deviceId)
{
return await _context.Device
.Where(d => d.Id == deviceId)
diff --git a/API/Data/Repositories/GenreRepository.cs b/API/Data/Repositories/GenreRepository.cs
index 2533a40cf..b552093e7 100644
--- a/API/Data/Repositories/GenreRepository.cs
+++ b/API/Data/Repositories/GenreRepository.cs
@@ -1,10 +1,10 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
-using API.Data.Misc;
using API.DTOs.Metadata;
using API.Entities;
using API.Extensions;
+using API.Extensions.QueryExtensions;
using AutoMapper;
using AutoMapper.QueryableExtensions;
using Microsoft.EntityFrameworkCore;
@@ -15,7 +15,7 @@ public interface IGenreRepository
{
void Attach(Genre genre);
void Remove(Genre genre);
- Task<Genre> FindByNameAsync(string genreName);
+ Task<Genre?> FindByNameAsync(string genreName);
Task<IList<Genre>> GetAllGenresAsync();
Task<IList<GenreTagDto>> GetAllGenreDtosAsync(int userId);
Task RemoveAllGenreNoLongerAssociated(bool removeExternal = false);
@@ -44,11 +44,11 @@ public class GenreRepository : IGenreRepository
_context.Genre.Remove(genre);
}
- public async Task<Genre> FindByNameAsync(string genreName)
+ public async Task<Genre?> FindByNameAsync(string genreName)
{
- var normalizedName = Services.Tasks.Scanner.Parser.Parser.Normalize(genreName);
+ var normalizedName = genreName.ToNormalized();
return await _context.Genre
- .FirstOrDefaultAsync(g => g.NormalizedTitle.Equals(normalizedName));
+ .FirstOrDefaultAsync(g => g.NormalizedTitle != null && g.NormalizedTitle.Equals(normalizedName));
}
public async Task RemoveAllGenreNoLongerAssociated(bool removeExternal = false)
diff --git a/API/Data/Repositories/LibraryRepository.cs b/API/Data/Repositories/LibraryRepository.cs
index 1b2303e98..c8be8929d 100644
--- a/API/Data/Repositories/LibraryRepository.cs
+++ b/API/Data/Repositories/LibraryRepository.cs
@@ -10,6 +10,7 @@ using API.DTOs.Metadata;
using API.Entities;
using API.Entities.Enums;
using API.Extensions;
+using API.Extensions.QueryExtensions;
using AutoMapper;
using AutoMapper.QueryableExtensions;
using Kavita.Common.Extensions;
@@ -31,13 +32,12 @@ public interface ILibraryRepository
{
void Add(Library library);
void Update(Library library);
- void Delete(Library library);
+ void Delete(Library? library);
Task<IEnumerable<LibraryDto>> GetLibraryDtosAsync();
Task<bool> LibraryExists(string libraryName);
- Task<Library> GetLibraryForIdAsync(int libraryId, LibraryIncludes includes = LibraryIncludes.None);
+ Task<Library?> GetLibraryForIdAsync(int libraryId, LibraryIncludes includes = LibraryIncludes.None);
Task<IEnumerable<LibraryDto>> GetLibraryDtosForUsernameAsync(string userName);
Task<IEnumerable<Library>> GetLibrariesAsync(LibraryIncludes includes = LibraryIncludes.None);
- Task<bool> DeleteLibrary(int libraryId);
Task<IEnumerable<Library>> GetLibrariesForUserIdAsync(int userId);
IEnumerable<int> GetLibraryIdsForUserIdAsync(int userId, QueryContext queryContext = QueryContext.None);
Task<LibraryType> GetLibraryTypeAsync(int libraryId);
@@ -49,9 +49,10 @@ public interface ILibraryRepository
Task<IList<LanguageDto>> GetAllLanguagesForLibrariesAsync();
IEnumerable<PublicationStatusDto> GetAllPublicationStatusesDtosForLibrariesAsync(List<int> libraryIds);
Task<bool> DoAnySeriesFoldersMatch(IEnumerable<string> folders);
- Task<string> GetLibraryCoverImageAsync(int libraryId);
+ Task<string?> GetLibraryCoverImageAsync(int libraryId);
Task<IList<string>> GetAllCoverImagesAsync();
Task<IDictionary<int, LibraryType>> GetLibraryTypesForIdsAsync(IEnumerable<int> libraryIds);
+ Task<IList<Library>> GetAllWithNonWebPCovers();
}
public class LibraryRepository : ILibraryRepository
@@ -75,8 +76,9 @@ public class LibraryRepository : ILibraryRepository
_context.Entry(library).State = EntityState.Modified;
}
- public void Delete(Library library)
+ public void Delete(Library? library)
{
+ if (library == null) return;
_context.Library.Remove(library);
}
@@ -107,14 +109,6 @@ public class LibraryRepository : ILibraryRepository
return await query.ToListAsync();
}
- public async Task<bool> DeleteLibrary(int libraryId)
- {
- var library = await GetLibraryForIdAsync(libraryId, LibraryIncludes.Folders | LibraryIncludes.Series);
- _context.Library.Remove(library);
-
- return await _context.SaveChangesAsync() > 0;
- }
-
/// <summary>
/// This does not track
/// </summary>
@@ -164,7 +158,7 @@ public class LibraryRepository : ILibraryRepository
public IEnumerable<JumpKeyDto> GetJumpBarAsync(int libraryId)
{
var seriesSortCharacters = _context.Series.Where(s => s.LibraryId == libraryId)
- .Select(s => s.SortName.ToUpper())
+ .Select(s => s.SortName!.ToUpper())
.OrderBy(s => s)
.AsEnumerable()
.Select(s => s[0]);
@@ -207,7 +201,7 @@ public class LibraryRepository : ILibraryRepository
.ToListAsync();
}
- public async Task<Library> GetLibraryForIdAsync(int libraryId, LibraryIncludes includes = LibraryIncludes.None)
+ public async Task<Library?> GetLibraryForIdAsync(int libraryId, LibraryIncludes includes = LibraryIncludes.None)
{
var query = _context.Library
@@ -237,54 +231,11 @@ public class LibraryRepository : ILibraryRepository
return query.AsSplitQuery();
}
-
- /// <summary>
- /// This returns a Library with all it's Series -> Volumes -> Chapters. This is expensive. Should only be called when needed.
- /// </summary>
- /// <param name="libraryId"></param>
- /// <returns></returns>
- public async Task<Library> GetFullLibraryForIdAsync(int libraryId)
- {
- return await _context.Library
- .Where(x => x.Id == libraryId)
- .Include(f => f.Folders)
- .Include(l => l.Series)
- .ThenInclude(s => s.Metadata)
- .Include(l => l.Series)
- .ThenInclude(s => s.Volumes)
- .ThenInclude(v => v.Chapters)
- .ThenInclude(c => c.Files)
- .AsSplitQuery()
- .SingleAsync();
- }
-
- /// <summary>
- /// This is a heavy call, pulls all entities for a Library, except this version only grabs for one series id
- /// </summary>
- /// <param name="libraryId"></param>
- /// <param name="seriesId"></param>
- /// <returns></returns>
- public async Task<Library> GetFullLibraryForIdAsync(int libraryId, int seriesId)
- {
-
- return await _context.Library
- .Where(x => x.Id == libraryId)
- .Include(f => f.Folders)
- .Include(l => l.Series.Where(s => s.Id == seriesId))
- .ThenInclude(s => s.Metadata)
- .Include(l => l.Series.Where(s => s.Id == seriesId))
- .ThenInclude(s => s.Volumes)
- .ThenInclude(v => v.Chapters)
- .ThenInclude(c => c.Files)
- .AsSplitQuery()
- .SingleAsync();
- }
-
public async Task<bool> LibraryExists(string libraryName)
{
return await _context.Library
.AsNoTracking()
- .AnyAsync(x => x.Name.Equals(libraryName));
+ .AnyAsync(x => x.Name != null && x.Name.Equals(libraryName));
}
public async Task<IEnumerable<LibraryDto>> GetLibrariesForUserAsync(AppUser user)
@@ -381,7 +332,7 @@ public class LibraryRepository : ILibraryRepository
return await _context.Series.AnyAsync(s => normalized.Contains(s.FolderPath));
}
- public Task<string> GetLibraryCoverImageAsync(int libraryId)
+ public Task<string?> GetLibraryCoverImageAsync(int libraryId)
{
return _context.Library
.Where(l => l.Id == libraryId)
@@ -392,11 +343,10 @@ public class LibraryRepository : ILibraryRepository
public async Task<IList<string>> GetAllCoverImagesAsync()
{
- return await _context.ReadingList
+ return (await _context.ReadingList
.Select(t => t.CoverImage)
.Where(t => !string.IsNullOrEmpty(t))
- .AsNoTracking()
- .ToListAsync();
+ .ToListAsync())!;
}
public async Task<IDictionary<int, LibraryType>> GetLibraryTypesForIdsAsync(IEnumerable<int> libraryIds)
@@ -420,4 +370,11 @@ public class LibraryRepository : ILibraryRepository
return dict;
}
+
+ public async Task<IList<Library>> GetAllWithNonWebPCovers()
+ {
+ return await _context.Library
+ .Where(c => !string.IsNullOrEmpty(c.CoverImage) && !c.CoverImage.EndsWith(".webp"))
+ .ToListAsync();
+ }
}
diff --git a/API/Data/Repositories/MangaFileRepository.cs b/API/Data/Repositories/MangaFileRepository.cs
index e45700b32..ddea0d51a 100644
--- a/API/Data/Repositories/MangaFileRepository.cs
+++ b/API/Data/Repositories/MangaFileRepository.cs
@@ -2,7 +2,6 @@
using System.Linq;
using System.Threading.Tasks;
using API.Entities;
-using AutoMapper;
using Microsoft.EntityFrameworkCore;
namespace API.Data.Repositories;
@@ -17,12 +16,10 @@ public interface IMangaFileRepository
public class MangaFileRepository : IMangaFileRepository
{
private readonly DataContext _context;
- private readonly IMapper _mapper;
- public MangaFileRepository(DataContext context, IMapper mapper)
+ public MangaFileRepository(DataContext context)
{
_context = context;
- _mapper = mapper;
}
public void Update(MangaFile file)
diff --git a/API/Data/Repositories/PersonRepository.cs b/API/Data/Repositories/PersonRepository.cs
index 7eea282a7..0e05a6672 100644
--- a/API/Data/Repositories/PersonRepository.cs
+++ b/API/Data/Repositories/PersonRepository.cs
@@ -4,6 +4,7 @@ using System.Threading.Tasks;
using API.DTOs;
using API.Entities;
using API.Extensions;
+using API.Extensions.QueryExtensions;
using AutoMapper;
using AutoMapper.QueryableExtensions;
using Microsoft.EntityFrameworkCore;
diff --git a/API/Data/Repositories/ReadingListRepository.cs b/API/Data/Repositories/ReadingListRepository.cs
index 1719f67b2..649ee4a9b 100644
--- a/API/Data/Repositories/ReadingListRepository.cs
+++ b/API/Data/Repositories/ReadingListRepository.cs
@@ -1,26 +1,38 @@
-using System.Collections;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
+using API.DTOs;
using API.DTOs.ReadingLists;
using API.Entities;
using API.Entities.Enums;
+using API.Extensions;
+using API.Extensions.QueryExtensions;
using API.Helpers;
using API.Services;
using AutoMapper;
using AutoMapper.QueryableExtensions;
+using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
namespace API.Data.Repositories;
+[Flags]
+public enum ReadingListIncludes
+{
+ None = 1,
+ Items = 2,
+ ItemChapter = 4,
+}
+
public interface IReadingListRepository
{
- Task<PagedList<ReadingListDto>> GetReadingListDtosForUserAsync(int userId, bool includePromoted, UserParams userParams);
- Task<ReadingList> GetReadingListByIdAsync(int readingListId);
+ Task<PagedList<ReadingListDto>> GetReadingListDtosForUserAsync(int userId, bool includePromoted, UserParams userParams, bool sortByLastModified = true);
+ Task<ReadingList?> GetReadingListByIdAsync(int readingListId, ReadingListIncludes includes = ReadingListIncludes.None);
Task<IEnumerable<ReadingListItemDto>> GetReadingListItemDtosByIdAsync(int readingListId, int userId);
- Task<ReadingListDto> GetReadingListDtoByIdAsync(int readingListId, int userId);
+ Task<ReadingListDto?> GetReadingListDtoByIdAsync(int readingListId, int userId);
Task<IEnumerable<ReadingListItemDto>> AddReadingProgressModifiers(int userId, IList<ReadingListItemDto> items);
- Task<ReadingListDto> GetReadingListDtoByTitleAsync(int userId, string title);
+ Task<ReadingListDto?> GetReadingListDtoByTitleAsync(int userId, string title);
Task<IEnumerable<ReadingListItem>> GetReadingListItemsByIdAsync(int readingListId);
Task<IEnumerable<ReadingListDto>> GetReadingListDtosForSeriesAndUserAsync(int userId, int seriesId,
bool includePromoted);
@@ -29,10 +41,14 @@ public interface IReadingListRepository
void BulkRemove(IEnumerable<ReadingListItem> items);
void Update(ReadingList list);
Task<int> Count();
- Task<string> GetCoverImageAsync(int readingListId);
+ Task<string?> GetCoverImageAsync(int readingListId);
Task<IList<string>> GetAllCoverImagesAsync();
Task<bool> ReadingListExists(string name);
- Task<List<ReadingList>> GetAllReadingListsAsync();
+ IEnumerable<PersonDto> GetReadingListCharactersAsync(int readingListId);
+ Task<IList<ReadingList>> GetAllWithNonWebPCovers();
+ Task<IList<string>> GetFirstFourCoverImagesByReadingListId(int readingListId);
+ Task<int> RemoveReadingListsWithoutSeries();
+ Task<ReadingList?> GetReadingListByTitleAsync(string name, int userId, ReadingListIncludes includes = ReadingListIncludes.Items);
}
public class ReadingListRepository : IReadingListRepository
@@ -61,38 +77,82 @@ public class ReadingListRepository : IReadingListRepository
return await _context.ReadingList.CountAsync();
}
- public async Task<string> GetCoverImageAsync(int readingListId)
+ public async Task<string?> GetCoverImageAsync(int readingListId)
{
return await _context.ReadingList
.Where(c => c.Id == readingListId)
.Select(c => c.CoverImage)
- .AsNoTracking()
.SingleOrDefaultAsync();
}
public async Task<IList<string>> GetAllCoverImagesAsync()
{
- return await _context.ReadingList
+ return (await _context.ReadingList
.Select(t => t.CoverImage)
.Where(t => !string.IsNullOrEmpty(t))
- .AsNoTracking()
- .ToListAsync();
+ .ToListAsync())!;
}
public async Task<bool> ReadingListExists(string name)
{
- var normalized = Services.Tasks.Scanner.Parser.Parser.Normalize(name);
+ var normalized = name.ToNormalized();
return await _context.ReadingList
- .AnyAsync(x => x.NormalizedTitle.Equals(normalized));
+ .AnyAsync(x => x.NormalizedTitle != null && x.NormalizedTitle.Equals(normalized));
}
- public async Task<List<ReadingList>> GetAllReadingListsAsync()
+ public IEnumerable<PersonDto> GetReadingListCharactersAsync(int readingListId)
+ {
+ return _context.ReadingListItem
+ .Where(item => item.ReadingListId == readingListId)
+ .SelectMany(item => item.Chapter.People.Where(p => p.Role == PersonRole.Character))
+ .OrderBy(p => p.NormalizedName)
+ .ProjectTo<PersonDto>(_mapper.ConfigurationProvider)
+ .AsEnumerable();
+ }
+
+ public async Task<IList<ReadingList>> GetAllWithNonWebPCovers()
{
return await _context.ReadingList
- .Include(r => r.Items.OrderBy(i => i.Order))
+ .Where(c => !string.IsNullOrEmpty(c.CoverImage) && !c.CoverImage.EndsWith(".webp"))
+ .ToListAsync();
+ }
+
+ /// <summary>
+ /// If less than 4 images exist, will return nothing back. Will not be full paths, but just cover image filenames
+ /// </summary>
+ /// <param name="readingListId"></param>
+ /// <returns></returns>
+ /// <exception cref="NotImplementedException"></exception>
+ public async Task<IList<string>> GetFirstFourCoverImagesByReadingListId(int readingListId)
+ {
+ return await _context.ReadingListItem
+ .Where(ri => ri.ReadingListId == readingListId)
+ .Include(ri => ri.Chapter)
+ .Where(ri => ri.Chapter.CoverImage != null)
+ .Select(ri => ri.Chapter.CoverImage)
+ .Take(4)
+ .ToListAsync();
+ }
+
+ public async Task<int> RemoveReadingListsWithoutSeries()
+ {
+ var listsToDelete = await _context.ReadingList
+ .Include(c => c.Items)
+ .Where(c => c.Items.Count == 0)
.AsSplitQuery()
- .OrderBy(l => l.Title)
.ToListAsync();
+ _context.RemoveRange(listsToDelete);
+
+ return await _context.SaveChangesAsync();
+ }
+
+
+ public async Task<ReadingList?> GetReadingListByTitleAsync(string name, int userId, ReadingListIncludes includes = ReadingListIncludes.Items)
+ {
+ var normalized = name.ToNormalized();
+ return await _context.ReadingList
+ .Includes(includes)
+ .FirstOrDefaultAsync(x => x.NormalizedTitle != null && x.NormalizedTitle.Equals(normalized) && x.AppUserId == userId);
}
public void Remove(ReadingListItem item)
@@ -106,17 +166,18 @@ public class ReadingListRepository : IReadingListRepository
}
- public async Task<PagedList<ReadingListDto>> GetReadingListDtosForUserAsync(int userId, bool includePromoted, UserParams userParams)
+ public async Task<PagedList<ReadingListDto>> GetReadingListDtosForUserAsync(int userId, bool includePromoted, UserParams userParams, bool sortByLastModified = true)
{
var userAgeRating = (await _context.AppUser.SingleAsync(u => u.Id == userId)).AgeRestriction;
var query = _context.ReadingList
.Where(l => l.AppUserId == userId || (includePromoted && l.Promoted ))
- .Where(l => l.AgeRating >= userAgeRating)
- .OrderBy(l => l.LastModified)
- .ProjectTo<ReadingListDto>(_mapper.ConfigurationProvider)
+ .Where(l => l.AgeRating >= userAgeRating);
+ query = sortByLastModified ? query.OrderByDescending(l => l.LastModified) : query.OrderBy(l => l.NormalizedTitle);
+
+ var finalQuery = query.ProjectTo<ReadingListDto>(_mapper.ConfigurationProvider)
.AsNoTracking();
- return await PagedList<ReadingListDto>.CreateAsync(query, userParams.PageNumber, userParams.PageSize);
+ return await PagedList<ReadingListDto>.CreateAsync(finalQuery, userParams.PageNumber, userParams.PageSize);
}
public async Task<IEnumerable<ReadingListDto>> GetReadingListDtosForSeriesAndUserAsync(int userId, int seriesId, bool includePromoted)
@@ -132,10 +193,11 @@ public class ReadingListRepository : IReadingListRepository
return await query.ToListAsync();
}
- public async Task<ReadingList> GetReadingListByIdAsync(int readingListId)
+ public async Task<ReadingList?> GetReadingListByIdAsync(int readingListId, ReadingListIncludes includes = ReadingListIncludes.None)
{
return await _context.ReadingList
.Where(r => r.Id == readingListId)
+ .Includes(includes)
.Include(r => r.Items.OrderBy(item => item.Order))
.AsSplitQuery()
.SingleOrDefaultAsync();
@@ -241,7 +303,7 @@ public class ReadingListRepository : IReadingListRepository
return items;
}
- public async Task<ReadingListDto> GetReadingListDtoByIdAsync(int readingListId, int userId)
+ public async Task<ReadingListDto?> GetReadingListDtoByIdAsync(int readingListId, int userId)
{
return await _context.ReadingList
.Where(r => r.Id == readingListId && (r.AppUserId == userId || r.Promoted))
@@ -261,14 +323,14 @@ public class ReadingListRepository : IReadingListRepository
{
var progress = userProgress.Where(p => p.ChapterId == item.ChapterId).ToList();
if (progress.Count == 0) continue;
- item.PagesRead = progress.Sum(p => p.PagesRead);
+ item.PagesRead = progress.Sum(p => p.PagesRead);
item.LastReadingProgressUtc = progress.Max(p => p.LastModifiedUtc);
}
return items;
}
- public async Task<ReadingListDto> GetReadingListDtoByTitleAsync(int userId, string title)
+ public async Task<ReadingListDto?> GetReadingListDtoByTitleAsync(int userId, string title)
{
return await _context.ReadingList
.Where(r => r.Title.Equals(title) && r.AppUserId == userId)
diff --git a/API/Data/Repositories/SeriesRepository.cs b/API/Data/Repositories/SeriesRepository.cs
index 4f055a2c2..e611e841c 100644
--- a/API/Data/Repositories/SeriesRepository.cs
+++ b/API/Data/Repositories/SeriesRepository.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Drawing;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
@@ -16,6 +17,7 @@ using API.Entities;
using API.Entities.Enums;
using API.Entities.Metadata;
using API.Extensions;
+using API.Extensions.QueryExtensions;
using API.Helpers;
using API.Services;
using API.Services.Tasks;
@@ -78,7 +80,7 @@ public interface ISeriesRepository
Task<SearchResultGroupDto> SearchSeries(int userId, bool isAdmin, IList<int> libraryIds, string searchQuery);
Task<IEnumerable<Series>> GetSeriesForLibraryIdAsync(int libraryId, SeriesIncludes includes = SeriesIncludes.None);
Task<SeriesDto> GetSeriesDtoByIdAsync(int seriesId, int userId);
- Task<Series> GetSeriesByIdAsync(int seriesId, SeriesIncludes includes = SeriesIncludes.Volumes | SeriesIncludes.Metadata);
+ Task<Series?> GetSeriesByIdAsync(int seriesId, SeriesIncludes includes = SeriesIncludes.Volumes | SeriesIncludes.Metadata);
Task<IList<Series>> GetSeriesByIdsAsync(IList<int> seriesIds);
Task<int[]> GetChapterIdsForSeriesAsync(IList<int> seriesIds);
Task<IDictionary<int, IList<int>>> GetChapterIdWithSeriesIdForSeriesAsync(int[] seriesIds);
@@ -89,20 +91,19 @@ public interface ISeriesRepository
/// <param name="series"></param>
/// <returns></returns>
Task AddSeriesModifiers(int userId, List<SeriesDto> series);
- Task<string> GetSeriesCoverImageAsync(int seriesId);
+ Task<string?> GetSeriesCoverImageAsync(int seriesId);
Task<PagedList<SeriesDto>> GetOnDeck(int userId, int libraryId, UserParams userParams, FilterDto filter);
Task<PagedList<SeriesDto>> GetRecentlyAdded(int libraryId, int userId, UserParams userParams, FilterDto filter);
- Task<SeriesMetadataDto> GetSeriesMetadata(int seriesId);
+ Task<SeriesMetadataDto?> GetSeriesMetadata(int seriesId);
Task<PagedList<SeriesDto>> GetSeriesDtoForCollectionAsync(int collectionId, int userId, UserParams userParams);
Task<IList<MangaFile>> GetFilesForSeries(int seriesId);
Task<IEnumerable<SeriesDto>> GetSeriesDtoForIdsAsync(IEnumerable<int> seriesIds, int userId);
Task<IList<string>> GetAllCoverImagesAsync();
Task<IEnumerable<string>> GetLockedCoverImagesAsync();
Task<PagedList<Series>> GetFullSeriesForLibraryIdAsync(int libraryId, UserParams userParams);
- Task<Series> GetFullSeriesForSeriesIdAsync(int seriesId);
+ Task<Series?> GetFullSeriesForSeriesIdAsync(int seriesId);
Task<Chunk> GetChunkInfo(int libraryId = 0);
Task<IList<SeriesMetadata>> GetSeriesMetadataForIdsAsync(IEnumerable<int> seriesIds);
-
Task<IEnumerable<GroupedSeriesDto>> GetRecentlyUpdatedSeries(int userId, int pageSize = 30);
Task<RelatedSeriesDto> GetRelatedSeries(int userId, int seriesId);
Task<IEnumerable<SeriesDto>> GetSeriesForRelationKind(int userId, int seriesId, RelationKind kind);
@@ -111,20 +112,19 @@ public interface ISeriesRepository
Task<PagedList<SeriesDto>> GetHighlyRated(int userId, int libraryId, UserParams userParams);
Task<PagedList<SeriesDto>> GetMoreIn(int userId, int libraryId, int genreId, UserParams userParams);
Task<PagedList<SeriesDto>> GetRediscover(int userId, int libraryId, UserParams userParams);
- Task<SeriesDto> GetSeriesForMangaFile(int mangaFileId, int userId);
- Task<SeriesDto> GetSeriesForChapter(int chapterId, int userId);
+ Task<SeriesDto?> GetSeriesForMangaFile(int mangaFileId, int userId);
+ Task<SeriesDto?> GetSeriesForChapter(int chapterId, int userId);
Task<PagedList<SeriesDto>> GetWantToReadForUserAsync(int userId, UserParams userParams, FilterDto filter);
Task<bool> IsSeriesInWantToRead(int userId, int seriesId);
- Task<Series> GetSeriesByFolderPath(string folder, SeriesIncludes includes = SeriesIncludes.None);
-
- Task<IEnumerable<Series>> GetAllSeriesByNameAsync(IEnumerable<string> normalizedNames,
+ Task<Series?> GetSeriesByFolderPath(string folder, SeriesIncludes includes = SeriesIncludes.None);
+ Task<IEnumerable<Series>> GetAllSeriesByNameAsync(IList<string> normalizedNames,
int userId, SeriesIncludes includes = SeriesIncludes.None);
Task<IEnumerable<SeriesDto>> GetAllSeriesDtosByNameAsync(IEnumerable<string> normalizedNames,
int userId, SeriesIncludes includes = SeriesIncludes.None);
- Task<Series> GetFullSeriesByAnyName(string seriesName, string localizedName, int libraryId, MangaFormat format, bool withFullIncludes = true);
+ Task<Series?> GetFullSeriesByAnyName(string seriesName, string localizedName, int libraryId, MangaFormat format, bool withFullIncludes = true);
Task<IList<Series>> RemoveSeriesNotInList(IList<ParsedSeries> seenSeries, int libraryId);
Task<IDictionary<string, IList<SeriesModified>>> GetFolderPathMap(int libraryId);
- Task<AgeRating> GetMaxAgeRatingFromSeriesAsync(IEnumerable<int> seriesIds);
+ Task<AgeRating?> GetMaxAgeRatingFromSeriesAsync(IEnumerable<int> seriesIds);
/// <summary>
/// This is only used for <see cref="MigrateUserProgressLibraryId"/>
/// </summary>
@@ -132,12 +132,17 @@ public interface ISeriesRepository
Task<IDictionary<int, int>> GetLibraryIdsForSeriesAsync();
Task<IList<SeriesMetadataDto>> GetSeriesMetadataForIds(IEnumerable<int> seriesIds);
+ Task<IList<Series>> GetAllWithNonWebPCovers(bool customOnly = true);
}
public class SeriesRepository : ISeriesRepository
{
private readonly DataContext _context;
private readonly IMapper _mapper;
+
+ private readonly Regex _yearRegex = new Regex(@"\d{4}", RegexOptions.Compiled,
+ Services.Tasks.Scanner.Parser.Parser.RegexTimeout);
+
public SeriesRepository(DataContext context, IMapper mapper)
{
_context = context;
@@ -202,6 +207,7 @@ public class SeriesRepository : ISeriesRepository
/// <returns></returns>
public async Task<PagedList<Series>> GetFullSeriesForLibraryIdAsync(int libraryId, UserParams userParams)
{
+ #nullable disable
var query = _context.Series
.Where(s => s.LibraryId == libraryId)
@@ -229,11 +235,12 @@ public class SeriesRepository : ISeriesRepository
.ThenInclude(v => v.Chapters)
.ThenInclude(c => c.Tags)
- .Include(s => s.Volumes)
- .ThenInclude(v => v.Chapters)
+ .Include(s => s.Volumes)!
+ .ThenInclude(v => v.Chapters)!
.ThenInclude(c => c.Files)
.AsSplitQuery()
.OrderBy(s => s.SortName.ToLower());
+#nullable enable
return await PagedList<Series>.CreateAsync(query, userParams.PageNumber, userParams.PageSize);
}
@@ -243,8 +250,9 @@ public class SeriesRepository : ISeriesRepository
/// </summary>
/// <param name="seriesId"></param>
/// <returns></returns>
- public async Task<Series> GetFullSeriesForSeriesIdAsync(int seriesId)
+ public async Task<Series?> GetFullSeriesForSeriesIdAsync(int seriesId)
{
+ #nullable disable
return await _context.Series
.Where(s => s.Id == seriesId)
.Include(s => s.Relations)
@@ -274,6 +282,7 @@ public class SeriesRepository : ISeriesRepository
.ThenInclude(c => c.Files)
.AsSplitQuery()
.SingleOrDefaultAsync();
+ #nullable enable
}
/// <summary>
@@ -313,7 +322,7 @@ public class SeriesRepository : ISeriesRepository
{
const int maxRecords = 15;
var result = new SearchResultGroupDto();
- var searchQueryNormalized = Services.Tasks.Scanner.Parser.Parser.Normalize(searchQuery);
+ var searchQueryNormalized = searchQuery.ToNormalized();
var userRating = await _context.AppUser.GetUserAgeRestriction(userId);
var seriesIds = _context.Series
@@ -332,20 +341,20 @@ public class SeriesRepository : ISeriesRepository
.ProjectTo<LibraryDto>(_mapper.ConfigurationProvider)
.ToListAsync();
- var justYear = Regex.Match(searchQuery, @"\d{4}", RegexOptions.None, Services.Tasks.Scanner.Parser.Parser.RegexTimeout).Value;
+ var justYear = _yearRegex.Match(searchQuery).Value;
var hasYearInQuery = !string.IsNullOrEmpty(justYear);
var yearComparison = hasYearInQuery ? int.Parse(justYear) : 0;
result.Series = _context.Series
.Where(s => libraryIds.Contains(s.LibraryId))
- .Where(s => EF.Functions.Like(s.Name, $"%{searchQuery}%")
- || EF.Functions.Like(s.OriginalName, $"%{searchQuery}%")
- || EF.Functions.Like(s.LocalizedName, $"%{searchQuery}%")
- || EF.Functions.Like(s.NormalizedName, $"%{searchQueryNormalized}%")
- || (hasYearInQuery && s.Metadata.ReleaseYear == yearComparison))
+ .Where(s => (EF.Functions.Like(s.Name, $"%{searchQuery}%")
+ || (s.OriginalName != null && EF.Functions.Like(s.OriginalName, $"%{searchQuery}%"))
+ || (s.LocalizedName != null && EF.Functions.Like(s.LocalizedName, $"%{searchQuery}%"))
+ || (EF.Functions.Like(s.NormalizedName, $"%{searchQueryNormalized}%"))
+ || (hasYearInQuery && s.Metadata.ReleaseYear == yearComparison)))
.RestrictAgainstAgeRestriction(userRating)
.Include(s => s.Library)
- .OrderBy(s => s.SortName.ToLower())
+ .OrderBy(s => s.SortName!.ToLower())
.AsNoTracking()
.AsSplitQuery()
.Take(maxRecords)
@@ -362,8 +371,8 @@ public class SeriesRepository : ISeriesRepository
.ToListAsync();
result.Collections = await _context.CollectionTag
- .Where(c => EF.Functions.Like(c.Title, $"%{searchQuery}%")
- || EF.Functions.Like(c.NormalizedTitle, $"%{searchQueryNormalized}%"))
+ .Where(c => (EF.Functions.Like(c.Title, $"%{searchQuery}%"))
+ || (EF.Functions.Like(c.NormalizedTitle, $"%{searchQueryNormalized}%")))
.Where(c => c.Promoted || isAdmin)
.RestrictAgainstAgeRestriction(userRating)
.OrderBy(s => s.NormalizedTitle)
@@ -376,7 +385,7 @@ public class SeriesRepository : ISeriesRepository
result.Persons = await _context.SeriesMetadata
.Where(sm => seriesIds.Contains(sm.SeriesId))
- .SelectMany(sm => sm.People.Where(t => EF.Functions.Like(t.Name, $"%{searchQuery}%")))
+ .SelectMany(sm => sm.People.Where(t => t.Name != null && EF.Functions.Like(t.Name, $"%{searchQuery}%")))
.AsSplitQuery()
.Take(maxRecords)
.Distinct()
@@ -448,7 +457,7 @@ public class SeriesRepository : ISeriesRepository
/// <param name="seriesId"></param>
/// <param name="includes"></param>
/// <returns></returns>
- public async Task<Series> GetSeriesByIdAsync(int seriesId, SeriesIncludes includes = SeriesIncludes.Volumes | SeriesIncludes.Metadata)
+ public async Task<Series?> GetSeriesByIdAsync(int seriesId, SeriesIncludes includes = SeriesIncludes.Volumes | SeriesIncludes.Metadata)
{
return await _context.Series
.Where(s => s.Id == seriesId)
@@ -552,6 +561,21 @@ public class SeriesRepository : ISeriesRepository
}
+ /// <summary>
+ /// Returns custom images only
+ /// </summary>
+ /// <returns></returns>
+ public async Task<IList<Series>> GetAllWithNonWebPCovers(bool customOnly = true)
+ {
+ var prefix = ImageService.GetSeriesFormat(0).Replace("0", string.Empty);
+ return await _context.Series
+ .Where(c => !string.IsNullOrEmpty(c.CoverImage)
+ && !c.CoverImage.EndsWith(".webp")
+ && (!customOnly || c.CoverImage.StartsWith(prefix)))
+ .ToListAsync();
+ }
+
+
public async Task AddSeriesModifiers(int userId, List<SeriesDto> series)
{
var userProgress = await _context.AppUserProgresses
@@ -581,12 +605,11 @@ public class SeriesRepository : ISeriesRepository
}
}
- public async Task<string> GetSeriesCoverImageAsync(int seriesId)
+ public async Task<string?> GetSeriesCoverImageAsync(int seriesId)
{
return await _context.Series
.Where(s => s.Id == seriesId)
.Select(s => s.CoverImage)
- .AsNoTracking()
.SingleOrDefaultAsync();
}
@@ -711,7 +734,7 @@ public class SeriesRepository : ISeriesRepository
var cutoffProgressPoint = DateTime.Now - TimeSpan.FromDays(30);
var cutoffLastAddedPoint = DateTime.Now - TimeSpan.FromDays(7);
- var libraryIds = _context.Library.GetUserLibraries(userId, QueryContext.Dashboard)
+ var libraryIds = GetLibraryIdsForUser(userId, libraryId, QueryContext.Dashboard)
.Where(id => libraryId == 0 || id == libraryId);
var usersSeriesIds = GetSeriesIdsForLibraryIds(libraryIds);
@@ -743,8 +766,12 @@ public class SeriesRepository : ISeriesRepository
private async Task<IQueryable<Series>> CreateFilteredSearchQueryable(int userId, int libraryId, FilterDto filter, QueryContext queryContext)
{
+ // NOTE: Why do we even have libraryId when the filter has the actual libraryIds?
var userLibraries = await GetUserLibrariesForFilteredQuery(libraryId, userId, queryContext);
var userRating = await _context.AppUser.GetUserAgeRestriction(userId);
+ var onlyParentSeries = await _context.AppUserPreferences.Where(u => u.AppUserId == userId)
+ .Select(u => u.CollapseSeriesRelationships)
+ .SingleOrDefaultAsync();
var formats = ExtractFilters(libraryId, userId, filter, ref userLibraries,
out var allPeopleIds, out var hasPeopleFilter, out var hasGenresFilter,
@@ -753,30 +780,33 @@ public class SeriesRepository : ISeriesRepository
out var hasPublicationFilter, out var hasSeriesNameFilter, out var hasReleaseYearMinFilter, out var hasReleaseYearMaxFilter);
var query = _context.Series
- .Where(s => userLibraries.Contains(s.LibraryId)
- && formats.Contains(s.Format)
- && (!hasGenresFilter || s.Metadata.Genres.Any(g => filter.Genres.Contains(g.Id)))
- && (!hasPeopleFilter || s.Metadata.People.Any(p => allPeopleIds.Contains(p.Id)))
- && (!hasCollectionTagFilter ||
- s.Metadata.CollectionTags.Any(t => filter.CollectionTags.Contains(t.Id)))
- && (!hasRatingFilter || s.Ratings.Any(r => r.Rating >= filter.Rating && r.AppUserId == userId))
- && (!hasProgressFilter || seriesIds.Contains(s.Id))
- && (!hasAgeRating || filter.AgeRating.Contains(s.Metadata.AgeRating))
- && (!hasTagsFilter || s.Metadata.Tags.Any(t => filter.Tags.Contains(t.Id)))
- && (!hasLanguageFilter || filter.Languages.Contains(s.Metadata.Language))
- && (!hasReleaseYearMinFilter || s.Metadata.ReleaseYear >= filter.ReleaseYearRange.Min)
- && (!hasReleaseYearMaxFilter || s.Metadata.ReleaseYear <= filter.ReleaseYearRange.Max)
- && (!hasPublicationFilter || filter.PublicationStatus.Contains(s.Metadata.PublicationStatus)))
- .Where(s => !hasSeriesNameFilter ||
- EF.Functions.Like(s.Name, $"%{filter.SeriesNameQuery}%")
- || EF.Functions.Like(s.OriginalName, $"%{filter.SeriesNameQuery}%")
- || EF.Functions.Like(s.LocalizedName, $"%{filter.SeriesNameQuery}%"));
+ .AsNoTracking()
+ .WhereIf(hasGenresFilter, s => s.Metadata.Genres.Any(g => filter.Genres.Contains(g.Id)))
+ .WhereIf(hasPeopleFilter, s => s.Metadata.People.Any(p => allPeopleIds.Contains(p.Id)))
+ .WhereIf(hasCollectionTagFilter,
+ s => s.Metadata.CollectionTags.Any(t => filter.CollectionTags.Contains(t.Id)))
+ .WhereIf(hasRatingFilter, s => s.Ratings.Any(r => r.Rating >= filter.Rating && r.AppUserId == userId))
+ .WhereIf(hasProgressFilter, s => seriesIds.Contains(s.Id))
+ .WhereIf(hasAgeRating, s => filter.AgeRating.Contains(s.Metadata.AgeRating))
+ .WhereIf(hasTagsFilter, s => s.Metadata.Tags.Any(t => filter.Tags.Contains(t.Id)))
+ .WhereIf(hasLanguageFilter, s => filter.Languages.Contains(s.Metadata.Language))
+ .WhereIf(hasReleaseYearMinFilter, s => s.Metadata.ReleaseYear >= filter.ReleaseYearRange!.Min)
+ .WhereIf(hasReleaseYearMaxFilter, s => s.Metadata.ReleaseYear <= filter.ReleaseYearRange!.Max)
+ .WhereIf(hasPublicationFilter, s => filter.PublicationStatus.Contains(s.Metadata.PublicationStatus))
+ .WhereIf(hasSeriesNameFilter, s => EF.Functions.Like(s.Name, $"%{filter.SeriesNameQuery}%")
+ || EF.Functions.Like(s.OriginalName!, $"%{filter.SeriesNameQuery}%")
+ || EF.Functions.Like(s.LocalizedName!, $"%{filter.SeriesNameQuery}%"))
+
+ .WhereIf(onlyParentSeries,
+ s => s.RelationOf.Count == 0 || s.RelationOf.All(p => p.RelationKind == RelationKind.Prequel))
+ .Where(s => userLibraries.Contains(s.LibraryId))
+ .Where(s => formats.Contains(s.Format));
+
if (userRating.AgeRating != AgeRating.NotApplicable)
{
query = query.RestrictAgainstAgeRestriction(userRating);
}
- query = query.AsNoTracking();
// If no sort options, default to using SortName
filter.SortOptions ??= new SortOptions()
@@ -825,24 +855,23 @@ public class SeriesRepository : ISeriesRepository
out var hasPublicationFilter, out var hasSeriesNameFilter, out var hasReleaseYearMinFilter, out var hasReleaseYearMaxFilter);
var query = sQuery
+ .WhereIf(hasGenresFilter, s => s.Metadata.Genres.Any(g => filter.Genres.Contains(g.Id)))
+ .WhereIf(hasPeopleFilter, s => s.Metadata.People.Any(p => allPeopleIds.Contains(p.Id)))
+ .WhereIf(hasCollectionTagFilter,
+ s => s.Metadata.CollectionTags.Any(t => filter.CollectionTags.Contains(t.Id)))
+ .WhereIf(hasRatingFilter, s => s.Ratings.Any(r => r.Rating >= filter.Rating && r.AppUserId == userId))
+ .WhereIf(hasProgressFilter, s => seriesIds.Contains(s.Id))
+ .WhereIf(hasAgeRating, s => filter.AgeRating.Contains(s.Metadata.AgeRating))
+ .WhereIf(hasTagsFilter, s => s.Metadata.Tags.Any(t => filter.Tags.Contains(t.Id)))
+ .WhereIf(hasLanguageFilter, s => filter.Languages.Contains(s.Metadata.Language))
+ .WhereIf(hasReleaseYearMinFilter, s => s.Metadata.ReleaseYear >= filter.ReleaseYearRange!.Min)
+ .WhereIf(hasReleaseYearMaxFilter, s => s.Metadata.ReleaseYear <= filter.ReleaseYearRange!.Max)
+ .WhereIf(hasPublicationFilter, s => filter.PublicationStatus.Contains(s.Metadata.PublicationStatus))
+ .WhereIf(hasSeriesNameFilter, s => EF.Functions.Like(s.Name, $"%{filter.SeriesNameQuery}%")
+ || EF.Functions.Like(s.OriginalName!, $"%{filter.SeriesNameQuery}%")
+ || EF.Functions.Like(s.LocalizedName!, $"%{filter.SeriesNameQuery}%"))
.Where(s => userLibraries.Contains(s.LibraryId)
- && formats.Contains(s.Format)
- && (!hasGenresFilter || s.Metadata.Genres.Any(g => filter.Genres.Contains(g.Id)))
- && (!hasPeopleFilter || s.Metadata.People.Any(p => allPeopleIds.Contains(p.Id)))
- && (!hasCollectionTagFilter ||
- s.Metadata.CollectionTags.Any(t => filter.CollectionTags.Contains(t.Id)))
- && (!hasRatingFilter || s.Ratings.Any(r => r.Rating >= filter.Rating && r.AppUserId == userId))
- && (!hasProgressFilter || seriesIds.Contains(s.Id))
- && (!hasAgeRating || filter.AgeRating.Contains(s.Metadata.AgeRating))
- && (!hasTagsFilter || s.Metadata.Tags.Any(t => filter.Tags.Contains(t.Id)))
- && (!hasLanguageFilter || filter.Languages.Contains(s.Metadata.Language))
- && (!hasReleaseYearMinFilter || s.Metadata.ReleaseYear >= filter.ReleaseYearRange.Min)
- && (!hasReleaseYearMaxFilter || s.Metadata.ReleaseYear <= filter.ReleaseYearRange.Max)
- && (!hasPublicationFilter || filter.PublicationStatus.Contains(s.Metadata.PublicationStatus)))
- .Where(s => !hasSeriesNameFilter ||
- EF.Functions.Like(s.Name, $"%{filter.SeriesNameQuery}%")
- || EF.Functions.Like(s.OriginalName, $"%{filter.SeriesNameQuery}%")
- || EF.Functions.Like(s.LocalizedName, $"%{filter.SeriesNameQuery}%"))
+ && formats.Contains(s.Format))
.AsNoTracking();
// If no sort options, default to using SortName
@@ -856,7 +885,7 @@ public class SeriesRepository : ISeriesRepository
{
query = filter.SortOptions.SortField switch
{
- SortField.SortName => query.OrderBy(s => s.SortName.ToLower()),
+ SortField.SortName => query.OrderBy(s => s.SortName!.ToLower()),
SortField.CreatedDate => query.OrderBy(s => s.Created),
SortField.LastModifiedDate => query.OrderBy(s => s.LastModified),
SortField.LastChapterAdded => query.OrderBy(s => s.LastChapterAdded),
@@ -868,7 +897,7 @@ public class SeriesRepository : ISeriesRepository
{
query = filter.SortOptions.SortField switch
{
- SortField.SortName => query.OrderByDescending(s => s.SortName.ToLower()),
+ SortField.SortName => query.OrderByDescending(s => s.SortName!.ToLower()),
SortField.CreatedDate => query.OrderByDescending(s => s.Created),
SortField.LastModifiedDate => query.OrderByDescending(s => s.LastModified),
SortField.LastChapterAdded => query.OrderByDescending(s => s.LastChapterAdded),
@@ -880,7 +909,7 @@ public class SeriesRepository : ISeriesRepository
return query;
}
- public async Task<SeriesMetadataDto> GetSeriesMetadata(int seriesId)
+ public async Task<SeriesMetadataDto?> GetSeriesMetadata(int seriesId)
{
var metadataDto = await _context.SeriesMetadata
.Where(metadata => metadata.SeriesId == seriesId)
@@ -962,20 +991,18 @@ public class SeriesRepository : ISeriesRepository
public async Task<IList<string>> GetAllCoverImagesAsync()
{
- return await _context.Series
+ return (await _context.Series
.Select(s => s.CoverImage)
.Where(t => !string.IsNullOrEmpty(t))
- .AsNoTracking()
- .ToListAsync();
+ .ToListAsync())!;
}
public async Task<IEnumerable<string>> GetLockedCoverImagesAsync()
{
- return await _context.Series
+ return (await _context.Series
.Where(s => s.CoverImageLocked && !string.IsNullOrEmpty(s.CoverImage))
.Select(s => s.CoverImage)
- .AsNoTracking()
- .ToListAsync();
+ .ToListAsync())!;
}
/// <summary>
@@ -1055,31 +1082,35 @@ public class SeriesRepository : ISeriesRepository
var items = (await GetRecentlyAddedChaptersQuery(userId));
if (userRating.AgeRating != AgeRating.NotApplicable)
{
- items = items.RestrictAgainstAgeRestriction(userRating);
+ items = items.RestrictAgainstAgeRestriction(userRating);
}
+
foreach (var item in items)
{
- if (seriesMap.Keys.Count == pageSize) break;
-
- if (seriesMap.ContainsKey(item.SeriesName))
- {
- seriesMap[item.SeriesName].Count += 1;
- }
- else
- {
- seriesMap[item.SeriesName] = new GroupedSeriesDto()
- {
- LibraryId = item.LibraryId,
- LibraryType = item.LibraryType,
- SeriesId = item.SeriesId,
- SeriesName = item.SeriesName,
- Created = item.Created,
- Id = index,
- Format = item.Format,
- Count = 1,
- };
- index += 1;
- }
+ if (seriesMap.Keys.Count == pageSize) break;
+
+ if (item.SeriesName == null) continue;
+
+
+ if (seriesMap.TryGetValue(item.SeriesName, out var value))
+ {
+ value.Count += 1;
+ }
+ else
+ {
+ seriesMap[item.SeriesName] = new GroupedSeriesDto()
+ {
+ LibraryId = item.LibraryId,
+ LibraryType = item.LibraryType,
+ SeriesId = item.SeriesId,
+ SeriesName = item.SeriesName,
+ Created = item.Created,
+ Id = index,
+ Format = item.Format,
+ Count = 1,
+ };
+ index += 1;
+ }
}
return seriesMap.Values.AsEnumerable();
@@ -1087,7 +1118,7 @@ public class SeriesRepository : ISeriesRepository
public async Task<IEnumerable<SeriesDto>> GetSeriesForRelationKind(int userId, int seriesId, RelationKind kind)
{
- var libraryIds = _context.Library.GetUserLibraries(userId);
+ var libraryIds = GetLibraryIdsForUser(userId);
var userRating = await _context.AppUser.GetUserAgeRestriction(userId);
var usersSeriesIds = _context.Series
@@ -1114,7 +1145,7 @@ public class SeriesRepository : ISeriesRepository
public async Task<PagedList<SeriesDto>> GetMoreIn(int userId, int libraryId, int genreId, UserParams userParams)
{
- var libraryIds = _context.Library.GetUserLibraries(userId, QueryContext.Recommended)
+ var libraryIds = GetLibraryIdsForUser(userId, libraryId, QueryContext.Recommended)
.Where(id => libraryId == 0 || id == libraryId);
var usersSeriesIds = GetSeriesIdsForLibraryIds(libraryIds);
@@ -1142,7 +1173,7 @@ public class SeriesRepository : ISeriesRepository
/// <returns></returns>
public async Task<PagedList<SeriesDto>> GetRediscover(int userId, int libraryId, UserParams userParams)
{
- var libraryIds = _context.Library.GetUserLibraries(userId, QueryContext.Recommended)
+ var libraryIds = GetLibraryIdsForUser(userId, libraryId, QueryContext.Recommended)
.Where(id => libraryId == 0 || id == libraryId);
var usersSeriesIds = GetSeriesIdsForLibraryIds(libraryIds);
var distinctSeriesIdsWithProgress = _context.AppUserProgresses
@@ -1160,9 +1191,9 @@ public class SeriesRepository : ISeriesRepository
return await PagedList<SeriesDto>.CreateAsync(query, userParams.PageNumber, userParams.PageSize);
}
- public async Task<SeriesDto> GetSeriesForMangaFile(int mangaFileId, int userId)
+ public async Task<SeriesDto?> GetSeriesForMangaFile(int mangaFileId, int userId)
{
- var libraryIds = _context.Library.GetUserLibraries(userId, QueryContext.Search);
+ var libraryIds = GetLibraryIdsForUser(userId, 0, QueryContext.Search);
var userRating = await _context.AppUser.GetUserAgeRestriction(userId);
return await _context.MangaFile
@@ -1177,9 +1208,9 @@ public class SeriesRepository : ISeriesRepository
.SingleOrDefaultAsync();
}
- public async Task<SeriesDto> GetSeriesForChapter(int chapterId, int userId)
+ public async Task<SeriesDto?> GetSeriesForChapter(int chapterId, int userId)
{
- var libraryIds = _context.Library.GetUserLibraries(userId);
+ var libraryIds = GetLibraryIdsForUser(userId);
var userRating = await _context.AppUser.GetUserAgeRestriction(userId);
return await _context.Chapter
.Where(m => m.Id == chapterId)
@@ -1198,23 +1229,24 @@ public class SeriesRepository : ISeriesRepository
/// <param name="folder">This will be normalized in the query</param>
/// <param name="includes">Additional relationships to include with the base query</param>
/// <returns></returns>
- public async Task<Series> GetSeriesByFolderPath(string folder, SeriesIncludes includes = SeriesIncludes.None)
+ public async Task<Series?> GetSeriesByFolderPath(string folder, SeriesIncludes includes = SeriesIncludes.None)
{
var normalized = Services.Tasks.Scanner.Parser.Parser.NormalizePath(folder);
return await _context.Series
- .Where(s => s.FolderPath.Equals(normalized))
+ .Where(s => s.FolderPath != null && s.FolderPath.Equals(normalized))
.Includes(includes)
.SingleOrDefaultAsync();
}
- public async Task<IEnumerable<Series>> GetAllSeriesByNameAsync(IEnumerable<string> normalizedNames,
+ public async Task<IEnumerable<Series>> GetAllSeriesByNameAsync(IList<string> normalizedNames,
int userId, SeriesIncludes includes = SeriesIncludes.None)
{
var libraryIds = _context.Library.GetUserLibraries(userId);
var userRating = await _context.AppUser.GetUserAgeRestriction(userId);
return await _context.Series
- .Where(s => normalizedNames.Contains(s.NormalizedName))
+ .Where(s => normalizedNames.Contains(s.NormalizedName) ||
+ normalizedNames.Contains(s.NormalizedLocalizedName))
.Where(s => libraryIds.Contains(s.LibraryId))
.RestrictAgainstAgeRestriction(userRating)
.Includes(includes)
@@ -1246,33 +1278,40 @@ public class SeriesRepository : ISeriesRepository
/// <param name="format"></param>
/// <param name="withFullIncludes">Defaults to true. This will query against all foreign keys (deep). If false, just the series will come back</param>
/// <returns></returns>
- public Task<Series> GetFullSeriesByAnyName(string seriesName, string localizedName, int libraryId, MangaFormat format, bool withFullIncludes = true)
+ public Task<Series?> GetFullSeriesByAnyName(string seriesName, string localizedName, int libraryId,
+ MangaFormat format, bool withFullIncludes = true)
{
- var normalizedSeries = Services.Tasks.Scanner.Parser.Parser.Normalize(seriesName);
- var normalizedLocalized = Services.Tasks.Scanner.Parser.Parser.Normalize(localizedName);
+ var normalizedSeries = seriesName.ToNormalized();
+ var normalizedLocalized = localizedName.ToNormalized();
var query = _context.Series
.Where(s => s.LibraryId == libraryId)
.Where(s => s.Format == format && format != MangaFormat.Unknown)
- .Where(s => s.NormalizedName.Equals(normalizedSeries)
- || (s.NormalizedLocalizedName.Equals(normalizedSeries) && s.NormalizedLocalizedName != string.Empty)
- || s.OriginalName.Equals(seriesName));
+ .Where(s =>
+ s.NormalizedName.Equals(normalizedSeries)
+ || s.NormalizedName.Equals(normalizedLocalized)
- if (!string.IsNullOrEmpty(normalizedLocalized))
- {
- query = query.Where(s =>
- s.NormalizedName.Equals(normalizedLocalized) || s.NormalizedLocalizedName.Equals(normalizedLocalized));
- }
+ || s.NormalizedLocalizedName.Equals(normalizedSeries)
+ || (!string.IsNullOrEmpty(normalizedLocalized) && s.NormalizedLocalizedName.Equals(normalizedLocalized))
+ || (s.OriginalName != null && s.OriginalName.Equals(seriesName))
+ );
if (!withFullIncludes)
{
return query.SingleOrDefaultAsync();
}
- return query.Include(s => s.Metadata)
+ #nullable disable
+ query = query.Include(s => s.Library)
+
+ .Include(s => s.Metadata)
.ThenInclude(m => m.People)
+
.Include(s => s.Metadata)
.ThenInclude(m => m.Genres)
- .Include(s => s.Library)
+
+ .Include(s => s.Metadata)
+ .ThenInclude(m => m.Tags)
+
.Include(s => s.Volumes)
.ThenInclude(v => v.Chapters)
.ThenInclude(cm => cm.People)
@@ -1285,15 +1324,13 @@ public class SeriesRepository : ISeriesRepository
.ThenInclude(v => v.Chapters)
.ThenInclude(c => c.Genres)
-
- .Include(s => s.Metadata)
- .ThenInclude(m => m.Tags)
-
.Include(s => s.Volumes)
.ThenInclude(v => v.Chapters)
.ThenInclude(c => c.Files)
- .AsSplitQuery()
- .SingleOrDefaultAsync();
+
+ .AsSplitQuery();
+ return query.SingleOrDefaultAsync();
+ #nullable enable
}
@@ -1350,7 +1387,7 @@ public class SeriesRepository : ISeriesRepository
public async Task<PagedList<SeriesDto>> GetHighlyRated(int userId, int libraryId, UserParams userParams)
{
- var libraryIds = _context.Library.GetUserLibraries(userId, QueryContext.Recommended)
+ var libraryIds = GetLibraryIdsForUser(userId, libraryId, QueryContext.Recommended)
.Where(id => libraryId == 0 || id == libraryId);
var usersSeriesIds = GetSeriesIdsForLibraryIds(libraryIds);
var distinctSeriesIdsWithHighRating = _context.AppUserRating
@@ -1372,7 +1409,7 @@ public class SeriesRepository : ISeriesRepository
public async Task<PagedList<SeriesDto>> GetQuickReads(int userId, int libraryId, UserParams userParams)
{
- var libraryIds = _context.Library.GetUserLibraries(userId, QueryContext.Recommended)
+ var libraryIds = GetLibraryIdsForUser(userId, libraryId, QueryContext.Recommended)
.Where(id => libraryId == 0 || id == libraryId);
var usersSeriesIds = GetSeriesIdsForLibraryIds(libraryIds);
var distinctSeriesIdsWithProgress = _context.AppUserProgresses
@@ -1399,7 +1436,7 @@ public class SeriesRepository : ISeriesRepository
public async Task<PagedList<SeriesDto>> GetQuickCatchupReads(int userId, int libraryId, UserParams userParams)
{
- var libraryIds = _context.Library.GetUserLibraries(userId, QueryContext.Recommended)
+ var libraryIds = GetLibraryIdsForUser(userId, libraryId, QueryContext.Recommended)
.Where(id => libraryId == 0 || id == libraryId);
var usersSeriesIds = GetSeriesIdsForLibraryIds(libraryIds);
var distinctSeriesIdsWithProgress = _context.AppUserProgresses
@@ -1575,6 +1612,7 @@ public class SeriesRepository : ISeriesRepository
var map = new Dictionary<string, IList<SeriesModified>>();
foreach (var series in info)
{
+ if (series.FolderPath == null) continue;
if (!map.ContainsKey(series.FolderPath))
{
map.Add(series.FolderPath, new List<SeriesModified>()
@@ -1597,7 +1635,7 @@ public class SeriesRepository : ISeriesRepository
/// </summary>
/// <param name="seriesIds"></param>
/// <returns></returns>
- public async Task<AgeRating> GetMaxAgeRatingFromSeriesAsync(IEnumerable<int> seriesIds)
+ public async Task<AgeRating?> GetMaxAgeRatingFromSeriesAsync(IEnumerable<int> seriesIds)
{
return await _context.Series
.Where(s => seriesIds.Contains(s.Id))
@@ -1606,4 +1644,32 @@ public class SeriesRepository : ISeriesRepository
.OrderBy(s => s)
.LastOrDefaultAsync();
}
+
+ /// <summary>
+ /// Returns all library ids for a user
+ /// </summary>
+ /// <param name="userId"></param>
+ /// <param name="libraryId">0 for no library filter</param>
+ /// <param name="queryContext">Defaults to None - The context behind this query, so appropriate restrictions can be placed</param>
+ /// <returns></returns>
+ private IQueryable<int> GetLibraryIdsForUser(int userId, int libraryId = 0, QueryContext queryContext = QueryContext.None)
+ {
+ var user = _context.AppUser
+ .AsSplitQuery()
+ .AsNoTracking()
+ .Where(u => u.Id == userId)
+ .AsSingleQuery();
+
+ if (libraryId == 0)
+ {
+ return user.SelectMany(l => l.Libraries)
+ .IsRestricted(queryContext)
+ .Select(lib => lib.Id);
+ }
+
+ return user.SelectMany(l => l.Libraries)
+ .Where(lib => lib.Id == libraryId)
+ .IsRestricted(queryContext)
+ .Select(lib => lib.Id);
+ }
}
diff --git a/API/Data/Repositories/SettingsRepository.cs b/API/Data/Repositories/SettingsRepository.cs
index b94204d56..c6a682391 100644
--- a/API/Data/Repositories/SettingsRepository.cs
+++ b/API/Data/Repositories/SettingsRepository.cs
@@ -5,7 +5,6 @@ using API.DTOs.Settings;
using API.Entities;
using API.Entities.Enums;
using AutoMapper;
-using AutoMapper.QueryableExtensions;
using Microsoft.EntityFrameworkCore;
namespace API.Data.Repositories;
@@ -44,7 +43,7 @@ public class SettingsRepository : ISettingsRepository
public Task<ServerSetting> GetSettingAsync(ServerSettingKey key)
{
- return _context.ServerSetting.SingleOrDefaultAsync(x => x.Key == key);
+ return _context.ServerSetting.SingleOrDefaultAsync(x => x.Key == key)!;
}
public async Task<IEnumerable<ServerSetting>> GetSettingsAsync()
diff --git a/API/Data/Repositories/SiteThemeRepository.cs b/API/Data/Repositories/SiteThemeRepository.cs
index 98f9c8c87..b2c082183 100644
--- a/API/Data/Repositories/SiteThemeRepository.cs
+++ b/API/Data/Repositories/SiteThemeRepository.cs
@@ -15,11 +15,11 @@ public interface ISiteThemeRepository
void Remove(SiteTheme theme);
void Update(SiteTheme siteTheme);
Task<IEnumerable<SiteThemeDto>> GetThemeDtos();
- Task<SiteThemeDto> GetThemeDto(int themeId);
- Task<SiteThemeDto> GetThemeDtoByName(string themeName);
+ Task<SiteThemeDto?> GetThemeDto(int themeId);
+ Task<SiteThemeDto?> GetThemeDtoByName(string themeName);
Task<SiteTheme> GetDefaultTheme();
Task<IEnumerable<SiteTheme>> GetThemes();
- Task<SiteTheme> GetThemeById(int themeId);
+ Task<SiteTheme?> GetThemeById(int themeId);
}
public class SiteThemeRepository : ISiteThemeRepository
@@ -55,7 +55,7 @@ public class SiteThemeRepository : ISiteThemeRepository
.ToListAsync();
}
- public async Task<SiteThemeDto> GetThemeDtoByName(string themeName)
+ public async Task<SiteThemeDto?> GetThemeDtoByName(string themeName)
{
return await _context.SiteTheme
.Where(t => t.Name.Equals(themeName))
@@ -71,13 +71,13 @@ public class SiteThemeRepository : ISiteThemeRepository
{
var result = await _context.SiteTheme
.Where(t => t.IsDefault)
- .SingleOrDefaultAsync();
+ .FirstOrDefaultAsync();
if (result == null)
{
return await _context.SiteTheme
- .Where(t => t.NormalizedName == "dark")
- .SingleOrDefaultAsync();
+ .Where(t => t.NormalizedName == Seed.DefaultThemes[0].NormalizedName)
+ .SingleAsync();
}
return result;
@@ -89,14 +89,14 @@ public class SiteThemeRepository : ISiteThemeRepository
.ToListAsync();
}
- public async Task<SiteTheme> GetThemeById(int themeId)
+ public async Task<SiteTheme?> GetThemeById(int themeId)
{
return await _context.SiteTheme
.Where(t => t.Id == themeId)
.SingleOrDefaultAsync();
}
- public async Task<SiteThemeDto> GetThemeDto(int themeId)
+ public async Task<SiteThemeDto?> GetThemeDto(int themeId)
{
return await _context.SiteTheme
.Where(t => t.Id == themeId)
diff --git a/API/Data/Repositories/TagRepository.cs b/API/Data/Repositories/TagRepository.cs
index 07f895193..c8d58a2bf 100644
--- a/API/Data/Repositories/TagRepository.cs
+++ b/API/Data/Repositories/TagRepository.cs
@@ -4,6 +4,7 @@ using System.Threading.Tasks;
using API.DTOs.Metadata;
using API.Entities;
using API.Extensions;
+using API.Extensions.QueryExtensions;
using AutoMapper;
using AutoMapper.QueryableExtensions;
using Microsoft.EntityFrameworkCore;
diff --git a/API/Data/Repositories/UserRepository.cs b/API/Data/Repositories/UserRepository.cs
index 0a11eccfe..de6f041e6 100644
--- a/API/Data/Repositories/UserRepository.cs
+++ b/API/Data/Repositories/UserRepository.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using API.Constants;
@@ -9,11 +8,12 @@ using API.DTOs.Account;
using API.DTOs.Filtering;
using API.DTOs.Reader;
using API.Entities;
+using API.Extensions;
+using API.Extensions.QueryExtensions;
using AutoMapper;
using AutoMapper.QueryableExtensions;
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
-using SixLabors.ImageSharp.PixelFormats;
namespace API.Data.Repositories;
@@ -38,31 +38,31 @@ public interface IUserRepository
void Update(AppUserPreferences preferences);
void Update(AppUserBookmark bookmark);
void Add(AppUserBookmark bookmark);
- public void Delete(AppUser user);
+ public void Delete(AppUser? user);
void Delete(AppUserBookmark bookmark);
- Task<IEnumerable<MemberDto>> GetEmailConfirmedMemberDtosAsync();
- Task<IEnumerable<MemberDto>> GetPendingMemberDtosAsync();
+ Task<IEnumerable<MemberDto>> GetEmailConfirmedMemberDtosAsync(bool emailConfirmed = true);
Task<IEnumerable<AppUser>> GetAdminUsersAsync();
- Task<bool> IsUserAdminAsync(AppUser user);
- Task<AppUserRating> GetUserRatingAsync(int seriesId, int userId);
- Task<AppUserPreferences> GetPreferencesAsync(string username);
+ Task<bool> IsUserAdminAsync(AppUser? user);
+ Task<AppUserRating?> GetUserRatingAsync(int seriesId, int userId);
+ Task<AppUserPreferences?> GetPreferencesAsync(string username);
Task<IEnumerable<BookmarkDto>> GetBookmarkDtosForSeries(int userId, int seriesId);
Task<IEnumerable<BookmarkDto>> GetBookmarkDtosForVolume(int userId, int volumeId);
Task<IEnumerable<BookmarkDto>> GetBookmarkDtosForChapter(int userId, int chapterId);
Task<IEnumerable<BookmarkDto>> GetAllBookmarkDtos(int userId, FilterDto filter);
Task<IEnumerable<AppUserBookmark>> GetAllBookmarksAsync();
- Task<AppUserBookmark> GetBookmarkForPage(int page, int chapterId, int userId);
- Task<AppUserBookmark> GetBookmarkAsync(int bookmarkId);
+ Task<AppUserBookmark?> GetBookmarkForPage(int page, int chapterId, int userId);
+ Task<AppUserBookmark?> GetBookmarkAsync(int bookmarkId);
Task<int> GetUserIdByApiKeyAsync(string apiKey);
- Task<AppUser> GetUserByUsernameAsync(string username, AppUserIncludes includeFlags = AppUserIncludes.None);
- Task<AppUser> GetUserByIdAsync(int userId, AppUserIncludes includeFlags = AppUserIncludes.None);
+ Task<AppUser?> GetUserByUsernameAsync(string username, AppUserIncludes includeFlags = AppUserIncludes.None);
+ Task<AppUser?> GetUserByIdAsync(int userId, AppUserIncludes includeFlags = AppUserIncludes.None);
Task<int> GetUserIdByUsernameAsync(string username);
Task<IList<AppUserBookmark>> GetAllBookmarksByIds(IList<int> bookmarkIds);
- Task<AppUser> GetUserByEmailAsync(string email);
+ Task<AppUser?> GetUserByEmailAsync(string email);
Task<IEnumerable<AppUserPreferences>> GetAllPreferencesByThemeAsync(int themeId);
Task<bool> HasAccessToLibrary(int libraryId, int userId);
Task<IEnumerable<AppUser>> GetAllUsersAsync(AppUserIncludes includeFlags = AppUserIncludes.None);
- Task<AppUser> GetUserByConfirmationToken(string token);
+ Task<AppUser?> GetUserByConfirmationToken(string token);
+ Task<AppUser> GetDefaultAdminUser();
}
public class UserRepository : IUserRepository
@@ -98,8 +98,9 @@ public class UserRepository : IUserRepository
_context.AppUserBookmark.Add(bookmark);
}
- public void Delete(AppUser user)
+ public void Delete(AppUser? user)
{
+ if (user == null) return;
_context.AppUser.Remove(user);
}
@@ -114,15 +115,12 @@ public class UserRepository : IUserRepository
/// <param name="username"></param>
/// <param name="includeFlags">Includes() you want. Pass multiple with flag1 | flag2 </param>
/// <returns></returns>
- public async Task<AppUser> GetUserByUsernameAsync(string username, AppUserIncludes includeFlags = AppUserIncludes.None)
+ public async Task<AppUser?> GetUserByUsernameAsync(string username, AppUserIncludes includeFlags = AppUserIncludes.None)
{
- var query = _context.Users
- .Where(x => x.UserName == username);
-
- // TODO: Move to QueryExtensions
- query = AddIncludesToQuery(query, includeFlags);
-
- return await query.SingleOrDefaultAsync();
+ return await _context.Users
+ .Where(x => x.UserName == username)
+ .Includes(includeFlags)
+ .SingleOrDefaultAsync();
}
/// <summary>
@@ -131,14 +129,12 @@ public class UserRepository : IUserRepository
/// <param name="userId"></param>
/// <param name="includeFlags">Includes() you want. Pass multiple with flag1 | flag2 </param>
/// <returns></returns>
- public async Task<AppUser> GetUserByIdAsync(int userId, AppUserIncludes includeFlags = AppUserIncludes.None)
+ public async Task<AppUser?> GetUserByIdAsync(int userId, AppUserIncludes includeFlags = AppUserIncludes.None)
{
- var query = _context.Users
- .Where(x => x.Id == userId);
-
- query = AddIncludesToQuery(query, includeFlags);
-
- return await query.SingleOrDefaultAsync();
+ return await _context.Users
+ .Where(x => x.Id == userId)
+ .Includes(includeFlags)
+ .SingleOrDefaultAsync();
}
public async Task<IEnumerable<AppUserBookmark>> GetAllBookmarksAsync()
@@ -146,65 +142,20 @@ public class UserRepository : IUserRepository
return await _context.AppUserBookmark.ToListAsync();
}
- public async Task<AppUserBookmark> GetBookmarkForPage(int page, int chapterId, int userId)
+ public async Task<AppUserBookmark?> GetBookmarkForPage(int page, int chapterId, int userId)
{
return await _context.AppUserBookmark
.Where(b => b.Page == page && b.ChapterId == chapterId && b.AppUserId == userId)
.SingleOrDefaultAsync();
}
- public async Task<AppUserBookmark> GetBookmarkAsync(int bookmarkId)
+ public async Task<AppUserBookmark?> GetBookmarkAsync(int bookmarkId)
{
return await _context.AppUserBookmark
.Where(b => b.Id == bookmarkId)
.SingleOrDefaultAsync();
}
- private static IQueryable<AppUser> AddIncludesToQuery(IQueryable<AppUser> query, AppUserIncludes includeFlags)
- {
- if (includeFlags.HasFlag(AppUserIncludes.Bookmarks))
- {
- query = query.Include(u => u.Bookmarks);
- }
-
- if (includeFlags.HasFlag(AppUserIncludes.Progress))
- {
- query = query.Include(u => u.Progresses);
- }
-
- if (includeFlags.HasFlag(AppUserIncludes.ReadingLists))
- {
- query = query.Include(u => u.ReadingLists);
- }
-
- if (includeFlags.HasFlag(AppUserIncludes.ReadingListsWithItems))
- {
- query = query.Include(u => u.ReadingLists).ThenInclude(r => r.Items);
- }
-
- if (includeFlags.HasFlag(AppUserIncludes.Ratings))
- {
- query = query.Include(u => u.Ratings);
- }
-
- if (includeFlags.HasFlag(AppUserIncludes.UserPreferences))
- {
- query = query.Include(u => u.UserPreferences);
- }
-
- if (includeFlags.HasFlag(AppUserIncludes.WantToRead))
- {
- query = query.Include(u => u.WantToRead);
- }
-
- if (includeFlags.HasFlag(AppUserIncludes.Devices))
- {
- query = query.Include(u => u.Devices);
- }
-
- return query.AsSplitQuery();
- }
-
/// <summary>
/// This fetches the Id for a user. Use whenever you just need an ID.
@@ -233,10 +184,10 @@ public class UserRepository : IUserRepository
.ToListAsync();
}
- public async Task<AppUser> GetUserByEmailAsync(string email)
+ public async Task<AppUser?> GetUserByEmailAsync(string email)
{
var lowerEmail = email.ToLower();
- return await _context.AppUser.SingleOrDefaultAsync(u => u.Email.ToLower().Equals(lowerEmail));
+ return await _context.AppUser.SingleOrDefaultAsync(u => u.Email != null && u.Email.ToLower().Equals(lowerEmail));
}
@@ -259,13 +210,26 @@ public class UserRepository : IUserRepository
public async Task<IEnumerable<AppUser>> GetAllUsersAsync(AppUserIncludes includeFlags = AppUserIncludes.None)
{
- var query = AddIncludesToQuery(_context.Users.AsQueryable(), includeFlags);
- return await query.ToListAsync();
+ return await _context.AppUser
+ .Includes(includeFlags)
+ .ToListAsync();
}
- public async Task<AppUser> GetUserByConfirmationToken(string token)
+ public async Task<AppUser?> GetUserByConfirmationToken(string token)
{
- return await _context.AppUser.SingleOrDefaultAsync(u => u.ConfirmationToken.Equals(token));
+ return await _context.AppUser
+ .SingleOrDefaultAsync(u => u.ConfirmationToken != null && u.ConfirmationToken.Equals(token));
+ }
+
+ /// <summary>
+ /// Returns the first admin account created
+ /// </summary>
+ /// <returns></returns>
+ public async Task<AppUser> GetDefaultAdminUser()
+ {
+ return (await _userManager.GetUsersInRoleAsync(PolicyConstants.AdminRole))
+ .OrderBy(u => u.Created)
+ .First();
}
public async Task<IEnumerable<AppUser>> GetAdminUsersAsync()
@@ -273,19 +237,20 @@ public class UserRepository : IUserRepository
return await _userManager.GetUsersInRoleAsync(PolicyConstants.AdminRole);
}
- public async Task<bool> IsUserAdminAsync(AppUser user)
+ public async Task<bool> IsUserAdminAsync(AppUser? user)
{
+ if (user == null) return false;
return await _userManager.IsInRoleAsync(user, PolicyConstants.AdminRole);
}
- public async Task<AppUserRating> GetUserRatingAsync(int seriesId, int userId)
+ public async Task<AppUserRating?> GetUserRatingAsync(int seriesId, int userId)
{
return await _context.AppUserRating
.Where(r => r.SeriesId == seriesId && r.AppUserId == userId)
.SingleOrDefaultAsync();
}
- public async Task<AppUserPreferences> GetPreferencesAsync(string username)
+ public async Task<AppUserPreferences?> GetPreferencesAsync(string username)
{
return await _context.AppUserPreferences
.Include(p => p.AppUser)
@@ -342,16 +307,16 @@ public class UserRepository : IUserRepository
.ProjectTo<BookmarkDto>(_mapper.ConfigurationProvider)
.ToListAsync();
- var seriesNameQueryNormalized = Services.Tasks.Scanner.Parser.Parser.Normalize(filter.SeriesNameQuery);
+ var seriesNameQueryNormalized = filter.SeriesNameQuery.ToNormalized();
var filterSeriesQuery = query.Join(_context.Series, b => b.SeriesId, s => s.Id, (bookmark, series) => new
{
bookmark,
series
})
- .Where(o => EF.Functions.Like(o.series.Name, $"%{filter.SeriesNameQuery}%")
- || EF.Functions.Like(o.series.OriginalName, $"%{filter.SeriesNameQuery}%")
- || EF.Functions.Like(o.series.LocalizedName, $"%{filter.SeriesNameQuery}%")
- || EF.Functions.Like(o.series.NormalizedName, $"%{seriesNameQueryNormalized}%")
+ .Where(o => (EF.Functions.Like(o.series.Name, $"%{filter.SeriesNameQuery}%"))
+ || (o.series.OriginalName != null && EF.Functions.Like(o.series.OriginalName, $"%{filter.SeriesNameQuery}%"))
+ || (o.series.LocalizedName != null && EF.Functions.Like(o.series.LocalizedName, $"%{filter.SeriesNameQuery}%"))
+ || (EF.Functions.Like(o.series.NormalizedName, $"%{seriesNameQueryNormalized}%"))
);
query = filterSeriesQuery.Select(o => o.bookmark);
@@ -370,54 +335,16 @@ public class UserRepository : IUserRepository
public async Task<int> GetUserIdByApiKeyAsync(string apiKey)
{
return await _context.AppUser
- .Where(u => u.ApiKey.Equals(apiKey))
+ .Where(u => u.ApiKey != null && u.ApiKey.Equals(apiKey))
.Select(u => u.Id)
- .SingleOrDefaultAsync();
+ .FirstOrDefaultAsync();
}
- public async Task<IEnumerable<MemberDto>> GetEmailConfirmedMemberDtosAsync()
- {
- return await _context.Users
- .Where(u => u.EmailConfirmed)
- .Include(x => x.Libraries)
- .Include(r => r.UserRoles)
- .ThenInclude(r => r.Role)
- .OrderBy(u => u.UserName)
- .Select(u => new MemberDto
- {
- Id = u.Id,
- Username = u.UserName,
- Email = u.Email,
- Created = u.Created,
- LastActive = u.LastActive,
- Roles = u.UserRoles.Select(r => r.Role.Name).ToList(),
- AgeRestriction = new AgeRestrictionDto()
- {
- AgeRating = u.AgeRestriction,
- IncludeUnknowns = u.AgeRestrictionIncludeUnknowns
- },
- Libraries = u.Libraries.Select(l => new LibraryDto
- {
- Name = l.Name,
- Type = l.Type,
- LastScanned = l.LastScanned,
- Folders = l.Folders.Select(x => x.Path).ToList()
- }).ToList()
- })
- .AsSplitQuery()
- .AsNoTracking()
- .ToListAsync();
- }
-
- /// <summary>
- /// Returns a list of users that are considered Pending by invite. This means email is unconfirmed and they have never logged in
- /// </summary>
- /// <returns></returns>
- public async Task<IEnumerable<MemberDto>> GetPendingMemberDtosAsync()
+ public async Task<IEnumerable<MemberDto>> GetEmailConfirmedMemberDtosAsync(bool emailConfirmed = true)
{
return await _context.Users
- .Where(u => !u.EmailConfirmed && u.LastActive == DateTime.MinValue)
+ .Where(u => (emailConfirmed && u.EmailConfirmed) || !emailConfirmed)
.Include(x => x.Libraries)
.Include(r => r.UserRoles)
.ThenInclude(r => r.Role)
@@ -430,6 +357,7 @@ public class UserRepository : IUserRepository
Created = u.Created,
LastActive = u.LastActive,
Roles = u.UserRoles.Select(r => r.Role.Name).ToList(),
+ IsPending = !u.EmailConfirmed,
AgeRestriction = new AgeRestrictionDto()
{
AgeRating = u.AgeRestriction,
diff --git a/API/Data/Repositories/VolumeRepository.cs b/API/Data/Repositories/VolumeRepository.cs
index c46110dd4..833ea9055 100644
--- a/API/Data/Repositories/VolumeRepository.cs
+++ b/API/Data/Repositories/VolumeRepository.cs
@@ -1,9 +1,11 @@
using System.Collections.Generic;
+using System.Collections.Immutable;
using System.Linq;
using System.Threading.Tasks;
using API.DTOs;
using API.Entities;
using API.Extensions;
+using API.Services;
using AutoMapper;
using AutoMapper.QueryableExtensions;
using Microsoft.EntityFrameworkCore;
@@ -16,14 +18,15 @@ public interface IVolumeRepository
void Update(Volume volume);
void Remove(Volume volume);
Task<IList<MangaFile>> GetFilesForVolume(int volumeId);
- Task<string> GetVolumeCoverImageAsync(int volumeId);
+ Task<string?> GetVolumeCoverImageAsync(int volumeId);
Task<IList<int>> GetChapterIdsByVolumeIds(IReadOnlyList<int> volumeIds);
Task<IEnumerable<VolumeDto>> GetVolumesDtoAsync(int seriesId, int userId);
- Task<Volume> GetVolumeAsync(int volumeId);
- Task<VolumeDto> GetVolumeDtoAsync(int volumeId, int userId);
+ Task<Volume?> GetVolumeAsync(int volumeId);
+ Task<VolumeDto?> GetVolumeDtoAsync(int volumeId, int userId);
Task<IEnumerable<Volume>> GetVolumesForSeriesAsync(IList<int> seriesIds, bool includeChapters = false);
Task<IEnumerable<Volume>> GetVolumes(int seriesId);
- Task<Volume> GetVolumeByIdAsync(int volumeId);
+ Task<Volume?> GetVolumeByIdAsync(int volumeId);
+ Task<IList<Volume>> GetAllWithNonWebPCovers();
}
public class VolumeRepository : IVolumeRepository
{
@@ -72,12 +75,11 @@ public class VolumeRepository : IVolumeRepository
/// </summary>
/// <param name="volumeId"></param>
/// <returns></returns>
- public async Task<string> GetVolumeCoverImageAsync(int volumeId)
+ public async Task<string?> GetVolumeCoverImageAsync(int volumeId)
{
return await _context.Volume
.Where(v => v.Id == volumeId)
.Select(v => v.CoverImage)
- .AsNoTracking()
.SingleOrDefaultAsync();
}
@@ -118,7 +120,7 @@ public class VolumeRepository : IVolumeRepository
/// <param name="volumeId"></param>
/// <param name="userId"></param>
/// <returns></returns>
- public async Task<VolumeDto> GetVolumeDtoAsync(int volumeId, int userId)
+ public async Task<VolumeDto?> GetVolumeDtoAsync(int volumeId, int userId)
{
var volume = await _context.Volume
.Where(vol => vol.Id == volumeId)
@@ -126,7 +128,9 @@ public class VolumeRepository : IVolumeRepository
.ThenInclude(c => c.Files)
.AsSplitQuery()
.ProjectTo<VolumeDto>(_mapper.ConfigurationProvider)
- .SingleAsync(vol => vol.Id == volumeId);
+ .SingleOrDefaultAsync(vol => vol.Id == volumeId);
+
+ if (volume == null) return null;
var volumeList = new List<VolumeDto>() {volume};
await AddVolumeModifiers(userId, volumeList);
@@ -155,7 +159,7 @@ public class VolumeRepository : IVolumeRepository
/// </summary>
/// <param name="volumeId"></param>
/// <returns></returns>
- public async Task<Volume> GetVolumeAsync(int volumeId)
+ public async Task<Volume?> GetVolumeAsync(int volumeId)
{
return await _context.Volume
.Include(vol => vol.Chapters)
@@ -191,11 +195,18 @@ public class VolumeRepository : IVolumeRepository
return volumes;
}
- public async Task<Volume> GetVolumeByIdAsync(int volumeId)
+ public async Task<Volume?> GetVolumeByIdAsync(int volumeId)
{
return await _context.Volume.SingleOrDefaultAsync(x => x.Id == volumeId);
}
+ public async Task<IList<Volume>> GetAllWithNonWebPCovers()
+ {
+ return await _context.Volume
+ .Where(c => !string.IsNullOrEmpty(c.CoverImage) && !c.CoverImage.EndsWith(".webp"))
+ .ToListAsync();
+ }
+
private static void SortSpecialChapters(IEnumerable<VolumeDto> volumes)
{
diff --git a/API/Data/Seed.cs b/API/Data/Seed.cs
index cd939c689..0cde90b6d 100644
--- a/API/Data/Seed.cs
+++ b/API/Data/Seed.cs
@@ -8,6 +8,7 @@ using API.Constants;
using API.Entities;
using API.Entities.Enums;
using API.Entities.Enums.Theme;
+using API.Extensions;
using API.Services;
using Kavita.Common;
using Kavita.Common.EnvironmentInfo;
@@ -29,7 +30,7 @@ public static class Seed
new()
{
Name = "Dark",
- NormalizedName = Services.Tasks.Scanner.Parser.Parser.Normalize("Dark"),
+ NormalizedName = "Dark".ToNormalized(),
Provider = ThemeProvider.System,
FileName = "dark.scss",
IsDefault = true,
@@ -42,13 +43,13 @@ public static class Seed
.GetFields(BindingFlags.Public | BindingFlags.Static)
.Where(f => f.FieldType == typeof(string))
.ToDictionary(f => f.Name,
- f => (string) f.GetValue(null)).Values
+ f => (string) f.GetValue(null)!).Values
.Select(policyName => new AppRole() {Name = policyName})
.ToList();
foreach (var role in roles)
{
- var exists = await roleManager.RoleExistsAsync(role.Name);
+ var exists = await roleManager.RoleExistsAsync(role.Name!);
if (!exists)
{
await roleManager.CreateAsync(role);
diff --git a/API/Data/UnitOfWork.cs b/API/Data/UnitOfWork.cs
index a62ac4552..02a089eca 100644
--- a/API/Data/UnitOfWork.cs
+++ b/API/Data/UnitOfWork.cs
@@ -60,7 +60,7 @@ public class UnitOfWork : IUnitOfWork
public IGenreRepository GenreRepository => new GenreRepository(_context, _mapper);
public ITagRepository TagRepository => new TagRepository(_context, _mapper);
public ISiteThemeRepository SiteThemeRepository => new SiteThemeRepository(_context, _mapper);
- public IMangaFileRepository MangaFileRepository => new MangaFileRepository(_context, _mapper);
+ public IMangaFileRepository MangaFileRepository => new MangaFileRepository(_context);
public IDeviceRepository DeviceRepository => new DeviceRepository(_context, _mapper);
/// <summary>
diff --git a/API/Entities/AppRole.cs b/API/Entities/AppRole.cs
index e27311027..ca46d1bb0 100644
--- a/API/Entities/AppRole.cs
+++ b/API/Entities/AppRole.cs
@@ -5,5 +5,5 @@ namespace API.Entities;
public class AppRole : IdentityRole<int>
{
- public ICollection<AppUserRole> UserRoles { get; set; }
+ public ICollection<AppUserRole> UserRoles { get; set; } = null!;
}
diff --git a/API/Entities/AppUser.cs b/API/Entities/AppUser.cs
index 37db2687a..77fd2bd12 100644
--- a/API/Entities/AppUser.cs
+++ b/API/Entities/AppUser.cs
@@ -14,35 +14,35 @@ public class AppUser : IdentityUser<int>, IHasConcurrencyToken
public DateTime CreatedUtc { get; set; } = DateTime.UtcNow;
public DateTime LastActive { get; set; }
public DateTime LastActiveUtc { get; set; }
- public ICollection<Library> Libraries { get; set; }
- public ICollection<AppUserRole> UserRoles { get; set; }
- public ICollection<AppUserProgress> Progresses { get; set; }
- public ICollection<AppUserRating> Ratings { get; set; }
- public AppUserPreferences UserPreferences { get; set; }
+ public ICollection<Library> Libraries { get; set; } = null!;
+ public ICollection<AppUserRole> UserRoles { get; set; } = null!;
+ public ICollection<AppUserProgress> Progresses { get; set; } = null!;
+ public ICollection<AppUserRating> Ratings { get; set; } = null!;
+ public AppUserPreferences UserPreferences { get; set; } = null!;
/// <summary>
/// Bookmarks associated with this User
/// </summary>
- public ICollection<AppUserBookmark> Bookmarks { get; set; }
+ public ICollection<AppUserBookmark> Bookmarks { get; set; } = null!;
/// <summary>
/// Reading lists associated with this user
/// </summary>
- public ICollection<ReadingList> ReadingLists { get; set; }
+ public ICollection<ReadingList> ReadingLists { get; set; } = null!;
/// <summary>
/// A list of Series the user want's to read
/// </summary>
- public ICollection<Series> WantToRead { get; set; }
+ public ICollection<Series> WantToRead { get; set; } = null!;
/// <summary>
/// A list of Devices which allows the user to send files to
/// </summary>
- public ICollection<Device> Devices { get; set; }
+ public ICollection<Device> Devices { get; set; } = null!;
/// <summary>
/// An API Key to interact with external services, like OPDS
/// </summary>
- public string ApiKey { get; set; }
+ public string? ApiKey { get; set; }
/// <summary>
/// The confirmation token for the user (invite). This will be set to null after the user confirms.
/// </summary>
- public string ConfirmationToken { get; set; }
+ public string? ConfirmationToken { get; set; }
/// <summary>
/// The highest age rating the user has access to. Not applicable for admins
/// </summary>
@@ -52,6 +52,7 @@ public class AppUser : IdentityUser<int>, IHasConcurrencyToken
/// </summary>
public bool AgeRestrictionIncludeUnknowns { get; set; } = false;
+
/// <inheritdoc />
[ConcurrencyCheck]
public uint RowVersion { get; private set; }
diff --git a/API/Entities/AppUserBookmark.cs b/API/Entities/AppUserBookmark.cs
index f0c8dfaea..d17e8eaf0 100644
--- a/API/Entities/AppUserBookmark.cs
+++ b/API/Entities/AppUserBookmark.cs
@@ -23,7 +23,7 @@ public class AppUserBookmark : IEntityDate
// Relationships
[JsonIgnore]
- public AppUser AppUser { get; set; }
+ public AppUser AppUser { get; set; } = null!;
public int AppUserId { get; set; }
public DateTime Created { get; set; }
public DateTime LastModified { get; set; }
diff --git a/API/Entities/AppUserPreferences.cs b/API/Entities/AppUserPreferences.cs
index 60ed4a55c..0b53f3f24 100644
--- a/API/Entities/AppUserPreferences.cs
+++ b/API/Entities/AppUserPreferences.cs
@@ -1,4 +1,4 @@
-using System;
+using API.Data;
using API.Entities.Enums;
using API.Entities.Enums.UserPreferences;
@@ -75,11 +75,16 @@ public class AppUserPreferences
/// Book Reader Option: What direction should the next/prev page buttons go
/// </summary>
public ReadingDirection BookReaderReadingDirection { get; set; } = ReadingDirection.LeftToRight;
+
+ /// <summary>
+ /// Book Reader Option: Defines the writing styles vertical/horizontal
+ /// </summary>
+ public WritingStyle BookReaderWritingStyle { get; set; } = WritingStyle.Horizontal;
/// <summary>
/// UI Site Global Setting: The UI theme the user should use.
/// </summary>
/// <remarks>Should default to Dark</remarks>
- public SiteTheme Theme { get; set; }
+ public required SiteTheme Theme { get; set; } = Seed.DefaultThemes[0];
/// <summary>
/// Book Reader Option: The color theme to decorate the book contents
/// </summary>
@@ -114,7 +119,11 @@ public class AppUserPreferences
/// UI Site Global Setting: Should Kavita disable CSS transitions
/// </summary>
public bool NoTransitions { get; set; } = false;
+ /// <summary>
+ /// UI Site Global Setting: When showing series, only parent series or series with no relationships will be returned
+ /// </summary>
+ public bool CollapseSeriesRelationships { get; set; } = false;
- public AppUser AppUser { get; set; }
+ public AppUser AppUser { get; set; } = null!;
public int AppUserId { get; set; }
}
diff --git a/API/Entities/AppUserProgress.cs b/API/Entities/AppUserProgress.cs
index 3d7ca6ee4..c972af78a 100644
--- a/API/Entities/AppUserProgress.cs
+++ b/API/Entities/AppUserProgress.cs
@@ -37,7 +37,7 @@ public class AppUserProgress : IEntityDate
/// For Book Reader, represents the nearest passed anchor on the screen that can be used to resume scroll point
/// on next load
/// </summary>
- public string BookScrollId { get; set; }
+ public string? BookScrollId { get; set; }
/// <summary>
/// When this was first created
/// </summary>
@@ -54,7 +54,7 @@ public class AppUserProgress : IEntityDate
/// <summary>
/// Navigational Property for EF. Links to a unique AppUser
/// </summary>
- public AppUser AppUser { get; set; }
+ public AppUser AppUser { get; set; } = null!;
/// <summary>
/// User this progress belongs to
/// </summary>
diff --git a/API/Entities/AppUserRating.cs b/API/Entities/AppUserRating.cs
index 54376bbd1..e4cc544df 100644
--- a/API/Entities/AppUserRating.cs
+++ b/API/Entities/AppUserRating.cs
@@ -11,11 +11,11 @@ public class AppUserRating
/// <summary>
/// A short summary the user can write when giving their review.
/// </summary>
- public string Review { get; set; }
+ public string? Review { get; set; }
public int SeriesId { get; set; }
// Relationships
public int AppUserId { get; set; }
- public AppUser AppUser { get; set; }
+ public AppUser AppUser { get; set; } = null!;
}
diff --git a/API/Entities/AppUserRole.cs b/API/Entities/AppUserRole.cs
index 09ccbce6c..9ee798e6b 100644
--- a/API/Entities/AppUserRole.cs
+++ b/API/Entities/AppUserRole.cs
@@ -4,6 +4,6 @@ namespace API.Entities;
public class AppUserRole : IdentityUserRole<int>
{
- public AppUser User { get; set; }
- public AppRole Role { get; set; }
+ public AppUser User { get; set; } = null!;
+ public AppRole Role { get; set; } = null!;
}
diff --git a/API/Entities/Chapter.cs b/API/Entities/Chapter.cs
index 716a07217..0d525ac99 100644
--- a/API/Entities/Chapter.cs
+++ b/API/Entities/Chapter.cs
@@ -2,8 +2,7 @@
using System.Collections.Generic;
using API.Entities.Enums;
using API.Entities.Interfaces;
-using API.Parser;
-using API.Services;
+using API.Services.Tasks.Scanner.Parser;
namespace API.Entities;
@@ -13,15 +12,15 @@ public class Chapter : IEntityDate, IHasReadTimeEstimate
/// <summary>
/// Range of numbers. Chapter 2-4 -> "2-4". Chapter 2 -> "2".
/// </summary>
- public string Range { get; set; }
+ public required string Range { get; set; }
/// <summary>
/// Smallest number of the Range. Can be a partial like Chapter 4.5
/// </summary>
- public string Number { get; set; }
+ public required string Number { get; set; }
/// <summary>
/// The files that represent this Chapter
/// </summary>
- public ICollection<MangaFile> Files { get; set; }
+ public ICollection<MangaFile> Files { get; set; } = null!;
public DateTime Created { get; set; }
public DateTime LastModified { get; set; }
public DateTime CreatedUtc { get; set; }
@@ -31,7 +30,7 @@ public class Chapter : IEntityDate, IHasReadTimeEstimate
/// Relative path to the (managed) image file representing the cover image
/// </summary>
/// <remarks>The file is managed internally to Kavita's APPDIR</remarks>
- public string CoverImage { get; set; }
+ public string? CoverImage { get; set; }
public bool CoverImageLocked { get; set; }
/// <summary>
/// Total number of pages in all MangaFiles
@@ -44,7 +43,7 @@ public class Chapter : IEntityDate, IHasReadTimeEstimate
/// <summary>
/// Used for books/specials to display custom title. For non-specials/books, will be set to <see cref="Range"/>
/// </summary>
- public string Title { get; set; }
+ public string? Title { get; set; }
/// <summary>
/// Age Rating for the issue/chapter
/// </summary>
@@ -62,11 +61,11 @@ public class Chapter : IEntityDate, IHasReadTimeEstimate
/// <summary>
/// Summary for the Chapter/Issue
/// </summary>
- public string Summary { get; set; }
+ public string? Summary { get; set; }
/// <summary>
/// Language for the Chapter/Issue
/// </summary>
- public string Language { get; set; }
+ public string? Language { get; set; }
/// <summary>
/// Total number of issues or volumes in the series
/// </summary>
@@ -79,7 +78,7 @@ public class Chapter : IEntityDate, IHasReadTimeEstimate
/// <summary>
/// SeriesGroup tag in ComicInfo
/// </summary>
- public string SeriesGroup { get; set; }
+ public string SeriesGroup { get; set; } = string.Empty;
public string StoryArc { get; set; } = string.Empty;
public string StoryArcNumber { get; set; } = string.Empty;
public string AlternateNumber { get; set; } = string.Empty;
@@ -118,7 +117,7 @@ public class Chapter : IEntityDate, IHasReadTimeEstimate
// Relationships
- public Volume Volume { get; set; }
+ public Volume Volume { get; set; } = null!;
public int VolumeId { get; set; }
public void UpdateFrom(ParserInfo info)
diff --git a/API/Entities/CollectionTag.cs b/API/Entities/CollectionTag.cs
index f32e981e9..2594a9772 100644
--- a/API/Entities/CollectionTag.cs
+++ b/API/Entities/CollectionTag.cs
@@ -14,12 +14,12 @@ public class CollectionTag
/// <summary>
/// Visible title of the Tag
/// </summary>
- public string Title { get; set; }
+ public required string Title { get; set; }
/// <summary>
/// Absolute path to the (managed) image file
/// </summary>
/// <remarks>The file is managed internally to Kavita's APPDIR</remarks>
- public string CoverImage { get; set; }
+ public string? CoverImage { get; set; }
/// <summary>
/// Denotes if the CoverImage has been overridden by the user. If so, it will not be updated during normal scan operations.
/// </summary>
@@ -28,18 +28,18 @@ public class CollectionTag
/// <summary>
/// A description of the tag
/// </summary>
- public string Summary { get; set; }
+ public string? Summary { get; set; }
/// <summary>
/// A normalized string used to check if the tag already exists in the DB
/// </summary>
- public string NormalizedTitle { get; set; }
+ public required string NormalizedTitle { get; set; }
/// <summary>
/// A promoted collection tag will allow all linked seriesMetadata's Series to show for all users.
/// </summary>
public bool Promoted { get; set; }
- public ICollection<SeriesMetadata> SeriesMetadatas { get; set; }
+ public ICollection<SeriesMetadata> SeriesMetadatas { get; set; } = null!;
/// <summary>
/// Not Used due to not using concurrency update
diff --git a/API/Entities/Device.cs b/API/Entities/Device.cs
index 4e7ca32dd..ae1956f5b 100644
--- a/API/Entities/Device.cs
+++ b/API/Entities/Device.cs
@@ -1,8 +1,4 @@
using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations.Schema;
-using System.Net;
using API.Entities.Enums.Device;
using API.Entities.Interfaces;
@@ -17,24 +13,24 @@ public class Device : IEntityDate
/// <summary>
/// Last Seen IP Address of the device
/// </summary>
- public string IpAddress { get; set; }
+ public string? IpAddress { get; set; }
/// <summary>
/// A name given to this device
/// </summary>
/// <remarks>If this device is web, this will be the browser name</remarks>
/// <example>Pixel 3a, John's Kindle</example>
- public string Name { get; set; }
+ public string? Name { get; set; }
/// <summary>
/// An email address associated with the device (ie Kindle). Will be used with Send to functionality
/// </summary>
- public string EmailAddress { get; set; }
+ public string? EmailAddress { get; set; }
/// <summary>
/// Platform (ie) Windows 10
/// </summary>
public DevicePlatform Platform { get; set; }
public int AppUserId { get; set; }
- public AppUser AppUser { get; set; }
+ public AppUser AppUser { get; set; } = null!;
/// <summary>
diff --git a/API/Entities/Enums/ServerSettingKey.cs b/API/Entities/Enums/ServerSettingKey.cs
index 084457d07..877429177 100644
--- a/API/Entities/Enums/ServerSettingKey.cs
+++ b/API/Entities/Enums/ServerSettingKey.cs
@@ -1,5 +1,4 @@
-using System;
-using System.ComponentModel;
+using System.ComponentModel;
namespace API.Entities.Enums;
diff --git a/API/Entities/Enums/WritingStyle.cs b/API/Entities/Enums/WritingStyle.cs
new file mode 100644
index 000000000..37d50c160
--- /dev/null
+++ b/API/Entities/Enums/WritingStyle.cs
@@ -0,0 +1,20 @@
+using System.ComponentModel;
+
+namespace API.Entities.Enums;
+
+/// <summary>
+/// Represents the writing styles for the book-reader
+/// </summary>
+public enum WritingStyle
+{
+ /// <summary>
+ /// Horizontal writing style for the book-reader
+ /// </summary>
+ [Description ("Horizontal")]
+ Horizontal = 0,
+ /// <summary>
+ /// Vertical writing style for the book-reader
+ /// </summary>
+ [Description ("Vertical")]
+ Vertical = 1
+}
diff --git a/API/Entities/FolderPath.cs b/API/Entities/FolderPath.cs
index 98b6e503e..2d5684ba9 100644
--- a/API/Entities/FolderPath.cs
+++ b/API/Entities/FolderPath.cs
@@ -6,7 +6,7 @@ namespace API.Entities;
public class FolderPath
{
public int Id { get; set; }
- public string Path { get; set; }
+ public required string Path { get; set; }
/// <summary>
/// Used when scanning to see if we can skip if nothing has changed
/// </summary>
@@ -14,7 +14,7 @@ public class FolderPath
public DateTime LastScanned { get; set; }
// Relationship
- public Library Library { get; set; }
+ public Library Library { get; set; } = null!;
public int LibraryId { get; set; }
public void UpdateLastScanned(DateTime? time)
diff --git a/API/Entities/Genre.cs b/API/Entities/Genre.cs
index 393a67860..56cb446b2 100644
--- a/API/Entities/Genre.cs
+++ b/API/Entities/Genre.cs
@@ -8,9 +8,9 @@ namespace API.Entities;
public class Genre
{
public int Id { get; set; }
- public string Title { get; set; }
- public string NormalizedTitle { get; set; }
+ public required string Title { get; set; }
+ public required string NormalizedTitle { get; set; }
- public ICollection<SeriesMetadata> SeriesMetadatas { get; set; }
- public ICollection<Chapter> Chapters { get; set; }
+ public ICollection<SeriesMetadata> SeriesMetadatas { get; set; } = null!;
+ public ICollection<Chapter> Chapters { get; set; } = null!;
}
diff --git a/API/Entities/Library.cs b/API/Entities/Library.cs
index 4a3369c6d..d4ea13b2b 100644
--- a/API/Entities/Library.cs
+++ b/API/Entities/Library.cs
@@ -8,8 +8,8 @@ namespace API.Entities;
public class Library : IEntityDate
{
public int Id { get; set; }
- public string Name { get; set; }
- public string CoverImage { get; set; }
+ public required string Name { get; set; }
+ public string? CoverImage { get; set; }
public LibraryType Type { get; set; }
/// <summary>
/// If Folder Watching is enabled for this library
@@ -28,9 +28,13 @@ public class Library : IEntityDate
/// </summary>
public bool IncludeInSearch { get; set; } = true;
/// <summary>
- /// Should this library create and manage collections from Metadata
+ /// Should this library create collections from Metadata
/// </summary>
public bool ManageCollections { get; set; } = true;
+ /// <summary>
+ /// Should this library create reading lists from Metadata
+ /// </summary>
+ public bool ManageReadingLists { get; set; } = true;
public DateTime Created { get; set; }
public DateTime LastModified { get; set; }
public DateTime CreatedUtc { get; set; }
@@ -41,9 +45,9 @@ public class Library : IEntityDate
/// </summary>
/// <remarks>Time stored in UTC</remarks>
public DateTime LastScanned { get; set; }
- public ICollection<FolderPath> Folders { get; set; }
- public ICollection<AppUser> AppUsers { get; set; }
- public ICollection<Series> Series { get; set; }
+ public ICollection<FolderPath> Folders { get; set; } = null!;
+ public ICollection<AppUser> AppUsers { get; set; } = null!;
+ public ICollection<Series> Series { get; set; } = null!;
public void UpdateLastModified()
{
diff --git a/API/Entities/MangaFile.cs b/API/Entities/MangaFile.cs
index 888548863..14a64fc26 100644
--- a/API/Entities/MangaFile.cs
+++ b/API/Entities/MangaFile.cs
@@ -15,7 +15,7 @@ public class MangaFile : IEntityDate
/// <summary>
/// Absolute path to the archive file
/// </summary>
- public string FilePath { get; set; }
+ public required string FilePath { get; set; }
/// <summary>
/// Number of pages for the given file
/// </summary>
@@ -28,7 +28,7 @@ public class MangaFile : IEntityDate
/// <summary>
/// File extension
/// </summary>
- public string Extension { get; set; }
+ public string? Extension { get; set; }
/// <inheritdoc cref="IEntityDate.Created"/>
public DateTime Created { get; set; }
/// <summary>
@@ -48,7 +48,7 @@ public class MangaFile : IEntityDate
// Relationship Mapping
- public Chapter Chapter { get; set; }
+ public Chapter Chapter { get; set; } = null!;
public int ChapterId { get; set; }
@@ -57,6 +57,7 @@ public class MangaFile : IEntityDate
/// </summary>
public void UpdateLastModified()
{
+ if (FilePath == null) return;
LastModified = File.GetLastWriteTime(FilePath);
LastModifiedUtc = File.GetLastWriteTimeUtc(FilePath);
}
diff --git a/API/Entities/Metadata/SeriesMetadata.cs b/API/Entities/Metadata/SeriesMetadata.cs
index ffadac211..188ed9692 100644
--- a/API/Entities/Metadata/SeriesMetadata.cs
+++ b/API/Entities/Metadata/SeriesMetadata.cs
@@ -13,7 +13,7 @@ public class SeriesMetadata : IHasConcurrencyToken
public string Summary { get; set; } = string.Empty;
- public ICollection<CollectionTag> CollectionTags { get; set; }
+ public ICollection<CollectionTag> CollectionTags { get; set; } = new List<CollectionTag>();
public ICollection<Genre> Genres { get; set; } = new List<Genre>();
public ICollection<Tag> Tags { get; set; } = new List<Tag>();
@@ -39,7 +39,7 @@ public class SeriesMetadata : IHasConcurrencyToken
/// </summary>
public int TotalCount { get; set; } = 0;
/// <summary>
- /// Max number of issues/volumes in the series (Max of Volume/Issue field in ComicInfo)
+ /// Max number of issues/volumes in the series (Max of Volume/Number field in ComicInfo)
/// </summary>
public int MaxCount { get; set; } = 0;
public PublicationStatus PublicationStatus { get; set; }
@@ -71,7 +71,7 @@ public class SeriesMetadata : IHasConcurrencyToken
// Relationship
- public Series Series { get; set; }
+ public Series Series { get; set; } = null!;
public int SeriesId { get; set; }
/// <inheritdoc />
diff --git a/API/Entities/Metadata/SeriesRelation.cs b/API/Entities/Metadata/SeriesRelation.cs
index f5263f11d..7493f945b 100644
--- a/API/Entities/Metadata/SeriesRelation.cs
+++ b/API/Entities/Metadata/SeriesRelation.cs
@@ -11,13 +11,13 @@ public sealed class SeriesRelation
public int Id { get; set; }
public RelationKind RelationKind { get; set; }
- public Series TargetSeries { get; set; }
+ public Series TargetSeries { get; set; } = null!;
/// <summary>
/// A is Sequel to B. In this example, TargetSeries is A. B will hold the foreign key.
/// </summary>
public int TargetSeriesId { get; set; }
// Relationships
- public Series Series { get; set; }
+ public Series Series { get; set; } = null!;
public int SeriesId { get; set; }
}
diff --git a/API/Entities/Person.cs b/API/Entities/Person.cs
index a7b8ea1c6..eeb21d6b1 100644
--- a/API/Entities/Person.cs
+++ b/API/Entities/Person.cs
@@ -7,11 +7,11 @@ namespace API.Entities;
public class Person
{
public int Id { get; set; }
- public string Name { get; set; }
- public string NormalizedName { get; set; }
- public PersonRole Role { get; set; }
+ public required string Name { get; set; }
+ public required string NormalizedName { get; set; }
+ public required PersonRole Role { get; set; }
// Relationships
- public ICollection<SeriesMetadata> SeriesMetadatas { get; set; }
- public ICollection<Chapter> ChapterMetadatas { get; set; }
+ public ICollection<SeriesMetadata> SeriesMetadatas { get; set; } = null!;
+ public ICollection<Chapter> ChapterMetadatas { get; set; } = null!;
}
diff --git a/API/Entities/ReadingList.cs b/API/Entities/ReadingList.cs
index 0d710728f..d169731bf 100644
--- a/API/Entities/ReadingList.cs
+++ b/API/Entities/ReadingList.cs
@@ -11,12 +11,12 @@ namespace API.Entities;
public class ReadingList : IEntityDate
{
public int Id { get; init; }
- public string Title { get; set; }
+ public required string Title { get; set; }
/// <summary>
/// A normalized string used to check if the reading list already exists in the DB
/// </summary>
- public string NormalizedTitle { get; set; }
- public string Summary { get; set; }
+ public required string NormalizedTitle { get; set; }
+ public string? Summary { get; set; }
/// <summary>
/// Reading lists that are promoted are only done by admins
/// </summary>
@@ -25,23 +25,39 @@ public class ReadingList : IEntityDate
/// Absolute path to the (managed) image file
/// </summary>
/// <remarks>The file is managed internally to Kavita's APPDIR</remarks>
- public string CoverImage { get; set; }
+ public string? CoverImage { get; set; }
public bool CoverImageLocked { get; set; }
/// <summary>
/// The highest age rating from all Series within the reading list
/// </summary>
/// <remarks>Introduced in v0.6</remarks>
- public AgeRating AgeRating { get; set; } = AgeRating.Unknown;
+ public required AgeRating AgeRating { get; set; } = AgeRating.Unknown;
- public ICollection<ReadingListItem> Items { get; set; }
+ public ICollection<ReadingListItem> Items { get; set; } = null!;
public DateTime Created { get; set; }
public DateTime LastModified { get; set; }
public DateTime CreatedUtc { get; set; }
public DateTime LastModifiedUtc { get; set; }
+ /// <summary>
+ /// Minimum Year the Reading List starts
+ /// </summary>
+ public int StartingYear { get; set; }
+ /// <summary>
+ /// Minimum Month the Reading List starts
+ /// </summary>
+ public int StartingMonth { get; set; }
+ /// <summary>
+ /// Maximum Year the Reading List starts
+ /// </summary>
+ public int EndingYear { get; set; }
+ /// <summary>
+ /// Maximum Month the Reading List starts
+ /// </summary>
+ public int EndingMonth { get; set; }
// Relationships
public int AppUserId { get; set; }
- public AppUser AppUser { get; set; }
+ public AppUser AppUser { get; set; } = null!;
}
diff --git a/API/Entities/ReadingListItem.cs b/API/Entities/ReadingListItem.cs
index bba133df7..c9d1de5db 100644
--- a/API/Entities/ReadingListItem.cs
+++ b/API/Entities/ReadingListItem.cs
@@ -12,11 +12,11 @@ public class ReadingListItem
public int Order { get; set; }
// Relationship
- public ReadingList ReadingList { get; set; }
+ public ReadingList ReadingList { get; set; } = null!;
public int ReadingListId { get; set; }
// Keep these for easy join statements
- public Series Series { get; set; }
- public Volume Volume { get; set; }
- public Chapter Chapter { get; set; }
+ public Series Series { get; set; } = null!;
+ public Volume Volume { get; set; } = null!;
+ public Chapter Chapter { get; set; } = null!;
}
diff --git a/API/Entities/Series.cs b/API/Entities/Series.cs
index 91c469fb8..ab51ce7fd 100644
--- a/API/Entities/Series.cs
+++ b/API/Entities/Series.cs
@@ -12,27 +12,27 @@ public class Series : IEntityDate, IHasReadTimeEstimate
/// <summary>
/// The UI visible Name of the Series. This may or may not be the same as the OriginalName
/// </summary>
- public string Name { get; set; }
+ public required string Name { get; set; }
/// <summary>
/// Used internally for name matching. <see cref="Services.Tasks.Scanner.Parser.Parser.Normalize"/>
/// </summary>
- public string NormalizedName { get; set; }
+ public required string NormalizedName { get; set; }
/// <summary>
/// Used internally for localized name matching. <see cref="Services.Tasks.Scanner.Parser.Parser.Normalize"/>
/// </summary>
- public string NormalizedLocalizedName { get; set; }
+ public required string NormalizedLocalizedName { get; set; }
/// <summary>
/// The name used to sort the Series. By default, will be the same as Name.
/// </summary>
- public string SortName { get; set; }
+ public required string SortName { get; set; }
/// <summary>
/// Name in original language (Japanese for Manga). By default, will be same as Name.
/// </summary>
- public string LocalizedName { get; set; }
+ public required string LocalizedName { get; set; }
/// <summary>
/// Original Name on disk. Not exposed to UI.
/// </summary>
- public string OriginalName { get; set; }
+ public required string OriginalName { get; set; }
/// <summary>
/// Time of creation
/// </summary>
@@ -49,7 +49,7 @@ public class Series : IEntityDate, IHasReadTimeEstimate
/// Absolute path to the (managed) image file
/// </summary>
/// <remarks>The file is managed internally to Kavita's APPDIR</remarks>
- public string CoverImage { get; set; }
+ public string? CoverImage { get; set; }
/// <summary>
/// Denotes if the CoverImage has been overridden by the user. If so, it will not be updated during normal scan operations.
/// </summary>
@@ -62,7 +62,7 @@ public class Series : IEntityDate, IHasReadTimeEstimate
/// Highest path (that is under library root) that contains the series.
/// </summary>
/// <remarks><see cref="Services.Tasks.Scanner.Parser.Parser.NormalizePath"/> must be used before setting</remarks>
- public string FolderPath { get; set; }
+ public string? FolderPath { get; set; }
/// <summary>
/// Last time the folder was scanned
/// </summary>
@@ -96,22 +96,22 @@ public class Series : IEntityDate, IHasReadTimeEstimate
public int MaxHoursToRead { get; set; }
public int AvgHoursToRead { get; set; }
- public SeriesMetadata Metadata { get; set; }
+ public SeriesMetadata Metadata { get; set; } = null!;
- public ICollection<AppUserRating> Ratings { get; set; } = new List<AppUserRating>();
- public ICollection<AppUserProgress> Progress { get; set; } = new List<AppUserProgress>();
+ public ICollection<AppUserRating> Ratings { get; set; } = null!;
+ public ICollection<AppUserProgress> Progress { get; set; } = null!;
/// <summary>
/// Relations to other Series, like Sequels, Prequels, etc
/// </summary>
/// <remarks>1 to Many relationship</remarks>
- public virtual ICollection<SeriesRelation> Relations { get; set; } = new List<SeriesRelation>();
- public virtual ICollection<SeriesRelation> RelationOf { get; set; } = new List<SeriesRelation>();
+ public ICollection<SeriesRelation> Relations { get; set; } = null!;
+ public ICollection<SeriesRelation> RelationOf { get; set; } = null!;
// Relationships
- public List<Volume> Volumes { get; set; }
- public Library Library { get; set; }
+ public List<Volume> Volumes { get; set; } = null!;
+ public Library Library { get; set; } = null!;
public int LibraryId { get; set; }
public void UpdateLastFolderScanned()
diff --git a/API/Entities/ServerSetting.cs b/API/Entities/ServerSetting.cs
index 277bb6569..37e85efae 100644
--- a/API/Entities/ServerSetting.cs
+++ b/API/Entities/ServerSetting.cs
@@ -7,11 +7,11 @@ namespace API.Entities;
public class ServerSetting : IHasConcurrencyToken
{
[Key]
- public ServerSettingKey Key { get; set; }
+ public required ServerSettingKey Key { get; set; }
/// <summary>
/// The value of the Setting. Converter knows how to convert to the correct type
/// </summary>
- public string Value { get; set; }
+ public required string Value { get; set; }
/// <inheritdoc />
[ConcurrencyCheck]
diff --git a/API/Entities/SiteTheme.cs b/API/Entities/SiteTheme.cs
index 79424014f..09b348cb8 100644
--- a/API/Entities/SiteTheme.cs
+++ b/API/Entities/SiteTheme.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Collections.Generic;
+using System;
using API.Entities.Enums.Theme;
using API.Entities.Interfaces;
using API.Services;
@@ -14,21 +13,22 @@ public class SiteTheme : IEntityDate, ITheme
/// <summary>
/// Name of the Theme
/// </summary>
- public string Name { get; set; }
+ public required string Name { get; set; }
/// <summary>
/// Normalized name for lookups
/// </summary>
- public string NormalizedName { get; set; }
+ public required string NormalizedName { get; set; }
/// <summary>
/// File path to the content. Stored under <see cref="DirectoryService.SiteThemeDirectory"/>.
/// Must be a .css file
/// </summary>
/// <remarks>System provided themes use an alternative location as they are packaged with the app</remarks>
- public string FileName { get; set; }
+ public required string FileName { get; set; }
/// <summary>
/// Only one theme can have this. Will auto-set this as default for new user accounts
/// </summary>
public bool IsDefault { get; set; }
+
/// <summary>
/// Where did the theme come from
/// </summary>
diff --git a/API/Entities/Tag.cs b/API/Entities/Tag.cs
index 1676b2fd2..277422713 100644
--- a/API/Entities/Tag.cs
+++ b/API/Entities/Tag.cs
@@ -8,9 +8,9 @@ namespace API.Entities;
public class Tag
{
public int Id { get; set; }
- public string Title { get; set; }
- public string NormalizedTitle { get; set; }
+ public required string Title { get; set; }
+ public required string NormalizedTitle { get; set; }
- public ICollection<SeriesMetadata> SeriesMetadatas { get; set; }
- public ICollection<Chapter> Chapters { get; set; }
+ public ICollection<SeriesMetadata> SeriesMetadatas { get; set; } = null!;
+ public ICollection<Chapter> Chapters { get; set; } = null!;
}
diff --git a/API/Entities/Volume.cs b/API/Entities/Volume.cs
index 36747f1d7..f5239e708 100644
--- a/API/Entities/Volume.cs
+++ b/API/Entities/Volume.cs
@@ -11,12 +11,12 @@ public class Volume : IEntityDate, IHasReadTimeEstimate
/// A String representation of the volume number. Allows for floats.
/// </summary>
/// <remarks>For Books with Series_index, this will map to the Series Index.</remarks>
- public string Name { get; set; }
+ public required string Name { get; set; }
/// <summary>
/// The minimum number in the Name field in Int form
/// </summary>
- public int Number { get; set; }
- public IList<Chapter> Chapters { get; set; }
+ public required int Number { get; set; }
+ public IList<Chapter> Chapters { get; set; } = null!;
public DateTime Created { get; set; }
public DateTime LastModified { get; set; }
public DateTime CreatedUtc { get; set; }
@@ -26,7 +26,7 @@ public class Volume : IEntityDate, IHasReadTimeEstimate
/// Absolute path to the (managed) image file
/// </summary>
/// <remarks>The file is managed internally to Kavita's APPDIR</remarks>
- public string CoverImage { get; set; }
+ public string? CoverImage { get; set; }
/// <summary>
/// Total pages of all chapters in this volume
/// </summary>
@@ -42,7 +42,7 @@ public class Volume : IEntityDate, IHasReadTimeEstimate
// Relationships
- public Series Series { get; set; }
+ public Series Series { get; set; } = null!;
public int SeriesId { get; set; }
}
diff --git a/API/Errors/ApiException.cs b/API/Errors/ApiException.cs
index d67a97f8a..d9c1a755a 100644
--- a/API/Errors/ApiException.cs
+++ b/API/Errors/ApiException.cs
@@ -1,15 +1,5 @@
namespace API.Errors;
-public class ApiException
-{
- public int Status { get; init; }
- public string Message { get; init; }
- public string Details { get; init; }
-
- public ApiException(int status, string message = null, string details = null)
- {
- Status = status;
- Message = message;
- Details = details;
- }
-}
+#nullable enable
+public record ApiException(int Status, string? Message = null, string? Details = null);
+#nullable disable
diff --git a/API/Extensions/ApplicationServiceExtensions.cs b/API/Extensions/ApplicationServiceExtensions.cs
index 164b58751..765c6e120 100644
--- a/API/Extensions/ApplicationServiceExtensions.cs
+++ b/API/Extensions/ApplicationServiceExtensions.cs
@@ -70,7 +70,8 @@ public static class ApplicationServiceExtensions
{
options.UseSqlite("Data source=config/kavita.db");
options.EnableDetailedErrors();
- options.EnableSensitiveDataLogging(env.IsDevelopment());
+
+ options.EnableSensitiveDataLogging();
});
}
}
diff --git a/API/Extensions/ChapterListExtensions.cs b/API/Extensions/ChapterListExtensions.cs
index c00fa1873..9f14c22ee 100644
--- a/API/Extensions/ChapterListExtensions.cs
+++ b/API/Extensions/ChapterListExtensions.cs
@@ -1,7 +1,8 @@
using System.Collections.Generic;
using System.Linq;
using API.Entities;
-using API.Parser;
+using API.Helpers;
+using API.Services.Tasks.Scanner.Parser;
namespace API.Extensions;
@@ -12,7 +13,7 @@ public static class ChapterListExtensions
/// </summary>
/// <param name="chapters"></param>
/// <returns></returns>
- public static Chapter GetFirstChapterWithFiles(this IList<Chapter> chapters)
+ public static Chapter? GetFirstChapterWithFiles(this IEnumerable<Chapter> chapters)
{
return chapters.FirstOrDefault(c => c.Files.Any());
}
@@ -24,7 +25,7 @@ public static class ChapterListExtensions
/// <param name="chapters"></param>
/// <param name="info"></param>
/// <returns></returns>
- public static Chapter GetChapterByRange(this IList<Chapter> chapters, ParserInfo info)
+ public static Chapter? GetChapterByRange(this IEnumerable<Chapter> chapters, ParserInfo info)
{
var specialTreatment = info.IsSpecialInfo();
return specialTreatment
@@ -39,6 +40,6 @@ public static class ChapterListExtensions
/// <returns></returns>
public static int MinimumReleaseYear(this IList<Chapter> chapters)
{
- return chapters.Select(v => v.ReleaseDate.Year).Where(y => y >= 1000).DefaultIfEmpty().Min();
+ return chapters.Select(v => v.ReleaseDate.Year).Where(y => NumberHelper.IsValidYear(y)).DefaultIfEmpty().Min();
}
}
diff --git a/API/Extensions/ConfigurationExtensions.cs b/API/Extensions/ConfigurationExtensions.cs
deleted file mode 100644
index a5bfe7660..000000000
--- a/API/Extensions/ConfigurationExtensions.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using Microsoft.Extensions.Configuration;
-
-namespace API.Extensions;
-
-public static class ConfigurationExtensions
-{
- public static int GetMaxRollingFiles(this IConfiguration config)
- {
- return int.Parse(config.GetSection("Logging").GetSection("File").GetSection("MaxRollingFiles").Value);
- }
- public static string GetLoggingFileName(this IConfiguration config)
- {
- return config.GetSection("Logging").GetSection("File").GetSection("Path").Value;
- }
-}
diff --git a/API/Extensions/EnumerableExtensions.cs b/API/Extensions/EnumerableExtensions.cs
index 679136efb..8dc2377df 100644
--- a/API/Extensions/EnumerableExtensions.cs
+++ b/API/Extensions/EnumerableExtensions.cs
@@ -19,7 +19,7 @@ public static class EnumerableExtensions
/// <param name="stringComparer">Defaults to CurrentCulture</param>
/// <typeparam name="T"></typeparam>
/// <returns>Sorted Enumerable</returns>
- public static IEnumerable<T> OrderByNatural<T>(this IEnumerable<T> items, Func<T, string> selector, StringComparer stringComparer = null)
+ public static IEnumerable<T> OrderByNatural<T>(this IEnumerable<T> items, Func<T, string> selector, StringComparer? stringComparer = null)
{
var list = items.ToList();
var maxDigits = list
diff --git a/API/Extensions/HttpExtensions.cs b/API/Extensions/HttpExtensions.cs
index c7820284a..4a75dfece 100644
--- a/API/Extensions/HttpExtensions.cs
+++ b/API/Extensions/HttpExtensions.cs
@@ -1,6 +1,4 @@
-using System;
-using System.Globalization;
-using System.IO;
+using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
@@ -34,9 +32,7 @@ public static class HttpExtensions
public static void AddCacheHeader(this HttpResponse response, byte[] content)
{
if (content is not {Length: > 0}) return;
- using var sha1 = SHA256.Create();
-
- response.Headers.Add(HeaderNames.ETag, string.Concat(sha1.ComputeHash(content).Select(x => x.ToString("X2"))));
+ response.Headers.Add(HeaderNames.ETag, string.Concat(SHA256.HashData(content).Select(x => x.ToString("X2"))));
response.Headers.CacheControl = $"private,max-age=100";
}
@@ -50,8 +46,7 @@ public static class HttpExtensions
{
if (filename is not {Length: > 0}) return;
var hashContent = filename + File.GetLastWriteTimeUtc(filename);
- using var sha1 = SHA256.Create();
- response.Headers.Add("ETag", string.Concat(sha1.ComputeHash(Encoding.UTF8.GetBytes(hashContent)).Select(x => x.ToString("X2"))));
+ response.Headers.Add("ETag", string.Concat(SHA256.HashData(Encoding.UTF8.GetBytes(hashContent)).Select(x => x.ToString("X2"))));
if (maxAge != 10)
{
response.Headers.CacheControl = $"max-age={maxAge}";
diff --git a/API/Extensions/IdentityServiceExtensions.cs b/API/Extensions/IdentityServiceExtensions.cs
index 6e958638a..5dc547362 100644
--- a/API/Extensions/IdentityServiceExtensions.cs
+++ b/API/Extensions/IdentityServiceExtensions.cs
@@ -53,7 +53,7 @@ public static class IdentityServiceExtensions
options.TokenValidationParameters = new TokenValidationParameters()
{
ValidateIssuerSigningKey = true,
- IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(config["TokenKey"])),
+ IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(config["TokenKey"]!)),
ValidateIssuer = false,
ValidateAudience = false,
ValidIssuer = "Kavita"
diff --git a/API/Extensions/ParserInfoListExtensions.cs b/API/Extensions/ParserInfoListExtensions.cs
index 9bea79ce9..96e39176f 100644
--- a/API/Extensions/ParserInfoListExtensions.cs
+++ b/API/Extensions/ParserInfoListExtensions.cs
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using API.Entities;
-using API.Parser;
+using API.Services.Tasks.Scanner.Parser;
namespace API.Extensions;
diff --git a/API/Extensions/QueryExtensions/IncludesExtensions.cs b/API/Extensions/QueryExtensions/IncludesExtensions.cs
new file mode 100644
index 000000000..143b4257b
--- /dev/null
+++ b/API/Extensions/QueryExtensions/IncludesExtensions.cs
@@ -0,0 +1,148 @@
+using System.Linq;
+using API.Data.Repositories;
+using API.Entities;
+using Microsoft.EntityFrameworkCore;
+
+namespace API.Extensions.QueryExtensions;
+
+/// <summary>
+/// All extensions against IQueryable that enables the dynamic including based on bitwise flag pattern
+/// </summary>
+public static class IncludesExtensions
+{
+ public static IQueryable<CollectionTag> Includes(this IQueryable<CollectionTag> queryable,
+ CollectionTagIncludes includes)
+ {
+ if (includes.HasFlag(CollectionTagIncludes.SeriesMetadata))
+ {
+ queryable = queryable.Include(c => c.SeriesMetadatas);
+ }
+
+ return queryable.AsSplitQuery();
+ }
+
+ public static IQueryable<Chapter> Includes(this IQueryable<Chapter> queryable,
+ ChapterIncludes includes)
+ {
+ if (includes.HasFlag(ChapterIncludes.Volumes))
+ {
+ queryable = queryable.Include(v => v.Volume);
+ }
+
+ if (includes.HasFlag(ChapterIncludes.Files))
+ {
+ queryable = queryable
+ .Include(c => c.Files);
+ }
+
+
+ return queryable.AsSplitQuery();
+ }
+
+ public static IQueryable<Series> Includes(this IQueryable<Series> query,
+ SeriesIncludes includeFlags)
+ {
+ if (includeFlags.HasFlag(SeriesIncludes.Library))
+ {
+ query = query.Include(u => u.Library);
+ }
+
+ if (includeFlags.HasFlag(SeriesIncludes.Volumes))
+ {
+ query = query.Include(s => s.Volumes);
+ }
+
+ if (includeFlags.HasFlag(SeriesIncludes.Chapters))
+ {
+ query = query
+ .Include(s => s.Volumes)
+ .ThenInclude(v => v.Chapters);
+ }
+
+ if (includeFlags.HasFlag(SeriesIncludes.Related))
+ {
+ query = query.Include(s => s.Relations)
+ .ThenInclude(r => r.TargetSeries)
+ .Include(s => s.RelationOf);
+ }
+
+ if (includeFlags.HasFlag(SeriesIncludes.Metadata))
+ {
+ query = query.Include(s => s.Metadata)
+ .ThenInclude(m => m.CollectionTags.OrderBy(g => g.NormalizedTitle))
+ .Include(s => s.Metadata)
+ .ThenInclude(m => m.Genres.OrderBy(g => g.NormalizedTitle))
+ .Include(s => s.Metadata)
+ .ThenInclude(m => m.People)
+ .Include(s => s.Metadata)
+ .ThenInclude(m => m.Tags.OrderBy(g => g.NormalizedTitle));
+ }
+
+
+ return query.AsSplitQuery();
+ }
+
+ public static IQueryable<AppUser> Includes(this IQueryable<AppUser> query, AppUserIncludes includeFlags)
+ {
+ if (includeFlags.HasFlag(AppUserIncludes.Bookmarks))
+ {
+ query = query.Include(u => u.Bookmarks);
+ }
+
+ if (includeFlags.HasFlag(AppUserIncludes.Progress))
+ {
+ query = query.Include(u => u.Progresses);
+ }
+
+ if (includeFlags.HasFlag(AppUserIncludes.ReadingLists))
+ {
+ query = query.Include(u => u.ReadingLists);
+ }
+
+ if (includeFlags.HasFlag(AppUserIncludes.ReadingListsWithItems))
+ {
+ query = query.Include(u => u.ReadingLists)
+ .ThenInclude(r => r.Items);
+ }
+
+ if (includeFlags.HasFlag(AppUserIncludes.Ratings))
+ {
+ query = query.Include(u => u.Ratings);
+ }
+
+ if (includeFlags.HasFlag(AppUserIncludes.UserPreferences))
+ {
+ query = query.Include(u => u.UserPreferences);
+ }
+
+ if (includeFlags.HasFlag(AppUserIncludes.WantToRead))
+ {
+ query = query.Include(u => u.WantToRead);
+ }
+
+ if (includeFlags.HasFlag(AppUserIncludes.Devices))
+ {
+ query = query.Include(u => u.Devices);
+ }
+
+ return query.AsSplitQuery();
+ }
+
+ public static IQueryable<ReadingList> Includes(this IQueryable<ReadingList> queryable,
+ ReadingListIncludes includes)
+ {
+ if (includes.HasFlag(ReadingListIncludes.Items))
+ {
+ queryable = queryable.Include(r => r.Items.OrderBy(item => item.Order));
+ }
+
+ if (includes.HasFlag(ReadingListIncludes.ItemChapter))
+ {
+ queryable = queryable
+ .Include(r => r.Items.OrderBy(item => item.Order))
+ .ThenInclude(ri => ri.Chapter);
+ }
+
+ return queryable.AsSplitQuery();
+ }
+}
diff --git a/API/Extensions/QueryExtensions/QueryableExtensions.cs b/API/Extensions/QueryExtensions/QueryableExtensions.cs
new file mode 100644
index 000000000..57a5e844a
--- /dev/null
+++ b/API/Extensions/QueryExtensions/QueryableExtensions.cs
@@ -0,0 +1,92 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Linq.Expressions;
+using System.Threading.Tasks;
+using API.Data.Misc;
+using API.Data.Repositories;
+using API.Entities;
+using API.Entities.Enums;
+using Microsoft.EntityFrameworkCore;
+
+namespace API.Extensions.QueryExtensions;
+
+public static class QueryableExtensions
+{
+ public static Task<AgeRestriction> GetUserAgeRestriction(this DbSet<AppUser> queryable, int userId)
+ {
+ if (userId < 1)
+ {
+ return Task.FromResult(new AgeRestriction()
+ {
+ AgeRating = AgeRating.NotApplicable,
+ IncludeUnknowns = true
+ });
+ }
+ return queryable
+ .AsNoTracking()
+ .Where(u => u.Id == userId)
+ .Select(u =>
+ new AgeRestriction(){
+ AgeRating = u.AgeRestriction,
+ IncludeUnknowns = u.AgeRestrictionIncludeUnknowns
+ })
+ .SingleAsync();
+ }
+
+
+ /// <summary>
+ /// Applies restriction based on if the Library has restrictions (like include in search)
+ /// </summary>
+ /// <param name="query"></param>
+ /// <param name="context"></param>
+ /// <returns></returns>
+ public static IQueryable<Library> IsRestricted(this IQueryable<Library> query, QueryContext context)
+ {
+ if (context.HasFlag(QueryContext.None)) return query;
+
+ if (context.HasFlag(QueryContext.Dashboard))
+ {
+ query = query.Where(l => l.IncludeInDashboard);
+ }
+
+ if (context.HasFlag(QueryContext.Recommended))
+ {
+ query = query.Where(l => l.IncludeInRecommended);
+ }
+
+ if (context.HasFlag(QueryContext.Search))
+ {
+ query = query.Where(l => l.IncludeInSearch);
+ }
+
+ return query;
+ }
+
+ /// <summary>
+ /// Returns all libraries for a given user
+ /// </summary>
+ /// <param name="library"></param>
+ /// <param name="userId"></param>
+ /// <param name="queryContext"></param>
+ /// <returns></returns>
+ public static IQueryable<int> GetUserLibraries(this IQueryable<Library> library, int userId, QueryContext queryContext = QueryContext.None)
+ {
+ return library
+ .Include(l => l.AppUsers)
+ .Where(lib => lib.AppUsers.Any(user => user.Id == userId))
+ .IsRestricted(queryContext)
+ .AsNoTracking()
+ .AsSplitQuery()
+ .Select(lib => lib.Id);
+ }
+
+ public static IEnumerable<DateTime> Range(this DateTime startDate, int numberOfDays) =>
+ Enumerable.Range(0, numberOfDays).Select(e => startDate.AddDays(e));
+
+ public static IQueryable<T> WhereIf<T>(this IQueryable<T> queryable, bool condition,
+ Expression<Func<T, bool>> predicate)
+ {
+ return condition ? queryable.Where(predicate) : queryable;
+ }
+}
diff --git a/API/Extensions/QueryExtensions/RestrictByAgeExtensions.cs b/API/Extensions/QueryExtensions/RestrictByAgeExtensions.cs
new file mode 100644
index 000000000..866382587
--- /dev/null
+++ b/API/Extensions/QueryExtensions/RestrictByAgeExtensions.cs
@@ -0,0 +1,94 @@
+using System.Linq;
+using API.Data.Misc;
+using API.Entities;
+using API.Entities.Enums;
+
+namespace API.Extensions.QueryExtensions;
+
+/// <summary>
+/// Responsible for restricting Entities based on an AgeRestriction
+/// </summary>
+public static class RestrictByAgeExtensions
+{
+ public static IQueryable<Series> RestrictAgainstAgeRestriction(this IQueryable<Series> queryable, AgeRestriction restriction)
+ {
+ if (restriction.AgeRating == AgeRating.NotApplicable) return queryable;
+ var q = queryable.Where(s => s.Metadata.AgeRating <= restriction.AgeRating);
+
+ if (!restriction.IncludeUnknowns)
+ {
+ return q.Where(s => s.Metadata.AgeRating != AgeRating.Unknown);
+ }
+
+ return q;
+ }
+
+ public static IQueryable<CollectionTag> RestrictAgainstAgeRestriction(this IQueryable<CollectionTag> queryable, AgeRestriction restriction)
+ {
+ if (restriction.AgeRating == AgeRating.NotApplicable) return queryable;
+
+ if (restriction.IncludeUnknowns)
+ {
+ return queryable.Where(c => c.SeriesMetadatas.All(sm =>
+ sm.AgeRating <= restriction.AgeRating));
+ }
+
+ return queryable.Where(c => c.SeriesMetadatas.All(sm =>
+ sm.AgeRating <= restriction.AgeRating && sm.AgeRating > AgeRating.Unknown));
+ }
+
+ public static IQueryable<Genre> RestrictAgainstAgeRestriction(this IQueryable<Genre> queryable, AgeRestriction restriction)
+ {
+ if (restriction.AgeRating == AgeRating.NotApplicable) return queryable;
+
+ if (restriction.IncludeUnknowns)
+ {
+ return queryable.Where(c => c.SeriesMetadatas.All(sm =>
+ sm.AgeRating <= restriction.AgeRating));
+ }
+
+ return queryable.Where(c => c.SeriesMetadatas.All(sm =>
+ sm.AgeRating <= restriction.AgeRating && sm.AgeRating > AgeRating.Unknown));
+ }
+
+ public static IQueryable<Tag> RestrictAgainstAgeRestriction(this IQueryable<Tag> queryable, AgeRestriction restriction)
+ {
+ if (restriction.AgeRating == AgeRating.NotApplicable) return queryable;
+
+ if (restriction.IncludeUnknowns)
+ {
+ return queryable.Where(c => c.SeriesMetadatas.All(sm =>
+ sm.AgeRating <= restriction.AgeRating));
+ }
+
+ return queryable.Where(c => c.SeriesMetadatas.All(sm =>
+ sm.AgeRating <= restriction.AgeRating && sm.AgeRating > AgeRating.Unknown));
+ }
+
+ public static IQueryable<Person> RestrictAgainstAgeRestriction(this IQueryable<Person> queryable, AgeRestriction restriction)
+ {
+ if (restriction.AgeRating == AgeRating.NotApplicable) return queryable;
+
+ if (restriction.IncludeUnknowns)
+ {
+ return queryable.Where(c => c.SeriesMetadatas.All(sm =>
+ sm.AgeRating <= restriction.AgeRating));
+ }
+
+ return queryable.Where(c => c.SeriesMetadatas.All(sm =>
+ sm.AgeRating <= restriction.AgeRating && sm.AgeRating > AgeRating.Unknown));
+ }
+
+ public static IQueryable<ReadingList> RestrictAgainstAgeRestriction(this IQueryable<ReadingList> queryable, AgeRestriction restriction)
+ {
+ if (restriction.AgeRating == AgeRating.NotApplicable) return queryable;
+ var q = queryable.Where(rl => rl.AgeRating <= restriction.AgeRating);
+
+ if (!restriction.IncludeUnknowns)
+ {
+ return q.Where(rl => rl.AgeRating != AgeRating.Unknown);
+ }
+
+ return q;
+ }
+}
diff --git a/API/Extensions/QueryableExtensions.cs b/API/Extensions/QueryableExtensions.cs
deleted file mode 100644
index 37ced54d2..000000000
--- a/API/Extensions/QueryableExtensions.cs
+++ /dev/null
@@ -1,237 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using API.Data.Misc;
-using API.Data.Repositories;
-using API.Entities;
-using API.Entities.Enums;
-using Microsoft.EntityFrameworkCore;
-
-namespace API.Extensions;
-
-public static class QueryableExtensions
-{
- public static IQueryable<Series> RestrictAgainstAgeRestriction(this IQueryable<Series> queryable, AgeRestriction restriction)
- {
- if (restriction.AgeRating == AgeRating.NotApplicable) return queryable;
- var q = queryable.Where(s => s.Metadata.AgeRating <= restriction.AgeRating);
- if (!restriction.IncludeUnknowns)
- {
- return q.Where(s => s.Metadata.AgeRating != AgeRating.Unknown);
- }
-
- return q;
- }
-
- public static IQueryable<CollectionTag> RestrictAgainstAgeRestriction(this IQueryable<CollectionTag> queryable, AgeRestriction restriction)
- {
- if (restriction.AgeRating == AgeRating.NotApplicable) return queryable;
-
- if (restriction.IncludeUnknowns)
- {
- return queryable.Where(c => c.SeriesMetadatas.All(sm =>
- sm.AgeRating <= restriction.AgeRating));
- }
-
- return queryable.Where(c => c.SeriesMetadatas.All(sm =>
- sm.AgeRating <= restriction.AgeRating && sm.AgeRating > AgeRating.Unknown));
- }
-
- public static IQueryable<Genre> RestrictAgainstAgeRestriction(this IQueryable<Genre> queryable, AgeRestriction restriction)
- {
- if (restriction.AgeRating == AgeRating.NotApplicable) return queryable;
-
- if (restriction.IncludeUnknowns)
- {
- return queryable.Where(c => c.SeriesMetadatas.All(sm =>
- sm.AgeRating <= restriction.AgeRating));
- }
-
- return queryable.Where(c => c.SeriesMetadatas.All(sm =>
- sm.AgeRating <= restriction.AgeRating && sm.AgeRating > AgeRating.Unknown));
- }
-
- public static IQueryable<Tag> RestrictAgainstAgeRestriction(this IQueryable<Tag> queryable, AgeRestriction restriction)
- {
- if (restriction.AgeRating == AgeRating.NotApplicable) return queryable;
-
- if (restriction.IncludeUnknowns)
- {
- return queryable.Where(c => c.SeriesMetadatas.All(sm =>
- sm.AgeRating <= restriction.AgeRating));
- }
-
- return queryable.Where(c => c.SeriesMetadatas.All(sm =>
- sm.AgeRating <= restriction.AgeRating && sm.AgeRating > AgeRating.Unknown));
- }
-
- public static IQueryable<Person> RestrictAgainstAgeRestriction(this IQueryable<Person> queryable, AgeRestriction restriction)
- {
- if (restriction.AgeRating == AgeRating.NotApplicable) return queryable;
-
- if (restriction.IncludeUnknowns)
- {
- return queryable.Where(c => c.SeriesMetadatas.All(sm =>
- sm.AgeRating <= restriction.AgeRating));
- }
-
- return queryable.Where(c => c.SeriesMetadatas.All(sm =>
- sm.AgeRating <= restriction.AgeRating && sm.AgeRating > AgeRating.Unknown));
- }
-
- public static IQueryable<ReadingList> RestrictAgainstAgeRestriction(this IQueryable<ReadingList> queryable, AgeRestriction restriction)
- {
- if (restriction.AgeRating == AgeRating.NotApplicable) return queryable;
- var q = queryable.Where(rl => rl.AgeRating <= restriction.AgeRating);
-
- if (!restriction.IncludeUnknowns)
- {
- return q.Where(rl => rl.AgeRating != AgeRating.Unknown);
- }
-
- return q;
- }
-
- public static Task<AgeRestriction> GetUserAgeRestriction(this DbSet<AppUser> queryable, int userId)
- {
- if (userId < 1)
- {
- return Task.FromResult(new AgeRestriction()
- {
- AgeRating = AgeRating.NotApplicable,
- IncludeUnknowns = true
- });
- }
- return queryable
- .AsNoTracking()
- .Where(u => u.Id == userId)
- .Select(u =>
- new AgeRestriction(){
- AgeRating = u.AgeRestriction,
- IncludeUnknowns = u.AgeRestrictionIncludeUnknowns
- })
- .SingleAsync();
- }
-
- public static IQueryable<CollectionTag> Includes(this IQueryable<CollectionTag> queryable,
- CollectionTagIncludes includes)
- {
- if (includes.HasFlag(CollectionTagIncludes.SeriesMetadata))
- {
- queryable = queryable.Include(c => c.SeriesMetadatas);
- }
-
- return queryable.AsSplitQuery();
- }
-
- public static IQueryable<Chapter> Includes(this IQueryable<Chapter> queryable,
- ChapterIncludes includes)
- {
- if (includes.HasFlag(ChapterIncludes.Volumes))
- {
- queryable = queryable.Include(v => v.Volume);
- }
-
- if (includes.HasFlag(ChapterIncludes.Files))
- {
- queryable = queryable
- .Include(c => c.Files);
- }
-
-
- return queryable.AsSplitQuery();
- }
-
- public static IQueryable<Series> Includes(this IQueryable<Series> query,
- SeriesIncludes includeFlags)
- {
- if (includeFlags.HasFlag(SeriesIncludes.Library))
- {
- query = query.Include(u => u.Library);
- }
-
- if (includeFlags.HasFlag(SeriesIncludes.Volumes))
- {
- query = query.Include(s => s.Volumes);
- }
-
- if (includeFlags.HasFlag(SeriesIncludes.Chapters))
- {
- query = query
- .Include(s => s.Volumes)
- .ThenInclude(v => v.Chapters);
- }
-
- if (includeFlags.HasFlag(SeriesIncludes.Related))
- {
- query = query.Include(s => s.Relations)
- .ThenInclude(r => r.TargetSeries)
- .Include(s => s.RelationOf);
- }
-
- if (includeFlags.HasFlag(SeriesIncludes.Metadata))
- {
- query = query.Include(s => s.Metadata)
- .ThenInclude(m => m.CollectionTags.OrderBy(g => g.NormalizedTitle))
- .Include(s => s.Metadata)
- .ThenInclude(m => m.Genres.OrderBy(g => g.NormalizedTitle))
- .Include(s => s.Metadata)
- .ThenInclude(m => m.People)
- .Include(s => s.Metadata)
- .ThenInclude(m => m.Tags.OrderBy(g => g.NormalizedTitle));
- }
-
-
- return query.AsSplitQuery();
- }
-
- /// <summary>
- /// Applies restriction based on if the Library has restrictions (like include in search)
- /// </summary>
- /// <param name="query"></param>
- /// <param name="context"></param>
- /// <returns></returns>
- public static IQueryable<Library> IsRestricted(this IQueryable<Library> query, QueryContext context)
- {
- if (context.HasFlag(QueryContext.None)) return query;
-
- if (context.HasFlag(QueryContext.Dashboard))
- {
- query = query.Where(l => l.IncludeInDashboard);
- }
-
- if (context.HasFlag(QueryContext.Recommended))
- {
- query = query.Where(l => l.IncludeInRecommended);
- }
-
- if (context.HasFlag(QueryContext.Search))
- {
- query = query.Where(l => l.IncludeInSearch);
- }
-
- return query;
- }
-
- /// <summary>
- /// Returns all libraries for a given user
- /// </summary>
- /// <param name="library"></param>
- /// <param name="userId"></param>
- /// <param name="queryContext"></param>
- /// <returns></returns>
- public static IQueryable<int> GetUserLibraries(this IQueryable<Library> library, int userId, QueryContext queryContext = QueryContext.None)
- {
- return library
- .Include(l => l.AppUsers)
- .Where(lib => lib.AppUsers.Any(user => user.Id == userId))
- .IsRestricted(queryContext)
- .AsNoTracking()
- .AsSplitQuery()
- .Select(lib => lib.Id);
- }
-
- public static IEnumerable<DateTime> Range(this DateTime startDate, int numberOfDays) =>
- Enumerable.Range(0, numberOfDays).Select(e => startDate.AddDays(e));
-}
diff --git a/API/Extensions/SeriesExtensions.cs b/API/Extensions/SeriesExtensions.cs
index ad5ec3130..42b428579 100644
--- a/API/Extensions/SeriesExtensions.cs
+++ b/API/Extensions/SeriesExtensions.cs
@@ -2,62 +2,23 @@
using System.Linq;
using API.Comparators;
using API.Entities;
-using API.Parser;
-using API.Services.Tasks.Scanner;
namespace API.Extensions;
public static class SeriesExtensions
{
- /// <summary>
- /// Checks against all the name variables of the Series if it matches anything in the list. This does not check against format.
- /// </summary>
- /// <param name="series"></param>
- /// <param name="list"></param>
- /// <returns></returns>
- public static bool NameInList(this Series series, IEnumerable<string> list)
- {
- return list.Any(name => Services.Tasks.Scanner.Parser.Parser.Normalize(name) == series.NormalizedName || Services.Tasks.Scanner.Parser.Parser.Normalize(name) == Services.Tasks.Scanner.Parser.Parser.Normalize(series.Name)
- || name == series.Name || name == series.LocalizedName || name == series.OriginalName || Services.Tasks.Scanner.Parser.Parser.Normalize(name) == Services.Tasks.Scanner.Parser.Parser.Normalize(series.OriginalName));
- }
-
- /// <summary>
- /// Checks against all the name variables of the Series if it matches anything in the list. Includes a check against the Format of the Series
- /// </summary>
- /// <param name="series"></param>
- /// <param name="list"></param>
- /// <returns></returns>
- public static bool NameInList(this Series series, IEnumerable<ParsedSeries> list)
- {
- return list.Any(name => Services.Tasks.Scanner.Parser.Parser.Normalize(name.Name) == series.NormalizedName || Services.Tasks.Scanner.Parser.Parser.Normalize(name.Name) == Services.Tasks.Scanner.Parser.Parser.Normalize(series.Name)
- || name.Name == series.Name || name.Name == series.LocalizedName || name.Name == series.OriginalName || Services.Tasks.Scanner.Parser.Parser.Normalize(name.Name) == Services.Tasks.Scanner.Parser.Parser.Normalize(series.OriginalName) && series.Format == name.Format);
- }
-
- /// <summary>
- /// Checks against all the name variables of the Series if it matches the <see cref="ParserInfo"/>
- /// </summary>
- /// <param name="series"></param>
- /// <param name="info"></param>
- /// <returns></returns>
- public static bool NameInParserInfo(this Series series, ParserInfo info)
- {
- if (info == null) return false;
- return Services.Tasks.Scanner.Parser.Parser.Normalize(info.Series) == series.NormalizedName || Services.Tasks.Scanner.Parser.Parser.Normalize(info.Series) == Services.Tasks.Scanner.Parser.Parser.Normalize(series.Name)
- || info.Series == series.Name || info.Series == series.LocalizedName || info.Series == series.OriginalName
- || Services.Tasks.Scanner.Parser.Parser.Normalize(info.Series) == Services.Tasks.Scanner.Parser.Parser.Normalize(series.OriginalName);
- }
-
/// <summary>
/// Calculates the Cover Image for the Series
/// </summary>
/// <param name="series"></param>
/// <returns></returns>
/// <remarks>This is under the assumption that the Volume already has a Cover Image calculated and set</remarks>
- public static string GetCoverImage(this Series series)
+ public static string? GetCoverImage(this Series series)
{
var volumes = series.Volumes ?? new List<Volume>();
var firstVolume = volumes.GetCoverImage(series.Format);
- string coverImage = null;
+ if (firstVolume == null) return null;
+ string? coverImage = null;
var chapters = firstVolume.Chapters.OrderBy(c => double.Parse(c.Number), ChapterSortComparerZeroFirst.Default).ToList();
if (chapters.Count > 1 && chapters.Any(c => c.IsSpecial))
diff --git a/API/Extensions/StringExtensions.cs b/API/Extensions/StringExtensions.cs
index 18c5ad989..9ce29eaec 100644
--- a/API/Extensions/StringExtensions.cs
+++ b/API/Extensions/StringExtensions.cs
@@ -11,4 +11,15 @@ public static class StringExtensions
{
return SentenceCaseRegex.Replace(value.ToLower(), s => s.Value.ToUpper());
}
+
+ /// <summary>
+ /// Apply normalization on the String
+ /// </summary>
+ /// <param name="value"></param>
+ /// <returns></returns>
+ public static string ToNormalized(this string? value)
+ {
+ if (string.IsNullOrEmpty(value)) return string.Empty;
+ return Services.Tasks.Scanner.Parser.Parser.Normalize(value);
+ }
}
diff --git a/API/Extensions/VolumeListExtensions.cs b/API/Extensions/VolumeListExtensions.cs
index 5c9084764..0d42b15e8 100644
--- a/API/Extensions/VolumeListExtensions.cs
+++ b/API/Extensions/VolumeListExtensions.cs
@@ -1,6 +1,6 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using System.Linq;
-using API.Comparators;
using API.Entities;
using API.Entities.Enums;
@@ -15,13 +15,16 @@ public static class VolumeListExtensions
/// <param name="volumes"></param>
/// <param name="seriesFormat"></param>
/// <returns></returns>
- public static Volume GetCoverImage(this IList<Volume> volumes, MangaFormat seriesFormat)
+ public static Volume? GetCoverImage(this IList<Volume> volumes, MangaFormat seriesFormat)
{
+ if (volumes == null) throw new ArgumentException("Volumes cannot be null");
+
if (seriesFormat == MangaFormat.Epub || seriesFormat == MangaFormat.Pdf)
{
return volumes.MinBy(x => x.Number);
}
+
if (volumes.Any(x => x.Number != 0))
{
return volumes.OrderBy(x => x.Number).FirstOrDefault(x => x.Number != 0);
diff --git a/API/Helpers/Builders/AppUserBuilder.cs b/API/Helpers/Builders/AppUserBuilder.cs
new file mode 100644
index 000000000..d837b3ff5
--- /dev/null
+++ b/API/Helpers/Builders/AppUserBuilder.cs
@@ -0,0 +1,40 @@
+using System.Collections.Generic;
+using System.Linq;
+using API.Data;
+using API.Entities;
+using Kavita.Common;
+
+namespace API.Helpers.Builders;
+
+public class AppUserBuilder : IEntityBuilder<AppUser>
+{
+ private readonly AppUser _appUser;
+ public AppUser Build() => _appUser;
+
+ public AppUserBuilder(string username, string email, SiteTheme? theme = null)
+ {
+ _appUser = new AppUser()
+ {
+ UserName = username,
+ Email = email,
+ ApiKey = HashUtil.ApiKey(),
+ UserPreferences = new AppUserPreferences
+ {
+ Theme = theme ?? Seed.DefaultThemes.First()
+ },
+ ReadingLists = new List<ReadingList>(),
+ Bookmarks = new List<AppUserBookmark>(),
+ Libraries = new List<Library>(),
+ Ratings = new List<AppUserRating>(),
+ Progresses = new List<AppUserProgress>(),
+ Devices = new List<Device>(),
+ Id = 0
+ };
+ }
+
+ public AppUserBuilder WithLibrary(Library library)
+ {
+ _appUser.Libraries.Add(library);
+ return this;
+ }
+}
diff --git a/API/Helpers/Builders/ChapterBuilder.cs b/API/Helpers/Builders/ChapterBuilder.cs
new file mode 100644
index 000000000..35b115998
--- /dev/null
+++ b/API/Helpers/Builders/ChapterBuilder.cs
@@ -0,0 +1,128 @@
+using System;
+using System.Collections.Generic;
+using API.Entities;
+using API.Entities.Enums;
+using API.Services.Tasks.Scanner.Parser;
+
+namespace API.Helpers.Builders;
+
+public class ChapterBuilder : IEntityBuilder<Chapter>
+{
+ private readonly Chapter _chapter;
+ public Chapter Build() => _chapter;
+
+ public ChapterBuilder(string number, string? range=null)
+ {
+ _chapter = new Chapter()
+ {
+ Range = string.IsNullOrEmpty(range) ? number : range,
+ Title = string.IsNullOrEmpty(range) ? number : range,
+ Number = Parser.MinNumberFromRange(number) + string.Empty,
+ Files = new List<MangaFile>(),
+ Pages = 1
+ };
+ }
+
+ public static ChapterBuilder FromParserInfo(ParserInfo info)
+ {
+ var specialTreatment = info.IsSpecialInfo();
+ var specialTitle = specialTreatment ? info.Filename : info.Chapters;
+ var builder = new ChapterBuilder(Services.Tasks.Scanner.Parser.Parser.DefaultChapter);
+ return builder.WithNumber(specialTreatment ? Services.Tasks.Scanner.Parser.Parser.DefaultChapter : Services.Tasks.Scanner.Parser.Parser.MinNumberFromRange(info.Chapters) + string.Empty)
+ .WithRange(specialTreatment ? info.Filename : info.Chapters)
+ .WithTitle((specialTreatment && info.Format == MangaFormat.Epub)
+ ? info.Title
+ : specialTitle)
+ .WithIsSpecial(specialTreatment);
+ }
+
+ public ChapterBuilder WithId(int id)
+ {
+ _chapter.Id = Math.Max(id, 0);
+ return this;
+ }
+
+ public ChapterBuilder WithNumber(string number)
+ {
+ _chapter.Number = number;
+ return this;
+ }
+
+ public ChapterBuilder WithStoryArc(string arc)
+ {
+ _chapter.StoryArc = arc;
+ return this;
+ }
+
+ public ChapterBuilder WithStoryArcNumber(string number)
+ {
+ _chapter.StoryArcNumber = number;
+ return this;
+ }
+
+ private ChapterBuilder WithRange(string range)
+ {
+ _chapter.Range = range;
+ return this;
+ }
+
+ public ChapterBuilder WithReleaseDate(DateTime time)
+ {
+ _chapter.ReleaseDate = time;
+ return this;
+ }
+
+ public ChapterBuilder WithAgeRating(AgeRating rating)
+ {
+ _chapter.AgeRating = rating;
+ return this;
+ }
+
+ public ChapterBuilder WithPages(int pages)
+ {
+ _chapter.Pages = pages;
+ return this;
+ }
+ public ChapterBuilder WithCoverImage(string cover)
+ {
+ _chapter.CoverImage = cover;
+ return this;
+ }
+ public ChapterBuilder WithIsSpecial(bool isSpecial)
+ {
+ _chapter.IsSpecial = isSpecial;
+ return this;
+ }
+ public ChapterBuilder WithTitle(string title)
+ {
+ _chapter.Title = title;
+ return this;
+ }
+
+ public ChapterBuilder WithFile(MangaFile file)
+ {
+ _chapter.Files ??= new List<MangaFile>();
+ _chapter.Files.Add(file);
+ return this;
+ }
+
+ public ChapterBuilder WithFiles(IList<MangaFile> files)
+ {
+ _chapter.Files = files ?? new List<MangaFile>();
+ return this;
+ }
+
+ public ChapterBuilder WithLastModified(DateTime lastModified)
+ {
+ _chapter.LastModified = lastModified;
+ _chapter.LastModifiedUtc = lastModified.ToUniversalTime();
+ return this;
+ }
+
+ public ChapterBuilder WithCreated(DateTime created)
+ {
+ _chapter.Created = created;
+ _chapter.CreatedUtc = created.ToUniversalTime();
+ return this;
+ }
+}
diff --git a/API/Helpers/Builders/CollectionTagBuilder.cs b/API/Helpers/Builders/CollectionTagBuilder.cs
new file mode 100644
index 000000000..e46720d79
--- /dev/null
+++ b/API/Helpers/Builders/CollectionTagBuilder.cs
@@ -0,0 +1,57 @@
+using System.Collections.Generic;
+using API.Entities;
+using API.Entities.Metadata;
+using API.Extensions;
+
+namespace API.Helpers.Builders;
+
+public class CollectionTagBuilder : IEntityBuilder<CollectionTag>
+{
+ private readonly CollectionTag _collectionTag;
+ public CollectionTag Build() => _collectionTag;
+
+ public CollectionTagBuilder(string title, bool promoted = false)
+ {
+ title = title.Trim();
+ _collectionTag = new CollectionTag()
+ {
+ Id = 0,
+ NormalizedTitle = title.ToNormalized(),
+ Title = title,
+ Promoted = promoted,
+ Summary = string.Empty,
+ SeriesMetadatas = new List<SeriesMetadata>()
+ };
+ }
+
+ public CollectionTagBuilder WithId(int id)
+ {
+ _collectionTag.Id = id;
+ return this;
+ }
+
+ public CollectionTagBuilder WithSummary(string summary)
+ {
+ _collectionTag.Summary = summary;
+ return this;
+ }
+
+ public CollectionTagBuilder WithIsPromoted(bool promoted)
+ {
+ _collectionTag.Promoted = promoted;
+ return this;
+ }
+
+ public CollectionTagBuilder WithSeriesMetadata(SeriesMetadata seriesMetadata)
+ {
+ _collectionTag.SeriesMetadatas ??= new List<SeriesMetadata>();
+ _collectionTag.SeriesMetadatas.Add(seriesMetadata);
+ return this;
+ }
+
+ public CollectionTagBuilder WithCoverImage(string cover)
+ {
+ _collectionTag.CoverImage = cover;
+ return this;
+ }
+}
diff --git a/API/Helpers/Builders/DeviceBuilder.cs b/API/Helpers/Builders/DeviceBuilder.cs
new file mode 100644
index 000000000..0ee892ffe
--- /dev/null
+++ b/API/Helpers/Builders/DeviceBuilder.cs
@@ -0,0 +1,30 @@
+using API.Entities;
+using API.Entities.Enums.Device;
+
+namespace API.Helpers.Builders;
+
+public class DeviceBuilder : IEntityBuilder<Device>
+{
+ private readonly Device _device;
+ public Device Build() => _device;
+
+ public DeviceBuilder(string name)
+ {
+ _device = new Device()
+ {
+ Name = name,
+ Platform = DevicePlatform.Custom
+ };
+ }
+
+ public DeviceBuilder WithPlatform(DevicePlatform platform)
+ {
+ _device.Platform = platform;
+ return this;
+ }
+ public DeviceBuilder WithEmail(string email)
+ {
+ _device.EmailAddress = email;
+ return this;
+ }
+}
diff --git a/API/Helpers/Builders/EntityBuilder.cs b/API/Helpers/Builders/EntityBuilder.cs
new file mode 100644
index 000000000..d45666e29
--- /dev/null
+++ b/API/Helpers/Builders/EntityBuilder.cs
@@ -0,0 +1,6 @@
+namespace API.Helpers.Builders;
+
+public interface IEntityBuilder<out T>
+{
+ public T Build();
+}
diff --git a/API/Helpers/Builders/FolderPathBuilder.cs b/API/Helpers/Builders/FolderPathBuilder.cs
new file mode 100644
index 000000000..2789db94a
--- /dev/null
+++ b/API/Helpers/Builders/FolderPathBuilder.cs
@@ -0,0 +1,19 @@
+using System.IO;
+using API.Entities;
+
+namespace API.Helpers.Builders;
+
+public class FolderPathBuilder : IEntityBuilder<FolderPath>
+{
+ private readonly FolderPath _folderPath;
+ public FolderPath Build() => _folderPath;
+
+ public FolderPathBuilder(string directory)
+ {
+ _folderPath = new FolderPath()
+ {
+ Path = directory,
+ Id = 0
+ };
+ }
+}
diff --git a/API/Helpers/Builders/GenreBuilder.cs b/API/Helpers/Builders/GenreBuilder.cs
new file mode 100644
index 000000000..69e68f6c1
--- /dev/null
+++ b/API/Helpers/Builders/GenreBuilder.cs
@@ -0,0 +1,30 @@
+using System.Collections.Generic;
+using API.Entities;
+using API.Entities.Metadata;
+using API.Extensions;
+
+namespace API.Helpers.Builders;
+
+public class GenreBuilder : IEntityBuilder<Genre>
+{
+ private readonly Genre _genre;
+ public Genre Build() => _genre;
+
+ public GenreBuilder(string name)
+ {
+ _genre = new Genre()
+ {
+ Title = name.Trim().SentenceCase(),
+ NormalizedTitle = name.ToNormalized(),
+ Chapters = new List<Chapter>(),
+ SeriesMetadatas = new List<SeriesMetadata>()
+ };
+ }
+
+ public GenreBuilder WithSeriesMetadata(SeriesMetadata seriesMetadata)
+ {
+ _genre.SeriesMetadatas ??= new List<SeriesMetadata>();
+ _genre.SeriesMetadatas.Add(seriesMetadata);
+ return this;
+ }
+}
diff --git a/API/Helpers/Builders/LibraryBuilder.cs b/API/Helpers/Builders/LibraryBuilder.cs
new file mode 100644
index 000000000..64e987db1
--- /dev/null
+++ b/API/Helpers/Builders/LibraryBuilder.cs
@@ -0,0 +1,46 @@
+using System.Collections.Generic;
+using System.Linq;
+using API.Entities;
+using API.Entities.Enums;
+using SQLitePCL;
+
+namespace API.Helpers.Builders;
+
+public class LibraryBuilder : IEntityBuilder<Library>
+{
+ private readonly Library _library;
+ public Library Build() => _library;
+
+ public LibraryBuilder(string name, LibraryType type = LibraryType.Manga)
+ {
+ _library = new Library()
+ {
+ Name = name,
+ Type = type,
+ Series = new List<Series>(),
+ Folders = new List<FolderPath>(),
+ AppUsers = new List<AppUser>()
+ };
+ }
+
+ public LibraryBuilder WithFolderPath(FolderPath folderPath)
+ {
+ _library.Folders ??= new List<FolderPath>();
+ if (_library.Folders.All(f => f != folderPath)) _library.Folders.Add(folderPath);
+ return this;
+ }
+
+ public LibraryBuilder WithSeries(Series series)
+ {
+ _library.Series ??= new List<Series>();
+ _library.Series.Add(series);
+ return this;
+ }
+
+ public LibraryBuilder WithAppUser(AppUser appUser)
+ {
+ _library.AppUsers ??= new List<AppUser>();
+ _library.AppUsers.Add(appUser);
+ return this;
+ }
+}
diff --git a/API/Helpers/Builders/MangaFileBuilder.cs b/API/Helpers/Builders/MangaFileBuilder.cs
new file mode 100644
index 000000000..f07dc4a37
--- /dev/null
+++ b/API/Helpers/Builders/MangaFileBuilder.cs
@@ -0,0 +1,61 @@
+using System;
+using System.IO;
+using API.Entities;
+using API.Entities.Enums;
+
+namespace API.Helpers.Builders;
+
+public class MangaFileBuilder : IEntityBuilder<MangaFile>
+{
+ private readonly MangaFile _mangaFile;
+ public MangaFile Build() => _mangaFile;
+
+ public MangaFileBuilder(string filePath, MangaFormat format, int pages = 0)
+ {
+ _mangaFile = new MangaFile()
+ {
+ FilePath = filePath,
+ Format = format,
+ Pages = pages,
+ LastModified = File.GetLastWriteTime(filePath),
+ LastModifiedUtc = File.GetLastWriteTimeUtc(filePath),
+ };
+ }
+
+ public MangaFileBuilder WithFormat(MangaFormat format)
+ {
+ _mangaFile.Format = format;
+ return this;
+ }
+
+ public MangaFileBuilder WithPages(int pages)
+ {
+ _mangaFile.Pages = Math.Max(pages, 0);
+ return this;
+ }
+
+ public MangaFileBuilder WithExtension(string extension)
+ {
+ _mangaFile.Extension = extension.ToLowerInvariant();
+ return this;
+ }
+
+ public MangaFileBuilder WithBytes(long bytes)
+ {
+ _mangaFile.Bytes = Math.Max(0, bytes);
+ return this;
+ }
+
+ public MangaFileBuilder WithLastModified(DateTime dateTime)
+ {
+ _mangaFile.LastModified = dateTime;
+ _mangaFile.LastModifiedUtc = dateTime.ToUniversalTime();
+ return this;
+ }
+
+ public MangaFileBuilder WithId(int id)
+ {
+ _mangaFile.Id = Math.Max(id, 0);
+ return this;
+ }
+}
diff --git a/API/Helpers/Builders/PersonBuilder.cs b/API/Helpers/Builders/PersonBuilder.cs
new file mode 100644
index 000000000..e7e1b573e
--- /dev/null
+++ b/API/Helpers/Builders/PersonBuilder.cs
@@ -0,0 +1,43 @@
+using System.Collections.Generic;
+using API.Entities;
+using API.Entities.Enums;
+using API.Entities.Metadata;
+using API.Extensions;
+
+namespace API.Helpers.Builders;
+
+public class PersonBuilder : IEntityBuilder<Person>
+{
+ private readonly Person _person;
+ public Person Build() => _person;
+
+ public PersonBuilder(string name, PersonRole role)
+ {
+ _person = new Person()
+ {
+ Name = name.Trim(),
+ NormalizedName = name.ToNormalized(),
+ Role = role,
+ ChapterMetadatas = new List<Chapter>(),
+ SeriesMetadatas = new List<SeriesMetadata>()
+ };
+ }
+
+ /// <summary>
+ /// Only call for Unit Tests
+ /// </summary>
+ /// <param name="id"></param>
+ /// <returns></returns>
+ public PersonBuilder WithId(int id)
+ {
+ _person.Id = id;
+ return this;
+ }
+
+ public PersonBuilder WithSeriesMetadata(SeriesMetadata metadata)
+ {
+ _person.SeriesMetadatas ??= new List<SeriesMetadata>();
+ _person.SeriesMetadatas.Add(metadata);
+ return this;
+ }
+}
diff --git a/API/Helpers/Builders/ReadingListBuilder.cs b/API/Helpers/Builders/ReadingListBuilder.cs
new file mode 100644
index 000000000..e05a92096
--- /dev/null
+++ b/API/Helpers/Builders/ReadingListBuilder.cs
@@ -0,0 +1,63 @@
+using System.Collections.Generic;
+using API.Entities;
+using API.Entities.Enums;
+using API.Extensions;
+
+namespace API.Helpers.Builders;
+
+public class ReadingListBuilder : IEntityBuilder<ReadingList>
+{
+ private readonly ReadingList _readingList;
+ public ReadingList Build() => _readingList;
+
+ public ReadingListBuilder(string title)
+ {
+ title = title.Trim();
+ _readingList = new ReadingList()
+ {
+ Title = title,
+ NormalizedTitle = title.ToNormalized(),
+ Summary = string.Empty,
+ Promoted = false,
+ Items = new List<ReadingListItem>(),
+ AgeRating = AgeRating.Unknown
+ };
+ }
+
+ public ReadingListBuilder WithSummary(string summary)
+ {
+ _readingList.Summary = summary ?? string.Empty;
+ return this;
+ }
+
+ public ReadingListBuilder WithItem(ReadingListItem item)
+ {
+ _readingList.Items ??= new List<ReadingListItem>();
+ _readingList.Items.Add(item);
+ return this;
+ }
+
+ public ReadingListBuilder WithRating(AgeRating rating)
+ {
+ _readingList.AgeRating = rating;
+ return this;
+ }
+
+ public ReadingListBuilder WithPromoted(bool promoted)
+ {
+ _readingList.Promoted = promoted;
+ return this;
+ }
+
+ public ReadingListBuilder WithCoverImage(string coverImage)
+ {
+ _readingList.CoverImage = coverImage;
+ return this;
+ }
+
+ public ReadingListBuilder WithAppUserId(int userId)
+ {
+ _readingList.AppUserId = userId;
+ return this;
+ }
+}
diff --git a/API/Helpers/Builders/ReadingListItemBuilder.cs b/API/Helpers/Builders/ReadingListItemBuilder.cs
new file mode 100644
index 000000000..86ca4cfc8
--- /dev/null
+++ b/API/Helpers/Builders/ReadingListItemBuilder.cs
@@ -0,0 +1,21 @@
+using API.Entities;
+
+namespace API.Helpers.Builders;
+
+public class ReadingListItemBuilder : IEntityBuilder<ReadingListItem>
+{
+ private readonly ReadingListItem _item;
+ public ReadingListItem Build() => _item;
+
+ public ReadingListItemBuilder(int index, int seriesId, int volumeId, int chapterId)
+ {
+ _item = new ReadingListItem()
+ {
+ Order = index,
+ ChapterId = chapterId,
+ SeriesId = seriesId,
+ VolumeId = volumeId
+ };
+
+ }
+}
diff --git a/API/Helpers/Builders/SeriesBuilder.cs b/API/Helpers/Builders/SeriesBuilder.cs
new file mode 100644
index 000000000..5d73dcd6d
--- /dev/null
+++ b/API/Helpers/Builders/SeriesBuilder.cs
@@ -0,0 +1,92 @@
+using System.Collections.Generic;
+using System.Linq;
+using API.Entities;
+using API.Entities.Enums;
+using API.Entities.Metadata;
+using API.Extensions;
+
+namespace API.Helpers.Builders;
+
+public class SeriesBuilder : IEntityBuilder<Series>
+{
+ private readonly Series _series;
+ public Series Build()
+ {
+ _series.Pages = _series.Volumes.Sum(v => v.Chapters.Sum(c => c.Pages));
+ return _series;
+ }
+
+ public SeriesBuilder(string name)
+ {
+ _series = new Series()
+ {
+ Name = name,
+ LocalizedName = name.ToNormalized(),
+ OriginalName = name,
+ SortName = name,
+ NormalizedName = name.ToNormalized(),
+ NormalizedLocalizedName = name.ToNormalized(),
+ Metadata = new SeriesMetadataBuilder().Build(),
+ Volumes = new List<Volume>()
+ };
+ }
+
+ /// <summary>
+ /// Sets the localized name. If null or empty, defaults back to the
+ /// </summary>
+ /// <param name="localizedName"></param>
+ /// <returns></returns>
+ public SeriesBuilder WithLocalizedName(string localizedName)
+ {
+ if (string.IsNullOrEmpty(localizedName))
+ {
+ localizedName = _series.Name;
+ }
+ _series.LocalizedName = localizedName;
+ _series.NormalizedLocalizedName = localizedName.ToNormalized();
+ return this;
+ }
+
+ public SeriesBuilder WithFormat(MangaFormat format)
+ {
+ _series.Format = format;
+ return this;
+ }
+
+ public SeriesBuilder WithVolume(Volume volume)
+ {
+ _series.Volumes ??= new List<Volume>();
+ _series.Volumes.Add(volume);
+ return this;
+ }
+
+ public SeriesBuilder WithVolumes(List<Volume> volumes)
+ {
+ _series.Volumes = volumes;
+ return this;
+ }
+
+ public SeriesBuilder WithMetadata(SeriesMetadata metadata)
+ {
+ _series.Metadata = metadata;
+ return this;
+ }
+
+ public SeriesBuilder WithPages(int pages)
+ {
+ _series.Pages = pages;
+ return this;
+ }
+
+ public SeriesBuilder WithCoverImage(string cover)
+ {
+ _series.CoverImage = cover;
+ return this;
+ }
+
+ public SeriesBuilder WithLibraryId(int id)
+ {
+ _series.LibraryId = id;
+ return this;
+ }
+}
diff --git a/API/Helpers/Builders/SeriesMetadataBuilder.cs b/API/Helpers/Builders/SeriesMetadataBuilder.cs
new file mode 100644
index 000000000..d90e896ef
--- /dev/null
+++ b/API/Helpers/Builders/SeriesMetadataBuilder.cs
@@ -0,0 +1,48 @@
+using System.Collections.Generic;
+using API.Entities;
+using API.Entities.Enums;
+using API.Entities.Metadata;
+
+namespace API.Helpers.Builders;
+
+public class SeriesMetadataBuilder : IEntityBuilder<SeriesMetadata>
+{
+ private readonly SeriesMetadata _seriesMetadata;
+ public SeriesMetadata Build() => _seriesMetadata;
+
+ public SeriesMetadataBuilder()
+ {
+ _seriesMetadata = new SeriesMetadata()
+ {
+ CollectionTags = new List<CollectionTag>(),
+ Genres = new List<Genre>(),
+ Tags = new List<Tag>(),
+ People = new List<Person>()
+ };
+ }
+
+ public SeriesMetadataBuilder WithCollectionTag(CollectionTag tag)
+ {
+ _seriesMetadata.CollectionTags ??= new List<CollectionTag>();
+ _seriesMetadata.CollectionTags.Add(tag);
+ return this;
+ }
+ public SeriesMetadataBuilder WithCollectionTags(IList<CollectionTag> tags)
+ {
+ if (tags == null) return this;
+ _seriesMetadata.CollectionTags ??= new List<CollectionTag>();
+ _seriesMetadata.CollectionTags = tags;
+ return this;
+ }
+ public SeriesMetadataBuilder WithPublicationStatus(PublicationStatus status)
+ {
+ _seriesMetadata.PublicationStatus = status;
+ return this;
+ }
+
+ public SeriesMetadataBuilder WithAgeRating(AgeRating rating)
+ {
+ _seriesMetadata.AgeRating = rating;
+ return this;
+ }
+}
diff --git a/API/Helpers/Builders/TagBuilder.cs b/API/Helpers/Builders/TagBuilder.cs
new file mode 100644
index 000000000..084171f54
--- /dev/null
+++ b/API/Helpers/Builders/TagBuilder.cs
@@ -0,0 +1,30 @@
+using System.Collections.Generic;
+using API.Entities;
+using API.Entities.Metadata;
+using API.Extensions;
+
+namespace API.Helpers.Builders;
+
+public class TagBuilder : IEntityBuilder<Tag>
+{
+ private readonly Tag _tag;
+ public Tag Build() => _tag;
+
+ public TagBuilder(string name)
+ {
+ _tag = new Tag()
+ {
+ Title = name.Trim().SentenceCase(),
+ NormalizedTitle = name.ToNormalized(),
+ Chapters = new List<Chapter>(),
+ SeriesMetadatas = new List<SeriesMetadata>()
+ };
+ }
+
+ public TagBuilder WithSeriesMetadata(SeriesMetadata seriesMetadata)
+ {
+ _tag.SeriesMetadatas ??= new List<SeriesMetadata>();
+ _tag.SeriesMetadatas.Add(seriesMetadata);
+ return this;
+ }
+}
diff --git a/API/Helpers/Builders/VolumeBuilder.cs b/API/Helpers/Builders/VolumeBuilder.cs
new file mode 100644
index 000000000..057c3bd99
--- /dev/null
+++ b/API/Helpers/Builders/VolumeBuilder.cs
@@ -0,0 +1,60 @@
+using System.Collections.Generic;
+using System.Linq;
+using API.Data;
+using API.Entities;
+
+namespace API.Helpers.Builders;
+
+public class VolumeBuilder : IEntityBuilder<Volume>
+{
+ private readonly Volume _volume;
+ public Volume Build() => _volume;
+
+ public VolumeBuilder(string volumeNumber)
+ {
+ _volume = new Volume()
+ {
+ Name = volumeNumber,
+ Number = (int) Services.Tasks.Scanner.Parser.Parser.MinNumberFromRange(volumeNumber),
+ Chapters = new List<Chapter>()
+ };
+ }
+
+ public VolumeBuilder WithName(string name)
+ {
+ _volume.Name = name;
+ return this;
+ }
+
+ public VolumeBuilder WithNumber(int number)
+ {
+ _volume.Number = number;
+ return this;
+ }
+
+ public VolumeBuilder WithChapters(List<Chapter> chapters)
+ {
+ _volume.Chapters = chapters;
+ return this;
+ }
+
+ public VolumeBuilder WithChapter(Chapter chapter)
+ {
+ _volume.Chapters ??= new List<Chapter>();
+ _volume.Chapters.Add(chapter);
+ _volume.Pages = _volume.Chapters.Sum(c => c.Pages);
+ return this;
+ }
+
+ public VolumeBuilder WithSeriesId(int seriesId)
+ {
+ _volume.SeriesId = seriesId;
+ return this;
+ }
+
+ public VolumeBuilder WithCoverImage(string cover)
+ {
+ _volume.CoverImage = cover;
+ return this;
+ }
+}
diff --git a/API/Helpers/CacheHelper.cs b/API/Helpers/CacheHelper.cs
index 06a2ba764..d7e22c2e6 100644
--- a/API/Helpers/CacheHelper.cs
+++ b/API/Helpers/CacheHelper.cs
@@ -7,7 +7,7 @@ namespace API.Helpers;
public interface ICacheHelper
{
- bool ShouldUpdateCoverImage(string coverPath, MangaFile firstFile, DateTime chapterCreated,
+ bool ShouldUpdateCoverImage(string coverPath, MangaFile? firstFile, DateTime chapterCreated,
bool forceUpdate = false,
bool isCoverLocked = false);
@@ -37,7 +37,7 @@ public class CacheHelper : ICacheHelper
/// <param name="forceUpdate">If the user has told us to force the refresh</param>
/// <param name="isCoverLocked">If cover has been locked by user. This will force false</param>
/// <returns></returns>
- public bool ShouldUpdateCoverImage(string coverPath, MangaFile firstFile, DateTime chapterCreated, bool forceUpdate = false,
+ public bool ShouldUpdateCoverImage(string coverPath, MangaFile? firstFile, DateTime chapterCreated, bool forceUpdate = false,
bool isCoverLocked = false)
{
diff --git a/API/Helpers/GenreHelper.cs b/API/Helpers/GenreHelper.cs
index f6d6e85e9..c0d04ffc6 100644
--- a/API/Helpers/GenreHelper.cs
+++ b/API/Helpers/GenreHelper.cs
@@ -1,9 +1,11 @@
using System;
-using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using API.Data;
+using API.DTOs.Metadata;
using API.Entities;
+using API.Extensions;
+using API.Helpers.Builders;
namespace API.Helpers;
@@ -21,11 +23,11 @@ public static class GenreHelper
{
if (string.IsNullOrEmpty(name.Trim())) continue;
- var normalizedName = Services.Tasks.Scanner.Parser.Parser.Normalize(name);
- var genre = allGenres.FirstOrDefault(p => p.NormalizedTitle.Equals(normalizedName));
+ var normalizedName = name.ToNormalized();
+ var genre = allGenres.FirstOrDefault(p => p.NormalizedTitle != null && p.NormalizedTitle.Equals(normalizedName));
if (genre == null)
{
- genre = DbFactory.Genre(name);
+ genre = new GenreBuilder(name).Build();
allGenres.Add(genre);
}
@@ -34,12 +36,12 @@ public static class GenreHelper
}
- public static void KeepOnlySameGenreBetweenLists(ICollection<Genre> existingGenres, ICollection<Genre> removeAllExcept, Action<Genre> action = null)
+ public static void KeepOnlySameGenreBetweenLists(ICollection<Genre> existingGenres, ICollection<Genre> removeAllExcept, Action<Genre>? action = null)
{
var existing = existingGenres.ToList();
foreach (var genre in existing)
{
- var existingPerson = removeAllExcept.FirstOrDefault(g => genre.NormalizedTitle.Equals(g.NormalizedTitle));
+ var existingPerson = removeAllExcept.FirstOrDefault(g => genre.NormalizedTitle != null && genre.NormalizedTitle.Equals(g.NormalizedTitle));
if (existingPerson != null) continue;
existingGenres.Remove(genre);
action?.Invoke(genre);
@@ -55,10 +57,57 @@ public static class GenreHelper
public static void AddGenreIfNotExists(ICollection<Genre> metadataGenres, Genre genre)
{
var existingGenre = metadataGenres.FirstOrDefault(p =>
- p.NormalizedTitle == Services.Tasks.Scanner.Parser.Parser.Normalize(genre.Title));
+ p.NormalizedTitle == genre.Title?.ToNormalized());
if (existingGenre == null)
{
metadataGenres.Add(genre);
}
}
+
+
+
+ public static void UpdateGenreList(ICollection<GenreTagDto>? tags, Series series,
+ IReadOnlyCollection<Genre> allTags, Action<Genre> handleAdd, Action onModified)
+ {
+ if (tags == null) return;
+ var isModified = false;
+ // I want a union of these 2 lists. Return only elements that are in both lists, but the list types are different
+ var existingTags = series.Metadata.Genres.ToList();
+ foreach (var existing in existingTags)
+ {
+ // NOTE: Why don't I use a NormalizedName here (outside of memory pressure from string creation)?
+ if (tags.SingleOrDefault(t => t.Id == existing.Id) == null)
+ {
+ // Remove tag
+ series.Metadata.Genres.Remove(existing);
+ isModified = true;
+ }
+ }
+
+ // At this point, all tags that aren't in dto have been removed.
+ foreach (var tagTitle in tags.Select(t => t.Title))
+ {
+ var normalizedTitle = tagTitle.ToNormalized();
+ var existingTag = allTags.SingleOrDefault(t => t.NormalizedTitle == normalizedTitle);
+ if (existingTag != null)
+ {
+ if (series.Metadata.Genres.All(t => t.NormalizedTitle != normalizedTitle))
+ {
+ handleAdd(existingTag);
+ isModified = true;
+ }
+ }
+ else
+ {
+ // Add new tag
+ handleAdd(new GenreBuilder(tagTitle).Build());
+ isModified = true;
+ }
+ }
+
+ if (isModified)
+ {
+ onModified();
+ }
+ }
}
diff --git a/API/Helpers/NumberHelper.cs b/API/Helpers/NumberHelper.cs
new file mode 100644
index 000000000..b15f7e680
--- /dev/null
+++ b/API/Helpers/NumberHelper.cs
@@ -0,0 +1,7 @@
+namespace API.Helpers;
+
+public static class NumberHelper
+{
+ public static bool IsValidMonth(int number) => number is > 0 and <= 12;
+ public static bool IsValidYear(int number) => number is >= 1000;
+}
diff --git a/API/Helpers/ParserInfoHelpers.cs b/API/Helpers/ParserInfoHelpers.cs
index c303fd2fb..dbd2f57da 100644
--- a/API/Helpers/ParserInfoHelpers.cs
+++ b/API/Helpers/ParserInfoHelpers.cs
@@ -1,8 +1,9 @@
using System.Collections.Generic;
using API.Entities;
using API.Entities.Enums;
-using API.Parser;
+using API.Extensions;
using API.Services.Tasks.Scanner;
+using API.Services.Tasks.Scanner.Parser;
namespace API.Helpers;
@@ -22,14 +23,13 @@ public static class ParserInfoHelpers
foreach (var pSeries in parsedSeries.Keys)
{
var name = pSeries.Name;
- var normalizedName = Services.Tasks.Scanner.Parser.Parser.Normalize(name);
+ var normalizedName = name.ToNormalized();
- //if (series.NameInParserInfo(pSeries.))
if (normalizedName == series.NormalizedName ||
- normalizedName == Services.Tasks.Scanner.Parser.Parser.Normalize(series.Name) ||
+ normalizedName == series.Name.ToNormalized() ||
name == series.Name || name == series.LocalizedName ||
name == series.OriginalName ||
- normalizedName == Services.Tasks.Scanner.Parser.Parser.Normalize(series.OriginalName))
+ normalizedName == series.OriginalName?.ToNormalized())
{
format = pSeries.Format;
if (format == series.Format)
diff --git a/API/Helpers/PersonHelper.cs b/API/Helpers/PersonHelper.cs
index adcdd4b08..ff73c6a74 100644
--- a/API/Helpers/PersonHelper.cs
+++ b/API/Helpers/PersonHelper.cs
@@ -1,10 +1,11 @@
using System;
-using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
-using API.Data;
+using API.DTOs;
using API.Entities;
using API.Entities.Enums;
+using API.Extensions;
+using API.Helpers.Builders;
namespace API.Helpers;
@@ -22,16 +23,17 @@ public static class PersonHelper
/// <param name="action"></param>
public static void UpdatePeople(ICollection<Person> allPeople, IEnumerable<string> names, PersonRole role, Action<Person> action)
{
+ // TODO: Validate if we need this, not used
var allPeopleTypeRole = allPeople.Where(p => p.Role == role).ToList();
foreach (var name in names)
{
- var normalizedName = Services.Tasks.Scanner.Parser.Parser.Normalize(name);
+ var normalizedName = name.ToNormalized();
var person = allPeopleTypeRole.FirstOrDefault(p =>
- p.NormalizedName.Equals(normalizedName));
+ p.NormalizedName != null && p.NormalizedName.Equals(normalizedName));
if (person == null)
{
- person = DbFactory.Person(name, role);
+ person = new PersonBuilder(name, role).Build();
allPeople.Add(person);
}
@@ -47,7 +49,7 @@ public static class PersonHelper
/// <param name="people">People from metadata</param>
/// <param name="role">Role to filter on</param>
/// <param name="action">Callback which will be executed for each person removed</param>
- public static void RemovePeople(ICollection<Person> existingPeople, IEnumerable<string> people, PersonRole role, Action<Person> action = null)
+ public static void RemovePeople(ICollection<Person> existingPeople, IEnumerable<string> people, PersonRole role, Action<Person>? action = null)
{
var normalizedPeople = people.Select(Services.Tasks.Scanner.Parser.Parser.Normalize).ToList();
if (normalizedPeople.Count == 0)
@@ -78,7 +80,7 @@ public static class PersonHelper
/// <param name="existingPeople"></param>
/// <param name="removeAllExcept"></param>
/// <param name="action">Callback for all entities that should be removed</param>
- public static void KeepOnlySamePeopleBetweenLists(IEnumerable<Person> existingPeople, ICollection<Person> removeAllExcept, Action<Person> action = null)
+ public static void KeepOnlySamePeopleBetweenLists(IEnumerable<Person> existingPeople, ICollection<Person> removeAllExcept, Action<Person>? action = null)
{
foreach (var person in existingPeople)
{
@@ -98,26 +100,66 @@ public static class PersonHelper
/// <param name="person"></param>
public static void AddPersonIfNotExists(ICollection<Person> metadataPeople, Person person)
{
- var existingPerson = metadataPeople.SingleOrDefault(p =>
- p.NormalizedName == Services.Tasks.Scanner.Parser.Parser.Normalize(person.Name) && p.Role == person.Role);
+ if (string.IsNullOrEmpty(person.Name)) return;
+ var existingPerson = metadataPeople.FirstOrDefault(p =>
+ p.NormalizedName == person.Name.ToNormalized() && p.Role == person.Role);
+
if (existingPerson == null)
{
metadataPeople.Add(person);
}
}
+
/// <summary>
- /// Adds the person to the list if it's not already in there
+ /// For a given role and people dtos, update a series
/// </summary>
- /// <param name="metadataPeople"></param>
- /// <param name="person"></param>
- public static void AddPersonIfNotExists(BlockingCollection<Person> metadataPeople, Person person)
+ /// <param name="role"></param>
+ /// <param name="tags"></param>
+ /// <param name="series"></param>
+ /// <param name="allTags"></param>
+ /// <param name="handleAdd">This will call with an existing or new tag, but the method does not update the series Metadata</param>
+ /// <param name="onModified"></param>
+ public static void UpdatePeopleList(PersonRole role, ICollection<PersonDto>? tags, Series series, IReadOnlyCollection<Person> allTags,
+ Action<Person> handleAdd, Action onModified)
{
- var existingPerson = metadataPeople.SingleOrDefault(p =>
- p.NormalizedName == Services.Tasks.Scanner.Parser.Parser.Normalize(person.Name) && p.Role == person.Role);
- if (existingPerson == null)
+ if (tags == null) return;
+ var isModified = false;
+ // I want a union of these 2 lists. Return only elements that are in both lists, but the list types are different
+ var existingTags = series.Metadata.People.Where(p => p.Role == role).ToList();
+ foreach (var existing in existingTags)
{
- metadataPeople.Add(person);
+ if (tags.SingleOrDefault(t => t.Id == existing.Id) == null) // This needs to check against role
+ {
+ // Remove tag
+ series.Metadata.People.Remove(existing);
+ isModified = true;
+ }
+ }
+
+ // At this point, all tags that aren't in dto have been removed.
+ foreach (var tag in tags)
+ {
+ var existingTag = allTags.SingleOrDefault(t => t.Name == tag.Name && t.Role == tag.Role);
+ if (existingTag != null)
+ {
+ if (series.Metadata.People.Where(t => t.Role == tag.Role).All(t => t.Name != null && !t.Name.Equals(tag.Name)))
+ {
+ handleAdd(existingTag);
+ isModified = true;
+ }
+ }
+ else
+ {
+ // Add new tag
+ handleAdd(new PersonBuilder(tag.Name, role).Build());
+ isModified = true;
+ }
+ }
+
+ if (isModified)
+ {
+ onModified();
}
}
}
diff --git a/API/Helpers/ReadingListHelper.cs b/API/Helpers/ReadingListHelper.cs
new file mode 100644
index 000000000..5f282702b
--- /dev/null
+++ b/API/Helpers/ReadingListHelper.cs
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/API/Helpers/SQLHelper.cs b/API/Helpers/SQLHelper.cs
index dd56a288b..575ba8c77 100644
--- a/API/Helpers/SQLHelper.cs
+++ b/API/Helpers/SQLHelper.cs
@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
-using API.DTOs;
using Microsoft.EntityFrameworkCore;
namespace API.Helpers;
diff --git a/API/Helpers/SeriesHelper.cs b/API/Helpers/SeriesHelper.cs
index b30969805..2b520fb7e 100644
--- a/API/Helpers/SeriesHelper.cs
+++ b/API/Helpers/SeriesHelper.cs
@@ -2,6 +2,7 @@
using System.Linq;
using API.Entities;
using API.Entities.Enums;
+using API.Extensions;
using API.Services.Tasks.Scanner;
namespace API.Helpers;
@@ -16,9 +17,10 @@ public static class SeriesHelper
/// <returns></returns>
public static bool FindSeries(Series series, ParsedSeries parsedInfoKey)
{
- return (series.NormalizedName.Equals(parsedInfoKey.NormalizedName) ||
- Services.Tasks.Scanner.Parser.Parser.Normalize(series.LocalizedName).Equals(parsedInfoKey.NormalizedName) ||
- Services.Tasks.Scanner.Parser.Parser.Normalize(series.OriginalName).Equals(parsedInfoKey.NormalizedName))
+ return (series.NormalizedName.Equals(parsedInfoKey.NormalizedName)
+ || (series.LocalizedName != null && series.LocalizedName.ToNormalized().Equals(parsedInfoKey.NormalizedName))
+ || (series.OriginalName != null && series.OriginalName.ToNormalized().Equals(parsedInfoKey.NormalizedName))
+ )
&& (series.Format == parsedInfoKey.Format || series.Format == MangaFormat.Unknown);
}
diff --git a/API/Helpers/TagHelper.cs b/API/Helpers/TagHelper.cs
index 4844f9587..f976ea608 100644
--- a/API/Helpers/TagHelper.cs
+++ b/API/Helpers/TagHelper.cs
@@ -3,7 +3,10 @@ using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using API.Data;
+using API.DTOs.Metadata;
using API.Entities;
+using API.Extensions;
+using API.Helpers.Builders;
namespace API.Helpers;
@@ -22,14 +25,14 @@ public static class TagHelper
if (string.IsNullOrEmpty(name.Trim())) continue;
var added = false;
- var normalizedName = Services.Tasks.Scanner.Parser.Parser.Normalize(name);
+ var normalizedName = name.ToNormalized();
var genre = allTags.FirstOrDefault(p =>
p.NormalizedTitle.Equals(normalizedName));
if (genre == null)
{
added = true;
- genre = DbFactory.Tag(name);
+ genre = new TagBuilder(name).Build();
allTags.Add(genre);
}
@@ -37,7 +40,7 @@ public static class TagHelper
}
}
- public static void KeepOnlySameTagBetweenLists(ICollection<Tag> existingTags, ICollection<Tag> removeAllExcept, Action<Tag> action = null)
+ public static void KeepOnlySameTagBetweenLists(ICollection<Tag> existingTags, ICollection<Tag> removeAllExcept, Action<Tag>? action = null)
{
var existing = existingTags.ToList();
foreach (var genre in existing)
@@ -58,7 +61,7 @@ public static class TagHelper
public static void AddTagIfNotExists(ICollection<Tag> metadataTags, Tag tag)
{
var existingGenre = metadataTags.FirstOrDefault(p =>
- p.NormalizedTitle == Services.Tasks.Scanner.Parser.Parser.Normalize(tag.Title));
+ p.NormalizedTitle == tag.Title.ToNormalized());
if (existingGenre == null)
{
metadataTags.Add(tag);
@@ -68,7 +71,7 @@ public static class TagHelper
public static void AddTagIfNotExists(BlockingCollection<Tag> metadataTags, Tag tag)
{
var existingGenre = metadataTags.FirstOrDefault(p =>
- p.NormalizedTitle == Services.Tasks.Scanner.Parser.Parser.Normalize(tag.Title));
+ p.NormalizedTitle == tag.Title.ToNormalized());
if (existingGenre == null)
{
metadataTags.Add(tag);
@@ -81,9 +84,8 @@ public static class TagHelper
/// <remarks>Used to remove before we update/add new tags</remarks>
/// <param name="existingTags">Existing tags on Entity</param>
/// <param name="tags">Tags from metadata</param>
- /// <param name="isExternal">Remove external tags?</param>
/// <param name="action">Callback which will be executed for each tag removed</param>
- public static void RemoveTags(ICollection<Tag> existingTags, IEnumerable<string> tags, Action<Tag> action = null)
+ public static void RemoveTags(ICollection<Tag> existingTags, IEnumerable<string> tags, Action<Tag>? action = null)
{
var normalizedTags = tags.Select(Services.Tasks.Scanner.Parser.Parser.Normalize).ToList();
foreach (var person in normalizedTags)
@@ -96,5 +98,47 @@ public static class TagHelper
}
}
+
+ public static void UpdateTagList(ICollection<TagDto>? tags, Series series, IReadOnlyCollection<Tag> allTags, Action<Tag> handleAdd, Action onModified)
+ {
+ if (tags == null) return;
+
+ var isModified = false;
+ // I want a union of these 2 lists. Return only elements that are in both lists, but the list types are different
+ var existingTags = series.Metadata.Tags.ToList();
+ foreach (var existing in existingTags.Where(existing => tags.SingleOrDefault(t => t.Id == existing.Id) == null))
+ {
+ // Remove tag
+ series.Metadata.Tags.Remove(existing);
+ isModified = true;
+ }
+
+ // At this point, all tags that aren't in dto have been removed.
+ foreach (var tagTitle in tags.Select(t => t.Title))
+ {
+ var normalizedTitle = tagTitle.ToNormalized();
+ var existingTag = allTags.SingleOrDefault(t => t.NormalizedTitle.Equals(normalizedTitle));
+ if (existingTag != null)
+ {
+ if (series.Metadata.Tags.All(t => t.NormalizedTitle != normalizedTitle))
+ {
+
+ handleAdd(existingTag);
+ isModified = true;
+ }
+ }
+ else
+ {
+ // Add new tag
+ handleAdd(new TagBuilder(tagTitle).Build());
+ isModified = true;
+ }
+ }
+
+ if (isModified)
+ {
+ onModified();
+ }
+ }
}
diff --git a/API/Logging/LogLevelOptions.cs b/API/Logging/LogLevelOptions.cs
index dc927f5e9..cae3f00a1 100644
--- a/API/Logging/LogLevelOptions.cs
+++ b/API/Logging/LogLevelOptions.cs
@@ -1,13 +1,7 @@
-using System;
-using System.IO;
-using System.Net;
-using API.Services;
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Configuration;
-using Serilog;
+using Serilog;
using Serilog.Core;
using Serilog.Events;
+using Serilog.Filters;
using Serilog.Formatting.Display;
namespace API.Logging;
@@ -64,7 +58,7 @@ public static class LogLevelOptions
.Filter.ByIncludingOnly(ShouldIncludeLogStatement);
}
- private static bool ShouldIncludeLogStatement(LogEvent e)
+ private static bool ShouldIncludeLogStatement(LogEvent e)
{
var isRequestLoggingMiddleware = e.Properties.ContainsKey("SourceContext") &&
e.Properties["SourceContext"].ToString().Replace("\"", string.Empty) ==
diff --git a/API/Middleware/ExceptionMiddleware.cs b/API/Middleware/ExceptionMiddleware.cs
index 81238d7a3..98c3c6aec 100644
--- a/API/Middleware/ExceptionMiddleware.cs
+++ b/API/Middleware/ExceptionMiddleware.cs
@@ -13,14 +13,12 @@ public class ExceptionMiddleware
{
private readonly RequestDelegate _next;
private readonly ILogger<ExceptionMiddleware> _logger;
- private readonly IHostEnvironment _env;
- public ExceptionMiddleware(RequestDelegate next, ILogger<ExceptionMiddleware> logger, IHostEnvironment env)
+ public ExceptionMiddleware(RequestDelegate next, ILogger<ExceptionMiddleware> logger)
{
_next = next;
_logger = logger;
- _env = env;
}
public async Task InvokeAsync(HttpContext context)
diff --git a/API/Middleware/RateLimit/AuthenticationRateLimiterPolicy.cs b/API/Middleware/RateLimit/AuthenticationRateLimiterPolicy.cs
new file mode 100644
index 000000000..f7732b7bd
--- /dev/null
+++ b/API/Middleware/RateLimit/AuthenticationRateLimiterPolicy.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Globalization;
+using System.Threading;
+using System.Threading.RateLimiting;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.RateLimiting;
+
+namespace API.Middleware.RateLimit;
+
+public class AuthenticationRateLimiterPolicy : IRateLimiterPolicy<string>
+{
+ public RateLimitPartition<string> GetPartition(HttpContext httpContext)
+ {
+ return RateLimitPartition.GetFixedWindowLimiter(httpContext.Request.Headers.Host.ToString(),
+ partition => new FixedWindowRateLimiterOptions
+ {
+ AutoReplenishment = true,
+ PermitLimit = 1,
+ Window = TimeSpan.FromMinutes(10),
+ });
+ }
+
+ public Func<OnRejectedContext, CancellationToken, ValueTask>? OnRejected { get; } =
+ (context, _) =>
+ {
+ if (context.Lease.TryGetMetadata(MetadataName.RetryAfter, out var retryAfter))
+ {
+ context.HttpContext.Response.Headers.RetryAfter =
+ ((int) retryAfter.TotalSeconds).ToString(NumberFormatInfo.InvariantInfo);
+ }
+
+ context.HttpContext.Response.StatusCode = StatusCodes.Status429TooManyRequests;
+ return new ValueTask();
+ };
+}
diff --git a/API/Program.cs b/API/Program.cs
index 8ecc83d27..446f04fd0 100644
--- a/API/Program.cs
+++ b/API/Program.cs
@@ -1,5 +1,4 @@
-using System;
-using System.IO;
+using System;
using System.IO.Abstractions;
using System.Linq;
using System.Security.Cryptography;
@@ -43,7 +42,8 @@ public class Program
.Information()
.CreateBootstrapLogger();
- var directoryService = new DirectoryService(null, new FileSystem());
+ var directoryService = new DirectoryService(null!, new FileSystem());
+
// Before anything, check if JWT has been generated properly or if user still has default
if (!Configuration.CheckIfJwtTokenSet() &&
Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") != Environments.Development)
@@ -126,7 +126,7 @@ public class Program
private static async Task<string> GetMigrationDirectory(DataContext context, IDirectoryService directoryService)
{
- string currentVersion = null;
+ string? currentVersion = null;
try
{
if (!await context.ServerSetting.AnyAsync()) return "vUnknown";
@@ -173,30 +173,30 @@ public class Program
webBuilder.UseKestrel((opts) =>
{
var ipAddresses = Configuration.IpAddresses;
- if (string.IsNullOrEmpty(ipAddresses))
+ if (new OsInfo(Array.Empty<IOsVersionAdapter>()).IsDocker || string.IsNullOrEmpty(ipAddresses) || ipAddresses.Equals(Configuration.DefaultIpAddresses))
{
opts.ListenAnyIP(HttpPort, options => { options.Protocols = HttpProtocols.Http1AndHttp2; });
}
else
{
- foreach(var ipAddress in ipAddresses.Split(','))
+ foreach (var ipAddress in ipAddresses.Split(','))
{
- try {
+ try
+ {
var address = System.Net.IPAddress.Parse(ipAddress.Trim());
opts.Listen(address, HttpPort, options => { options.Protocols = HttpProtocols.Http1AndHttp2; });
}
- catch(Exception ex)
+ catch (Exception ex)
{
- Log.Fatal(ex, "Could not parse ip addess '{0}'", ipAddress);
+ Log.Fatal(ex, "Could not parse ip address {IPAddress}", ipAddress);
}
}
}
});
- webBuilder.UseStartup<Startup>();
+ webBuilder.UseStartup<Startup>();
});
-
}
diff --git a/API/Services/AccountService.cs b/API/Services/AccountService.cs
index 28ac98cf3..17f5e8110 100644
--- a/API/Services/AccountService.cs
+++ b/API/Services/AccountService.cs
@@ -7,6 +7,7 @@ using API.Constants;
using API.Data;
using API.Entities;
using API.Errors;
+using Kavita.Common;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
@@ -21,8 +22,9 @@ public interface IAccountService
Task<IEnumerable<ApiException>> ValidatePassword(AppUser user, string password);
Task<IEnumerable<ApiException>> ValidateUsername(string username);
Task<IEnumerable<ApiException>> ValidateEmail(string email);
- Task<bool> HasBookmarkPermission(AppUser user);
- Task<bool> HasDownloadPermission(AppUser user);
+ Task<bool> HasBookmarkPermission(AppUser? user);
+ Task<bool> HasDownloadPermission(AppUser? user);
+ Task<bool> HasChangeRestrictionRole(AppUser? user);
Task<bool> CheckIfAccessible(HttpRequest request);
Task<string> GenerateEmailLink(HttpRequest request, string token, string routePart, string email, bool withHost = true);
}
@@ -66,6 +68,10 @@ public class AccountService : IAccountService
if (!string.IsNullOrEmpty(serverSettings.HostName))
{
basePart = serverSettings.HostName;
+ if (!serverSettings.BaseUrl.Equals(Configuration.DefaultBaseUrl))
+ {
+ basePart += serverSettings.BaseUrl.Substring(0, serverSettings.BaseUrl.Length - 1);
+ }
}
if (withHost) return $"{basePart}/registration/{routePart}?token={HttpUtility.UrlEncode(token)}&email={HttpUtility.UrlEncode(email)}";
@@ -137,8 +143,9 @@ public class AccountService : IAccountService
/// </summary>
/// <param name="user"></param>
/// <returns></returns>
- public async Task<bool> HasBookmarkPermission(AppUser user)
+ public async Task<bool> HasBookmarkPermission(AppUser? user)
{
+ if (user == null) return false;
var roles = await _userManager.GetRolesAsync(user);
return roles.Contains(PolicyConstants.BookmarkRole) || roles.Contains(PolicyConstants.AdminRole);
}
@@ -148,8 +155,9 @@ public class AccountService : IAccountService
/// </summary>
/// <param name="user"></param>
/// <returns></returns>
- public async Task<bool> HasDownloadPermission(AppUser user)
+ public async Task<bool> HasDownloadPermission(AppUser? user)
{
+ if (user == null) return false;
var roles = await _userManager.GetRolesAsync(user);
return roles.Contains(PolicyConstants.DownloadRole) || roles.Contains(PolicyConstants.AdminRole);
}
@@ -159,8 +167,9 @@ public class AccountService : IAccountService
/// </summary>
/// <param name="user"></param>
/// <returns></returns>
- public async Task<bool> HasChangeRestrictionRole(AppUser user)
+ public async Task<bool> HasChangeRestrictionRole(AppUser? user)
{
+ if (user == null) return false;
var roles = await _userManager.GetRolesAsync(user);
return roles.Contains(PolicyConstants.ChangePasswordRole) || roles.Contains(PolicyConstants.AdminRole);
}
diff --git a/API/Services/ArchiveService.cs b/API/Services/ArchiveService.cs
index 751f9a303..d07e6e9a4 100644
--- a/API/Services/ArchiveService.cs
+++ b/API/Services/ArchiveService.cs
@@ -22,7 +22,7 @@ public interface IArchiveService
int GetNumberOfPagesFromArchive(string archivePath);
string GetCoverImage(string archivePath, string fileName, string outputDirectory, bool saveAsWebP = false);
bool IsValidArchive(string archivePath);
- ComicInfo GetComicInfo(string archivePath);
+ ComicInfo? GetComicInfo(string archivePath);
ArchiveLibrary CanOpen(string archivePath);
bool ArchiveNeedsFlattening(ZipArchive archive);
/// <summary>
@@ -129,7 +129,7 @@ public class ArchiveService : IArchiveService
/// </summary>
/// <param name="entryFullNames"></param>
/// <returns>Entry name of match, null if no match</returns>
- public static string FindFolderEntry(IEnumerable<string> entryFullNames)
+ public static string? FindFolderEntry(IEnumerable<string> entryFullNames)
{
var result = entryFullNames
.Where(path => !(Path.EndsInDirectorySeparator(path) || Tasks.Scanner.Parser.Parser.HasBlacklistedFolderInPath(path) || path.StartsWith(Tasks.Scanner.Parser.Parser.MacOsMetadataFileStartsWith)))
@@ -163,7 +163,7 @@ public class ArchiveService : IArchiveService
// Check the first folder and sort within that to see if we can find a file, else fallback to first file with basic sort.
// Get first folder, then sort within that
- var firstDirectoryFile = fullNames.OrderByNatural(Path.GetDirectoryName).FirstOrDefault();
+ var firstDirectoryFile = fullNames.OrderByNatural(Path.GetDirectoryName!).FirstOrDefault();
if (!string.IsNullOrEmpty(firstDirectoryFile))
{
var firstDirectory = Path.GetDirectoryName(firstDirectoryFile);
@@ -249,7 +249,7 @@ public class ArchiveService : IArchiveService
/// <param name="archivePath"></param>
/// <param name="entryNames"></param>
/// <returns></returns>
- public static string FindCoverImageFilename(string archivePath, IEnumerable<string> entryNames)
+ public static string? FindCoverImageFilename(string archivePath, IEnumerable<string> entryNames)
{
var entryName = FindFolderEntry(entryNames) ?? FirstFileEntry(entryNames, Path.GetFileName(archivePath));
return entryName;
@@ -281,7 +281,7 @@ public class ArchiveService : IArchiveService
var dateString = DateTime.UtcNow.ToShortDateString().Replace("/", "_");
var tempLocation = Path.Join(_directoryService.TempDirectory, $"{tempFolder}_{dateString}");
- var potentialExistingFile = _directoryService.FileSystem.FileInfo.FromFileName(Path.Join(_directoryService.TempDirectory, $"kavita_{tempFolder}_{dateString}.zip"));
+ var potentialExistingFile = _directoryService.FileSystem.FileInfo.New(Path.Join(_directoryService.TempDirectory, $"kavita_{tempFolder}_{dateString}.zip"));
if (potentialExistingFile.Exists)
{
// A previous download exists, just return it immediately
@@ -331,8 +331,9 @@ public class ArchiveService : IArchiveService
return false;
}
- private static bool IsComicInfoArchiveEntry(string fullName, string name)
+ private static bool IsComicInfoArchiveEntry(string? fullName, string name)
{
+ if (fullName == null) return false;
return !Tasks.Scanner.Parser.Parser.HasBlacklistedFolderInPath(fullName)
&& name.EndsWith(ComicInfoFilename, StringComparison.OrdinalIgnoreCase)
&& !name.StartsWith(Tasks.Scanner.Parser.Parser.MacOsMetadataFileStartsWith);
@@ -364,7 +365,7 @@ public class ArchiveService : IArchiveService
{
using var stream = entry.Open();
var serializer = new XmlSerializer(typeof(ComicInfo));
- var info = (ComicInfo) serializer.Deserialize(stream);
+ var info = (ComicInfo?) serializer.Deserialize(stream);
ComicInfo.CleanComicInfo(info);
return info;
}
@@ -382,7 +383,7 @@ public class ArchiveService : IArchiveService
{
using var stream = entry.OpenEntryStream();
var serializer = new XmlSerializer(typeof(ComicInfo));
- var info = (ComicInfo) serializer.Deserialize(stream);
+ var info = (ComicInfo?) serializer.Deserialize(stream);
ComicInfo.CleanComicInfo(info);
return info;
}
diff --git a/API/Services/BookService.cs b/API/Services/BookService.cs
index 29c038b99..58bd80793 100644
--- a/API/Services/BookService.cs
+++ b/API/Services/BookService.cs
@@ -11,7 +11,7 @@ using API.Data.Metadata;
using API.DTOs.Reader;
using API.Entities;
using API.Entities.Enums;
-using API.Parser;
+using API.Services.Tasks.Scanner.Parser;
using Docnet.Core;
using Docnet.Core.Converters;
using Docnet.Core.Models;
@@ -25,7 +25,6 @@ using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;
using VersOne.Epub;
using VersOne.Epub.Options;
-using Image = SixLabors.ImageSharp.Image;
namespace API.Services;
@@ -33,8 +32,17 @@ public interface IBookService
{
int GetNumberOfPages(string filePath);
string GetCoverImage(string fileFilePath, string fileName, string outputDirectory, bool saveAsWebP = false);
- ComicInfo GetComicInfo(string filePath);
- ParserInfo ParseInfo(string filePath);
+ ComicInfo? GetComicInfo(string filePath);
+ ParserInfo? ParseInfo(string filePath);
+ /// <summary>
+ /// Scopes styles to .reading-section and replaces img src to the passed apiBase
+ /// </summary>
+ /// <param name="stylesheetHtml"></param>
+ /// <param name="apiBase"></param>
+ /// <param name="filename">If the stylesheetHtml contains Import statements, when scoping the filename, scope needs to be wrt filepath.</param>
+ /// <param name="book">Book Reference, needed for if you expect Import statements</param>
+ /// <returns></returns>
+ Task<string> ScopeStyles(string stylesheetHtml, string apiBase, string filename, EpubBookRef book);
/// <summary>
/// Extracts a PDF file's pages as images to an target directory
/// </summary>
@@ -58,7 +66,7 @@ public class BookService : IBookService
private const string BookApiUrl = "book-resources?file=";
public static readonly EpubReaderOptions BookReaderOptions = new()
{
- PackageReaderOptions = new PackageReaderOptions()
+ PackageReaderOptions = new PackageReaderOptions
{
IgnoreMissingToc = true
}
@@ -163,7 +171,8 @@ public class BookService : IBookService
// @Import statements will be handled by browser, so we must inline the css into the original file that request it, so they can be Scoped
var prepend = filename.Length > 0 ? filename.Replace(Path.GetFileName(filename), string.Empty) : string.Empty;
var importBuilder = new StringBuilder();
- foreach (Match match in Tasks.Scanner.Parser.Parser.CssImportUrlRegex.Matches(stylesheetHtml))
+ //foreach (Match match in Tasks.Scanner.Parser.Parser.CssImportUrlRegex().Matches(stylesheetHtml))
+ foreach (Match match in Parser.CssImportUrlRegex.Matches(stylesheetHtml))
{
if (!match.Success) continue;
@@ -200,7 +209,7 @@ public class BookService : IBookService
foreach (var styleRule in stylesheet.StyleRules)
{
if (styleRule.Selector.Text == CssScopeClass) continue;
- if (styleRule.Selector.Text.Contains(","))
+ if (styleRule.Selector.Text.Contains(','))
{
styleRule.Text = styleRule.Text.Replace(styleRule.SelectorText,
string.Join(", ",
@@ -214,7 +223,8 @@ public class BookService : IBookService
private static void EscapeCssImportReferences(ref string stylesheetHtml, string apiBase, string prepend)
{
- foreach (Match match in Tasks.Scanner.Parser.Parser.CssImportUrlRegex.Matches(stylesheetHtml))
+ //foreach (Match match in Tasks.Scanner.Parser.Parser.CssImportUrlRegex().Matches(stylesheetHtml))
+ foreach (Match match in Parser.CssImportUrlRegex.Matches(stylesheetHtml))
{
if (!match.Success) continue;
var importFile = match.Groups["Filename"].Value;
@@ -224,7 +234,8 @@ public class BookService : IBookService
private static void EscapeFontFamilyReferences(ref string stylesheetHtml, string apiBase, string prepend)
{
- foreach (Match match in Tasks.Scanner.Parser.Parser.FontSrcUrlRegex.Matches(stylesheetHtml))
+ //foreach (Match match in Tasks.Scanner.Parser.Parser.FontSrcUrlRegex().Matches(stylesheetHtml))
+ foreach (Match match in Parser.FontSrcUrlRegex.Matches(stylesheetHtml))
{
if (!match.Success) continue;
var importFile = match.Groups["Filename"].Value;
@@ -234,7 +245,8 @@ public class BookService : IBookService
private static void EscapeCssImageReferences(ref string stylesheetHtml, string apiBase, EpubBookRef book)
{
- var matches = Tasks.Scanner.Parser.Parser.CssImageUrlRegex.Matches(stylesheetHtml);
+ //var matches = Tasks.Scanner.Parser.Parser.CssImageUrlRegex().Matches(stylesheetHtml);
+ var matches = Parser.CssImageUrlRegex.Matches(stylesheetHtml);
foreach (Match match in matches)
{
if (!match.Success) continue;
@@ -254,13 +266,12 @@ public class BookService : IBookService
if (images == null) return;
-
var parent = images.First().ParentNode;
foreach (var image in images)
{
- string key = null;
+ string? key = null;
if (image.Attributes["src"] != null)
{
key = "src";
@@ -388,9 +399,9 @@ public class BookService : IBookService
}
}
- public ComicInfo GetComicInfo(string filePath)
+ public ComicInfo? GetComicInfo(string filePath)
{
- if (!IsValidFile(filePath) || Tasks.Scanner.Parser.Parser.IsPdf(filePath)) return null;
+ if (!IsValidFile(filePath) || Parser.IsPdf(filePath)) return null;
try
{
@@ -404,10 +415,10 @@ public class BookService : IBookService
}
var (year, month, day) = GetPublicationDate(publicationDate);
- var info = new ComicInfo()
+ var info = new ComicInfo
{
Summary = epubBook.Schema.Package.Metadata.Description,
- Writer = string.Join(",", epubBook.Schema.Package.Metadata.Creators.Select(c => Tasks.Scanner.Parser.Parser.CleanAuthor(c.Creator))),
+ Writer = string.Join(",", epubBook.Schema.Package.Metadata.Creators.Select(c => Parser.CleanAuthor(c.Creator))),
Publisher = string.Join(",", epubBook.Schema.Package.Metadata.Publishers),
Month = month,
Day = day,
@@ -421,6 +432,7 @@ public class BookService : IBookService
// Parse tags not exposed via Library
foreach (var metadataItem in epubBook.Schema.Package.Metadata.MetaItems)
{
+ // EPUB 2 and 3
switch (metadataItem.Name)
{
case "calibre:rating":
@@ -437,16 +449,31 @@ public class BookService : IBookService
info.Volume = metadataItem.Content;
break;
}
+
+ // EPUB 3.2+ only
+ switch (metadataItem.Property)
+ {
+ case "group-position":
+ info.Volume = metadataItem.Content;
+ break;
+ case "belongs-to-collection":
+ info.Series = metadataItem.Content;
+ info.SeriesSort = metadataItem.Content;
+ break;
+ case "collection-type":
+ // These look to be genres from https://manual.calibre-ebook.com/sub_groups.html or can be "series"
+ break;
+ }
}
- var hasVolumeInSeries = !Tasks.Scanner.Parser.Parser.ParseVolume(info.Title)
- .Equals(Tasks.Scanner.Parser.Parser.DefaultVolume);
+ var hasVolumeInSeries = !Parser.ParseVolume(info.Title)
+ .Equals(Parser.DefaultVolume);
if (string.IsNullOrEmpty(info.Volume) && hasVolumeInSeries && (!info.Series.Equals(info.Title) || string.IsNullOrEmpty(info.Series)))
{
// This is likely a light novel for which we can set series from parsed title
- info.Series = Tasks.Scanner.Parser.Parser.ParseSeries(info.Title);
- info.Volume = Tasks.Scanner.Parser.Parser.ParseVolume(info.Title);
+ info.Series = Parser.ParseSeries(info.Title);
+ info.Volume = Parser.ParseVolume(info.Title);
}
return info;
@@ -480,23 +507,19 @@ public class BookService : IBookService
return (year, month, day);
}
-#nullable enable
private static string ValidateLanguage(string? language)
{
if (string.IsNullOrEmpty(language)) return string.Empty;
try
{
- CultureInfo.GetCultureInfo(language);
+ return CultureInfo.GetCultureInfo(language).ToString();
}
catch (Exception)
{
return string.Empty;
}
-
- return language;
}
- #nullable disable
private bool IsValidFile(string filePath)
{
@@ -506,7 +529,7 @@ public class BookService : IBookService
return false;
}
- if (Tasks.Scanner.Parser.Parser.IsBook(filePath)) return true;
+ if (Parser.IsBook(filePath)) return true;
_logger.LogWarning("[BookService] Book {EpubFile} is not a valid EPUB/PDF", filePath);
return false;
@@ -518,14 +541,14 @@ public class BookService : IBookService
try
{
- if (Tasks.Scanner.Parser.Parser.IsPdf(filePath))
+ if (Parser.IsPdf(filePath))
{
using var docReader = DocLib.Instance.GetDocReader(filePath, new PageDimensions(1080, 1920));
return docReader.GetPageCount();
}
using var epubBook = EpubReader.OpenBook(filePath, BookReaderOptions);
- return epubBook.Content.Html.Count;
+ return epubBook.GetReadingOrder().Count;
}
catch (Exception ex)
{
@@ -537,8 +560,10 @@ public class BookService : IBookService
private static string EscapeTags(string content)
{
- content = Regex.Replace(content, @"<script(.*)(/>)", "<script$1></script>", RegexOptions.None, Tasks.Scanner.Parser.Parser.RegexTimeout);
- content = Regex.Replace(content, @"<title(.*)(/>)", "<title$1></title>", RegexOptions.None, Tasks.Scanner.Parser.Parser.RegexTimeout);
+ // content = StartingScriptTag().Replace(content, "<script$1></script>");
+ // content = StartingTitleTag().Replace(content, "<title$1></title>");
+ content = Regex.Replace(content, @"<script(.*)(/>)", "<script$1></script>", RegexOptions.None, Parser.RegexTimeout);
+ content = Regex.Replace(content, @"<title(.*)(/>)", "<title$1></title>", RegexOptions.None, Parser.RegexTimeout);
return content;
}
@@ -572,9 +597,9 @@ public class BookService : IBookService
/// </summary>
/// <param name="filePath"></param>
/// <returns></returns>
- public ParserInfo ParseInfo(string filePath)
+ public ParserInfo? ParseInfo(string filePath)
{
- if (!Tasks.Scanner.Parser.Parser.IsEpub(filePath)) return null;
+ if (!Parser.IsEpub(filePath)) return null;
try
{
@@ -634,13 +659,13 @@ public class BookService : IBookService
{
specialName = epubBook.Title;
}
- var info = new ParserInfo()
+ var info = new ParserInfo
{
- Chapters = Tasks.Scanner.Parser.Parser.DefaultChapter,
+ Chapters = Parser.DefaultChapter,
Edition = string.Empty,
Format = MangaFormat.Epub,
Filename = Path.GetFileName(filePath),
- Title = specialName?.Trim(),
+ Title = specialName?.Trim() ?? string.Empty,
FullFilePath = filePath,
IsSpecial = false,
Series = series.Trim(),
@@ -656,9 +681,9 @@ public class BookService : IBookService
// Swallow exception
}
- return new ParserInfo()
+ return new ParserInfo
{
- Chapters = Tasks.Scanner.Parser.Parser.DefaultChapter,
+ Chapters = Parser.DefaultChapter,
Edition = string.Empty,
Format = MangaFormat.Epub,
Filename = Path.GetFileName(filePath),
@@ -666,7 +691,7 @@ public class BookService : IBookService
FullFilePath = filePath,
IsSpecial = false,
Series = epubBook.Title.Trim(),
- Volumes = Tasks.Scanner.Parser.Parser.DefaultVolume,
+ Volumes = Parser.DefaultVolume,
};
}
catch (Exception ex)
@@ -786,7 +811,7 @@ public class BookService : IBookService
var key = CoalesceKey(book, mappings, nestedChapter.Link.ContentFileName);
if (mappings.ContainsKey(key))
{
- nestedChapters.Add(new BookChapterItem()
+ nestedChapters.Add(new BookChapterItem
{
Title = nestedChapter.Title,
Page = mappings[key],
@@ -823,7 +848,7 @@ public class BookService : IBookService
{
part = anchor.Attributes["href"].Value.Split("#")[1];
}
- chaptersList.Add(new BookChapterItem()
+ chaptersList.Add(new BookChapterItem
{
Title = anchor.InnerText,
Page = mappings[key],
@@ -903,7 +928,7 @@ public class BookService : IBookService
{
if (navigationItem.Link == null)
{
- var item = new BookChapterItem()
+ var item = new BookChapterItem
{
Title = navigationItem.Title,
Children = nestedChapters
@@ -920,7 +945,7 @@ public class BookService : IBookService
var groupKey = CleanContentKeys(navigationItem.Link.ContentFileName);
if (mappings.ContainsKey(groupKey))
{
- chaptersList.Add(new BookChapterItem()
+ chaptersList.Add(new BookChapterItem
{
Title = navigationItem.Title,
Page = mappings[groupKey],
@@ -943,7 +968,7 @@ public class BookService : IBookService
{
if (!IsValidFile(fileFilePath)) return string.Empty;
- if (Tasks.Scanner.Parser.Parser.IsPdf(fileFilePath))
+ if (Parser.IsPdf(fileFilePath))
{
return GetPdfCoverImage(fileFilePath, fileName, outputDirectory, saveAsWebP);
}
@@ -954,7 +979,7 @@ public class BookService : IBookService
{
// Try to get the cover image from OPF file, if not set, try to parse it from all the files, then result to the first one.
var coverImageContent = epubBook.Content.Cover
- ?? epubBook.Content.Images.Values.FirstOrDefault(file => Tasks.Scanner.Parser.Parser.IsCoverImage(file.FileName))
+ ?? epubBook.Content.Images.Values.FirstOrDefault(file => Parser.IsCoverImage(file.FileName))
?? epubBook.Content.Images.Values.FirstOrDefault();
if (coverImageContent == null) return string.Empty;
@@ -1021,12 +1046,18 @@ public class BookService : IBookService
}
// Remove comments from CSS
- body = Regex.Replace(body, @"/\*[\d\D]*?\*/", string.Empty, RegexOptions.None, Tasks.Scanner.Parser.Parser.RegexTimeout);
-
- body = Regex.Replace(body, @"[a-zA-Z]+#", "#", RegexOptions.None, Tasks.Scanner.Parser.Parser.RegexTimeout);
- body = Regex.Replace(body, @"[\n\r]+\s*", string.Empty, RegexOptions.None, Tasks.Scanner.Parser.Parser.RegexTimeout);
- body = Regex.Replace(body, @"\s+", " ", RegexOptions.None, Tasks.Scanner.Parser.Parser.RegexTimeout);
- body = Regex.Replace(body, @"\s?([:,;{}])\s?", "$1", RegexOptions.None, Tasks.Scanner.Parser.Parser.RegexTimeout);
+ // body = CssComment().Replace(body, string.Empty);
+ //
+ // body = WhiteSpace1().Replace(body, "#");
+ // body = WhiteSpace2().Replace(body, string.Empty);
+ // body = WhiteSpace3().Replace(body, " ");
+ // body = WhiteSpace4().Replace(body, "$1");
+ body = Regex.Replace(body, @"/\*[\d\D]*?\*/", string.Empty, RegexOptions.None, Parser.RegexTimeout);
+
+ body = Regex.Replace(body, @"[a-zA-Z]+#", "#", RegexOptions.None, Parser.RegexTimeout);
+ body = Regex.Replace(body, @"[\n\r]+\s*", string.Empty, RegexOptions.None, Parser.RegexTimeout);
+ body = Regex.Replace(body, @"\s+", " ", RegexOptions.None, Parser.RegexTimeout);
+ body = Regex.Replace(body, @"\s?([:,;{}])\s?", "$1", RegexOptions.None, Parser.RegexTimeout);
try
{
body = body.Replace(";}", "}");
@@ -1036,7 +1067,8 @@ public class BookService : IBookService
//Swallow exception. Some css don't have style rules ending in ';'
}
- body = Regex.Replace(body, @"([\s:]0)(px|pt|%|em)", "$1", RegexOptions.None, Tasks.Scanner.Parser.Parser.RegexTimeout);
+ //body = UnitPadding().Replace(body, "$1");
+ body = Regex.Replace(body, @"([\s:]0)(px|pt|%|em)", "$1", RegexOptions.None, Parser.RegexTimeout);
return body;
diff --git a/API/Services/BookmarkService.cs b/API/Services/BookmarkService.cs
index b79f4923d..c3b450214 100644
--- a/API/Services/BookmarkService.cs
+++ b/API/Services/BookmarkService.cs
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
-using API.Constants;
using API.Data;
using API.DTOs.Reader;
using API.Entities;
@@ -23,8 +22,6 @@ public interface IBookmarkService
[DisableConcurrentExecution(timeoutInSeconds: 2 * 60 * 60), AutomaticRetry(Attempts = 0)]
Task ConvertAllBookmarkToWebP();
Task ConvertAllCoverToWebP();
- Task ConvertBookmarkToWebP(int bookmarkId);
-
}
public class BookmarkService : IBookmarkService
@@ -50,21 +47,23 @@ public class BookmarkService : IBookmarkService
/// Deletes the files associated with the list of Bookmarks passed. Will clean up empty folders.
/// </summary>
/// <param name="bookmarks"></param>
- public async Task DeleteBookmarkFiles(IEnumerable<AppUserBookmark> bookmarks)
+ public async Task DeleteBookmarkFiles(IEnumerable<AppUserBookmark?> bookmarks)
{
var bookmarkDirectory =
(await _unitOfWork.SettingsRepository.GetSettingAsync(ServerSettingKey.BookmarkDirectory)).Value;
- var bookmarkFilesToDelete = bookmarks.Select(b => Tasks.Scanner.Parser.Parser.NormalizePath(
- _directoryService.FileSystem.Path.Join(bookmarkDirectory,
- b.FileName))).ToList();
+ var bookmarkFilesToDelete = bookmarks
+ .Where(b => b != null)
+ .Select(b => Tasks.Scanner.Parser.Parser.NormalizePath(
+ _directoryService.FileSystem.Path.Join(bookmarkDirectory, b!.FileName)))
+ .ToList();
if (bookmarkFilesToDelete.Count == 0) return;
_directoryService.DeleteFiles(bookmarkFilesToDelete);
// Delete any leftover folders
- foreach (var directory in _directoryService.FileSystem.Directory.GetDirectories(bookmarkDirectory, "", SearchOption.AllDirectories))
+ foreach (var directory in _directoryService.FileSystem.Directory.GetDirectories(bookmarkDirectory, string.Empty, SearchOption.AllDirectories))
{
if (_directoryService.FileSystem.Directory.GetFiles(directory, "", SearchOption.AllDirectories).Length == 0 &&
_directoryService.FileSystem.Directory.GetDirectories(directory).Length == 0)
@@ -73,6 +72,32 @@ public class BookmarkService : IBookmarkService
}
}
}
+
+ /// <summary>
+ /// This is a job that runs after a bookmark is saved
+ /// </summary>
+ /// <remarks>This must be public</remarks>
+ public async Task ConvertBookmarkToWebP(int bookmarkId)
+ {
+ var bookmarkDirectory =
+ (await _unitOfWork.SettingsRepository.GetSettingAsync(ServerSettingKey.BookmarkDirectory)).Value;
+ var convertBookmarkToWebP =
+ (await _unitOfWork.SettingsRepository.GetSettingsDtoAsync()).ConvertBookmarkToWebP;
+
+ if (!convertBookmarkToWebP) return;
+
+ // Validate the bookmark still exists
+ var bookmark = await _unitOfWork.UserRepository.GetBookmarkAsync(bookmarkId);
+ if (bookmark == null) return;
+
+ bookmark.FileName = await SaveAsWebP(bookmarkDirectory, bookmark.FileName,
+ BookmarkStem(bookmark.AppUserId, bookmark.SeriesId, bookmark.ChapterId));
+ _unitOfWork.UserRepository.Update(bookmark);
+
+ await _unitOfWork.CommitAsync();
+ }
+
+
/// <summary>
/// Creates a new entry in the AppUserBookmarks and copies an image to BookmarkDirectory.
/// </summary>
@@ -92,7 +117,7 @@ public class BookmarkService : IBookmarkService
return true;
}
- var fileInfo = _directoryService.FileSystem.FileInfo.FromFileName(imageToBookmark);
+ var fileInfo = _directoryService.FileSystem.FileInfo.New(imageToBookmark);
var settings = await _unitOfWork.SettingsRepository.GetSettingsDtoAsync();
var targetFolderStem = BookmarkStem(userWithBookmarks.Id, bookmarkDto.SeriesId, bookmarkDto.ChapterId);
var targetFilepath = Path.Join(settings.BookmarksDirectory, targetFolderStem);
@@ -136,7 +161,6 @@ public class BookmarkService : IBookmarkService
/// <returns></returns>
public async Task<bool> RemoveBookmarkPage(AppUser userWithBookmarks, BookmarkDto bookmarkDto)
{
- if (userWithBookmarks.Bookmarks == null) return true;
var bookmarkToDelete = userWithBookmarks.Bookmarks.SingleOrDefault(x =>
x.ChapterId == bookmarkDto.ChapterId && x.Page == bookmarkDto.Page);
try
@@ -206,53 +230,118 @@ public class BookmarkService : IBookmarkService
[DisableConcurrentExecution(timeoutInSeconds: 2 * 60 * 60), AutomaticRetry(Attempts = 0)]
public async Task ConvertAllCoverToWebP()
{
+ _logger.LogInformation("[BookmarkService] Starting conversion of all covers to webp");
var coverDirectory = _directoryService.CoverImageDirectory;
await _eventHub.SendMessageAsync(MessageFactory.NotificationProgress,
MessageFactory.ConvertCoverProgressEvent(0F, ProgressEventType.Started));
- var chapters = await _unitOfWork.ChapterRepository.GetAllChaptersWithNonWebPCovers();
+ var chapterCovers = await _unitOfWork.ChapterRepository.GetAllChaptersWithNonWebPCovers();
+ var seriesCovers = await _unitOfWork.SeriesRepository.GetAllWithNonWebPCovers();
+
+ var readingListCovers = await _unitOfWork.ReadingListRepository.GetAllWithNonWebPCovers();
+ var libraryCovers = await _unitOfWork.LibraryRepository.GetAllWithNonWebPCovers();
+ var collectionCovers = await _unitOfWork.CollectionTagRepository.GetAllWithNonWebPCovers();
+
+ var totalCount = chapterCovers.Count + seriesCovers.Count + readingListCovers.Count +
+ libraryCovers.Count + collectionCovers.Count;
var count = 1F;
- foreach (var chapter in chapters)
+ _logger.LogInformation("[BookmarkService] Starting conversion of chapters");
+ foreach (var chapter in chapterCovers)
{
+ if (string.IsNullOrEmpty(chapter.CoverImage)) continue;
+
var newFile = await SaveAsWebP(coverDirectory, chapter.CoverImage, coverDirectory);
chapter.CoverImage = Path.GetFileName(newFile);
_unitOfWork.ChapterRepository.Update(chapter);
await _unitOfWork.CommitAsync();
await _eventHub.SendMessageAsync(MessageFactory.NotificationProgress,
- MessageFactory.ConvertCoverProgressEvent(count / chapters.Count, ProgressEventType.Started));
+ MessageFactory.ConvertCoverProgressEvent(count / totalCount, ProgressEventType.Started));
count++;
}
- await _eventHub.SendMessageAsync(MessageFactory.NotificationProgress,
- MessageFactory.ConvertCoverProgressEvent(1F, ProgressEventType.Ended));
+ _logger.LogInformation("[BookmarkService] Starting conversion of series");
+ foreach (var series in seriesCovers)
+ {
+ if (string.IsNullOrEmpty(series.CoverImage)) continue;
- _logger.LogInformation("[BookmarkService] Converted covers to WebP");
- }
+ var newFile = await SaveAsWebP(coverDirectory, series.CoverImage, coverDirectory);
+ series.CoverImage = Path.GetFileName(newFile);
+ _unitOfWork.SeriesRepository.Update(series);
+ await _unitOfWork.CommitAsync();
+ await _eventHub.SendMessageAsync(MessageFactory.NotificationProgress,
+ MessageFactory.ConvertCoverProgressEvent(count / totalCount, ProgressEventType.Started));
+ count++;
+ }
- /// <summary>
- /// This is a job that runs after a bookmark is saved
- /// </summary>
- public async Task ConvertBookmarkToWebP(int bookmarkId)
- {
- var bookmarkDirectory =
- (await _unitOfWork.SettingsRepository.GetSettingAsync(ServerSettingKey.BookmarkDirectory)).Value;
- var convertBookmarkToWebP =
- (await _unitOfWork.SettingsRepository.GetSettingsDtoAsync()).ConvertBookmarkToWebP;
+ _logger.LogInformation("[BookmarkService] Starting conversion of libraries");
+ foreach (var library in libraryCovers)
+ {
+ if (string.IsNullOrEmpty(library.CoverImage)) continue;
- if (!convertBookmarkToWebP) return;
+ var newFile = await SaveAsWebP(coverDirectory, library.CoverImage, coverDirectory);
+ library.CoverImage = Path.GetFileName(newFile);
+ _unitOfWork.LibraryRepository.Update(library);
+ await _unitOfWork.CommitAsync();
+ await _eventHub.SendMessageAsync(MessageFactory.NotificationProgress,
+ MessageFactory.ConvertCoverProgressEvent(count / totalCount, ProgressEventType.Started));
+ count++;
+ }
- // Validate the bookmark still exists
- var bookmark = await _unitOfWork.UserRepository.GetBookmarkAsync(bookmarkId);
- if (bookmark == null) return;
+ _logger.LogInformation("[BookmarkService] Starting conversion of reading lists");
+ foreach (var readingList in readingListCovers)
+ {
+ if (string.IsNullOrEmpty(readingList.CoverImage)) continue;
- bookmark.FileName = await SaveAsWebP(bookmarkDirectory, bookmark.FileName,
- BookmarkStem(bookmark.AppUserId, bookmark.SeriesId, bookmark.ChapterId));
- _unitOfWork.UserRepository.Update(bookmark);
+ var newFile = await SaveAsWebP(coverDirectory, readingList.CoverImage, coverDirectory);
+ readingList.CoverImage = Path.GetFileName(newFile);
+ _unitOfWork.ReadingListRepository.Update(readingList);
+ await _unitOfWork.CommitAsync();
+ await _eventHub.SendMessageAsync(MessageFactory.NotificationProgress,
+ MessageFactory.ConvertCoverProgressEvent(count / totalCount, ProgressEventType.Started));
+ count++;
+ }
- await _unitOfWork.CommitAsync();
+ _logger.LogInformation("[BookmarkService] Starting conversion of collections");
+ foreach (var collection in collectionCovers)
+ {
+ if (string.IsNullOrEmpty(collection.CoverImage)) continue;
+
+ var newFile = await SaveAsWebP(coverDirectory, collection.CoverImage, coverDirectory);
+ collection.CoverImage = Path.GetFileName(newFile);
+ _unitOfWork.CollectionTagRepository.Update(collection);
+ await _unitOfWork.CommitAsync();
+ await _eventHub.SendMessageAsync(MessageFactory.NotificationProgress,
+ MessageFactory.ConvertCoverProgressEvent(count / totalCount, ProgressEventType.Started));
+ count++;
+ }
+
+ // Now null out all series and volumes that aren't webp or custom
+ var nonCustomOrConvertedVolumeCovers = await _unitOfWork.VolumeRepository.GetAllWithNonWebPCovers();
+ foreach (var volume in nonCustomOrConvertedVolumeCovers)
+ {
+ if (string.IsNullOrEmpty(volume.CoverImage)) continue;
+ volume.CoverImage = null; // We null it out so when we call Refresh Metadata it will auto update from first chapter
+ _unitOfWork.VolumeRepository.Update(volume);
+ await _unitOfWork.CommitAsync();
+ }
+
+ var nonCustomOrConvertedSeriesCovers = await _unitOfWork.SeriesRepository.GetAllWithNonWebPCovers(false);
+ foreach (var series in nonCustomOrConvertedSeriesCovers)
+ {
+ if (string.IsNullOrEmpty(series.CoverImage)) continue;
+ series.CoverImage = null; // We null it out so when we call Refresh Metadata it will auto update from first chapter
+ _unitOfWork.SeriesRepository.Update(series);
+ await _unitOfWork.CommitAsync();
+ }
+
+ await _eventHub.SendMessageAsync(MessageFactory.NotificationProgress,
+ MessageFactory.ConvertCoverProgressEvent(1F, ProgressEventType.Ended));
+
+ _logger.LogInformation("[BookmarkService] Converted covers to WebP");
}
+
/// <summary>
/// Converts an image file, deletes original and returns the new path back
/// </summary>
@@ -260,8 +349,9 @@ public class BookmarkService : IBookmarkService
/// <param name="filename">The file to convert</param>
/// <param name="targetFolder">Full path to where files should be stored or any stem</param>
/// <returns></returns>
- private async Task<string> SaveAsWebP(string imageDirectory, string filename, string targetFolder)
+ public async Task<string> SaveAsWebP(string imageDirectory, string filename, string targetFolder)
{
+ // This must be Public as it's used in via Hangfire as a background task
var fullSourcePath = _directoryService.FileSystem.Path.Join(imageDirectory, filename);
var fullTargetDirectory = fullSourcePath.Replace(new FileInfo(filename).Name, string.Empty);
diff --git a/API/Services/CacheService.cs b/API/Services/CacheService.cs
index 0d75ceb01..9998526f9 100644
--- a/API/Services/CacheService.cs
+++ b/API/Services/CacheService.cs
@@ -4,7 +4,6 @@ using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
-using API.Comparators;
using API.Data;
using API.DTOs.Reader;
using API.Entities;
@@ -25,7 +24,7 @@ public interface ICacheService
/// <param name="chapterId"></param>
/// <param name="extractPdfToImages">Extracts a PDF into images for a different reading experience</param>
/// <returns>Chapter for the passed chapterId. Side-effect from ensuring cache.</returns>
- Task<Chapter> Ensure(int chapterId, bool extractPdfToImages = false);
+ Task<Chapter?> Ensure(int chapterId, bool extractPdfToImages = false);
/// <summary>
/// Clears cache directory of all volumes. This can be invoked from deleting a library or a series.
/// </summary>
@@ -33,7 +32,10 @@ public interface ICacheService
void CleanupChapters(IEnumerable<int> chapterIds);
void CleanupBookmarks(IEnumerable<int> seriesIds);
string GetCachedPagePath(int chapterId, int page);
- IEnumerable<FileDimensionDto> GetCachedFileDimensions(int chapterId);
+ string GetCachePath(int chapterId);
+ string GetBookmarkCachePath(int seriesId);
+ IEnumerable<string> GetCachedPages(int chapterId);
+ IEnumerable<FileDimensionDto> GetCachedFileDimensions(string cachePath);
string GetCachedBookmarkPagePath(int seriesId, int page);
string GetCachedFile(Chapter chapter);
public void ExtractChapterFiles(string extractPath, IReadOnlyList<MangaFile> files, bool extractPdfImages = false);
@@ -59,11 +61,22 @@ public class CacheService : ICacheService
_bookmarkService = bookmarkService;
}
- public IEnumerable<FileDimensionDto> GetCachedFileDimensions(int chapterId)
+ public IEnumerable<string> GetCachedPages(int chapterId)
{
- var sw = Stopwatch.StartNew();
var path = GetCachePath(chapterId);
- var files = _directoryService.GetFilesWithExtension(path, Tasks.Scanner.Parser.Parser.ImageFileExtensions)
+ return _directoryService.GetFilesWithExtension(path, Tasks.Scanner.Parser.Parser.ImageFileExtensions)
+ .OrderByNatural(Path.GetFileNameWithoutExtension);
+ }
+
+ /// <summary>
+ /// For a given path, scan all files (in reading order) and generate File Dimensions for it. Path must exist
+ /// </summary>
+ /// <param name="cachePath"></param>
+ /// <returns></returns>
+ public IEnumerable<FileDimensionDto> GetCachedFileDimensions(string cachePath)
+ {
+ var sw = Stopwatch.StartNew();
+ var files = _directoryService.GetFilesWithExtension(cachePath, Tasks.Scanner.Parser.Parser.ImageFileExtensions)
.OrderByNatural(Path.GetFileNameWithoutExtension)
.ToArray();
@@ -87,13 +100,13 @@ public class CacheService : ICacheService
Height = image.Height,
Width = image.Width,
IsWide = image.Width > image.Height,
- FileName = file.Replace(path, string.Empty)
+ FileName = file.Replace(cachePath, string.Empty)
});
}
}
catch (Exception ex)
{
- _logger.LogError(ex, "There was an error calculating image dimensions for {ChapterId}", chapterId);
+ _logger.LogError(ex, "There was an error calculating image dimensions for {CachePath}", cachePath);
}
finally
{
@@ -132,14 +145,21 @@ public class CacheService : ICacheService
{
var extractPath = GetCachePath(chapter.Id);
var path = Path.Join(extractPath, _directoryService.FileSystem.Path.GetFileName(chapter.Files.First().FilePath));
- if (!(_directoryService.FileSystem.FileInfo.FromFileName(path).Exists))
+ if (!(_directoryService.FileSystem.FileInfo.New(path).Exists))
{
path = chapter.Files.First().FilePath;
}
return path;
}
- public async Task<Chapter> Ensure(int chapterId, bool extractPdfToImages = false)
+
+ /// <summary>
+ /// Caches the files for the given chapter to CacheDirectory
+ /// </summary>
+ /// <param name="chapterId"></param>
+ /// <param name="extractPdfToImages">Defaults to false. Extract pdf file into images rather than copying just the pdf file</param>
+ /// <returns>This will always return the Chapter for the chapterId</returns>
+ public async Task<Chapter?> Ensure(int chapterId, bool extractPdfToImages = false)
{
_directoryService.ExistOrCreate(_directoryService.CacheDirectory);
var chapter = await _unitOfWork.ChapterRepository.GetChapterAsync(chapterId);
@@ -160,12 +180,13 @@ public class CacheService : ICacheService
/// <param name="files"></param>
/// <param name="extractPdfImages">Defaults to false, if true, will extract the images from the PDF renderer and not move the pdf file</param>
/// <returns></returns>
- public void ExtractChapterFiles(string extractPath, IReadOnlyList<MangaFile> files, bool extractPdfImages = false)
+ public void ExtractChapterFiles(string extractPath, IReadOnlyList<MangaFile>? files, bool extractPdfImages = false)
{
+ if (files == null) return;
var removeNonImages = true;
var fileCount = files.Count;
var extraPath = string.Empty;
- var extractDi = _directoryService.FileSystem.DirectoryInfo.FromDirectoryName(extractPath);
+ var extractDi = _directoryService.FileSystem.DirectoryInfo.New(extractPath);
if (files.Count > 0 && files[0].Format == MangaFormat.Image)
{
@@ -244,12 +265,17 @@ public class CacheService : ICacheService
/// </summary>
/// <param name="chapterId"></param>
/// <returns></returns>
- private string GetCachePath(int chapterId)
+ public string GetCachePath(int chapterId)
{
return _directoryService.FileSystem.Path.GetFullPath(_directoryService.FileSystem.Path.Join(_directoryService.CacheDirectory, $"{chapterId}/"));
}
- private string GetBookmarkCachePath(int seriesId)
+ /// <summary>
+ /// Returns the cache path for a given series' bookmarks. Should be cacheDirectory/{seriesId_bookmarks}/
+ /// </summary>
+ /// <param name="seriesId"></param>
+ /// <returns></returns>
+ public string GetBookmarkCachePath(int seriesId)
{
return _directoryService.FileSystem.Path.GetFullPath(_directoryService.FileSystem.Path.Join(_directoryService.CacheDirectory, $"{seriesId}_bookmarks/"));
}
@@ -269,15 +295,7 @@ public class CacheService : ICacheService
.OrderByNatural(Path.GetFileNameWithoutExtension)
.ToArray();
- if (files.Length == 0)
- {
- return string.Empty;
- }
-
- if (page > files.Length) page = files.Length;
-
- // Since array is 0 based, we need to keep that in account (only affects last image)
- return page == files.Length ? files.ElementAt(page - 1) : files.ElementAt(page);
+ return GetPageFromFiles(files, page);
}
public async Task<int> CacheBookmarkForSeries(int userId, int seriesId)
@@ -303,4 +321,33 @@ public class CacheService : ICacheService
_directoryService.ClearAndDeleteDirectory(destDirectory);
}
+
+ /// <summary>
+ /// Returns either the file or an empty string
+ /// </summary>
+ /// <param name="files"></param>
+ /// <param name="pageNum"></param>
+ /// <returns></returns>
+ public static string GetPageFromFiles(string[] files, int pageNum)
+ {
+ files = files
+ .AsEnumerable()
+ .OrderByNatural(Path.GetFileNameWithoutExtension)
+ .ToArray();
+
+ if (files.Length == 0)
+ {
+ return string.Empty;
+ }
+
+ if (pageNum < 0)
+ {
+ pageNum = 0;
+ }
+
+ // Since array is 0 based, we need to keep that in account (only affects last image)
+ return pageNum >= files.Length ? files.ElementAt(Math.Min(pageNum - 1, files.Length - 1)) : files.ElementAt(pageNum);
+ }
+
+
}
diff --git a/API/Services/CollectionTagService.cs b/API/Services/CollectionTagService.cs
index 79443f1ef..e95096cd1 100644
--- a/API/Services/CollectionTagService.cs
+++ b/API/Services/CollectionTagService.cs
@@ -3,12 +3,13 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using API.Data;
+using API.Data.Repositories;
using API.DTOs.CollectionTags;
using API.Entities;
using API.Entities.Metadata;
+using API.Helpers.Builders;
using API.SignalR;
using Kavita.Common;
-using Microsoft.Extensions.Logging;
namespace API.Services;
@@ -17,10 +18,10 @@ public interface ICollectionTagService
{
Task<bool> TagExistsByName(string name);
Task<bool> UpdateTag(CollectionTagDto dto);
- Task<bool> AddTagToSeries(CollectionTag tag, IEnumerable<int> seriesIds);
- Task<bool> RemoveTagFromSeries(CollectionTag tag, IEnumerable<int> seriesIds);
+ Task<bool> AddTagToSeries(CollectionTag? tag, IEnumerable<int> seriesIds);
+ Task<bool> RemoveTagFromSeries(CollectionTag? tag, IEnumerable<int> seriesIds);
Task<CollectionTag> GetTagOrCreate(int tagId, string title);
- void AddTagToSeriesMetadata(CollectionTag tag, SeriesMetadata metadata);
+ void AddTagToSeriesMetadata(CollectionTag? tag, SeriesMetadata metadata);
CollectionTag CreateTag(string title);
Task<bool> RemoveTagsWithoutSeries();
}
@@ -93,8 +94,9 @@ public class CollectionTagService : ICollectionTagService
/// <param name="tag">A full Tag</param>
/// <param name="seriesIds"></param>
/// <returns></returns>
- public async Task<bool> AddTagToSeries(CollectionTag tag, IEnumerable<int> seriesIds)
+ public async Task<bool> AddTagToSeries(CollectionTag? tag, IEnumerable<int> seriesIds)
{
+ if (tag == null) return false;
var metadatas = await _unitOfWork.SeriesRepository.GetSeriesMetadataForIdsAsync(seriesIds);
foreach (var metadata in metadatas)
{
@@ -112,8 +114,9 @@ public class CollectionTagService : ICollectionTagService
/// <param name="tag"></param>
/// <param name="metadata"></param>
/// <returns></returns>
- public void AddTagToSeriesMetadata(CollectionTag tag, SeriesMetadata metadata)
+ public void AddTagToSeriesMetadata(CollectionTag? tag, SeriesMetadata metadata)
{
+ if (tag == null) return;
metadata.CollectionTags ??= new List<CollectionTag>();
if (metadata.CollectionTags.Any(t => t.NormalizedTitle.Equals(tag.NormalizedTitle, StringComparison.InvariantCulture))) return;
@@ -124,8 +127,9 @@ public class CollectionTagService : ICollectionTagService
}
}
- public async Task<bool> RemoveTagFromSeries(CollectionTag tag, IEnumerable<int> seriesIds)
+ public async Task<bool> RemoveTagFromSeries(CollectionTag? tag, IEnumerable<int> seriesIds)
{
+ if (tag == null) return false;
foreach (var seriesIdToRemove in seriesIds)
{
tag.SeriesMetadatas.Remove(tag.SeriesMetadatas.Single(sm => sm.SeriesId == seriesIdToRemove));
@@ -150,7 +154,7 @@ public class CollectionTagService : ICollectionTagService
/// <returns></returns>
public async Task<CollectionTag> GetTagOrCreate(int tagId, string title)
{
- return await _unitOfWork.CollectionTagRepository.GetFullTagAsync(tagId) ?? CreateTag(title);
+ return await _unitOfWork.CollectionTagRepository.GetTagAsync(tagId, CollectionTagIncludes.SeriesMetadata) ?? CreateTag(title);
}
/// <summary>
@@ -160,7 +164,7 @@ public class CollectionTagService : ICollectionTagService
/// <returns></returns>
public CollectionTag CreateTag(string title)
{
- var tag = DbFactory.CollectionTag(0, title, string.Empty, false);
+ var tag = new CollectionTagBuilder(title).Build();
_unitOfWork.CollectionTagRepository.Add(tag);
return tag;
}
diff --git a/API/Services/DeviceService.cs b/API/Services/DeviceService.cs
index ffab5a858..11727b5fa 100644
--- a/API/Services/DeviceService.cs
+++ b/API/Services/DeviceService.cs
@@ -8,7 +8,7 @@ using API.DTOs.Email;
using API.Entities;
using API.Entities.Enums;
using API.Entities.Enums.Device;
-using API.SignalR;
+using API.Helpers.Builders;
using Kavita.Common;
using Microsoft.Extensions.Logging;
@@ -16,8 +16,8 @@ namespace API.Services;
public interface IDeviceService
{
- Task<Device> Create(CreateDeviceDto dto, AppUser userWithDevices);
- Task<Device> Update(UpdateDeviceDto dto, AppUser userWithDevices);
+ Task<Device?> Create(CreateDeviceDto dto, AppUser userWithDevices);
+ Task<Device?> Update(UpdateDeviceDto dto, AppUser userWithDevices);
Task<bool> Delete(AppUser userWithDevices, int deviceId);
Task<bool> SendTo(IReadOnlyList<int> chapterIds, int deviceId);
}
@@ -34,18 +34,19 @@ public class DeviceService : IDeviceService
_logger = logger;
_emailService = emailService;
}
- #nullable enable
+
public async Task<Device?> Create(CreateDeviceDto dto, AppUser userWithDevices)
{
try
{
userWithDevices.Devices ??= new List<Device>();
- var existingDevice = userWithDevices.Devices.SingleOrDefault(d => d.Name.Equals(dto.Name));
+ var existingDevice = userWithDevices.Devices.SingleOrDefault(d => d.Name!.Equals(dto.Name));
if (existingDevice != null) throw new KavitaException("A device with this name already exists");
- existingDevice = DbFactory.Device(dto.Name);
- existingDevice.Platform = dto.Platform;
- existingDevice.EmailAddress = dto.EmailAddress;
+ existingDevice = new DeviceBuilder(dto.Name)
+ .WithPlatform(dto.Platform)
+ .WithEmail(dto.EmailAddress)
+ .Build();
userWithDevices.Devices.Add(existingDevice);
@@ -85,7 +86,6 @@ public class DeviceService : IDeviceService
return null;
}
- #nullable disable
public async Task<bool> Delete(AppUser userWithDevices, int deviceId)
{
@@ -119,7 +119,7 @@ public class DeviceService : IDeviceService
await _unitOfWork.CommitAsync();
var success = await _emailService.SendFilesToEmail(new SendToDto()
{
- DestinationEmail = device.EmailAddress,
+ DestinationEmail = device.EmailAddress!,
FilePaths = files.Select(m => m.FilePath)
});
diff --git a/API/Services/DirectoryService.cs b/API/Services/DirectoryService.cs
index 0d4b9eeae..9608fc469 100644
--- a/API/Services/DirectoryService.cs
+++ b/API/Services/DirectoryService.cs
@@ -1,17 +1,14 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
-using System.Diagnostics;
using System.IO;
using System.IO.Abstractions;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using API.DTOs.System;
-using API.Entities.Enums;
using API.Extensions;
using Kavita.Common.Helpers;
-using Microsoft.Extensions.FileSystemGlobbing;
using Microsoft.Extensions.Logging;
namespace API.Services;
@@ -47,33 +44,25 @@ public interface IDirectoryService
void ClearDirectory(string directoryPath);
void ClearAndDeleteDirectory(string directoryPath);
string[] GetFilesWithExtension(string path, string searchPatternExpression = "");
- bool CopyDirectoryToDirectory(string sourceDirName, string destDirName, string searchPattern = "");
-
+ bool CopyDirectoryToDirectory(string? sourceDirName, string destDirName, string searchPattern = "");
Dictionary<string, string> FindHighestDirectoriesFromFiles(IEnumerable<string> libraryFolders,
IList<string> filePaths);
-
IEnumerable<string> GetFoldersTillRoot(string rootPath, string fullPath);
-
IEnumerable<string> GetFiles(string path, string fileNameRegex = "", SearchOption searchOption = SearchOption.TopDirectoryOnly);
-
bool ExistOrCreate(string directoryPath);
void DeleteFiles(IEnumerable<string> files);
void RemoveNonImages(string directoryName);
void Flatten(string directoryName);
Task<bool> CheckWriteAccess(string directoryName);
-
IEnumerable<string> GetFilesWithCertainExtensions(string path,
string searchPatternExpression = "",
SearchOption searchOption = SearchOption.TopDirectoryOnly);
-
IEnumerable<string> GetDirectories(string folderPath);
- IEnumerable<string> GetDirectories(string folderPath, GlobMatcher matcher);
+ IEnumerable<string> GetDirectories(string folderPath, GlobMatcher? matcher);
string GetParentDirectoryName(string fileOrFolder);
-#nullable enable
IList<string> ScanFiles(string folderPath, GlobMatcher? matcher = null);
DateTime GetLastWriteTime(string folderPath);
- GlobMatcher CreateMatcherFromFile(string filePath);
-#nullable disable
+ GlobMatcher? CreateMatcherFromFile(string filePath);
}
public class DirectoryService : IDirectoryService
{
@@ -87,13 +76,14 @@ public class DirectoryService : IDirectoryService
public string BookmarkDirectory { get; }
public string SiteThemeDirectory { get; }
private readonly ILogger<DirectoryService> _logger;
+ private const RegexOptions MatchOptions = RegexOptions.Compiled | RegexOptions.IgnoreCase;
private static readonly Regex ExcludeDirectories = new Regex(
- @"@eaDir|\.DS_Store|\.qpkg|__MACOSX|@Recently-Snapshot|@recycle",
- RegexOptions.Compiled | RegexOptions.IgnoreCase,
+ @"@eaDir|\.DS_Store|\.qpkg|__MACOSX|@Recently-Snapshot|@recycle|\.@__thumb",
+ MatchOptions,
Tasks.Scanner.Parser.Parser.RegexTimeout);
private static readonly Regex FileCopyAppend = new Regex(@"\(\d+\)",
- RegexOptions.Compiled | RegexOptions.IgnoreCase,
+ MatchOptions,
Tasks.Scanner.Parser.Parser.RegexTimeout);
public static readonly string BackupDirectory = Path.Join(Directory.GetCurrentDirectory(), "config", "backups");
@@ -130,7 +120,7 @@ public class DirectoryService : IDirectoryService
SearchOption searchOption = SearchOption.TopDirectoryOnly)
{
if (!FileSystem.Directory.Exists(path)) return ImmutableList<string>.Empty;
- var reSearchPattern = new Regex(searchPatternExpression, RegexOptions.IgnoreCase);
+ var reSearchPattern = new Regex(searchPatternExpression, RegexOptions.IgnoreCase, Tasks.Scanner.Parser.Parser.RegexTimeout);
return FileSystem.Directory.EnumerateFiles(path, "*", searchOption)
.Where(file =>
@@ -172,7 +162,7 @@ public class DirectoryService : IDirectoryService
while (FileSystem.Path.GetDirectoryName(path) != Path.GetDirectoryName(root))
{
- var folder = FileSystem.DirectoryInfo.FromDirectoryName(path).Name;
+ var folder = FileSystem.DirectoryInfo.New(path).Name;
paths.Add(folder);
path = path.Substring(0, path.LastIndexOf(separator));
}
@@ -187,7 +177,7 @@ public class DirectoryService : IDirectoryService
/// <returns></returns>
public bool Exists(string directory)
{
- var di = FileSystem.DirectoryInfo.FromDirectoryName(directory);
+ var di = FileSystem.DirectoryInfo.New(directory);
return di.Exists;
}
@@ -230,7 +220,7 @@ public class DirectoryService : IDirectoryService
{
try
{
- var fileInfo = FileSystem.FileInfo.FromFileName(fullFilePath);
+ var fileInfo = FileSystem.FileInfo.New(fullFilePath);
if (!fileInfo.Exists) return;
ExistOrCreate(targetDirectory);
@@ -250,12 +240,12 @@ public class DirectoryService : IDirectoryService
/// <param name="searchPattern">Defaults to all files</param>
/// <returns>If was successful</returns>
/// <exception cref="DirectoryNotFoundException">Thrown when source directory does not exist</exception>
- public bool CopyDirectoryToDirectory(string sourceDirName, string destDirName, string searchPattern = "")
+ public bool CopyDirectoryToDirectory(string? sourceDirName, string destDirName, string searchPattern = "")
{
if (string.IsNullOrEmpty(sourceDirName)) return false;
// Get the subdirectories for the specified directory.
- var dir = FileSystem.DirectoryInfo.FromDirectoryName(sourceDirName);
+ var dir = FileSystem.DirectoryInfo.New(sourceDirName);
if (!dir.Exists)
{
@@ -270,7 +260,7 @@ public class DirectoryService : IDirectoryService
ExistOrCreate(destDirName);
// Get the files in the directory and copy them to the new location.
- var files = GetFilesWithExtension(dir.FullName, searchPattern).Select(n => FileSystem.FileInfo.FromFileName(n));
+ var files = GetFilesWithExtension(dir.FullName, searchPattern).Select(n => FileSystem.FileInfo.New(n));
foreach (var file in files)
{
var tempPath = FileSystem.Path.Combine(destDirName, file.Name);
@@ -294,7 +284,7 @@ public class DirectoryService : IDirectoryService
/// <returns></returns>
public bool IsDriveMounted(string path)
{
- return FileSystem.DirectoryInfo.FromDirectoryName(FileSystem.Path.GetPathRoot(path) ?? string.Empty).Exists;
+ return FileSystem.DirectoryInfo.New(FileSystem.Path.GetPathRoot(path) ?? string.Empty).Exists;
}
@@ -325,7 +315,7 @@ public class DirectoryService : IDirectoryService
/// <returns>Total bytes</returns>
public long GetTotalSize(IEnumerable<string> paths)
{
- return paths.Sum(path => FileSystem.FileInfo.FromFileName(path).Length);
+ return paths.Sum(path => FileSystem.FileInfo.New(path).Length);
}
/// <summary>
@@ -335,7 +325,7 @@ public class DirectoryService : IDirectoryService
/// <returns></returns>
public bool ExistOrCreate(string directoryPath)
{
- var di = FileSystem.DirectoryInfo.FromDirectoryName(directoryPath);
+ var di = FileSystem.DirectoryInfo.New(directoryPath);
if (di.Exists) return true;
try
{
@@ -356,7 +346,7 @@ public class DirectoryService : IDirectoryService
{
if (!FileSystem.Directory.Exists(directoryPath)) return;
- var di = FileSystem.DirectoryInfo.FromDirectoryName(directoryPath);
+ var di = FileSystem.DirectoryInfo.New(directoryPath);
ClearDirectory(directoryPath);
@@ -370,7 +360,7 @@ public class DirectoryService : IDirectoryService
/// <returns></returns>
public void ClearDirectory(string directoryPath)
{
- var di = FileSystem.DirectoryInfo.FromDirectoryName(directoryPath);
+ var di = FileSystem.DirectoryInfo.New(directoryPath);
if (!di.Exists) return;
try
{
@@ -401,7 +391,7 @@ public class DirectoryService : IDirectoryService
public bool CopyFilesToDirectory(IEnumerable<string> filePaths, string directoryPath, string prepend = "")
{
ExistOrCreate(directoryPath);
- string currentFile = null;
+ string? currentFile = null;
try
{
foreach (var file in filePaths)
@@ -413,8 +403,8 @@ public class DirectoryService : IDirectoryService
_logger.LogError("Unable to copy {File} to {DirectoryPath} as it doesn't exist", file, directoryPath);
continue;
}
- var fileInfo = FileSystem.FileInfo.FromFileName(file);
- var targetFile = FileSystem.FileInfo.FromFileName(RenameFileForCopy(file, directoryPath, prepend));
+ var fileInfo = FileSystem.FileInfo.New(file);
+ var targetFile = FileSystem.FileInfo.New(RenameFileForCopy(file, directoryPath, prepend));
fileInfo.CopyTo(FileSystem.Path.Join(directoryPath, targetFile.Name));
}
@@ -439,7 +429,7 @@ public class DirectoryService : IDirectoryService
public bool CopyFilesToDirectory(IEnumerable<string> filePaths, string directoryPath, IList<string> newFilenames)
{
ExistOrCreate(directoryPath);
- string currentFile = null;
+ string? currentFile = null;
var index = 0;
try
{
@@ -452,8 +442,8 @@ public class DirectoryService : IDirectoryService
_logger.LogError("Unable to copy {File} to {DirectoryPath} as it doesn't exist", file, directoryPath);
continue;
}
- var fileInfo = FileSystem.FileInfo.FromFileName(file);
- var targetFile = FileSystem.FileInfo.FromFileName(RenameFileForCopy(newFilenames[index] + fileInfo.Extension, directoryPath));
+ var fileInfo = FileSystem.FileInfo.New(file);
+ var targetFile = FileSystem.FileInfo.New(RenameFileForCopy(newFilenames[index] + fileInfo.Extension, directoryPath));
fileInfo.CopyTo(FileSystem.Path.Join(directoryPath, targetFile.Name));
index++;
@@ -480,18 +470,20 @@ public class DirectoryService : IDirectoryService
{
while (true)
{
- var fileInfo = FileSystem.FileInfo.FromFileName(fileToCopy);
+ var fileInfo = FileSystem.FileInfo.New(fileToCopy);
var filename = prepend + fileInfo.Name;
- var targetFile = FileSystem.FileInfo.FromFileName(FileSystem.Path.Join(directoryPath, filename));
+ var targetFile = FileSystem.FileInfo.New(FileSystem.Path.Join(directoryPath, filename));
if (!targetFile.Exists)
{
return targetFile.FullName;
}
var noExtension = FileSystem.Path.GetFileNameWithoutExtension(fileInfo.Name);
+ //if (FileCopyAppendRegex().IsMatch(noExtension))
if (FileCopyAppend.IsMatch(noExtension))
{
+ //var match = FileCopyAppendRegex().Match(noExtension).Value;
var match = FileCopyAppend.Match(noExtension).Value;
var matchNumber = match.Replace("(", string.Empty).Replace(")", string.Empty);
noExtension = noExtension.Replace(match, $"({int.Parse(matchNumber) + 1})");
@@ -515,7 +507,7 @@ public class DirectoryService : IDirectoryService
{
if (!FileSystem.Directory.Exists(rootPath)) return ImmutableList<DirectoryDto>.Empty;
- var di = FileSystem.DirectoryInfo.FromDirectoryName(rootPath);
+ var di = FileSystem.DirectoryInfo.New(rootPath);
var dirs = di.GetDirectories()
.Where(dir => !(dir.Attributes.HasFlag(FileAttributes.Hidden) || dir.Attributes.HasFlag(FileAttributes.System)))
.Select(d => new DirectoryDto()
@@ -595,13 +587,13 @@ public class DirectoryService : IDirectoryService
/// <param name="folderPath"></param>
/// <param name="matcher">A set of glob rules that will filter directories out</param>
/// <returns>List of directory paths, empty if path doesn't exist</returns>
- public IEnumerable<string> GetDirectories(string folderPath, GlobMatcher matcher)
+ public IEnumerable<string> GetDirectories(string folderPath, GlobMatcher? matcher)
{
if (matcher == null) return GetDirectories(folderPath);
return GetDirectories(folderPath)
.Where(folder => !matcher.ExcludeMatches(
- $"{FileSystem.DirectoryInfo.FromDirectoryName(folder).Name}{FileSystem.Path.AltDirectorySeparatorChar}"));
+ $"{FileSystem.DirectoryInfo.New(folder).Name}{FileSystem.Path.AltDirectorySeparatorChar}"));
}
/// <summary>
@@ -681,7 +673,7 @@ public class DirectoryService : IDirectoryService
{
var foundFiles = GetFilesWithCertainExtensions(folderPath,
Tasks.Scanner.Parser.Parser.SupportedExtensions)
- .Where(file => !matcher.ExcludeMatches(FileSystem.FileInfo.FromFileName(file).Name));
+ .Where(file => !matcher.ExcludeMatches(FileSystem.FileInfo.New(file).Name));
files.AddRange(foundFiles);
}
@@ -707,7 +699,7 @@ public class DirectoryService : IDirectoryService
/// </summary>
/// <param name="filePath"></param>
/// <returns></returns>
- public GlobMatcher CreateMatcherFromFile(string filePath)
+ public GlobMatcher? CreateMatcherFromFile(string filePath)
{
if (!FileSystem.File.Exists(filePath))
{
@@ -831,7 +823,7 @@ public class DirectoryService : IDirectoryService
{
try
{
- FileSystem.FileInfo.FromFileName(file).Delete();
+ FileSystem.FileInfo.New(file).Delete();
}
catch (Exception)
{
@@ -934,7 +926,7 @@ public class DirectoryService : IDirectoryService
{
if (string.IsNullOrEmpty(directoryName) || !FileSystem.Directory.Exists(directoryName)) return;
- var directory = FileSystem.DirectoryInfo.FromDirectoryName(directoryName);
+ var directory = FileSystem.DirectoryInfo.New(directoryName);
var index = 0;
FlattenDirectory(directory, directory, ref index);
diff --git a/API/Services/DownloadService.cs b/API/Services/DownloadService.cs
index a89a0988f..a8dfd5d50 100644
--- a/API/Services/DownloadService.cs
+++ b/API/Services/DownloadService.cs
@@ -2,10 +2,9 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
-using System.Threading.Tasks;
using API.Entities;
-using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.StaticFiles;
+using MimeTypes;
namespace API.Services;
@@ -49,11 +48,11 @@ public class DownloadService : IDownloadService
".zip" => "application/zip",
".tar.gz" => "application/gzip",
".pdf" => "application/pdf",
- _ => contentType
+ _ => MimeTypeMap.GetMimeType(contentType)
};
}
- return contentType;
+ return contentType!;
}
diff --git a/API/Services/EmailService.cs b/API/Services/EmailService.cs
index 32823c178..e97ccfaea 100644
--- a/API/Services/EmailService.cs
+++ b/API/Services/EmailService.cs
@@ -6,6 +6,7 @@ using System.Threading.Tasks;
using API.Data;
using API.DTOs.Email;
using API.Entities.Enums;
+using Flurl;
using Flurl.Http;
using Kavita.Common;
using Kavita.Common.EnvironmentInfo;
@@ -22,7 +23,7 @@ public interface IEmailService
Task<bool> SendMigrationEmail(EmailMigrationDto data);
Task<bool> SendPasswordResetEmail(PasswordResetEmailDto data);
Task<bool> SendFilesToEmail(SendToDto data);
- Task<EmailTestResultDto> TestConnectivity(string emailUrl);
+ Task<EmailTestResultDto> TestConnectivity(string emailUrl, string adminEmail, bool sendEmail);
Task<bool> IsDefaultEmailService();
Task SendEmailChangeEmail(ConfirmationEmailDto data);
}
@@ -55,7 +56,7 @@ public class EmailService : IEmailService
/// <remarks>This will do some basic filtering to auto return false if the emailUrl is a LAN ip</remarks>
/// <param name="emailUrl"></param>
/// <returns></returns>
- public async Task<EmailTestResultDto> TestConnectivity(string emailUrl)
+ public async Task<EmailTestResultDto> TestConnectivity(string emailUrl, string adminEmail, bool sendEmail)
{
var result = new EmailTestResultDto();
try
@@ -65,7 +66,7 @@ public class EmailService : IEmailService
result.Successful = false;
result.ErrorMessage = "This is a local IP address";
}
- result.Successful = await SendEmailWithGet(emailUrl + "/api/test");
+ result.Successful = await SendEmailWithGet($"{emailUrl}/api/test?adminEmail={Url.Encode(adminEmail)}&sendEmail={sendEmail}");
}
catch (KavitaException ex)
{
@@ -78,13 +79,13 @@ public class EmailService : IEmailService
public async Task<bool> IsDefaultEmailService()
{
- return (await _unitOfWork.SettingsRepository.GetSettingAsync(ServerSettingKey.EmailServiceUrl)).Value
+ return (await _unitOfWork.SettingsRepository.GetSettingAsync(ServerSettingKey.EmailServiceUrl))!.Value!
.Equals(DefaultApiUrl);
}
public async Task SendEmailChangeEmail(ConfirmationEmailDto data)
{
- var emailLink = (await _unitOfWork.SettingsRepository.GetSettingAsync(ServerSettingKey.EmailServiceUrl)).Value;
+ var emailLink = (await _unitOfWork.SettingsRepository.GetSettingAsync(ServerSettingKey.EmailServiceUrl))!.Value;
var success = await SendEmailWithPost(emailLink + "/api/account/email-change", data);
if (!success)
{
diff --git a/API/Services/ImageService.cs b/API/Services/ImageService.cs
index a3eee4178..23d8b59f7 100644
--- a/API/Services/ImageService.cs
+++ b/API/Services/ImageService.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
@@ -17,12 +18,29 @@ public interface IImageService
/// </summary>
/// <param name="encodedImage">base64 encoded image</param>
/// <param name="fileName"></param>
+ /// <param name="saveAsWebP">Convert and save as webp</param>
/// <param name="thumbnailWidth">Width of thumbnail</param>
/// <returns>File name with extension of the file. This will always write to <see cref="DirectoryService.CoverImageDirectory"/></returns>
- string CreateThumbnailFromBase64(string encodedImage, string fileName, int thumbnailWidth = 0);
-
+ string CreateThumbnailFromBase64(string encodedImage, string fileName, bool saveAsWebP = false, int thumbnailWidth = 320);
+ /// <summary>
+ /// Writes out a thumbnail by stream input
+ /// </summary>
+ /// <param name="stream"></param>
+ /// <param name="fileName"></param>
+ /// <param name="outputDirectory"></param>
+ /// <param name="saveAsWebP"></param>
+ /// <returns></returns>
string WriteCoverThumbnail(Stream stream, string fileName, string outputDirectory, bool saveAsWebP = false);
/// <summary>
+ /// Writes out a thumbnail by file path input
+ /// </summary>
+ /// <param name="sourceFile"></param>
+ /// <param name="fileName"></param>
+ /// <param name="outputDirectory"></param>
+ /// <param name="saveAsWebP"></param>
+ /// <returns></returns>
+ string WriteCoverThumbnail(string sourceFile, string fileName, string outputDirectory, bool saveAsWebP = false);
+ /// <summary>
/// Converts the passed image to webP and outputs it in the same directory
/// </summary>
/// <param name="filePath">Full path to the image to convert</param>
@@ -42,7 +60,6 @@ public class ImageService : IImageService
public const string CollectionTagCoverImageRegex = @"tag\d+";
public const string ReadingListCoverImageRegex = @"readinglist\d+";
-
/// <summary>
/// Width of the Thumbnail generation
/// </summary>
@@ -58,8 +75,9 @@ public class ImageService : IImageService
_directoryService = directoryService;
}
- public void ExtractImages(string fileFilePath, string targetDirectory, int fileCount = 1)
+ public void ExtractImages(string? fileFilePath, string targetDirectory, int fileCount = 1)
{
+ if (string.IsNullOrEmpty(fileFilePath)) return;
_directoryService.ExistOrCreate(targetDirectory);
if (fileCount == 1)
{
@@ -67,7 +85,7 @@ public class ImageService : IImageService
}
else
{
- _directoryService.CopyDirectoryToDirectory(Path.GetDirectoryName(fileFilePath), targetDirectory,
+ _directoryService.CopyDirectoryToDirectory(_directoryService.FileSystem.Path.GetDirectoryName(fileFilePath), targetDirectory,
Tasks.Scanner.Parser.Parser.ImageFileExtensions);
}
}
@@ -113,9 +131,22 @@ public class ImageService : IImageService
return filename;
}
+ public string WriteCoverThumbnail(string sourceFile, string fileName, string outputDirectory, bool saveAsWebP = false)
+ {
+ using var thumbnail = Image.Thumbnail(sourceFile, ThumbnailWidth);
+ var filename = fileName + (saveAsWebP ? ".webp" : ".png");
+ _directoryService.ExistOrCreate(outputDirectory);
+ try
+ {
+ _directoryService.FileSystem.File.Delete(_directoryService.FileSystem.Path.Join(outputDirectory, filename));
+ } catch (Exception) {/* Swallow exception */}
+ thumbnail.WriteToFile(_directoryService.FileSystem.Path.Join(outputDirectory, filename));
+ return filename;
+ }
+
public Task<string> ConvertToWebP(string filePath, string outputPath)
{
- var file = _directoryService.FileSystem.FileInfo.FromFileName(filePath);
+ var file = _directoryService.FileSystem.FileInfo.New(filePath);
var fileName = file.Name.Replace(file.Extension, string.Empty);
var outputFile = Path.Join(outputPath, fileName + ".webp");
@@ -124,6 +155,11 @@ public class ImageService : IImageService
return Task.FromResult(outputFile);
}
+ /// <summary>
+ /// Performs I/O to determine if the file is a valid Image
+ /// </summary>
+ /// <param name="filePath"></param>
+ /// <returns></returns>
public async Task<bool> IsImage(string filePath)
{
try
@@ -143,14 +179,14 @@ public class ImageService : IImageService
/// <inheritdoc />
- public string CreateThumbnailFromBase64(string encodedImage, string fileName, int thumbnailWidth = ThumbnailWidth)
+ public string CreateThumbnailFromBase64(string encodedImage, string fileName, bool saveAsWebP = false, int thumbnailWidth = ThumbnailWidth)
{
try
{
- using var thumbnail = Image.ThumbnailBuffer(Convert.FromBase64String(encodedImage), ThumbnailWidth);
- var filename = fileName + ".png";
- thumbnail.WriteToFile(_directoryService.FileSystem.Path.Join(_directoryService.CoverImageDirectory, fileName + ".png"));
- return filename;
+ using var thumbnail = Image.ThumbnailBuffer(Convert.FromBase64String(encodedImage), thumbnailWidth);
+ fileName += (saveAsWebP ? ".webp" : ".png");
+ thumbnail.WriteToFile(_directoryService.FileSystem.Path.Join(_directoryService.CoverImageDirectory, fileName));
+ return fileName;
}
catch (Exception e)
{
@@ -211,5 +247,33 @@ public class ImageService : IImageService
return $"readinglist{readingListId}";
}
+ /// <summary>
+ /// Returns the name format for a thumbnail (temp thumbnail)
+ /// </summary>
+ /// <param name="chapterId"></param>
+ /// <returns></returns>
+ public static string GetThumbnailFormat(int chapterId)
+ {
+ return $"thumbnail{chapterId}";
+ }
+
+
+ public static string CreateMergedImage(List<string> coverImages, string dest)
+ {
+ // Currently this doesn't work due to non-standard cover image sizes and dimensions
+ var image = Image.Black(320*4, 160*4);
+
+ for (var i = 0; i < coverImages.Count; i++)
+ {
+ var tile = Image.NewFromFile(coverImages[i], access: Enums.Access.Sequential);
+
+ var x = (i % 2) * (image.Width / 2);
+ var y = (i / 2) * (image.Height / 2);
+ image = image.Insert(tile, x, y);
+ }
+
+ image.WriteToFile(dest);
+ return dest;
+ }
}
diff --git a/API/Services/MetadataService.cs b/API/Services/MetadataService.cs
index 833ee83c8..369d555f3 100644
--- a/API/Services/MetadataService.cs
+++ b/API/Services/MetadataService.cs
@@ -5,18 +5,11 @@ using System.Linq;
using System.Threading.Tasks;
using API.Comparators;
using API.Data;
-using API.Data.Metadata;
-using API.Data.Repositories;
-using API.Data.Scanner;
-using API.DTOs.Metadata;
using API.Entities;
-using API.Entities.Enums;
using API.Extensions;
using API.Helpers;
-using API.Services.Tasks.Metadata;
using API.SignalR;
using Hangfire;
-using Microsoft.AspNetCore.SignalR;
using Microsoft.Extensions.Logging;
namespace API.Services;
@@ -74,11 +67,13 @@ public class MetadataService : IMetadataService
private Task<bool> UpdateChapterCoverImage(Chapter chapter, bool forceUpdate, bool convertToWebPOnWrite)
{
var firstFile = chapter.Files.MinBy(x => x.Chapter);
+ if (firstFile == null) return Task.FromResult(false);
- if (!_cacheHelper.ShouldUpdateCoverImage(_directoryService.FileSystem.Path.Join(_directoryService.CoverImageDirectory, chapter.CoverImage), firstFile, chapter.Created, forceUpdate, chapter.CoverImageLocked))
+ if (!_cacheHelper.ShouldUpdateCoverImage(_directoryService.FileSystem.Path.Join(_directoryService.CoverImageDirectory, chapter.CoverImage),
+ firstFile, chapter.Created, forceUpdate, chapter.CoverImageLocked))
return Task.FromResult(false);
- if (firstFile == null) return Task.FromResult(false);
+
_logger.LogDebug("[MetadataService] Generating cover image for {File}", firstFile.FilePath);
@@ -102,7 +97,7 @@ public class MetadataService : IMetadataService
/// </summary>
/// <param name="volume"></param>
/// <param name="forceUpdate">Force updating cover image even if underlying file has not been modified or chapter already has a cover image</param>
- private Task<bool> UpdateVolumeCoverImage(Volume volume, bool forceUpdate)
+ private Task<bool> UpdateVolumeCoverImage(Volume? volume, bool forceUpdate)
{
// We need to check if Volume coverImage matches first chapters if forceUpdate is false
if (volume == null || !_cacheHelper.ShouldUpdateCoverImage(
@@ -125,7 +120,7 @@ public class MetadataService : IMetadataService
/// </summary>
/// <param name="series"></param>
/// <param name="forceUpdate">Force updating cover image even if underlying file has not been modified or chapter already has a cover image</param>
- private Task UpdateSeriesCoverImage(Series series, bool forceUpdate)
+ private Task UpdateSeriesCoverImage(Series? series, bool forceUpdate)
{
if (series == null) return Task.CompletedTask;
@@ -199,6 +194,7 @@ public class MetadataService : IMetadataService
public async Task GenerateCoversForLibrary(int libraryId, bool forceUpdate = false)
{
var library = await _unitOfWork.LibraryRepository.GetLibraryForIdAsync(libraryId);
+ if (library == null) return;
_logger.LogInformation("[MetadataService] Beginning cover generation refresh of {LibraryName}", library.Name);
_updateEvents.Clear();
diff --git a/API/Services/ReaderService.cs b/API/Services/ReaderService.cs
index 6997e5b27..d044575f8 100644
--- a/API/Services/ReaderService.cs
+++ b/API/Services/ReaderService.cs
@@ -12,7 +12,9 @@ using API.DTOs.Reader;
using API.Entities;
using API.Entities.Enums;
using API.Extensions;
+using API.Services.Tasks;
using API.SignalR;
+using Hangfire;
using Kavita.Common;
using Microsoft.Extensions.Logging;
@@ -34,6 +36,7 @@ public interface IReaderService
Task MarkVolumesUntilAsRead(AppUser user, int seriesId, int volumeNumber);
HourEstimateRangeDto GetTimeEstimate(long wordCount, int pageCount, bool isEpub);
IDictionary<int, int> GetPairs(IEnumerable<FileDimensionDto> dimensions);
+ Task<string> GetThumbnail(Chapter chapter, int pageNum, IEnumerable<string> cachedImages);
}
public class ReaderService : IReaderService
@@ -41,6 +44,8 @@ public class ReaderService : IReaderService
private readonly IUnitOfWork _unitOfWork;
private readonly ILogger<ReaderService> _logger;
private readonly IEventHub _eventHub;
+ private readonly IImageService _imageService;
+ private readonly IDirectoryService _directoryService;
private readonly ChapterSortComparer _chapterSortComparer = ChapterSortComparer.Default;
private readonly ChapterSortComparerZeroFirst _chapterSortComparerForInChapterSorting = ChapterSortComparerZeroFirst.Default;
@@ -49,14 +54,17 @@ public class ReaderService : IReaderService
public const float AvgWordsPerHour = (MaxWordsPerHour + MinWordsPerHour) / 2F;
private const float MinPagesPerMinute = 3.33F;
private const float MaxPagesPerMinute = 2.75F;
- public const float AvgPagesPerMinute = (MaxPagesPerMinute + MinPagesPerMinute) / 2F;
+ public const float AvgPagesPerMinute = (MaxPagesPerMinute + MinPagesPerMinute) / 2F; //3.04
- public ReaderService(IUnitOfWork unitOfWork, ILogger<ReaderService> logger, IEventHub eventHub)
+ public ReaderService(IUnitOfWork unitOfWork, ILogger<ReaderService> logger, IEventHub eventHub, IImageService imageService,
+ IDirectoryService directoryService)
{
_unitOfWork = unitOfWork;
_logger = logger;
_eventHub = eventHub;
+ _imageService = imageService;
+ _directoryService = directoryService;
}
public static string FormatBookmarkFolderPath(string baseDirectory, int userId, int seriesId, int chapterId)
@@ -105,6 +113,7 @@ public class ReaderService : IReaderService
{
var seenVolume = new Dictionary<int, bool>();
var series = await _unitOfWork.SeriesRepository.GetSeriesByIdAsync(seriesId);
+ if (series == null) throw new KavitaException("Series suddenly doesn't exist, cannot mark as read");
foreach (var chapter in chapters)
{
var userProgress = GetUserProgressForChapter(user, chapter);
@@ -128,14 +137,14 @@ public class ReaderService : IReaderService
}
await _eventHub.SendMessageAsync(MessageFactory.UserProgressUpdate,
- MessageFactory.UserProgressUpdateEvent(user.Id, user.UserName, seriesId, chapter.VolumeId, chapter.Id, chapter.Pages));
+ MessageFactory.UserProgressUpdateEvent(user.Id, user.UserName!, seriesId, chapter.VolumeId, chapter.Id, chapter.Pages));
// Send out volume events for each distinct volume
if (!seenVolume.ContainsKey(chapter.VolumeId))
{
seenVolume[chapter.VolumeId] = true;
await _eventHub.SendMessageAsync(MessageFactory.UserProgressUpdate,
- MessageFactory.UserProgressUpdateEvent(user.Id, user.UserName, seriesId,
+ MessageFactory.UserProgressUpdateEvent(user.Id, user.UserName!, seriesId,
chapter.VolumeId, 0, chapters.Where(c => c.VolumeId == chapter.VolumeId).Sum(c => c.Pages)));
}
@@ -164,14 +173,14 @@ public class ReaderService : IReaderService
userProgress.VolumeId = chapter.VolumeId;
await _eventHub.SendMessageAsync(MessageFactory.UserProgressUpdate,
- MessageFactory.UserProgressUpdateEvent(user.Id, user.UserName, userProgress.SeriesId, userProgress.VolumeId, userProgress.ChapterId, 0));
+ MessageFactory.UserProgressUpdateEvent(user.Id, user.UserName!, userProgress.SeriesId, userProgress.VolumeId, userProgress.ChapterId, 0));
// Send out volume events for each distinct volume
if (!seenVolume.ContainsKey(chapter.VolumeId))
{
seenVolume[chapter.VolumeId] = true;
await _eventHub.SendMessageAsync(MessageFactory.UserProgressUpdate,
- MessageFactory.UserProgressUpdateEvent(user.Id, user.UserName, seriesId,
+ MessageFactory.UserProgressUpdateEvent(user.Id, user.UserName!, seriesId,
chapter.VolumeId, 0, 0));
}
}
@@ -184,9 +193,9 @@ public class ReaderService : IReaderService
/// <param name="user">Must have Progresses populated</param>
/// <param name="chapter"></param>
/// <returns></returns>
- private static AppUserProgress GetUserProgressForChapter(AppUser user, Chapter chapter)
+ private static AppUserProgress? GetUserProgressForChapter(AppUser user, Chapter chapter)
{
- AppUserProgress userProgress = null;
+ AppUserProgress? userProgress = null;
if (user.Progresses == null)
{
@@ -227,7 +236,7 @@ public class ReaderService : IReaderService
try
{
- // TODO: Rewrite this code to just pull user object with progress for that particiular appuserprogress, else create it
+ // TODO: Rewrite this code to just pull user object with progress for that particular appuserprogress, else create it
var userProgress =
await _unitOfWork.AppUserProgressRepository.GetUserProgressAsync(progressDto.ChapterId, userId);
@@ -237,6 +246,7 @@ public class ReaderService : IReaderService
// Create a user object
var userWithProgress =
await _unitOfWork.UserRepository.GetUserByIdAsync(userId, AppUserIncludes.Progress);
+ if (userWithProgress == null) return false;
userWithProgress.Progresses ??= new List<AppUserProgress>();
userWithProgress.Progresses.Add(new AppUserProgress
{
@@ -263,7 +273,8 @@ public class ReaderService : IReaderService
{
var user = await _unitOfWork.UserRepository.GetUserByIdAsync(userId);
await _eventHub.SendMessageAsync(MessageFactory.UserProgressUpdate,
- MessageFactory.UserProgressUpdateEvent(userId, user.UserName, progressDto.SeriesId, progressDto.VolumeId, progressDto.ChapterId, progressDto.PageNum));
+ MessageFactory.UserProgressUpdateEvent(userId, user!.UserName!, progressDto.SeriesId,
+ progressDto.VolumeId, progressDto.ChapterId, progressDto.PageNum));
return true;
}
}
@@ -384,7 +395,7 @@ public class ReaderService : IReaderService
var chapterId = GetNextChapterId(volume.Chapters.OrderByNatural(x => x.Number),
currentChapter.Range, dto => dto.Range);
if (chapterId > 0) return chapterId;
- } else if (double.Parse(firstChapter.Number) > double.Parse(currentChapter.Number)) return firstChapter.Id;
+ } else if (double.Parse(firstChapter.Number) >= double.Parse(currentChapter.Number)) return firstChapter.Id;
// If we are the last chapter and next volume is there, we should try to use it (unless it's volume 0)
else if (double.Parse(firstChapter.Number) == 0) return firstChapter.Id;
}
@@ -487,7 +498,7 @@ public class ReaderService : IReaderService
// NOTE: If volume 1 has chapter 1 and volume 2 is just chapter 0 due to being a full volume file, then this fails
// If there are any volumes that have progress, return those. If not, move on.
var currentlyReadingChapter = volumeChapters
- .OrderBy(c => double.Parse(c.Range), _chapterSortComparer)
+ .OrderBy(c => double.Parse(c.Number), _chapterSortComparer) // BUG: This is throwing an exception when Range is 1-11
.FirstOrDefault(chapter => chapter.PagesRead < chapter.Pages && chapter.PagesRead > 0);
if (currentlyReadingChapter != null) return currentlyReadingChapter;
@@ -643,6 +654,44 @@ public class ReaderService : IReaderService
return pairs;
}
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="chapter"></param>
+ /// <param name="pageNum"></param>
+ /// <param name="cachedImages"></param>
+ /// <returns>Full path of thumbnail</returns>
+ public async Task<string> GetThumbnail(Chapter chapter, int pageNum, IEnumerable<string> cachedImages)
+ {
+ var outputDirectory =
+ _directoryService.FileSystem.Path.Join(_directoryService.TempDirectory, ImageService.GetThumbnailFormat(chapter.Id));
+ try
+ {
+ var saveAsWebp =
+ (await _unitOfWork.SettingsRepository.GetSettingsDtoAsync()).ConvertBookmarkToWebP;
+
+ if (!Directory.Exists(outputDirectory))
+ {
+ var outputtedThumbnails = cachedImages
+ .Select((img, idx) =>
+ _directoryService.FileSystem.Path.Join(outputDirectory,
+ _imageService.WriteCoverThumbnail(img, $"{idx}", outputDirectory, saveAsWebp)))
+ .ToArray();
+ return CacheService.GetPageFromFiles(outputtedThumbnails, pageNum);
+ }
+
+ var files = _directoryService.GetFilesWithExtension(outputDirectory,
+ Tasks.Scanner.Parser.Parser.ImageFileExtensions);
+ return CacheService.GetPageFromFiles(files, pageNum);
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "There was an error when trying to get thumbnail for Chapter {ChapterId}, Page {PageNum}", chapter.Id, pageNum);
+ _directoryService.ClearAndDeleteDirectory(outputDirectory);
+ throw;
+ }
+ }
+
/// <summary>
/// Formats a Chapter name based on the library it's in
/// </summary>
@@ -667,4 +716,6 @@ public class ReaderService : IReaderService
throw new ArgumentOutOfRangeException(nameof(libraryType), libraryType, null);
}
}
+
+
}
diff --git a/API/Services/ReadingItemService.cs b/API/Services/ReadingItemService.cs
index 14ced8674..1ef67c1ce 100644
--- a/API/Services/ReadingItemService.cs
+++ b/API/Services/ReadingItemService.cs
@@ -1,19 +1,17 @@
using System;
using API.Data.Metadata;
using API.Entities.Enums;
-using API.Parser;
using API.Services.Tasks.Scanner.Parser;
namespace API.Services;
public interface IReadingItemService
{
- ComicInfo GetComicInfo(string filePath);
+ ComicInfo? GetComicInfo(string filePath);
int GetNumberOfPages(string filePath, MangaFormat format);
string GetCoverImage(string filePath, string fileName, MangaFormat format, bool saveAsWebP);
void Extract(string fileFilePath, string targetDirectory, MangaFormat format, int imageCount = 1);
- ParserInfo Parse(string path, string rootPath, LibraryType type);
- ParserInfo ParseFile(string path, string rootPath, LibraryType type);
+ ParserInfo? ParseFile(string path, string rootPath, LibraryType type);
}
public class ReadingItemService : IReadingItemService
@@ -41,12 +39,12 @@ public class ReadingItemService : IReadingItemService
/// <returns></returns>
public ComicInfo? GetComicInfo(string filePath)
{
- if (Tasks.Scanner.Parser.Parser.IsEpub(filePath))
+ if (Parser.IsEpub(filePath))
{
return _bookService.GetComicInfo(filePath);
}
- if (Tasks.Scanner.Parser.Parser.IsComicInfoExtension(filePath))
+ if (Parser.IsComicInfoExtension(filePath))
{
return _archiveService.GetComicInfo(filePath);
}
@@ -60,7 +58,7 @@ public class ReadingItemService : IReadingItemService
/// <param name="path">Path of a file</param>
/// <param name="rootPath"></param>
/// <param name="type">Library type to determine parsing to perform</param>
- public ParserInfo ParseFile(string path, string rootPath, LibraryType type)
+ public ParserInfo? ParseFile(string path, string rootPath, LibraryType type)
{
var info = Parse(path, rootPath, type);
if (info == null)
@@ -70,18 +68,18 @@ public class ReadingItemService : IReadingItemService
// This catches when original library type is Manga/Comic and when parsing with non
- if (Tasks.Scanner.Parser.Parser.IsEpub(path) && Tasks.Scanner.Parser.Parser.ParseVolume(info.Series) != Tasks.Scanner.Parser.Parser.DefaultVolume) // Shouldn't this be info.Volume != DefaultVolume?
+ if (Parser.IsEpub(path) && Parser.ParseVolume(info.Series) != Parser.DefaultVolume) // Shouldn't this be info.Volume != DefaultVolume?
{
- var hasVolumeInTitle = !Tasks.Scanner.Parser.Parser.ParseVolume(info.Title)
- .Equals(Tasks.Scanner.Parser.Parser.DefaultVolume);
- var hasVolumeInSeries = !Tasks.Scanner.Parser.Parser.ParseVolume(info.Series)
- .Equals(Tasks.Scanner.Parser.Parser.DefaultVolume);
+ var hasVolumeInTitle = !Parser.ParseVolume(info.Title)
+ .Equals(Parser.DefaultVolume);
+ var hasVolumeInSeries = !Parser.ParseVolume(info.Series)
+ .Equals(Parser.DefaultVolume);
if (string.IsNullOrEmpty(info.ComicInfo?.Volume) && hasVolumeInTitle && (hasVolumeInSeries || string.IsNullOrEmpty(info.Series)))
{
// This is likely a light novel for which we can set series from parsed title
- info.Series = Tasks.Scanner.Parser.Parser.ParseSeries(info.Title);
- info.Volumes = Tasks.Scanner.Parser.Parser.ParseVolume(info.Title);
+ info.Series = Parser.ParseSeries(info.Title);
+ info.Volumes = Parser.ParseVolume(info.Title);
}
else
{
@@ -113,11 +111,11 @@ public class ReadingItemService : IReadingItemService
info.SeriesSort = info.ComicInfo.TitleSort.Trim();
}
- if (!string.IsNullOrEmpty(info.ComicInfo.Format) && Tasks.Scanner.Parser.Parser.HasComicInfoSpecial(info.ComicInfo.Format))
+ if (!string.IsNullOrEmpty(info.ComicInfo.Format) && Parser.HasComicInfoSpecial(info.ComicInfo.Format))
{
info.IsSpecial = true;
- info.Chapters = Tasks.Scanner.Parser.Parser.DefaultChapter;
- info.Volumes = Tasks.Scanner.Parser.Parser.DefaultVolume;
+ info.Chapters = Parser.DefaultChapter;
+ info.Volumes = Parser.DefaultVolume;
}
if (!string.IsNullOrEmpty(info.ComicInfo.SeriesSort))
@@ -216,8 +214,8 @@ public class ReadingItemService : IReadingItemService
/// <param name="rootPath"></param>
/// <param name="type"></param>
/// <returns></returns>
- public ParserInfo Parse(string path, string rootPath, LibraryType type)
+ private ParserInfo? Parse(string path, string rootPath, LibraryType type)
{
- return Tasks.Scanner.Parser.Parser.IsEpub(path) ? _bookService.ParseInfo(path) : _defaultParser.Parse(path, rootPath, type);
+ return Parser.IsEpub(path) ? _bookService.ParseInfo(path) : _defaultParser.Parse(path, rootPath, type);
}
}
diff --git a/API/Services/ReadingListService.cs b/API/Services/ReadingListService.cs
index 746bfdd5f..76202d63b 100644
--- a/API/Services/ReadingListService.cs
+++ b/API/Services/ReadingListService.cs
@@ -7,14 +7,17 @@ using System.Threading.Tasks;
using API.Comparators;
using API.Data;
using API.Data.Repositories;
-using API.DTOs;
using API.DTOs.ReadingLists;
using API.DTOs.ReadingLists.CBL;
using API.Entities;
using API.Entities.Enums;
+using API.Helpers;
+using API.Helpers.Builders;
+using API.Services.Tasks.Scanner.Parser;
using API.SignalR;
using Kavita.Common;
using Microsoft.Extensions.Logging;
+using Microsoft.IdentityModel.Tokens;
namespace API.Services;
@@ -33,12 +36,21 @@ public interface IReadingListService
Task<CblImportSummaryDto> ValidateCblFile(int userId, CblReadingList cblReading);
Task<CblImportSummaryDto> CreateReadingListFromCbl(int userId, CblReadingList cblReading, bool dryRun = false);
+ Task CalculateStartAndEndDates(ReadingList readingListWithItems);
+ Task<string> GenerateMergedImage(int readingListId);
+ /// <summary>
+ /// This is expected to be called from ProcessSeries and has the Full Series present. Will generate on the default admin user.
+ /// </summary>
+ /// <param name="series"></param>
+ /// <param name="library"></param>
+ /// <returns></returns>
+ Task CreateReadingListsFromSeries(Series series, Library library);
}
/// <summary>
/// Methods responsible for management of Reading Lists
/// </summary>
-/// <remarks>If called from API layer, expected for <see cref="UserHasReadingListAccess"/> to be called beforehand</remarks>
+/// <remarks>If called from API layer, expected for <see cref="UserHasReadingListAccess(int, String)"/> to be called beforehand</remarks>
public class ReadingListService : IReadingListService
{
private readonly IUnitOfWork _unitOfWork;
@@ -116,7 +128,7 @@ public class ReadingListService : IReadingListService
throw new KavitaException("A list of this name already exists");
}
- var readingList = DbFactory.ReadingList(title, string.Empty, false);
+ var readingList = new ReadingListBuilder(title).Build();
userWithReadingList.ReadingLists.Add(readingList);
if (!_unitOfWork.HasChanges()) throw new KavitaException("There was a problem creating list");
@@ -140,10 +152,29 @@ public class ReadingListService : IReadingListService
readingList.Summary = dto.Summary;
readingList.Title = dto.Title.Trim();
- readingList.NormalizedTitle = Tasks.Scanner.Parser.Parser.Normalize(readingList.Title);
+ readingList.NormalizedTitle = Parser.Normalize(readingList.Title);
readingList.Promoted = dto.Promoted;
readingList.CoverImageLocked = dto.CoverImageLocked;
+
+ if (NumberHelper.IsValidMonth(dto.StartingMonth))
+ {
+ readingList.StartingMonth = dto.StartingMonth;
+ }
+ if (NumberHelper.IsValidYear(dto.StartingYear))
+ {
+ readingList.StartingYear = dto.StartingYear;
+ }
+ if (NumberHelper.IsValidMonth(dto.EndingMonth))
+ {
+ readingList.EndingMonth = dto.EndingMonth;
+ }
+ if (NumberHelper.IsValidYear(dto.EndingYear))
+ {
+ readingList.EndingYear = dto.EndingYear;
+ }
+
+
if (!dto.CoverImageLocked)
{
readingList.CoverImageLocked = false;
@@ -162,7 +193,7 @@ public class ReadingListService : IReadingListService
/// <summary>
/// Removes all entries that are fully read from the reading list. This commits
/// </summary>
- /// <remarks>If called from API layer, expected for <see cref="UserHasReadingListAccess"/> to be called beforehand</remarks>
+ /// <remarks>If called from API layer, expected for <see cref="UserHasReadingListAccess(int, String)"/> to be called beforehand</remarks>
/// <param name="readingListId">Reading List Id</param>
/// <param name="user">User</param>
/// <returns></returns>
@@ -172,8 +203,9 @@ public class ReadingListService : IReadingListService
items = await _unitOfWork.ReadingListRepository.AddReadingProgressModifiers(user.Id, items.ToList());
// Collect all Ids to remove
- var itemIdsToRemove = items.Where(item => item.PagesRead == item.PagesTotal).Select(item => item.Id);
+ var itemIdsToRemove = items.Where(item => item.PagesRead == item.PagesTotal).Select(item => item.Id).ToList();
+ if (!itemIdsToRemove.Any()) return true;
try
{
var listItems =
@@ -182,10 +214,11 @@ public class ReadingListService : IReadingListService
_unitOfWork.ReadingListRepository.BulkRemove(listItems);
var readingList = await _unitOfWork.ReadingListRepository.GetReadingListByIdAsync(readingListId);
+ if (readingList == null) return true;
await CalculateReadingListAgeRating(readingList);
+ await CalculateStartAndEndDates(readingList);
if (!_unitOfWork.HasChanges()) return true;
-
return await _unitOfWork.CommitAsync();
}
catch
@@ -204,18 +237,26 @@ public class ReadingListService : IReadingListService
public async Task<bool> UpdateReadingListItemPosition(UpdateReadingListPosition dto)
{
var items = (await _unitOfWork.ReadingListRepository.GetReadingListItemsByIdAsync(dto.ReadingListId)).ToList();
- var item = items.Find(r => r.Id == dto.ReadingListItemId);
- items.Remove(item);
- items.Insert(dto.ToPosition, item);
+ ReorderItems(items, dto.ReadingListItemId, dto.ToPosition);
+
+ if (!_unitOfWork.HasChanges()) return true;
+
+ return await _unitOfWork.CommitAsync();
+ }
+
+ private static void ReorderItems(List<ReadingListItem> items, int readingListItemId, int toPosition)
+ {
+ var item = items.Find(r => r.Id == readingListItemId);
+ if (item != null)
+ {
+ items.Remove(item);
+ items.Insert(toPosition, item);
+ }
for (var i = 0; i < items.Count; i++)
{
items[i].Order = i;
}
-
- if (!_unitOfWork.HasChanges()) return true;
-
- return await _unitOfWork.CommitAsync();
}
/// <summary>
@@ -226,6 +267,7 @@ public class ReadingListService : IReadingListService
public async Task<bool> DeleteReadingListItem(UpdateReadingListPosition dto)
{
var readingList = await _unitOfWork.ReadingListRepository.GetReadingListByIdAsync(dto.ReadingListId);
+ if (readingList == null) return false;
readingList.Items = readingList.Items.Where(r => r.Id != dto.ReadingListItemId).OrderBy(r => r.Order).ToList();
var index = 0;
@@ -236,6 +278,7 @@ public class ReadingListService : IReadingListService
}
await CalculateReadingListAgeRating(readingList);
+ await CalculateStartAndEndDates(readingList);
if (!_unitOfWork.HasChanges()) return true;
@@ -251,6 +294,52 @@ public class ReadingListService : IReadingListService
await CalculateReadingListAgeRating(readingList, readingList.Items.Select(i => i.SeriesId));
}
+ /// <summary>
+ /// Calculates the Start month/year and Ending month/year
+ /// </summary>
+ /// <param name="readingListWithItems">Reading list should have all items and Chapters</param>
+ public async Task CalculateStartAndEndDates(ReadingList readingListWithItems)
+ {
+ var items = readingListWithItems.Items;
+ if (readingListWithItems.Items.All(i => i.Chapter == null))
+ {
+ items =
+ (await _unitOfWork.ReadingListRepository.GetReadingListByIdAsync(readingListWithItems.Id, ReadingListIncludes.ItemChapter))?.Items;
+ }
+ if (items == null || items.Count == 0) return;
+
+ if (items.First().Chapter == null)
+ {
+ _logger.LogError("Tried to calculate release dates for Reading List, but missing Chapter entities");
+ return;
+ }
+ var maxReleaseDate = items.Where(item => item.Chapter != null).Max(item => item.Chapter.ReleaseDate);
+ var minReleaseDate = items.Where(item => item.Chapter != null).Min(item => item.Chapter.ReleaseDate);
+ if (maxReleaseDate != DateTime.MinValue)
+ {
+ readingListWithItems.EndingMonth = maxReleaseDate.Month;
+ readingListWithItems.EndingYear = maxReleaseDate.Year;
+ }
+ if (minReleaseDate != DateTime.MinValue)
+ {
+ readingListWithItems.StartingMonth = minReleaseDate.Month;
+ readingListWithItems.StartingYear = minReleaseDate.Year;
+ }
+ }
+
+ public Task<string?> GenerateMergedImage(int readingListId)
+ {
+ throw new NotImplementedException();
+ // var coverImages = (await _unitOfWork.ReadingListRepository.GetFirstFourCoverImagesByReadingListId(readingListId)).ToList();
+ // if (coverImages.Count < 4) return null;
+ // var fullImages = coverImages
+ // .Select(c => _directoryService.FileSystem.Path.Join(_directoryService.CoverImageDirectory, c)).ToList();
+ //
+ // var combinedFile = ImageService.CreateMergedImage(fullImages, _directoryService.FileSystem.Path.Join(_directoryService.TempDirectory, $"{readingListId}.png"));
+ // // webp needs to be handled
+ // return combinedFile;
+ }
+
/// <summary>
/// Calculates the highest Age Rating from each Reading List Item
/// </summary>
@@ -260,7 +349,8 @@ public class ReadingListService : IReadingListService
private async Task CalculateReadingListAgeRating(ReadingList readingList, IEnumerable<int> seriesIds)
{
var ageRating = await _unitOfWork.SeriesRepository.GetMaxAgeRatingFromSeriesAsync(seriesIds);
- readingList.AgeRating = ageRating;
+ if (ageRating == null) readingList.AgeRating = AgeRating.Unknown;
+ else readingList.AgeRating = (AgeRating) ageRating;
}
/// <summary>
@@ -274,7 +364,7 @@ public class ReadingListService : IReadingListService
// We need full reading list with items as this is used by many areas that manipulate items
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(username,
AppUserIncludes.ReadingListsWithItems);
- if (!await UserHasReadingListAccess(readingListId, user))
+ if (user == null || !await UserHasReadingListAccess(readingListId, user))
{
return null;
}
@@ -302,6 +392,7 @@ public class ReadingListService : IReadingListService
public async Task<bool> DeleteReadingList(int readingListId, AppUser user)
{
var readingList = await _unitOfWork.ReadingListRepository.GetReadingListByIdAsync(readingListId);
+ if (readingList == null) return true;
user.ReadingLists.Remove(readingList);
if (!_unitOfWork.HasChanges()) return true;
@@ -322,7 +413,7 @@ public class ReadingListService : IReadingListService
var lastOrder = 0;
if (readingList.Items.Any())
{
- lastOrder = readingList.Items.DefaultIfEmpty().Max(rli => rli.Order);
+ lastOrder = readingList.Items.DefaultIfEmpty().Max(rli => rli!.Order);
}
var existingChapterExists = readingList.Items.Select(rli => rli.ChapterId).ToHashSet();
@@ -334,7 +425,7 @@ public class ReadingListService : IReadingListService
var index = readingList.Items.Count == 0 ? 0 : lastOrder + 1;
foreach (var chapter in chaptersForSeries.Where(chapter => !existingChapterExists.Contains(chapter.Id)))
{
- readingList.Items.Add(DbFactory.ReadingListItem(index, seriesId, chapter.VolumeId, chapter.Id));
+ readingList.Items.Add(new ReadingListItemBuilder(index, seriesId, chapter.VolumeId, chapter.Id).Build());
index += 1;
}
@@ -343,6 +434,106 @@ public class ReadingListService : IReadingListService
return index > lastOrder + 1;
}
+ public async Task CreateReadingListsFromSeries(Series series, Library library)
+ {
+ if (!library.ManageReadingLists) return;
+
+ var hasReadingListMarkers = series.Volumes
+ .SelectMany(c => c.Chapters)
+ .Any(c => !string.IsNullOrEmpty(c.StoryArc) || !string.IsNullOrEmpty(c.AlternateSeries));
+
+ if (!hasReadingListMarkers) return;
+
+ _logger.LogInformation("Processing Reading Lists for {SeriesName}", series.Name);
+ var user = await _unitOfWork.UserRepository.GetDefaultAdminUser();
+ series.Metadata ??= new SeriesMetadataBuilder().Build();
+ foreach (var chapter in series.Volumes.SelectMany(v => v.Chapters))
+ {
+ var pairs = new List<Tuple<string, string>>();
+ if (!string.IsNullOrEmpty(chapter.StoryArc))
+ {
+ pairs.AddRange(GeneratePairs(chapter.Files.FirstOrDefault()!.FilePath, chapter.StoryArc, chapter.StoryArcNumber));
+ }
+ if (!string.IsNullOrEmpty(chapter.AlternateSeries))
+ {
+ pairs.AddRange(GeneratePairs(chapter.Files.FirstOrDefault()!.FilePath, chapter.AlternateSeries, chapter.AlternateNumber));
+ }
+
+ foreach (var arcPair in pairs)
+ {
+ var readingList = await _unitOfWork.ReadingListRepository.GetReadingListByTitleAsync(arcPair.Item1, user.Id);
+ if (readingList == null)
+ {
+ readingList = new ReadingListBuilder(arcPair.Item1)
+ .WithAppUserId(user.Id)
+ .Build();
+ _unitOfWork.ReadingListRepository.Add(readingList);
+
+ }
+
+ var items = readingList.Items.ToList();
+ var order = int.Parse(arcPair.Item2);
+ var readingListItem = items.FirstOrDefault(item => item.Order == order || item.ChapterId == chapter.Id);
+ if (readingListItem == null)
+ {
+ // If no number was provided in the reading list, we default to MaxValue and hence we should insert the item at the end of the list
+ if (order == int.MaxValue)
+ {
+ order = items.Count > 0 ? items.Max(item => item.Order) + 1 : 0;
+ }
+ items.Add(new ReadingListItemBuilder(order, series.Id, chapter.VolumeId, chapter.Id).Build());
+ }
+ else
+ {
+ if (order == int.MaxValue)
+ {
+ _logger.LogWarning("{Filename} has a missing StoryArcNumber/AlternativeNumber but list already exists with this item. Skipping item", chapter.Files.FirstOrDefault()?.FilePath);
+ }
+ else
+ {
+ ReorderItems(items, readingListItem.Id, order);
+ }
+ }
+
+ readingList.Items = items;
+ await CalculateReadingListAgeRating(readingList);
+ if (_unitOfWork.HasChanges())
+ {
+ await _unitOfWork.CommitAsync();
+ }
+ await CalculateStartAndEndDates(await _unitOfWork.ReadingListRepository.GetReadingListByTitleAsync(arcPair.Item1, user.Id, ReadingListIncludes.Items | ReadingListIncludes.ItemChapter));
+ await _unitOfWork.CommitAsync();
+ }
+ }
+ }
+
+ private IEnumerable<Tuple<string, string>> GeneratePairs(string filename, string storyArc, string storyArcNumbers)
+ {
+ var data = new List<Tuple<string, string>>();
+ if (string.IsNullOrEmpty(storyArc)) return data;
+
+ var arcs = storyArc.Split(",");
+ var arcNumbers = storyArcNumbers.Split(",");
+ if (arcNumbers.Count(s => !string.IsNullOrEmpty(s)) != arcs.Length)
+ {
+ _logger.LogWarning("There is a mismatch on StoryArc and StoryArcNumber for {FileName}. Def", filename);
+ }
+
+ var maxPairs = Math.Min(arcs.Length, arcNumbers.Length);
+ for (var i = 0; i < maxPairs; i++)
+ {
+ // When there is a mismatch on arcs and arc numbers, then we should default to a high number
+ if (string.IsNullOrEmpty(arcNumbers[i]) && !string.IsNullOrEmpty(arcs[i]))
+ {
+ arcNumbers[i] = int.MaxValue.ToString();
+ }
+ if (string.IsNullOrEmpty(arcs[i]) || !int.TryParse(arcNumbers[i], out _)) continue;
+ data.Add(new Tuple<string, string>(arcs[i], arcNumbers[i]));
+ }
+
+ return data;
+ }
+
/// <summary>
/// Check for File issues like: No entries, Reading List Name collision, Duplicate Series across Libraries
/// </summary>
@@ -355,13 +546,22 @@ public class ReadingListService : IReadingListService
CblName = cblReading.Name,
Success = CblImportResult.Success,
Results = new List<CblBookResult>(),
- SuccessfulInserts = new List<CblBookResult>(),
- Conflicts = new List<SeriesDto>(),
- Conflicts2 = new List<CblConflictQuestion>()
+ SuccessfulInserts = new List<CblBookResult>()
};
if (IsCblEmpty(cblReading, importSummary, out var readingListFromCbl)) return readingListFromCbl;
- var uniqueSeries = cblReading.Books.Book.Select(b => Tasks.Scanner.Parser.Parser.Normalize(b.Series)).Distinct();
+ // Is there another reading list with the same name?
+ if (await _unitOfWork.ReadingListRepository.ReadingListExists(cblReading.Name))
+ {
+ importSummary.Success = CblImportResult.Fail;
+ importSummary.Results.Add(new CblBookResult()
+ {
+ Reason = CblImportReason.NameConflict,
+ ReadingListName = cblReading.Name
+ });
+ }
+
+ var uniqueSeries = cblReading.Books.Book.Select(b => Tasks.Scanner.Parser.Parser.Normalize(b.Series)).Distinct().ToList();
var userSeries =
(await _unitOfWork.SeriesRepository.GetAllSeriesByNameAsync(uniqueSeries, userId, SeriesIncludes.Chapters)).ToList();
if (!userSeries.Any())
@@ -379,24 +579,16 @@ public class ReadingListService : IReadingListService
if (!conflicts.Any()) return importSummary;
importSummary.Success = CblImportResult.Fail;
- if (conflicts.Count == cblReading.Books.Book.Count)
+ foreach (var conflict in conflicts)
{
importSummary.Results.Add(new CblBookResult()
{
- Reason = CblImportReason.AllChapterMissing,
+ Reason = CblImportReason.SeriesCollision,
+ Series = conflict.Name,
+ LibraryId = conflict.LibraryId,
+ SeriesId = conflict.Id,
});
}
- else
- {
- foreach (var conflict in conflicts)
- {
- importSummary.Results.Add(new CblBookResult()
- {
- Reason = CblImportReason.SeriesCollision,
- Series = conflict.Name
- });
- }
- }
return importSummary;
}
@@ -412,7 +604,7 @@ public class ReadingListService : IReadingListService
public async Task<CblImportSummaryDto> CreateReadingListFromCbl(int userId, CblReadingList cblReading, bool dryRun = false)
{
var user = await _unitOfWork.UserRepository.GetUserByIdAsync(userId, AppUserIncludes.ReadingListsWithItems);
- _logger.LogDebug("Importing {ReadingListName} CBL for User {UserName}", cblReading.Name, user.UserName);
+ _logger.LogDebug("Importing {ReadingListName} CBL for User {UserName}", cblReading.Name, user!.UserName);
var importSummary = new CblImportSummaryDto()
{
CblName = cblReading.Name,
@@ -421,17 +613,18 @@ public class ReadingListService : IReadingListService
SuccessfulInserts = new List<CblBookResult>()
};
- var uniqueSeries = cblReading.Books.Book.Select(b => Tasks.Scanner.Parser.Parser.Normalize(b.Series)).Distinct();
+ var uniqueSeries = cblReading.Books.Book.Select(b => Tasks.Scanner.Parser.Parser.Normalize(b.Series)).Distinct().ToList();
var userSeries =
(await _unitOfWork.SeriesRepository.GetAllSeriesByNameAsync(uniqueSeries, userId, SeriesIncludes.Chapters)).ToList();
var allSeries = userSeries.ToDictionary(s => Tasks.Scanner.Parser.Parser.Normalize(s.Name));
+ var allSeriesLocalized = userSeries.ToDictionary(s => Tasks.Scanner.Parser.Parser.Normalize(s.LocalizedName));
var readingListNameNormalized = Tasks.Scanner.Parser.Parser.Normalize(cblReading.Name);
// Get all the user's reading lists
var allReadingLists = (user.ReadingLists).ToDictionary(s => s.NormalizedTitle);
if (!allReadingLists.TryGetValue(readingListNameNormalized, out var readingList))
{
- readingList = DbFactory.ReadingList(cblReading.Name, string.Empty, false);
+ readingList = new ReadingListBuilder(cblReading.Name).WithSummary(cblReading.Summary).Build();
user.ReadingLists.Add(readingList);
}
else
@@ -452,38 +645,54 @@ public class ReadingListService : IReadingListService
foreach (var (book, i) in cblReading.Books.Book.Select((value, i) => ( value, i )))
{
var normalizedSeries = Tasks.Scanner.Parser.Parser.Normalize(book.Series);
- if (!allSeries.TryGetValue(normalizedSeries, out var bookSeries))
+ if (!allSeries.TryGetValue(normalizedSeries, out var bookSeries) && !allSeriesLocalized.TryGetValue(normalizedSeries, out bookSeries))
{
importSummary.Results.Add(new CblBookResult(book)
{
- Reason = CblImportReason.SeriesMissing
+ Reason = CblImportReason.SeriesMissing,
+ Order = i
});
continue;
}
// Prioritize lookup by Volume then Chapter, but allow fallback to just Chapter
- var matchingVolume = bookSeries.Volumes.FirstOrDefault(v => book.Volume == v.Name) ?? bookSeries.Volumes.FirstOrDefault(v => v.Number == 0);
+ var bookVolume = string.IsNullOrEmpty(book.Volume)
+ ? Tasks.Scanner.Parser.Parser.DefaultVolume
+ : book.Volume;
+ var matchingVolume = bookSeries.Volumes.FirstOrDefault(v => bookVolume == v.Name) ?? bookSeries.Volumes.FirstOrDefault(v => v.Number == 0);
if (matchingVolume == null)
{
importSummary.Results.Add(new CblBookResult(book)
{
- Reason = CblImportReason.VolumeMissing
+ Reason = CblImportReason.VolumeMissing,
+ LibraryId = bookSeries.LibraryId,
+ Order = i
});
continue;
}
- var chapter = matchingVolume.Chapters.FirstOrDefault(c => c.Number == book.Number);
+ // We need to handle chapter 0 or empty string when it's just a volume
+ var bookNumber = string.IsNullOrEmpty(book.Number)
+ ? Tasks.Scanner.Parser.Parser.DefaultChapter
+ : book.Number;
+ var chapter = matchingVolume.Chapters.FirstOrDefault(c => c.Number == bookNumber);
if (chapter == null)
{
importSummary.Results.Add(new CblBookResult(book)
{
- Reason = CblImportReason.ChapterMissing
+ Reason = CblImportReason.ChapterMissing,
+ LibraryId = bookSeries.LibraryId,
+ Order = i
});
continue;
}
// See if a matching item already exists
ExistsOrAddReadingListItem(readingList, bookSeries.Id, matchingVolume.Id, chapter.Id);
- importSummary.SuccessfulInserts.Add(new CblBookResult(book));
+ importSummary.SuccessfulInserts.Add(new CblBookResult(book)
+ {
+ Reason = CblImportReason.Success,
+ Order = i
+ });
}
if (importSummary.SuccessfulInserts.Count != cblReading.Books.Book.Count || importSummary.Results.Count > 0)
@@ -491,11 +700,29 @@ public class ReadingListService : IReadingListService
importSummary.Success = CblImportResult.Partial;
}
+ if (importSummary.SuccessfulInserts.Count == 0 && importSummary.Results.Count == cblReading.Books.Book.Count)
+ {
+ importSummary.Success = CblImportResult.Fail;
+ }
+
+ if (dryRun) return importSummary;
+
await CalculateReadingListAgeRating(readingList);
+ await CalculateStartAndEndDates(readingList);
- if (!dryRun) return importSummary;
+ // For CBL Import only we override pre-calculated dates
+ if (NumberHelper.IsValidMonth(cblReading.StartMonth)) readingList.StartingMonth = cblReading.StartMonth;
+ if (NumberHelper.IsValidYear(cblReading.StartYear)) readingList.StartingYear = cblReading.StartYear;
+ if (NumberHelper.IsValidMonth(cblReading.EndMonth)) readingList.EndingMonth = cblReading.EndMonth;
+ if (NumberHelper.IsValidYear(cblReading.EndYear)) readingList.EndingYear = cblReading.EndYear;
+
+ if (!string.IsNullOrEmpty(readingList.Summary?.Trim()))
+ {
+ readingList.Summary = readingList.Summary?.Trim();
+ }
- if (!_unitOfWork.HasChanges()) return importSummary;
+ // If there are no items, don't create a blank list
+ if (!_unitOfWork.HasChanges() || !readingList.Items.Any()) return importSummary;
await _unitOfWork.CommitAsync();
@@ -533,8 +760,8 @@ public class ReadingListService : IReadingListService
item.SeriesId == seriesId && item.ChapterId == chapterId);
if (readingListItem != null) return;
- readingListItem = DbFactory.ReadingListItem(readingList.Items.Count, seriesId,
- volumeId, chapterId);
+ readingListItem = new ReadingListItemBuilder(readingList.Items.Count, seriesId,
+ volumeId, chapterId).Build();
readingList.Items.Add(readingListItem);
}
diff --git a/API/Services/SeriesService.cs b/API/Services/SeriesService.cs
index 42cb77049..bbec61d7f 100644
--- a/API/Services/SeriesService.cs
+++ b/API/Services/SeriesService.cs
@@ -8,14 +8,13 @@ using API.Data;
using API.Data.Repositories;
using API.DTOs;
using API.DTOs.CollectionTags;
-using API.DTOs.Metadata;
using API.DTOs.SeriesDetail;
using API.Entities;
using API.Entities.Enums;
using API.Entities.Metadata;
using API.Helpers;
+using API.Helpers.Builders;
using API.SignalR;
-using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
namespace API.Services;
@@ -52,7 +51,7 @@ public class SeriesService : ISeriesService
/// <param name="series"></param>
/// <param name="isBookLibrary"></param>
/// <returns></returns>
- public static Chapter GetFirstChapterForMetadata(Series series, bool isBookLibrary)
+ public static Chapter? GetFirstChapterForMetadata(Series series, bool isBookLibrary)
{
return series.Volumes.OrderBy(v => v.Number, ChapterSortComparer.Default)
.SelectMany(v => v.Chapters.OrderBy(c => float.Parse(c.Number), ChapterSortComparer.Default))
@@ -65,13 +64,20 @@ public class SeriesService : ISeriesService
{
var seriesId = updateSeriesMetadataDto.SeriesMetadata.SeriesId;
var series = await _unitOfWork.SeriesRepository.GetSeriesByIdAsync(seriesId);
+ if (series == null) return false;
var allCollectionTags = (await _unitOfWork.CollectionTagRepository.GetAllTagsAsync()).ToList();
var allGenres = (await _unitOfWork.GenreRepository.GetAllGenresAsync()).ToList();
var allPeople = (await _unitOfWork.PersonRepository.GetAllPeople()).ToList();
var allTags = (await _unitOfWork.TagRepository.GetAllTagsAsync()).ToList();
- series.Metadata ??= DbFactory.SeriesMetadata(updateSeriesMetadataDto.CollectionTags
- .Select(dto => DbFactory.CollectionTag(dto.Id, dto.Title, dto.Summary, dto.Promoted)).ToList());
+ series.Metadata ??= new SeriesMetadataBuilder()
+ .WithCollectionTags(updateSeriesMetadataDto.CollectionTags.Select(dto =>
+ new CollectionTagBuilder(dto.Title)
+ .WithId(dto.Id)
+ .WithSummary(dto.Summary)
+ .WithIsPromoted(dto.Promoted)
+ .Build()).ToList())
+ .Build();
if (series.Metadata.AgeRating != updateSeriesMetadataDto.SeriesMetadata.AgeRating)
{
@@ -79,7 +85,7 @@ public class SeriesService : ISeriesService
series.Metadata.AgeRatingLocked = true;
}
- if (updateSeriesMetadataDto.SeriesMetadata.ReleaseYear > 1000 && series.Metadata.ReleaseYear != updateSeriesMetadataDto.SeriesMetadata.ReleaseYear)
+ if (NumberHelper.IsValidYear(updateSeriesMetadataDto.SeriesMetadata.ReleaseYear) && series.Metadata.ReleaseYear != updateSeriesMetadataDto.SeriesMetadata.ReleaseYear)
{
series.Metadata.ReleaseYear = updateSeriesMetadataDto.SeriesMetadata.ReleaseYear;
series.Metadata.ReleaseYearLocked = true;
@@ -104,13 +110,13 @@ public class SeriesService : ISeriesService
if (series.Metadata.Summary != updateSeriesMetadataDto.SeriesMetadata.Summary.Trim())
{
- series.Metadata.Summary = updateSeriesMetadataDto.SeriesMetadata?.Summary.Trim();
+ series.Metadata.Summary = updateSeriesMetadataDto.SeriesMetadata?.Summary.Trim() ?? string.Empty;
series.Metadata.SummaryLocked = true;
}
if (series.Metadata.Language != updateSeriesMetadataDto.SeriesMetadata?.Language)
{
- series.Metadata.Language = updateSeriesMetadataDto.SeriesMetadata?.Language;
+ series.Metadata.Language = updateSeriesMetadataDto.SeriesMetadata?.Language ?? string.Empty;
series.Metadata.LanguageLocked = true;
}
@@ -121,13 +127,13 @@ public class SeriesService : ISeriesService
});
series.Metadata.Genres ??= new List<Genre>();
- UpdateGenreList(updateSeriesMetadataDto.SeriesMetadata?.Genres, series, allGenres, (genre) =>
+ GenreHelper.UpdateGenreList(updateSeriesMetadataDto.SeriesMetadata?.Genres, series, allGenres, (genre) =>
{
series.Metadata.Genres.Add(genre);
}, () => series.Metadata.GenresLocked = true);
series.Metadata.Tags ??= new List<Tag>();
- UpdateTagList(updateSeriesMetadataDto.SeriesMetadata.Tags, series, allTags, (tag) =>
+ TagHelper.UpdateTagList(updateSeriesMetadataDto.SeriesMetadata?.Tags, series, allTags, (tag) =>
{
series.Metadata.Tags.Add(tag);
}, () => series.Metadata.TagsLocked = true);
@@ -139,25 +145,25 @@ public class SeriesService : ISeriesService
}
series.Metadata.People ??= new List<Person>();
- UpdatePeopleList(PersonRole.Writer, updateSeriesMetadataDto.SeriesMetadata.Writers, series, allPeople,
+ PersonHelper.UpdatePeopleList(PersonRole.Writer, updateSeriesMetadataDto.SeriesMetadata!.Writers, series, allPeople,
HandleAddPerson, () => series.Metadata.WriterLocked = true);
- UpdatePeopleList(PersonRole.Character, updateSeriesMetadataDto.SeriesMetadata.Characters, series, allPeople,
+ PersonHelper.UpdatePeopleList(PersonRole.Character, updateSeriesMetadataDto.SeriesMetadata.Characters, series, allPeople,
HandleAddPerson, () => series.Metadata.CharacterLocked = true);
- UpdatePeopleList(PersonRole.Colorist, updateSeriesMetadataDto.SeriesMetadata.Colorists, series, allPeople,
+ PersonHelper.UpdatePeopleList(PersonRole.Colorist, updateSeriesMetadataDto.SeriesMetadata.Colorists, series, allPeople,
HandleAddPerson, () => series.Metadata.ColoristLocked = true);
- UpdatePeopleList(PersonRole.Editor, updateSeriesMetadataDto.SeriesMetadata.Editors, series, allPeople,
+ PersonHelper.UpdatePeopleList(PersonRole.Editor, updateSeriesMetadataDto.SeriesMetadata.Editors, series, allPeople,
HandleAddPerson, () => series.Metadata.EditorLocked = true);
- UpdatePeopleList(PersonRole.Inker, updateSeriesMetadataDto.SeriesMetadata.Inkers, series, allPeople,
+ PersonHelper.UpdatePeopleList(PersonRole.Inker, updateSeriesMetadataDto.SeriesMetadata.Inkers, series, allPeople,
HandleAddPerson, () => series.Metadata.InkerLocked = true);
- UpdatePeopleList(PersonRole.Letterer, updateSeriesMetadataDto.SeriesMetadata.Letterers, series, allPeople,
+ PersonHelper.UpdatePeopleList(PersonRole.Letterer, updateSeriesMetadataDto.SeriesMetadata.Letterers, series, allPeople,
HandleAddPerson, () => series.Metadata.LettererLocked = true);
- UpdatePeopleList(PersonRole.Penciller, updateSeriesMetadataDto.SeriesMetadata.Pencillers, series, allPeople,
+ PersonHelper.UpdatePeopleList(PersonRole.Penciller, updateSeriesMetadataDto.SeriesMetadata.Pencillers, series, allPeople,
HandleAddPerson, () => series.Metadata.PencillerLocked = true);
- UpdatePeopleList(PersonRole.Publisher, updateSeriesMetadataDto.SeriesMetadata.Publishers, series, allPeople,
+ PersonHelper.UpdatePeopleList(PersonRole.Publisher, updateSeriesMetadataDto.SeriesMetadata.Publishers, series, allPeople,
HandleAddPerson, () => series.Metadata.PublisherLocked = true);
- UpdatePeopleList(PersonRole.Translator, updateSeriesMetadataDto.SeriesMetadata.Translators, series, allPeople,
+ PersonHelper.UpdatePeopleList(PersonRole.Translator, updateSeriesMetadataDto.SeriesMetadata.Translators, series, allPeople,
HandleAddPerson, () => series.Metadata.TranslatorLocked = true);
- UpdatePeopleList(PersonRole.CoverArtist, updateSeriesMetadataDto.SeriesMetadata.CoverArtists, series, allPeople,
+ PersonHelper.UpdatePeopleList(PersonRole.CoverArtist, updateSeriesMetadataDto.SeriesMetadata.CoverArtists, series, allPeople,
HandleAddPerson, () => series.Metadata.CoverArtistLocked = true);
series.Metadata.AgeRatingLocked = updateSeriesMetadataDto.SeriesMetadata.AgeRatingLocked;
@@ -183,7 +189,12 @@ public class SeriesService : ISeriesService
return true;
}
- if (await _unitOfWork.CommitAsync())
+ await _unitOfWork.CommitAsync();
+
+ // Trigger code to cleanup tags, collections, people, etc
+ await _taskScheduler.CleanupDbEntries();
+
+ if (updateSeriesMetadataDto.CollectionTags != null)
{
foreach (var tag in updateSeriesMetadataDto.CollectionTags)
{
@@ -210,10 +221,10 @@ public class SeriesService : ISeriesService
}
- public static void UpdateCollectionsList(ICollection<CollectionTagDto> tags, Series series, IReadOnlyCollection<CollectionTag> allTags,
+ public static void UpdateCollectionsList(ICollection<CollectionTagDto>? tags, Series series, IReadOnlyCollection<CollectionTag> allTags,
Action<CollectionTag> handleAdd)
{
- // TODO: Move UpdateRelatedList to a helper so we can easily test
+ // TODO: Move UpdateCollectionsList to a helper so we can easily test
if (tags == null) return;
// I want a union of these 2 lists. Return only elements that are in both lists, but the list types are different
var existingTags = series.Metadata.CollectionTags.ToList();
@@ -240,138 +251,13 @@ public class SeriesService : ISeriesService
else
{
// Add new tag
- handleAdd(DbFactory.CollectionTag(tag.Id, tag.Title, tag.Summary, tag.Promoted));
- }
- }
- }
-
- private static void UpdateGenreList(ICollection<GenreTagDto> tags, Series series, IReadOnlyCollection<Genre> allTags, Action<Genre> handleAdd, Action onModified)
- {
- if (tags == null) return;
- var isModified = false;
- // I want a union of these 2 lists. Return only elements that are in both lists, but the list types are different
- var existingTags = series.Metadata.Genres.ToList();
- foreach (var existing in existingTags)
- {
- // NOTE: Why don't I use a NormalizedName here (outside of memory pressure from string creation)?
- if (tags.SingleOrDefault(t => t.Id == existing.Id) == null)
- {
- // Remove tag
- series.Metadata.Genres.Remove(existing);
- isModified = true;
- }
- }
-
- // At this point, all tags that aren't in dto have been removed.
- foreach (var tagTitle in tags.Select(t => t.Title))
- {
- var normalizedTitle = Tasks.Scanner.Parser.Parser.Normalize(tagTitle);
- var existingTag = allTags.SingleOrDefault(t => t.NormalizedTitle == normalizedTitle);
- if (existingTag != null)
- {
- if (series.Metadata.Genres.All(t => t.NormalizedTitle != normalizedTitle))
- {
- handleAdd(existingTag);
- isModified = true;
- }
- }
- else
- {
- // Add new tag
- handleAdd(DbFactory.Genre(tagTitle));
- isModified = true;
+ handleAdd(new CollectionTagBuilder(tag.Title)
+ .WithId(tag.Id)
+ .WithSummary(tag.Summary)
+ .WithIsPromoted(tag.Promoted)
+ .Build());
}
}
-
- if (isModified)
- {
- onModified();
- }
- }
-
- private static void UpdateTagList(ICollection<TagDto> tags, Series series, IReadOnlyCollection<Tag> allTags, Action<Tag> handleAdd, Action onModified)
- {
- if (tags == null) return;
-
- var isModified = false;
- // I want a union of these 2 lists. Return only elements that are in both lists, but the list types are different
- var existingTags = series.Metadata.Tags.ToList();
- foreach (var existing in existingTags.Where(existing => tags.SingleOrDefault(t => t.Id == existing.Id) == null))
- {
- // Remove tag
- series.Metadata.Tags.Remove(existing);
- isModified = true;
- }
-
- // At this point, all tags that aren't in dto have been removed.
- foreach (var tagTitle in tags.Select(t => t.Title))
- {
- var normalizedTitle = Tasks.Scanner.Parser.Parser.Normalize(tagTitle);
- var existingTag = allTags.SingleOrDefault(t => t.NormalizedTitle.Equals(normalizedTitle));
- if (existingTag != null)
- {
- if (series.Metadata.Tags.All(t => t.NormalizedTitle != normalizedTitle))
- {
-
- handleAdd(existingTag);
- isModified = true;
- }
- }
- else
- {
- // Add new tag
- handleAdd(DbFactory.Tag(tagTitle));
- isModified = true;
- }
- }
-
- if (isModified)
- {
- onModified();
- }
- }
-
- private static void UpdatePeopleList(PersonRole role, ICollection<PersonDto> tags, Series series, IReadOnlyCollection<Person> allTags,
- Action<Person> handleAdd, Action onModified)
- {
- if (tags == null) return;
- var isModified = false;
- // I want a union of these 2 lists. Return only elements that are in both lists, but the list types are different
- var existingTags = series.Metadata.People.Where(p => p.Role == role).ToList();
- foreach (var existing in existingTags)
- {
- if (tags.SingleOrDefault(t => t.Id == existing.Id) == null) // This needs to check against role
- {
- // Remove tag
- series.Metadata.People.Remove(existing);
- isModified = true;
- }
- }
-
- // At this point, all tags that aren't in dto have been removed.
- foreach (var tag in tags)
- {
- var existingTag = allTags.SingleOrDefault(t => t.Name == tag.Name && t.Role == tag.Role);
- if (existingTag != null)
- {
- if (series.Metadata.People.Where(t => t.Role == tag.Role).All(t => !t.Name.Equals(tag.Name)))
- {
- handleAdd(existingTag);
- isModified = true;
- }
- }
- else
- {
- // Add new tag
- handleAdd(DbFactory.Person(tag.Name, role));
- isModified = true;
- }
- }
-
- if (isModified)
- {
- onModified();
- }
}
/// <summary>
@@ -380,7 +266,7 @@ public class SeriesService : ISeriesService
/// <param name="user">User with Ratings includes</param>
/// <param name="updateSeriesRatingDto"></param>
/// <returns></returns>
- public async Task<bool> UpdateRating(AppUser user, UpdateSeriesRatingDto updateSeriesRatingDto)
+ public async Task<bool> UpdateRating(AppUser? user, UpdateSeriesRatingDto updateSeriesRatingDto)
{
if (user == null)
{
@@ -478,10 +364,10 @@ public class SeriesService : ISeriesService
throw new UnauthorizedAccessException("User does not have access to the library this series belongs to");
var user = await _unitOfWork.UserRepository.GetUserByIdAsync(userId);
- if (user.AgeRestriction != AgeRating.NotApplicable)
+ if (user!.AgeRestriction != AgeRating.NotApplicable)
{
var seriesMetadata = await _unitOfWork.SeriesRepository.GetSeriesMetadata(seriesId);
- if (seriesMetadata.AgeRating > user.AgeRestriction)
+ if (seriesMetadata!.AgeRating > user.AgeRestriction)
throw new UnauthorizedAccessException("User is not allowed to view this series due to age restrictions");
}
@@ -580,10 +466,14 @@ public class SeriesService : ISeriesService
if (string.IsNullOrEmpty(title)) return;
volume.Name += $" - {title}";
}
- else
+ else if (volume.Name != "0")
{
volume.Name += $" - {firstChapter.TitleName}";
}
+ else
+ {
+ volume.Name += $"";
+ }
return;
}
@@ -592,8 +482,10 @@ public class SeriesService : ISeriesService
}
- private static string FormatChapterTitle(bool isSpecial, LibraryType libraryType, string chapterTitle, bool withHash)
+ private static string FormatChapterTitle(bool isSpecial, LibraryType libraryType, string? chapterTitle, bool withHash)
{
+ if (string.IsNullOrEmpty(chapterTitle)) throw new ArgumentException("Chapter Title cannot be null");
+
if (isSpecial)
{
return Tasks.Scanner.Parser.Parser.CleanSpecialTitle(chapterTitle);
@@ -649,6 +541,7 @@ public class SeriesService : ISeriesService
public async Task<bool> UpdateRelatedSeries(UpdateRelatedSeriesDto dto)
{
var series = await _unitOfWork.SeriesRepository.GetSeriesByIdAsync(dto.SeriesId, SeriesIncludes.Related);
+ if (series == null) return false;
UpdateRelationForKind(dto.Adaptations, series.Relations.Where(r => r.RelationKind == RelationKind.Adaptation).ToList(), series, RelationKind.Adaptation);
UpdateRelationForKind(dto.Characters, series.Relations.Where(r => r.RelationKind == RelationKind.Character).ToList(), series, RelationKind.Character);
diff --git a/API/Services/StatisticService.cs b/API/Services/StatisticService.cs
index 8b182e8c0..253df6b49 100644
--- a/API/Services/StatisticService.cs
+++ b/API/Services/StatisticService.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.IO;
using System.Linq;
using System.Threading.Tasks;
using API.Data;
@@ -9,10 +8,10 @@ using API.DTOs.Statistics;
using API.Entities;
using API.Entities.Enums;
using API.Extensions;
+using API.Extensions.QueryExtensions;
using AutoMapper;
using AutoMapper.QueryableExtensions;
using Microsoft.EntityFrameworkCore;
-using Microsoft.Extensions.Logging;
namespace API.Services;
@@ -104,7 +103,6 @@ public class StatisticService : IStatisticService
})
.ToListAsync();
-
var averageReadingTimePerWeek = _context.AppUserProgresses
.Where(p => p.AppUserId == userId)
.Join(_context.Chapter, p => p.ChapterId, c => c.Id,
@@ -113,7 +111,7 @@ public class StatisticService : IStatisticService
AverageReadingHours = Math.Min((float) p.PagesRead / (float) c.Pages, 1.0) * ((float) c.AvgHoursToRead)
})
.Select(x => x.AverageReadingHours)
- .Average() / 7.0;
+ .Average() * 7.0;
return new UserReadStatistics()
{
@@ -342,29 +340,26 @@ public class StatisticService : IStatisticService
.Join(_context.Volume, x => x.chapter.VolumeId, volume => volume.Id,
(x, volume) => new {x.appUserProgresses, x.chapter, volume})
.Join(_context.Series, x => x.appUserProgresses.SeriesId, series => series.Id,
- (x, series) => new {x.appUserProgresses, x.chapter, x.volume, series});
+ (x, series) => new {x.appUserProgresses, x.chapter, x.volume, series})
+ .WhereIf(userId > 0, x => x.appUserProgresses.AppUserId == userId)
+ .WhereIf(days > 0, x => x.appUserProgresses.LastModified >= DateTime.Now.AddDays(days * -1));
- if (userId > 0)
- {
- query = query.Where(x => x.appUserProgresses.AppUserId == userId);
- }
- if (days > 0)
- {
- var date = DateTime.Now.AddDays(days * -1);
- query = query.Where(x => x.appUserProgresses.LastModified >= date);
- }
+ // .Where(p => p.chapter.AvgHoursToRead > 0)
+ // .SumAsync(p =>
+ // p.chapter.AvgHoursToRead * (p.progress.PagesRead / (1.0f * p.chapter.Pages))))
var results = await query.GroupBy(x => new
{
Day = x.appUserProgresses.LastModified.Date,
- x.series.Format
+ x.series.Format,
})
.Select(g => new PagesReadOnADayCount<DateTime>
{
Value = g.Key.Day,
Format = g.Key.Format,
- Count = g.Count()
+ Count = (long) g.Sum(x =>
+ x.chapter.AvgHoursToRead * (x.appUserProgresses.PagesRead / (1.0f * x.chapter.Pages)))
})
.OrderBy(d => d.Value)
.ToListAsync();
@@ -593,13 +588,14 @@ public class StatisticService : IStatisticService
user[userChapter.User.Id] = libraryTimes;
}
+
return user.Keys.Select(userId => new TopReadDto()
{
UserId = userId,
Username = users.First(u => u.Id == userId).UserName,
- BooksTime = user[userId].ContainsKey(LibraryType.Book) ? user[userId][LibraryType.Book] : 0,
- ComicsTime = user[userId].ContainsKey(LibraryType.Comic) ? user[userId][LibraryType.Comic] : 0,
- MangaTime = user[userId].ContainsKey(LibraryType.Manga) ? user[userId][LibraryType.Manga] : 0,
+ BooksTime = user[userId].TryGetValue(LibraryType.Book, out var bookTime) ? bookTime : 0,
+ ComicsTime = user[userId].TryGetValue(LibraryType.Comic, out var comicTime) ? comicTime : 0,
+ MangaTime = user[userId].TryGetValue(LibraryType.Manga, out var mangaTime) ? mangaTime : 0,
})
.ToList();
}
diff --git a/API/Services/TachiyomiService.cs b/API/Services/TachiyomiService.cs
index 23f57562d..ea7da471f 100644
--- a/API/Services/TachiyomiService.cs
+++ b/API/Services/TachiyomiService.cs
@@ -15,7 +15,7 @@ namespace API.Services;
public interface ITachiyomiService
{
- Task<ChapterDto> GetLatestChapter(int seriesId, int userId);
+ Task<ChapterDto?> GetLatestChapter(int seriesId, int userId);
Task<bool> MarkChaptersUntilAsRead(AppUser userWithProgress, int seriesId, float chapterNumber);
}
@@ -49,10 +49,8 @@ public class TachiyomiService : ITachiyomiService
/// If its a chapter, return the chapterDto as is.
/// If it's a volume, the volume number gets returned in the 'Number' attribute of a chapterDto encoded.
/// The volume number gets divided by 10,000 because that's how Tachiyomi interprets volumes</returns>
- public async Task<ChapterDto> GetLatestChapter(int seriesId, int userId)
+ public async Task<ChapterDto?> GetLatestChapter(int seriesId, int userId)
{
-
-
var currentChapter = await _readerService.GetContinuePoint(seriesId, userId);
var prevChapterId =
@@ -95,10 +93,11 @@ public class TachiyomiService : ITachiyomiService
}
// There is progress, we now need to figure out the highest volume or chapter and return that.
- var prevChapter = await _unitOfWork.ChapterRepository.GetChapterDtoAsync(prevChapterId);
+ var prevChapter = (await _unitOfWork.ChapterRepository.GetChapterDtoAsync(prevChapterId))!;
+
var volumeWithProgress = await _unitOfWork.VolumeRepository.GetVolumeDtoAsync(prevChapter.VolumeId, userId);
// We only encode for single-file volumes
- if (volumeWithProgress.Number != 0 && volumeWithProgress.Chapters.Count == 1)
+ if (volumeWithProgress!.Number != 0 && volumeWithProgress.Chapters.Count == 1)
{
// The progress is on a volume, encode it as a fake chapterDTO
return new ChapterDto()
diff --git a/API/Services/TaskScheduler.cs b/API/Services/TaskScheduler.cs
index bdd7069bc..4a3bfad93 100644
--- a/API/Services/TaskScheduler.cs
+++ b/API/Services/TaskScheduler.cs
@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
-using System.Threading;
using System.Threading.Tasks;
using API.Data;
using API.Entities.Enums;
@@ -22,6 +21,7 @@ public interface ITaskScheduler
void ScanFolder(string folderPath, TimeSpan delay);
void ScanFolder(string folderPath);
void ScanLibrary(int libraryId, bool force = false);
+ void ScanLibraries(bool force = false);
void CleanupChapters(int[] chapterIds);
void RefreshMetadata(int libraryId, bool forceUpdate = true);
void RefreshSeriesMetadata(int libraryId, int seriesId, bool forceUpdate = false);
@@ -31,6 +31,9 @@ public interface ITaskScheduler
void CancelStatsTasks();
Task RunStatCollection();
void ScanSiteThemes();
+ Task CovertAllCoversToWebP();
+ Task CleanupDbEntries();
+
}
public class TaskScheduler : ITaskScheduler
{
@@ -47,6 +50,7 @@ public class TaskScheduler : ITaskScheduler
private readonly IThemeService _themeService;
private readonly IWordCountAnalyzerService _wordCountAnalyzerService;
private readonly IStatisticService _statisticService;
+ private readonly IBookmarkService _bookmarkService;
public static BackgroundJobServer Client => new BackgroundJobServer();
public const string ScanQueue = "scan";
@@ -59,7 +63,8 @@ public class TaskScheduler : ITaskScheduler
public const string ScanLibrariesTaskId = "scan-libraries";
public const string ReportStatsTaskId = "report-stats";
- private static readonly ImmutableArray<string> ScanTasks = ImmutableArray.Create("ScannerService", "ScanLibrary", "ScanLibraries", "ScanFolder", "ScanSeries");
+ private static readonly ImmutableArray<string> ScanTasks =
+ ImmutableArray.Create("ScannerService", "ScanLibrary", "ScanLibraries", "ScanFolder", "ScanSeries");
private static readonly Random Rnd = new Random();
@@ -67,7 +72,8 @@ public class TaskScheduler : ITaskScheduler
public TaskScheduler(ICacheService cacheService, ILogger<TaskScheduler> logger, IScannerService scannerService,
IUnitOfWork unitOfWork, IMetadataService metadataService, IBackupService backupService,
ICleanupService cleanupService, IStatsService statsService, IVersionUpdaterService versionUpdaterService,
- IThemeService themeService, IWordCountAnalyzerService wordCountAnalyzerService, IStatisticService statisticService)
+ IThemeService themeService, IWordCountAnalyzerService wordCountAnalyzerService, IStatisticService statisticService,
+ IBookmarkService bookmarkService)
{
_cacheService = cacheService;
_logger = logger;
@@ -81,6 +87,7 @@ public class TaskScheduler : ITaskScheduler
_themeService = themeService;
_wordCountAnalyzerService = wordCountAnalyzerService;
_statisticService = statisticService;
+ _bookmarkService = bookmarkService;
}
public async Task ScheduleTasks()
@@ -92,12 +99,12 @@ public class TaskScheduler : ITaskScheduler
{
var scanLibrarySetting = setting;
_logger.LogDebug("Scheduling Scan Library Task for {Setting}", scanLibrarySetting);
- RecurringJob.AddOrUpdate(ScanLibrariesTaskId, () => _scannerService.ScanLibraries(),
+ RecurringJob.AddOrUpdate(ScanLibrariesTaskId, () => _scannerService.ScanLibraries(false),
() => CronConverter.ConvertToCronNotation(scanLibrarySetting), TimeZoneInfo.Local);
}
else
{
- RecurringJob.AddOrUpdate(ScanLibrariesTaskId, () => ScanLibraries(), Cron.Daily, TimeZoneInfo.Local);
+ RecurringJob.AddOrUpdate(ScanLibrariesTaskId, () => ScanLibraries(false), Cron.Daily, TimeZoneInfo.Local);
}
setting = (await _unitOfWork.SettingsRepository.GetSettingAsync(ServerSettingKey.TaskBackup)).Value;
@@ -175,6 +182,17 @@ public class TaskScheduler : ITaskScheduler
BackgroundJob.Enqueue(() => _themeService.Scan());
}
+ public async Task CovertAllCoversToWebP()
+ {
+ await _bookmarkService.ConvertAllCoverToWebP();
+ _logger.LogInformation("[BookmarkService] Queuing tasks to update Series and Volume references via Cover Refresh");
+ var libraryIds = await _unitOfWork.LibraryRepository.GetLibrariesAsync();
+ foreach (var lib in libraryIds)
+ {
+ RefreshMetadata(lib.Id, false);
+ }
+ }
+
#endregion
#region UpdateTasks
@@ -216,15 +234,24 @@ public class TaskScheduler : ITaskScheduler
#endregion
- public void ScanLibraries()
+ public async Task CleanupDbEntries()
+ {
+ await _cleanupService.CleanupDbEntries();
+ }
+
+ /// <summary>
+ /// Attempts to call ScanLibraries on ScannerService, but if another scan task is in progress, will reschedule the invocation for 3 hours in future.
+ /// </summary>
+ /// <param name="force"></param>
+ public void ScanLibraries(bool force = false)
{
if (RunningAnyTasksByMethod(ScanTasks, ScanQueue))
{
_logger.LogInformation("A Scan is already running, rescheduling ScanLibraries in 3 hours");
- BackgroundJob.Schedule(() => ScanLibraries(), TimeSpan.FromHours(3));
+ BackgroundJob.Schedule(() => ScanLibraries(force), TimeSpan.FromHours(3));
return;
}
- _scannerService.ScanLibraries();
+ BackgroundJob.Enqueue(() => _scannerService.ScanLibraries(force));
}
public void ScanLibrary(int libraryId, bool force = false)
@@ -322,6 +349,7 @@ public class TaskScheduler : ITaskScheduler
public async Task CheckForUpdate()
{
var update = await _versionUpdaterService.CheckForUpdate();
+ if (update == null) return;
await _versionUpdaterService.PushUpdate(update);
}
diff --git a/API/Services/Tasks/BackupService.cs b/API/Services/Tasks/BackupService.cs
index 134a82f90..6cc52ff9f 100644
--- a/API/Services/Tasks/BackupService.cs
+++ b/API/Services/Tasks/BackupService.cs
@@ -6,12 +6,9 @@ using System.Linq;
using System.Threading.Tasks;
using API.Data;
using API.Entities.Enums;
-using API.Extensions;
using API.Logging;
using API.SignalR;
using Hangfire;
-using Microsoft.AspNetCore.SignalR;
-using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
namespace API.Services.Tasks;
@@ -62,7 +59,7 @@ public class BackupService : IBackupService
public IEnumerable<string> GetLogFiles(bool rollFiles = LogLevelOptions.LogRollingEnabled)
{
var multipleFileRegex = rollFiles ? @"\d*" : string.Empty;
- var fi = _directoryService.FileSystem.FileInfo.FromFileName(LogLevelOptions.LogFile);
+ var fi = _directoryService.FileSystem.FileInfo.New(LogLevelOptions.LogFile);
var files = rollFiles
? _directoryService.GetFiles(_directoryService.LogDirectory,
diff --git a/API/Services/Tasks/CleanupService.cs b/API/Services/Tasks/CleanupService.cs
index 0cc4d7c98..b51df5b44 100644
--- a/API/Services/Tasks/CleanupService.cs
+++ b/API/Services/Tasks/CleanupService.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.IO;
using System.Linq;
using System.Threading.Tasks;
using API.Data;
@@ -11,7 +10,6 @@ using API.Entities.Enums;
using API.Helpers;
using API.SignalR;
using Hangfire;
-using Microsoft.AspNetCore.SignalR;
using Microsoft.Extensions.Logging;
namespace API.Services.Tasks;
@@ -60,6 +58,17 @@ public class CleanupService : ICleanupService
[AutomaticRetry(Attempts = 3, LogEvents = false, OnAttemptsExceeded = AttemptsExceededAction.Fail)]
public async Task Cleanup()
{
+ if (TaskScheduler.HasAlreadyEnqueuedTask(BookmarkService.Name, "ConvertAllCoverToWebP", Array.Empty<object>(),
+ TaskScheduler.DefaultQueue, true) ||
+ TaskScheduler.HasAlreadyEnqueuedTask(BookmarkService.Name, "ConvertAllBookmarkToWebP", Array.Empty<object>(),
+ TaskScheduler.DefaultQueue, true))
+ {
+ _logger.LogInformation("Cleanup put on hold as a conversion to WebP in progress");
+ await _eventHub.SendMessageAsync(MessageFactory.NotificationProgress,
+ MessageFactory.ErrorEvent("Cleanup", "Cleanup put on hold as a conversion to WebP in progress"));
+ return;
+ }
+
_logger.LogInformation("Starting Cleanup");
await SendProgress(0F, "Starting cleanup");
_logger.LogInformation("Cleaning temp directory");
@@ -92,6 +101,7 @@ public class CleanupService : ICleanupService
await _unitOfWork.PersonRepository.RemoveAllPeopleNoLongerAssociated();
await _unitOfWork.GenreRepository.RemoveAllGenreNoLongerAssociated();
await _unitOfWork.CollectionTagRepository.RemoveTagsWithoutSeries();
+ await _unitOfWork.ReadingListRepository.RemoveReadingListsWithoutSeries();
}
private async Task SendProgress(float progress, string subtitle)
@@ -175,7 +185,7 @@ public class CleanupService : ICleanupService
var deltaTime = DateTime.Today.Subtract(TimeSpan.FromDays(dayThreshold));
var allBackups = _directoryService.GetFiles(backupDirectory).ToList();
- var expiredBackups = allBackups.Select(filename => _directoryService.FileSystem.FileInfo.FromFileName(filename))
+ var expiredBackups = allBackups.Select(filename => _directoryService.FileSystem.FileInfo.New(filename))
.Where(f => f.CreationTime < deltaTime)
.ToList();
@@ -198,7 +208,7 @@ public class CleanupService : ICleanupService
var dayThreshold = (await _unitOfWork.SettingsRepository.GetSettingsDtoAsync()).TotalLogs;
var deltaTime = DateTime.Today.Subtract(TimeSpan.FromDays(dayThreshold));
var allLogs = _directoryService.GetFiles(_directoryService.LogDirectory).ToList();
- var expiredLogs = allLogs.Select(filename => _directoryService.FileSystem.FileInfo.FromFileName(filename))
+ var expiredLogs = allLogs.Select(filename => _directoryService.FileSystem.FileInfo.New(filename))
.Where(f => f.CreationTime < deltaTime)
.ToList();
@@ -232,6 +242,9 @@ public class CleanupService : ICleanupService
_logger.LogInformation("Temp directory purged");
}
+ /// <summary>
+ /// This does not cleanup any Series that are not Completed or Cancelled
+ /// </summary>
public async Task CleanupWantToRead()
{
_logger.LogInformation("Performing cleanup of Series that are Completed and have been fully read that are in Want To Read list");
diff --git a/API/Services/Tasks/Metadata/WordCountAnalyzerService.cs b/API/Services/Tasks/Metadata/WordCountAnalyzerService.cs
index 24075abf3..b4687d749 100644
--- a/API/Services/Tasks/Metadata/WordCountAnalyzerService.cs
+++ b/API/Services/Tasks/Metadata/WordCountAnalyzerService.cs
@@ -3,7 +3,6 @@ using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using API.Data;
-using API.Data.Repositories;
using API.Entities;
using API.Entities.Enums;
using API.Helpers;
@@ -50,7 +49,8 @@ public class WordCountAnalyzerService : IWordCountAnalyzerService
public async Task ScanLibrary(int libraryId, bool forceUpdate = false)
{
var sw = Stopwatch.StartNew();
- var library = await _unitOfWork.LibraryRepository.GetLibraryForIdAsync(libraryId, LibraryIncludes.None);
+ var library = await _unitOfWork.LibraryRepository.GetLibraryForIdAsync(libraryId);
+ if (library == null) return;
await _eventHub.SendMessageAsync(MessageFactory.NotificationProgress,
MessageFactory.WordCountAnalyzerProgressEvent(libraryId, 0F, ProgressEventType.Started, string.Empty));
diff --git a/API/Services/Tasks/Scanner/LibraryWatcher.cs b/API/Services/Tasks/Scanner/LibraryWatcher.cs
index 1f3a65dc5..0714a4371 100644
--- a/API/Services/Tasks/Scanner/LibraryWatcher.cs
+++ b/API/Services/Tasks/Scanner/LibraryWatcher.cs
@@ -5,6 +5,7 @@ using System.IO;
using System.Linq;
using System.Threading.Tasks;
using API.Data;
+using API.Entities.Enums;
using Hangfire;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
@@ -55,6 +56,8 @@ public class LibraryWatcher : ILibraryWatcher
/// Counts within a time frame how many times the buffer became full. Is used to reschedule LibraryWatcher to start monitoring much later rather than instantly
/// </summary>
private int _bufferFullCounter;
+ private int _restartCounter;
+ private DateTime _lastErrorTime = DateTime.MinValue;
/// <summary>
/// Used to lock buffer Full Counter
/// </summary>
@@ -180,12 +183,21 @@ public class LibraryWatcher : ILibraryWatcher
lock (Lock)
{
_bufferFullCounter += 1;
- condition = _bufferFullCounter >= 3;
+ _lastErrorTime = DateTime.Now;
+ condition = _bufferFullCounter >= 3 && (DateTime.Now - _lastErrorTime).TotalMinutes <= 10;
+ }
+
+ if (_restartCounter >= 3)
+ {
+ _logger.LogInformation("[LibraryWatcher] Too many restarts occured, you either have limited inotify or an OS constraint. Kavita will turn off folder watching to prevent high utilization of resources");
+ Task.Run(TurnOffWatching);
+ return;
}
if (condition)
{
- _logger.LogInformation("[LibraryWatcher] Internal buffer has been overflown multiple times in past 10 minutes. Suspending file watching for an hour");
+ _logger.LogInformation("[LibraryWatcher] Internal buffer has been overflown multiple times in past 10 minutes. Suspending file watching for an hour. Restart count: {RestartCount}", _restartCounter);
+ _restartCounter++;
StopWatching();
BackgroundJob.Schedule(() => RestartWatching(), TimeSpan.FromHours(1));
return;
@@ -194,6 +206,16 @@ public class LibraryWatcher : ILibraryWatcher
BackgroundJob.Schedule(() => UpdateLastBufferOverflow(), TimeSpan.FromMinutes(10));
}
+ private async Task TurnOffWatching()
+ {
+ var setting = await _unitOfWork.SettingsRepository.GetSettingAsync(ServerSettingKey.EnableFolderWatching);
+ setting.Value = "false";
+ _unitOfWork.SettingsRepository.Update(setting);
+ await _unitOfWork.CommitAsync();
+ StopWatching();
+ _logger.LogInformation("[LibraryWatcher] Folder watching has been disabled");
+ }
+
/// <summary>
/// Processes the file or folder change. If the change is a file change and not from a supported extension, it will be ignored.
diff --git a/API/Services/Tasks/Scanner/ParseScannedFiles.cs b/API/Services/Tasks/Scanner/ParseScannedFiles.cs
index 1a23af727..d6c3fdcfa 100644
--- a/API/Services/Tasks/Scanner/ParseScannedFiles.cs
+++ b/API/Services/Tasks/Scanner/ParseScannedFiles.cs
@@ -6,7 +6,7 @@ using System.Linq;
using System.Threading.Tasks;
using API.Entities.Enums;
using API.Extensions;
-using API.Parser;
+using API.Services.Tasks.Scanner.Parser;
using API.SignalR;
using Kavita.Common.Helpers;
using Microsoft.Extensions.Logging;
@@ -18,24 +18,24 @@ public class ParsedSeries
/// <summary>
/// Name of the Series
/// </summary>
- public string Name { get; init; }
+ public required string Name { get; init; }
/// <summary>
/// Normalized Name of the Series
/// </summary>
- public string NormalizedName { get; init; }
+ public required string NormalizedName { get; init; }
/// <summary>
/// Format of the Series
/// </summary>
- public MangaFormat Format { get; init; }
+ public required MangaFormat Format { get; init; }
}
public class SeriesModified
{
- public string FolderPath { get; set; }
- public string SeriesName { get; set; }
+ public required string FolderPath { get; set; }
+ public required string SeriesName { get; set; }
public DateTime LastScanned { get; set; }
public MangaFormat Format { get; set; }
- public IEnumerable<string> LibraryRoots { get; set; }
+ public IEnumerable<string> LibraryRoots { get; set; } = ArraySegment<string>.Empty;
}
/// <summary>
@@ -166,16 +166,16 @@ public class ParseScannedFiles
/// </summary>
/// <param name="scannedSeries">A localized list of a series' parsed infos</param>
/// <param name="info"></param>
- private void TrackSeries(ConcurrentDictionary<ParsedSeries, List<ParserInfo>> scannedSeries, ParserInfo info)
+ private void TrackSeries(ConcurrentDictionary<ParsedSeries, List<ParserInfo>> scannedSeries, ParserInfo? info)
{
- if (info.Series == string.Empty) return;
+ if (info == null || info.Series == string.Empty) return;
// Check if normalized info.Series already exists and if so, update info to use that name instead
info.Series = MergeName(scannedSeries, info);
- var normalizedSeries = Parser.Parser.Normalize(info.Series);
- var normalizedSortSeries = Parser.Parser.Normalize(info.SeriesSort);
- var normalizedLocalizedSeries = Parser.Parser.Normalize(info.LocalizedSeries);
+ var normalizedSeries = info.Series.ToNormalized();
+ var normalizedSortSeries = info.SeriesSort.ToNormalized();
+ var normalizedLocalizedSeries = info.LocalizedSeries.ToNormalized();
try
{
@@ -224,19 +224,24 @@ public class ParseScannedFiles
/// <returns>Series Name to group this info into</returns>
private string MergeName(ConcurrentDictionary<ParsedSeries, List<ParserInfo>> scannedSeries, ParserInfo info)
{
- var normalizedSeries = Parser.Parser.Normalize(info.Series);
- var normalizedLocalSeries = Parser.Parser.Normalize(info.LocalizedSeries);
+ var normalizedSeries = info.Series.ToNormalized();
+ var normalizedLocalSeries = info.LocalizedSeries.ToNormalized();
try
{
var existingName =
scannedSeries.SingleOrDefault(p =>
- (Parser.Parser.Normalize(p.Key.NormalizedName).Equals(normalizedSeries) ||
- Parser.Parser.Normalize(p.Key.NormalizedName).Equals(normalizedLocalSeries)) &&
+ (p.Key.NormalizedName.ToNormalized().Equals(normalizedSeries) ||
+ p.Key.NormalizedName.ToNormalized().Equals(normalizedLocalSeries)) &&
p.Key.Format == info.Format)
.Key;
- if (existingName != null && !string.IsNullOrEmpty(existingName.Name))
+ if (existingName == null)
+ {
+ return info.Series;
+ }
+
+ if (!string.IsNullOrEmpty(existingName.Name))
{
return existingName.Name;
}
@@ -245,8 +250,8 @@ public class ParseScannedFiles
{
_logger.LogCritical(ex, "[ScannerService] Multiple series detected for {SeriesName} ({File})! This is critical to fix! There should only be 1", info.Series, info.FullFilePath);
var values = scannedSeries.Where(p =>
- (Parser.Parser.Normalize(p.Key.NormalizedName) == normalizedSeries ||
- Parser.Parser.Normalize(p.Key.NormalizedName) == normalizedLocalSeries) &&
+ (p.Key.NormalizedName.ToNormalized() == normalizedSeries ||
+ p.Key.NormalizedName.ToNormalized() == normalizedLocalSeries) &&
p.Key.Format == info.Format);
foreach (var pair in values)
{
@@ -272,7 +277,7 @@ public class ParseScannedFiles
/// <returns></returns>
public async Task ScanLibrariesForSeries(LibraryType libraryType,
IEnumerable<string> folders, string libraryName, bool isLibraryScan,
- IDictionary<string, IList<SeriesModified>> seriesPaths, Func<Tuple<bool, IList<ParserInfo>>, Task> processSeriesInfos, bool forceCheck = false)
+ IDictionary<string, IList<SeriesModified>> seriesPaths, Func<Tuple<bool, IList<ParserInfo>>, Task>? processSeriesInfos, bool forceCheck = false)
{
await _eventHub.SendMessageAsync(MessageFactory.NotificationProgress, MessageFactory.FileScanProgressEvent("File Scan Starting", libraryName, ProgressEventType.Started));
@@ -287,14 +292,17 @@ public class ParseScannedFiles
Series = fp.SeriesName,
Format = fp.Format,
}).ToList();
- await processSeriesInfos.Invoke(new Tuple<bool, IList<ParserInfo>>(true, parsedInfos));
+ if (processSeriesInfos != null)
+ await processSeriesInfos.Invoke(new Tuple<bool, IList<ParserInfo>>(true, parsedInfos));
_logger.LogDebug("[ScannerService] Skipped File Scan for {Folder} as it hasn't changed since last scan", folder);
+ await _eventHub.SendMessageAsync(MessageFactory.NotificationProgress,
+ MessageFactory.FileScanProgressEvent("Skipped " + normalizedFolder, libraryName, ProgressEventType.Updated));
return;
}
_logger.LogDebug("[ScannerService] Found {Count} files for {Folder}", files.Count, folder);
await _eventHub.SendMessageAsync(MessageFactory.NotificationProgress,
- MessageFactory.FileScanProgressEvent(folder, libraryName, ProgressEventType.Updated));
+ MessageFactory.FileScanProgressEvent($"{files.Count} files in {folder}", libraryName, ProgressEventType.Updated));
if (files.Count == 0)
{
_logger.LogInformation("[ScannerService] {Folder} is empty or is no longer in this location", folder);
@@ -320,7 +328,7 @@ public class ParseScannedFiles
{
_logger.LogError(ex,
"[ScannerService] There was an exception that occurred during tracking {FilePath}. Skipping this file",
- info.FullFilePath);
+ info?.FullFilePath);
}
}
@@ -388,7 +396,7 @@ public class ParseScannedFiles
if (string.IsNullOrEmpty(localizedSeries)) return;
// NOTE: If we have multiple series in a folder with a localized title, then this will fail. It will group into one series. User needs to fix this themselves.
- string nonLocalizedSeries;
+ string? nonLocalizedSeries;
// Normalize this as many of the cases is a capitalization difference
var nonLocalizedSeriesFound = infos
.Where(i => !i.IsSpecial)
@@ -407,11 +415,11 @@ public class ParseScannedFiles
nonLocalizedSeries = nonLocalizedSeriesFound.FirstOrDefault(s => !s.Equals(localizedSeries));
}
- if (string.IsNullOrEmpty(nonLocalizedSeries)) return;
+ if (nonLocalizedSeries == null) return;
- var normalizedNonLocalizedSeries = Parser.Parser.Normalize(nonLocalizedSeries);
+ var normalizedNonLocalizedSeries = nonLocalizedSeries.ToNormalized();
foreach (var infoNeedingMapping in infos.Where(i =>
- !Parser.Parser.Normalize(i.Series).Equals(normalizedNonLocalizedSeries)))
+ !i.Series.ToNormalized().Equals(normalizedNonLocalizedSeries)))
{
infoNeedingMapping.Series = nonLocalizedSeries;
infoNeedingMapping.LocalizedSeries = localizedSeries;
diff --git a/API/Services/Tasks/Scanner/Parser/DefaultParser.cs b/API/Services/Tasks/Scanner/Parser/DefaultParser.cs
index 072b1e44e..0f4095582 100644
--- a/API/Services/Tasks/Scanner/Parser/DefaultParser.cs
+++ b/API/Services/Tasks/Scanner/Parser/DefaultParser.cs
@@ -1,13 +1,12 @@
using System.IO;
using System.Linq;
using API.Entities.Enums;
-using API.Parser;
namespace API.Services.Tasks.Scanner.Parser;
public interface IDefaultParser
{
- ParserInfo Parse(string filePath, string rootPath, LibraryType type = LibraryType.Manga);
+ ParserInfo? Parse(string filePath, string rootPath, LibraryType type = LibraryType.Manga);
void ParseFromFallbackFolders(string filePath, string rootPath, LibraryType type, ref ParserInfo ret);
}
@@ -31,11 +30,12 @@ public class DefaultParser : IDefaultParser
/// <param name="rootPath">Root folder</param>
/// <param name="type">Defaults to Manga. Allows different Regex to be used for parsing.</param>
/// <returns><see cref="ParserInfo"/> or null if Series was empty</returns>
- public ParserInfo Parse(string filePath, string rootPath, LibraryType type = LibraryType.Manga)
+ public ParserInfo? Parse(string filePath, string rootPath, LibraryType type = LibraryType.Manga)
{
var fileName = _directoryService.FileSystem.Path.GetFileNameWithoutExtension(filePath);
- // TODO: Potential Bug: This will return null, but on Image libraries, if all images, we would want to include this.
+ // TODO: Potential Bug: This will return null, but on Image libraries, if all images, we would want to include this. (we can probably remove this and have users use kavitaignore)
if (Parser.IsCoverImage(_directoryService.FileSystem.Path.GetFileName(filePath))) return null;
+
ParserInfo ret;
if (Parser.IsEpub(filePath))
@@ -134,7 +134,7 @@ public class DefaultParser : IDefaultParser
if (fallbackFolders.Count == 0)
{
- var rootFolderName = _directoryService.FileSystem.DirectoryInfo.FromDirectoryName(rootPath).Name;
+ var rootFolderName = _directoryService.FileSystem.DirectoryInfo.New(rootPath).Name;
var series = Parser.ParseSeries(rootFolderName);
if (string.IsNullOrEmpty(series))
diff --git a/API/Services/Tasks/Scanner/Parser/Parser.cs b/API/Services/Tasks/Scanner/Parser/Parser.cs
index 39952c1fa..6777e052b 100644
--- a/API/Services/Tasks/Scanner/Parser/Parser.cs
+++ b/API/Services/Tasks/Scanner/Parser/Parser.cs
@@ -11,11 +11,13 @@ public static class Parser
{
public const string DefaultChapter = "0";
public const string DefaultVolume = "0";
+ private const int RegexTimeoutMs = 5000000; // 500 ms
public static readonly TimeSpan RegexTimeout = TimeSpan.FromMilliseconds(500);
public const string ImageFileExtensions = @"^(\.png|\.jpeg|\.jpg|\.webp|\.gif)";
public const string ArchiveFileExtensions = @"\.cbz|\.zip|\.rar|\.cbr|\.tar.gz|\.7zip|\.7z|\.cb7|\.cbt";
private const string BookFileExtensions = @"\.epub|\.pdf";
+ private const string XmlRegexExtensions = @"\.xml";
public const string MacOsMetadataFileStartsWith = @"._";
public const string SupportedExtensions =
@@ -24,6 +26,37 @@ public static class Parser
private const RegexOptions MatchOptions =
RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.CultureInvariant;
+ private static readonly ImmutableArray<string> FormatTagSpecialKeywords = ImmutableArray.Create(
+ "Special", "Reference", "Director's Cut", "Box Set", "Box-Set", "Annual", "Anthology", "Epilogue",
+ "One Shot", "One-Shot", "Prologue", "TPB", "Trade Paper Back", "Omnibus", "Compendium", "Absolute", "Graphic Novel",
+ "GN", "FCBD");
+
+ private static readonly char[] LeadingZeroesTrimChars = new[] { '0' };
+
+ private static readonly char[] SpacesAndSeparators = { '\0', '\t', '\r', ' ', '-', ','};
+
+
+ private const string Number = @"\d+(\.\d)?";
+ private const string NumberRange = Number + @"(-" + Number + @")?";
+
+ /// <summary>
+ /// non greedy matching of a string where parenthesis are balanced
+ /// </summary>
+ public const string BalancedParen = @"(?:[^()]|(?<open>\()|(?<-open>\)))*?(?(open)(?!))";
+ /// <summary>
+ /// non greedy matching of a string where square brackets are balanced
+ /// </summary>
+ public const string BalancedBracket = @"(?:[^\[\]]|(?<open>\[)|(?<-open>\]))*?(?(open)(?!))";
+ /// <summary>
+ /// Matches [Complete], release tags like [kmts] but not [ Complete ] or [kmts ]
+ /// </summary>
+ private const string TagsInBrackets = $@"\[(?!\s){BalancedBracket}(?<!\s)\]";
+ /// <summary>
+ /// Common regex patterns present in both Comics and Mangas
+ /// </summary>
+ private const string CommonSpecial = @"Specials?|One[- ]?Shot|Extra(?:\sChapter)?(?=\s)|Art Collection|Side Stories|Bonus";
+
+
/// <summary>
/// Matches against font-family css syntax. Does not match if url import has data: starting, as that is binary data
/// </summary>
@@ -44,7 +77,6 @@ public static class Parser
MatchOptions, RegexTimeout);
- private const string XmlRegexExtensions = @"\.xml";
private static readonly Regex ImageRegex = new Regex(ImageFileExtensions,
MatchOptions, RegexTimeout);
private static readonly Regex ArchiveFileRegex = new Regex(ArchiveFileExtensions,
@@ -67,14 +99,6 @@ public static class Parser
private static readonly Regex SpecialTokenRegex = new Regex(@"SP\d+",
MatchOptions, RegexTimeout);
- private const string Number = @"\d+(\.\d)?";
- private const string NumberRange = Number + @"(-" + Number + @")?";
-
- // Some generic reusage regex patterns:
- // - non greedy matching of a string where parenthesis are balanced
- public const string BalancedParen = @"(?:[^()]|(?<open>\()|(?<-open>\)))*?(?(open)(?!))";
- // - non greedy matching of a string where square brackets are balanced
- public const string BalancedBrack = @"(?:[^\[\]]|(?<open>\[)|(?<-open>\]))*?(?(open)(?!))";
private static readonly Regex[] MangaVolumeRegex = new[]
{
@@ -86,7 +110,6 @@ public static class Parser
new Regex(
@"(?<Series>.*)(\b|_)(?!\[)(vol\.?)(?<Volume>\d+(-\d+)?)(?!\])",
MatchOptions, RegexTimeout),
- // TODO: In .NET 7, update this to use raw literal strings and apply the NumberRange everywhere
// Historys Strongest Disciple Kenichi_v11_c90-98.zip or Dance in the Vampire Bund v16-17
new Regex(
@"(?<Series>.*)(\b|_)(?!\[)v(?<Volume>" + NumberRange + @")(?!\])",
@@ -202,6 +225,11 @@ public static class Parser
new Regex(
@"(?<Series>.+?):? (\b|_|-)(vol)\.?(\s|-|_)?\d+",
MatchOptions, RegexTimeout),
+ // [xPearse] Kyochuu Rettou Chapter 001 Volume 1 [English] [Manga] [Volume Scans]
+ new Regex(
+ @"(?<Series>.+?):?(\s|\b|_|-)Chapter(\s|\b|_|-)\d+(\s|\b|_|-)(vol)(ume)",
+ MatchOptions,
+ RegexTimeout),
// [xPearse] Kyochuu Rettou Volume 1 [English] [Manga] [Volume Scans]
new Regex(
@"(?<Series>.+?):? (\b|_|-)(vol)(ume)",
@@ -576,18 +604,12 @@ public static class Parser
MatchOptions, RegexTimeout
);
- // Matches [Complete], release tags like [kmts] but not [ Complete ] or [kmts ]
- private const string TagsInBrackets = $@"\[(?!\s){BalancedBrack}(?<!\s)\]";
-
// Matches anything between balanced parenthesis, tags between brackets, {} and {Complete}
private static readonly Regex CleanupRegex = new Regex(
$@"(?:\({BalancedParen}\)|{TagsInBrackets}|\{{\}}|\{{Complete\}})",
MatchOptions, RegexTimeout
);
- // Common regex patterns present in both Comics and Mangas
- private const string CommonSpecial = @"Specials?|One[- ]?Shot|Extra(?:\sChapter)?(?=\s)|Art Collection|Side Stories|Bonus";
-
private static readonly Regex MangaSpecialRegex = new Regex(
// All Keywords, does not account for checking if contains volume/chapter identification. Parser.Parse() will handle.
$@"\b(?:{CommonSpecial}|Omake)\b",
@@ -601,11 +623,12 @@ public static class Parser
);
private static readonly Regex EuropeanComicRegex = new Regex(
- // All Keywords, does not account for checking if contains volume/chapter identification. Parser.Parse() will handle.
+ // All Keywords, does not account for checking if contains volume/chapter identification. Parser.Parse() will handle.
@"\b(?:Bd[-\s]Fr)\b",
MatchOptions, RegexTimeout
);
+
// If SP\d+ is in the filename, we force treat it as a special regardless if volume or chapter might have been found.
private static readonly Regex SpecialMarkerRegex = new Regex(
@"SP\d+",
@@ -617,14 +640,7 @@ public static class Parser
MatchOptions, RegexTimeout
);
- private static readonly ImmutableArray<string> FormatTagSpecialKeywords = ImmutableArray.Create(
- "Special", "Reference", "Director's Cut", "Box Set", "Box-Set", "Annual", "Anthology", "Epilogue",
- "One Shot", "One-Shot", "Prologue", "TPB", "Trade Paper Back", "Omnibus", "Compendium", "Absolute", "Graphic Novel",
- "GN", "FCBD");
- private static readonly char[] LeadingZeroesTrimChars = new[] { '0' };
-
- private static readonly char[] SpacesAndSeparators = { '\0', '\t', '\r', ' ', '-', ','};
public static MangaFormat ParseFormat(string filePath)
{
@@ -669,11 +685,10 @@ public static class Parser
foreach (var regex in MangaSeriesRegex)
{
var matches = regex.Matches(filename);
- foreach (var group in matches.Select(match => match.Groups["Series"])
- .Where(group => group.Success && group != Match.Empty))
- {
- return CleanTitle(group.Value);
- }
+ var group = matches
+ .Select(match => match.Groups["Series"])
+ .FirstOrDefault(group => group.Success && group != Match.Empty);
+ if (group != null) return CleanTitle(group.Value);
}
return string.Empty;
@@ -683,11 +698,10 @@ public static class Parser
foreach (var regex in ComicSeriesRegex)
{
var matches = regex.Matches(filename);
- foreach (var group in matches.Select(match => match.Groups["Series"])
- .Where(group => group.Success && group != Match.Empty))
- {
- return CleanTitle(group.Value, true);
- }
+ var group = matches
+ .Select(match => match.Groups["Series"])
+ .FirstOrDefault(group => group.Success && group != Match.Empty);
+ if (group != null) return CleanTitle(group.Value, true);
}
return string.Empty;
@@ -898,7 +912,7 @@ public static class Parser
public static bool IsImage(string filePath)
{
- return !filePath.StartsWith(".") && ImageRegex.IsMatch(Path.GetExtension(filePath));
+ return !filePath.StartsWith('.') && ImageRegex.IsMatch(Path.GetExtension(filePath));
}
public static bool IsXml(string filePath)
@@ -1028,9 +1042,9 @@ public static class Parser
/// <example>/manga/1\1 -> /manga/1/1</example>
/// <param name="path"></param>
/// <returns></returns>
- public static string NormalizePath(string path)
+ public static string NormalizePath(string? path)
{
- return path.Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar)
+ return string.IsNullOrEmpty(path) ? string.Empty : path.Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar)
.Replace(@"//", Path.AltDirectorySeparatorChar + string.Empty);
}
@@ -1044,5 +1058,8 @@ public static class Parser
return FormatTagSpecialKeywords.Contains(comicInfoFormat);
}
- private static string ReplaceUnderscores(string name) => name?.Replace("_", " ");
+ private static string ReplaceUnderscores(string name)
+ {
+ return string.IsNullOrEmpty(name) ? string.Empty : name.Replace('_', ' ');
+ }
}
diff --git a/API/Services/Tasks/Scanner/Parser/ParserInfo.cs b/API/Services/Tasks/Scanner/Parser/ParserInfo.cs
index 1f0a9d692..4f860b75e 100644
--- a/API/Services/Tasks/Scanner/Parser/ParserInfo.cs
+++ b/API/Services/Tasks/Scanner/Parser/ParserInfo.cs
@@ -1,8 +1,7 @@
using API.Data.Metadata;
using API.Entities.Enums;
-using API.Services.Tasks.Scanner.Parser;
-namespace API.Parser;
+namespace API.Services.Tasks.Scanner.Parser;
/// <summary>
/// This represents all parsed information from a single file
@@ -17,7 +16,7 @@ public class ParserInfo
/// <summary>
/// Represents the parsed series from the file or folder
/// </summary>
- public string Series { get; set; } = string.Empty;
+ public required string Series { get; set; } = string.Empty;
/// <summary>
/// This can be filled in from ComicInfo.xml/Epub during scanning. Will update the SortName field on <see cref="Entities.Series"/>
/// </summary>
@@ -80,14 +79,14 @@ public class ParserInfo
/// This will contain any EXTRA comicInfo information parsed from the epub or archive. If there is an archive with comicInfo.xml AND it contains
/// series, volume information, that will override what we parsed.
/// </summary>
- public ComicInfo ComicInfo { get; set; }
+ public ComicInfo? ComicInfo { get; set; }
/// <summary>
/// Merges non empty/null properties from info2 into this entity.
/// </summary>
/// <remarks>This does not merge ComicInfo as they should always be the same</remarks>
/// <param name="info2"></param>
- public void Merge(ParserInfo info2)
+ public void Merge(ParserInfo? info2)
{
if (info2 == null) return;
Chapters = string.IsNullOrEmpty(Chapters) || Chapters == "0" ? info2.Chapters: Chapters;
diff --git a/API/Services/Tasks/Scanner/ProcessSeries.cs b/API/Services/Tasks/Scanner/ProcessSeries.cs
index 10a9ed313..f50fd778f 100644
--- a/API/Services/Tasks/Scanner/ProcessSeries.cs
+++ b/API/Services/Tasks/Scanner/ProcessSeries.cs
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Linq;
-using System.Threading;
using System.Threading.Tasks;
using API.Data;
using API.Data.Metadata;
@@ -12,8 +11,9 @@ using API.Entities;
using API.Entities.Enums;
using API.Extensions;
using API.Helpers;
-using API.Parser;
+using API.Helpers.Builders;
using API.Services.Tasks.Metadata;
+using API.Services.Tasks.Scanner.Parser;
using API.SignalR;
using Hangfire;
using Kavita.Common;
@@ -30,6 +30,13 @@ public interface IProcessSeries
Task Prime();
Task ProcessSeriesAsync(IList<ParserInfo> parsedInfos, Library library, bool forceUpdate = false);
void EnqueuePostSeriesProcessTasks(int libraryId, int seriesId, bool forceUpdate = false);
+
+ // These exists only for Unit testing
+ void UpdateSeriesMetadata(Series series, Library library);
+ void UpdateVolumes(Series series, IList<ParserInfo> parsedInfos, bool forceUpdate = false);
+ void UpdateChapters(Series series, Volume volume, IList<ParserInfo> parsedInfos, bool forceUpdate = false);
+ void AddOrUpdateFileForChapter(Chapter chapter, ParserInfo info, bool forceUpdate = false);
+ void UpdateChapterFromComicInfo(Chapter chapter, ComicInfo? info);
}
/// <summary>
@@ -47,16 +54,20 @@ public class ProcessSeries : IProcessSeries
private readonly IMetadataService _metadataService;
private readonly IWordCountAnalyzerService _wordCountAnalyzerService;
private readonly ICollectionTagService _collectionTagService;
+ private readonly IReadingListService _readingListService;
private Dictionary<string, Genre> _genres;
private IList<Person> _people;
private Dictionary<string, Tag> _tags;
private Dictionary<string, CollectionTag> _collectionTags;
+ private readonly object _peopleLock = new object();
+ private readonly object _genreLock = new object();
+ private readonly object _tagLock = new object();
public ProcessSeries(IUnitOfWork unitOfWork, ILogger<ProcessSeries> logger, IEventHub eventHub,
IDirectoryService directoryService, ICacheHelper cacheHelper, IReadingItemService readingItemService,
IFileService fileService, IMetadataService metadataService, IWordCountAnalyzerService wordCountAnalyzerService,
- ICollectionTagService collectionTagService)
+ ICollectionTagService collectionTagService, IReadingListService readingListService)
{
_unitOfWork = unitOfWork;
_logger = logger;
@@ -68,6 +79,13 @@ public class ProcessSeries : IProcessSeries
_metadataService = metadataService;
_wordCountAnalyzerService = wordCountAnalyzerService;
_collectionTagService = collectionTagService;
+ _readingListService = readingListService;
+
+
+ _genres = new Dictionary<string, Genre>();
+ _people = new List<Person>();
+ _tags = new Dictionary<string, Tag>();
+ _collectionTags = new Dictionary<string, CollectionTag>();
}
/// <summary>
@@ -96,7 +114,7 @@ public class ProcessSeries : IProcessSeries
// Check if there is a Series
var firstInfo = parsedInfos.First();
- Series series;
+ Series? series;
try
{
series =
@@ -115,7 +133,9 @@ public class ProcessSeries : IProcessSeries
if (series == null)
{
seriesAdded = true;
- series = DbFactory.Series(firstInfo.Series, firstInfo.LocalizedSeries);
+ series = new SeriesBuilder(firstInfo.Series)
+ .WithLocalizedName(firstInfo.LocalizedSeries)
+ .Build();
_unitOfWork.SeriesRepository.Add(series);
}
@@ -131,7 +151,7 @@ public class ProcessSeries : IProcessSeries
UpdateVolumes(series, parsedInfos, forceUpdate);
series.Pages = series.Volumes.Sum(v => v.Pages);
- series.NormalizedName = Parser.Parser.Normalize(series.Name);
+ series.NormalizedName = series.Name.ToNormalized();
series.OriginalName ??= firstParsedInfo.Series;
if (series.Format == MangaFormat.Unknown)
{
@@ -156,13 +176,11 @@ public class ProcessSeries : IProcessSeries
if (!series.LocalizedNameLocked && !string.IsNullOrEmpty(localizedSeries))
{
series.LocalizedName = localizedSeries;
- series.NormalizedLocalizedName = Parser.Parser.Normalize(series.LocalizedName);
+ series.NormalizedLocalizedName = series.LocalizedName.ToNormalized();
}
UpdateSeriesMetadata(series, library);
- //CreateReadingListsFromSeries(series, library); This will be implemented later when I solution it
-
// Update series FolderPath here
await UpdateSeriesFolderPath(parsedInfos, library, series);
@@ -178,8 +196,16 @@ public class ProcessSeries : IProcessSeries
{
await _unitOfWork.RollbackAsync();
_logger.LogCritical(ex,
- "[ScannerService] There was an issue writing to the database for series {@SeriesName}",
+ "[ScannerService] There was an issue writing to the database for series {SeriesName}",
series.Name);
+ _logger.LogTrace("[ScannerService] Series Metadata Dump: {@Series}", series.Metadata);
+ _logger.LogTrace("[ScannerService] People Dump: {@People}", _people
+ .Select(p =>
+ new {p.Id, p.Name, SeriesMetadataIds =
+ p.SeriesMetadatas?.Select(m => m.Id),
+ ChapterMetadataIds =
+ p.ChapterMetadatas?.Select(m => m.Id)
+ .ToList()}));
await _eventHub.SendMessageAsync(MessageFactory.Error,
MessageFactory.ErrorEvent($"There was an issue writing to the DB for Series {series}",
@@ -187,6 +213,9 @@ public class ProcessSeries : IProcessSeries
return;
}
+ // Process reading list after commit as we need to commit per list
+ await _readingListService.CreateReadingListsFromSeries(series, library);
+
if (seriesAdded)
{
await _eventHub.SendMessageAsync(MessageFactory.SeriesAdded,
@@ -201,30 +230,10 @@ public class ProcessSeries : IProcessSeries
_logger.LogError(ex, "[ScannerService] There was an exception updating series for {SeriesName}", series.Name);
}
- await _metadataService.GenerateCoversForSeries(series, false);
+ await _metadataService.GenerateCoversForSeries(series, (await _unitOfWork.SettingsRepository.GetSettingsDtoAsync()).ConvertCoverToWebP);
EnqueuePostSeriesProcessTasks(series.LibraryId, series.Id);
}
- private void CreateReadingListsFromSeries(Series series, Library library)
- {
- //if (!library.ManageReadingLists) return;
- _logger.LogInformation("Generating Reading Lists for {SeriesName}", series.Name);
-
- series.Metadata ??= DbFactory.SeriesMetadata(new List<CollectionTag>());
- foreach (var chapter in series.Volumes.SelectMany(v => v.Chapters))
- {
- if (!string.IsNullOrEmpty(chapter.StoryArc))
- {
- var readingLists = chapter.StoryArc.Split(',');
- var readingListOrders = chapter.StoryArcNumber.Split(',');
- if (readingListOrders.Length == 0)
- {
- _logger.LogDebug("[ScannerService] There are no StoryArc orders listed, all reading lists fueled from StoryArc will be unordered");
-
- }
- }
- }
- }
private async Task UpdateSeriesFolderPath(IEnumerable<ParserInfo> parsedInfos, Library library, Series series)
{
@@ -254,9 +263,9 @@ public class ProcessSeries : IProcessSeries
BackgroundJob.Enqueue(() => _wordCountAnalyzerService.ScanSeries(libraryId, seriesId, forceUpdate));
}
- private void UpdateSeriesMetadata(Series series, Library library)
+ public void UpdateSeriesMetadata(Series series, Library library)
{
- series.Metadata ??= DbFactory.SeriesMetadata(new List<CollectionTag>());
+ series.Metadata ??= new SeriesMetadataBuilder().Build();
var isBook = library.Type == LibraryType.Book;
var firstChapter = SeriesService.GetFirstChapterForMetadata(series, isBook);
@@ -275,7 +284,9 @@ public class ProcessSeries : IProcessSeries
// Set the AgeRating as highest in all the comicInfos
if (!series.Metadata.AgeRatingLocked) series.Metadata.AgeRating = chapters.Max(chapter => chapter.AgeRating);
+ // Count (aka expected total number of chapters or volumes from metadata) across all chapters
series.Metadata.TotalCount = chapters.Max(chapter => chapter.TotalCount);
+ // The actual number of count's defined across all chapter's metadata
series.Metadata.MaxCount = chapters.Max(chapter => chapter.Count);
// To not have to rely completely on ComicInfo, try to parse out if the series is complete by checking parsed filenames as well.
if (series.Metadata.MaxCount != series.Metadata.TotalCount)
@@ -293,26 +304,25 @@ public class ProcessSeries : IProcessSeries
if (series.Metadata.MaxCount >= series.Metadata.TotalCount && series.Metadata.TotalCount > 0)
{
series.Metadata.PublicationStatus = PublicationStatus.Completed;
- } else if (series.Metadata.TotalCount > 0 && series.Metadata.MaxCount > 0)
+ } else if (series.Metadata.TotalCount > 0)
{
series.Metadata.PublicationStatus = PublicationStatus.Ended;
}
}
- if (!string.IsNullOrEmpty(firstChapter.Summary) && !series.Metadata.SummaryLocked)
+ if (!string.IsNullOrEmpty(firstChapter?.Summary) && !series.Metadata.SummaryLocked)
{
series.Metadata.Summary = firstChapter.Summary;
}
- if (!string.IsNullOrEmpty(firstChapter.Language) && !series.Metadata.LanguageLocked)
+ if (!string.IsNullOrEmpty(firstChapter?.Language) && !series.Metadata.LanguageLocked)
{
series.Metadata.Language = firstChapter.Language;
}
- if (!string.IsNullOrEmpty(firstChapter.SeriesGroup) && library.ManageCollections)
+ if (!string.IsNullOrEmpty(firstChapter?.SeriesGroup) && library.ManageCollections)
{
_logger.LogDebug("Collection tag(s) found for {SeriesName}, updating collections", series.Name);
-
foreach (var collection in firstChapter.SeriesGroup.Split(','))
{
var normalizedName = Parser.Parser.Normalize(collection);
@@ -326,6 +336,16 @@ public class ProcessSeries : IProcessSeries
}
}
+ if (!series.Metadata.GenresLocked)
+ {
+ var genres = chapters.SelectMany(c => c.Genres).ToList();
+ GenreHelper.KeepOnlySameGenreBetweenLists(series.Metadata.Genres.ToList(), genres, genre =>
+ {
+ series.Metadata.Genres.Remove(genre);
+ });
+ }
+
+
// Handle People
foreach (var chapter in chapters)
{
@@ -425,14 +445,6 @@ public class ProcessSeries : IProcessSeries
}
}
}
-
- var genres = chapters.SelectMany(c => c.Genres).ToList();
- GenreHelper.KeepOnlySameGenreBetweenLists(series.Metadata.Genres.ToList(), genres, genre =>
- {
- if (series.Metadata.GenresLocked) return;
- series.Metadata.Genres.Remove(genre);
- });
-
// NOTE: The issue here is that people is just from chapter, but series metadata might already have some people on it
// I might be able to filter out people that are in locked fields?
var people = chapters.SelectMany(c => c.People).ToList();
@@ -471,14 +483,16 @@ public class ProcessSeries : IProcessSeries
case PersonRole.Translator:
if (!series.Metadata.TranslatorLocked) series.Metadata.People.Remove(person);
break;
+ case PersonRole.Other:
default:
series.Metadata.People.Remove(person);
break;
}
});
+
}
- private void UpdateVolumes(Series series, IList<ParserInfo> parsedInfos, bool forceUpdate = false)
+ public void UpdateVolumes(Series series, IList<ParserInfo> parsedInfos, bool forceUpdate = false)
{
var startingVolumeCount = series.Volumes.Count;
// Add new volumes and update chapters per volume
@@ -486,26 +500,23 @@ public class ProcessSeries : IProcessSeries
_logger.LogDebug("[ScannerService] Updating {DistinctVolumes} volumes on {SeriesName}", distinctVolumes.Count, series.Name);
foreach (var volumeNumber in distinctVolumes)
{
- _logger.LogDebug("[ScannerService] Looking up volume for {VolumeNumber}", volumeNumber);
- Volume volume;
+ Volume? volume;
try
{
volume = series.Volumes.SingleOrDefault(s => s.Name == volumeNumber);
}
catch (Exception ex)
{
- if (ex.Message.Equals("Sequence contains more than one matching element"))
- {
- _logger.LogCritical("[ScannerService] Kavita found corrupted volume entries on {SeriesName}. Please delete the series from Kavita via UI and rescan", series.Name);
- throw new KavitaException(
- $"Kavita found corrupted volume entries on {series.Name}. Please delete the series from Kavita via UI and rescan");
- }
- throw;
+ if (!ex.Message.Equals("Sequence contains more than one matching element")) throw;
+ _logger.LogCritical("[ScannerService] Kavita found corrupted volume entries on {SeriesName}. Please delete the series from Kavita via UI and rescan", series.Name);
+ throw new KavitaException(
+ $"Kavita found corrupted volume entries on {series.Name}. Please delete the series from Kavita via UI and rescan");
}
if (volume == null)
{
- volume = DbFactory.Volume(volumeNumber);
- volume.SeriesId = series.Id;
+ volume = new VolumeBuilder(volumeNumber)
+ .WithSeriesId(series.Id)
+ .Build();
series.Volumes.Add(volume);
}
@@ -561,14 +572,14 @@ public class ProcessSeries : IProcessSeries
series.Name, startingVolumeCount, series.Volumes.Count);
}
- private void UpdateChapters(Series series, Volume volume, IList<ParserInfo> parsedInfos, bool forceUpdate = false)
+ public void UpdateChapters(Series series, Volume volume, IList<ParserInfo> parsedInfos, bool forceUpdate = false)
{
// Add new chapters
foreach (var info in parsedInfos)
{
// Specials go into their own chapters with Range being their filename and IsSpecial = True. Non-Specials with Vol and Chap as 0
// also are treated like specials for UI grouping.
- Chapter chapter;
+ Chapter? chapter;
try
{
chapter = volume.Chapters.GetChapterByRange(info);
@@ -583,7 +594,7 @@ public class ProcessSeries : IProcessSeries
{
_logger.LogDebug(
"[ScannerService] Adding new chapter, {Series} - Vol {Volume} Ch {Chapter}", info.Series, info.Volumes, info.Chapters);
- chapter = DbFactory.Chapter(info);
+ chapter = ChapterBuilder.FromParserInfo(info).Build();
volume.Chapters.Add(chapter);
series.UpdateLastChapterAdded();
}
@@ -621,11 +632,11 @@ public class ProcessSeries : IProcessSeries
}
}
- private void AddOrUpdateFileForChapter(Chapter chapter, ParserInfo info, bool forceUpdate = false)
+ public void AddOrUpdateFileForChapter(Chapter chapter, ParserInfo info, bool forceUpdate = false)
{
chapter.Files ??= new List<MangaFile>();
var existingFile = chapter.Files.SingleOrDefault(f => f.FilePath == info.FullFilePath);
- var fileInfo = _directoryService.FileSystem.FileInfo.FromFileName(info.FullFilePath);
+ var fileInfo = _directoryService.FileSystem.FileInfo.New(info.FullFilePath);
if (existingFile != null)
{
existingFile.Format = info.Format;
@@ -637,16 +648,16 @@ public class ProcessSeries : IProcessSeries
}
else
{
- var file = DbFactory.MangaFile(info.FullFilePath, info.Format, _readingItemService.GetNumberOfPages(info.FullFilePath, info.Format));
- if (file == null) return;
- file.Extension = fileInfo.Extension.ToLowerInvariant();
- file.Bytes = fileInfo.Length;
+
+ var file = new MangaFileBuilder(info.FullFilePath, info.Format, _readingItemService.GetNumberOfPages(info.FullFilePath, info.Format))
+ .WithExtension(fileInfo.Extension)
+ .WithBytes(fileInfo.Length)
+ .Build();
chapter.Files.Add(file);
}
}
- #nullable enable
- private void UpdateChapterFromComicInfo(Chapter chapter, ComicInfo? info)
+ public void UpdateChapterFromComicInfo(Chapter chapter, ComicInfo? info)
{
var firstFile = chapter.Files.MinBy(x => x.Chapter);
if (firstFile == null ||
@@ -659,7 +670,7 @@ public class ProcessSeries : IProcessSeries
}
if (comicInfo == null) return;
- _logger.LogDebug("[ScannerService] Read ComicInfo for {File}", firstFile.FilePath);
+ _logger.LogTrace("[ScannerService] Read ComicInfo for {File}", firstFile.FilePath);
chapter.AgeRating = ComicInfo.ConvertAgeRatingToEnum(comicInfo.AgeRating);
@@ -743,77 +754,65 @@ public class ProcessSeries : IProcessSeries
var people = GetTagValues(comicInfo.Colorist);
PersonHelper.RemovePeople(chapter.People, people, PersonRole.Colorist);
- UpdatePeople(people, PersonRole.Colorist,
- AddPerson);
+ UpdatePeople(people, PersonRole.Colorist, AddPerson);
people = GetTagValues(comicInfo.Characters);
PersonHelper.RemovePeople(chapter.People, people, PersonRole.Character);
- UpdatePeople(people, PersonRole.Character,
- AddPerson);
+ UpdatePeople(people, PersonRole.Character, AddPerson);
people = GetTagValues(comicInfo.Translator);
PersonHelper.RemovePeople(chapter.People, people, PersonRole.Translator);
- UpdatePeople(people, PersonRole.Translator,
- AddPerson);
+ UpdatePeople(people, PersonRole.Translator, AddPerson);
people = GetTagValues(comicInfo.Writer);
PersonHelper.RemovePeople(chapter.People, people, PersonRole.Writer);
- UpdatePeople(people, PersonRole.Writer,
- AddPerson);
+ UpdatePeople(people, PersonRole.Writer, AddPerson);
people = GetTagValues(comicInfo.Editor);
PersonHelper.RemovePeople(chapter.People, people, PersonRole.Editor);
- UpdatePeople(people, PersonRole.Editor,
- AddPerson);
+ UpdatePeople(people, PersonRole.Editor, AddPerson);
people = GetTagValues(comicInfo.Inker);
PersonHelper.RemovePeople(chapter.People, people, PersonRole.Inker);
- UpdatePeople(people, PersonRole.Inker,
- AddPerson);
+ UpdatePeople(people, PersonRole.Inker, AddPerson);
people = GetTagValues(comicInfo.Letterer);
PersonHelper.RemovePeople(chapter.People, people, PersonRole.Letterer);
- UpdatePeople(people, PersonRole.Letterer,
- AddPerson);
-
+ UpdatePeople(people, PersonRole.Letterer, AddPerson);
people = GetTagValues(comicInfo.Penciller);
PersonHelper.RemovePeople(chapter.People, people, PersonRole.Penciller);
- UpdatePeople(people, PersonRole.Penciller,
- AddPerson);
+ UpdatePeople(people, PersonRole.Penciller, AddPerson);
people = GetTagValues(comicInfo.CoverArtist);
PersonHelper.RemovePeople(chapter.People, people, PersonRole.CoverArtist);
- UpdatePeople(people, PersonRole.CoverArtist,
- AddPerson);
+ UpdatePeople(people, PersonRole.CoverArtist, AddPerson);
people = GetTagValues(comicInfo.Publisher);
PersonHelper.RemovePeople(chapter.People, people, PersonRole.Publisher);
- UpdatePeople(people, PersonRole.Publisher,
- AddPerson);
+ UpdatePeople(people, PersonRole.Publisher, AddPerson);
var genres = GetTagValues(comicInfo.Genre);
GenreHelper.KeepOnlySameGenreBetweenLists(chapter.Genres,
- genres.Select(DbFactory.Genre).ToList());
+ genres.Select(g => new GenreBuilder(g).Build()).ToList());
UpdateGenre(genres, AddGenre);
var tags = GetTagValues(comicInfo.Tags);
- TagHelper.KeepOnlySameTagBetweenLists(chapter.Tags, tags.Select(DbFactory.Tag).ToList());
+ TagHelper.KeepOnlySameTagBetweenLists(chapter.Tags, tags.Select(t => new TagBuilder(t).Build()).ToList());
UpdateTag(tags, AddTag);
}
private static IList<string> GetTagValues(string comicInfoTagSeparatedByComma)
{
-
+ // TODO: Move this to an extension and test it
if (!string.IsNullOrEmpty(comicInfoTagSeparatedByComma))
{
return comicInfoTagSeparatedByComma.Split(",").Select(s => s.Trim()).DistinctBy(Parser.Parser.Normalize).ToList();
}
return ImmutableList<string>.Empty;
}
- #nullable disable
/// <summary>
/// Given a list of all existing people, this will check the new names and roles and if it doesn't exist in allPeople, will create and
@@ -826,23 +825,23 @@ public class ProcessSeries : IProcessSeries
/// <param name="action"></param>
private void UpdatePeople(IEnumerable<string> names, PersonRole role, Action<Person> action)
{
- var allPeopleTypeRole = _people.Where(p => p.Role == role).ToList();
-
- foreach (var name in names)
+ lock (_peopleLock)
{
- var normalizedName = Parser.Parser.Normalize(name);
- var person = allPeopleTypeRole.FirstOrDefault(p =>
- p.NormalizedName.Equals(normalizedName));
- if (person == null)
+ var allPeopleTypeRole = _people.Where(p => p.Role == role).ToList();
+
+ foreach (var name in names)
{
- person = DbFactory.Person(name, role);
- lock (_people)
+ var normalizedName = name.ToNormalized();
+ var person = allPeopleTypeRole.FirstOrDefault(p =>
+ p.NormalizedName != null && p.NormalizedName.Equals(normalizedName));
+
+ if (person == null)
{
+ person = new PersonBuilder(name, role).Build();
_people.Add(person);
}
+ action(person);
}
-
- action(person);
}
}
@@ -855,15 +854,15 @@ public class ProcessSeries : IProcessSeries
{
foreach (var name in names)
{
- var normalizedName = Parser.Parser.Normalize(name);
+ var normalizedName = name.ToNormalized();
if (string.IsNullOrEmpty(normalizedName)) continue;
_genres.TryGetValue(normalizedName, out var genre);
var newTag = genre == null;
if (newTag)
{
- genre = DbFactory.Genre(name);
- lock (_genres)
+ genre = new GenreBuilder(name).Build();
+ lock (_genreLock)
{
_genres.Add(normalizedName, genre);
_unitOfWork.GenreRepository.Attach(genre);
@@ -885,14 +884,14 @@ public class ProcessSeries : IProcessSeries
{
if (string.IsNullOrEmpty(name.Trim())) continue;
- var normalizedName = Parser.Parser.Normalize(name);
+ var normalizedName = name.ToNormalized();
_tags.TryGetValue(normalizedName, out var tag);
var added = tag == null;
if (tag == null)
{
- tag = DbFactory.Tag(name);
- lock (_tags)
+ tag = new TagBuilder(name).Build();
+ lock (_tagLock)
{
_tags.Add(normalizedName, tag);
}
diff --git a/API/Services/Tasks/ScannerService.cs b/API/Services/Tasks/ScannerService.cs
index 26962183d..7c3a6abf5 100644
--- a/API/Services/Tasks/ScannerService.cs
+++ b/API/Services/Tasks/ScannerService.cs
@@ -9,10 +9,11 @@ using API.Data;
using API.Data.Repositories;
using API.Entities;
using API.Entities.Enums;
+using API.Extensions;
using API.Helpers;
-using API.Parser;
using API.Services.Tasks.Metadata;
using API.Services.Tasks.Scanner;
+using API.Services.Tasks.Scanner.Parser;
using API.SignalR;
using Hangfire;
using Microsoft.Extensions.Logging;
@@ -34,7 +35,7 @@ public interface IScannerService
[Queue(TaskScheduler.ScanQueue)]
[DisableConcurrentExecution(60 * 60 * 60)]
[AutomaticRetry(Attempts = 3, OnAttemptsExceeded = AttemptsExceededAction.Delete)]
- Task ScanLibraries();
+ Task ScanLibraries(bool forceUpdate = false);
[Queue(TaskScheduler.ScanQueue)]
[DisableConcurrentExecution(60 * 60 * 60)]
@@ -115,7 +116,7 @@ public class ScannerService : IScannerService
foreach (var file in missingExtensions)
{
- var fileInfo = _directoryService.FileSystem.FileInfo.FromFileName(file.FilePath);
+ var fileInfo = _directoryService.FileSystem.FileInfo.New(file.FilePath);
if (!fileInfo.Exists)continue;
file.Extension = fileInfo.Extension.ToLowerInvariant();
file.Bytes = fileInfo.Length;
@@ -134,7 +135,7 @@ public class ScannerService : IScannerService
/// <param name="folder"></param>
public async Task ScanFolder(string folder)
{
- Series series = null;
+ Series? series = null;
try
{
series = await _unitOfWork.SeriesRepository.GetSeriesByFolderPath(folder, SeriesIncludes.Library);
@@ -193,6 +194,7 @@ public class ScannerService : IScannerService
if (series == null) return; // This can occur when UI deletes a series but doesn't update and user re-requests update
var chapterIds = await _unitOfWork.SeriesRepository.GetChapterIdsForSeriesAsync(new[] {seriesId});
var library = await _unitOfWork.LibraryRepository.GetLibraryForIdAsync(series.LibraryId, LibraryIncludes.Folders);
+ if (library == null) return;
var libraryPaths = library.Folders.Select(f => f.Path).ToList();
if (await ShouldScanSeries(seriesId, library, libraryPaths, series, true) != ScanCancelReason.NoCancel)
{
@@ -216,7 +218,7 @@ public class ScannerService : IScannerService
folderPath = seriesDirs.Keys.FirstOrDefault();
// We should check if folderPath is a library folder path and if so, return early and tell user to correct their setup.
- if (libraryPaths.Contains(folderPath))
+ if (!string.IsNullOrEmpty(folderPath) && libraryPaths.Contains(folderPath))
{
_logger.LogCritical("[ScannerSeries] {SeriesName} scan aborted. Files for series are not in a nested folder under library path. Correct this and rescan", series.Name);
await _eventHub.SendMessageAsync(MessageFactory.Error, MessageFactory.ErrorEvent($"{series.Name} scan aborted", "Files for series are not in a nested folder under library path. Correct this and rescan."));
@@ -246,12 +248,12 @@ public class ScannerService : IScannerService
var foundParsedSeries = new ParsedSeries()
{
Name = parsedFiles.First().Series,
- NormalizedName = Scanner.Parser.Parser.Normalize(parsedFiles.First().Series),
+ NormalizedName = parsedFiles.First().Series.ToNormalized(),
Format = parsedFiles.First().Format
};
// For Scan Series, we need to filter out anything that isn't our Series
- if (!foundParsedSeries.NormalizedName.Equals(series.NormalizedName) && !foundParsedSeries.NormalizedName.Equals(Scanner.Parser.Parser.Normalize(series.OriginalName)))
+ if (!foundParsedSeries.NormalizedName.Equals(series.NormalizedName) && !foundParsedSeries.NormalizedName.Equals(series.OriginalName?.ToNormalized()))
{
return;
}
@@ -275,9 +277,7 @@ public class ScannerService : IScannerService
if (parsedSeries.Count == 0)
{
var seriesFiles = (await _unitOfWork.SeriesRepository.GetFilesForSeries(series.Id));
- var anyFilesExist = seriesFiles.Where(f => f.FilePath.Contains(series.FolderPath)).Any(m => File.Exists(m.FilePath));
-
- if (!anyFilesExist)
+ if (!string.IsNullOrEmpty(series.FolderPath) && !seriesFiles.Where(f => f.FilePath.Contains(series.FolderPath)).Any(m => File.Exists(m.FilePath)))
{
try
{
@@ -320,7 +320,8 @@ public class ScannerService : IScannerService
private async Task<ScanCancelReason> ShouldScanSeries(int seriesId, Library library, IList<string> libraryPaths, Series series, bool bypassFolderChecks = false)
{
var seriesFolderPaths = (await _unitOfWork.SeriesRepository.GetFilesForSeries(seriesId))
- .Select(f => _directoryService.FileSystem.FileInfo.FromFileName(f.FilePath).Directory.FullName)
+ .Select(f => _directoryService.FileSystem.FileInfo.New(f.FilePath).Directory?.FullName ?? string.Empty)
+ .Where(f => !string.IsNullOrEmpty(f))
.Distinct()
.ToList();
@@ -438,12 +439,12 @@ public class ScannerService : IScannerService
[Queue(TaskScheduler.ScanQueue)]
[DisableConcurrentExecution(60 * 60 * 60)]
[AutomaticRetry(Attempts = 3, OnAttemptsExceeded = AttemptsExceededAction.Delete)]
- public async Task ScanLibraries()
+ public async Task ScanLibraries(bool forceUpdate = false)
{
_logger.LogInformation("Starting Scan of All Libraries");
foreach (var lib in await _unitOfWork.LibraryRepository.GetLibrariesAsync())
{
- await ScanLibrary(lib.Id);
+ await ScanLibrary(lib.Id, forceUpdate);
}
_logger.LogInformation("Scan of All Libraries Finished");
}
@@ -463,7 +464,7 @@ public class ScannerService : IScannerService
{
var sw = Stopwatch.StartNew();
var library = await _unitOfWork.LibraryRepository.GetLibraryForIdAsync(libraryId, LibraryIncludes.Folders);
- var libraryFolderPaths = library.Folders.Select(fp => fp.Path).ToList();
+ var libraryFolderPaths = library!.Folders.Select(fp => fp.Path).ToList();
if (!await CheckMounts(library.Name, libraryFolderPaths)) return;
@@ -519,16 +520,18 @@ public class ScannerService : IScannerService
var scanElapsedTime = await ScanFiles(library, libraryFolderPaths, shouldUseLibraryScan, TrackFiles, forceUpdate);
+ // NOTE: This runs sync after every file is scanned
foreach (var task in processTasks)
{
await task();
}
- await _eventHub.SendMessageAsync(MessageFactory.NotificationProgress, MessageFactory.FileScanProgressEvent(string.Empty, library.Name, ProgressEventType.Ended));
+ await _eventHub.SendMessageAsync(MessageFactory.NotificationProgress,
+ MessageFactory.FileScanProgressEvent(string.Empty, library.Name, ProgressEventType.Ended));
_logger.LogInformation("[ScannerService] Finished file scan in {ScanAndUpdateTime} milliseconds. Updating database", scanElapsedTime);
- var time = DateTime.UtcNow;
+ var time = DateTime.Now;
foreach (var folderPath in library.Folders)
{
folderPath.UpdateLastScanned(time);
@@ -589,7 +592,7 @@ public class ScannerService : IScannerService
}
private async Task<long> ScanFiles(Library library, IEnumerable<string> dirs,
- bool isLibraryScan, Func<Tuple<bool, IList<ParserInfo>>, Task> processSeriesInfos = null, bool forceChecks = false)
+ bool isLibraryScan, Func<Tuple<bool, IList<ParserInfo>>, Task>? processSeriesInfos = null, bool forceChecks = false)
{
var scanner = new ParseScannedFiles(_logger, _directoryService, _readingItemService, _eventHub);
var scanWatch = Stopwatch.StartNew();
@@ -602,26 +605,6 @@ public class ScannerService : IScannerService
return scanElapsedTime;
}
- /// <summary>
- /// Remove any user progress rows that no longer exist since scan library ran and deleted series/volumes/chapters
- /// </summary>
- private async Task CleanupAbandonedChapters()
- {
- var cleanedUp = await _unitOfWork.AppUserProgressRepository.CleanupAbandonedChapters();
- _logger.LogInformation("Removed {Count} abandoned progress rows", cleanedUp);
- }
-
-
- /// <summary>
- /// Cleans up any abandoned rows due to removals from Scan loop
- /// </summary>
- private async Task CleanupDbEntities()
- {
- await CleanupAbandonedChapters();
- var cleanedUp = await _unitOfWork.CollectionTagRepository.RemoveTagsWithoutSeries();
- _logger.LogInformation("Removed {Count} abandoned collection tags", cleanedUp);
- }
-
public static IEnumerable<Series> FindSeriesNotOnDisk(IEnumerable<Series> existingSeries, Dictionary<ParsedSeries, IList<ParserInfo>> parsedSeries)
{
return existingSeries.Where(es => !ParserInfoHelpers.SeriesHasMatchingParserInfoFormat(es, parsedSeries));
diff --git a/API/Services/Tasks/SiteThemeService.cs b/API/Services/Tasks/SiteThemeService.cs
index 8de7f879c..da08b327b 100644
--- a/API/Services/Tasks/SiteThemeService.cs
+++ b/API/Services/Tasks/SiteThemeService.cs
@@ -4,6 +4,7 @@ using System.Threading.Tasks;
using API.Data;
using API.Entities;
using API.Entities.Enums.Theme;
+using API.Extensions;
using API.SignalR;
using Kavita.Common;
using Microsoft.AspNetCore.Authorization;
@@ -56,7 +57,7 @@ public class ThemeService : IThemeService
var reservedNames = Seed.DefaultThemes.Select(t => t.NormalizedName).ToList();
var themeFiles = _directoryService
.GetFilesWithExtension(Scanner.Parser.Parser.NormalizePath(_directoryService.SiteThemeDirectory), @"\.css")
- .Where(name => !reservedNames.Contains(Scanner.Parser.Parser.Normalize(name))).ToList();
+ .Where(name => !reservedNames.Contains(name.ToNormalized())).ToList();
var allThemes = (await _unitOfWork.SiteThemeRepository.GetThemes()).ToList();
@@ -78,7 +79,7 @@ public class ThemeService : IThemeService
foreach (var themeFile in themeFiles)
{
var themeName =
- Scanner.Parser.Parser.Normalize(_directoryService.FileSystem.Path.GetFileNameWithoutExtension(themeFile));
+ _directoryService.FileSystem.Path.GetFileNameWithoutExtension(themeFile).ToNormalized();
if (allThemeNames.Contains(themeName)) continue;
_unitOfWork.SiteThemeRepository.Add(new SiteTheme()
diff --git a/API/Services/Tasks/StatsService.cs b/API/Services/Tasks/StatsService.cs
index a4cb355c5..e6035d23a 100644
--- a/API/Services/Tasks/StatsService.cs
+++ b/API/Services/Tasks/StatsService.cs
@@ -161,11 +161,11 @@ public class StatsService : IStatsService
if (firstAdminUser != null)
{
- var firstAdminUserPref = (await _unitOfWork.UserRepository.GetPreferencesAsync(firstAdminUser.UserName));
- var activeTheme = firstAdminUserPref.Theme ?? Seed.DefaultThemes.First(t => t.IsDefault);
+ var firstAdminUserPref = (await _unitOfWork.UserRepository.GetPreferencesAsync(firstAdminUser.UserName!));
+ var activeTheme = firstAdminUserPref?.Theme ?? Seed.DefaultThemes.First(t => t.IsDefault);
serverInfo.ActiveSiteTheme = activeTheme.Name;
- serverInfo.MangaReaderMode = firstAdminUserPref.ReaderMode;
+ if (firstAdminUserPref != null) serverInfo.MangaReaderMode = firstAdminUserPref.ReaderMode;
}
return serverInfo;
@@ -242,7 +242,7 @@ public class StatsService : IStatsService
// If first time flow, just return 0
if (!await _context.Series.AnyAsync()) return 0;
return await _context.Series
- .Select(s => _context.Library.Where(l => l.Id == s.LibraryId).SelectMany(l => l.Series).Count())
+ .Select(s => _context.Library.Where(l => l.Id == s.LibraryId).SelectMany(l => l.Series!).Count())
.MaxAsync();
}
@@ -254,7 +254,7 @@ public class StatsService : IStatsService
.Select(v => new
{
v.SeriesId,
- Count = _context.Series.Where(s => s.Id == v.SeriesId).SelectMany(s => s.Volumes).Count()
+ Count = _context.Series.Where(s => s.Id == v.SeriesId).SelectMany(s => s.Volumes!).Count()
})
.AsNoTracking()
.AsSplitQuery()
@@ -268,9 +268,9 @@ public class StatsService : IStatsService
return await _context.Series
.AsNoTracking()
.AsSplitQuery()
- .MaxAsync(s => s.Volumes
+ .MaxAsync(s => s.Volumes!
.Where(v => v.Number == 0)
- .SelectMany(v => v.Chapters)
+ .SelectMany(v => v.Chapters!)
.Count());
}
@@ -292,13 +292,14 @@ public class StatsService : IStatsService
private IEnumerable<FileFormatDto> AllFormats()
{
+ // TODO: Rewrite this with new migration code in feature/basic-stats
var results = _context.MangaFile
.AsNoTracking()
.AsEnumerable()
.Select(m => new FileFormatDto()
{
Format = m.Format,
- Extension = Path.GetExtension(m.FilePath)?.ToLowerInvariant()
+ Extension = Path.GetExtension(m.FilePath)?.ToLowerInvariant()!
})
.DistinctBy(f => f.Extension)
.ToList();
diff --git a/API/Services/Tasks/VersionUpdaterService.cs b/API/Services/Tasks/VersionUpdaterService.cs
index 8d79b3a45..3f5d81b22 100644
--- a/API/Services/Tasks/VersionUpdaterService.cs
+++ b/API/Services/Tasks/VersionUpdaterService.cs
@@ -4,12 +4,10 @@ using System.Linq;
using System.Threading.Tasks;
using API.DTOs.Update;
using API.SignalR;
-using API.SignalR.Presence;
using Flurl.Http;
using Kavita.Common.EnvironmentInfo;
using Kavita.Common.Helpers;
using MarkdownDeep;
-using Microsoft.AspNetCore.SignalR;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
@@ -22,30 +20,30 @@ internal class GithubReleaseMetadata
/// <example>v0.4.3</example>
/// </summary>
// ReSharper disable once InconsistentNaming
- public string Tag_Name { get; init; }
+ public required string Tag_Name { get; init; }
/// <summary>
/// Name of the Release
/// </summary>
- public string Name { get; init; }
+ public required string Name { get; init; }
/// <summary>
/// Body of the Release
/// </summary>
- public string Body { get; init; }
+ public required string Body { get; init; }
/// <summary>
/// Url of the release on Github
/// </summary>
// ReSharper disable once InconsistentNaming
- public string Html_Url { get; init; }
+ public required string Html_Url { get; init; }
/// <summary>
/// Date Release was Published
/// </summary>
// ReSharper disable once InconsistentNaming
- public string Published_At { get; init; }
+ public required string Published_At { get; init; }
}
public interface IVersionUpdaterService
{
- Task<UpdateNotificationDto> CheckForUpdate();
+ Task<UpdateNotificationDto?> CheckForUpdate();
Task PushUpdate(UpdateNotificationDto update);
Task<IEnumerable<UpdateNotificationDto>> GetAllReleases();
}
@@ -79,16 +77,17 @@ public class VersionUpdaterService : IVersionUpdaterService
{
var update = await GetGithubRelease();
var dto = CreateDto(update);
+ if (dto == null) return null;
return new Version(dto.UpdateVersion) <= new Version(dto.CurrentVersion) ? null : dto;
}
public async Task<IEnumerable<UpdateNotificationDto>> GetAllReleases()
{
var updates = await GetGithubReleases();
- return updates.Select(CreateDto);
+ return updates.Select(CreateDto).Where(d => d != null)!;
}
- private UpdateNotificationDto CreateDto(GithubReleaseMetadata update)
+ private UpdateNotificationDto? CreateDto(GithubReleaseMetadata? update)
{
if (update == null || string.IsNullOrEmpty(update.Tag_Name)) return null;
var updateVersion = new Version(update.Tag_Name.Replace("v", string.Empty));
@@ -106,7 +105,7 @@ public class VersionUpdaterService : IVersionUpdaterService
};
}
- public async Task PushUpdate(UpdateNotificationDto update)
+ public async Task PushUpdate(UpdateNotificationDto? update)
{
if (update == null) return;
diff --git a/API/Services/TokenService.cs b/API/Services/TokenService.cs
index 923c3b1d7..06cc41d66 100644
--- a/API/Services/TokenService.cs
+++ b/API/Services/TokenService.cs
@@ -19,7 +19,7 @@ namespace API.Services;
public interface ITokenService
{
Task<string> CreateToken(AppUser user);
- Task<TokenRequestDto> ValidateRefreshToken(TokenRequestDto request);
+ Task<TokenRequestDto?> ValidateRefreshToken(TokenRequestDto request);
Task<string> CreateRefreshToken(AppUser user);
}
@@ -28,19 +28,20 @@ public class TokenService : ITokenService
{
private readonly UserManager<AppUser> _userManager;
private readonly SymmetricSecurityKey _key;
+ private const string RefreshTokenName = "RefreshToken";
public TokenService(IConfiguration config, UserManager<AppUser> userManager)
{
_userManager = userManager;
- _key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(config["TokenKey"]));
+ _key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(config["TokenKey"] ?? string.Empty));
}
public async Task<string> CreateToken(AppUser user)
{
var claims = new List<Claim>
{
- new Claim(JwtRegisteredClaimNames.Name, user.UserName),
+ new Claim(JwtRegisteredClaimNames.Name, user.UserName!),
new Claim(ClaimTypes.NameIdentifier, user.Id.ToString()),
};
@@ -65,27 +66,40 @@ public class TokenService : ITokenService
public async Task<string> CreateRefreshToken(AppUser user)
{
- await _userManager.RemoveAuthenticationTokenAsync(user, TokenOptions.DefaultProvider, "RefreshToken");
- var refreshToken = await _userManager.GenerateUserTokenAsync(user, TokenOptions.DefaultProvider, "RefreshToken");
- await _userManager.SetAuthenticationTokenAsync(user, TokenOptions.DefaultProvider, "RefreshToken", refreshToken);
+ await _userManager.RemoveAuthenticationTokenAsync(user, TokenOptions.DefaultProvider, RefreshTokenName);
+ var refreshToken = await _userManager.GenerateUserTokenAsync(user, TokenOptions.DefaultProvider, RefreshTokenName);
+ await _userManager.SetAuthenticationTokenAsync(user, TokenOptions.DefaultProvider, RefreshTokenName, refreshToken);
return refreshToken;
}
- public async Task<TokenRequestDto> ValidateRefreshToken(TokenRequestDto request)
+ public async Task<TokenRequestDto?> ValidateRefreshToken(TokenRequestDto request)
{
- var tokenHandler = new JwtSecurityTokenHandler();
- var tokenContent = tokenHandler.ReadJwtToken(request.Token);
- var username = tokenContent.Claims.FirstOrDefault(q => q.Type == JwtRegisteredClaimNames.NameId)?.Value;
- var user = await _userManager.FindByNameAsync(username);
- if (user == null) return null; // This forces a logout
- await _userManager.VerifyUserTokenAsync(user, TokenOptions.DefaultProvider, "RefreshToken", request.RefreshToken);
-
- await _userManager.UpdateSecurityStampAsync(user);
-
- return new TokenRequestDto()
+ try
{
- Token = await CreateToken(user),
- RefreshToken = await CreateRefreshToken(user)
- };
+ var tokenHandler = new JwtSecurityTokenHandler();
+ var tokenContent = tokenHandler.ReadJwtToken(request.Token);
+ var username = tokenContent.Claims.FirstOrDefault(q => q.Type == JwtRegisteredClaimNames.NameId)?.Value;
+ if (string.IsNullOrEmpty(username)) return null;
+ var user = await _userManager.FindByIdAsync(username);
+ if (user == null) return null; // This forces a logout
+ var validated = await _userManager.VerifyUserTokenAsync(user, TokenOptions.DefaultProvider, RefreshTokenName, request.RefreshToken);
+ if (!validated) return null;
+ await _userManager.UpdateSecurityStampAsync(user);
+
+ return new TokenRequestDto()
+ {
+ Token = await CreateToken(user),
+ RefreshToken = await CreateRefreshToken(user)
+ };
+ } catch (SecurityTokenExpiredException)
+ {
+ // Handle expired token
+ return null;
+ }
+ catch (Exception)
+ {
+ // Handle other exceptions
+ return null;
+ }
}
}
diff --git a/API/SignalR/EventHub.cs b/API/SignalR/EventHub.cs
index d5820ab09..3f5eed44a 100644
--- a/API/SignalR/EventHub.cs
+++ b/API/SignalR/EventHub.cs
@@ -1,4 +1,5 @@
using System.Linq;
+using System;
using System.Threading.Tasks;
using API.Data;
using API.SignalR.Presence;
@@ -54,8 +55,8 @@ public class EventHub : IEventHub
/// <returns></returns>
public async Task SendMessageToAsync(string method, SignalRMessage message, int userId)
{
- var user = await _unitOfWork.UserRepository.GetUserByIdAsync(userId);
- await _messageHub.Clients.User(user.UserName).SendAsync(method, message);
+ var user = await _unitOfWork.UserRepository.GetUserByIdAsync(userId) ?? throw new InvalidOperationException();
+ await _messageHub.Clients.User(user.UserName!).SendAsync(method, message);
}
}
diff --git a/API/SignalR/LogHub.cs b/API/SignalR/LogHub.cs
index 5158a389f..975711dfd 100644
--- a/API/SignalR/LogHub.cs
+++ b/API/SignalR/LogHub.cs
@@ -26,13 +26,13 @@ public class LogHub : Hub<ILogHub>
public override async Task OnConnectedAsync()
{
- await _tracker.UserConnected(Context.User.GetUserId(), Context.ConnectionId);
+ await _tracker.UserConnected(Context.User!.GetUserId(), Context.ConnectionId);
await base.OnConnectedAsync();
}
- public override async Task OnDisconnectedAsync(Exception exception)
+ public override async Task OnDisconnectedAsync(Exception? exception)
{
- await _tracker.UserDisconnected(Context.User.GetUserId(), Context.ConnectionId);
+ await _tracker.UserDisconnected(Context.User!.GetUserId(), Context.ConnectionId);
await base.OnDisconnectedAsync(exception);
}
diff --git a/API/SignalR/MessageFactory.cs b/API/SignalR/MessageFactory.cs
index 11c1e625b..e71d8fda8 100644
--- a/API/SignalR/MessageFactory.cs
+++ b/API/SignalR/MessageFactory.cs
@@ -1,9 +1,5 @@
using System;
-using System.Diagnostics;
-using System.IO;
-using System.Threading;
using API.DTOs.Update;
-using API.Entities;
using API.Extensions;
namespace API.SignalR;
diff --git a/API/SignalR/MessageHub.cs b/API/SignalR/MessageHub.cs
index 23ceaa8be..1e75e13de 100644
--- a/API/SignalR/MessageHub.cs
+++ b/API/SignalR/MessageHub.cs
@@ -22,7 +22,7 @@ public class MessageHub : Hub
public override async Task OnConnectedAsync()
{
- await _tracker.UserConnected(Context.User.GetUserId(), Context.ConnectionId);
+ await _tracker.UserConnected(Context.User!.GetUserId(), Context.ConnectionId);
var currentUsers = await PresenceTracker.GetOnlineUsers();
await Clients.All.SendAsync(MessageFactory.OnlineUsers, currentUsers);
@@ -31,9 +31,9 @@ public class MessageHub : Hub
await base.OnConnectedAsync();
}
- public override async Task OnDisconnectedAsync(Exception exception)
+ public override async Task OnDisconnectedAsync(Exception? exception)
{
- await _tracker.UserDisconnected(Context.User.GetUserId(), Context.ConnectionId);
+ await _tracker.UserDisconnected(Context.User!.GetUserId(), Context.ConnectionId);
var currentUsers = await PresenceTracker.GetOnlineUsers();
await Clients.All.SendAsync(MessageFactory.OnlineUsers, currentUsers);
diff --git a/API/SignalR/Presence/PresenceTracker.cs b/API/SignalR/Presence/PresenceTracker.cs
index 1e9f930f3..45e2a0bcc 100644
--- a/API/SignalR/Presence/PresenceTracker.cs
+++ b/API/SignalR/Presence/PresenceTracker.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using API.Data;
@@ -18,7 +17,7 @@ public interface IPresenceTracker
internal class ConnectionDetail
{
public string UserName { get; set; }
- public List<string> ConnectionIds { get; set; }
+ public List<string> ConnectionIds { get; set; } = new List<string>();
public bool IsAdmin { get; set; }
}
@@ -43,9 +42,9 @@ public class PresenceTracker : IPresenceTracker
var isAdmin = await _unitOfWork.UserRepository.IsUserAdminAsync(user);
lock (OnlineUsers)
{
- if (OnlineUsers.ContainsKey(userId))
+ if (OnlineUsers.TryGetValue(userId, out var detail))
{
- OnlineUsers[userId].ConnectionIds.Add(connectionId);
+ detail.ConnectionIds.Add(connectionId);
}
else
{
@@ -104,7 +103,7 @@ public class PresenceTracker : IPresenceTracker
public Task<List<string>> GetConnectionsForUser(int userId)
{
- List<string> connectionIds;
+ List<string>? connectionIds;
lock (OnlineUsers)
{
connectionIds = OnlineUsers.GetValueOrDefault(userId)?.ConnectionIds;
diff --git a/API/SignalR/SignalRMessage.cs b/API/SignalR/SignalRMessage.cs
index 6c8afe844..d3f250293 100644
--- a/API/SignalR/SignalRMessage.cs
+++ b/API/SignalR/SignalRMessage.cs
@@ -10,8 +10,8 @@ public class SignalRMessage
/// <summary>
/// Body of the event type
/// </summary>
- public object Body { get; set; }
- public string Name { get; set; }
+ public object? Body { get; set; }
+ public required string Name { get; set; }
/// <summary>
/// User friendly Title of the Event
/// </summary>
diff --git a/API/Startup.cs b/API/Startup.cs
index f84ef6387..8e8a2e1ce 100644
--- a/API/Startup.cs
+++ b/API/Startup.cs
@@ -6,6 +6,7 @@ using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Reflection;
+using System.Threading.RateLimiting;
using System.Threading.Tasks;
using API.Constants;
using API.Data;
@@ -14,13 +15,13 @@ using API.Entities.Enums;
using API.Extensions;
using API.Logging;
using API.Middleware;
+using API.Middleware.RateLimit;
using API.Services;
using API.Services.HostedServices;
using API.Services.Tasks;
using API.SignalR;
using Hangfire;
-using Hangfire.MemoryStorage;
-using Hangfire.Storage.SQLite;
+using HtmlAgilityPack;
using Kavita.Common;
using Kavita.Common.EnvironmentInfo;
using Microsoft.AspNetCore.Builder;
@@ -31,6 +32,7 @@ using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.ResponseCompression;
using Microsoft.AspNetCore.StaticFiles;
+using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
@@ -111,7 +113,7 @@ public class Startup
{
options.ForwardedHeaders = ForwardedHeaders.All;
foreach(var proxy in _config.GetSection("KnownProxies").AsEnumerable().Where(c => c.Value != null)) {
- options.KnownProxies.Add(IPAddress.Parse(proxy.Value));
+ options.KnownProxies.Add(IPAddress.Parse(proxy.Value!));
}
});
services.AddCors();
@@ -180,6 +182,12 @@ public class Startup
services.AddResponseCaching();
+ services.AddRateLimiter(options =>
+ {
+ options.AddPolicy("Authentication", httpContext =>
+ new AuthenticationRateLimiterPolicy().GetPartition(httpContext));
+ });
+
services.AddHangfire(configuration => configuration
.UseSimpleAssemblyNameTypeSerializer()
.UseRecommendedSerializerSettings()
@@ -216,6 +224,7 @@ public class Startup
logger.LogInformation("Running Migrations");
+
// Only run this if we are upgrading
await MigrateChangePasswordRoles.Migrate(unitOfWork, userManager);
await MigrateRemoveExtraThemes.Migrate(unitOfWork, themeService);
@@ -237,6 +246,9 @@ public class Startup
// v0.7
await MigrateBrokenGMT1Dates.Migrate(unitOfWork, dataContext, logger);
+ // v0.7.2
+ await MigrateLoginRoles.Migrate(unitOfWork, userManager, logger);
+
// Update the version in the DB after all migrations are run
var installVersion = await unitOfWork.SettingsRepository.GetSettingAsync(ServerSettingKey.InstallVersion);
installVersion.Value = BuildInfo.Version.ToString();
@@ -275,6 +287,26 @@ public class Startup
app.UseForwardedHeaders();
+ app.UseRateLimiter();
+
+ var basePath = Configuration.BaseUrl;
+ app.UsePathBase(basePath);
+ if (!env.IsDevelopment())
+ {
+ // We don't update the index.html in local as we don't serve from there
+ UpdateBaseUrlInIndex(basePath);
+
+ // Update DB with what's in config
+ var dataContext = serviceProvider.GetRequiredService<DataContext>();
+ var setting = dataContext.ServerSetting.SingleOrDefault(x => x.Key == ServerSettingKey.BaseUrl);
+ if (setting != null)
+ {
+ setting.Value = basePath;
+ }
+
+ dataContext.SaveChanges();
+ }
+
app.UseRouting();
// Ordering is important. Cors, authentication, authorization
@@ -284,7 +316,17 @@ public class Startup
.AllowAnyHeader()
.AllowAnyMethod()
.AllowCredentials() // For SignalR token query param
- .WithOrigins("http://localhost:4200", $"http://{GetLocalIpAddress()}:4200", $"http://{GetLocalIpAddress()}:5000")
+ .WithOrigins("http://localhost:4200", $"http://{GetLocalIpAddress()}:4200", $"http://{GetLocalIpAddress()}:5000", "https://kavita.majora2007.duckdns.org")
+ .WithExposedHeaders("Content-Disposition", "Pagination"));
+ }
+ else
+ {
+ // Allow CORS for Kavita's url
+ app.UseCors(policy => policy
+ .AllowAnyHeader()
+ .AllowAnyMethod()
+ .AllowCredentials() // For SignalR token query param
+ .WithOrigins("https://kavita.majora2007.duckdns.org")
.WithExposedHeaders("Content-Disposition", "Pagination"));
}
@@ -303,6 +345,7 @@ public class Startup
OnPrepareResponse = ctx =>
{
ctx.Context.Response.Headers[HeaderNames.CacheControl] = "public,max-age=" + TimeSpan.FromHours(24);
+ ctx.Context.Response.Headers["X-Robots-Tag"] = "noindex,nofollow";
}
});
@@ -318,7 +361,7 @@ public class Startup
new[] { "Accept-Encoding" };
// Don't let the site be iframed outside the same origin (clickjacking)
- context.Response.Headers.XFrameOptions = "SAMEORIGIN";
+ context.Response.Headers.XFrameOptions = Configuration.XFrameOptions;
// Setup CSP to ensure we load assets only from these origins
context.Response.Headers.Add("Content-Security-Policy", "frame-ancestors 'none';");
@@ -349,6 +392,32 @@ public class Startup
}
Console.WriteLine($"Kavita - v{BuildInfo.Version}");
});
+
+ var _logger = serviceProvider.GetRequiredService<ILogger<Startup>>();
+ _logger.LogInformation("Starting with base url as {BaseUrl}", basePath);
+ }
+
+ private static void UpdateBaseUrlInIndex(string baseUrl)
+ {
+ try
+ {
+ var htmlDoc = new HtmlDocument();
+ var indexHtmlPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "index.html");
+ htmlDoc.Load(indexHtmlPath);
+
+ var baseNode = htmlDoc.DocumentNode.SelectSingleNode("/html/head/base");
+ baseNode.SetAttributeValue("href", baseUrl);
+ htmlDoc.Save(indexHtmlPath);
+ }
+ catch (Exception ex)
+ {
+ if ((ex.Message.Contains("Permission denied") || ex.Message.Contains("UnauthorizedAccessException")) && baseUrl.Equals(Configuration.DefaultBaseUrl) && new OsInfo().IsDocker)
+ {
+ // Swallow the exception as the install is non-root and Docker
+ return;
+ }
+ Log.Error(ex, "There was an error setting base url");
+ }
}
private static void OnShutdown()
diff --git a/API/config/appsettings.Development.json b/API/config/appsettings.Development.json
index b449ae2a0..2a01e3fb3 100644
--- a/API/config/appsettings.Development.json
+++ b/API/config/appsettings.Development.json
@@ -1,5 +1,6 @@
{
- "TokenKey": "super secret unguessable key",
- "Port": 5000,
- "IpAddresses": "0.0.0.0,::"
+ "TokenKey": "super secret unguessable key",
+ "Port": 5000,
+ "IpAddresses": "",
+ "BaseUrl": "/joe/"
}
diff --git a/API/config/appsettings.json b/API/config/appsettings.json
index b449ae2a0..486fc8d39 100644
--- a/API/config/appsettings.json
+++ b/API/config/appsettings.json
@@ -1,5 +1,6 @@
{
"TokenKey": "super secret unguessable key",
"Port": 5000,
- "IpAddresses": "0.0.0.0,::"
+ "IpAddresses": "",
+ "BaseUrl": "/"
}
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 4d81e02a9..238e54542 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -13,7 +13,7 @@ Setup guides, FAQ, the more information we have on the [wiki](https://wiki.kavit
- HTML/Javascript editor of choice (VS Code/Sublime Text/Webstorm/Atom/etc)
- [Git](https://git-scm.com/downloads)
- [NodeJS](https://nodejs.org/en/download/) (Node 16.X.X or higher)
-- .NET 6.0+
+- .NET 7.0+
- dotnet tool install -g --version 6.4.0 Swashbuckle.AspNetCore.Cli
### Getting started ###
diff --git a/Kavita.Common/Configuration.cs b/Kavita.Common/Configuration.cs
index 560c1cebd..cde819cb7 100644
--- a/Kavita.Common/Configuration.cs
+++ b/Kavita.Common/Configuration.cs
@@ -8,8 +8,10 @@ namespace Kavita.Common;
public static class Configuration
{
- public const string DefaultIPAddresses = "0.0.0.0,::";
- public static readonly string AppSettingsFilename = Path.Join("config", GetAppSettingFilename());
+ public const string DefaultIpAddresses = "0.0.0.0,::";
+ public const string DefaultBaseUrl = "/";
+ public const string DefaultXFrameOptions = "SAMEORIGIN";
+ private static readonly string AppSettingsFilename = Path.Join("config", GetAppSettingFilename());
public static int Port
{
@@ -29,6 +31,14 @@ public static class Configuration
set => SetJwtToken(GetAppSettingFilename(), value);
}
+ public static string BaseUrl
+ {
+ get => GetBaseUrl(GetAppSettingFilename());
+ set => SetBaseUrl(GetAppSettingFilename(), value);
+ }
+
+ public static string XFrameOptions => GetXFrameOptions(GetAppSettingFilename());
+
private static string GetAppSettingFilename()
{
if (!string.IsNullOrEmpty(AppSettingsFilename))
@@ -177,7 +187,7 @@ public static class Configuration
{
if (new OsInfo(Array.Empty<IOsVersionAdapter>()).IsDocker)
{
- return DefaultIPAddresses;
+ return string.Empty;
}
try
@@ -196,14 +206,109 @@ public static class Configuration
Console.WriteLine("Error writing app settings: " + ex.Message);
}
- return DefaultIPAddresses;
+ return string.Empty;
+ }
+ #endregion
+
+ #region BaseUrl
+ private static string GetBaseUrl(string filePath)
+ {
+
+ try
+ {
+ var json = File.ReadAllText(filePath);
+ var jsonObj = JsonSerializer.Deserialize<dynamic>(json);
+ const string key = "BaseUrl";
+
+ if (jsonObj.TryGetProperty(key, out JsonElement tokenElement))
+ {
+ var baseUrl = tokenElement.GetString();
+ if (!string.IsNullOrEmpty(baseUrl))
+ {
+ baseUrl = !baseUrl.StartsWith("/")
+ ? $"/{baseUrl}"
+ : baseUrl;
+
+ baseUrl = !baseUrl.EndsWith("/")
+ ? $"{baseUrl}/"
+ : baseUrl;
+
+ return baseUrl;
+ }
+ return DefaultBaseUrl;
+ }
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("Error reading app settings: " + ex.Message);
+ }
+
+ return DefaultBaseUrl;
+ }
+
+ private static void SetBaseUrl(string filePath, string value)
+ {
+
+ var baseUrl = !value.StartsWith("/")
+ ? $"/{value}"
+ : value;
+
+ baseUrl = !baseUrl.EndsWith("/")
+ ? $"{baseUrl}/"
+ : baseUrl;
+
+ try
+ {
+ var json = File.ReadAllText(filePath);
+ var jsonObj = JsonSerializer.Deserialize<AppSettings>(json);
+ jsonObj.BaseUrl = baseUrl;
+ json = JsonSerializer.Serialize(jsonObj, new JsonSerializerOptions { WriteIndented = true });
+ File.WriteAllText(filePath, json);
+ }
+ catch (Exception)
+ {
+ /* Swallow exception */
+ }
+ }
+ #endregion
+
+ #region XFrameOrigins
+ private static string GetXFrameOptions(string filePath)
+ {
+ if (new OsInfo(Array.Empty<IOsVersionAdapter>()).IsDocker)
+ {
+ return DefaultBaseUrl;
+ }
+
+ try
+ {
+ var json = File.ReadAllText(filePath);
+ var jsonObj = JsonSerializer.Deserialize<dynamic>(json);
+ const string key = "XFrameOrigins";
+
+ if (jsonObj.TryGetProperty(key, out JsonElement tokenElement))
+ {
+ var origins = tokenElement.GetString();
+ return !string.IsNullOrEmpty(origins) ? origins : DefaultBaseUrl;
+ }
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("Error reading app settings: " + ex.Message);
+ }
+
+ return DefaultXFrameOptions;
}
#endregion
- private class AppSettings
+ private sealed class AppSettings
{
public string TokenKey { get; set; }
+ // ReSharper disable once MemberHidesStaticFromOuterClass
public int Port { get; set; }
+ // ReSharper disable once MemberHidesStaticFromOuterClass
public string IpAddresses { get; set; }
+ // ReSharper disable once MemberHidesStaticFromOuterClass
+ public string BaseUrl { get; set; }
}
}
diff --git a/Kavita.Common/EnvironmentInfo/IOsInfo.cs b/Kavita.Common/EnvironmentInfo/IOsInfo.cs
index e3453c3d6..54ec1500c 100644
--- a/Kavita.Common/EnvironmentInfo/IOsInfo.cs
+++ b/Kavita.Common/EnvironmentInfo/IOsInfo.cs
@@ -16,7 +16,7 @@ public class OsInfo : IOsInfo
public static bool IsWindows => Os == Os.Windows;
// this needs to not be static so we can mock it
- public bool IsDocker { get; }
+ public bool IsDocker { get; private set; }
public string Version { get; }
public string Name { get; }
@@ -41,7 +41,6 @@ public class OsInfo : IOsInfo
break;
}
}
-
}
public OsInfo(IEnumerable<IOsVersionAdapter> versionAdapters)
diff --git a/Kavita.Common/HashUtil.cs b/Kavita.Common/HashUtil.cs
index eccfc87e1..8b808b9c1 100644
--- a/Kavita.Common/HashUtil.cs
+++ b/Kavita.Common/HashUtil.cs
@@ -7,9 +7,9 @@ public static class HashUtil
{
private static string CalculateCrc(string input)
{
- var mCrc = 0xffffffff;
- var bytes = Encoding.UTF8.GetBytes(input);
- foreach (var myByte in bytes)
+ uint mCrc = 0xffffffff;
+ byte[] bytes = Encoding.UTF8.GetBytes(input);
+ foreach (byte myByte in bytes)
{
mCrc ^= (uint)myByte << 24;
for (var i = 0; i < 8; i++)
diff --git a/Kavita.Common/Kavita.Common.csproj b/Kavita.Common/Kavita.Common.csproj
index 0217b7037..b41be132a 100644
--- a/Kavita.Common/Kavita.Common.csproj
+++ b/Kavita.Common/Kavita.Common.csproj
@@ -1,9 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
+
<PropertyGroup>
- <TargetFramework>net6.0</TargetFramework>
+ <TargetFramework>net7.0</TargetFramework>
<Company>kavitareader.com</Company>
<Product>Kavita</Product>
- <AssemblyVersion>0.7.1.4</AssemblyVersion>
+ <AssemblyVersion>0.7.2.0</AssemblyVersion>
<NeutralLanguage>en</NeutralLanguage>
<TieredPGO>true</TieredPGO>
</PropertyGroup>
@@ -11,13 +12,13 @@
<ItemGroup>
<PackageReference Include="DotNet.Glob" Version="3.1.3" />
<PackageReference Include="Flurl.Http" Version="3.2.4" />
- <PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="6.0.0" />
- <PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
- <PackageReference Include="SonarAnalyzer.CSharp" Version="8.47.0.55603">
+ <PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="7.0.0" />
+ <PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
+ <PackageReference Include="SonarAnalyzer.CSharp" Version="8.55.0.65544">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
-</Project>
+</Project>
diff --git a/Kavita.sln.DotSettings b/Kavita.sln.DotSettings
index 277751040..2ebdeb970 100644
--- a/Kavita.sln.DotSettings
+++ b/Kavita.sln.DotSettings
@@ -12,4 +12,5 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=Omake/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Opds/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=rewinded/@EntryIndexedValue">True</s:Boolean>
- <s:Boolean x:Key="/Default/UserDictionary/Words/=Tachiyomi/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
\ No newline at end of file
+ <s:Boolean x:Key="/Default/UserDictionary/Words/=Tachiyomi/@EntryIndexedValue">True</s:Boolean>
+ <s:Boolean x:Key="/Default/UserDictionary/Words/=unbookmark/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
\ No newline at end of file
diff --git a/UI/Web/angular.json b/UI/Web/angular.json
index 449796577..30a197ec3 100644
--- a/UI/Web/angular.json
+++ b/UI/Web/angular.json
@@ -85,7 +85,7 @@
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
- "maximumError": "5kb"
+ "maximumError": "6kb"
}
]
}
diff --git a/UI/Web/package-lock.json b/UI/Web/package-lock.json
index d26d7362f..b52a4cf11 100644
--- a/UI/Web/package-lock.json
+++ b/UI/Web/package-lock.json
@@ -8,54 +8,50 @@
"name": "kavita-webui",
"version": "0.4.2",
"dependencies": {
- "requires": "^1.0.2",
- "@angular/animations": "^15.1.2",
- "@angular/cdk": "^15.1.2",
- "@angular/common": "^15.1.2",
- "@angular/compiler": "^15.1.2",
- "@angular/core": "^15.1.2",
- "@angular/forms": "^15.1.2",
- "@angular/localize": "^15.1.2",
- "@angular/platform-browser": "^15.1.2",
- "@angular/platform-browser-dynamic": "^15.1.2",
- "@angular/router": "^15.1.2",
+ "@angular/animations": "^15.2.7",
+ "@angular/cdk": "^15.2.7",
+ "@angular/common": "^15.2.7",
+ "@angular/compiler": "^15.2.7",
+ "@angular/core": "^15.2.7",
+ "@angular/forms": "^15.2.7",
+ "@angular/localize": "^15.2.7",
+ "@angular/platform-browser": "^15.2.7",
+ "@angular/platform-browser-dynamic": "^15.2.7",
+ "@angular/router": "^15.2.7",
"@fortawesome/fontawesome-free": "^6.2.0",
- "@iharbeck/ngx-virtual-scroller": "^15.0.0",
+ "@iharbeck/ngx-virtual-scroller": "^15.2.0",
"@iplab/ngx-file-upload": "^15.0.0",
- "@microsoft/signalr": "^7.0.2",
+ "@microsoft/signalr": "^7.0.5",
"@ng-bootstrap/ng-bootstrap": "^14.0.1",
"@popperjs/core": "^2.11.6",
"@swimlane/ngx-charts": "^20.1.2",
"@tweenjs/tween.js": "^18.6.4",
"@types/file-saver": "^2.0.5",
"bootstrap": "^5.2.3",
- "browser": "^0.2.6",
"eventsource": "^2.0.2",
"file-saver": "^2.0.5",
"lazysizes": "^5.3.2",
"ng-circle-progress": "^1.7.1",
- "ng-swipe": "^2.0.1",
- "ngx-color-picker": "^13.0.0",
- "ngx-extended-pdf-viewer": "^15.2.2",
- "ngx-file-drop": "^14.0.2",
- "ngx-slider-v2": "^15.0.3",
- "ngx-toastr": "^16.0.2",
+ "ngx-color-picker": "^14.0.0",
+ "ngx-extended-pdf-viewer": "^16.2.16",
+ "ngx-file-drop": "^15.0.0",
+ "ngx-slider-v2": "^15.0.4",
+ "ngx-toastr": "^16.1.1",
"rxjs": "^7.8.0",
"screenfull": "^6.0.2",
"swiper": "^8.4.6",
"tslib": "^2.3.0",
- "webpack-bundle-analyzer": "^4.7.0",
"zone.js": "~0.12.0"
},
"devDependencies": {
- "@angular-devkit/build-angular": "^15.1.3",
- "@angular-eslint/builder": "15.2.0",
- "@angular-eslint/eslint-plugin": "15.2.0",
- "@angular-eslint/eslint-plugin-template": "15.2.0",
- "@angular-eslint/schematics": "15.2.0",
- "@angular-eslint/template-parser": "15.2.0",
- "@angular/cli": "^15.1.3",
- "@angular/compiler-cli": "^15.1.2",
+ "@angular-devkit/build-angular": "^15.2.6",
+ "@angular-eslint/builder": "15.2.1",
+ "@angular-eslint/eslint-plugin": "15.2.1",
+ "@angular-eslint/eslint-plugin-template": "15.2.1",
+ "@angular-eslint/schematics": "15.2.1",
+ "@angular-eslint/template-parser": "15.2.1",
+ "@angular/cli": "^15.2.6",
+ "@angular/compiler-cli": "^15.2.7",
"@playwright/test": "^1.30.0",
"@types/d3": "^7.4.0",
"@types/jest": "^27.5.2",
@@ -69,7 +65,8 @@
"karma-coverage": "~2.2.0",
"playwright": "^1.30.0",
"ts-node": "~10.5.0",
- "typescript": "~4.9.4"
+ "typescript": "~4.9.4",
+ "webpack-bundle-analyzer": "^4.8.0"
}
},
"node_modules/@ampproject/remapping": {
@@ -85,12 +82,12 @@
}
},
"node_modules/@angular-devkit/architect": {
- "version": "0.1501.3",
- "resolved": "https://registry.npmjs.org/@angular-devkit/architect/-/architect-0.1501.3.tgz",
- "integrity": "sha512-+hvesYUgChdAkBcWSO2pseIGBzRDAATyIw36UBwOmYkL7wM65TEXpspbo5ZIfU1M/l7X/lHzDXLTzCMfb0Qxbg==",
+ "version": "0.1502.6",
+ "resolved": "https://registry.npmjs.org/@angular-devkit/architect/-/architect-0.1502.6.tgz",
+ "integrity": "sha512-n4oJ9vzFWwabf+AfgqqevVzdJhNKNCav7ytefjD/Y01vkNwlXqWnHcvyyHCLkVibJ6WR8J9lK4t77j/HFlDvWQ==",
"dev": true,
"dependencies": {
- "@angular-devkit/core": "15.1.3",
+ "@angular-devkit/core": "15.2.6",
"rxjs": "6.6.7"
},
"engines": {
@@ -118,38 +115,39 @@
"dev": true
},
"node_modules/@angular-devkit/build-angular": {
- "version": "15.1.3",
- "resolved": "https://registry.npmjs.org/@angular-devkit/build-angular/-/build-angular-15.1.3.tgz",
- "integrity": "sha512-QQfvpccShQldpMmuwgpZfbE6cNiNwff2aAY1YGswU9DBpeoz4YWeW4e8ss2j/Mxn5RXo7cbzWkhbm1xXTFY1FA==",
+ "version": "15.2.6",
+ "resolved": "https://registry.npmjs.org/@angular-devkit/build-angular/-/build-angular-15.2.6.tgz",
+ "integrity": "sha512-OmMcdXXUrAdZNxwxDE8SUx1FMcq9FyMnrSv1PmP9sHPBoxAdBVc/qNdGA9V7C5yHvWHGgzsx7ZK5TDuvifzS5g==",
"dev": true,
"dependencies": {
"@ampproject/remapping": "2.2.0",
- "@angular-devkit/architect": "0.1501.3",
- "@angular-devkit/build-webpack": "0.1501.3",
- "@angular-devkit/core": "15.1.3",
+ "@angular-devkit/architect": "0.1502.6",
+ "@angular-devkit/build-webpack": "0.1502.6",
+ "@angular-devkit/core": "15.2.6",
"@babel/core": "7.20.12",
- "@babel/generator": "7.20.7",
+ "@babel/generator": "7.20.14",
"@babel/helper-annotate-as-pure": "7.18.6",
+ "@babel/helper-split-export-declaration": "7.18.6",
"@babel/plugin-proposal-async-generator-functions": "7.20.7",
"@babel/plugin-transform-async-to-generator": "7.20.7",
"@babel/plugin-transform-runtime": "7.19.6",
"@babel/preset-env": "7.20.2",
- "@babel/runtime": "7.20.7",
+ "@babel/runtime": "7.20.13",
"@babel/template": "7.20.7",
"@discoveryjs/json-ext": "0.5.7",
- "@ngtools/webpack": "15.1.3",
+ "@ngtools/webpack": "15.2.6",
"ansi-colors": "4.1.3",
"autoprefixer": "10.4.13",
"babel-loader": "9.1.2",
"babel-plugin-istanbul": "6.1.1",
- "browserslist": "4.21.4",
+ "browserslist": "4.21.5",
"cacache": "17.0.4",
"chokidar": "3.5.3",
"copy-webpack-plugin": "11.0.0",
"critters": "0.0.16",
"css-loader": "6.7.3",
- "esbuild-wasm": "0.16.17",
- "glob": "8.0.3",
+ "esbuild-wasm": "0.17.8",
+ "glob": "8.1.0",
"https-proxy-agent": "5.0.1",
"inquirer": "8.2.4",
"jsonc-parser": "3.2.0",
@@ -158,26 +156,26 @@
"less-loader": "11.1.0",
"license-webpack-plugin": "4.0.2",
"loader-utils": "3.2.1",
- "magic-string": "0.27.0",
+ "magic-string": "0.29.0",
"mini-css-extract-plugin": "2.7.2",
- "open": "8.4.0",
+ "open": "8.4.1",
"ora": "5.4.1",
- "parse5-html-rewriting-stream": "6.0.1",
+ "parse5-html-rewriting-stream": "7.0.0",
"piscina": "3.2.0",
"postcss": "8.4.21",
"postcss-loader": "7.0.2",
"resolve-url-loader": "5.0.0",
"rxjs": "6.6.7",
- "sass": "1.57.1",
+ "sass": "1.58.1",
"sass-loader": "13.2.0",
"semver": "7.3.8",
"source-map-loader": "4.0.1",
"source-map-support": "0.5.21",
- "terser": "5.16.1",
+ "terser": "5.16.3",
"text-table": "0.2.0",
"tree-kill": "1.2.2",
- "tslib": "2.4.1",
- "webpack": "5.75.0",
+ "tslib": "2.5.0",
+ "webpack": "5.76.1",
"webpack-dev-middleware": "6.0.1",
"webpack-dev-server": "4.11.1",
"webpack-merge": "5.8.0",
@@ -189,7 +187,7 @@
"yarn": ">= 1.13.0"
},
"optionalDependencies": {
- "esbuild": "0.16.17"
+ "esbuild": "0.17.8"
},
"peerDependencies": {
"@angular/compiler-cli": "^15.0.0",
@@ -265,129 +263,28 @@
"semver": "bin/semver.js"
}
},
- "node_modules/@angular-devkit/build-angular/node_modules/@babel/generator": {
- "version": "7.20.7",
- "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.20.7.tgz",
- "integrity": "sha512-7wqMOJq8doJMZmP4ApXTzLxSr7+oO2jroJURrVEp6XShrQUObV8Tq/D0NCcoYg2uHqUrjzO0zwBjoYzelxK+sw==",
- "dev": true,
- "dependencies": {
- "@babel/types": "^7.20.7",
- "@jridgewell/gen-mapping": "^0.3.2",
- "jsesc": "^2.5.1"
- },
- "engines": {
- "node": ">=6.9.0"
- }
- },
- "node_modules/@angular-devkit/build-angular/node_modules/@jridgewell/gen-mapping": {
- "version": "0.3.2",
- "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz",
- "integrity": "sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A==",
- "dev": true,
- "dependencies": {
- "@jridgewell/set-array": "^1.0.1",
- "@jridgewell/sourcemap-codec": "^1.4.10",
- "@jridgewell/trace-mapping": "^0.3.9"
- },
- "engines": {
- "node": ">=6.0.0"
- }
- },
- "node_modules/@angular-devkit/build-angular/node_modules/browserslist": {
- "version": "4.21.4",
- "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.4.tgz",
- "integrity": "sha512-CBHJJdDmgjl3daYjN5Cp5kbTf1mUhZoS+beLklHIvkOWscs83YAhLlF3Wsh/lciQYAcbBJgTOD44VtG31ZM4Hw==",
+ "node_modules/@angular-devkit/build-angular/node_modules/lru-cache": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
+ "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
"dev": true,
- "funding": [
- {
- "type": "opencollective",
- "url": "https://opencollective.com/browserslist"
- },
- {
- "type": "tidelift",
- "url": "https://tidelift.com/funding/github/npm/browserslist"
- }
- ],
"dependencies": {
- "caniuse-lite": "^1.0.30001400",
- "electron-to-chromium": "^1.4.251",
- "node-releases": "^2.0.6",
- "update-browserslist-db": "^1.0.9"
- },
- "bin": {
- "browserslist": "cli.js"
+ "yallist": "^4.0.0"
},
"engines": {
- "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
+ "node": ">=10"
}
},
- "node_modules/@angular-devkit/build-angular/node_modules/esbuild": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.16.17.tgz",
- "integrity": "sha512-G8LEkV0XzDMNwXKgM0Jwu3nY3lSTwSGY6XbxM9cr9+s0T/qSV1q1JVPBGzm3dcjhCic9+emZDmMffkwgPeOeLg==",
- "dev": true,
- "hasInstallScript": true,
- "optional": true,
- "bin": {
- "esbuild": "bin/esbuild"
- },
- "engines": {
- "node": ">=12"
- },
- "optionalDependencies": {
- "@esbuild/android-arm": "0.16.17",
- "@esbuild/android-arm64": "0.16.17",
- "@esbuild/android-x64": "0.16.17",
- "@esbuild/darwin-arm64": "0.16.17",
- "@esbuild/darwin-x64": "0.16.17",
- "@esbuild/freebsd-arm64": "0.16.17",
- "@esbuild/freebsd-x64": "0.16.17",
- "@esbuild/linux-arm": "0.16.17",
- "@esbuild/linux-arm64": "0.16.17",
- "@esbuild/linux-ia32": "0.16.17",
- "@esbuild/linux-loong64": "0.16.17",
- "@esbuild/linux-mips64el": "0.16.17",
- "@esbuild/linux-ppc64": "0.16.17",
- "@esbuild/linux-riscv64": "0.16.17",
- "@esbuild/linux-s390x": "0.16.17",
- "@esbuild/linux-x64": "0.16.17",
- "@esbuild/netbsd-x64": "0.16.17",
- "@esbuild/openbsd-x64": "0.16.17",
- "@esbuild/sunos-x64": "0.16.17",
- "@esbuild/win32-arm64": "0.16.17",
- "@esbuild/win32-ia32": "0.16.17",
- "@esbuild/win32-x64": "0.16.17"
- }
- },
- "node_modules/@angular-devkit/build-angular/node_modules/glob": {
- "version": "8.0.3",
- "resolved": "https://registry.npmjs.org/glob/-/glob-8.0.3.tgz",
- "integrity": "sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ==",
+ "node_modules/@angular-devkit/build-angular/node_modules/magic-string": {
+ "version": "0.29.0",
+ "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.29.0.tgz",
+ "integrity": "sha512-WcfidHrDjMY+eLjlU+8OvwREqHwpgCeKVBUpQ3OhYYuvfaYCUgcbuBzappNzZvg/v8onU3oQj+BYpkOJe9Iw4Q==",
"dev": true,
"dependencies": {
- "fs.realpath": "^1.0.0",
- "inflight": "^1.0.4",
- "inherits": "2",
- "minimatch": "^5.0.1",
- "once": "^1.3.0"
+ "@jridgewell/sourcemap-codec": "^1.4.13"
},
"engines": {
"node": ">=12"
- },
- "funding": {
- "url": "https://github.com/sponsors/isaacs"
- }
- },
- "node_modules/@angular-devkit/build-angular/node_modules/lru-cache": {
- "version": "6.0.0",
- "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
- "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
- "dev": true,
- "dependencies": {
- "yallist": "^4.0.0"
- },
- "engines": {
- "node": ">=10"
}
},
"node_modules/@angular-devkit/build-angular/node_modules/rxjs": {
@@ -423,12 +320,6 @@
"node": ">=10"
}
},
- "node_modules/@angular-devkit/build-angular/node_modules/tslib": {
- "version": "2.4.1",
- "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz",
- "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==",
- "dev": true
- },
"node_modules/@angular-devkit/build-angular/node_modules/yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
@@ -436,12 +327,12 @@
"dev": true
},
"node_modules/@angular-devkit/build-webpack": {
- "version": "0.1501.3",
- "resolved": "https://registry.npmjs.org/@angular-devkit/build-webpack/-/build-webpack-0.1501.3.tgz",
- "integrity": "sha512-ZsgbTFf1I9hAf4FvNxBJphF95Hw9QchCaWQdQXY+2mqQuPP70uK1Kd/TzNCfx5lyNFHMI9oWpCg2QLrAdwqJnA==",
+ "version": "0.1502.6",
+ "resolved": "https://registry.npmjs.org/@angular-devkit/build-webpack/-/build-webpack-0.1502.6.tgz",
+ "integrity": "sha512-X7XQ11QDz2Bs5qpJ3a5glIytvI+S74ORQxdzvT6a6KB8ayW0SgZEhTwD+GF7pa5My8draIaXBGzzQR1qmpWK5Q==",
"dev": true,
"dependencies": {
- "@angular-devkit/architect": "0.1501.3",
+ "@angular-devkit/architect": "0.1502.6",
"rxjs": "6.6.7"
},
"engines": {
@@ -473,9 +364,9 @@
"dev": true
},
"node_modules/@angular-devkit/core": {
- "version": "15.1.3",
- "resolved": "https://registry.npmjs.org/@angular-devkit/core/-/core-15.1.3.tgz",
- "integrity": "sha512-biuS+DceyZEqcE/cLvndtslqn3Q6uCmJ0RLpACikH6ESYorvk+A91H0ofuGue6HB/2CUN/F+mPSr7sWVI1W9sA==",
+ "version": "15.2.6",
+ "resolved": "https://registry.npmjs.org/@angular-devkit/core/-/core-15.2.6.tgz",
+ "integrity": "sha512-YVTWZ+M+xNKdFX4EnY9QX49PZraawiaA0iTd2CUW8ZoTUvU7yOGMKZLSdz6aokTMRVfm0449wt6YL994ibOo1g==",
"dev": true,
"dependencies": {
"ajv": "8.12.0",
@@ -533,14 +424,14 @@
"dev": true
},
"node_modules/@angular-devkit/schematics": {
- "version": "15.1.3",
- "resolved": "https://registry.npmjs.org/@angular-devkit/schematics/-/schematics-15.1.3.tgz",
- "integrity": "sha512-IXZ56/5uFnHqnLq+80JhmFx5mflyW8LgS/8Tr2l5DYVA71Fh3b1q+vGrEZB1X2zPoFeDOGAxv3Fi+kmjcz1GZg==",
+ "version": "15.2.6",
+ "resolved": "https://registry.npmjs.org/@angular-devkit/schematics/-/schematics-15.2.6.tgz",
+ "integrity": "sha512-f7VgnAcok7AwR/DhX0ZWskB0rFBo/KsvtIUA2qZSrpKMf8eFiwu03dv/b2mI0vnf+1FBfIQzJvO0ww45zRp6dA==",
"dev": true,
"dependencies": {
- "@angular-devkit/core": "15.1.3",
+ "@angular-devkit/core": "15.2.6",
"jsonc-parser": "3.2.0",
- "magic-string": "0.27.0",
+ "magic-string": "0.29.0",
"ora": "5.4.1",
"rxjs": "6.6.7"
},
@@ -550,6 +441,18 @@
"yarn": ">= 1.13.0"
}
},
+ "node_modules/@angular-devkit/schematics/node_modules/magic-string": {
+ "version": "0.29.0",
+ "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.29.0.tgz",
+ "integrity": "sha512-WcfidHrDjMY+eLjlU+8OvwREqHwpgCeKVBUpQ3OhYYuvfaYCUgcbuBzappNzZvg/v8onU3oQj+BYpkOJe9Iw4Q==",
+ "dev": true,
+ "dependencies": {
+ "@jridgewell/sourcemap-codec": "^1.4.13"
+ },
+ "engines": {
+ "node": ">=12"
+ }
+ },
"node_modules/@angular-devkit/schematics/node_modules/rxjs": {
"version": "6.6.7",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz",
@@ -569,9 +472,9 @@
"dev": true
},
"node_modules/@angular-eslint/builder": {
- "version": "15.2.0",
- "resolved": "https://registry.npmjs.org/@angular-eslint/builder/-/builder-15.2.0.tgz",
- "integrity": "sha512-5xnJub1G7+F9Ra75N90Ln9yn/KFzWnMIHfqDVRRDrlwgja1Zc9ZmqcazLWc/k12yzKyJoO3uwBSycyVwG2fYVg==",
+ "version": "15.2.1",
+ "resolved": "https://registry.npmjs.org/@angular-eslint/builder/-/builder-15.2.1.tgz",
+ "integrity": "sha512-7x2DANebLRl997Mj4DhZrnz5+vnSjavGGveJ0mBuU7CEsL0ZYLftdRqL0e0HtU3ksseS7xpchD6OM08nkNgySw==",
"dev": true,
"peerDependencies": {
"eslint": "^7.20.0 || ^8.0.0",
@@ -579,19 +482,19 @@
}
},
"node_modules/@angular-eslint/bundled-angular-compiler": {
- "version": "15.2.0",
- "resolved": "https://registry.npmjs.org/@angular-eslint/bundled-angular-compiler/-/bundled-angular-compiler-15.2.0.tgz",
- "integrity": "sha512-a0bfXxYyGoWJHrVQ4QER0HdRgselcTtJeyqiFPAxID2ZxF0IBGKLNTtugUTXekEmiLev8yGLX9TqAtthN57fEg==",
+ "version": "15.2.1",
+ "resolved": "https://registry.npmjs.org/@angular-eslint/bundled-angular-compiler/-/bundled-angular-compiler-15.2.1.tgz",
+ "integrity": "sha512-LO7Am8eVCr7oh6a0VmKSL7K03CnQEQhFO7Wt/YtbfYOxVjrbwmYLwJn+wZPOT7A02t/BttOD/WXuDrOWtSMQ/Q==",
"dev": true
},
"node_modules/@angular-eslint/eslint-plugin": {
- "version": "15.2.0",
- "resolved": "https://registry.npmjs.org/@angular-eslint/eslint-plugin/-/eslint-plugin-15.2.0.tgz",
- "integrity": "sha512-yJGbmSUU0B0MFJ48ktpkqqEK+zv5k9iwlZSqEHtiQMKvDelfluovnEusihel7uPRo1c1iVlbSgXfGpxpUCfocA==",
+ "version": "15.2.1",
+ "resolved": "https://registry.npmjs.org/@angular-eslint/eslint-plugin/-/eslint-plugin-15.2.1.tgz",
+ "integrity": "sha512-OM7b1kS4E4CkXjkaWN+lEzawh4VxY6l7FO1Cuk4s7iv3/YpZG3rJxIZBqnFLTixwrBuqw8y4FNBzF3eDgmFAUw==",
"dev": true,
"dependencies": {
- "@angular-eslint/utils": "15.2.0",
- "@typescript-eslint/utils": "5.48.1"
+ "@angular-eslint/utils": "15.2.1",
+ "@typescript-eslint/utils": "5.48.2"
},
"peerDependencies": {
"eslint": "^7.20.0 || ^8.0.0",
@@ -599,15 +502,15 @@
}
},
"node_modules/@angular-eslint/eslint-plugin-template": {
- "version": "15.2.0",
- "resolved": "https://registry.npmjs.org/@angular-eslint/eslint-plugin-template/-/eslint-plugin-template-15.2.0.tgz",
- "integrity": "sha512-aL3czf5Jpv29rKN3UG20tQepX1+V0d6xc0g+1l0zPHZJYjVd6Oy0nIxWiGfl4yanaXiVpmxiV4vUcLlqqaFwbw==",
+ "version": "15.2.1",
+ "resolved": "https://registry.npmjs.org/@angular-eslint/eslint-plugin-template/-/eslint-plugin-template-15.2.1.tgz",
+ "integrity": "sha512-IeiSLk6YxapFdH2z5o/O3R7VwtBd2T6fWmhLFPwDYMDknrwegnOjwswCdBplOccpUp0wqlCeGUx7LTsuzwaz7w==",
"dev": true,
"dependencies": {
- "@angular-eslint/bundled-angular-compiler": "15.2.0",
- "@angular-eslint/utils": "15.2.0",
- "@typescript-eslint/type-utils": "5.48.1",
- "@typescript-eslint/utils": "5.48.1",
+ "@angular-eslint/bundled-angular-compiler": "15.2.1",
+ "@angular-eslint/utils": "15.2.1",
+ "@typescript-eslint/type-utils": "5.48.2",
+ "@typescript-eslint/utils": "5.48.2",
"aria-query": "5.1.3",
"axobject-query": "3.1.1"
},
@@ -616,14 +519,365 @@
"typescript": "*"
}
},
+ "node_modules/@angular-eslint/eslint-plugin-template/node_modules/@typescript-eslint/scope-manager": {
+ "version": "5.48.2",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.48.2.tgz",
+ "integrity": "sha512-zEUFfonQid5KRDKoI3O+uP1GnrFd4tIHlvs+sTJXiWuypUWMuDaottkJuR612wQfOkjYbsaskSIURV9xo4f+Fw==",
+ "dev": true,
+ "dependencies": {
+ "@typescript-eslint/types": "5.48.2",
+ "@typescript-eslint/visitor-keys": "5.48.2"
+ },
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ }
+ },
+ "node_modules/@angular-eslint/eslint-plugin-template/node_modules/@typescript-eslint/type-utils": {
+ "version": "5.48.2",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.48.2.tgz",
+ "integrity": "sha512-QVWx7J5sPMRiOMJp5dYshPxABRoZV1xbRirqSk8yuIIsu0nvMTZesKErEA3Oix1k+uvsk8Cs8TGJ6kQ0ndAcew==",
+ "dev": true,
+ "dependencies": {
+ "@typescript-eslint/typescript-estree": "5.48.2",
+ "@typescript-eslint/utils": "5.48.2",
+ "debug": "^4.3.4",
+ "tsutils": "^3.21.0"
+ },
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ },
+ "peerDependencies": {
+ "eslint": "*"
+ },
+ "peerDependenciesMeta": {
+ "typescript": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@angular-eslint/eslint-plugin-template/node_modules/@typescript-eslint/types": {
+ "version": "5.48.2",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.48.2.tgz",
+ "integrity": "sha512-hE7dA77xxu7ByBc6KCzikgfRyBCTst6dZQpwaTy25iMYOnbNljDT4hjhrGEJJ0QoMjrfqrx+j1l1B9/LtKeuqA==",
+ "dev": true,
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ }
+ },
+ "node_modules/@angular-eslint/eslint-plugin-template/node_modules/@typescript-eslint/typescript-estree": {
+ "version": "5.48.2",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.48.2.tgz",
+ "integrity": "sha512-bibvD3z6ilnoVxUBFEgkO0k0aFvUc4Cttt0dAreEr+nrAHhWzkO83PEVVuieK3DqcgL6VAK5dkzK8XUVja5Zcg==",
+ "dev": true,
+ "dependencies": {
+ "@typescript-eslint/types": "5.48.2",
+ "@typescript-eslint/visitor-keys": "5.48.2",
+ "debug": "^4.3.4",
+ "globby": "^11.1.0",
+ "is-glob": "^4.0.3",
+ "semver": "^7.3.7",
+ "tsutils": "^3.21.0"
+ },
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ },
+ "peerDependenciesMeta": {
+ "typescript": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@angular-eslint/eslint-plugin-template/node_modules/@typescript-eslint/utils": {
+ "version": "5.48.2",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.48.2.tgz",
+ "integrity": "sha512-2h18c0d7jgkw6tdKTlNaM7wyopbLRBiit8oAxoP89YnuBOzCZ8g8aBCaCqq7h208qUTroL7Whgzam7UY3HVLow==",
+ "dev": true,
+ "dependencies": {
+ "@types/json-schema": "^7.0.9",
+ "@types/semver": "^7.3.12",
+ "@typescript-eslint/scope-manager": "5.48.2",
+ "@typescript-eslint/types": "5.48.2",
+ "@typescript-eslint/typescript-estree": "5.48.2",
+ "eslint-scope": "^5.1.1",
+ "eslint-utils": "^3.0.0",
+ "semver": "^7.3.7"
+ },
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ },
+ "peerDependencies": {
+ "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0"
+ }
+ },
+ "node_modules/@angular-eslint/eslint-plugin-template/node_modules/@typescript-eslint/visitor-keys": {
+ "version": "5.48.2",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.48.2.tgz",
+ "integrity": "sha512-z9njZLSkwmjFWUelGEwEbdf4NwKvfHxvGC0OcGN1Hp/XNDIcJ7D5DpPNPv6x6/mFvc1tQHsaWmpD/a4gOvvCJQ==",
+ "dev": true,
+ "dependencies": {
+ "@typescript-eslint/types": "5.48.2",
+ "eslint-visitor-keys": "^3.3.0"
+ },
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ }
+ },
+ "node_modules/@angular-eslint/eslint-plugin-template/node_modules/globby": {
+ "version": "11.1.0",
+ "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz",
+ "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==",
+ "dev": true,
+ "dependencies": {
+ "array-union": "^2.1.0",
+ "dir-glob": "^3.0.1",
+ "fast-glob": "^3.2.9",
+ "ignore": "^5.2.0",
+ "merge2": "^1.4.1",
+ "slash": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/@angular-eslint/eslint-plugin-template/node_modules/lru-cache": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
+ "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
+ "dev": true,
+ "dependencies": {
+ "yallist": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/@angular-eslint/eslint-plugin-template/node_modules/semver": {
+ "version": "7.4.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz",
+ "integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==",
+ "dev": true,
+ "dependencies": {
+ "lru-cache": "^6.0.0"
+ },
+ "bin": {
+ "semver": "bin/semver.js"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/@angular-eslint/eslint-plugin-template/node_modules/slash": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",
+ "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/@angular-eslint/eslint-plugin-template/node_modules/yallist": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
+ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
+ "dev": true
+ },
+ "node_modules/@angular-eslint/eslint-plugin/node_modules/@typescript-eslint/scope-manager": {
+ "version": "5.48.2",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.48.2.tgz",
+ "integrity": "sha512-zEUFfonQid5KRDKoI3O+uP1GnrFd4tIHlvs+sTJXiWuypUWMuDaottkJuR612wQfOkjYbsaskSIURV9xo4f+Fw==",
+ "dev": true,
+ "dependencies": {
+ "@typescript-eslint/types": "5.48.2",
+ "@typescript-eslint/visitor-keys": "5.48.2"
+ },
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ }
+ },
+ "node_modules/@angular-eslint/eslint-plugin/node_modules/@typescript-eslint/types": {
+ "version": "5.48.2",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.48.2.tgz",
+ "integrity": "sha512-hE7dA77xxu7ByBc6KCzikgfRyBCTst6dZQpwaTy25iMYOnbNljDT4hjhrGEJJ0QoMjrfqrx+j1l1B9/LtKeuqA==",
+ "dev": true,
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ }
+ },
+ "node_modules/@angular-eslint/eslint-plugin/node_modules/@typescript-eslint/typescript-estree": {
+ "version": "5.48.2",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.48.2.tgz",
+ "integrity": "sha512-bibvD3z6ilnoVxUBFEgkO0k0aFvUc4Cttt0dAreEr+nrAHhWzkO83PEVVuieK3DqcgL6VAK5dkzK8XUVja5Zcg==",
+ "dev": true,
+ "dependencies": {
+ "@typescript-eslint/types": "5.48.2",
+ "@typescript-eslint/visitor-keys": "5.48.2",
+ "debug": "^4.3.4",
+ "globby": "^11.1.0",
+ "is-glob": "^4.0.3",
+ "semver": "^7.3.7",
+ "tsutils": "^3.21.0"
+ },
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ },
+ "peerDependenciesMeta": {
+ "typescript": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@angular-eslint/eslint-plugin/node_modules/@typescript-eslint/utils": {
+ "version": "5.48.2",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.48.2.tgz",
+ "integrity": "sha512-2h18c0d7jgkw6tdKTlNaM7wyopbLRBiit8oAxoP89YnuBOzCZ8g8aBCaCqq7h208qUTroL7Whgzam7UY3HVLow==",
+ "dev": true,
+ "dependencies": {
+ "@types/json-schema": "^7.0.9",
+ "@types/semver": "^7.3.12",
+ "@typescript-eslint/scope-manager": "5.48.2",
+ "@typescript-eslint/types": "5.48.2",
+ "@typescript-eslint/typescript-estree": "5.48.2",
+ "eslint-scope": "^5.1.1",
+ "eslint-utils": "^3.0.0",
+ "semver": "^7.3.7"
+ },
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ },
+ "peerDependencies": {
+ "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0"
+ }
+ },
+ "node_modules/@angular-eslint/eslint-plugin/node_modules/@typescript-eslint/visitor-keys": {
+ "version": "5.48.2",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.48.2.tgz",
+ "integrity": "sha512-z9njZLSkwmjFWUelGEwEbdf4NwKvfHxvGC0OcGN1Hp/XNDIcJ7D5DpPNPv6x6/mFvc1tQHsaWmpD/a4gOvvCJQ==",
+ "dev": true,
+ "dependencies": {
+ "@typescript-eslint/types": "5.48.2",
+ "eslint-visitor-keys": "^3.3.0"
+ },
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ }
+ },
+ "node_modules/@angular-eslint/eslint-plugin/node_modules/globby": {
+ "version": "11.1.0",
+ "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz",
+ "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==",
+ "dev": true,
+ "dependencies": {
+ "array-union": "^2.1.0",
+ "dir-glob": "^3.0.1",
+ "fast-glob": "^3.2.9",
+ "ignore": "^5.2.0",
+ "merge2": "^1.4.1",
+ "slash": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/@angular-eslint/eslint-plugin/node_modules/lru-cache": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
+ "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
+ "dev": true,
+ "dependencies": {
+ "yallist": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/@angular-eslint/eslint-plugin/node_modules/semver": {
+ "version": "7.4.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz",
+ "integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==",
+ "dev": true,
+ "dependencies": {
+ "lru-cache": "^6.0.0"
+ },
+ "bin": {
+ "semver": "bin/semver.js"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/@angular-eslint/eslint-plugin/node_modules/slash": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",
+ "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/@angular-eslint/eslint-plugin/node_modules/yallist": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
+ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
+ "dev": true
+ },
"node_modules/@angular-eslint/schematics": {
- "version": "15.2.0",
- "resolved": "https://registry.npmjs.org/@angular-eslint/schematics/-/schematics-15.2.0.tgz",
- "integrity": "sha512-N9tuVu3vL47beppTsV9wAF+v6M9trbJnuNWYQGGsqA3mtCAkFUvJuHyWcXNPdSCNv/cJtR1OOJ7Y922uB5JPJQ==",
+ "version": "15.2.1",
+ "resolved": "https://registry.npmjs.org/@angular-eslint/schematics/-/schematics-15.2.1.tgz",
+ "integrity": "sha512-0ZfBCejHWIcgy3J5kFs9sS/jqi8i5AptxggOwFySOlCLJ+CzNrktjD4jff1Zy8K/VLzY0Ci0BSZXvgWfP0k9Rg==",
"dev": true,
"dependencies": {
- "@angular-eslint/eslint-plugin": "15.2.0",
- "@angular-eslint/eslint-plugin-template": "15.2.0",
+ "@angular-eslint/eslint-plugin": "15.2.1",
+ "@angular-eslint/eslint-plugin-template": "15.2.1",
"ignore": "5.2.4",
"strip-json-comments": "3.1.1",
"tmp": "0.2.1"
@@ -641,63 +895,225 @@
"rimraf": "^3.0.0"
},
"engines": {
- "node": ">=8.17.0"
+ "node": ">=8.17.0"
+ }
+ },
+ "node_modules/@angular-eslint/template-parser": {
+ "version": "15.2.1",
+ "resolved": "https://registry.npmjs.org/@angular-eslint/template-parser/-/template-parser-15.2.1.tgz",
+ "integrity": "sha512-ViCi79gC2aKJecmYLkOT+QlT5WMRNXeYz0Dr9Pr8qXzIbY0oAWE7nOT5jkXwQ9oUk+ybtGCWHma5JVJWVJsIog==",
+ "dev": true,
+ "dependencies": {
+ "@angular-eslint/bundled-angular-compiler": "15.2.1",
+ "eslint-scope": "^7.0.0"
+ },
+ "peerDependencies": {
+ "eslint": "^7.20.0 || ^8.0.0",
+ "typescript": "*"
+ }
+ },
+ "node_modules/@angular-eslint/template-parser/node_modules/eslint-scope": {
+ "version": "7.1.1",
+ "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz",
+ "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==",
+ "dev": true,
+ "dependencies": {
+ "esrecurse": "^4.3.0",
+ "estraverse": "^5.2.0"
+ },
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ }
+ },
+ "node_modules/@angular-eslint/template-parser/node_modules/estraverse": {
+ "version": "5.3.0",
+ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz",
+ "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==",
+ "dev": true,
+ "engines": {
+ "node": ">=4.0"
+ }
+ },
+ "node_modules/@angular-eslint/utils": {
+ "version": "15.2.1",
+ "resolved": "https://registry.npmjs.org/@angular-eslint/utils/-/utils-15.2.1.tgz",
+ "integrity": "sha512-++FneAJHxJqcSu0igVN6uOkSoHxlzgLoMBswuovYJy3UKwm33/T6WFku8++753Ca/JucIoR1gdUfO7SoSspMDg==",
+ "dev": true,
+ "dependencies": {
+ "@angular-eslint/bundled-angular-compiler": "15.2.1",
+ "@typescript-eslint/utils": "5.48.2"
+ },
+ "peerDependencies": {
+ "eslint": "^7.20.0 || ^8.0.0",
+ "typescript": "*"
+ }
+ },
+ "node_modules/@angular-eslint/utils/node_modules/@typescript-eslint/scope-manager": {
+ "version": "5.48.2",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.48.2.tgz",
+ "integrity": "sha512-zEUFfonQid5KRDKoI3O+uP1GnrFd4tIHlvs+sTJXiWuypUWMuDaottkJuR612wQfOkjYbsaskSIURV9xo4f+Fw==",
+ "dev": true,
+ "dependencies": {
+ "@typescript-eslint/types": "5.48.2",
+ "@typescript-eslint/visitor-keys": "5.48.2"
+ },
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ }
+ },
+ "node_modules/@angular-eslint/utils/node_modules/@typescript-eslint/types": {
+ "version": "5.48.2",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.48.2.tgz",
+ "integrity": "sha512-hE7dA77xxu7ByBc6KCzikgfRyBCTst6dZQpwaTy25iMYOnbNljDT4hjhrGEJJ0QoMjrfqrx+j1l1B9/LtKeuqA==",
+ "dev": true,
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ }
+ },
+ "node_modules/@angular-eslint/utils/node_modules/@typescript-eslint/typescript-estree": {
+ "version": "5.48.2",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.48.2.tgz",
+ "integrity": "sha512-bibvD3z6ilnoVxUBFEgkO0k0aFvUc4Cttt0dAreEr+nrAHhWzkO83PEVVuieK3DqcgL6VAK5dkzK8XUVja5Zcg==",
+ "dev": true,
+ "dependencies": {
+ "@typescript-eslint/types": "5.48.2",
+ "@typescript-eslint/visitor-keys": "5.48.2",
+ "debug": "^4.3.4",
+ "globby": "^11.1.0",
+ "is-glob": "^4.0.3",
+ "semver": "^7.3.7",
+ "tsutils": "^3.21.0"
+ },
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ },
+ "peerDependenciesMeta": {
+ "typescript": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@angular-eslint/utils/node_modules/@typescript-eslint/utils": {
+ "version": "5.48.2",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.48.2.tgz",
+ "integrity": "sha512-2h18c0d7jgkw6tdKTlNaM7wyopbLRBiit8oAxoP89YnuBOzCZ8g8aBCaCqq7h208qUTroL7Whgzam7UY3HVLow==",
+ "dev": true,
+ "dependencies": {
+ "@types/json-schema": "^7.0.9",
+ "@types/semver": "^7.3.12",
+ "@typescript-eslint/scope-manager": "5.48.2",
+ "@typescript-eslint/types": "5.48.2",
+ "@typescript-eslint/typescript-estree": "5.48.2",
+ "eslint-scope": "^5.1.1",
+ "eslint-utils": "^3.0.0",
+ "semver": "^7.3.7"
+ },
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ },
+ "peerDependencies": {
+ "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0"
+ }
+ },
+ "node_modules/@angular-eslint/utils/node_modules/@typescript-eslint/visitor-keys": {
+ "version": "5.48.2",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.48.2.tgz",
+ "integrity": "sha512-z9njZLSkwmjFWUelGEwEbdf4NwKvfHxvGC0OcGN1Hp/XNDIcJ7D5DpPNPv6x6/mFvc1tQHsaWmpD/a4gOvvCJQ==",
+ "dev": true,
+ "dependencies": {
+ "@typescript-eslint/types": "5.48.2",
+ "eslint-visitor-keys": "^3.3.0"
+ },
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ }
+ },
+ "node_modules/@angular-eslint/utils/node_modules/globby": {
+ "version": "11.1.0",
+ "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz",
+ "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==",
+ "dev": true,
+ "dependencies": {
+ "array-union": "^2.1.0",
+ "dir-glob": "^3.0.1",
+ "fast-glob": "^3.2.9",
+ "ignore": "^5.2.0",
+ "merge2": "^1.4.1",
+ "slash": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
}
},
- "node_modules/@angular-eslint/template-parser": {
- "version": "15.2.0",
- "resolved": "https://registry.npmjs.org/@angular-eslint/template-parser/-/template-parser-15.2.0.tgz",
- "integrity": "sha512-xnnxPfV/G0Ll3B0HGrF1ucsc/DHmNE6UhhmWxYPTERq0McbZGRiATa66hCoOZ/Rdylun4ogBfsRKAG8XxEvlvw==",
+ "node_modules/@angular-eslint/utils/node_modules/lru-cache": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
+ "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
"dev": true,
"dependencies": {
- "@angular-eslint/bundled-angular-compiler": "15.2.0",
- "eslint-scope": "^7.0.0"
+ "yallist": "^4.0.0"
},
- "peerDependencies": {
- "eslint": "^7.20.0 || ^8.0.0",
- "typescript": "*"
+ "engines": {
+ "node": ">=10"
}
},
- "node_modules/@angular-eslint/template-parser/node_modules/eslint-scope": {
- "version": "7.1.1",
- "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz",
- "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==",
+ "node_modules/@angular-eslint/utils/node_modules/semver": {
+ "version": "7.4.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz",
+ "integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==",
"dev": true,
"dependencies": {
- "esrecurse": "^4.3.0",
- "estraverse": "^5.2.0"
+ "lru-cache": "^6.0.0"
+ },
+ "bin": {
+ "semver": "bin/semver.js"
},
"engines": {
- "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ "node": ">=10"
}
},
- "node_modules/@angular-eslint/template-parser/node_modules/estraverse": {
- "version": "5.3.0",
- "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz",
- "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==",
+ "node_modules/@angular-eslint/utils/node_modules/slash": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",
+ "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==",
"dev": true,
"engines": {
- "node": ">=4.0"
+ "node": ">=8"
}
},
- "node_modules/@angular-eslint/utils": {
- "version": "15.2.0",
- "resolved": "https://registry.npmjs.org/@angular-eslint/utils/-/utils-15.2.0.tgz",
- "integrity": "sha512-qfTOKQ+aef/YER679/xN1E+FkZKMd0I73P6txUZAb9k2G1ACVktG+wOUIBfgjIlUVq9Q01AV91LGOWcd+rdEEA==",
- "dev": true,
- "dependencies": {
- "@angular-eslint/bundled-angular-compiler": "15.2.0",
- "@typescript-eslint/utils": "5.48.1"
- },
- "peerDependencies": {
- "eslint": "^7.20.0 || ^8.0.0",
- "typescript": "*"
- }
+ "node_modules/@angular-eslint/utils/node_modules/yallist": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
+ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
+ "dev": true
},
"node_modules/@angular/animations": {
- "version": "15.1.2",
- "resolved": "https://registry.npmjs.org/@angular/animations/-/animations-15.1.2.tgz",
- "integrity": "sha512-Bamm2gNdSMVeXEFwlXG75rx49NJfbupDQM6geix0uI30iVCYlufPz+kMe4SzpasO5hHzP7Pat3cmEu4356It+g==",
+ "version": "15.2.7",
+ "resolved": "https://registry.npmjs.org/@angular/animations/-/animations-15.2.7.tgz",
+ "integrity": "sha512-Vmy0AljHc/GOp87O2x0mxUDiyfJFW8ndDE9Xrm/g0rnLnNWsaLtLXr1TWbwF7eTqKA3k/QcUvYAjLMWKvjyKgQ==",
"dependencies": {
"tslib": "^2.3.0"
},
@@ -705,13 +1121,13 @@
"node": "^14.20.0 || ^16.13.0 || >=18.10.0"
},
"peerDependencies": {
- "@angular/core": "15.1.2"
+ "@angular/core": "15.2.7"
}
},
"node_modules/@angular/cdk": {
- "version": "15.1.2",
- "resolved": "https://registry.npmjs.org/@angular/cdk/-/cdk-15.1.2.tgz",
- "integrity": "sha512-LO3b/akdcPaRwSa+rbrI02THwQm+O4Z3rDIvbDTHyCf3Vmk3p7gsp8WtKAMMJlkCF88VQ3Wh4ZZcfNAtbVO7EA==",
+ "version": "15.2.7",
+ "resolved": "https://registry.npmjs.org/@angular/cdk/-/cdk-15.2.7.tgz",
+ "integrity": "sha512-IQg/EuZ3LC/vOHZtcLvkM+FSACXW5PVv2NddJgsBOtfcf1HcTk97VhegtB4WGQTUe1pcxiLGz/aWYuIRknjitw==",
"dependencies": {
"tslib": "^2.3.0"
},
@@ -725,15 +1141,15 @@
}
},
"node_modules/@angular/cli": {
- "version": "15.1.3",
- "resolved": "https://registry.npmjs.org/@angular/cli/-/cli-15.1.3.tgz",
- "integrity": "sha512-gNVvyvkGZ1zKiDdWjPqCLst8iHcB1C4B2nXrr3B+/YAd1G/y87VI1aBKFlK9ulG4tkwktog5uQaut7xs48IsEQ==",
+ "version": "15.2.6",
+ "resolved": "https://registry.npmjs.org/@angular/cli/-/cli-15.2.6.tgz",
+ "integrity": "sha512-wNkQ/qCVbd4pERaGVagKJPifEvjRNY5otwsd4iRVubY/XOcIHcYChUThZwgQdVfNAImfJPMZNrhbGxejuWLA9w==",
"dev": true,
"dependencies": {
- "@angular-devkit/architect": "0.1501.3",
- "@angular-devkit/core": "15.1.3",
- "@angular-devkit/schematics": "15.1.3",
- "@schematics/angular": "15.1.3",
+ "@angular-devkit/architect": "0.1502.6",
+ "@angular-devkit/core": "15.2.6",
+ "@angular-devkit/schematics": "15.2.6",
+ "@schematics/angular": "15.2.6",
"@yarnpkg/lockfile": "1.1.0",
"ansi-colors": "4.1.3",
"ini": "3.0.1",
@@ -741,9 +1157,9 @@
"jsonc-parser": "3.2.0",
"npm-package-arg": "10.1.0",
"npm-pick-manifest": "8.0.1",
- "open": "8.4.0",
+ "open": "8.4.1",
"ora": "5.4.1",
- "pacote": "15.0.8",
+ "pacote": "15.1.0",
"resolve": "1.22.1",
"semver": "7.3.8",
"symbol-observable": "4.0.0",
@@ -792,9 +1208,9 @@
"dev": true
},
"node_modules/@angular/common": {
- "version": "15.1.2",
- "resolved": "https://registry.npmjs.org/@angular/common/-/common-15.1.2.tgz",
- "integrity": "sha512-1Ra6EoaZjPcdDsGBge3qSajO1ECYceX+2EWHdjvJ9ZEIaXsLNFMQBUMgJnjsnrojs9Gd3bxJ0WHkahij5/8WNA==",
+ "version": "15.2.7",
+ "resolved": "https://registry.npmjs.org/@angular/common/-/common-15.2.7.tgz",
+ "integrity": "sha512-CbmrQeZ0yChQrF/ab3v+gv6x2uLbv/s1wZNUBSO/p1STz6BZzHRJqObVlfPlQvyBx5btBBy/+I1sUh1yumARDA==",
"dependencies": {
"tslib": "^2.3.0"
},
@@ -802,14 +1218,14 @@
"node": "^14.20.0 || ^16.13.0 || >=18.10.0"
},
"peerDependencies": {
- "@angular/core": "15.1.2",
+ "@angular/core": "15.2.7",
"rxjs": "^6.5.3 || ^7.4.0"
}
},
"node_modules/@angular/compiler": {
- "version": "15.1.2",
- "resolved": "https://registry.npmjs.org/@angular/compiler/-/compiler-15.1.2.tgz",
- "integrity": "sha512-hKlr1i61a2Gl0h53goSSUbZmzNgdC1zAHu+Ws0+1Qfv9cDgg1aVphFGFMdV0kbjLV+k7LyFjj5EgWU48o5UXww==",
+ "version": "15.2.7",
+ "resolved": "https://registry.npmjs.org/@angular/compiler/-/compiler-15.2.7.tgz",
+ "integrity": "sha512-SesyYI2ExUa13XukXgIsmfg3ar90HbWeWDJTgmzsIfph0M9t6+SaPGpf3FCtdBgNADIpUFp3cieCOJgLESzxYQ==",
"dependencies": {
"tslib": "^2.3.0"
},
@@ -817,7 +1233,7 @@
"node": "^14.20.0 || ^16.13.0 || >=18.10.0"
},
"peerDependencies": {
- "@angular/core": "15.1.2"
+ "@angular/core": "15.2.7"
},
"peerDependenciesMeta": {
"@angular/core": {
@@ -826,9 +1242,9 @@
}
},
"node_modules/@angular/compiler-cli": {
- "version": "15.1.2",
- "resolved": "https://registry.npmjs.org/@angular/compiler-cli/-/compiler-cli-15.1.2.tgz",
- "integrity": "sha512-gAqbQSKI4oeboh0UKsFdaEoST9IBVzqeckJzSTwAGxJeS33IM7Jjo3LViqHuzQyWKXe6srkci0LD4C2Mrj4kfQ==",
+ "version": "15.2.7",
+ "resolved": "https://registry.npmjs.org/@angular/compiler-cli/-/compiler-cli-15.2.7.tgz",
+ "integrity": "sha512-4v51dOaT8GDUzRh6+mCLZOaYuU9FYX6vOHaLod9np3tVWPhcpoF2ZklRSiQDeFqrhr5B4vuCp/Lh9N2wzc22XQ==",
"dependencies": {
"@babel/core": "7.19.3",
"@jridgewell/sourcemap-codec": "^1.4.14",
@@ -850,7 +1266,7 @@
"node": "^14.20.0 || ^16.13.0 || >=18.10.0"
},
"peerDependencies": {
- "@angular/compiler": "15.1.2",
+ "@angular/compiler": "15.2.7",
"typescript": ">=4.8.2 <5.0"
}
},
@@ -885,9 +1301,9 @@
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
},
"node_modules/@angular/core": {
- "version": "15.1.2",
- "resolved": "https://registry.npmjs.org/@angular/core/-/core-15.1.2.tgz",
- "integrity": "sha512-K9pz6Bq6RuY/OWhKLZT1JQvk4orvU9wozgXY8cZaOGmNCQQ7sJv5zGkO5csO6o1ON1v/AHowrP/FAF1i8tml5g==",
+ "version": "15.2.7",
+ "resolved": "https://registry.npmjs.org/@angular/core/-/core-15.2.7.tgz",
+ "integrity": "sha512-iS7JCJubRFqdndoUdAnvNkQRT3tY5tNFupBQS/sytkwxVrdBg+Is5jpdgk741n824vTMsE+CnuY0SETar8rN6g==",
"dependencies": {
"tslib": "^2.3.0"
},
@@ -896,13 +1312,13 @@
},
"peerDependencies": {
"rxjs": "^6.5.3 || ^7.4.0",
- "zone.js": "~0.11.4 || ~0.12.0"
+ "zone.js": "~0.11.4 || ~0.12.0 || ~0.13.0"
}
},
"node_modules/@angular/forms": {
- "version": "15.1.2",
- "resolved": "https://registry.npmjs.org/@angular/forms/-/forms-15.1.2.tgz",
- "integrity": "sha512-ZL3EkCQ2SDrv9hdyPX54WPiTf9SQpkKz4bn/Gxe6lySLy0oHR5Te68DPMljWBeHYa+cNTCDdPN81AKLIDjRQtA==",
+ "version": "15.2.7",
+ "resolved": "https://registry.npmjs.org/@angular/forms/-/forms-15.2.7.tgz",
+ "integrity": "sha512-rzrebDIrtxxOeMcBzRBxqaOBZ+T1DJrysG/6YWZy428W/Z3MfPxUarPxgfx/oZI+x5uUsDaZmyoRdhVPJ2KhZg==",
"dependencies": {
"tslib": "^2.3.0"
},
@@ -910,16 +1326,16 @@
"node": "^14.20.0 || ^16.13.0 || >=18.10.0"
},
"peerDependencies": {
- "@angular/common": "15.1.2",
- "@angular/core": "15.1.2",
- "@angular/platform-browser": "15.1.2",
+ "@angular/common": "15.2.7",
+ "@angular/core": "15.2.7",
+ "@angular/platform-browser": "15.2.7",
"rxjs": "^6.5.3 || ^7.4.0"
}
},
"node_modules/@angular/localize": {
- "version": "15.1.2",
- "resolved": "https://registry.npmjs.org/@angular/localize/-/localize-15.1.2.tgz",
- "integrity": "sha512-wnNgq8tn5W1u2B/G2Q08XiHKucJidNE+U5OuYk+qjf2M5M5DVwBhF/mxJxWoDKSuLg/JIJ8FUiKjEhJ5iUJ4lg==",
+ "version": "15.2.7",
+ "resolved": "https://registry.npmjs.org/@angular/localize/-/localize-15.2.7.tgz",
+ "integrity": "sha512-ySuy35QKApWH9sW3PfnAAnZjLl3NT+SacvlEWigrTeCqfBEuDPUG57ugvc1/Lzuo09UOh3HQkrQBbdWAILd8JA==",
"dependencies": {
"@babel/core": "7.19.3",
"glob": "8.1.0",
@@ -934,14 +1350,14 @@
"node": "^14.20.0 || ^16.13.0 || >=18.10.0"
},
"peerDependencies": {
- "@angular/compiler": "15.1.2",
- "@angular/compiler-cli": "15.1.2"
+ "@angular/compiler": "15.2.7",
+ "@angular/compiler-cli": "15.2.7"
}
},
"node_modules/@angular/platform-browser": {
- "version": "15.1.2",
- "resolved": "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-15.1.2.tgz",
- "integrity": "sha512-eWyfUOFZ05vB0UfPUTPK7pPJZjFtbGZlJOea3IUqEohuyRqq3CqYCrv7SVXGKQVOx1qRA0Ckr9FOB8/qYbTq1A==",
+ "version": "15.2.7",
+ "resolved": "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-15.2.7.tgz",
+ "integrity": "sha512-aCbd7xyuP7c2eDITkOTDO2mqP550WHCBN8U6VnjysqtB5ocbJtR6z/MIRItN/Zx+xj3piiaKei//XIkb3Q5fXQ==",
"dependencies": {
"tslib": "^2.3.0"
},
@@ -949,9 +1365,9 @@
"node": "^14.20.0 || ^16.13.0 || >=18.10.0"
},
"peerDependencies": {
- "@angular/animations": "15.1.2",
- "@angular/common": "15.1.2",
- "@angular/core": "15.1.2"
+ "@angular/animations": "15.2.7",
+ "@angular/common": "15.2.7",
+ "@angular/core": "15.2.7"
},
"peerDependenciesMeta": {
"@angular/animations": {
@@ -960,9 +1376,9 @@
}
},
"node_modules/@angular/platform-browser-dynamic": {
- "version": "15.1.2",
- "resolved": "https://registry.npmjs.org/@angular/platform-browser-dynamic/-/platform-browser-dynamic-15.1.2.tgz",
- "integrity": "sha512-JBSRYeaW+Vb/lKXwxgrU8m42Avxjwmx8vGRp/krJfhh4KL9CJ84zf7Ldxb0sCv06kGdu6vbOUasNGDdgIQfdOQ==",
+ "version": "15.2.7",
+ "resolved": "https://registry.npmjs.org/@angular/platform-browser-dynamic/-/platform-browser-dynamic-15.2.7.tgz",
+ "integrity": "sha512-t1Nf7hgbcYvhmxuzgUtsV47jrI5CXUBqrtz5I0ilWG92zZTig5qvfd1/2Ub8NHz87uHNrnggyZpL2+4MJ26nyQ==",
"dependencies": {
"tslib": "^2.3.0"
},
@@ -970,16 +1386,16 @@
"node": "^14.20.0 || ^16.13.0 || >=18.10.0"
},
"peerDependencies": {
- "@angular/common": "15.1.2",
- "@angular/compiler": "15.1.2",
- "@angular/core": "15.1.2",
- "@angular/platform-browser": "15.1.2"
+ "@angular/common": "15.2.7",
+ "@angular/compiler": "15.2.7",
+ "@angular/core": "15.2.7",
+ "@angular/platform-browser": "15.2.7"
}
},
"node_modules/@angular/router": {
- "version": "15.1.2",
- "resolved": "https://registry.npmjs.org/@angular/router/-/router-15.1.2.tgz",
- "integrity": "sha512-p2tTHYvBsMaayJNWAZMBqrL7jwxs6NQaEDImBtMwnOnQr/M+LwQdAeNFfpky20ODZw0JwTW84q04l8klExq0kw==",
+ "version": "15.2.7",
+ "resolved": "https://registry.npmjs.org/@angular/router/-/router-15.2.7.tgz",
+ "integrity": "sha512-Wkk+oJSUrVafJjmv9uE1SoY4wDE9bjX7ald+UXePz+QyM/PFoLkm/CzLYjFBkJnsOkOVxw1VmvacoUjWN6BCTQ==",
"dependencies": {
"tslib": "^2.3.0"
},
@@ -987,9 +1403,9 @@
"node": "^14.20.0 || ^16.13.0 || >=18.10.0"
},
"peerDependencies": {
- "@angular/common": "15.1.2",
- "@angular/core": "15.1.2",
- "@angular/platform-browser": "15.1.2",
+ "@angular/common": "15.2.7",
+ "@angular/core": "15.2.7",
+ "@angular/platform-browser": "15.2.7",
"rxjs": "^6.5.3 || ^7.4.0"
}
},
@@ -2566,9 +2982,9 @@
}
},
"node_modules/@babel/runtime": {
- "version": "7.20.7",
- "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.7.tgz",
- "integrity": "sha512-UF0tvkUtxwAgZ5W/KrkHf0Rn0fdnLDU9ScxBrEVNUprE/MzirjK4MJUX1/BVDv00Sv8cljtukVK1aky++X1SjQ==",
+ "version": "7.20.13",
+ "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.13.tgz",
+ "integrity": "sha512-gt3PKXs0DBoL9xCvOIIZ2NEqAGZqHjAnmVbfQtB620V0uReIQutpel14KcneZuer7UioY8ALKZ7iocavvzTNFA==",
"dev": true,
"dependencies": {
"regenerator-runtime": "^0.13.11"
@@ -2660,9 +3076,9 @@
}
},
"node_modules/@esbuild/android-arm": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.16.17.tgz",
- "integrity": "sha512-N9x1CMXVhtWEAMS7pNNONyA14f71VPQN9Cnavj1XQh6T7bskqiLLrSca4O0Vr8Wdcga943eThxnVp3JLnBMYtw==",
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.17.8.tgz",
+ "integrity": "sha512-0/rb91GYKhrtbeglJXOhAv9RuYimgI8h623TplY2X+vA4EXnk3Zj1fXZreJ0J3OJJu1bwmb0W7g+2cT/d8/l/w==",
"cpu": [
"arm"
],
@@ -2676,9 +3092,9 @@
}
},
"node_modules/@esbuild/android-arm64": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.16.17.tgz",
- "integrity": "sha512-MIGl6p5sc3RDTLLkYL1MyL8BMRN4tLMRCn+yRJJmEDvYZ2M7tmAf80hx1kbNEUX2KJ50RRtxZ4JHLvCfuB6kBg==",
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.17.8.tgz",
+ "integrity": "sha512-oa/N5j6v1svZQs7EIRPqR8f+Bf8g6HBDjD/xHC02radE/NjKHK7oQmtmLxPs1iVwYyvE+Kolo6lbpfEQ9xnhxQ==",
"cpu": [
"arm64"
],
@@ -2692,9 +3108,9 @@
}
},
"node_modules/@esbuild/android-x64": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.16.17.tgz",
- "integrity": "sha512-a3kTv3m0Ghh4z1DaFEuEDfz3OLONKuFvI4Xqczqx4BqLyuFaFkuaG4j2MtA6fuWEFeC5x9IvqnX7drmRq/fyAQ==",
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.17.8.tgz",
+ "integrity": "sha512-bTliMLqD7pTOoPg4zZkXqCDuzIUguEWLpeqkNfC41ODBHwoUgZ2w5JBeYimv4oP6TDVocoYmEhZrCLQTrH89bg==",
"cpu": [
"x64"
],
@@ -2708,9 +3124,9 @@
}
},
"node_modules/@esbuild/darwin-arm64": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.16.17.tgz",
- "integrity": "sha512-/2agbUEfmxWHi9ARTX6OQ/KgXnOWfsNlTeLcoV7HSuSTv63E4DqtAc+2XqGw1KHxKMHGZgbVCZge7HXWX9Vn+w==",
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.17.8.tgz",
+ "integrity": "sha512-ghAbV3ia2zybEefXRRm7+lx8J/rnupZT0gp9CaGy/3iolEXkJ6LYRq4IpQVI9zR97ID80KJVoUlo3LSeA/sMAg==",
"cpu": [
"arm64"
],
@@ -2724,9 +3140,9 @@
}
},
"node_modules/@esbuild/darwin-x64": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.16.17.tgz",
- "integrity": "sha512-2By45OBHulkd9Svy5IOCZt376Aa2oOkiE9QWUK9fe6Tb+WDr8hXL3dpqi+DeLiMed8tVXspzsTAvd0jUl96wmg==",
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.17.8.tgz",
+ "integrity": "sha512-n5WOpyvZ9TIdv2V1K3/iIkkJeKmUpKaCTdun9buhGRWfH//osmUjlv4Z5mmWdPWind/VGcVxTHtLfLCOohsOXw==",
"cpu": [
"x64"
],
@@ -2740,9 +3156,9 @@
}
},
"node_modules/@esbuild/freebsd-arm64": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.16.17.tgz",
- "integrity": "sha512-mt+cxZe1tVx489VTb4mBAOo2aKSnJ33L9fr25JXpqQqzbUIw/yzIzi+NHwAXK2qYV1lEFp4OoVeThGjUbmWmdw==",
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.8.tgz",
+ "integrity": "sha512-a/SATTaOhPIPFWvHZDoZYgxaZRVHn0/LX1fHLGfZ6C13JqFUZ3K6SMD6/HCtwOQ8HnsNaEeokdiDSFLuizqv5A==",
"cpu": [
"arm64"
],
@@ -2756,9 +3172,9 @@
}
},
"node_modules/@esbuild/freebsd-x64": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.16.17.tgz",
- "integrity": "sha512-8ScTdNJl5idAKjH8zGAsN7RuWcyHG3BAvMNpKOBaqqR7EbUhhVHOqXRdL7oZvz8WNHL2pr5+eIT5c65kA6NHug==",
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.17.8.tgz",
+ "integrity": "sha512-xpFJb08dfXr5+rZc4E+ooZmayBW6R3q59daCpKZ/cDU96/kvDM+vkYzNeTJCGd8rtO6fHWMq5Rcv/1cY6p6/0Q==",
"cpu": [
"x64"
],
@@ -2772,9 +3188,9 @@
}
},
"node_modules/@esbuild/linux-arm": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.16.17.tgz",
- "integrity": "sha512-iihzrWbD4gIT7j3caMzKb/RsFFHCwqqbrbH9SqUSRrdXkXaygSZCZg1FybsZz57Ju7N/SHEgPyaR0LZ8Zbe9gQ==",
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.17.8.tgz",
+ "integrity": "sha512-6Ij8gfuGszcEwZpi5jQIJCVIACLS8Tz2chnEBfYjlmMzVsfqBP1iGmHQPp7JSnZg5xxK9tjCc+pJ2WtAmPRFVA==",
"cpu": [
"arm"
],
@@ -2788,9 +3204,9 @@
}
},
"node_modules/@esbuild/linux-arm64": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.16.17.tgz",
- "integrity": "sha512-7S8gJnSlqKGVJunnMCrXHU9Q8Q/tQIxk/xL8BqAP64wchPCTzuM6W3Ra8cIa1HIflAvDnNOt2jaL17vaW+1V0g==",
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.17.8.tgz",
+ "integrity": "sha512-v3iwDQuDljLTxpsqQDl3fl/yihjPAyOguxuloON9kFHYwopeJEf1BkDXODzYyXEI19gisEsQlG1bM65YqKSIww==",
"cpu": [
"arm64"
],
@@ -2804,9 +3220,9 @@
}
},
"node_modules/@esbuild/linux-ia32": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.16.17.tgz",
- "integrity": "sha512-kiX69+wcPAdgl3Lonh1VI7MBr16nktEvOfViszBSxygRQqSpzv7BffMKRPMFwzeJGPxcio0pdD3kYQGpqQ2SSg==",
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.17.8.tgz",
+ "integrity": "sha512-8svILYKhE5XetuFk/B6raFYIyIqydQi+GngEXJgdPdI7OMKUbSd7uzR02wSY4kb53xBrClLkhH4Xs8P61Q2BaA==",
"cpu": [
"ia32"
],
@@ -2820,9 +3236,9 @@
}
},
"node_modules/@esbuild/linux-loong64": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.16.17.tgz",
- "integrity": "sha512-dTzNnQwembNDhd654cA4QhbS9uDdXC3TKqMJjgOWsC0yNCbpzfWoXdZvp0mY7HU6nzk5E0zpRGGx3qoQg8T2DQ==",
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.17.8.tgz",
+ "integrity": "sha512-B6FyMeRJeV0NpyEOYlm5qtQfxbdlgmiGdD+QsipzKfFky0K5HW5Td6dyK3L3ypu1eY4kOmo7wW0o94SBqlqBSA==",
"cpu": [
"loong64"
],
@@ -2836,9 +3252,9 @@
}
},
"node_modules/@esbuild/linux-mips64el": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.16.17.tgz",
- "integrity": "sha512-ezbDkp2nDl0PfIUn0CsQ30kxfcLTlcx4Foz2kYv8qdC6ia2oX5Q3E/8m6lq84Dj/6b0FrkgD582fJMIfHhJfSw==",
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.17.8.tgz",
+ "integrity": "sha512-CCb67RKahNobjm/eeEqeD/oJfJlrWyw29fgiyB6vcgyq97YAf3gCOuP6qMShYSPXgnlZe/i4a8WFHBw6N8bYAA==",
"cpu": [
"mips64el"
],
@@ -2852,9 +3268,9 @@
}
},
"node_modules/@esbuild/linux-ppc64": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.16.17.tgz",
- "integrity": "sha512-dzS678gYD1lJsW73zrFhDApLVdM3cUF2MvAa1D8K8KtcSKdLBPP4zZSLy6LFZ0jYqQdQ29bjAHJDgz0rVbLB3g==",
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.17.8.tgz",
+ "integrity": "sha512-bytLJOi55y55+mGSdgwZ5qBm0K9WOCh0rx+vavVPx+gqLLhxtSFU0XbeYy/dsAAD6xECGEv4IQeFILaSS2auXw==",
"cpu": [
"ppc64"
],
@@ -2868,9 +3284,9 @@
}
},
"node_modules/@esbuild/linux-riscv64": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.16.17.tgz",
- "integrity": "sha512-ylNlVsxuFjZK8DQtNUwiMskh6nT0vI7kYl/4fZgV1llP5d6+HIeL/vmmm3jpuoo8+NuXjQVZxmKuhDApK0/cKw==",
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.17.8.tgz",
+ "integrity": "sha512-2YpRyQJmKVBEHSBLa8kBAtbhucaclb6ex4wchfY0Tj3Kg39kpjeJ9vhRU7x4mUpq8ISLXRXH1L0dBYjAeqzZAw==",
"cpu": [
"riscv64"
],
@@ -2884,9 +3300,9 @@
}
},
"node_modules/@esbuild/linux-s390x": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.16.17.tgz",
- "integrity": "sha512-gzy7nUTO4UA4oZ2wAMXPNBGTzZFP7mss3aKR2hH+/4UUkCOyqmjXiKpzGrY2TlEUhbbejzXVKKGazYcQTZWA/w==",
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.17.8.tgz",
+ "integrity": "sha512-QgbNY/V3IFXvNf11SS6exkpVcX0LJcob+0RWCgV9OiDAmVElnxciHIisoSix9uzYzScPmS6dJFbZULdSAEkQVw==",
"cpu": [
"s390x"
],
@@ -2900,9 +3316,9 @@
}
},
"node_modules/@esbuild/linux-x64": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.16.17.tgz",
- "integrity": "sha512-mdPjPxfnmoqhgpiEArqi4egmBAMYvaObgn4poorpUaqmvzzbvqbowRllQ+ZgzGVMGKaPkqUmPDOOFQRUFDmeUw==",
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.17.8.tgz",
+ "integrity": "sha512-mM/9S0SbAFDBc4OPoyP6SEOo5324LpUxdpeIUUSrSTOfhHU9hEfqRngmKgqILqwx/0DVJBzeNW7HmLEWp9vcOA==",
"cpu": [
"x64"
],
@@ -2916,9 +3332,9 @@
}
},
"node_modules/@esbuild/netbsd-x64": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.16.17.tgz",
- "integrity": "sha512-/PzmzD/zyAeTUsduZa32bn0ORug+Jd1EGGAUJvqfeixoEISYpGnAezN6lnJoskauoai0Jrs+XSyvDhppCPoKOA==",
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.17.8.tgz",
+ "integrity": "sha512-eKUYcWaWTaYr9zbj8GertdVtlt1DTS1gNBWov+iQfWuWyuu59YN6gSEJvFzC5ESJ4kMcKR0uqWThKUn5o8We6Q==",
"cpu": [
"x64"
],
@@ -2932,9 +3348,9 @@
}
},
"node_modules/@esbuild/openbsd-x64": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.16.17.tgz",
- "integrity": "sha512-2yaWJhvxGEz2RiftSk0UObqJa/b+rIAjnODJgv2GbGGpRwAfpgzyrg1WLK8rqA24mfZa9GvpjLcBBg8JHkoodg==",
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.17.8.tgz",
+ "integrity": "sha512-Vc9J4dXOboDyMXKD0eCeW0SIeEzr8K9oTHJU+Ci1mZc5njPfhKAqkRt3B/fUNU7dP+mRyralPu8QUkiaQn7iIg==",
"cpu": [
"x64"
],
@@ -2948,9 +3364,9 @@
}
},
"node_modules/@esbuild/sunos-x64": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.16.17.tgz",
- "integrity": "sha512-xtVUiev38tN0R3g8VhRfN7Zl42YCJvyBhRKw1RJjwE1d2emWTVToPLNEQj/5Qxc6lVFATDiy6LjVHYhIPrLxzw==",
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.17.8.tgz",
+ "integrity": "sha512-0xvOTNuPXI7ft1LYUgiaXtpCEjp90RuBBYovdd2lqAFxje4sEucurg30M1WIm03+3jxByd3mfo+VUmPtRSVuOw==",
"cpu": [
"x64"
],
@@ -2964,9 +3380,9 @@
}
},
"node_modules/@esbuild/win32-arm64": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.16.17.tgz",
- "integrity": "sha512-ga8+JqBDHY4b6fQAmOgtJJue36scANy4l/rL97W+0wYmijhxKetzZdKOJI7olaBaMhWt8Pac2McJdZLxXWUEQw==",
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.17.8.tgz",
+ "integrity": "sha512-G0JQwUI5WdEFEnYNKzklxtBheCPkuDdu1YrtRrjuQv30WsYbkkoixKxLLv8qhJmNI+ATEWquZe/N0d0rpr55Mg==",
"cpu": [
"arm64"
],
@@ -2980,9 +3396,9 @@
}
},
"node_modules/@esbuild/win32-ia32": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.16.17.tgz",
- "integrity": "sha512-WnsKaf46uSSF/sZhwnqE4L/F89AYNMiD4YtEcYekBt9Q7nj0DiId2XH2Ng2PHM54qi5oPrQ8luuzGszqi/veig==",
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.17.8.tgz",
+ "integrity": "sha512-Fqy63515xl20OHGFykjJsMnoIWS+38fqfg88ClvPXyDbLtgXal2DTlhb1TfTX34qWi3u4I7Cq563QcHpqgLx8w==",
"cpu": [
"ia32"
],
@@ -2996,9 +3412,9 @@
}
},
"node_modules/@esbuild/win32-x64": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.16.17.tgz",
- "integrity": "sha512-y+EHuSchhL7FjHgvQL/0fnnFmO4T1bhvWANX6gcnqTjtnKWbTvUMCpGnv2+t+31d7RzyEAYAd4u2fnIhHL6N/Q==",
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.17.8.tgz",
+ "integrity": "sha512-1iuezdyDNngPnz8rLRDO2C/ZZ/emJLb72OsZeqQ6gL6Avko/XCXZw+NuxBSNhBAP13Hie418V7VMt9et1FMvpg==",
"cpu": [
"x64"
],
@@ -3124,9 +3540,9 @@
}
},
"node_modules/@fortawesome/fontawesome-free": {
- "version": "6.2.1",
- "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-6.2.1.tgz",
- "integrity": "sha512-viouXhegu/TjkvYQoiRZK3aax69dGXxgEjpvZW81wIJdxm5Fnvp3VVIP4VHKqX4SvFw6qpmkILkD4RJWAdrt7A==",
+ "version": "6.2.0",
+ "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-6.2.0.tgz",
+ "integrity": "sha512-CNR7qRIfCwWHNN7FnKUniva94edPdyQzil/zCwk3v6k4R6rR2Fr8i4s3PM7n/lyfPA6Zfko9z5WDzFxG9SW1uQ==",
"hasInstallScript": true,
"engines": {
"node": ">=6"
@@ -3194,15 +3610,13 @@
"dev": true
},
"node_modules/@iharbeck/ngx-virtual-scroller": {
- "version": "15.0.0",
- "resolved": "https://registry.npmjs.org/@iharbeck/ngx-virtual-scroller/-/ngx-virtual-scroller-15.0.0.tgz",
- "integrity": "sha512-Z5Lbqx7hrU8dM1UVnsP9QdLHMmiyOGA+Wg+CkF+4jxQR/Wbe1wz0OPnMi5uIRI3/njkVCtu8vleVGIY5dWg1WA==",
+ "version": "15.2.0",
+ "resolved": "https://registry.npmjs.org/@iharbeck/ngx-virtual-scroller/-/ngx-virtual-scroller-15.2.0.tgz",
+ "integrity": "sha512-06zs8INWWy5UaopYauPOHF1CKVGWCHjT0N1E408F5BtwqR0iRlRme4Ba9iGOWCC0sgYwEjEV1AcFtvhHSe8/mA==",
"dependencies": {
- "tslib": "^2.4.1"
+ "tslib": "^2.3.0"
},
"peerDependencies": {
- "@angular/common": "^15.0.4",
- "@angular/core": "^15.0.4",
"@tweenjs/tween.js": "^18.6.4"
}
},
@@ -4013,9 +4427,9 @@
"dev": true
},
"node_modules/@microsoft/signalr": {
- "version": "7.0.2",
- "resolved": "https://registry.npmjs.org/@microsoft/signalr/-/signalr-7.0.2.tgz",
- "integrity": "sha512-U+o33K2m6nnMojZzBrjrApKgYfiQ0A0t4I2F5oFJObgfzRSDS9v0YoYgkmva5nbPftUp3YcR5XmH0S/1+BZT6Q==",
+ "version": "7.0.5",
+ "resolved": "https://registry.npmjs.org/@microsoft/signalr/-/signalr-7.0.5.tgz",
+ "integrity": "sha512-j84syCKlXkQAOQhyrzRmW7w/M2UXQ6OKcXXFIVNjmiiZbEGIvSvJDRAuyMFjArdQOXz+etJgd58H/prTbyTCrA==",
"dependencies": {
"abort-controller": "^3.0.0",
"eventsource": "^2.0.2",
@@ -4041,9 +4455,9 @@
}
},
"node_modules/@ngtools/webpack": {
- "version": "15.1.3",
- "resolved": "https://registry.npmjs.org/@ngtools/webpack/-/webpack-15.1.3.tgz",
- "integrity": "sha512-xbV74ulf5BwIA61jASjKxzS0gzD6CQQkqPXDRo8I1tpDMQpEKFKWivw+1Joy6Anm62DWR4xuMEhnj5kjKWemgw==",
+ "version": "15.2.6",
+ "resolved": "https://registry.npmjs.org/@ngtools/webpack/-/webpack-15.2.6.tgz",
+ "integrity": "sha512-I+kekKItfsCLdX+ZjjmsWqd0AyoYGTQPjlbQAiPtmdH73/rfPOF4Q/3AU4tzTdn0n0GXqZWv6VOs91w99ydi0A==",
"dev": true,
"engines": {
"node": "^14.20.0 || ^16.13.0 || >=18.10.0",
@@ -4137,14 +4551,13 @@
"dev": true
},
"node_modules/@npmcli/git": {
- "version": "4.0.3",
- "resolved": "https://registry.npmjs.org/@npmcli/git/-/git-4.0.3.tgz",
- "integrity": "sha512-8cXNkDIbnXPVbhXMmQ7/bklCAjtmPaXfI9aEM4iH+xSuEHINLMHhlfESvVwdqmHJRJkR48vNJTSUvoF6GRPSFA==",
+ "version": "4.0.4",
+ "resolved": "https://registry.npmjs.org/@npmcli/git/-/git-4.0.4.tgz",
+ "integrity": "sha512-5yZghx+u5M47LghaybLCkdSyFzV/w4OuH12d96HO389Ik9CDsLaDZJVynSGGVJOLn6gy/k7Dz5XYcplM3uxXRg==",
"dev": true,
"dependencies": {
"@npmcli/promise-spawn": "^6.0.0",
"lru-cache": "^7.4.4",
- "mkdirp": "^1.0.4",
"npm-pick-manifest": "^8.0.0",
"proc-log": "^3.0.0",
"promise-inflight": "^1.0.1",
@@ -4157,18 +4570,18 @@
}
},
"node_modules/@npmcli/git/node_modules/lru-cache": {
- "version": "7.14.1",
- "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.14.1.tgz",
- "integrity": "sha512-ysxwsnTKdAx96aTRdhDOCQfDgbHnt8SK0KY8SEjO0wHinhWOFTESbjVCMPbU1uGXg/ch4lifqx0wfjOawU2+WA==",
+ "version": "7.18.3",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz",
+ "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==",
"dev": true,
"engines": {
"node": ">=12"
}
},
"node_modules/@npmcli/git/node_modules/semver": {
- "version": "7.3.8",
- "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz",
- "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==",
+ "version": "7.4.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz",
+ "integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==",
"dev": true,
"dependencies": {
"lru-cache": "^6.0.0"
@@ -4214,9 +4627,9 @@
"dev": true
},
"node_modules/@npmcli/installed-package-contents": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/@npmcli/installed-package-contents/-/installed-package-contents-2.0.1.tgz",
- "integrity": "sha512-GIykAFdOVK31Q1/zAtT5MbxqQL2vyl9mvFJv+OGu01zxbhL3p0xc8gJjdNGX1mWmUT43aEKVO2L6V/2j4TOsAA==",
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/@npmcli/installed-package-contents/-/installed-package-contents-2.0.2.tgz",
+ "integrity": "sha512-xACzLPhnfD51GKvTOOuNX2/V4G4mz9/1I2MfDoye9kBM3RYe5g2YbscsaGoTlaWqkxeiapBWyseULVKpSVHtKQ==",
"dev": true,
"dependencies": {
"npm-bundled": "^3.0.0",
@@ -4341,7 +4754,8 @@
"node_modules/@polka/url": {
"version": "1.0.0-next.21",
"resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.21.tgz",
- "integrity": "sha512-a5Sab1C4/icpTZVzZc5Ghpz88yQtGOyNqYXcZgOssB2uuAr+wF/MvN6bgtW32q7HHrvBki+BsZ0OuNv6EV3K9g=="
+ "integrity": "sha512-a5Sab1C4/icpTZVzZc5Ghpz88yQtGOyNqYXcZgOssB2uuAr+wF/MvN6bgtW32q7HHrvBki+BsZ0OuNv6EV3K9g==",
+ "dev": true
},
"node_modules/@popperjs/core": {
"version": "2.11.6",
@@ -4353,13 +4767,13 @@
}
},
"node_modules/@schematics/angular": {
- "version": "15.1.3",
- "resolved": "https://registry.npmjs.org/@schematics/angular/-/angular-15.1.3.tgz",
- "integrity": "sha512-jCJ0Nq/FpoMnA63rPAhRWQJFVbS+K8NpdTHZ/7l4wx9iFtIH7khCdbp3QYMJSwZh5pEiw/NO7ouxsWo5YgapYQ==",
+ "version": "15.2.6",
+ "resolved": "https://registry.npmjs.org/@schematics/angular/-/angular-15.2.6.tgz",
+ "integrity": "sha512-OcBUvVAxZEMBX+fi0ytybeAdmStra+GwtlvipS70yOxcAgJ84ZrnZGN7a072cCVQcq7AgqUfssnyqCx1wu+yCg==",
"dev": true,
"dependencies": {
- "@angular-devkit/core": "15.1.3",
- "@angular-devkit/schematics": "15.1.3",
+ "@angular-devkit/core": "15.2.6",
+ "@angular-devkit/schematics": "15.2.6",
"jsonc-parser": "3.2.0"
},
"engines": {
@@ -4368,6 +4782,15 @@
"yarn": ">= 1.13.0"
}
},
+ "node_modules/@sigstore/protobuf-specs": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/@sigstore/protobuf-specs/-/protobuf-specs-0.1.0.tgz",
+ "integrity": "sha512-a31EnjuIDSX8IXBUib3cYLDRlPMU36AWX4xS8ysLaNu4ZzUesDiPt83pgrW2X1YLMe5L2HbDyaKK5BrL4cNKaQ==",
+ "dev": true,
+ "engines": {
+ "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+ }
+ },
"node_modules/@sinonjs/commons": {
"version": "1.8.6",
"resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.6.tgz",
@@ -4449,6 +4872,43 @@
"integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==",
"dev": true
},
+ "node_modules/@tufjs/canonical-json": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/@tufjs/canonical-json/-/canonical-json-1.0.0.tgz",
+ "integrity": "sha512-QTnf++uxunWvG2z3UFNzAoQPHxnSXOwtaI3iJ+AohhV+5vONuArPjJE7aPXPVXfXJsqrVbZBu9b81AJoSd09IQ==",
+ "dev": true,
+ "engines": {
+ "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+ }
+ },
+ "node_modules/@tufjs/models": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/@tufjs/models/-/models-1.0.2.tgz",
+ "integrity": "sha512-uxarDtxTIK3f8hJS4yFhW/lvTa3tsiQU5iDCRut+NCnOXvNtEul0Ct58NIIcIx9Rkt7OFEK31Ndpqsd663nsew==",
+ "dev": true,
+ "dependencies": {
+ "@tufjs/canonical-json": "1.0.0",
+ "minimatch": "^8.0.3"
+ },
+ "engines": {
+ "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+ }
+ },
+ "node_modules/@tufjs/models/node_modules/minimatch": {
+ "version": "8.0.4",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-8.0.4.tgz",
+ "integrity": "sha512-W0Wvr9HyFXZRGIDgCicunpQ299OKXs9RgZfaukz4qAW/pJhcpUfupc9c+OObPOFueNy8VSrZgEmDtk6Kh4WzDA==",
+ "dev": true,
+ "dependencies": {
+ "brace-expansion": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=16 || 14 >=14.17"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
"node_modules/@tweenjs/tween.js": {
"version": "18.6.4",
"resolved": "https://registry.npmjs.org/@tweenjs/tween.js/-/tween.js-18.6.4.tgz",
@@ -4813,13 +5273,13 @@
"dev": true
},
"node_modules/@types/express": {
- "version": "4.17.16",
- "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.16.tgz",
- "integrity": "sha512-LkKpqRZ7zqXJuvoELakaFYuETHjZkSol8EV6cNnyishutDBCCdv6+dsKPbKkCcIk57qRphOLY5sEgClw1bO3gA==",
+ "version": "4.17.17",
+ "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.17.tgz",
+ "integrity": "sha512-Q4FmmuLGBG58btUnfS1c1r/NQdlp3DMfGDGig8WhfpA2YRUtEkxAjkZb0yvplJGYdF1fsQ81iMDcH24sSCNC/Q==",
"dev": true,
"dependencies": {
"@types/body-parser": "*",
- "@types/express-serve-static-core": "^4.17.31",
+ "@types/express-serve-static-core": "^4.17.33",
"@types/qs": "*",
"@types/serve-static": "*"
}
@@ -4856,9 +5316,9 @@
}
},
"node_modules/@types/http-proxy": {
- "version": "1.17.9",
- "resolved": "https://registry.npmjs.org/@types/http-proxy/-/http-proxy-1.17.9.tgz",
- "integrity": "sha512-QsbSjA/fSk7xB+UXlCT3wHBy5ai9wOcNDWwZAtud+jXhwOM3l+EYZh8Lng4+/6n8uar0J7xILzqftJdJ/Wdfkw==",
+ "version": "1.17.10",
+ "resolved": "https://registry.npmjs.org/@types/http-proxy/-/http-proxy-1.17.10.tgz",
+ "integrity": "sha512-Qs5aULi+zV1bwKAg5z1PWnDXWmsn+LxIvUGv6E2+OOMYhclZMO+OXd9pYVf2gLykf2I7IV2u7oTHwChPNsvJ7g==",
"dev": true,
"dependencies": {
"@types/node": "*"
@@ -4962,9 +5422,9 @@
}
},
"node_modules/@types/serve-static": {
- "version": "1.15.0",
- "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.0.tgz",
- "integrity": "sha512-z5xyF6uh8CbjAu9760KDKsH2FcDxZ2tFCsA4HIMWE6IkiYMXfVoa+4f9KX+FN0ZLsaMw1WNG2ETLA6N+/YA+cg==",
+ "version": "1.15.1",
+ "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.1.tgz",
+ "integrity": "sha512-NUo5XNiAdULrJENtJXZZ3fHtfMolzZwczzBbnAeBbqBwG+LaG6YaJtuwzwGSQZ2wsCrxjEhNNjAkKigy3n8teQ==",
"dev": true,
"dependencies": {
"@types/mime": "*",
@@ -5529,6 +5989,7 @@
"version": "8.8.2",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz",
"integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==",
+ "dev": true,
"bin": {
"acorn": "bin/acorn"
},
@@ -5589,6 +6050,7 @@
"version": "8.2.0",
"resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz",
"integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==",
+ "dev": true,
"engines": {
"node": ">=0.4.0"
}
@@ -5620,14 +6082,6 @@
"node": ">=8.9.0"
}
},
- "node_modules/ag-swipe-core": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/ag-swipe-core/-/ag-swipe-core-1.0.2.tgz",
- "integrity": "sha512-NNONbrEbsmu6wsl7E07eGYVZw8Wx7hOok2TlhQLU/50EUhmI3Vpg8EDz0rWhV/HrfUAoEd4LxBvLAeT9DswQDw==",
- "dependencies": {
- "rxjs": "^7.5.5"
- }
- },
"node_modules/agent-base": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",
@@ -5641,28 +6095,19 @@
}
},
"node_modules/agentkeepalive": {
- "version": "4.2.1",
- "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.2.1.tgz",
- "integrity": "sha512-Zn4cw2NEqd+9fiSVWMscnjyQ1a8Yfoc5oBajLeo5w+YBHgDUcEBY2hS4YpTz6iN5f/2zQiktcuM6tS8x1p9dpA==",
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.3.0.tgz",
+ "integrity": "sha512-7Epl1Blf4Sy37j4v9f9FjICCh4+KAQOyXgHEwlyBiAQLbhKdq/i2QQU3amQalS/wPhdPzDXPL5DMR5bkn+YeWg==",
"dev": true,
"dependencies": {
"debug": "^4.1.0",
- "depd": "^1.1.2",
+ "depd": "^2.0.0",
"humanize-ms": "^1.2.1"
},
"engines": {
"node": ">= 8.0.0"
}
},
- "node_modules/agentkeepalive/node_modules/depd": {
- "version": "1.1.2",
- "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
- "integrity": "sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==",
- "dev": true,
- "engines": {
- "node": ">= 0.6"
- }
- },
"node_modules/aggregate-error": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz",
@@ -6257,9 +6702,9 @@
"dev": true
},
"node_modules/bonjour-service": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/bonjour-service/-/bonjour-service-1.1.0.tgz",
- "integrity": "sha512-LVRinRB3k1/K0XzZ2p58COnWvkQknIY6sf0zF2rpErvcJXpMBttEPQSxK+HEXSS9VmpZlDoDnQWv8ftJT20B0Q==",
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/bonjour-service/-/bonjour-service-1.1.1.tgz",
+ "integrity": "sha512-Z/5lQRMOG9k7W+FkeGTNjh7htqn/2LMnfOvBZ8pynNZCM9MwkQkI3zeI4oz09uWdcgmgHugVvBqxGg4VQJ5PCg==",
"dev": true,
"dependencies": {
"array-flatten": "^2.1.2",
@@ -6271,7 +6716,8 @@
"node_modules/boolbase": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz",
- "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww=="
+ "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==",
+ "dev": true
},
"node_modules/bootstrap": {
"version": "5.2.3",
@@ -6310,17 +6756,6 @@
"node": ">=8"
}
},
- "node_modules/browser": {
- "version": "0.2.6",
- "resolved": "https://registry.npmjs.org/browser/-/browser-0.2.6.tgz",
- "integrity": "sha512-U6FjD1MaSio5jnSbGj7nrMzdy4mHmXe6RZ4/5Oa9CWIEa6iWCwnhJPfbZXGwaOOySqRF10v8BIQ4zYJyhBg97g==",
- "dependencies": {
- "cheerio": "x.x.x",
- "junjo": ">=0.2.6",
- "termcolor": "x.x.x",
- "u2r": "x.x.x"
- }
- },
"node_modules/browser-process-hrtime": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz",
@@ -6427,9 +6862,9 @@
}
},
"node_modules/builtins/node_modules/semver": {
- "version": "7.3.8",
- "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz",
- "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==",
+ "version": "7.4.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz",
+ "integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==",
"dev": true,
"dependencies": {
"lru-cache": "^6.0.0"
@@ -6563,37 +6998,6 @@
"integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==",
"dev": true
},
- "node_modules/cheerio": {
- "version": "0.22.0",
- "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-0.22.0.tgz",
- "integrity": "sha512-8/MzidM6G/TgRelkzDG13y3Y9LxBjCb+8yOEZ9+wwq5gVF2w2pV0wmHvjfT0RvuxGyR7UEuK36r+yYMbT4uKgA==",
- "dependencies": {
- "css-select": "~1.2.0",
- "dom-serializer": "~0.1.0",
- "entities": "~1.1.1",
- "htmlparser2": "^3.9.1",
- "lodash.assignin": "^4.0.9",
- "lodash.bind": "^4.1.4",
- "lodash.defaults": "^4.0.1",
- "lodash.filter": "^4.4.0",
- "lodash.flatten": "^4.2.0",
- "lodash.foreach": "^4.3.0",
- "lodash.map": "^4.4.0",
- "lodash.merge": "^4.4.0",
- "lodash.pick": "^4.2.1",
- "lodash.reduce": "^4.4.0",
- "lodash.reject": "^4.4.0",
- "lodash.some": "^4.4.0"
- },
- "engines": {
- "node": ">= 0.6"
- }
- },
- "node_modules/cheerio/node_modules/entities": {
- "version": "1.1.2",
- "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz",
- "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w=="
- },
"node_modules/chokidar": {
"version": "3.5.3",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz",
@@ -6797,6 +7201,7 @@
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz",
"integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==",
+ "dev": true,
"engines": {
"node": ">= 10"
}
@@ -7276,25 +7681,6 @@
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
"dev": true
},
- "node_modules/css-select": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz",
- "integrity": "sha512-dUQOBoqdR7QwV90WysXPLXG5LO7nhYBgiWVfxF80DKPF8zx1t/pUd2FYy73emg3zrjtM6dzmYgbHKfV2rxiHQA==",
- "dependencies": {
- "boolbase": "~1.0.0",
- "css-what": "2.1",
- "domutils": "1.5.1",
- "nth-check": "~1.0.1"
- }
- },
- "node_modules/css-what": {
- "version": "2.1.3",
- "resolved": "https://registry.npmjs.org/css-what/-/css-what-2.1.3.tgz",
- "integrity": "sha512-a+EPoD+uZiNfh+5fxw2nO9QwFa6nJe2Or35fGY6Ipw1R3R4AGz1d1TEZrCegvw2YTmZ0jXirGYlzxxpYSHwpEg==",
- "engines": {
- "node": "*"
- }
- },
"node_modules/cssesc": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz",
@@ -7754,9 +8140,9 @@
"dev": true
},
"node_modules/dns-packet": {
- "version": "5.4.0",
- "resolved": "https://registry.npmjs.org/dns-packet/-/dns-packet-5.4.0.tgz",
- "integrity": "sha512-EgqGeaBB8hLiHLZtp/IbaDQTL8pZ0+IvwzSHA6d7VyMDM+B9hgddEMa9xjK5oYnw0ci0JQ6g2XCD7/f6cafU6g==",
+ "version": "5.5.0",
+ "resolved": "https://registry.npmjs.org/dns-packet/-/dns-packet-5.5.0.tgz",
+ "integrity": "sha512-USawdAUzRkV6xrqTjiAEp6M9YagZEzWcSUaZTcIFAiyQWW1SoI6KyId8y2+/71wbgHKQAKd+iupLv4YvEwYWvA==",
"dev": true,
"dependencies": {
"@leichtgewicht/ip-codec": "^2.0.1"
@@ -7777,20 +8163,6 @@
"node": ">=6.0.0"
}
},
- "node_modules/dom-serializer": {
- "version": "0.1.1",
- "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.1.tgz",
- "integrity": "sha512-l0IU0pPzLWSHBcieZbpOKgkIn3ts3vAh7ZuFyXNwJxJXk/c4Gwj9xaTJwIDVQCXawWD0qb3IzMGH5rglQaO0XA==",
- "dependencies": {
- "domelementtype": "^1.3.0",
- "entities": "^1.1.1"
- }
- },
- "node_modules/dom-serializer/node_modules/entities": {
- "version": "1.1.2",
- "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz",
- "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w=="
- },
"node_modules/dom7": {
"version": "4.0.4",
"resolved": "https://registry.npmjs.org/dom7/-/dom7-4.0.4.tgz",
@@ -7799,11 +8171,6 @@
"ssr-window": "^4.0.0"
}
},
- "node_modules/domelementtype": {
- "version": "1.3.1",
- "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.1.tgz",
- "integrity": "sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w=="
- },
"node_modules/domexception": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/domexception/-/domexception-2.0.1.tgz",
@@ -7825,27 +8192,11 @@
"node": ">=8"
}
},
- "node_modules/domhandler": {
- "version": "2.4.2",
- "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.4.2.tgz",
- "integrity": "sha512-JiK04h0Ht5u/80fdLMCEmV4zkNh2BcoMFBmZ/91WtYZ8qVXSKjiw7fXMgFPnHcSZgOo3XdinHvmnDUeMf5R4wA==",
- "dependencies": {
- "domelementtype": "1"
- }
- },
- "node_modules/domutils": {
- "version": "1.5.1",
- "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.5.1.tgz",
- "integrity": "sha512-gSu5Oi/I+3wDENBsOWBiRK1eoGxcywYSqg3rR960/+EfY0CF4EX1VPkgHOZ3WiS/Jg2DtliF6BhWcHlfpYUcGw==",
- "dependencies": {
- "dom-serializer": "0",
- "domelementtype": "1"
- }
- },
"node_modules/duplexer": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz",
- "integrity": "sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg=="
+ "integrity": "sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==",
+ "dev": true
},
"node_modules/ee-first": {
"version": "1.1.1",
@@ -7931,7 +8282,7 @@
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/entities/-/entities-4.4.0.tgz",
"integrity": "sha512-oYp7156SP8LkeGD0GF85ad1X9Ai79WtRsZ2gxJqtBuzH+98YUV6jkHEKlZkMbcrjJjIVJNIDP/3WL9wQkoPbWA==",
- "optional": true,
+ "devOptional": true,
"engines": {
"node": ">=0.12"
},
@@ -8008,6 +8359,44 @@
"integrity": "sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ==",
"dev": true
},
+ "node_modules/esbuild": {
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.17.8.tgz",
+ "integrity": "sha512-g24ybC3fWhZddZK6R3uD2iF/RIPnRpwJAqLov6ouX3hMbY4+tKolP0VMF3zuIYCaXun+yHwS5IPQ91N2BT191g==",
+ "dev": true,
+ "hasInstallScript": true,
+ "optional": true,
+ "bin": {
+ "esbuild": "bin/esbuild"
+ },
+ "engines": {
+ "node": ">=12"
+ },
+ "optionalDependencies": {
+ "@esbuild/android-arm": "0.17.8",
+ "@esbuild/android-arm64": "0.17.8",
+ "@esbuild/android-x64": "0.17.8",
+ "@esbuild/darwin-arm64": "0.17.8",
+ "@esbuild/darwin-x64": "0.17.8",
+ "@esbuild/freebsd-arm64": "0.17.8",
+ "@esbuild/freebsd-x64": "0.17.8",
+ "@esbuild/linux-arm": "0.17.8",
+ "@esbuild/linux-arm64": "0.17.8",
+ "@esbuild/linux-ia32": "0.17.8",
+ "@esbuild/linux-loong64": "0.17.8",
+ "@esbuild/linux-mips64el": "0.17.8",
+ "@esbuild/linux-ppc64": "0.17.8",
+ "@esbuild/linux-riscv64": "0.17.8",
+ "@esbuild/linux-s390x": "0.17.8",
+ "@esbuild/linux-x64": "0.17.8",
+ "@esbuild/netbsd-x64": "0.17.8",
+ "@esbuild/openbsd-x64": "0.17.8",
+ "@esbuild/sunos-x64": "0.17.8",
+ "@esbuild/win32-arm64": "0.17.8",
+ "@esbuild/win32-ia32": "0.17.8",
+ "@esbuild/win32-x64": "0.17.8"
+ }
+ },
"node_modules/esbuild-android-arm64": {
"version": "0.14.11",
"resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.14.11.tgz",
@@ -8204,9 +8593,9 @@
]
},
"node_modules/esbuild-wasm": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/esbuild-wasm/-/esbuild-wasm-0.16.17.tgz",
- "integrity": "sha512-Tn7NuMqRcM+T/qCOxbQRq0qrwWl1sUWp6ARfJRakE8Bepew6zata4qrKgH2YqovNC5e/2fcTa7o+VL/FAOZC1Q==",
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/esbuild-wasm/-/esbuild-wasm-0.17.8.tgz",
+ "integrity": "sha512-zCmpxv95E0FuCmvdw1K836UHnj4EdiQnFfjTby35y3LAjRPtXMj3sbHDRHjbD8Mqg5lTwq3knacr/1qIFU51CQ==",
"dev": true,
"bin": {
"esbuild": "bin/esbuild"
@@ -9482,6 +9871,7 @@
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/gzip-size/-/gzip-size-6.0.0.tgz",
"integrity": "sha512-ax7ZYomf6jqPTQ4+XCpUGyXKHk5WweS+e05MBO4/y3WJ5RkmPXNKvX+bx1behVILVwr6JSQvZAku021CHPXG3Q==",
+ "dev": true,
"dependencies": {
"duplexer": "^0.1.2"
},
@@ -9602,9 +9992,9 @@
}
},
"node_modules/hosted-git-info/node_modules/lru-cache": {
- "version": "7.14.1",
- "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.14.1.tgz",
- "integrity": "sha512-ysxwsnTKdAx96aTRdhDOCQfDgbHnt8SK0KY8SEjO0wHinhWOFTESbjVCMPbU1uGXg/ch4lifqx0wfjOawU2+WA==",
+ "version": "7.18.3",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz",
+ "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==",
"dev": true,
"engines": {
"node": ">=12"
@@ -9623,9 +10013,9 @@
}
},
"node_modules/hpack.js/node_modules/readable-stream": {
- "version": "2.3.7",
- "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
- "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
+ "version": "2.3.8",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz",
+ "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==",
"dev": true,
"dependencies": {
"core-util-is": "~1.0.0",
@@ -9676,24 +10066,6 @@
"integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==",
"dev": true
},
- "node_modules/htmlparser2": {
- "version": "3.10.1",
- "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.1.tgz",
- "integrity": "sha512-IgieNijUMbkDovyoKObU1DUhm1iwNYE/fuifEoEHfd1oZKZDaONBSkal7Y01shxsM49R4XaMdGez3WnF9UfiCQ==",
- "dependencies": {
- "domelementtype": "^1.3.1",
- "domhandler": "^2.3.0",
- "domutils": "^1.5.1",
- "entities": "^1.1.1",
- "inherits": "^2.0.1",
- "readable-stream": "^3.1.1"
- }
- },
- "node_modules/htmlparser2/node_modules/entities": {
- "version": "1.1.2",
- "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz",
- "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w=="
- },
"node_modules/http-cache-semantics": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz",
@@ -9865,17 +10237,32 @@
}
},
"node_modules/ignore-walk": {
- "version": "6.0.0",
- "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-6.0.0.tgz",
- "integrity": "sha512-bTf9UWe/UP1yxG3QUrj/KOvEhTAUWPcv+WvbFZ28LcqznXabp7Xu6o9y1JEC18+oqODuS7VhTpekV5XvFwsxJg==",
+ "version": "6.0.2",
+ "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-6.0.2.tgz",
+ "integrity": "sha512-ezmQ1Dg2b3jVZh2Dh+ar6Eu2MqNSTkyb32HU2MAQQQX9tKM3q/UQ/9lf03lQ5hW+fOeoMnwxwkleZ0xcNp0/qg==",
"dev": true,
"dependencies": {
- "minimatch": "^5.0.1"
+ "minimatch": "^7.4.2"
},
"engines": {
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
}
},
+ "node_modules/ignore-walk/node_modules/minimatch": {
+ "version": "7.4.6",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-7.4.6.tgz",
+ "integrity": "sha512-sBz8G/YjVniEz6lKPNpKxXwazJe4c19fEfV2GDMX6AjFz+MX9uDWIZW8XreVhkFW3fkIdTv/gxWr/Kks5FFAVw==",
+ "dev": true,
+ "dependencies": {
+ "brace-expansion": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
"node_modules/image-size": {
"version": "0.5.5",
"resolved": "https://registry.npmjs.org/image-size/-/image-size-0.5.5.tgz",
@@ -12773,14 +13160,6 @@
"node >= 0.2.0"
]
},
- "node_modules/junjo": {
- "version": "0.2.8",
- "resolved": "https://registry.npmjs.org/junjo/-/junjo-0.2.8.tgz",
- "integrity": "sha512-aekTv1Qq5BpOSXWlJWgfTsUKsu1gg/+ZluD+9aJfJcOP/BiywM+8owTX/DIZTp9O7V7YOybOXiIftz35JyjjuA==",
- "engines": {
- "node": "*"
- }
- },
"node_modules/karma-coverage": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/karma-coverage/-/karma-coverage-2.2.0.tgz",
@@ -13019,17 +13398,8 @@
"node_modules/lodash": {
"version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
- "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
- },
- "node_modules/lodash.assignin": {
- "version": "4.2.0",
- "resolved": "https://registry.npmjs.org/lodash.assignin/-/lodash.assignin-4.2.0.tgz",
- "integrity": "sha512-yX/rx6d/UTVh7sSVWVSIMjfnz95evAgDFdb1ZozC35I9mSFCkmzptOzevxjgbQUsc78NR44LVHWjsoMQXy9FDg=="
- },
- "node_modules/lodash.bind": {
- "version": "4.2.1",
- "resolved": "https://registry.npmjs.org/lodash.bind/-/lodash.bind-4.2.1.tgz",
- "integrity": "sha512-lxdsn7xxlCymgLYo1gGvVrfHmkjDiyqVv62FAeF2i5ta72BipE1SLxw8hPEPLhD4/247Ijw07UQH7Hq/chT5LA=="
+ "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
+ "dev": true
},
"node_modules/lodash.debounce": {
"version": "4.0.8",
@@ -13042,31 +13412,6 @@
"resolved": "https://registry.npmjs.org/lodash.deburr/-/lodash.deburr-4.1.0.tgz",
"integrity": "sha512-m/M1U1f3ddMCs6Hq2tAsYThTBDaAKFDX3dwDo97GEYzamXi9SqUpjWi/Rrj/gf3X2n8ktwgZrlP1z6E3v/IExQ=="
},
- "node_modules/lodash.defaults": {
- "version": "4.2.0",
- "resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-4.2.0.tgz",
- "integrity": "sha512-qjxPLHd3r5DnsdGacqOMU6pb/avJzdh9tFX2ymgoZE27BmjXrNy/y4LoaiTeAb+O3gL8AfpJGtqfX/ae2leYYQ=="
- },
- "node_modules/lodash.filter": {
- "version": "4.6.0",
- "resolved": "https://registry.npmjs.org/lodash.filter/-/lodash.filter-4.6.0.tgz",
- "integrity": "sha512-pXYUy7PR8BCLwX5mgJ/aNtyOvuJTdZAo9EQFUvMIYugqmJxnrYaANvTbgndOzHSCSR0wnlBBfRXJL5SbWxo3FQ=="
- },
- "node_modules/lodash.flatten": {
- "version": "4.4.0",
- "resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz",
- "integrity": "sha512-C5N2Z3DgnnKr0LOpv/hKCgKdb7ZZwafIrsesve6lmzvZIRZRGaZ/l6Q8+2W7NaT+ZwO3fFlSCzCzrDCFdJfZ4g=="
- },
- "node_modules/lodash.foreach": {
- "version": "4.5.0",
- "resolved": "https://registry.npmjs.org/lodash.foreach/-/lodash.foreach-4.5.0.tgz",
- "integrity": "sha512-aEXTF4d+m05rVOAUG3z4vZZ4xVexLKZGF0lIxuHZ1Hplpk/3B6Z1+/ICICYRLm7c41Z2xiejbkCkJoTlypoXhQ=="
- },
- "node_modules/lodash.map": {
- "version": "4.6.0",
- "resolved": "https://registry.npmjs.org/lodash.map/-/lodash.map-4.6.0.tgz",
- "integrity": "sha512-worNHGKLDetmcEYDvh2stPCrrQRkP20E4l0iIS7F8EvzMqBBi7ltvFN5m1HvTf1P7Jk1txKhvFcmYsCr8O2F1Q=="
- },
"node_modules/lodash.memoize": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz",
@@ -13076,27 +13421,8 @@
"node_modules/lodash.merge": {
"version": "4.6.2",
"resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
- "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ=="
- },
- "node_modules/lodash.pick": {
- "version": "4.4.0",
- "resolved": "https://registry.npmjs.org/lodash.pick/-/lodash.pick-4.4.0.tgz",
- "integrity": "sha512-hXt6Ul/5yWjfklSGvLQl8vM//l3FtyHZeuelpzK6mm99pNvN9yTDruNZPEJZD1oWrqo+izBmB7oUfWgcCX7s4Q=="
- },
- "node_modules/lodash.reduce": {
- "version": "4.6.0",
- "resolved": "https://registry.npmjs.org/lodash.reduce/-/lodash.reduce-4.6.0.tgz",
- "integrity": "sha512-6raRe2vxCYBhpBu+B+TtNGUzah+hQjVdu3E17wfusjyrXBka2nBS8OH/gjVZ5PvHOhWmIZTYri09Z6n/QfnNMw=="
- },
- "node_modules/lodash.reject": {
- "version": "4.6.0",
- "resolved": "https://registry.npmjs.org/lodash.reject/-/lodash.reject-4.6.0.tgz",
- "integrity": "sha512-qkTuvgEzYdyhiJBx42YPzPo71R1aEr0z79kAv7Ixg8wPFEjgRgJdUsGMG3Hf3OYSF/kHI79XhNlt+5Ar6OzwxQ=="
- },
- "node_modules/lodash.some": {
- "version": "4.6.0",
- "resolved": "https://registry.npmjs.org/lodash.some/-/lodash.some-4.6.0.tgz",
- "integrity": "sha512-j7MJE+TuT51q9ggt4fSgVqro163BEFjAt3u97IqU+JA2DkWl80nFTrowzLpZ/BnpN7rrl0JA/593NAdd8p/scQ=="
+ "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==",
+ "dev": true
},
"node_modules/log-symbols": {
"version": "4.1.0",
@@ -13306,9 +13632,9 @@
}
},
"node_modules/make-fetch-happen/node_modules/lru-cache": {
- "version": "7.14.1",
- "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.14.1.tgz",
- "integrity": "sha512-ysxwsnTKdAx96aTRdhDOCQfDgbHnt8SK0KY8SEjO0wHinhWOFTESbjVCMPbU1uGXg/ch4lifqx0wfjOawU2+WA==",
+ "version": "7.18.3",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz",
+ "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==",
"dev": true,
"engines": {
"node": ">=12"
@@ -13327,9 +13653,9 @@
}
},
"node_modules/make-fetch-happen/node_modules/semver": {
- "version": "7.3.8",
- "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz",
- "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==",
+ "version": "7.4.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz",
+ "integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==",
"dev": true,
"dependencies": {
"lru-cache": "^6.0.0"
@@ -13547,9 +13873,9 @@
}
},
"node_modules/minipass": {
- "version": "4.0.1",
- "resolved": "https://registry.npmjs.org/minipass/-/minipass-4.0.1.tgz",
- "integrity": "sha512-V9esFpNbK0arbN3fm2sxDKqMYgIp7XtVdE4Esj+PE4Qaaxdg1wIw48ITQIOn1sc8xXSmUviVL3cyjMqPlrVkiA==",
+ "version": "4.2.8",
+ "resolved": "https://registry.npmjs.org/minipass/-/minipass-4.2.8.tgz",
+ "integrity": "sha512-fNzuVyifolSLFL4NzpF+wEF4qrgqaaKX0haXPQEdQ7NKAN+WecoKMHV09YcuL/DHxrUsYQOK3MiuDf7Ip2OXfQ==",
"dev": true,
"engines": {
"node": ">=8"
@@ -13785,6 +14111,7 @@
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/mrmime/-/mrmime-1.0.1.tgz",
"integrity": "sha512-hzzEagAgDyoU1Q6yg5uI+AorQgdvMCur3FcKf7NhMKWsaYg+RnbTyHRa/9IlLF9rf455MOCtcqqrQQ83pPP7Uw==",
+ "dev": true,
"engines": {
"node": ">=10"
}
@@ -13898,31 +14225,18 @@
"resolved": "https://registry.npmjs.org/ng-circle-progress/-/ng-circle-progress-1.7.1.tgz",
"integrity": "sha512-XAsd/FRWC4lqO7pUakwniO1c+ew3zr+Un/pZ58aqdE1aq3iS7kquxDmzOOCZ2XoUhU/6vC31e/DSYHvlHhITkA==",
"dependencies": {
- "tslib": "^2.0.0"
- },
- "peerDependencies": {
- "@angular/common": ">=14.0.0",
- "@angular/core": ">=14.0.0",
- "rxjs": ">=6.4.0"
- }
- },
- "node_modules/ng-swipe": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/ng-swipe/-/ng-swipe-2.0.1.tgz",
- "integrity": "sha512-y4w2d719VK1u6KUlNqhHVevzT+yR30bnTTLkFNEsVG3Gp5+oZhUnflVNWfzIw+O8GCjZqVLelwla/jOkqUclmQ==",
- "dependencies": {
- "ag-swipe-core": "^1.0.0",
- "tslib": "^2.3.0"
+ "tslib": "^2.0.0"
},
"peerDependencies": {
- "@angular/common": "^14.0.0",
- "@angular/core": "^14.0.0"
+ "@angular/common": ">=14.0.0",
+ "@angular/core": ">=14.0.0",
+ "rxjs": ">=6.4.0"
}
},
"node_modules/ngx-color-picker": {
- "version": "13.0.0",
- "resolved": "https://registry.npmjs.org/ngx-color-picker/-/ngx-color-picker-13.0.0.tgz",
- "integrity": "sha512-3mgMbs21KeqnmmY5p1cn71ckTH3q7gBt6Qn0fMfeF/Ql7ddTZsW4Z7Z8ga6LymMP/ugooGuLOFX+V6yx0dDxAw==",
+ "version": "14.0.0",
+ "resolved": "https://registry.npmjs.org/ngx-color-picker/-/ngx-color-picker-14.0.0.tgz",
+ "integrity": "sha512-w28zx2DyVpIJeNsTB3T2LUI4Ed/Ujf5Uhxuh0dllputfpxXwZG9ocSJM/0L67+fxA3UnfvvXVZNUX1Ny5nZIIw==",
"dependencies": {
"tslib": "^2.3.0"
},
@@ -13933,9 +14247,9 @@
}
},
"node_modules/ngx-extended-pdf-viewer": {
- "version": "15.2.2",
- "resolved": "https://registry.npmjs.org/ngx-extended-pdf-viewer/-/ngx-extended-pdf-viewer-15.2.2.tgz",
- "integrity": "sha512-IibJ4633TosuAJDtazQiPkVx2G8+tDgs3Nnup9vjwH4f0UqmLA6NdTH7qwwCPdHJxlogRUkCHYNPlP5jB5PmPg==",
+ "version": "16.2.16",
+ "resolved": "https://registry.npmjs.org/ngx-extended-pdf-viewer/-/ngx-extended-pdf-viewer-16.2.16.tgz",
+ "integrity": "sha512-C4gTb6IdzEUbPe1n72pLZbsEQWwH8VSAXPGWI88XeCpnplDBxkiMGJ/5UdyxOiT30GDYxsjNWq+yZhD87XfH6w==",
"dependencies": {
"lodash.deburr": "^4.1.0",
"tslib": "^2.3.0"
@@ -13946,9 +14260,9 @@
}
},
"node_modules/ngx-file-drop": {
- "version": "14.0.2",
- "resolved": "https://registry.npmjs.org/ngx-file-drop/-/ngx-file-drop-14.0.2.tgz",
- "integrity": "sha512-tIW+Ymd2IOjUQTqMb2NiuupeRPWwKe19kHmb13gf4Iw8rkvrO6PlqqZ3EqSGPIEJOmV836FZHpM4B1xXjVQLfA==",
+ "version": "15.0.0",
+ "resolved": "https://registry.npmjs.org/ngx-file-drop/-/ngx-file-drop-15.0.0.tgz",
+ "integrity": "sha512-P1BRa9w+l6CFCQFEHRaUcQy8DvrgwMnWZUWwndcXQ+Qqqa3BOXfrN26uDd+px9FD/P5OkKidhglI7VRX6qmLwg==",
"dependencies": {
"tslib": "^2.3.0"
},
@@ -13962,9 +14276,9 @@
}
},
"node_modules/ngx-slider-v2": {
- "version": "15.0.3",
- "resolved": "https://registry.npmjs.org/ngx-slider-v2/-/ngx-slider-v2-15.0.3.tgz",
- "integrity": "sha512-dzFUHH3PWo7tRDopMocLcF7CjYNrXI9P3/5RwlZMHLazaru0qHMlukrUzp8FvuZWTD1CX6hAhDrDevHgMOUiFA==",
+ "version": "15.0.4",
+ "resolved": "https://registry.npmjs.org/ngx-slider-v2/-/ngx-slider-v2-15.0.4.tgz",
+ "integrity": "sha512-+ohkyhWa2J1u04Wm1g2yBH5MEiwVGQqbCbOUXISAwl0Vcv6xOHYkJNcDOa4f0lINu9ozmCaozA0KH0SkPss6pw==",
"dependencies": {
"detect-passive-events": "^2.0.3",
"rxjs": "^7.4.0",
@@ -13977,9 +14291,9 @@
}
},
"node_modules/ngx-toastr": {
- "version": "16.0.2",
- "resolved": "https://registry.npmjs.org/ngx-toastr/-/ngx-toastr-16.0.2.tgz",
- "integrity": "sha512-J6SueNCaGwm/gpXdsG56UzMEAcuayYWEW6NmIrNoe5iP7lOUohg4xYXWipkbMH9wGWmLPD9gU8AufUVWMplCvg==",
+ "version": "16.1.1",
+ "resolved": "https://registry.npmjs.org/ngx-toastr/-/ngx-toastr-16.1.1.tgz",
+ "integrity": "sha512-obUGE5RYC/62/AYiZvZcVw/mMBSI0KGJH7VhdiQQ2jsysp05m8nndI1shGhm6X1t/6/z/qj7NFpvSuUyhdweNg==",
"dependencies": {
"tslib": "^2.3.0"
},
@@ -14130,9 +14444,9 @@
}
},
"node_modules/node-gyp/node_modules/semver": {
- "version": "7.3.8",
- "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz",
- "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==",
+ "version": "7.4.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz",
+ "integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==",
"dev": true,
"dependencies": {
"lru-cache": "^6.0.0"
@@ -14204,9 +14518,9 @@
}
},
"node_modules/normalize-package-data/node_modules/semver": {
- "version": "7.3.8",
- "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz",
- "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==",
+ "version": "7.4.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz",
+ "integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==",
"dev": true,
"dependencies": {
"lru-cache": "^6.0.0"
@@ -14254,9 +14568,9 @@
}
},
"node_modules/npm-install-checks": {
- "version": "6.0.0",
- "resolved": "https://registry.npmjs.org/npm-install-checks/-/npm-install-checks-6.0.0.tgz",
- "integrity": "sha512-SBU9oFglRVZnfElwAtF14NivyulDqF1VKqqwNsFW9HDcbHMAPHpRSsVFgKuwFGq/hVvWZExz62Th0kvxn/XE7Q==",
+ "version": "6.1.1",
+ "resolved": "https://registry.npmjs.org/npm-install-checks/-/npm-install-checks-6.1.1.tgz",
+ "integrity": "sha512-dH3GmQL4vsPtld59cOn8uY0iOqRmqKvV+DLGwNXV/Q7MDgD2QfOADWd/mFXcIE5LVhYYGjA3baz6W9JneqnuCw==",
"dev": true,
"dependencies": {
"semver": "^7.1.1"
@@ -14278,9 +14592,9 @@
}
},
"node_modules/npm-install-checks/node_modules/semver": {
- "version": "7.3.8",
- "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz",
- "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==",
+ "version": "7.4.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz",
+ "integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==",
"dev": true,
"dependencies": {
"lru-cache": "^6.0.0"
@@ -14335,9 +14649,9 @@
}
},
"node_modules/npm-package-arg/node_modules/semver": {
- "version": "7.3.8",
- "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz",
- "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==",
+ "version": "7.4.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz",
+ "integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==",
"dev": true,
"dependencies": {
"lru-cache": "^6.0.0"
@@ -14395,9 +14709,9 @@
}
},
"node_modules/npm-pick-manifest/node_modules/semver": {
- "version": "7.3.8",
- "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz",
- "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==",
+ "version": "7.4.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz",
+ "integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==",
"dev": true,
"dependencies": {
"lru-cache": "^6.0.0"
@@ -14416,9 +14730,9 @@
"dev": true
},
"node_modules/npm-registry-fetch": {
- "version": "14.0.3",
- "resolved": "https://registry.npmjs.org/npm-registry-fetch/-/npm-registry-fetch-14.0.3.tgz",
- "integrity": "sha512-YaeRbVNpnWvsGOjX2wk5s85XJ7l1qQBGAp724h8e2CZFFhMSuw9enom7K1mWVUtvXO1uUSFIAPofQK0pPN0ZcA==",
+ "version": "14.0.4",
+ "resolved": "https://registry.npmjs.org/npm-registry-fetch/-/npm-registry-fetch-14.0.4.tgz",
+ "integrity": "sha512-pMS2DRkwg+M44ct65zrN/Cr9IHK1+n6weuefAo6Er4lc+/8YBCU0Czq04H3ZiSigluh7pb2rMM5JpgcytctB+Q==",
"dev": true,
"dependencies": {
"make-fetch-happen": "^11.0.0",
@@ -14434,29 +14748,28 @@
}
},
"node_modules/npm-registry-fetch/node_modules/lru-cache": {
- "version": "7.14.1",
- "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.14.1.tgz",
- "integrity": "sha512-ysxwsnTKdAx96aTRdhDOCQfDgbHnt8SK0KY8SEjO0wHinhWOFTESbjVCMPbU1uGXg/ch4lifqx0wfjOawU2+WA==",
+ "version": "7.18.3",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz",
+ "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==",
"dev": true,
"engines": {
"node": ">=12"
}
},
"node_modules/npm-registry-fetch/node_modules/make-fetch-happen": {
- "version": "11.0.2",
- "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-11.0.2.tgz",
- "integrity": "sha512-5n/Pq41w/uZghpdlXAY5kIM85RgJThtTH/NYBRAZ9VUOBWV90USaQjwGrw76fZP3Lj5hl/VZjpVvOaRBMoL/2w==",
+ "version": "11.1.0",
+ "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-11.1.0.tgz",
+ "integrity": "sha512-7ChuOzCb1LzdQZrTy0ky6RsCoMYeM+Fh4cY0+4zsJVhNcH5Q3OJojLY1mGkD0xAhWB29lskECVb6ZopofwjldA==",
"dev": true,
"dependencies": {
"agentkeepalive": "^4.2.1",
"cacache": "^17.0.0",
- "http-cache-semantics": "^4.1.0",
+ "http-cache-semantics": "^4.1.1",
"http-proxy-agent": "^5.0.0",
"https-proxy-agent": "^5.0.0",
"is-lambda": "^1.0.1",
"lru-cache": "^7.7.1",
"minipass": "^4.0.0",
- "minipass-collect": "^1.0.2",
"minipass-fetch": "^3.0.0",
"minipass-flush": "^1.0.5",
"minipass-pipeline": "^1.2.4",
@@ -14470,9 +14783,9 @@
}
},
"node_modules/npm-registry-fetch/node_modules/minipass-fetch": {
- "version": "3.0.1",
- "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-3.0.1.tgz",
- "integrity": "sha512-t9/wowtf7DYkwz8cfMSt0rMwiyNIBXf5CKZ3S5ZMqRqMYT0oLTp0x1WorMI9WTwvaPg21r1JbFxJMum8JrLGfw==",
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-3.0.2.tgz",
+ "integrity": "sha512-/ZpF1CQaWYqjbhfFgKNt3azxztEpc/JUPuMkqOgrnMQqcU8CbE409AUdJYTIWryl3PP5CBaTJZT71N49MXP/YA==",
"dev": true,
"dependencies": {
"minipass": "^4.0.0",
@@ -14513,14 +14826,6 @@
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
}
},
- "node_modules/nth-check": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-1.0.2.tgz",
- "integrity": "sha512-WeBOdju8SnzPN5vTUJYxYUxLeXpCaVP5i5e0LF8fg7WORF2Wd7wFX/pk0tYZk7s8T+J7VLy0Da6J1+wCT0AtHg==",
- "dependencies": {
- "boolbase": "~1.0.0"
- }
- },
"node_modules/nwsapi": {
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.2.tgz",
@@ -14630,9 +14935,9 @@
}
},
"node_modules/open": {
- "version": "8.4.0",
- "resolved": "https://registry.npmjs.org/open/-/open-8.4.0.tgz",
- "integrity": "sha512-XgFPPM+B28FtCCgSb9I+s9szOC1vZRSwgWsRUA5ylIxRTgKozqjOCrVOqGsYABPYK5qnfqClxZTFBa8PKt2v6Q==",
+ "version": "8.4.1",
+ "resolved": "https://registry.npmjs.org/open/-/open-8.4.1.tgz",
+ "integrity": "sha512-/4b7qZNhv6Uhd7jjnREh1NjnPxlTq+XNWPG88Ydkj5AILcA5m3ajvcg57pB24EQjKv0dK62XnDqk9c/hkIG5Kg==",
"dev": true,
"dependencies": {
"define-lazy-prop": "^2.0.0",
@@ -14650,6 +14955,7 @@
"version": "1.5.2",
"resolved": "https://registry.npmjs.org/opener/-/opener-1.5.2.tgz",
"integrity": "sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A==",
+ "dev": true,
"bin": {
"opener": "bin/opener-bin.js"
}
@@ -14828,6 +15134,15 @@
"node": ">=8"
}
},
+ "node_modules/p-retry/node_modules/retry": {
+ "version": "0.13.1",
+ "resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz",
+ "integrity": "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==",
+ "dev": true,
+ "engines": {
+ "node": ">= 4"
+ }
+ },
"node_modules/p-try": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
@@ -14838,9 +15153,9 @@
}
},
"node_modules/pacote": {
- "version": "15.0.8",
- "resolved": "https://registry.npmjs.org/pacote/-/pacote-15.0.8.tgz",
- "integrity": "sha512-UlcumB/XS6xyyIMwg/WwMAyUmga+RivB5KgkRwA1hZNtrx+0Bt41KxHCvg1kr0pZ/ZeD8qjhW4fph6VaYRCbLw==",
+ "version": "15.1.0",
+ "resolved": "https://registry.npmjs.org/pacote/-/pacote-15.1.0.tgz",
+ "integrity": "sha512-FFcjtIl+BQNfeliSm7MZz5cpdohvUV1yjGnqgVM4UnVF7JslRY0ImXAygdaCDV0jjUADEWu4y5xsDV8brtrTLg==",
"dev": true,
"dependencies": {
"@npmcli/git": "^4.0.0",
@@ -14858,6 +15173,7 @@
"promise-retry": "^2.0.1",
"read-package-json": "^6.0.0",
"read-package-json-fast": "^3.0.0",
+ "sigstore": "^1.0.0",
"ssri": "^10.0.0",
"tar": "^6.1.11"
},
@@ -14917,7 +15233,7 @@
"version": "7.1.2",
"resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz",
"integrity": "sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==",
- "optional": true,
+ "devOptional": true,
"dependencies": {
"entities": "^4.4.0"
},
@@ -14926,21 +15242,19 @@
}
},
"node_modules/parse5-html-rewriting-stream": {
- "version": "6.0.1",
- "resolved": "https://registry.npmjs.org/parse5-html-rewriting-stream/-/parse5-html-rewriting-stream-6.0.1.tgz",
- "integrity": "sha512-vwLQzynJVEfUlURxgnf51yAJDQTtVpNyGD8tKi2Za7m+akukNHxCcUQMAa/mUGLhCeicFdpy7Tlvj8ZNKadprg==",
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/parse5-html-rewriting-stream/-/parse5-html-rewriting-stream-7.0.0.tgz",
+ "integrity": "sha512-mazCyGWkmCRWDI15Zp+UiCqMp/0dgEmkZRvhlsqqKYr4SsVm/TvnSpD9fCvqCA2zoWJcfRym846ejWBBHRiYEg==",
"dev": true,
"dependencies": {
- "parse5": "^6.0.1",
- "parse5-sax-parser": "^6.0.1"
+ "entities": "^4.3.0",
+ "parse5": "^7.0.0",
+ "parse5-sax-parser": "^7.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/inikulin/parse5?sponsor=1"
}
},
- "node_modules/parse5-html-rewriting-stream/node_modules/parse5": {
- "version": "6.0.1",
- "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz",
- "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==",
- "dev": true
- },
"node_modules/parse5-htmlparser2-tree-adapter": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-6.0.1.tgz",
@@ -14957,20 +15271,17 @@
"dev": true
},
"node_modules/parse5-sax-parser": {
- "version": "6.0.1",
- "resolved": "https://registry.npmjs.org/parse5-sax-parser/-/parse5-sax-parser-6.0.1.tgz",
- "integrity": "sha512-kXX+5S81lgESA0LsDuGjAlBybImAChYRMT+/uKCEXFBFOeEhS52qUCydGhU3qLRD8D9DVjaUo821WK7DM4iCeg==",
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/parse5-sax-parser/-/parse5-sax-parser-7.0.0.tgz",
+ "integrity": "sha512-5A+v2SNsq8T6/mG3ahcz8ZtQ0OUFTatxPbeidoMB7tkJSGDY3tdfl4MHovtLQHkEn5CGxijNWRQHhRQ6IRpXKg==",
"dev": true,
"dependencies": {
- "parse5": "^6.0.1"
+ "parse5": "^7.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/inikulin/parse5?sponsor=1"
}
},
- "node_modules/parse5-sax-parser/node_modules/parse5": {
- "version": "6.0.1",
- "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz",
- "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==",
- "dev": true
- },
"node_modules/parseurl": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
@@ -15013,6 +15324,40 @@
"integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
"dev": true
},
+ "node_modules/path-scurry": {
+ "version": "1.6.4",
+ "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.6.4.tgz",
+ "integrity": "sha512-Qp/9IHkdNiXJ3/Kon++At2nVpnhRiPq/aSvQN+H3U1WZbvNRK0RIQK/o4HMqPoXjpuGJUEWpHSs6Mnjxqh3TQg==",
+ "dev": true,
+ "dependencies": {
+ "lru-cache": "^9.0.0",
+ "minipass": "^5.0.0"
+ },
+ "engines": {
+ "node": ">=16 || 14 >=14.17"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
+ "node_modules/path-scurry/node_modules/lru-cache": {
+ "version": "9.0.2",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-9.0.2.tgz",
+ "integrity": "sha512-7zYMKApzQ9qQE13xQUzbXVY3p2C5lh+9V+bs8M9fRf1TF59id+8jkljRWtIPfBfNP4yQAol5cqh/e8clxatdXw==",
+ "dev": true,
+ "engines": {
+ "node": "14 || >=16.14"
+ }
+ },
+ "node_modules/path-scurry/node_modules/minipass": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz",
+ "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/path-to-regexp": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
@@ -15355,15 +15700,6 @@
"node": ">=10"
}
},
- "node_modules/promise-retry/node_modules/retry": {
- "version": "0.12.0",
- "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz",
- "integrity": "sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==",
- "dev": true,
- "engines": {
- "node": ">= 4"
- }
- },
"node_modules/prompts": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz",
@@ -15508,12 +15844,12 @@
"dev": true
},
"node_modules/read-package-json": {
- "version": "6.0.0",
- "resolved": "https://registry.npmjs.org/read-package-json/-/read-package-json-6.0.0.tgz",
- "integrity": "sha512-b/9jxWJ8EwogJPpv99ma+QwtqB7FSl3+V6UXS7Aaay8/5VwMY50oIFooY1UKXMWpfNCM6T/PoGqa5GD1g9xf9w==",
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/read-package-json/-/read-package-json-6.0.1.tgz",
+ "integrity": "sha512-AaHqXxfAVa+fNL07x8iAghfKOds/XXsu7zoouIVsbm7PEbQ3nMWXlvjcbrNLjElnUHWQtAo4QEa0RXuvD4XlpA==",
"dev": true,
"dependencies": {
- "glob": "^8.0.1",
+ "glob": "^9.3.0",
"json-parse-even-better-errors": "^3.0.0",
"normalize-package-data": "^5.0.0",
"npm-normalize-package-bin": "^3.0.0"
@@ -15544,6 +15880,24 @@
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
}
},
+ "node_modules/read-package-json/node_modules/glob": {
+ "version": "9.3.5",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-9.3.5.tgz",
+ "integrity": "sha512-e1LleDykUz2Iu+MTYdkSsuWX8lvAjAcs0Xef0lNIu0S2wOAzuTxCJtcd9S3cijlwYF18EsU3rzb8jPVobxDh9Q==",
+ "dev": true,
+ "dependencies": {
+ "fs.realpath": "^1.0.0",
+ "minimatch": "^8.0.2",
+ "minipass": "^4.2.4",
+ "path-scurry": "^1.6.1"
+ },
+ "engines": {
+ "node": ">=16 || 14 >=14.17"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
"node_modules/read-package-json/node_modules/json-parse-even-better-errors": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-3.0.0.tgz",
@@ -15553,10 +15907,26 @@
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
}
},
+ "node_modules/read-package-json/node_modules/minimatch": {
+ "version": "8.0.4",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-8.0.4.tgz",
+ "integrity": "sha512-W0Wvr9HyFXZRGIDgCicunpQ299OKXs9RgZfaukz4qAW/pJhcpUfupc9c+OObPOFueNy8VSrZgEmDtk6Kh4WzDA==",
+ "dev": true,
+ "dependencies": {
+ "brace-expansion": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=16 || 14 >=14.17"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
"node_modules/readable-stream": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
"integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
+ "dev": true,
"dependencies": {
"inherits": "^2.0.3",
"string_decoder": "^1.1.1",
@@ -15711,11 +16081,6 @@
"node": ">=0.10.0"
}
},
- "node_modules/requires": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/requires/-/requires-1.0.2.tgz",
- "integrity": "sha512-X0owrXW/+IVhkwoYHL9ZKQQBfq+5NiPVmw6ev7LhWFecMmx9uhbBzjbR/xxv9bRSsHorSrUpQm6WNQdUxnlGtg=="
- },
"node_modules/requires-port": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz",
@@ -15821,9 +16186,9 @@
}
},
"node_modules/retry": {
- "version": "0.13.1",
- "resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz",
- "integrity": "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==",
+ "version": "0.12.0",
+ "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz",
+ "integrity": "sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==",
"dev": true,
"engines": {
"node": ">= 4"
@@ -15945,6 +16310,7 @@
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
+ "dev": true,
"funding": [
{
"type": "github",
@@ -15967,9 +16333,9 @@
"devOptional": true
},
"node_modules/sass": {
- "version": "1.57.1",
- "resolved": "https://registry.npmjs.org/sass/-/sass-1.57.1.tgz",
- "integrity": "sha512-O2+LwLS79op7GI0xZ8fqzF7X2m/m8WFfI02dHOdsK5R2ECeS5F62zrwg/relM1rjSLy7Vd/DiMNIvPrQGsA0jw==",
+ "version": "1.58.1",
+ "resolved": "https://registry.npmjs.org/sass/-/sass-1.58.1.tgz",
+ "integrity": "sha512-bnINi6nPXbP1XNRaranMFEBZWUfdW/AF16Ql5+ypRxfTvCRTTKrLsMIakyDcayUt2t/RZotmL4kgJwNH5xO+bg==",
"dev": true,
"dependencies": {
"chokidar": ">=3.0.0 <4.0.0",
@@ -16329,10 +16695,80 @@
"integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
"dev": true
},
+ "node_modules/sigstore": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/sigstore/-/sigstore-1.2.0.tgz",
+ "integrity": "sha512-Fr9+W1nkBSIZCkJQR7jDn/zI0UXNsVpp+7mDQkCnZOIxG9p6yNXBx9xntHsfUyYHE55XDkkVV3+rYbrkzAeesA==",
+ "dev": true,
+ "dependencies": {
+ "@sigstore/protobuf-specs": "^0.1.0",
+ "make-fetch-happen": "^11.0.1",
+ "tuf-js": "^1.0.0"
+ },
+ "bin": {
+ "sigstore": "bin/sigstore.js"
+ },
+ "engines": {
+ "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+ }
+ },
+ "node_modules/sigstore/node_modules/lru-cache": {
+ "version": "7.18.3",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz",
+ "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==",
+ "dev": true,
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/sigstore/node_modules/make-fetch-happen": {
+ "version": "11.1.0",
+ "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-11.1.0.tgz",
+ "integrity": "sha512-7ChuOzCb1LzdQZrTy0ky6RsCoMYeM+Fh4cY0+4zsJVhNcH5Q3OJojLY1mGkD0xAhWB29lskECVb6ZopofwjldA==",
+ "dev": true,
+ "dependencies": {
+ "agentkeepalive": "^4.2.1",
+ "cacache": "^17.0.0",
+ "http-cache-semantics": "^4.1.1",
+ "http-proxy-agent": "^5.0.0",
+ "https-proxy-agent": "^5.0.0",
+ "is-lambda": "^1.0.1",
+ "lru-cache": "^7.7.1",
+ "minipass": "^4.0.0",
+ "minipass-fetch": "^3.0.0",
+ "minipass-flush": "^1.0.5",
+ "minipass-pipeline": "^1.2.4",
+ "negotiator": "^0.6.3",
+ "promise-retry": "^2.0.1",
+ "socks-proxy-agent": "^7.0.0",
+ "ssri": "^10.0.0"
+ },
+ "engines": {
+ "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+ }
+ },
+ "node_modules/sigstore/node_modules/minipass-fetch": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-3.0.2.tgz",
+ "integrity": "sha512-/ZpF1CQaWYqjbhfFgKNt3azxztEpc/JUPuMkqOgrnMQqcU8CbE409AUdJYTIWryl3PP5CBaTJZT71N49MXP/YA==",
+ "dev": true,
+ "dependencies": {
+ "minipass": "^4.0.0",
+ "minipass-sized": "^1.0.3",
+ "minizlib": "^2.1.2"
+ },
+ "engines": {
+ "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+ },
+ "optionalDependencies": {
+ "encoding": "^0.1.13"
+ }
+ },
"node_modules/sirv": {
"version": "1.0.19",
"resolved": "https://registry.npmjs.org/sirv/-/sirv-1.0.19.tgz",
"integrity": "sha512-JuLThK3TnZG1TAKDwNIqNq6QA2afLOCcm+iE8D1Kj3GA40pSPsxQjjJl0J8X3tsR7T+CP1GavpzLwYkgVLWrZQ==",
+ "dev": true,
"dependencies": {
"@polka/url": "^1.0.0-next.20",
"mrmime": "^1.0.0",
@@ -16480,9 +16916,9 @@
}
},
"node_modules/spdx-correct": {
- "version": "3.1.1",
- "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz",
- "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==",
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz",
+ "integrity": "sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==",
"dev": true,
"dependencies": {
"spdx-expression-parse": "^3.0.0",
@@ -16506,9 +16942,9 @@
}
},
"node_modules/spdx-license-ids": {
- "version": "3.0.12",
- "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.12.tgz",
- "integrity": "sha512-rr+VVSXtRhO4OHbXUiAF7xW3Bo9DuuF6C5jH+q/x15j2jniycgKbxU09Hr0WqlSLUs4i4ltHGXqTe7VHclYWyA==",
+ "version": "3.0.13",
+ "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.13.tgz",
+ "integrity": "sha512-XkD+zwiqXHikFZm4AX/7JSCXA98U5Db4AFd5XUg/+9UNtnH75+Z9KxtpYiJZx36mUDVOwH83pl7yvCer6ewM3w==",
"dev": true
},
"node_modules/spdy": {
@@ -16610,6 +17046,7 @@
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
+ "dev": true,
"dependencies": {
"safe-buffer": "~5.2.0"
}
@@ -16832,14 +17269,6 @@
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
"dev": true
},
- "node_modules/termcolor": {
- "version": "0.2.0",
- "resolved": "https://registry.npmjs.org/termcolor/-/termcolor-0.2.0.tgz",
- "integrity": "sha512-BJ/FFGl0cQAyYYmUurkqQUJA9RyD2PFt9YNd24nlt7HkeuZqUmHL86ELvaY6JY/TLUvmxzJY9/fHHk3jFibUSg==",
- "engines": {
- "node": "*"
- }
- },
"node_modules/terminal-link": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/terminal-link/-/terminal-link-2.1.1.tgz",
@@ -16857,9 +17286,9 @@
}
},
"node_modules/terser": {
- "version": "5.16.1",
- "resolved": "https://registry.npmjs.org/terser/-/terser-5.16.1.tgz",
- "integrity": "sha512-xvQfyfA1ayT0qdK47zskQgRZeWLoOQ8JQ6mIgRGVNwZKdQMU+5FkCBjmv4QjcrTzyZquRw2FVtlJSRUmMKQslw==",
+ "version": "5.16.3",
+ "resolved": "https://registry.npmjs.org/terser/-/terser-5.16.3.tgz",
+ "integrity": "sha512-v8wWLaS/xt3nE9dgKEWhNUFP6q4kngO5B8eYFUuebsu7Dw/UNAnpUod6UHo04jSSkv8TzKHjZDSd7EXdDQAl8Q==",
"dev": true,
"dependencies": {
"@jridgewell/source-map": "^0.3.2",
@@ -17093,6 +17522,7 @@
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/totalist/-/totalist-1.1.0.tgz",
"integrity": "sha512-gduQwd1rOdDMGxFG1gEvhV88Oirdo2p+KjoYFU7k2g+i7n6AFFbDQ5kMPUsW0pNbfQsB/cwXvT1i4Bue0s9g5g==",
+ "dev": true,
"engines": {
"node": ">=6"
}
@@ -17243,41 +17673,106 @@
"@types/node": "*",
"typescript": ">=2.7"
},
- "peerDependenciesMeta": {
- "@swc/core": {
- "optional": true
- },
- "@swc/wasm": {
- "optional": true
- }
+ "peerDependenciesMeta": {
+ "@swc/core": {
+ "optional": true
+ },
+ "@swc/wasm": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/tslib": {
+ "version": "2.5.0",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz",
+ "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg=="
+ },
+ "node_modules/tsutils": {
+ "version": "3.21.0",
+ "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz",
+ "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==",
+ "dev": true,
+ "dependencies": {
+ "tslib": "^1.8.1"
+ },
+ "engines": {
+ "node": ">= 6"
+ },
+ "peerDependencies": {
+ "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta"
+ }
+ },
+ "node_modules/tsutils/node_modules/tslib": {
+ "version": "1.14.1",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
+ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==",
+ "dev": true
+ },
+ "node_modules/tuf-js": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/tuf-js/-/tuf-js-1.1.3.tgz",
+ "integrity": "sha512-jGYi5nG/kqgfTFQSdoN6PW9eIn+XRZqdXku+fSwNk6UpWIsWaV7pzAqPgFr85edOPhoyJDyBqCS+DCnHroMvrw==",
+ "dev": true,
+ "dependencies": {
+ "@tufjs/models": "1.0.2",
+ "make-fetch-happen": "^11.0.1"
+ },
+ "engines": {
+ "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+ }
+ },
+ "node_modules/tuf-js/node_modules/lru-cache": {
+ "version": "7.18.3",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz",
+ "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==",
+ "dev": true,
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/tuf-js/node_modules/make-fetch-happen": {
+ "version": "11.1.0",
+ "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-11.1.0.tgz",
+ "integrity": "sha512-7ChuOzCb1LzdQZrTy0ky6RsCoMYeM+Fh4cY0+4zsJVhNcH5Q3OJojLY1mGkD0xAhWB29lskECVb6ZopofwjldA==",
+ "dev": true,
+ "dependencies": {
+ "agentkeepalive": "^4.2.1",
+ "cacache": "^17.0.0",
+ "http-cache-semantics": "^4.1.1",
+ "http-proxy-agent": "^5.0.0",
+ "https-proxy-agent": "^5.0.0",
+ "is-lambda": "^1.0.1",
+ "lru-cache": "^7.7.1",
+ "minipass": "^4.0.0",
+ "minipass-fetch": "^3.0.0",
+ "minipass-flush": "^1.0.5",
+ "minipass-pipeline": "^1.2.4",
+ "negotiator": "^0.6.3",
+ "promise-retry": "^2.0.1",
+ "socks-proxy-agent": "^7.0.0",
+ "ssri": "^10.0.0"
+ },
+ "engines": {
+ "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
}
},
- "node_modules/tslib": {
- "version": "2.5.0",
- "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz",
- "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg=="
- },
- "node_modules/tsutils": {
- "version": "3.21.0",
- "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz",
- "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==",
+ "node_modules/tuf-js/node_modules/minipass-fetch": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-3.0.2.tgz",
+ "integrity": "sha512-/ZpF1CQaWYqjbhfFgKNt3azxztEpc/JUPuMkqOgrnMQqcU8CbE409AUdJYTIWryl3PP5CBaTJZT71N49MXP/YA==",
"dev": true,
"dependencies": {
- "tslib": "^1.8.1"
+ "minipass": "^4.0.0",
+ "minipass-sized": "^1.0.3",
+ "minizlib": "^2.1.2"
},
"engines": {
- "node": ">= 6"
+ "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
},
- "peerDependencies": {
- "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta"
+ "optionalDependencies": {
+ "encoding": "^0.1.13"
}
},
- "node_modules/tsutils/node_modules/tslib": {
- "version": "1.14.1",
- "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
- "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==",
- "dev": true
- },
"node_modules/type-check": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
@@ -17351,14 +17846,6 @@
"node": ">=4.2.0"
}
},
- "node_modules/u2r": {
- "version": "0.1.3",
- "resolved": "https://registry.npmjs.org/u2r/-/u2r-0.1.3.tgz",
- "integrity": "sha512-OqMjkw3si8wJyuK6RzBQCuJjbDmCm7LEBoQEMrZg1hUtwXBhZxZzEnxUF/Mky3zesSPfwRud5xbvoH7lzoiS3Q==",
- "engines": {
- "node": "*"
- }
- },
"node_modules/unicode-canonical-property-names-ecmascript": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz",
@@ -17486,7 +17973,8 @@
"node_modules/util-deprecate": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
- "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
+ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",
+ "dev": true
},
"node_modules/utils-merge": {
"version": "1.0.1",
@@ -17625,9 +18113,9 @@
"integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="
},
"node_modules/webpack": {
- "version": "5.75.0",
- "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.75.0.tgz",
- "integrity": "sha512-piaIaoVJlqMsPtX/+3KTTO6jfvrSYgauFVdt8cr9LTHKmcq/AMd4mhzsiP7ZF/PGRNPGA8336jldh9l2Kt2ogQ==",
+ "version": "5.76.1",
+ "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.76.1.tgz",
+ "integrity": "sha512-4+YIK4Abzv8172/SGqObnUjaIHjLEuUasz9EwQj/9xmPPkYJy2Mh03Q/lJfSD3YLzbxy5FeTq5Uw0323Oh6SJQ==",
"dev": true,
"dependencies": {
"@types/eslint-scope": "^3.7.3",
@@ -17672,10 +18160,12 @@
}
},
"node_modules/webpack-bundle-analyzer": {
- "version": "4.7.0",
- "resolved": "https://registry.npmjs.org/webpack-bundle-analyzer/-/webpack-bundle-analyzer-4.7.0.tgz",
- "integrity": "sha512-j9b8ynpJS4K+zfO5GGwsAcQX4ZHpWV+yRiHDiL+bE0XHJ8NiPYLTNVQdlFYWxtpg9lfAQNlwJg16J9AJtFSXRg==",
+ "version": "4.8.0",
+ "resolved": "https://registry.npmjs.org/webpack-bundle-analyzer/-/webpack-bundle-analyzer-4.8.0.tgz",
+ "integrity": "sha512-ZzoSBePshOKhr+hd8u6oCkZVwpVaXgpw23ScGLFpR6SjYI7+7iIWYarjN6OEYOfRt8o7ZyZZQk0DuMizJ+LEIg==",
+ "dev": true,
"dependencies": {
+ "@discoveryjs/json-ext": "0.5.7",
"acorn": "^8.0.4",
"acorn-walk": "^8.0.0",
"chalk": "^4.1.0",
@@ -17697,6 +18187,7 @@
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
+ "dev": true,
"dependencies": {
"color-convert": "^2.0.1"
},
@@ -17711,6 +18202,7 @@
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
+ "dev": true,
"dependencies": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
@@ -17726,6 +18218,7 @@
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dev": true,
"dependencies": {
"color-name": "~1.1.4"
},
@@ -17736,12 +18229,14 @@
"node_modules/webpack-bundle-analyzer/node_modules/color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
- "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "dev": true
},
"node_modules/webpack-bundle-analyzer/node_modules/has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "dev": true,
"engines": {
"node": ">=8"
}
@@ -17750,6 +18245,7 @@
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
+ "dev": true,
"dependencies": {
"has-flag": "^4.0.0"
},
@@ -17859,9 +18355,9 @@
}
},
"node_modules/webpack-dev-server/node_modules/ws": {
- "version": "8.12.0",
- "resolved": "https://registry.npmjs.org/ws/-/ws-8.12.0.tgz",
- "integrity": "sha512-kU62emKIdKVeEIOIKVegvqpXMSTAMLJozpHZaJNDYqBjzlSYXQGviYwN1osDLJ9av68qHd4a2oSjd7yD4pacig==",
+ "version": "8.13.0",
+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz",
+ "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==",
"dev": true,
"engines": {
"node": ">=10.0.0"
@@ -18281,11 +18777,6 @@
}
},
"dependencies": {
- "requires": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/requires/-/requires-1.0.2.tgz",
- "integrity": "sha512-X0owrXW/+IVhkwoYHL9ZKQQBfq+5NiPVmw6ev7LhWFecMmx9uhbBzjbR/xxv9bRSsHorSrUpQm6WNQdUxnlGtg=="
- },
"@ampproject/remapping": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz",
@@ -18296,12 +18787,12 @@
}
},
"@angular-devkit/architect": {
- "version": "0.1501.3",
- "resolved": "https://registry.npmjs.org/@angular-devkit/architect/-/architect-0.1501.3.tgz",
- "integrity": "sha512-+hvesYUgChdAkBcWSO2pseIGBzRDAATyIw36UBwOmYkL7wM65TEXpspbo5ZIfU1M/l7X/lHzDXLTzCMfb0Qxbg==",
+ "version": "0.1502.6",
+ "resolved": "https://registry.npmjs.org/@angular-devkit/architect/-/architect-0.1502.6.tgz",
+ "integrity": "sha512-n4oJ9vzFWwabf+AfgqqevVzdJhNKNCav7ytefjD/Y01vkNwlXqWnHcvyyHCLkVibJ6WR8J9lK4t77j/HFlDvWQ==",
"dev": true,
"requires": {
- "@angular-devkit/core": "15.1.3",
+ "@angular-devkit/core": "15.2.6",
"rxjs": "6.6.7"
},
"dependencies": {
@@ -18323,39 +18814,40 @@
}
},
"@angular-devkit/build-angular": {
- "version": "15.1.3",
- "resolved": "https://registry.npmjs.org/@angular-devkit/build-angular/-/build-angular-15.1.3.tgz",
- "integrity": "sha512-QQfvpccShQldpMmuwgpZfbE6cNiNwff2aAY1YGswU9DBpeoz4YWeW4e8ss2j/Mxn5RXo7cbzWkhbm1xXTFY1FA==",
+ "version": "15.2.6",
+ "resolved": "https://registry.npmjs.org/@angular-devkit/build-angular/-/build-angular-15.2.6.tgz",
+ "integrity": "sha512-OmMcdXXUrAdZNxwxDE8SUx1FMcq9FyMnrSv1PmP9sHPBoxAdBVc/qNdGA9V7C5yHvWHGgzsx7ZK5TDuvifzS5g==",
"dev": true,
"requires": {
"@ampproject/remapping": "2.2.0",
- "@angular-devkit/architect": "0.1501.3",
- "@angular-devkit/build-webpack": "0.1501.3",
- "@angular-devkit/core": "15.1.3",
+ "@angular-devkit/architect": "0.1502.6",
+ "@angular-devkit/build-webpack": "0.1502.6",
+ "@angular-devkit/core": "15.2.6",
"@babel/core": "7.20.12",
- "@babel/generator": "7.20.7",
+ "@babel/generator": "7.20.14",
"@babel/helper-annotate-as-pure": "7.18.6",
+ "@babel/helper-split-export-declaration": "7.18.6",
"@babel/plugin-proposal-async-generator-functions": "7.20.7",
"@babel/plugin-transform-async-to-generator": "7.20.7",
"@babel/plugin-transform-runtime": "7.19.6",
"@babel/preset-env": "7.20.2",
- "@babel/runtime": "7.20.7",
+ "@babel/runtime": "7.20.13",
"@babel/template": "7.20.7",
"@discoveryjs/json-ext": "0.5.7",
- "@ngtools/webpack": "15.1.3",
+ "@ngtools/webpack": "15.2.6",
"ansi-colors": "4.1.3",
"autoprefixer": "10.4.13",
"babel-loader": "9.1.2",
"babel-plugin-istanbul": "6.1.1",
- "browserslist": "4.21.4",
+ "browserslist": "4.21.5",
"cacache": "17.0.4",
"chokidar": "3.5.3",
"copy-webpack-plugin": "11.0.0",
"critters": "0.0.16",
"css-loader": "6.7.3",
- "esbuild": "0.16.17",
- "esbuild-wasm": "0.16.17",
- "glob": "8.0.3",
+ "esbuild": "0.17.8",
+ "esbuild-wasm": "0.17.8",
+ "glob": "8.1.0",
"https-proxy-agent": "5.0.1",
"inquirer": "8.2.4",
"jsonc-parser": "3.2.0",
@@ -18364,26 +18856,26 @@
"less-loader": "11.1.0",
"license-webpack-plugin": "4.0.2",
"loader-utils": "3.2.1",
- "magic-string": "0.27.0",
+ "magic-string": "0.29.0",
"mini-css-extract-plugin": "2.7.2",
- "open": "8.4.0",
+ "open": "8.4.1",
"ora": "5.4.1",
- "parse5-html-rewriting-stream": "6.0.1",
+ "parse5-html-rewriting-stream": "7.0.0",
"piscina": "3.2.0",
"postcss": "8.4.21",
"postcss-loader": "7.0.2",
"resolve-url-loader": "5.0.0",
"rxjs": "6.6.7",
- "sass": "1.57.1",
+ "sass": "1.58.1",
"sass-loader": "13.2.0",
"semver": "7.3.8",
"source-map-loader": "4.0.1",
"source-map-support": "0.5.21",
- "terser": "5.16.1",
+ "terser": "5.16.3",
"text-table": "0.2.0",
"tree-kill": "1.2.2",
- "tslib": "2.4.1",
- "webpack": "5.75.0",
+ "tslib": "2.5.0",
+ "webpack": "5.76.1",
"webpack-dev-middleware": "6.0.1",
"webpack-dev-server": "4.11.1",
"webpack-merge": "5.8.0",
@@ -18421,84 +18913,6 @@
}
}
},
- "@babel/generator": {
- "version": "7.20.7",
- "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.20.7.tgz",
- "integrity": "sha512-7wqMOJq8doJMZmP4ApXTzLxSr7+oO2jroJURrVEp6XShrQUObV8Tq/D0NCcoYg2uHqUrjzO0zwBjoYzelxK+sw==",
- "dev": true,
- "requires": {
- "@babel/types": "^7.20.7",
- "@jridgewell/gen-mapping": "^0.3.2",
- "jsesc": "^2.5.1"
- }
- },
- "@jridgewell/gen-mapping": {
- "version": "0.3.2",
- "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz",
- "integrity": "sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A==",
- "dev": true,
- "requires": {
- "@jridgewell/set-array": "^1.0.1",
- "@jridgewell/sourcemap-codec": "^1.4.10",
- "@jridgewell/trace-mapping": "^0.3.9"
- }
- },
- "browserslist": {
- "version": "4.21.4",
- "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.4.tgz",
- "integrity": "sha512-CBHJJdDmgjl3daYjN5Cp5kbTf1mUhZoS+beLklHIvkOWscs83YAhLlF3Wsh/lciQYAcbBJgTOD44VtG31ZM4Hw==",
- "dev": true,
- "requires": {
- "caniuse-lite": "^1.0.30001400",
- "electron-to-chromium": "^1.4.251",
- "node-releases": "^2.0.6",
- "update-browserslist-db": "^1.0.9"
- }
- },
- "esbuild": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.16.17.tgz",
- "integrity": "sha512-G8LEkV0XzDMNwXKgM0Jwu3nY3lSTwSGY6XbxM9cr9+s0T/qSV1q1JVPBGzm3dcjhCic9+emZDmMffkwgPeOeLg==",
- "dev": true,
- "optional": true,
- "requires": {
- "@esbuild/android-arm": "0.16.17",
- "@esbuild/android-arm64": "0.16.17",
- "@esbuild/android-x64": "0.16.17",
- "@esbuild/darwin-arm64": "0.16.17",
- "@esbuild/darwin-x64": "0.16.17",
- "@esbuild/freebsd-arm64": "0.16.17",
- "@esbuild/freebsd-x64": "0.16.17",
- "@esbuild/linux-arm": "0.16.17",
- "@esbuild/linux-arm64": "0.16.17",
- "@esbuild/linux-ia32": "0.16.17",
- "@esbuild/linux-loong64": "0.16.17",
- "@esbuild/linux-mips64el": "0.16.17",
- "@esbuild/linux-ppc64": "0.16.17",
- "@esbuild/linux-riscv64": "0.16.17",
- "@esbuild/linux-s390x": "0.16.17",
- "@esbuild/linux-x64": "0.16.17",
- "@esbuild/netbsd-x64": "0.16.17",
- "@esbuild/openbsd-x64": "0.16.17",
- "@esbuild/sunos-x64": "0.16.17",
- "@esbuild/win32-arm64": "0.16.17",
- "@esbuild/win32-ia32": "0.16.17",
- "@esbuild/win32-x64": "0.16.17"
- }
- },
- "glob": {
- "version": "8.0.3",
- "resolved": "https://registry.npmjs.org/glob/-/glob-8.0.3.tgz",
- "integrity": "sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ==",
- "dev": true,
- "requires": {
- "fs.realpath": "^1.0.0",
- "inflight": "^1.0.4",
- "inherits": "2",
- "minimatch": "^5.0.1",
- "once": "^1.3.0"
- }
- },
"lru-cache": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
@@ -18508,6 +18922,15 @@
"yallist": "^4.0.0"
}
},
+ "magic-string": {
+ "version": "0.29.0",
+ "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.29.0.tgz",
+ "integrity": "sha512-WcfidHrDjMY+eLjlU+8OvwREqHwpgCeKVBUpQ3OhYYuvfaYCUgcbuBzappNzZvg/v8onU3oQj+BYpkOJe9Iw4Q==",
+ "dev": true,
+ "requires": {
+ "@jridgewell/sourcemap-codec": "^1.4.13"
+ }
+ },
"rxjs": {
"version": "6.6.7",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz",
@@ -18534,12 +18957,6 @@
"lru-cache": "^6.0.0"
}
},
- "tslib": {
- "version": "2.4.1",
- "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz",
- "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==",
- "dev": true
- },
"yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
@@ -18549,12 +18966,12 @@
}
},
"@angular-devkit/build-webpack": {
- "version": "0.1501.3",
- "resolved": "https://registry.npmjs.org/@angular-devkit/build-webpack/-/build-webpack-0.1501.3.tgz",
- "integrity": "sha512-ZsgbTFf1I9hAf4FvNxBJphF95Hw9QchCaWQdQXY+2mqQuPP70uK1Kd/TzNCfx5lyNFHMI9oWpCg2QLrAdwqJnA==",
+ "version": "0.1502.6",
+ "resolved": "https://registry.npmjs.org/@angular-devkit/build-webpack/-/build-webpack-0.1502.6.tgz",
+ "integrity": "sha512-X7XQ11QDz2Bs5qpJ3a5glIytvI+S74ORQxdzvT6a6KB8ayW0SgZEhTwD+GF7pa5My8draIaXBGzzQR1qmpWK5Q==",
"dev": true,
"requires": {
- "@angular-devkit/architect": "0.1501.3",
+ "@angular-devkit/architect": "0.1502.6",
"rxjs": "6.6.7"
},
"dependencies": {
@@ -18576,9 +18993,9 @@
}
},
"@angular-devkit/core": {
- "version": "15.1.3",
- "resolved": "https://registry.npmjs.org/@angular-devkit/core/-/core-15.1.3.tgz",
- "integrity": "sha512-biuS+DceyZEqcE/cLvndtslqn3Q6uCmJ0RLpACikH6ESYorvk+A91H0ofuGue6HB/2CUN/F+mPSr7sWVI1W9sA==",
+ "version": "15.2.6",
+ "resolved": "https://registry.npmjs.org/@angular-devkit/core/-/core-15.2.6.tgz",
+ "integrity": "sha512-YVTWZ+M+xNKdFX4EnY9QX49PZraawiaA0iTd2CUW8ZoTUvU7yOGMKZLSdz6aokTMRVfm0449wt6YL994ibOo1g==",
"dev": true,
"requires": {
"ajv": "8.12.0",
@@ -18600,98 +19017,325 @@
"uri-js": "^4.2.2"
}
},
- "rxjs": {
- "version": "6.6.7",
- "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz",
- "integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==",
+ "rxjs": {
+ "version": "6.6.7",
+ "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz",
+ "integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==",
+ "dev": true,
+ "requires": {
+ "tslib": "^1.9.0"
+ }
+ },
+ "tslib": {
+ "version": "1.14.1",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
+ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==",
+ "dev": true
+ }
+ }
+ },
+ "@angular-devkit/schematics": {
+ "version": "15.2.6",
+ "resolved": "https://registry.npmjs.org/@angular-devkit/schematics/-/schematics-15.2.6.tgz",
+ "integrity": "sha512-f7VgnAcok7AwR/DhX0ZWskB0rFBo/KsvtIUA2qZSrpKMf8eFiwu03dv/b2mI0vnf+1FBfIQzJvO0ww45zRp6dA==",
+ "dev": true,
+ "requires": {
+ "@angular-devkit/core": "15.2.6",
+ "jsonc-parser": "3.2.0",
+ "magic-string": "0.29.0",
+ "ora": "5.4.1",
+ "rxjs": "6.6.7"
+ },
+ "dependencies": {
+ "magic-string": {
+ "version": "0.29.0",
+ "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.29.0.tgz",
+ "integrity": "sha512-WcfidHrDjMY+eLjlU+8OvwREqHwpgCeKVBUpQ3OhYYuvfaYCUgcbuBzappNzZvg/v8onU3oQj+BYpkOJe9Iw4Q==",
+ "dev": true,
+ "requires": {
+ "@jridgewell/sourcemap-codec": "^1.4.13"
+ }
+ },
+ "rxjs": {
+ "version": "6.6.7",
+ "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz",
+ "integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==",
+ "dev": true,
+ "requires": {
+ "tslib": "^1.9.0"
+ }
+ },
+ "tslib": {
+ "version": "1.14.1",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
+ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==",
+ "dev": true
+ }
+ }
+ },
+ "@angular-eslint/builder": {
+ "version": "15.2.1",
+ "resolved": "https://registry.npmjs.org/@angular-eslint/builder/-/builder-15.2.1.tgz",
+ "integrity": "sha512-7x2DANebLRl997Mj4DhZrnz5+vnSjavGGveJ0mBuU7CEsL0ZYLftdRqL0e0HtU3ksseS7xpchD6OM08nkNgySw==",
+ "dev": true,
+ "requires": {}
+ },
+ "@angular-eslint/bundled-angular-compiler": {
+ "version": "15.2.1",
+ "resolved": "https://registry.npmjs.org/@angular-eslint/bundled-angular-compiler/-/bundled-angular-compiler-15.2.1.tgz",
+ "integrity": "sha512-LO7Am8eVCr7oh6a0VmKSL7K03CnQEQhFO7Wt/YtbfYOxVjrbwmYLwJn+wZPOT7A02t/BttOD/WXuDrOWtSMQ/Q==",
+ "dev": true
+ },
+ "@angular-eslint/eslint-plugin": {
+ "version": "15.2.1",
+ "resolved": "https://registry.npmjs.org/@angular-eslint/eslint-plugin/-/eslint-plugin-15.2.1.tgz",
+ "integrity": "sha512-OM7b1kS4E4CkXjkaWN+lEzawh4VxY6l7FO1Cuk4s7iv3/YpZG3rJxIZBqnFLTixwrBuqw8y4FNBzF3eDgmFAUw==",
+ "dev": true,
+ "requires": {
+ "@angular-eslint/utils": "15.2.1",
+ "@typescript-eslint/utils": "5.48.2"
+ },
+ "dependencies": {
+ "@typescript-eslint/scope-manager": {
+ "version": "5.48.2",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.48.2.tgz",
+ "integrity": "sha512-zEUFfonQid5KRDKoI3O+uP1GnrFd4tIHlvs+sTJXiWuypUWMuDaottkJuR612wQfOkjYbsaskSIURV9xo4f+Fw==",
+ "dev": true,
+ "requires": {
+ "@typescript-eslint/types": "5.48.2",
+ "@typescript-eslint/visitor-keys": "5.48.2"
+ }
+ },
+ "@typescript-eslint/types": {
+ "version": "5.48.2",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.48.2.tgz",
+ "integrity": "sha512-hE7dA77xxu7ByBc6KCzikgfRyBCTst6dZQpwaTy25iMYOnbNljDT4hjhrGEJJ0QoMjrfqrx+j1l1B9/LtKeuqA==",
+ "dev": true
+ },
+ "@typescript-eslint/typescript-estree": {
+ "version": "5.48.2",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.48.2.tgz",
+ "integrity": "sha512-bibvD3z6ilnoVxUBFEgkO0k0aFvUc4Cttt0dAreEr+nrAHhWzkO83PEVVuieK3DqcgL6VAK5dkzK8XUVja5Zcg==",
+ "dev": true,
+ "requires": {
+ "@typescript-eslint/types": "5.48.2",
+ "@typescript-eslint/visitor-keys": "5.48.2",
+ "debug": "^4.3.4",
+ "globby": "^11.1.0",
+ "is-glob": "^4.0.3",
+ "semver": "^7.3.7",
+ "tsutils": "^3.21.0"
+ }
+ },
+ "@typescript-eslint/utils": {
+ "version": "5.48.2",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.48.2.tgz",
+ "integrity": "sha512-2h18c0d7jgkw6tdKTlNaM7wyopbLRBiit8oAxoP89YnuBOzCZ8g8aBCaCqq7h208qUTroL7Whgzam7UY3HVLow==",
+ "dev": true,
+ "requires": {
+ "@types/json-schema": "^7.0.9",
+ "@types/semver": "^7.3.12",
+ "@typescript-eslint/scope-manager": "5.48.2",
+ "@typescript-eslint/types": "5.48.2",
+ "@typescript-eslint/typescript-estree": "5.48.2",
+ "eslint-scope": "^5.1.1",
+ "eslint-utils": "^3.0.0",
+ "semver": "^7.3.7"
+ }
+ },
+ "@typescript-eslint/visitor-keys": {
+ "version": "5.48.2",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.48.2.tgz",
+ "integrity": "sha512-z9njZLSkwmjFWUelGEwEbdf4NwKvfHxvGC0OcGN1Hp/XNDIcJ7D5DpPNPv6x6/mFvc1tQHsaWmpD/a4gOvvCJQ==",
+ "dev": true,
+ "requires": {
+ "@typescript-eslint/types": "5.48.2",
+ "eslint-visitor-keys": "^3.3.0"
+ }
+ },
+ "globby": {
+ "version": "11.1.0",
+ "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz",
+ "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==",
+ "dev": true,
+ "requires": {
+ "array-union": "^2.1.0",
+ "dir-glob": "^3.0.1",
+ "fast-glob": "^3.2.9",
+ "ignore": "^5.2.0",
+ "merge2": "^1.4.1",
+ "slash": "^3.0.0"
+ }
+ },
+ "lru-cache": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
+ "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
+ "dev": true,
+ "requires": {
+ "yallist": "^4.0.0"
+ }
+ },
+ "semver": {
+ "version": "7.4.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz",
+ "integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==",
+ "dev": true,
+ "requires": {
+ "lru-cache": "^6.0.0"
+ }
+ },
+ "slash": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",
+ "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==",
+ "dev": true
+ },
+ "yallist": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
+ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
+ "dev": true
+ }
+ }
+ },
+ "@angular-eslint/eslint-plugin-template": {
+ "version": "15.2.1",
+ "resolved": "https://registry.npmjs.org/@angular-eslint/eslint-plugin-template/-/eslint-plugin-template-15.2.1.tgz",
+ "integrity": "sha512-IeiSLk6YxapFdH2z5o/O3R7VwtBd2T6fWmhLFPwDYMDknrwegnOjwswCdBplOccpUp0wqlCeGUx7LTsuzwaz7w==",
+ "dev": true,
+ "requires": {
+ "@angular-eslint/bundled-angular-compiler": "15.2.1",
+ "@angular-eslint/utils": "15.2.1",
+ "@typescript-eslint/type-utils": "5.48.2",
+ "@typescript-eslint/utils": "5.48.2",
+ "aria-query": "5.1.3",
+ "axobject-query": "3.1.1"
+ },
+ "dependencies": {
+ "@typescript-eslint/scope-manager": {
+ "version": "5.48.2",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.48.2.tgz",
+ "integrity": "sha512-zEUFfonQid5KRDKoI3O+uP1GnrFd4tIHlvs+sTJXiWuypUWMuDaottkJuR612wQfOkjYbsaskSIURV9xo4f+Fw==",
+ "dev": true,
+ "requires": {
+ "@typescript-eslint/types": "5.48.2",
+ "@typescript-eslint/visitor-keys": "5.48.2"
+ }
+ },
+ "@typescript-eslint/type-utils": {
+ "version": "5.48.2",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.48.2.tgz",
+ "integrity": "sha512-QVWx7J5sPMRiOMJp5dYshPxABRoZV1xbRirqSk8yuIIsu0nvMTZesKErEA3Oix1k+uvsk8Cs8TGJ6kQ0ndAcew==",
+ "dev": true,
+ "requires": {
+ "@typescript-eslint/typescript-estree": "5.48.2",
+ "@typescript-eslint/utils": "5.48.2",
+ "debug": "^4.3.4",
+ "tsutils": "^3.21.0"
+ }
+ },
+ "@typescript-eslint/types": {
+ "version": "5.48.2",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.48.2.tgz",
+ "integrity": "sha512-hE7dA77xxu7ByBc6KCzikgfRyBCTst6dZQpwaTy25iMYOnbNljDT4hjhrGEJJ0QoMjrfqrx+j1l1B9/LtKeuqA==",
+ "dev": true
+ },
+ "@typescript-eslint/typescript-estree": {
+ "version": "5.48.2",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.48.2.tgz",
+ "integrity": "sha512-bibvD3z6ilnoVxUBFEgkO0k0aFvUc4Cttt0dAreEr+nrAHhWzkO83PEVVuieK3DqcgL6VAK5dkzK8XUVja5Zcg==",
+ "dev": true,
+ "requires": {
+ "@typescript-eslint/types": "5.48.2",
+ "@typescript-eslint/visitor-keys": "5.48.2",
+ "debug": "^4.3.4",
+ "globby": "^11.1.0",
+ "is-glob": "^4.0.3",
+ "semver": "^7.3.7",
+ "tsutils": "^3.21.0"
+ }
+ },
+ "@typescript-eslint/utils": {
+ "version": "5.48.2",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.48.2.tgz",
+ "integrity": "sha512-2h18c0d7jgkw6tdKTlNaM7wyopbLRBiit8oAxoP89YnuBOzCZ8g8aBCaCqq7h208qUTroL7Whgzam7UY3HVLow==",
+ "dev": true,
+ "requires": {
+ "@types/json-schema": "^7.0.9",
+ "@types/semver": "^7.3.12",
+ "@typescript-eslint/scope-manager": "5.48.2",
+ "@typescript-eslint/types": "5.48.2",
+ "@typescript-eslint/typescript-estree": "5.48.2",
+ "eslint-scope": "^5.1.1",
+ "eslint-utils": "^3.0.0",
+ "semver": "^7.3.7"
+ }
+ },
+ "@typescript-eslint/visitor-keys": {
+ "version": "5.48.2",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.48.2.tgz",
+ "integrity": "sha512-z9njZLSkwmjFWUelGEwEbdf4NwKvfHxvGC0OcGN1Hp/XNDIcJ7D5DpPNPv6x6/mFvc1tQHsaWmpD/a4gOvvCJQ==",
+ "dev": true,
+ "requires": {
+ "@typescript-eslint/types": "5.48.2",
+ "eslint-visitor-keys": "^3.3.0"
+ }
+ },
+ "globby": {
+ "version": "11.1.0",
+ "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz",
+ "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==",
+ "dev": true,
+ "requires": {
+ "array-union": "^2.1.0",
+ "dir-glob": "^3.0.1",
+ "fast-glob": "^3.2.9",
+ "ignore": "^5.2.0",
+ "merge2": "^1.4.1",
+ "slash": "^3.0.0"
+ }
+ },
+ "lru-cache": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
+ "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
"dev": true,
"requires": {
- "tslib": "^1.9.0"
+ "yallist": "^4.0.0"
}
},
- "tslib": {
- "version": "1.14.1",
- "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
- "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==",
- "dev": true
- }
- }
- },
- "@angular-devkit/schematics": {
- "version": "15.1.3",
- "resolved": "https://registry.npmjs.org/@angular-devkit/schematics/-/schematics-15.1.3.tgz",
- "integrity": "sha512-IXZ56/5uFnHqnLq+80JhmFx5mflyW8LgS/8Tr2l5DYVA71Fh3b1q+vGrEZB1X2zPoFeDOGAxv3Fi+kmjcz1GZg==",
- "dev": true,
- "requires": {
- "@angular-devkit/core": "15.1.3",
- "jsonc-parser": "3.2.0",
- "magic-string": "0.27.0",
- "ora": "5.4.1",
- "rxjs": "6.6.7"
- },
- "dependencies": {
- "rxjs": {
- "version": "6.6.7",
- "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz",
- "integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==",
+ "semver": {
+ "version": "7.4.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz",
+ "integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==",
"dev": true,
"requires": {
- "tslib": "^1.9.0"
+ "lru-cache": "^6.0.0"
}
},
- "tslib": {
- "version": "1.14.1",
- "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
- "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==",
+ "slash": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",
+ "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==",
+ "dev": true
+ },
+ "yallist": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
+ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
"dev": true
}
}
},
- "@angular-eslint/builder": {
- "version": "15.2.0",
- "resolved": "https://registry.npmjs.org/@angular-eslint/builder/-/builder-15.2.0.tgz",
- "integrity": "sha512-5xnJub1G7+F9Ra75N90Ln9yn/KFzWnMIHfqDVRRDrlwgja1Zc9ZmqcazLWc/k12yzKyJoO3uwBSycyVwG2fYVg==",
- "dev": true,
- "requires": {}
- },
- "@angular-eslint/bundled-angular-compiler": {
- "version": "15.2.0",
- "resolved": "https://registry.npmjs.org/@angular-eslint/bundled-angular-compiler/-/bundled-angular-compiler-15.2.0.tgz",
- "integrity": "sha512-a0bfXxYyGoWJHrVQ4QER0HdRgselcTtJeyqiFPAxID2ZxF0IBGKLNTtugUTXekEmiLev8yGLX9TqAtthN57fEg==",
- "dev": true
- },
- "@angular-eslint/eslint-plugin": {
- "version": "15.2.0",
- "resolved": "https://registry.npmjs.org/@angular-eslint/eslint-plugin/-/eslint-plugin-15.2.0.tgz",
- "integrity": "sha512-yJGbmSUU0B0MFJ48ktpkqqEK+zv5k9iwlZSqEHtiQMKvDelfluovnEusihel7uPRo1c1iVlbSgXfGpxpUCfocA==",
- "dev": true,
- "requires": {
- "@angular-eslint/utils": "15.2.0",
- "@typescript-eslint/utils": "5.48.1"
- }
- },
- "@angular-eslint/eslint-plugin-template": {
- "version": "15.2.0",
- "resolved": "https://registry.npmjs.org/@angular-eslint/eslint-plugin-template/-/eslint-plugin-template-15.2.0.tgz",
- "integrity": "sha512-aL3czf5Jpv29rKN3UG20tQepX1+V0d6xc0g+1l0zPHZJYjVd6Oy0nIxWiGfl4yanaXiVpmxiV4vUcLlqqaFwbw==",
- "dev": true,
- "requires": {
- "@angular-eslint/bundled-angular-compiler": "15.2.0",
- "@angular-eslint/utils": "15.2.0",
- "@typescript-eslint/type-utils": "5.48.1",
- "@typescript-eslint/utils": "5.48.1",
- "aria-query": "5.1.3",
- "axobject-query": "3.1.1"
- }
- },
"@angular-eslint/schematics": {
- "version": "15.2.0",
- "resolved": "https://registry.npmjs.org/@angular-eslint/schematics/-/schematics-15.2.0.tgz",
- "integrity": "sha512-N9tuVu3vL47beppTsV9wAF+v6M9trbJnuNWYQGGsqA3mtCAkFUvJuHyWcXNPdSCNv/cJtR1OOJ7Y922uB5JPJQ==",
+ "version": "15.2.1",
+ "resolved": "https://registry.npmjs.org/@angular-eslint/schematics/-/schematics-15.2.1.tgz",
+ "integrity": "sha512-0ZfBCejHWIcgy3J5kFs9sS/jqi8i5AptxggOwFySOlCLJ+CzNrktjD4jff1Zy8K/VLzY0Ci0BSZXvgWfP0k9Rg==",
"dev": true,
"requires": {
- "@angular-eslint/eslint-plugin": "15.2.0",
- "@angular-eslint/eslint-plugin-template": "15.2.0",
+ "@angular-eslint/eslint-plugin": "15.2.1",
+ "@angular-eslint/eslint-plugin-template": "15.2.1",
"ignore": "5.2.4",
"strip-json-comments": "3.1.1",
"tmp": "0.2.1"
@@ -18709,12 +19353,12 @@
}
},
"@angular-eslint/template-parser": {
- "version": "15.2.0",
- "resolved": "https://registry.npmjs.org/@angular-eslint/template-parser/-/template-parser-15.2.0.tgz",
- "integrity": "sha512-xnnxPfV/G0Ll3B0HGrF1ucsc/DHmNE6UhhmWxYPTERq0McbZGRiATa66hCoOZ/Rdylun4ogBfsRKAG8XxEvlvw==",
+ "version": "15.2.1",
+ "resolved": "https://registry.npmjs.org/@angular-eslint/template-parser/-/template-parser-15.2.1.tgz",
+ "integrity": "sha512-ViCi79gC2aKJecmYLkOT+QlT5WMRNXeYz0Dr9Pr8qXzIbY0oAWE7nOT5jkXwQ9oUk+ybtGCWHma5JVJWVJsIog==",
"dev": true,
"requires": {
- "@angular-eslint/bundled-angular-compiler": "15.2.0",
+ "@angular-eslint/bundled-angular-compiler": "15.2.1",
"eslint-scope": "^7.0.0"
},
"dependencies": {
@@ -18737,42 +19381,145 @@
}
},
"@angular-eslint/utils": {
- "version": "15.2.0",
- "resolved": "https://registry.npmjs.org/@angular-eslint/utils/-/utils-15.2.0.tgz",
- "integrity": "sha512-qfTOKQ+aef/YER679/xN1E+FkZKMd0I73P6txUZAb9k2G1ACVktG+wOUIBfgjIlUVq9Q01AV91LGOWcd+rdEEA==",
+ "version": "15.2.1",
+ "resolved": "https://registry.npmjs.org/@angular-eslint/utils/-/utils-15.2.1.tgz",
+ "integrity": "sha512-++FneAJHxJqcSu0igVN6uOkSoHxlzgLoMBswuovYJy3UKwm33/T6WFku8++753Ca/JucIoR1gdUfO7SoSspMDg==",
"dev": true,
"requires": {
- "@angular-eslint/bundled-angular-compiler": "15.2.0",
- "@typescript-eslint/utils": "5.48.1"
+ "@angular-eslint/bundled-angular-compiler": "15.2.1",
+ "@typescript-eslint/utils": "5.48.2"
+ },
+ "dependencies": {
+ "@typescript-eslint/scope-manager": {
+ "version": "5.48.2",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.48.2.tgz",
+ "integrity": "sha512-zEUFfonQid5KRDKoI3O+uP1GnrFd4tIHlvs+sTJXiWuypUWMuDaottkJuR612wQfOkjYbsaskSIURV9xo4f+Fw==",
+ "dev": true,
+ "requires": {
+ "@typescript-eslint/types": "5.48.2",
+ "@typescript-eslint/visitor-keys": "5.48.2"
+ }
+ },
+ "@typescript-eslint/types": {
+ "version": "5.48.2",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.48.2.tgz",
+ "integrity": "sha512-hE7dA77xxu7ByBc6KCzikgfRyBCTst6dZQpwaTy25iMYOnbNljDT4hjhrGEJJ0QoMjrfqrx+j1l1B9/LtKeuqA==",
+ "dev": true
+ },
+ "@typescript-eslint/typescript-estree": {
+ "version": "5.48.2",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.48.2.tgz",
+ "integrity": "sha512-bibvD3z6ilnoVxUBFEgkO0k0aFvUc4Cttt0dAreEr+nrAHhWzkO83PEVVuieK3DqcgL6VAK5dkzK8XUVja5Zcg==",
+ "dev": true,
+ "requires": {
+ "@typescript-eslint/types": "5.48.2",
+ "@typescript-eslint/visitor-keys": "5.48.2",
+ "debug": "^4.3.4",
+ "globby": "^11.1.0",
+ "is-glob": "^4.0.3",
+ "semver": "^7.3.7",
+ "tsutils": "^3.21.0"
+ }
+ },
+ "@typescript-eslint/utils": {
+ "version": "5.48.2",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.48.2.tgz",
+ "integrity": "sha512-2h18c0d7jgkw6tdKTlNaM7wyopbLRBiit8oAxoP89YnuBOzCZ8g8aBCaCqq7h208qUTroL7Whgzam7UY3HVLow==",
+ "dev": true,
+ "requires": {
+ "@types/json-schema": "^7.0.9",
+ "@types/semver": "^7.3.12",
+ "@typescript-eslint/scope-manager": "5.48.2",
+ "@typescript-eslint/types": "5.48.2",
+ "@typescript-eslint/typescript-estree": "5.48.2",
+ "eslint-scope": "^5.1.1",
+ "eslint-utils": "^3.0.0",
+ "semver": "^7.3.7"
+ }
+ },
+ "@typescript-eslint/visitor-keys": {
+ "version": "5.48.2",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.48.2.tgz",
+ "integrity": "sha512-z9njZLSkwmjFWUelGEwEbdf4NwKvfHxvGC0OcGN1Hp/XNDIcJ7D5DpPNPv6x6/mFvc1tQHsaWmpD/a4gOvvCJQ==",
+ "dev": true,
+ "requires": {
+ "@typescript-eslint/types": "5.48.2",
+ "eslint-visitor-keys": "^3.3.0"
+ }
+ },
+ "globby": {
+ "version": "11.1.0",
+ "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz",
+ "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==",
+ "dev": true,
+ "requires": {
+ "array-union": "^2.1.0",
+ "dir-glob": "^3.0.1",
+ "fast-glob": "^3.2.9",
+ "ignore": "^5.2.0",
+ "merge2": "^1.4.1",
+ "slash": "^3.0.0"
+ }
+ },
+ "lru-cache": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
+ "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
+ "dev": true,
+ "requires": {
+ "yallist": "^4.0.0"
+ }
+ },
+ "semver": {
+ "version": "7.4.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz",
+ "integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==",
+ "dev": true,
+ "requires": {
+ "lru-cache": "^6.0.0"
+ }
+ },
+ "slash": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",
+ "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==",
+ "dev": true
+ },
+ "yallist": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
+ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
+ "dev": true
+ }
}
},
"@angular/animations": {
- "version": "15.1.2",
- "resolved": "https://registry.npmjs.org/@angular/animations/-/animations-15.1.2.tgz",
- "integrity": "sha512-Bamm2gNdSMVeXEFwlXG75rx49NJfbupDQM6geix0uI30iVCYlufPz+kMe4SzpasO5hHzP7Pat3cmEu4356It+g==",
+ "version": "15.2.7",
+ "resolved": "https://registry.npmjs.org/@angular/animations/-/animations-15.2.7.tgz",
+ "integrity": "sha512-Vmy0AljHc/GOp87O2x0mxUDiyfJFW8ndDE9Xrm/g0rnLnNWsaLtLXr1TWbwF7eTqKA3k/QcUvYAjLMWKvjyKgQ==",
"requires": {
"tslib": "^2.3.0"
}
},
"@angular/cdk": {
- "version": "15.1.2",
- "resolved": "https://registry.npmjs.org/@angular/cdk/-/cdk-15.1.2.tgz",
- "integrity": "sha512-LO3b/akdcPaRwSa+rbrI02THwQm+O4Z3rDIvbDTHyCf3Vmk3p7gsp8WtKAMMJlkCF88VQ3Wh4ZZcfNAtbVO7EA==",
+ "version": "15.2.7",
+ "resolved": "https://registry.npmjs.org/@angular/cdk/-/cdk-15.2.7.tgz",
+ "integrity": "sha512-IQg/EuZ3LC/vOHZtcLvkM+FSACXW5PVv2NddJgsBOtfcf1HcTk97VhegtB4WGQTUe1pcxiLGz/aWYuIRknjitw==",
"requires": {
"parse5": "^7.1.2",
"tslib": "^2.3.0"
}
},
"@angular/cli": {
- "version": "15.1.3",
- "resolved": "https://registry.npmjs.org/@angular/cli/-/cli-15.1.3.tgz",
- "integrity": "sha512-gNVvyvkGZ1zKiDdWjPqCLst8iHcB1C4B2nXrr3B+/YAd1G/y87VI1aBKFlK9ulG4tkwktog5uQaut7xs48IsEQ==",
+ "version": "15.2.6",
+ "resolved": "https://registry.npmjs.org/@angular/cli/-/cli-15.2.6.tgz",
+ "integrity": "sha512-wNkQ/qCVbd4pERaGVagKJPifEvjRNY5otwsd4iRVubY/XOcIHcYChUThZwgQdVfNAImfJPMZNrhbGxejuWLA9w==",
"dev": true,
"requires": {
- "@angular-devkit/architect": "0.1501.3",
- "@angular-devkit/core": "15.1.3",
- "@angular-devkit/schematics": "15.1.3",
- "@schematics/angular": "15.1.3",
+ "@angular-devkit/architect": "0.1502.6",
+ "@angular-devkit/core": "15.2.6",
+ "@angular-devkit/schematics": "15.2.6",
+ "@schematics/angular": "15.2.6",
"@yarnpkg/lockfile": "1.1.0",
"ansi-colors": "4.1.3",
"ini": "3.0.1",
@@ -18780,9 +19527,9 @@
"jsonc-parser": "3.2.0",
"npm-package-arg": "10.1.0",
"npm-pick-manifest": "8.0.1",
- "open": "8.4.0",
+ "open": "8.4.1",
"ora": "5.4.1",
- "pacote": "15.0.8",
+ "pacote": "15.1.0",
"resolve": "1.22.1",
"semver": "7.3.8",
"symbol-observable": "4.0.0",
@@ -18816,25 +19563,25 @@
}
},
"@angular/common": {
- "version": "15.1.2",
- "resolved": "https://registry.npmjs.org/@angular/common/-/common-15.1.2.tgz",
- "integrity": "sha512-1Ra6EoaZjPcdDsGBge3qSajO1ECYceX+2EWHdjvJ9ZEIaXsLNFMQBUMgJnjsnrojs9Gd3bxJ0WHkahij5/8WNA==",
+ "version": "15.2.7",
+ "resolved": "https://registry.npmjs.org/@angular/common/-/common-15.2.7.tgz",
+ "integrity": "sha512-CbmrQeZ0yChQrF/ab3v+gv6x2uLbv/s1wZNUBSO/p1STz6BZzHRJqObVlfPlQvyBx5btBBy/+I1sUh1yumARDA==",
"requires": {
"tslib": "^2.3.0"
}
},
"@angular/compiler": {
- "version": "15.1.2",
- "resolved": "https://registry.npmjs.org/@angular/compiler/-/compiler-15.1.2.tgz",
- "integrity": "sha512-hKlr1i61a2Gl0h53goSSUbZmzNgdC1zAHu+Ws0+1Qfv9cDgg1aVphFGFMdV0kbjLV+k7LyFjj5EgWU48o5UXww==",
+ "version": "15.2.7",
+ "resolved": "https://registry.npmjs.org/@angular/compiler/-/compiler-15.2.7.tgz",
+ "integrity": "sha512-SesyYI2ExUa13XukXgIsmfg3ar90HbWeWDJTgmzsIfph0M9t6+SaPGpf3FCtdBgNADIpUFp3cieCOJgLESzxYQ==",
"requires": {
"tslib": "^2.3.0"
}
},
"@angular/compiler-cli": {
- "version": "15.1.2",
- "resolved": "https://registry.npmjs.org/@angular/compiler-cli/-/compiler-cli-15.1.2.tgz",
- "integrity": "sha512-gAqbQSKI4oeboh0UKsFdaEoST9IBVzqeckJzSTwAGxJeS33IM7Jjo3LViqHuzQyWKXe6srkci0LD4C2Mrj4kfQ==",
+ "version": "15.2.7",
+ "resolved": "https://registry.npmjs.org/@angular/compiler-cli/-/compiler-cli-15.2.7.tgz",
+ "integrity": "sha512-4v51dOaT8GDUzRh6+mCLZOaYuU9FYX6vOHaLod9np3tVWPhcpoF2ZklRSiQDeFqrhr5B4vuCp/Lh9N2wzc22XQ==",
"requires": {
"@babel/core": "7.19.3",
"@jridgewell/sourcemap-codec": "^1.4.14",
@@ -18872,25 +19619,25 @@
}
},
"@angular/core": {
- "version": "15.1.2",
- "resolved": "https://registry.npmjs.org/@angular/core/-/core-15.1.2.tgz",
- "integrity": "sha512-K9pz6Bq6RuY/OWhKLZT1JQvk4orvU9wozgXY8cZaOGmNCQQ7sJv5zGkO5csO6o1ON1v/AHowrP/FAF1i8tml5g==",
+ "version": "15.2.7",
+ "resolved": "https://registry.npmjs.org/@angular/core/-/core-15.2.7.tgz",
+ "integrity": "sha512-iS7JCJubRFqdndoUdAnvNkQRT3tY5tNFupBQS/sytkwxVrdBg+Is5jpdgk741n824vTMsE+CnuY0SETar8rN6g==",
"requires": {
"tslib": "^2.3.0"
}
},
"@angular/forms": {
- "version": "15.1.2",
- "resolved": "https://registry.npmjs.org/@angular/forms/-/forms-15.1.2.tgz",
- "integrity": "sha512-ZL3EkCQ2SDrv9hdyPX54WPiTf9SQpkKz4bn/Gxe6lySLy0oHR5Te68DPMljWBeHYa+cNTCDdPN81AKLIDjRQtA==",
+ "version": "15.2.7",
+ "resolved": "https://registry.npmjs.org/@angular/forms/-/forms-15.2.7.tgz",
+ "integrity": "sha512-rzrebDIrtxxOeMcBzRBxqaOBZ+T1DJrysG/6YWZy428W/Z3MfPxUarPxgfx/oZI+x5uUsDaZmyoRdhVPJ2KhZg==",
"requires": {
"tslib": "^2.3.0"
}
},
"@angular/localize": {
- "version": "15.1.2",
- "resolved": "https://registry.npmjs.org/@angular/localize/-/localize-15.1.2.tgz",
- "integrity": "sha512-wnNgq8tn5W1u2B/G2Q08XiHKucJidNE+U5OuYk+qjf2M5M5DVwBhF/mxJxWoDKSuLg/JIJ8FUiKjEhJ5iUJ4lg==",
+ "version": "15.2.7",
+ "resolved": "https://registry.npmjs.org/@angular/localize/-/localize-15.2.7.tgz",
+ "integrity": "sha512-ySuy35QKApWH9sW3PfnAAnZjLl3NT+SacvlEWigrTeCqfBEuDPUG57ugvc1/Lzuo09UOh3HQkrQBbdWAILd8JA==",
"requires": {
"@babel/core": "7.19.3",
"glob": "8.1.0",
@@ -18898,25 +19645,25 @@
}
},
"@angular/platform-browser": {
- "version": "15.1.2",
- "resolved": "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-15.1.2.tgz",
- "integrity": "sha512-eWyfUOFZ05vB0UfPUTPK7pPJZjFtbGZlJOea3IUqEohuyRqq3CqYCrv7SVXGKQVOx1qRA0Ckr9FOB8/qYbTq1A==",
+ "version": "15.2.7",
+ "resolved": "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-15.2.7.tgz",
+ "integrity": "sha512-aCbd7xyuP7c2eDITkOTDO2mqP550WHCBN8U6VnjysqtB5ocbJtR6z/MIRItN/Zx+xj3piiaKei//XIkb3Q5fXQ==",
"requires": {
"tslib": "^2.3.0"
}
},
"@angular/platform-browser-dynamic": {
- "version": "15.1.2",
- "resolved": "https://registry.npmjs.org/@angular/platform-browser-dynamic/-/platform-browser-dynamic-15.1.2.tgz",
- "integrity": "sha512-JBSRYeaW+Vb/lKXwxgrU8m42Avxjwmx8vGRp/krJfhh4KL9CJ84zf7Ldxb0sCv06kGdu6vbOUasNGDdgIQfdOQ==",
+ "version": "15.2.7",
+ "resolved": "https://registry.npmjs.org/@angular/platform-browser-dynamic/-/platform-browser-dynamic-15.2.7.tgz",
+ "integrity": "sha512-t1Nf7hgbcYvhmxuzgUtsV47jrI5CXUBqrtz5I0ilWG92zZTig5qvfd1/2Ub8NHz87uHNrnggyZpL2+4MJ26nyQ==",
"requires": {
"tslib": "^2.3.0"
}
},
"@angular/router": {
- "version": "15.1.2",
- "resolved": "https://registry.npmjs.org/@angular/router/-/router-15.1.2.tgz",
- "integrity": "sha512-p2tTHYvBsMaayJNWAZMBqrL7jwxs6NQaEDImBtMwnOnQr/M+LwQdAeNFfpky20ODZw0JwTW84q04l8klExq0kw==",
+ "version": "15.2.7",
+ "resolved": "https://registry.npmjs.org/@angular/router/-/router-15.2.7.tgz",
+ "integrity": "sha512-Wkk+oJSUrVafJjmv9uE1SoY4wDE9bjX7ald+UXePz+QyM/PFoLkm/CzLYjFBkJnsOkOVxw1VmvacoUjWN6BCTQ==",
"requires": {
"tslib": "^2.3.0"
}
@@ -20003,9 +20750,9 @@
}
},
"@babel/runtime": {
- "version": "7.20.7",
- "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.7.tgz",
- "integrity": "sha512-UF0tvkUtxwAgZ5W/KrkHf0Rn0fdnLDU9ScxBrEVNUprE/MzirjK4MJUX1/BVDv00Sv8cljtukVK1aky++X1SjQ==",
+ "version": "7.20.13",
+ "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.13.tgz",
+ "integrity": "sha512-gt3PKXs0DBoL9xCvOIIZ2NEqAGZqHjAnmVbfQtB620V0uReIQutpel14KcneZuer7UioY8ALKZ7iocavvzTNFA==",
"dev": true,
"requires": {
"regenerator-runtime": "^0.13.11"
@@ -20076,156 +20823,156 @@
"dev": true
},
"@esbuild/android-arm": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.16.17.tgz",
- "integrity": "sha512-N9x1CMXVhtWEAMS7pNNONyA14f71VPQN9Cnavj1XQh6T7bskqiLLrSca4O0Vr8Wdcga943eThxnVp3JLnBMYtw==",
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.17.8.tgz",
+ "integrity": "sha512-0/rb91GYKhrtbeglJXOhAv9RuYimgI8h623TplY2X+vA4EXnk3Zj1fXZreJ0J3OJJu1bwmb0W7g+2cT/d8/l/w==",
"dev": true,
"optional": true
},
"@esbuild/android-arm64": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.16.17.tgz",
- "integrity": "sha512-MIGl6p5sc3RDTLLkYL1MyL8BMRN4tLMRCn+yRJJmEDvYZ2M7tmAf80hx1kbNEUX2KJ50RRtxZ4JHLvCfuB6kBg==",
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.17.8.tgz",
+ "integrity": "sha512-oa/N5j6v1svZQs7EIRPqR8f+Bf8g6HBDjD/xHC02radE/NjKHK7oQmtmLxPs1iVwYyvE+Kolo6lbpfEQ9xnhxQ==",
"dev": true,
"optional": true
},
"@esbuild/android-x64": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.16.17.tgz",
- "integrity": "sha512-a3kTv3m0Ghh4z1DaFEuEDfz3OLONKuFvI4Xqczqx4BqLyuFaFkuaG4j2MtA6fuWEFeC5x9IvqnX7drmRq/fyAQ==",
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.17.8.tgz",
+ "integrity": "sha512-bTliMLqD7pTOoPg4zZkXqCDuzIUguEWLpeqkNfC41ODBHwoUgZ2w5JBeYimv4oP6TDVocoYmEhZrCLQTrH89bg==",
"dev": true,
"optional": true
},
"@esbuild/darwin-arm64": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.16.17.tgz",
- "integrity": "sha512-/2agbUEfmxWHi9ARTX6OQ/KgXnOWfsNlTeLcoV7HSuSTv63E4DqtAc+2XqGw1KHxKMHGZgbVCZge7HXWX9Vn+w==",
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.17.8.tgz",
+ "integrity": "sha512-ghAbV3ia2zybEefXRRm7+lx8J/rnupZT0gp9CaGy/3iolEXkJ6LYRq4IpQVI9zR97ID80KJVoUlo3LSeA/sMAg==",
"dev": true,
"optional": true
},
"@esbuild/darwin-x64": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.16.17.tgz",
- "integrity": "sha512-2By45OBHulkd9Svy5IOCZt376Aa2oOkiE9QWUK9fe6Tb+WDr8hXL3dpqi+DeLiMed8tVXspzsTAvd0jUl96wmg==",
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.17.8.tgz",
+ "integrity": "sha512-n5WOpyvZ9TIdv2V1K3/iIkkJeKmUpKaCTdun9buhGRWfH//osmUjlv4Z5mmWdPWind/VGcVxTHtLfLCOohsOXw==",
"dev": true,
"optional": true
},
"@esbuild/freebsd-arm64": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.16.17.tgz",
- "integrity": "sha512-mt+cxZe1tVx489VTb4mBAOo2aKSnJ33L9fr25JXpqQqzbUIw/yzIzi+NHwAXK2qYV1lEFp4OoVeThGjUbmWmdw==",
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.8.tgz",
+ "integrity": "sha512-a/SATTaOhPIPFWvHZDoZYgxaZRVHn0/LX1fHLGfZ6C13JqFUZ3K6SMD6/HCtwOQ8HnsNaEeokdiDSFLuizqv5A==",
"dev": true,
"optional": true
},
"@esbuild/freebsd-x64": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.16.17.tgz",
- "integrity": "sha512-8ScTdNJl5idAKjH8zGAsN7RuWcyHG3BAvMNpKOBaqqR7EbUhhVHOqXRdL7oZvz8WNHL2pr5+eIT5c65kA6NHug==",
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.17.8.tgz",
+ "integrity": "sha512-xpFJb08dfXr5+rZc4E+ooZmayBW6R3q59daCpKZ/cDU96/kvDM+vkYzNeTJCGd8rtO6fHWMq5Rcv/1cY6p6/0Q==",
"dev": true,
"optional": true
},
"@esbuild/linux-arm": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.16.17.tgz",
- "integrity": "sha512-iihzrWbD4gIT7j3caMzKb/RsFFHCwqqbrbH9SqUSRrdXkXaygSZCZg1FybsZz57Ju7N/SHEgPyaR0LZ8Zbe9gQ==",
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.17.8.tgz",
+ "integrity": "sha512-6Ij8gfuGszcEwZpi5jQIJCVIACLS8Tz2chnEBfYjlmMzVsfqBP1iGmHQPp7JSnZg5xxK9tjCc+pJ2WtAmPRFVA==",
"dev": true,
"optional": true
},
"@esbuild/linux-arm64": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.16.17.tgz",
- "integrity": "sha512-7S8gJnSlqKGVJunnMCrXHU9Q8Q/tQIxk/xL8BqAP64wchPCTzuM6W3Ra8cIa1HIflAvDnNOt2jaL17vaW+1V0g==",
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.17.8.tgz",
+ "integrity": "sha512-v3iwDQuDljLTxpsqQDl3fl/yihjPAyOguxuloON9kFHYwopeJEf1BkDXODzYyXEI19gisEsQlG1bM65YqKSIww==",
"dev": true,
"optional": true
},
"@esbuild/linux-ia32": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.16.17.tgz",
- "integrity": "sha512-kiX69+wcPAdgl3Lonh1VI7MBr16nktEvOfViszBSxygRQqSpzv7BffMKRPMFwzeJGPxcio0pdD3kYQGpqQ2SSg==",
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.17.8.tgz",
+ "integrity": "sha512-8svILYKhE5XetuFk/B6raFYIyIqydQi+GngEXJgdPdI7OMKUbSd7uzR02wSY4kb53xBrClLkhH4Xs8P61Q2BaA==",
"dev": true,
"optional": true
},
"@esbuild/linux-loong64": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.16.17.tgz",
- "integrity": "sha512-dTzNnQwembNDhd654cA4QhbS9uDdXC3TKqMJjgOWsC0yNCbpzfWoXdZvp0mY7HU6nzk5E0zpRGGx3qoQg8T2DQ==",
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.17.8.tgz",
+ "integrity": "sha512-B6FyMeRJeV0NpyEOYlm5qtQfxbdlgmiGdD+QsipzKfFky0K5HW5Td6dyK3L3ypu1eY4kOmo7wW0o94SBqlqBSA==",
"dev": true,
"optional": true
},
"@esbuild/linux-mips64el": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.16.17.tgz",
- "integrity": "sha512-ezbDkp2nDl0PfIUn0CsQ30kxfcLTlcx4Foz2kYv8qdC6ia2oX5Q3E/8m6lq84Dj/6b0FrkgD582fJMIfHhJfSw==",
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.17.8.tgz",
+ "integrity": "sha512-CCb67RKahNobjm/eeEqeD/oJfJlrWyw29fgiyB6vcgyq97YAf3gCOuP6qMShYSPXgnlZe/i4a8WFHBw6N8bYAA==",
"dev": true,
"optional": true
},
"@esbuild/linux-ppc64": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.16.17.tgz",
- "integrity": "sha512-dzS678gYD1lJsW73zrFhDApLVdM3cUF2MvAa1D8K8KtcSKdLBPP4zZSLy6LFZ0jYqQdQ29bjAHJDgz0rVbLB3g==",
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.17.8.tgz",
+ "integrity": "sha512-bytLJOi55y55+mGSdgwZ5qBm0K9WOCh0rx+vavVPx+gqLLhxtSFU0XbeYy/dsAAD6xECGEv4IQeFILaSS2auXw==",
"dev": true,
"optional": true
},
"@esbuild/linux-riscv64": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.16.17.tgz",
- "integrity": "sha512-ylNlVsxuFjZK8DQtNUwiMskh6nT0vI7kYl/4fZgV1llP5d6+HIeL/vmmm3jpuoo8+NuXjQVZxmKuhDApK0/cKw==",
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.17.8.tgz",
+ "integrity": "sha512-2YpRyQJmKVBEHSBLa8kBAtbhucaclb6ex4wchfY0Tj3Kg39kpjeJ9vhRU7x4mUpq8ISLXRXH1L0dBYjAeqzZAw==",
"dev": true,
"optional": true
},
"@esbuild/linux-s390x": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.16.17.tgz",
- "integrity": "sha512-gzy7nUTO4UA4oZ2wAMXPNBGTzZFP7mss3aKR2hH+/4UUkCOyqmjXiKpzGrY2TlEUhbbejzXVKKGazYcQTZWA/w==",
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.17.8.tgz",
+ "integrity": "sha512-QgbNY/V3IFXvNf11SS6exkpVcX0LJcob+0RWCgV9OiDAmVElnxciHIisoSix9uzYzScPmS6dJFbZULdSAEkQVw==",
"dev": true,
"optional": true
},
"@esbuild/linux-x64": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.16.17.tgz",
- "integrity": "sha512-mdPjPxfnmoqhgpiEArqi4egmBAMYvaObgn4poorpUaqmvzzbvqbowRllQ+ZgzGVMGKaPkqUmPDOOFQRUFDmeUw==",
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.17.8.tgz",
+ "integrity": "sha512-mM/9S0SbAFDBc4OPoyP6SEOo5324LpUxdpeIUUSrSTOfhHU9hEfqRngmKgqILqwx/0DVJBzeNW7HmLEWp9vcOA==",
"dev": true,
"optional": true
},
"@esbuild/netbsd-x64": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.16.17.tgz",
- "integrity": "sha512-/PzmzD/zyAeTUsduZa32bn0ORug+Jd1EGGAUJvqfeixoEISYpGnAezN6lnJoskauoai0Jrs+XSyvDhppCPoKOA==",
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.17.8.tgz",
+ "integrity": "sha512-eKUYcWaWTaYr9zbj8GertdVtlt1DTS1gNBWov+iQfWuWyuu59YN6gSEJvFzC5ESJ4kMcKR0uqWThKUn5o8We6Q==",
"dev": true,
"optional": true
},
"@esbuild/openbsd-x64": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.16.17.tgz",
- "integrity": "sha512-2yaWJhvxGEz2RiftSk0UObqJa/b+rIAjnODJgv2GbGGpRwAfpgzyrg1WLK8rqA24mfZa9GvpjLcBBg8JHkoodg==",
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.17.8.tgz",
+ "integrity": "sha512-Vc9J4dXOboDyMXKD0eCeW0SIeEzr8K9oTHJU+Ci1mZc5njPfhKAqkRt3B/fUNU7dP+mRyralPu8QUkiaQn7iIg==",
"dev": true,
"optional": true
},
"@esbuild/sunos-x64": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.16.17.tgz",
- "integrity": "sha512-xtVUiev38tN0R3g8VhRfN7Zl42YCJvyBhRKw1RJjwE1d2emWTVToPLNEQj/5Qxc6lVFATDiy6LjVHYhIPrLxzw==",
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.17.8.tgz",
+ "integrity": "sha512-0xvOTNuPXI7ft1LYUgiaXtpCEjp90RuBBYovdd2lqAFxje4sEucurg30M1WIm03+3jxByd3mfo+VUmPtRSVuOw==",
"dev": true,
"optional": true
},
"@esbuild/win32-arm64": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.16.17.tgz",
- "integrity": "sha512-ga8+JqBDHY4b6fQAmOgtJJue36scANy4l/rL97W+0wYmijhxKetzZdKOJI7olaBaMhWt8Pac2McJdZLxXWUEQw==",
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.17.8.tgz",
+ "integrity": "sha512-G0JQwUI5WdEFEnYNKzklxtBheCPkuDdu1YrtRrjuQv30WsYbkkoixKxLLv8qhJmNI+ATEWquZe/N0d0rpr55Mg==",
"dev": true,
"optional": true
},
"@esbuild/win32-ia32": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.16.17.tgz",
- "integrity": "sha512-WnsKaf46uSSF/sZhwnqE4L/F89AYNMiD4YtEcYekBt9Q7nj0DiId2XH2Ng2PHM54qi5oPrQ8luuzGszqi/veig==",
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.17.8.tgz",
+ "integrity": "sha512-Fqy63515xl20OHGFykjJsMnoIWS+38fqfg88ClvPXyDbLtgXal2DTlhb1TfTX34qWi3u4I7Cq563QcHpqgLx8w==",
"dev": true,
"optional": true
},
"@esbuild/win32-x64": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.16.17.tgz",
- "integrity": "sha512-y+EHuSchhL7FjHgvQL/0fnnFmO4T1bhvWANX6gcnqTjtnKWbTvUMCpGnv2+t+31d7RzyEAYAd4u2fnIhHL6N/Q==",
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.17.8.tgz",
+ "integrity": "sha512-1iuezdyDNngPnz8rLRDO2C/ZZ/emJLb72OsZeqQ6gL6Avko/XCXZw+NuxBSNhBAP13Hie418V7VMt9et1FMvpg==",
"dev": true,
"optional": true
},
@@ -20316,9 +21063,9 @@
}
},
"@fortawesome/fontawesome-free": {
- "version": "6.2.1",
- "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-6.2.1.tgz",
- "integrity": "sha512-viouXhegu/TjkvYQoiRZK3aax69dGXxgEjpvZW81wIJdxm5Fnvp3VVIP4VHKqX4SvFw6qpmkILkD4RJWAdrt7A=="
+ "version": "6.2.0",
+ "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-6.2.0.tgz",
+ "integrity": "sha512-CNR7qRIfCwWHNN7FnKUniva94edPdyQzil/zCwk3v6k4R6rR2Fr8i4s3PM7n/lyfPA6Zfko9z5WDzFxG9SW1uQ=="
},
"@gar/promisify": {
"version": "1.1.3",
@@ -20371,11 +21118,11 @@
"dev": true
},
"@iharbeck/ngx-virtual-scroller": {
- "version": "15.0.0",
- "resolved": "https://registry.npmjs.org/@iharbeck/ngx-virtual-scroller/-/ngx-virtual-scroller-15.0.0.tgz",
- "integrity": "sha512-Z5Lbqx7hrU8dM1UVnsP9QdLHMmiyOGA+Wg+CkF+4jxQR/Wbe1wz0OPnMi5uIRI3/njkVCtu8vleVGIY5dWg1WA==",
+ "version": "15.2.0",
+ "resolved": "https://registry.npmjs.org/@iharbeck/ngx-virtual-scroller/-/ngx-virtual-scroller-15.2.0.tgz",
+ "integrity": "sha512-06zs8INWWy5UaopYauPOHF1CKVGWCHjT0N1E408F5BtwqR0iRlRme4Ba9iGOWCC0sgYwEjEV1AcFtvhHSe8/mA==",
"requires": {
- "tslib": "^2.4.1"
+ "tslib": "^2.3.0"
}
},
"@iplab/ngx-file-upload": {
@@ -20991,9 +21738,9 @@
"dev": true
},
"@microsoft/signalr": {
- "version": "7.0.2",
- "resolved": "https://registry.npmjs.org/@microsoft/signalr/-/signalr-7.0.2.tgz",
- "integrity": "sha512-U+o33K2m6nnMojZzBrjrApKgYfiQ0A0t4I2F5oFJObgfzRSDS9v0YoYgkmva5nbPftUp3YcR5XmH0S/1+BZT6Q==",
+ "version": "7.0.5",
+ "resolved": "https://registry.npmjs.org/@microsoft/signalr/-/signalr-7.0.5.tgz",
+ "integrity": "sha512-j84syCKlXkQAOQhyrzRmW7w/M2UXQ6OKcXXFIVNjmiiZbEGIvSvJDRAuyMFjArdQOXz+etJgd58H/prTbyTCrA==",
"requires": {
"abort-controller": "^3.0.0",
"eventsource": "^2.0.2",
@@ -21011,9 +21758,9 @@
}
},
"@ngtools/webpack": {
- "version": "15.1.3",
- "resolved": "https://registry.npmjs.org/@ngtools/webpack/-/webpack-15.1.3.tgz",
- "integrity": "sha512-xbV74ulf5BwIA61jASjKxzS0gzD6CQQkqPXDRo8I1tpDMQpEKFKWivw+1Joy6Anm62DWR4xuMEhnj5kjKWemgw==",
+ "version": "15.2.6",
+ "resolved": "https://registry.npmjs.org/@ngtools/webpack/-/webpack-15.2.6.tgz",
+ "integrity": "sha512-I+kekKItfsCLdX+ZjjmsWqd0AyoYGTQPjlbQAiPtmdH73/rfPOF4Q/3AU4tzTdn0n0GXqZWv6VOs91w99ydi0A==",
"dev": true,
"requires": {}
},
@@ -21079,14 +21826,13 @@
}
},
"@npmcli/git": {
- "version": "4.0.3",
- "resolved": "https://registry.npmjs.org/@npmcli/git/-/git-4.0.3.tgz",
- "integrity": "sha512-8cXNkDIbnXPVbhXMmQ7/bklCAjtmPaXfI9aEM4iH+xSuEHINLMHhlfESvVwdqmHJRJkR48vNJTSUvoF6GRPSFA==",
+ "version": "4.0.4",
+ "resolved": "https://registry.npmjs.org/@npmcli/git/-/git-4.0.4.tgz",
+ "integrity": "sha512-5yZghx+u5M47LghaybLCkdSyFzV/w4OuH12d96HO389Ik9CDsLaDZJVynSGGVJOLn6gy/k7Dz5XYcplM3uxXRg==",
"dev": true,
"requires": {
"@npmcli/promise-spawn": "^6.0.0",
"lru-cache": "^7.4.4",
- "mkdirp": "^1.0.4",
"npm-pick-manifest": "^8.0.0",
"proc-log": "^3.0.0",
"promise-inflight": "^1.0.1",
@@ -21096,15 +21842,15 @@
},
"dependencies": {
"lru-cache": {
- "version": "7.14.1",
- "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.14.1.tgz",
- "integrity": "sha512-ysxwsnTKdAx96aTRdhDOCQfDgbHnt8SK0KY8SEjO0wHinhWOFTESbjVCMPbU1uGXg/ch4lifqx0wfjOawU2+WA==",
+ "version": "7.18.3",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz",
+ "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==",
"dev": true
},
"semver": {
- "version": "7.3.8",
- "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz",
- "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==",
+ "version": "7.4.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz",
+ "integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==",
"dev": true,
"requires": {
"lru-cache": "^6.0.0"
@@ -21139,9 +21885,9 @@
}
},
"@npmcli/installed-package-contents": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/@npmcli/installed-package-contents/-/installed-package-contents-2.0.1.tgz",
- "integrity": "sha512-GIykAFdOVK31Q1/zAtT5MbxqQL2vyl9mvFJv+OGu01zxbhL3p0xc8gJjdNGX1mWmUT43aEKVO2L6V/2j4TOsAA==",
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/@npmcli/installed-package-contents/-/installed-package-contents-2.0.2.tgz",
+ "integrity": "sha512-xACzLPhnfD51GKvTOOuNX2/V4G4mz9/1I2MfDoye9kBM3RYe5g2YbscsaGoTlaWqkxeiapBWyseULVKpSVHtKQ==",
"dev": true,
"requires": {
"npm-bundled": "^3.0.0",
@@ -21229,7 +21975,8 @@
"@polka/url": {
"version": "1.0.0-next.21",
"resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.21.tgz",
- "integrity": "sha512-a5Sab1C4/icpTZVzZc5Ghpz88yQtGOyNqYXcZgOssB2uuAr+wF/MvN6bgtW32q7HHrvBki+BsZ0OuNv6EV3K9g=="
+ "integrity": "sha512-a5Sab1C4/icpTZVzZc5Ghpz88yQtGOyNqYXcZgOssB2uuAr+wF/MvN6bgtW32q7HHrvBki+BsZ0OuNv6EV3K9g==",
+ "dev": true
},
"@popperjs/core": {
"version": "2.11.6",
@@ -21237,16 +21984,22 @@
"integrity": "sha512-50/17A98tWUfQ176raKiOGXuYpLyyVMkxxG6oylzL3BPOlA6ADGdK7EYunSa4I064xerltq9TGXs8HmOk5E+vw=="
},
"@schematics/angular": {
- "version": "15.1.3",
- "resolved": "https://registry.npmjs.org/@schematics/angular/-/angular-15.1.3.tgz",
- "integrity": "sha512-jCJ0Nq/FpoMnA63rPAhRWQJFVbS+K8NpdTHZ/7l4wx9iFtIH7khCdbp3QYMJSwZh5pEiw/NO7ouxsWo5YgapYQ==",
+ "version": "15.2.6",
+ "resolved": "https://registry.npmjs.org/@schematics/angular/-/angular-15.2.6.tgz",
+ "integrity": "sha512-OcBUvVAxZEMBX+fi0ytybeAdmStra+GwtlvipS70yOxcAgJ84ZrnZGN7a072cCVQcq7AgqUfssnyqCx1wu+yCg==",
"dev": true,
"requires": {
- "@angular-devkit/core": "15.1.3",
- "@angular-devkit/schematics": "15.1.3",
+ "@angular-devkit/core": "15.2.6",
+ "@angular-devkit/schematics": "15.2.6",
"jsonc-parser": "3.2.0"
}
},
+ "@sigstore/protobuf-specs": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/@sigstore/protobuf-specs/-/protobuf-specs-0.1.0.tgz",
+ "integrity": "sha512-a31EnjuIDSX8IXBUib3cYLDRlPMU36AWX4xS8ysLaNu4ZzUesDiPt83pgrW2X1YLMe5L2HbDyaKK5BrL4cNKaQ==",
+ "dev": true
+ },
"@sinonjs/commons": {
"version": "1.8.6",
"resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.6.tgz",
@@ -21315,6 +22068,33 @@
"integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==",
"dev": true
},
+ "@tufjs/canonical-json": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/@tufjs/canonical-json/-/canonical-json-1.0.0.tgz",
+ "integrity": "sha512-QTnf++uxunWvG2z3UFNzAoQPHxnSXOwtaI3iJ+AohhV+5vONuArPjJE7aPXPVXfXJsqrVbZBu9b81AJoSd09IQ==",
+ "dev": true
+ },
+ "@tufjs/models": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/@tufjs/models/-/models-1.0.2.tgz",
+ "integrity": "sha512-uxarDtxTIK3f8hJS4yFhW/lvTa3tsiQU5iDCRut+NCnOXvNtEul0Ct58NIIcIx9Rkt7OFEK31Ndpqsd663nsew==",
+ "dev": true,
+ "requires": {
+ "@tufjs/canonical-json": "1.0.0",
+ "minimatch": "^8.0.3"
+ },
+ "dependencies": {
+ "minimatch": {
+ "version": "8.0.4",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-8.0.4.tgz",
+ "integrity": "sha512-W0Wvr9HyFXZRGIDgCicunpQ299OKXs9RgZfaukz4qAW/pJhcpUfupc9c+OObPOFueNy8VSrZgEmDtk6Kh4WzDA==",
+ "dev": true,
+ "requires": {
+ "brace-expansion": "^2.0.1"
+ }
+ }
+ }
+ },
"@tweenjs/tween.js": {
"version": "18.6.4",
"resolved": "https://registry.npmjs.org/@tweenjs/tween.js/-/tween.js-18.6.4.tgz",
@@ -21679,13 +22459,13 @@
"dev": true
},
"@types/express": {
- "version": "4.17.16",
- "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.16.tgz",
- "integrity": "sha512-LkKpqRZ7zqXJuvoELakaFYuETHjZkSol8EV6cNnyishutDBCCdv6+dsKPbKkCcIk57qRphOLY5sEgClw1bO3gA==",
+ "version": "4.17.17",
+ "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.17.tgz",
+ "integrity": "sha512-Q4FmmuLGBG58btUnfS1c1r/NQdlp3DMfGDGig8WhfpA2YRUtEkxAjkZb0yvplJGYdF1fsQ81iMDcH24sSCNC/Q==",
"dev": true,
"requires": {
"@types/body-parser": "*",
- "@types/express-serve-static-core": "^4.17.31",
+ "@types/express-serve-static-core": "^4.17.33",
"@types/qs": "*",
"@types/serve-static": "*"
}
@@ -21722,9 +22502,9 @@
}
},
"@types/http-proxy": {
- "version": "1.17.9",
- "resolved": "https://registry.npmjs.org/@types/http-proxy/-/http-proxy-1.17.9.tgz",
- "integrity": "sha512-QsbSjA/fSk7xB+UXlCT3wHBy5ai9wOcNDWwZAtud+jXhwOM3l+EYZh8Lng4+/6n8uar0J7xILzqftJdJ/Wdfkw==",
+ "version": "1.17.10",
+ "resolved": "https://registry.npmjs.org/@types/http-proxy/-/http-proxy-1.17.10.tgz",
+ "integrity": "sha512-Qs5aULi+zV1bwKAg5z1PWnDXWmsn+LxIvUGv6E2+OOMYhclZMO+OXd9pYVf2gLykf2I7IV2u7oTHwChPNsvJ7g==",
"dev": true,
"requires": {
"@types/node": "*"
@@ -21828,9 +22608,9 @@
}
},
"@types/serve-static": {
- "version": "1.15.0",
- "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.0.tgz",
- "integrity": "sha512-z5xyF6uh8CbjAu9760KDKsH2FcDxZ2tFCsA4HIMWE6IkiYMXfVoa+4f9KX+FN0ZLsaMw1WNG2ETLA6N+/YA+cg==",
+ "version": "1.15.1",
+ "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.1.tgz",
+ "integrity": "sha512-NUo5XNiAdULrJENtJXZZ3fHtfMolzZwczzBbnAeBbqBwG+LaG6YaJtuwzwGSQZ2wsCrxjEhNNjAkKigy3n8teQ==",
"dev": true,
"requires": {
"@types/mime": "*",
@@ -22269,7 +23049,8 @@
"acorn": {
"version": "8.8.2",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz",
- "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw=="
+ "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==",
+ "dev": true
},
"acorn-globals": {
"version": "6.0.0",
@@ -22312,7 +23093,8 @@
"acorn-walk": {
"version": "8.2.0",
"resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz",
- "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA=="
+ "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==",
+ "dev": true
},
"adjust-sourcemap-loader": {
"version": "4.0.0",
@@ -22337,14 +23119,6 @@
}
}
},
- "ag-swipe-core": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/ag-swipe-core/-/ag-swipe-core-1.0.2.tgz",
- "integrity": "sha512-NNONbrEbsmu6wsl7E07eGYVZw8Wx7hOok2TlhQLU/50EUhmI3Vpg8EDz0rWhV/HrfUAoEd4LxBvLAeT9DswQDw==",
- "requires": {
- "rxjs": "^7.5.5"
- }
- },
"agent-base": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",
@@ -22355,22 +23129,14 @@
}
},
"agentkeepalive": {
- "version": "4.2.1",
- "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.2.1.tgz",
- "integrity": "sha512-Zn4cw2NEqd+9fiSVWMscnjyQ1a8Yfoc5oBajLeo5w+YBHgDUcEBY2hS4YpTz6iN5f/2zQiktcuM6tS8x1p9dpA==",
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.3.0.tgz",
+ "integrity": "sha512-7Epl1Blf4Sy37j4v9f9FjICCh4+KAQOyXgHEwlyBiAQLbhKdq/i2QQU3amQalS/wPhdPzDXPL5DMR5bkn+YeWg==",
"dev": true,
"requires": {
"debug": "^4.1.0",
- "depd": "^1.1.2",
+ "depd": "^2.0.0",
"humanize-ms": "^1.2.1"
- },
- "dependencies": {
- "depd": {
- "version": "1.1.2",
- "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
- "integrity": "sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==",
- "dev": true
- }
}
},
"aggregate-error": {
@@ -22808,9 +23574,9 @@
}
},
"bonjour-service": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/bonjour-service/-/bonjour-service-1.1.0.tgz",
- "integrity": "sha512-LVRinRB3k1/K0XzZ2p58COnWvkQknIY6sf0zF2rpErvcJXpMBttEPQSxK+HEXSS9VmpZlDoDnQWv8ftJT20B0Q==",
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/bonjour-service/-/bonjour-service-1.1.1.tgz",
+ "integrity": "sha512-Z/5lQRMOG9k7W+FkeGTNjh7htqn/2LMnfOvBZ8pynNZCM9MwkQkI3zeI4oz09uWdcgmgHugVvBqxGg4VQJ5PCg==",
"dev": true,
"requires": {
"array-flatten": "^2.1.2",
@@ -22822,7 +23588,8 @@
"boolbase": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz",
- "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww=="
+ "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==",
+ "dev": true
},
"bootstrap": {
"version": "5.2.3",
@@ -22846,17 +23613,6 @@
"fill-range": "^7.0.1"
}
},
- "browser": {
- "version": "0.2.6",
- "resolved": "https://registry.npmjs.org/browser/-/browser-0.2.6.tgz",
- "integrity": "sha512-U6FjD1MaSio5jnSbGj7nrMzdy4mHmXe6RZ4/5Oa9CWIEa6iWCwnhJPfbZXGwaOOySqRF10v8BIQ4zYJyhBg97g==",
- "requires": {
- "cheerio": "x.x.x",
- "junjo": ">=0.2.6",
- "termcolor": "x.x.x",
- "u2r": "x.x.x"
- }
- },
"browser-process-hrtime": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz",
@@ -22927,9 +23683,9 @@
}
},
"semver": {
- "version": "7.3.8",
- "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz",
- "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==",
+ "version": "7.4.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz",
+ "integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==",
"dev": true,
"requires": {
"lru-cache": "^6.0.0"
@@ -23027,36 +23783,6 @@
"integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==",
"dev": true
},
- "cheerio": {
- "version": "0.22.0",
- "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-0.22.0.tgz",
- "integrity": "sha512-8/MzidM6G/TgRelkzDG13y3Y9LxBjCb+8yOEZ9+wwq5gVF2w2pV0wmHvjfT0RvuxGyR7UEuK36r+yYMbT4uKgA==",
- "requires": {
- "css-select": "~1.2.0",
- "dom-serializer": "~0.1.0",
- "entities": "~1.1.1",
- "htmlparser2": "^3.9.1",
- "lodash.assignin": "^4.0.9",
- "lodash.bind": "^4.1.4",
- "lodash.defaults": "^4.0.1",
- "lodash.filter": "^4.4.0",
- "lodash.flatten": "^4.2.0",
- "lodash.foreach": "^4.3.0",
- "lodash.map": "^4.4.0",
- "lodash.merge": "^4.4.0",
- "lodash.pick": "^4.2.1",
- "lodash.reduce": "^4.4.0",
- "lodash.reject": "^4.4.0",
- "lodash.some": "^4.4.0"
- },
- "dependencies": {
- "entities": {
- "version": "1.1.2",
- "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz",
- "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w=="
- }
- }
- },
"chokidar": {
"version": "3.5.3",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz",
@@ -23199,7 +23925,8 @@
"commander": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz",
- "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw=="
+ "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==",
+ "dev": true
},
"commondir": {
"version": "1.0.1",
@@ -23567,22 +24294,6 @@
}
}
},
- "css-select": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz",
- "integrity": "sha512-dUQOBoqdR7QwV90WysXPLXG5LO7nhYBgiWVfxF80DKPF8zx1t/pUd2FYy73emg3zrjtM6dzmYgbHKfV2rxiHQA==",
- "requires": {
- "boolbase": "~1.0.0",
- "css-what": "2.1",
- "domutils": "1.5.1",
- "nth-check": "~1.0.1"
- }
- },
- "css-what": {
- "version": "2.1.3",
- "resolved": "https://registry.npmjs.org/css-what/-/css-what-2.1.3.tgz",
- "integrity": "sha512-a+EPoD+uZiNfh+5fxw2nO9QwFa6nJe2Or35fGY6Ipw1R3R4AGz1d1TEZrCegvw2YTmZ0jXirGYlzxxpYSHwpEg=="
- },
"cssesc": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz",
@@ -23971,9 +24682,9 @@
"dev": true
},
"dns-packet": {
- "version": "5.4.0",
- "resolved": "https://registry.npmjs.org/dns-packet/-/dns-packet-5.4.0.tgz",
- "integrity": "sha512-EgqGeaBB8hLiHLZtp/IbaDQTL8pZ0+IvwzSHA6d7VyMDM+B9hgddEMa9xjK5oYnw0ci0JQ6g2XCD7/f6cafU6g==",
+ "version": "5.5.0",
+ "resolved": "https://registry.npmjs.org/dns-packet/-/dns-packet-5.5.0.tgz",
+ "integrity": "sha512-USawdAUzRkV6xrqTjiAEp6M9YagZEzWcSUaZTcIFAiyQWW1SoI6KyId8y2+/71wbgHKQAKd+iupLv4YvEwYWvA==",
"dev": true,
"requires": {
"@leichtgewicht/ip-codec": "^2.0.1"
@@ -23988,22 +24699,6 @@
"esutils": "^2.0.2"
}
},
- "dom-serializer": {
- "version": "0.1.1",
- "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.1.tgz",
- "integrity": "sha512-l0IU0pPzLWSHBcieZbpOKgkIn3ts3vAh7ZuFyXNwJxJXk/c4Gwj9xaTJwIDVQCXawWD0qb3IzMGH5rglQaO0XA==",
- "requires": {
- "domelementtype": "^1.3.0",
- "entities": "^1.1.1"
- },
- "dependencies": {
- "entities": {
- "version": "1.1.2",
- "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz",
- "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w=="
- }
- }
- },
"dom7": {
"version": "4.0.4",
"resolved": "https://registry.npmjs.org/dom7/-/dom7-4.0.4.tgz",
@@ -24012,11 +24707,6 @@
"ssr-window": "^4.0.0"
}
},
- "domelementtype": {
- "version": "1.3.1",
- "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.1.tgz",
- "integrity": "sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w=="
- },
"domexception": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/domexception/-/domexception-2.0.1.tgz",
@@ -24034,27 +24724,11 @@
}
}
},
- "domhandler": {
- "version": "2.4.2",
- "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.4.2.tgz",
- "integrity": "sha512-JiK04h0Ht5u/80fdLMCEmV4zkNh2BcoMFBmZ/91WtYZ8qVXSKjiw7fXMgFPnHcSZgOo3XdinHvmnDUeMf5R4wA==",
- "requires": {
- "domelementtype": "1"
- }
- },
- "domutils": {
- "version": "1.5.1",
- "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.5.1.tgz",
- "integrity": "sha512-gSu5Oi/I+3wDENBsOWBiRK1eoGxcywYSqg3rR960/+EfY0CF4EX1VPkgHOZ3WiS/Jg2DtliF6BhWcHlfpYUcGw==",
- "requires": {
- "dom-serializer": "0",
- "domelementtype": "1"
- }
- },
"duplexer": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz",
- "integrity": "sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg=="
+ "integrity": "sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==",
+ "dev": true
},
"ee-first": {
"version": "1.1.1",
@@ -24124,7 +24798,7 @@
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/entities/-/entities-4.4.0.tgz",
"integrity": "sha512-oYp7156SP8LkeGD0GF85ad1X9Ai79WtRsZ2gxJqtBuzH+98YUV6jkHEKlZkMbcrjJjIVJNIDP/3WL9wQkoPbWA==",
- "optional": true
+ "devOptional": true
},
"env-paths": {
"version": "2.2.1",
@@ -24188,6 +24862,37 @@
"integrity": "sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ==",
"dev": true
},
+ "esbuild": {
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.17.8.tgz",
+ "integrity": "sha512-g24ybC3fWhZddZK6R3uD2iF/RIPnRpwJAqLov6ouX3hMbY4+tKolP0VMF3zuIYCaXun+yHwS5IPQ91N2BT191g==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "@esbuild/android-arm": "0.17.8",
+ "@esbuild/android-arm64": "0.17.8",
+ "@esbuild/android-x64": "0.17.8",
+ "@esbuild/darwin-arm64": "0.17.8",
+ "@esbuild/darwin-x64": "0.17.8",
+ "@esbuild/freebsd-arm64": "0.17.8",
+ "@esbuild/freebsd-x64": "0.17.8",
+ "@esbuild/linux-arm": "0.17.8",
+ "@esbuild/linux-arm64": "0.17.8",
+ "@esbuild/linux-ia32": "0.17.8",
+ "@esbuild/linux-loong64": "0.17.8",
+ "@esbuild/linux-mips64el": "0.17.8",
+ "@esbuild/linux-ppc64": "0.17.8",
+ "@esbuild/linux-riscv64": "0.17.8",
+ "@esbuild/linux-s390x": "0.17.8",
+ "@esbuild/linux-x64": "0.17.8",
+ "@esbuild/netbsd-x64": "0.17.8",
+ "@esbuild/openbsd-x64": "0.17.8",
+ "@esbuild/sunos-x64": "0.17.8",
+ "@esbuild/win32-arm64": "0.17.8",
+ "@esbuild/win32-ia32": "0.17.8",
+ "@esbuild/win32-x64": "0.17.8"
+ }
+ },
"esbuild-android-arm64": {
"version": "0.14.11",
"resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.14.11.tgz",
@@ -24294,9 +24999,9 @@
"optional": true
},
"esbuild-wasm": {
- "version": "0.16.17",
- "resolved": "https://registry.npmjs.org/esbuild-wasm/-/esbuild-wasm-0.16.17.tgz",
- "integrity": "sha512-Tn7NuMqRcM+T/qCOxbQRq0qrwWl1sUWp6ARfJRakE8Bepew6zata4qrKgH2YqovNC5e/2fcTa7o+VL/FAOZC1Q==",
+ "version": "0.17.8",
+ "resolved": "https://registry.npmjs.org/esbuild-wasm/-/esbuild-wasm-0.17.8.tgz",
+ "integrity": "sha512-zCmpxv95E0FuCmvdw1K836UHnj4EdiQnFfjTby35y3LAjRPtXMj3sbHDRHjbD8Mqg5lTwq3knacr/1qIFU51CQ==",
"dev": true
},
"esbuild-windows-32": {
@@ -25241,6 +25946,7 @@
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/gzip-size/-/gzip-size-6.0.0.tgz",
"integrity": "sha512-ax7ZYomf6jqPTQ4+XCpUGyXKHk5WweS+e05MBO4/y3WJ5RkmPXNKvX+bx1behVILVwr6JSQvZAku021CHPXG3Q==",
+ "dev": true,
"requires": {
"duplexer": "^0.1.2"
}
@@ -25326,11 +26032,11 @@
"requires": {
"lru-cache": "^7.5.1"
},
- "dependencies": {
- "lru-cache": {
- "version": "7.14.1",
- "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.14.1.tgz",
- "integrity": "sha512-ysxwsnTKdAx96aTRdhDOCQfDgbHnt8SK0KY8SEjO0wHinhWOFTESbjVCMPbU1uGXg/ch4lifqx0wfjOawU2+WA==",
+ "dependencies": {
+ "lru-cache": {
+ "version": "7.18.3",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz",
+ "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==",
"dev": true
}
}
@@ -25348,9 +26054,9 @@
},
"dependencies": {
"readable-stream": {
- "version": "2.3.7",
- "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
- "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
+ "version": "2.3.8",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz",
+ "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==",
"dev": true,
"requires": {
"core-util-is": "~1.0.0",
@@ -25400,26 +26106,6 @@
"integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==",
"dev": true
},
- "htmlparser2": {
- "version": "3.10.1",
- "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.1.tgz",
- "integrity": "sha512-IgieNijUMbkDovyoKObU1DUhm1iwNYE/fuifEoEHfd1oZKZDaONBSkal7Y01shxsM49R4XaMdGez3WnF9UfiCQ==",
- "requires": {
- "domelementtype": "^1.3.1",
- "domhandler": "^2.3.0",
- "domutils": "^1.5.1",
- "entities": "^1.1.1",
- "inherits": "^2.0.1",
- "readable-stream": "^3.1.1"
- },
- "dependencies": {
- "entities": {
- "version": "1.1.2",
- "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz",
- "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w=="
- }
- }
- },
"http-cache-semantics": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz",
@@ -25540,12 +26226,23 @@
"dev": true
},
"ignore-walk": {
- "version": "6.0.0",
- "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-6.0.0.tgz",
- "integrity": "sha512-bTf9UWe/UP1yxG3QUrj/KOvEhTAUWPcv+WvbFZ28LcqznXabp7Xu6o9y1JEC18+oqODuS7VhTpekV5XvFwsxJg==",
+ "version": "6.0.2",
+ "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-6.0.2.tgz",
+ "integrity": "sha512-ezmQ1Dg2b3jVZh2Dh+ar6Eu2MqNSTkyb32HU2MAQQQX9tKM3q/UQ/9lf03lQ5hW+fOeoMnwxwkleZ0xcNp0/qg==",
"dev": true,
"requires": {
- "minimatch": "^5.0.1"
+ "minimatch": "^7.4.2"
+ },
+ "dependencies": {
+ "minimatch": {
+ "version": "7.4.6",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-7.4.6.tgz",
+ "integrity": "sha512-sBz8G/YjVniEz6lKPNpKxXwazJe4c19fEfV2GDMX6AjFz+MX9uDWIZW8XreVhkFW3fkIdTv/gxWr/Kks5FFAVw==",
+ "dev": true,
+ "requires": {
+ "brace-expansion": "^2.0.1"
+ }
+ }
}
},
"image-size": {
@@ -27691,11 +28388,6 @@
"integrity": "sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==",
"dev": true
},
- "junjo": {
- "version": "0.2.8",
- "resolved": "https://registry.npmjs.org/junjo/-/junjo-0.2.8.tgz",
- "integrity": "sha512-aekTv1Qq5BpOSXWlJWgfTsUKsu1gg/+ZluD+9aJfJcOP/BiywM+8owTX/DIZTp9O7V7YOybOXiIftz35JyjjuA=="
- },
"karma-coverage": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/karma-coverage/-/karma-coverage-2.2.0.tgz",
@@ -27872,17 +28564,8 @@
"lodash": {
"version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
- "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
- },
- "lodash.assignin": {
- "version": "4.2.0",
- "resolved": "https://registry.npmjs.org/lodash.assignin/-/lodash.assignin-4.2.0.tgz",
- "integrity": "sha512-yX/rx6d/UTVh7sSVWVSIMjfnz95evAgDFdb1ZozC35I9mSFCkmzptOzevxjgbQUsc78NR44LVHWjsoMQXy9FDg=="
- },
- "lodash.bind": {
- "version": "4.2.1",
- "resolved": "https://registry.npmjs.org/lodash.bind/-/lodash.bind-4.2.1.tgz",
- "integrity": "sha512-lxdsn7xxlCymgLYo1gGvVrfHmkjDiyqVv62FAeF2i5ta72BipE1SLxw8hPEPLhD4/247Ijw07UQH7Hq/chT5LA=="
+ "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
+ "dev": true
},
"lodash.debounce": {
"version": "4.0.8",
@@ -27895,31 +28578,6 @@
"resolved": "https://registry.npmjs.org/lodash.deburr/-/lodash.deburr-4.1.0.tgz",
"integrity": "sha512-m/M1U1f3ddMCs6Hq2tAsYThTBDaAKFDX3dwDo97GEYzamXi9SqUpjWi/Rrj/gf3X2n8ktwgZrlP1z6E3v/IExQ=="
},
- "lodash.defaults": {
- "version": "4.2.0",
- "resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-4.2.0.tgz",
- "integrity": "sha512-qjxPLHd3r5DnsdGacqOMU6pb/avJzdh9tFX2ymgoZE27BmjXrNy/y4LoaiTeAb+O3gL8AfpJGtqfX/ae2leYYQ=="
- },
- "lodash.filter": {
- "version": "4.6.0",
- "resolved": "https://registry.npmjs.org/lodash.filter/-/lodash.filter-4.6.0.tgz",
- "integrity": "sha512-pXYUy7PR8BCLwX5mgJ/aNtyOvuJTdZAo9EQFUvMIYugqmJxnrYaANvTbgndOzHSCSR0wnlBBfRXJL5SbWxo3FQ=="
- },
- "lodash.flatten": {
- "version": "4.4.0",
- "resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz",
- "integrity": "sha512-C5N2Z3DgnnKr0LOpv/hKCgKdb7ZZwafIrsesve6lmzvZIRZRGaZ/l6Q8+2W7NaT+ZwO3fFlSCzCzrDCFdJfZ4g=="
- },
- "lodash.foreach": {
- "version": "4.5.0",
- "resolved": "https://registry.npmjs.org/lodash.foreach/-/lodash.foreach-4.5.0.tgz",
- "integrity": "sha512-aEXTF4d+m05rVOAUG3z4vZZ4xVexLKZGF0lIxuHZ1Hplpk/3B6Z1+/ICICYRLm7c41Z2xiejbkCkJoTlypoXhQ=="
- },
- "lodash.map": {
- "version": "4.6.0",
- "resolved": "https://registry.npmjs.org/lodash.map/-/lodash.map-4.6.0.tgz",
- "integrity": "sha512-worNHGKLDetmcEYDvh2stPCrrQRkP20E4l0iIS7F8EvzMqBBi7ltvFN5m1HvTf1P7Jk1txKhvFcmYsCr8O2F1Q=="
- },
"lodash.memoize": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz",
@@ -27929,27 +28587,8 @@
"lodash.merge": {
"version": "4.6.2",
"resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
- "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ=="
- },
- "lodash.pick": {
- "version": "4.4.0",
- "resolved": "https://registry.npmjs.org/lodash.pick/-/lodash.pick-4.4.0.tgz",
- "integrity": "sha512-hXt6Ul/5yWjfklSGvLQl8vM//l3FtyHZeuelpzK6mm99pNvN9yTDruNZPEJZD1oWrqo+izBmB7oUfWgcCX7s4Q=="
- },
- "lodash.reduce": {
- "version": "4.6.0",
- "resolved": "https://registry.npmjs.org/lodash.reduce/-/lodash.reduce-4.6.0.tgz",
- "integrity": "sha512-6raRe2vxCYBhpBu+B+TtNGUzah+hQjVdu3E17wfusjyrXBka2nBS8OH/gjVZ5PvHOhWmIZTYri09Z6n/QfnNMw=="
- },
- "lodash.reject": {
- "version": "4.6.0",
- "resolved": "https://registry.npmjs.org/lodash.reject/-/lodash.reject-4.6.0.tgz",
- "integrity": "sha512-qkTuvgEzYdyhiJBx42YPzPo71R1aEr0z79kAv7Ixg8wPFEjgRgJdUsGMG3Hf3OYSF/kHI79XhNlt+5Ar6OzwxQ=="
- },
- "lodash.some": {
- "version": "4.6.0",
- "resolved": "https://registry.npmjs.org/lodash.some/-/lodash.some-4.6.0.tgz",
- "integrity": "sha512-j7MJE+TuT51q9ggt4fSgVqro163BEFjAt3u97IqU+JA2DkWl80nFTrowzLpZ/BnpN7rrl0JA/593NAdd8p/scQ=="
+ "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==",
+ "dev": true
},
"log-symbols": {
"version": "4.1.0",
@@ -28113,9 +28752,9 @@
}
},
"lru-cache": {
- "version": "7.14.1",
- "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.14.1.tgz",
- "integrity": "sha512-ysxwsnTKdAx96aTRdhDOCQfDgbHnt8SK0KY8SEjO0wHinhWOFTESbjVCMPbU1uGXg/ch4lifqx0wfjOawU2+WA==",
+ "version": "7.18.3",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz",
+ "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==",
"dev": true
},
"minipass": {
@@ -28128,9 +28767,9 @@
}
},
"semver": {
- "version": "7.3.8",
- "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz",
- "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==",
+ "version": "7.4.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz",
+ "integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==",
"dev": true,
"requires": {
"lru-cache": "^6.0.0"
@@ -28291,9 +28930,9 @@
}
},
"minipass": {
- "version": "4.0.1",
- "resolved": "https://registry.npmjs.org/minipass/-/minipass-4.0.1.tgz",
- "integrity": "sha512-V9esFpNbK0arbN3fm2sxDKqMYgIp7XtVdE4Esj+PE4Qaaxdg1wIw48ITQIOn1sc8xXSmUviVL3cyjMqPlrVkiA==",
+ "version": "4.2.8",
+ "resolved": "https://registry.npmjs.org/minipass/-/minipass-4.2.8.tgz",
+ "integrity": "sha512-fNzuVyifolSLFL4NzpF+wEF4qrgqaaKX0haXPQEdQ7NKAN+WecoKMHV09YcuL/DHxrUsYQOK3MiuDf7Ip2OXfQ==",
"dev": true
},
"minipass-collect": {
@@ -28492,7 +29131,8 @@
"mrmime": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/mrmime/-/mrmime-1.0.1.tgz",
- "integrity": "sha512-hzzEagAgDyoU1Q6yg5uI+AorQgdvMCur3FcKf7NhMKWsaYg+RnbTyHRa/9IlLF9rf455MOCtcqqrQQ83pPP7Uw=="
+ "integrity": "sha512-hzzEagAgDyoU1Q6yg5uI+AorQgdvMCur3FcKf7NhMKWsaYg+RnbTyHRa/9IlLF9rf455MOCtcqqrQQ83pPP7Uw==",
+ "dev": true
},
"ms": {
"version": "2.1.2",
@@ -28587,44 +29227,35 @@
"tslib": "^2.0.0"
}
},
- "ng-swipe": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/ng-swipe/-/ng-swipe-2.0.1.tgz",
- "integrity": "sha512-y4w2d719VK1u6KUlNqhHVevzT+yR30bnTTLkFNEsVG3Gp5+oZhUnflVNWfzIw+O8GCjZqVLelwla/jOkqUclmQ==",
- "requires": {
- "ag-swipe-core": "^1.0.0",
- "tslib": "^2.3.0"
- }
- },
"ngx-color-picker": {
- "version": "13.0.0",
- "resolved": "https://registry.npmjs.org/ngx-color-picker/-/ngx-color-picker-13.0.0.tgz",
- "integrity": "sha512-3mgMbs21KeqnmmY5p1cn71ckTH3q7gBt6Qn0fMfeF/Ql7ddTZsW4Z7Z8ga6LymMP/ugooGuLOFX+V6yx0dDxAw==",
+ "version": "14.0.0",
+ "resolved": "https://registry.npmjs.org/ngx-color-picker/-/ngx-color-picker-14.0.0.tgz",
+ "integrity": "sha512-w28zx2DyVpIJeNsTB3T2LUI4Ed/Ujf5Uhxuh0dllputfpxXwZG9ocSJM/0L67+fxA3UnfvvXVZNUX1Ny5nZIIw==",
"requires": {
"tslib": "^2.3.0"
}
},
"ngx-extended-pdf-viewer": {
- "version": "15.2.2",
- "resolved": "https://registry.npmjs.org/ngx-extended-pdf-viewer/-/ngx-extended-pdf-viewer-15.2.2.tgz",
- "integrity": "sha512-IibJ4633TosuAJDtazQiPkVx2G8+tDgs3Nnup9vjwH4f0UqmLA6NdTH7qwwCPdHJxlogRUkCHYNPlP5jB5PmPg==",
+ "version": "16.2.16",
+ "resolved": "https://registry.npmjs.org/ngx-extended-pdf-viewer/-/ngx-extended-pdf-viewer-16.2.16.tgz",
+ "integrity": "sha512-C4gTb6IdzEUbPe1n72pLZbsEQWwH8VSAXPGWI88XeCpnplDBxkiMGJ/5UdyxOiT30GDYxsjNWq+yZhD87XfH6w==",
"requires": {
"lodash.deburr": "^4.1.0",
"tslib": "^2.3.0"
}
},
"ngx-file-drop": {
- "version": "14.0.2",
- "resolved": "https://registry.npmjs.org/ngx-file-drop/-/ngx-file-drop-14.0.2.tgz",
- "integrity": "sha512-tIW+Ymd2IOjUQTqMb2NiuupeRPWwKe19kHmb13gf4Iw8rkvrO6PlqqZ3EqSGPIEJOmV836FZHpM4B1xXjVQLfA==",
+ "version": "15.0.0",
+ "resolved": "https://registry.npmjs.org/ngx-file-drop/-/ngx-file-drop-15.0.0.tgz",
+ "integrity": "sha512-P1BRa9w+l6CFCQFEHRaUcQy8DvrgwMnWZUWwndcXQ+Qqqa3BOXfrN26uDd+px9FD/P5OkKidhglI7VRX6qmLwg==",
"requires": {
"tslib": "^2.3.0"
}
},
"ngx-slider-v2": {
- "version": "15.0.3",
- "resolved": "https://registry.npmjs.org/ngx-slider-v2/-/ngx-slider-v2-15.0.3.tgz",
- "integrity": "sha512-dzFUHH3PWo7tRDopMocLcF7CjYNrXI9P3/5RwlZMHLazaru0qHMlukrUzp8FvuZWTD1CX6hAhDrDevHgMOUiFA==",
+ "version": "15.0.4",
+ "resolved": "https://registry.npmjs.org/ngx-slider-v2/-/ngx-slider-v2-15.0.4.tgz",
+ "integrity": "sha512-+ohkyhWa2J1u04Wm1g2yBH5MEiwVGQqbCbOUXISAwl0Vcv6xOHYkJNcDOa4f0lINu9ozmCaozA0KH0SkPss6pw==",
"requires": {
"detect-passive-events": "^2.0.3",
"rxjs": "^7.4.0",
@@ -28632,9 +29263,9 @@
}
},
"ngx-toastr": {
- "version": "16.0.2",
- "resolved": "https://registry.npmjs.org/ngx-toastr/-/ngx-toastr-16.0.2.tgz",
- "integrity": "sha512-J6SueNCaGwm/gpXdsG56UzMEAcuayYWEW6NmIrNoe5iP7lOUohg4xYXWipkbMH9wGWmLPD9gU8AufUVWMplCvg==",
+ "version": "16.1.1",
+ "resolved": "https://registry.npmjs.org/ngx-toastr/-/ngx-toastr-16.1.1.tgz",
+ "integrity": "sha512-obUGE5RYC/62/AYiZvZcVw/mMBSI0KGJH7VhdiQQ2jsysp05m8nndI1shGhm6X1t/6/z/qj7NFpvSuUyhdweNg==",
"requires": {
"tslib": "^2.3.0"
}
@@ -28732,9 +29363,9 @@
}
},
"semver": {
- "version": "7.3.8",
- "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz",
- "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==",
+ "version": "7.4.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz",
+ "integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==",
"dev": true,
"requires": {
"lru-cache": "^6.0.0"
@@ -28797,9 +29428,9 @@
}
},
"semver": {
- "version": "7.3.8",
- "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz",
- "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==",
+ "version": "7.4.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz",
+ "integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==",
"dev": true,
"requires": {
"lru-cache": "^6.0.0"
@@ -28834,9 +29465,9 @@
}
},
"npm-install-checks": {
- "version": "6.0.0",
- "resolved": "https://registry.npmjs.org/npm-install-checks/-/npm-install-checks-6.0.0.tgz",
- "integrity": "sha512-SBU9oFglRVZnfElwAtF14NivyulDqF1VKqqwNsFW9HDcbHMAPHpRSsVFgKuwFGq/hVvWZExz62Th0kvxn/XE7Q==",
+ "version": "6.1.1",
+ "resolved": "https://registry.npmjs.org/npm-install-checks/-/npm-install-checks-6.1.1.tgz",
+ "integrity": "sha512-dH3GmQL4vsPtld59cOn8uY0iOqRmqKvV+DLGwNXV/Q7MDgD2QfOADWd/mFXcIE5LVhYYGjA3baz6W9JneqnuCw==",
"dev": true,
"requires": {
"semver": "^7.1.1"
@@ -28852,9 +29483,9 @@
}
},
"semver": {
- "version": "7.3.8",
- "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz",
- "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==",
+ "version": "7.4.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz",
+ "integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==",
"dev": true,
"requires": {
"lru-cache": "^6.0.0"
@@ -28896,9 +29527,9 @@
}
},
"semver": {
- "version": "7.3.8",
- "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz",
- "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==",
+ "version": "7.4.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz",
+ "integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==",
"dev": true,
"requires": {
"lru-cache": "^6.0.0"
@@ -28943,9 +29574,9 @@
}
},
"semver": {
- "version": "7.3.8",
- "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz",
- "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==",
+ "version": "7.4.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz",
+ "integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==",
"dev": true,
"requires": {
"lru-cache": "^6.0.0"
@@ -28960,9 +29591,9 @@
}
},
"npm-registry-fetch": {
- "version": "14.0.3",
- "resolved": "https://registry.npmjs.org/npm-registry-fetch/-/npm-registry-fetch-14.0.3.tgz",
- "integrity": "sha512-YaeRbVNpnWvsGOjX2wk5s85XJ7l1qQBGAp724h8e2CZFFhMSuw9enom7K1mWVUtvXO1uUSFIAPofQK0pPN0ZcA==",
+ "version": "14.0.4",
+ "resolved": "https://registry.npmjs.org/npm-registry-fetch/-/npm-registry-fetch-14.0.4.tgz",
+ "integrity": "sha512-pMS2DRkwg+M44ct65zrN/Cr9IHK1+n6weuefAo6Er4lc+/8YBCU0Czq04H3ZiSigluh7pb2rMM5JpgcytctB+Q==",
"dev": true,
"requires": {
"make-fetch-happen": "^11.0.0",
@@ -28975,26 +29606,25 @@
},
"dependencies": {
"lru-cache": {
- "version": "7.14.1",
- "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.14.1.tgz",
- "integrity": "sha512-ysxwsnTKdAx96aTRdhDOCQfDgbHnt8SK0KY8SEjO0wHinhWOFTESbjVCMPbU1uGXg/ch4lifqx0wfjOawU2+WA==",
+ "version": "7.18.3",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz",
+ "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==",
"dev": true
},
"make-fetch-happen": {
- "version": "11.0.2",
- "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-11.0.2.tgz",
- "integrity": "sha512-5n/Pq41w/uZghpdlXAY5kIM85RgJThtTH/NYBRAZ9VUOBWV90USaQjwGrw76fZP3Lj5hl/VZjpVvOaRBMoL/2w==",
+ "version": "11.1.0",
+ "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-11.1.0.tgz",
+ "integrity": "sha512-7ChuOzCb1LzdQZrTy0ky6RsCoMYeM+Fh4cY0+4zsJVhNcH5Q3OJojLY1mGkD0xAhWB29lskECVb6ZopofwjldA==",
"dev": true,
"requires": {
"agentkeepalive": "^4.2.1",
"cacache": "^17.0.0",
- "http-cache-semantics": "^4.1.0",
+ "http-cache-semantics": "^4.1.1",
"http-proxy-agent": "^5.0.0",
"https-proxy-agent": "^5.0.0",
"is-lambda": "^1.0.1",
"lru-cache": "^7.7.1",
"minipass": "^4.0.0",
- "minipass-collect": "^1.0.2",
"minipass-fetch": "^3.0.0",
"minipass-flush": "^1.0.5",
"minipass-pipeline": "^1.2.4",
@@ -29005,9 +29635,9 @@
}
},
"minipass-fetch": {
- "version": "3.0.1",
- "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-3.0.1.tgz",
- "integrity": "sha512-t9/wowtf7DYkwz8cfMSt0rMwiyNIBXf5CKZ3S5ZMqRqMYT0oLTp0x1WorMI9WTwvaPg21r1JbFxJMum8JrLGfw==",
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-3.0.2.tgz",
+ "integrity": "sha512-/ZpF1CQaWYqjbhfFgKNt3azxztEpc/JUPuMkqOgrnMQqcU8CbE409AUdJYTIWryl3PP5CBaTJZT71N49MXP/YA==",
"dev": true,
"requires": {
"encoding": "^0.1.13",
@@ -29039,14 +29669,6 @@
"set-blocking": "^2.0.0"
}
},
- "nth-check": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-1.0.2.tgz",
- "integrity": "sha512-WeBOdju8SnzPN5vTUJYxYUxLeXpCaVP5i5e0LF8fg7WORF2Wd7wFX/pk0tYZk7s8T+J7VLy0Da6J1+wCT0AtHg==",
- "requires": {
- "boolbase": "~1.0.0"
- }
- },
"nwsapi": {
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.2.tgz",
@@ -29126,9 +29748,9 @@
}
},
"open": {
- "version": "8.4.0",
- "resolved": "https://registry.npmjs.org/open/-/open-8.4.0.tgz",
- "integrity": "sha512-XgFPPM+B28FtCCgSb9I+s9szOC1vZRSwgWsRUA5ylIxRTgKozqjOCrVOqGsYABPYK5qnfqClxZTFBa8PKt2v6Q==",
+ "version": "8.4.1",
+ "resolved": "https://registry.npmjs.org/open/-/open-8.4.1.tgz",
+ "integrity": "sha512-/4b7qZNhv6Uhd7jjnREh1NjnPxlTq+XNWPG88Ydkj5AILcA5m3ajvcg57pB24EQjKv0dK62XnDqk9c/hkIG5Kg==",
"dev": true,
"requires": {
"define-lazy-prop": "^2.0.0",
@@ -29139,7 +29761,8 @@
"opener": {
"version": "1.5.2",
"resolved": "https://registry.npmjs.org/opener/-/opener-1.5.2.tgz",
- "integrity": "sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A=="
+ "integrity": "sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A==",
+ "dev": true
},
"optionator": {
"version": "0.9.1",
@@ -29264,6 +29887,14 @@
"requires": {
"@types/retry": "0.12.0",
"retry": "^0.13.1"
+ },
+ "dependencies": {
+ "retry": {
+ "version": "0.13.1",
+ "resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz",
+ "integrity": "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==",
+ "dev": true
+ }
}
},
"p-try": {
@@ -29273,9 +29904,9 @@
"dev": true
},
"pacote": {
- "version": "15.0.8",
- "resolved": "https://registry.npmjs.org/pacote/-/pacote-15.0.8.tgz",
- "integrity": "sha512-UlcumB/XS6xyyIMwg/WwMAyUmga+RivB5KgkRwA1hZNtrx+0Bt41KxHCvg1kr0pZ/ZeD8qjhW4fph6VaYRCbLw==",
+ "version": "15.1.0",
+ "resolved": "https://registry.npmjs.org/pacote/-/pacote-15.1.0.tgz",
+ "integrity": "sha512-FFcjtIl+BQNfeliSm7MZz5cpdohvUV1yjGnqgVM4UnVF7JslRY0ImXAygdaCDV0jjUADEWu4y5xsDV8brtrTLg==",
"dev": true,
"requires": {
"@npmcli/git": "^4.0.0",
@@ -29293,6 +29924,7 @@
"promise-retry": "^2.0.1",
"read-package-json": "^6.0.0",
"read-package-json-fast": "^3.0.0",
+ "sigstore": "^1.0.0",
"ssri": "^10.0.0",
"tar": "^6.1.11"
}
@@ -29334,27 +29966,20 @@
"version": "7.1.2",
"resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz",
"integrity": "sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==",
- "optional": true,
+ "devOptional": true,
"requires": {
"entities": "^4.4.0"
}
},
"parse5-html-rewriting-stream": {
- "version": "6.0.1",
- "resolved": "https://registry.npmjs.org/parse5-html-rewriting-stream/-/parse5-html-rewriting-stream-6.0.1.tgz",
- "integrity": "sha512-vwLQzynJVEfUlURxgnf51yAJDQTtVpNyGD8tKi2Za7m+akukNHxCcUQMAa/mUGLhCeicFdpy7Tlvj8ZNKadprg==",
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/parse5-html-rewriting-stream/-/parse5-html-rewriting-stream-7.0.0.tgz",
+ "integrity": "sha512-mazCyGWkmCRWDI15Zp+UiCqMp/0dgEmkZRvhlsqqKYr4SsVm/TvnSpD9fCvqCA2zoWJcfRym846ejWBBHRiYEg==",
"dev": true,
"requires": {
- "parse5": "^6.0.1",
- "parse5-sax-parser": "^6.0.1"
- },
- "dependencies": {
- "parse5": {
- "version": "6.0.1",
- "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz",
- "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==",
- "dev": true
- }
+ "entities": "^4.3.0",
+ "parse5": "^7.0.0",
+ "parse5-sax-parser": "^7.0.0"
}
},
"parse5-htmlparser2-tree-adapter": {
@@ -29375,20 +30000,12 @@
}
},
"parse5-sax-parser": {
- "version": "6.0.1",
- "resolved": "https://registry.npmjs.org/parse5-sax-parser/-/parse5-sax-parser-6.0.1.tgz",
- "integrity": "sha512-kXX+5S81lgESA0LsDuGjAlBybImAChYRMT+/uKCEXFBFOeEhS52qUCydGhU3qLRD8D9DVjaUo821WK7DM4iCeg==",
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/parse5-sax-parser/-/parse5-sax-parser-7.0.0.tgz",
+ "integrity": "sha512-5A+v2SNsq8T6/mG3ahcz8ZtQ0OUFTatxPbeidoMB7tkJSGDY3tdfl4MHovtLQHkEn5CGxijNWRQHhRQ6IRpXKg==",
"dev": true,
"requires": {
- "parse5": "^6.0.1"
- },
- "dependencies": {
- "parse5": {
- "version": "6.0.1",
- "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz",
- "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==",
- "dev": true
- }
+ "parse5": "^7.0.0"
}
},
"parseurl": {
@@ -29421,6 +30038,30 @@
"integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
"dev": true
},
+ "path-scurry": {
+ "version": "1.6.4",
+ "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.6.4.tgz",
+ "integrity": "sha512-Qp/9IHkdNiXJ3/Kon++At2nVpnhRiPq/aSvQN+H3U1WZbvNRK0RIQK/o4HMqPoXjpuGJUEWpHSs6Mnjxqh3TQg==",
+ "dev": true,
+ "requires": {
+ "lru-cache": "^9.0.0",
+ "minipass": "^5.0.0"
+ },
+ "dependencies": {
+ "lru-cache": {
+ "version": "9.0.2",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-9.0.2.tgz",
+ "integrity": "sha512-7zYMKApzQ9qQE13xQUzbXVY3p2C5lh+9V+bs8M9fRf1TF59id+8jkljRWtIPfBfNP4yQAol5cqh/e8clxatdXw==",
+ "dev": true
+ },
+ "minipass": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz",
+ "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==",
+ "dev": true
+ }
+ }
+ },
"path-to-regexp": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
@@ -29651,14 +30292,6 @@
"requires": {
"err-code": "^2.0.2",
"retry": "^0.12.0"
- },
- "dependencies": {
- "retry": {
- "version": "0.12.0",
- "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz",
- "integrity": "sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==",
- "dev": true
- }
}
},
"prompts": {
@@ -29768,22 +30401,43 @@
"dev": true
},
"read-package-json": {
- "version": "6.0.0",
- "resolved": "https://registry.npmjs.org/read-package-json/-/read-package-json-6.0.0.tgz",
- "integrity": "sha512-b/9jxWJ8EwogJPpv99ma+QwtqB7FSl3+V6UXS7Aaay8/5VwMY50oIFooY1UKXMWpfNCM6T/PoGqa5GD1g9xf9w==",
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/read-package-json/-/read-package-json-6.0.1.tgz",
+ "integrity": "sha512-AaHqXxfAVa+fNL07x8iAghfKOds/XXsu7zoouIVsbm7PEbQ3nMWXlvjcbrNLjElnUHWQtAo4QEa0RXuvD4XlpA==",
"dev": true,
"requires": {
- "glob": "^8.0.1",
+ "glob": "^9.3.0",
"json-parse-even-better-errors": "^3.0.0",
"normalize-package-data": "^5.0.0",
"npm-normalize-package-bin": "^3.0.0"
},
"dependencies": {
+ "glob": {
+ "version": "9.3.5",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-9.3.5.tgz",
+ "integrity": "sha512-e1LleDykUz2Iu+MTYdkSsuWX8lvAjAcs0Xef0lNIu0S2wOAzuTxCJtcd9S3cijlwYF18EsU3rzb8jPVobxDh9Q==",
+ "dev": true,
+ "requires": {
+ "fs.realpath": "^1.0.0",
+ "minimatch": "^8.0.2",
+ "minipass": "^4.2.4",
+ "path-scurry": "^1.6.1"
+ }
+ },
"json-parse-even-better-errors": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-3.0.0.tgz",
"integrity": "sha512-iZbGHafX/59r39gPwVPRBGw0QQKnA7tte5pSMrhWOW7swGsVvVTjmfyAV9pNqk8YGT7tRCdxRu8uzcgZwoDooA==",
"dev": true
+ },
+ "minimatch": {
+ "version": "8.0.4",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-8.0.4.tgz",
+ "integrity": "sha512-W0Wvr9HyFXZRGIDgCicunpQ299OKXs9RgZfaukz4qAW/pJhcpUfupc9c+OObPOFueNy8VSrZgEmDtk6Kh4WzDA==",
+ "dev": true,
+ "requires": {
+ "brace-expansion": "^2.0.1"
+ }
}
}
},
@@ -29809,6 +30463,7 @@
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
"integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
+ "dev": true,
"requires": {
"inherits": "^2.0.3",
"string_decoder": "^1.1.1",
@@ -30009,9 +30664,9 @@
}
},
"retry": {
- "version": "0.13.1",
- "resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz",
- "integrity": "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==",
+ "version": "0.12.0",
+ "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz",
+ "integrity": "sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==",
"dev": true
},
"reusify": {
@@ -30095,7 +30750,8 @@
"safe-buffer": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
- "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="
+ "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
+ "dev": true
},
"safer-buffer": {
"version": "2.1.2",
@@ -30104,9 +30760,9 @@
"devOptional": true
},
"sass": {
- "version": "1.57.1",
- "resolved": "https://registry.npmjs.org/sass/-/sass-1.57.1.tgz",
- "integrity": "sha512-O2+LwLS79op7GI0xZ8fqzF7X2m/m8WFfI02dHOdsK5R2ECeS5F62zrwg/relM1rjSLy7Vd/DiMNIvPrQGsA0jw==",
+ "version": "1.58.1",
+ "resolved": "https://registry.npmjs.org/sass/-/sass-1.58.1.tgz",
+ "integrity": "sha512-bnINi6nPXbP1XNRaranMFEBZWUfdW/AF16Ql5+ypRxfTvCRTTKrLsMIakyDcayUt2t/RZotmL4kgJwNH5xO+bg==",
"dev": true,
"requires": {
"chokidar": ">=3.0.0 <4.0.0",
@@ -30384,10 +31040,65 @@
"integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
"dev": true
},
+ "sigstore": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/sigstore/-/sigstore-1.2.0.tgz",
+ "integrity": "sha512-Fr9+W1nkBSIZCkJQR7jDn/zI0UXNsVpp+7mDQkCnZOIxG9p6yNXBx9xntHsfUyYHE55XDkkVV3+rYbrkzAeesA==",
+ "dev": true,
+ "requires": {
+ "@sigstore/protobuf-specs": "^0.1.0",
+ "make-fetch-happen": "^11.0.1",
+ "tuf-js": "^1.0.0"
+ },
+ "dependencies": {
+ "lru-cache": {
+ "version": "7.18.3",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz",
+ "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==",
+ "dev": true
+ },
+ "make-fetch-happen": {
+ "version": "11.1.0",
+ "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-11.1.0.tgz",
+ "integrity": "sha512-7ChuOzCb1LzdQZrTy0ky6RsCoMYeM+Fh4cY0+4zsJVhNcH5Q3OJojLY1mGkD0xAhWB29lskECVb6ZopofwjldA==",
+ "dev": true,
+ "requires": {
+ "agentkeepalive": "^4.2.1",
+ "cacache": "^17.0.0",
+ "http-cache-semantics": "^4.1.1",
+ "http-proxy-agent": "^5.0.0",
+ "https-proxy-agent": "^5.0.0",
+ "is-lambda": "^1.0.1",
+ "lru-cache": "^7.7.1",
+ "minipass": "^4.0.0",
+ "minipass-fetch": "^3.0.0",
+ "minipass-flush": "^1.0.5",
+ "minipass-pipeline": "^1.2.4",
+ "negotiator": "^0.6.3",
+ "promise-retry": "^2.0.1",
+ "socks-proxy-agent": "^7.0.0",
+ "ssri": "^10.0.0"
+ }
+ },
+ "minipass-fetch": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-3.0.2.tgz",
+ "integrity": "sha512-/ZpF1CQaWYqjbhfFgKNt3azxztEpc/JUPuMkqOgrnMQqcU8CbE409AUdJYTIWryl3PP5CBaTJZT71N49MXP/YA==",
+ "dev": true,
+ "requires": {
+ "encoding": "^0.1.13",
+ "minipass": "^4.0.0",
+ "minipass-sized": "^1.0.3",
+ "minizlib": "^2.1.2"
+ }
+ }
+ }
+ },
"sirv": {
"version": "1.0.19",
"resolved": "https://registry.npmjs.org/sirv/-/sirv-1.0.19.tgz",
"integrity": "sha512-JuLThK3TnZG1TAKDwNIqNq6QA2afLOCcm+iE8D1Kj3GA40pSPsxQjjJl0J8X3tsR7T+CP1GavpzLwYkgVLWrZQ==",
+ "dev": true,
"requires": {
"@polka/url": "^1.0.0-next.20",
"mrmime": "^1.0.0",
@@ -30497,9 +31208,9 @@
}
},
"spdx-correct": {
- "version": "3.1.1",
- "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz",
- "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==",
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz",
+ "integrity": "sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==",
"dev": true,
"requires": {
"spdx-expression-parse": "^3.0.0",
@@ -30523,9 +31234,9 @@
}
},
"spdx-license-ids": {
- "version": "3.0.12",
- "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.12.tgz",
- "integrity": "sha512-rr+VVSXtRhO4OHbXUiAF7xW3Bo9DuuF6C5jH+q/x15j2jniycgKbxU09Hr0WqlSLUs4i4ltHGXqTe7VHclYWyA==",
+ "version": "3.0.13",
+ "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.13.tgz",
+ "integrity": "sha512-XkD+zwiqXHikFZm4AX/7JSCXA98U5Db4AFd5XUg/+9UNtnH75+Z9KxtpYiJZx36mUDVOwH83pl7yvCer6ewM3w==",
"dev": true
},
"spdy": {
@@ -30611,6 +31322,7 @@
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
+ "dev": true,
"requires": {
"safe-buffer": "~5.2.0"
}
@@ -30771,11 +31483,6 @@
}
}
},
- "termcolor": {
- "version": "0.2.0",
- "resolved": "https://registry.npmjs.org/termcolor/-/termcolor-0.2.0.tgz",
- "integrity": "sha512-BJ/FFGl0cQAyYYmUurkqQUJA9RyD2PFt9YNd24nlt7HkeuZqUmHL86ELvaY6JY/TLUvmxzJY9/fHHk3jFibUSg=="
- },
"terminal-link": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/terminal-link/-/terminal-link-2.1.1.tgz",
@@ -30787,9 +31494,9 @@
}
},
"terser": {
- "version": "5.16.1",
- "resolved": "https://registry.npmjs.org/terser/-/terser-5.16.1.tgz",
- "integrity": "sha512-xvQfyfA1ayT0qdK47zskQgRZeWLoOQ8JQ6mIgRGVNwZKdQMU+5FkCBjmv4QjcrTzyZquRw2FVtlJSRUmMKQslw==",
+ "version": "5.16.3",
+ "resolved": "https://registry.npmjs.org/terser/-/terser-5.16.3.tgz",
+ "integrity": "sha512-v8wWLaS/xt3nE9dgKEWhNUFP6q4kngO5B8eYFUuebsu7Dw/UNAnpUod6UHo04jSSkv8TzKHjZDSd7EXdDQAl8Q==",
"dev": true,
"requires": {
"@jridgewell/source-map": "^0.3.2",
@@ -30964,7 +31671,8 @@
"totalist": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/totalist/-/totalist-1.1.0.tgz",
- "integrity": "sha512-gduQwd1rOdDMGxFG1gEvhV88Oirdo2p+KjoYFU7k2g+i7n6AFFbDQ5kMPUsW0pNbfQsB/cwXvT1i4Bue0s9g5g=="
+ "integrity": "sha512-gduQwd1rOdDMGxFG1gEvhV88Oirdo2p+KjoYFU7k2g+i7n6AFFbDQ5kMPUsW0pNbfQsB/cwXvT1i4Bue0s9g5g==",
+ "dev": true
},
"tough-cookie": {
"version": "4.1.2",
@@ -31079,6 +31787,59 @@
}
}
},
+ "tuf-js": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/tuf-js/-/tuf-js-1.1.3.tgz",
+ "integrity": "sha512-jGYi5nG/kqgfTFQSdoN6PW9eIn+XRZqdXku+fSwNk6UpWIsWaV7pzAqPgFr85edOPhoyJDyBqCS+DCnHroMvrw==",
+ "dev": true,
+ "requires": {
+ "@tufjs/models": "1.0.2",
+ "make-fetch-happen": "^11.0.1"
+ },
+ "dependencies": {
+ "lru-cache": {
+ "version": "7.18.3",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz",
+ "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==",
+ "dev": true
+ },
+ "make-fetch-happen": {
+ "version": "11.1.0",
+ "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-11.1.0.tgz",
+ "integrity": "sha512-7ChuOzCb1LzdQZrTy0ky6RsCoMYeM+Fh4cY0+4zsJVhNcH5Q3OJojLY1mGkD0xAhWB29lskECVb6ZopofwjldA==",
+ "dev": true,
+ "requires": {
+ "agentkeepalive": "^4.2.1",
+ "cacache": "^17.0.0",
+ "http-cache-semantics": "^4.1.1",
+ "http-proxy-agent": "^5.0.0",
+ "https-proxy-agent": "^5.0.0",
+ "is-lambda": "^1.0.1",
+ "lru-cache": "^7.7.1",
+ "minipass": "^4.0.0",
+ "minipass-fetch": "^3.0.0",
+ "minipass-flush": "^1.0.5",
+ "minipass-pipeline": "^1.2.4",
+ "negotiator": "^0.6.3",
+ "promise-retry": "^2.0.1",
+ "socks-proxy-agent": "^7.0.0",
+ "ssri": "^10.0.0"
+ }
+ },
+ "minipass-fetch": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-3.0.2.tgz",
+ "integrity": "sha512-/ZpF1CQaWYqjbhfFgKNt3azxztEpc/JUPuMkqOgrnMQqcU8CbE409AUdJYTIWryl3PP5CBaTJZT71N49MXP/YA==",
+ "dev": true,
+ "requires": {
+ "encoding": "^0.1.13",
+ "minipass": "^4.0.0",
+ "minipass-sized": "^1.0.3",
+ "minizlib": "^2.1.2"
+ }
+ }
+ }
+ },
"type-check": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
@@ -31130,11 +31891,6 @@
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.4.tgz",
"integrity": "sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg=="
},
- "u2r": {
- "version": "0.1.3",
- "resolved": "https://registry.npmjs.org/u2r/-/u2r-0.1.3.tgz",
- "integrity": "sha512-OqMjkw3si8wJyuK6RzBQCuJjbDmCm7LEBoQEMrZg1hUtwXBhZxZzEnxUF/Mky3zesSPfwRud5xbvoH7lzoiS3Q=="
- },
"unicode-canonical-property-names-ecmascript": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz",
@@ -31222,7 +31978,8 @@
"util-deprecate": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
- "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
+ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",
+ "dev": true
},
"utils-merge": {
"version": "1.0.1",
@@ -31339,9 +32096,9 @@
"integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="
},
"webpack": {
- "version": "5.75.0",
- "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.75.0.tgz",
- "integrity": "sha512-piaIaoVJlqMsPtX/+3KTTO6jfvrSYgauFVdt8cr9LTHKmcq/AMd4mhzsiP7ZF/PGRNPGA8336jldh9l2Kt2ogQ==",
+ "version": "5.76.1",
+ "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.76.1.tgz",
+ "integrity": "sha512-4+YIK4Abzv8172/SGqObnUjaIHjLEuUasz9EwQj/9xmPPkYJy2Mh03Q/lJfSD3YLzbxy5FeTq5Uw0323Oh6SJQ==",
"dev": true,
"requires": {
"@types/eslint-scope": "^3.7.3",
@@ -31409,10 +32166,12 @@
}
},
"webpack-bundle-analyzer": {
- "version": "4.7.0",
- "resolved": "https://registry.npmjs.org/webpack-bundle-analyzer/-/webpack-bundle-analyzer-4.7.0.tgz",
- "integrity": "sha512-j9b8ynpJS4K+zfO5GGwsAcQX4ZHpWV+yRiHDiL+bE0XHJ8NiPYLTNVQdlFYWxtpg9lfAQNlwJg16J9AJtFSXRg==",
+ "version": "4.8.0",
+ "resolved": "https://registry.npmjs.org/webpack-bundle-analyzer/-/webpack-bundle-analyzer-4.8.0.tgz",
+ "integrity": "sha512-ZzoSBePshOKhr+hd8u6oCkZVwpVaXgpw23ScGLFpR6SjYI7+7iIWYarjN6OEYOfRt8o7ZyZZQk0DuMizJ+LEIg==",
+ "dev": true,
"requires": {
+ "@discoveryjs/json-ext": "0.5.7",
"acorn": "^8.0.4",
"acorn-walk": "^8.0.0",
"chalk": "^4.1.0",
@@ -31428,6 +32187,7 @@
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
+ "dev": true,
"requires": {
"color-convert": "^2.0.1"
}
@@ -31436,6 +32196,7 @@
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
+ "dev": true,
"requires": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
@@ -31445,6 +32206,7 @@
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dev": true,
"requires": {
"color-name": "~1.1.4"
}
@@ -31452,17 +32214,20 @@
"color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
- "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "dev": true
},
"has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
- "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "dev": true
},
"supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
+ "dev": true,
"requires": {
"has-flag": "^4.0.0"
}
@@ -31533,9 +32298,9 @@
}
},
"ws": {
- "version": "8.12.0",
- "resolved": "https://registry.npmjs.org/ws/-/ws-8.12.0.tgz",
- "integrity": "sha512-kU62emKIdKVeEIOIKVegvqpXMSTAMLJozpHZaJNDYqBjzlSYXQGviYwN1osDLJ9av68qHd4a2oSjd7yD4pacig==",
+ "version": "8.13.0",
+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz",
+ "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==",
"dev": true,
"requires": {}
}
diff --git a/UI/Web/package.json b/UI/Web/package.json
index 9fd596eef..7aad5645a 100644
--- a/UI/Web/package.json
+++ b/UI/Web/package.json
@@ -15,54 +15,50 @@
},
"private": true,
"dependencies": {
- "@angular/animations": "^15.1.2",
- "@angular/cdk": "^15.1.2",
- "@angular/common": "^15.1.2",
- "@angular/compiler": "^15.1.2",
- "@angular/core": "^15.1.2",
- "@angular/forms": "^15.1.2",
- "@angular/localize": "^15.1.2",
- "@angular/platform-browser": "^15.1.2",
- "@angular/platform-browser-dynamic": "^15.1.2",
- "@angular/router": "^15.1.2",
+ "@angular/animations": "^15.2.7",
+ "@angular/cdk": "^15.2.7",
+ "@angular/common": "^15.2.7",
+ "@angular/compiler": "^15.2.7",
+ "@angular/core": "^15.2.7",
+ "@angular/forms": "^15.2.7",
+ "@angular/localize": "^15.2.7",
+ "@angular/platform-browser": "^15.2.7",
+ "@angular/platform-browser-dynamic": "^15.2.7",
+ "@angular/router": "^15.2.7",
"@fortawesome/fontawesome-free": "^6.2.0",
- "@iharbeck/ngx-virtual-scroller": "^15.0.0",
+ "@iharbeck/ngx-virtual-scroller": "^15.2.0",
"@iplab/ngx-file-upload": "^15.0.0",
- "@microsoft/signalr": "^7.0.2",
+ "@microsoft/signalr": "^7.0.5",
"@ng-bootstrap/ng-bootstrap": "^14.0.1",
"@popperjs/core": "^2.11.6",
"@swimlane/ngx-charts": "^20.1.2",
"@tweenjs/tween.js": "^18.6.4",
"@types/file-saver": "^2.0.5",
"bootstrap": "^5.2.3",
- "browser": "^0.2.6",
"eventsource": "^2.0.2",
"file-saver": "^2.0.5",
"lazysizes": "^5.3.2",
"ng-circle-progress": "^1.7.1",
- "ng-swipe": "^2.0.1",
- "ngx-color-picker": "^13.0.0",
- "ngx-extended-pdf-viewer": "^15.2.2",
- "ngx-file-drop": "^14.0.2",
- "ngx-slider-v2": "^15.0.3",
- "ngx-toastr": "^16.0.2",
- "requires": "^1.0.2",
+ "ngx-color-picker": "^14.0.0",
+ "ngx-extended-pdf-viewer": "^16.2.16",
+ "ngx-file-drop": "^15.0.0",
+ "ngx-slider-v2": "^15.0.4",
+ "ngx-toastr": "^16.1.1",
"rxjs": "^7.8.0",
"screenfull": "^6.0.2",
"swiper": "^8.4.6",
"tslib": "^2.3.0",
- "webpack-bundle-analyzer": "^4.7.0",
"zone.js": "~0.12.0"
},
"devDependencies": {
- "@angular-devkit/build-angular": "^15.1.3",
- "@angular-eslint/builder": "15.2.0",
- "@angular-eslint/eslint-plugin": "15.2.0",
- "@angular-eslint/eslint-plugin-template": "15.2.0",
- "@angular-eslint/schematics": "15.2.0",
- "@angular-eslint/template-parser": "15.2.0",
- "@angular/cli": "^15.1.3",
- "@angular/compiler-cli": "^15.1.2",
+ "@angular-devkit/build-angular": "^15.2.6",
+ "@angular-eslint/builder": "15.2.1",
+ "@angular-eslint/eslint-plugin": "15.2.1",
+ "@angular-eslint/eslint-plugin-template": "15.2.1",
+ "@angular-eslint/schematics": "15.2.1",
+ "@angular-eslint/template-parser": "15.2.1",
+ "@angular/cli": "^15.2.6",
+ "@angular/compiler-cli": "^15.2.7",
"@playwright/test": "^1.30.0",
"@types/d3": "^7.4.0",
"@types/jest": "^27.5.2",
@@ -76,6 +72,7 @@
"karma-coverage": "~2.2.0",
"playwright": "^1.30.0",
"ts-node": "~10.5.0",
- "typescript": "~4.9.4"
+ "typescript": "~4.9.4",
+ "webpack-bundle-analyzer": "^4.8.0"
}
}
diff --git a/UI/Web/src/_manga-reader-common.scss b/UI/Web/src/_manga-reader-common.scss
index 07f49d704..a7dfb4f19 100644
--- a/UI/Web/src/_manga-reader-common.scss
+++ b/UI/Web/src/_manga-reader-common.scss
@@ -1,3 +1,5 @@
+$scrollbarHeight: 34px;
+
img {
user-select: none;
}
@@ -12,8 +14,9 @@ img {
}
&.full-height {
- height: calc(100vh - 34px); // 34px is the height of the horizontal scrollbar that will appear
- display: flex; // changed from inline-block to fix the centering on tablets not working
+ height: calc(100vh); // We need to - $scrollbarHeight when there is a horizontal scroll on macos
+ display: flex;
+ align-content: center;
}
&.original {
@@ -55,14 +58,6 @@ img {
animation: bookmark 0.7s cubic-bezier(0.165, 0.84, 0.44, 1);
}
-// TODO: Move this into a dedicated component
-.loading {
- position: absolute;
- left: 48%;
- top: 20%;
- z-index: 1;
-}
-
.highlight {
background-color: var(--manga-reader-next-highlight-bg-color) !important;
@@ -76,7 +71,7 @@ img {
}
-::ng-deep .image-container.book-shadow.center-double:before {
+::ng-deep .image-container.book-shadow[class*="double-offset"]:before, ::ng-deep .image-container.book-shadow.wide:before {
content: '';
position: absolute;
top: 0;
@@ -90,7 +85,7 @@ img {
}
@supports (-moz-appearance:none) {
- ::ng-deep .image-container.book-shadow.center-double:before {
+ ::ng-deep .image-container.book-shadow[class*="double-offset"]:before, ::ng-deep .image-container.book-shadow.wide:before {
box-shadow:
0px 0px calc(17px*3.14) 25px rgb(0 0 0 / 43%),
0px 0px calc(2px*3.14) 2px rgb(0 0 0 / 43%),
@@ -98,4 +93,4 @@ img {
0px 0px calc(0.5px*3.14) 0.3px rgb(0 0 0 / 43%),
0px 0px 1px 0.5px rgb(0 0 0 / 43%);
}
-}
\ No newline at end of file
+}
diff --git a/UI/Web/src/app/_models/auth/member.ts b/UI/Web/src/app/_models/auth/member.ts
index 76f05d44d..a9b50d110 100644
--- a/UI/Web/src/app/_models/auth/member.ts
+++ b/UI/Web/src/app/_models/auth/member.ts
@@ -10,4 +10,5 @@ export interface Member {
roles: string[];
libraries: Library[];
ageRestriction: AgeRestriction;
+ isPending: boolean;
}
\ No newline at end of file
diff --git a/UI/Web/src/app/_models/library.ts b/UI/Web/src/app/_models/library.ts
index 8f229b4df..7a36812ef 100644
--- a/UI/Web/src/app/_models/library.ts
+++ b/UI/Web/src/app/_models/library.ts
@@ -16,4 +16,6 @@ export interface Library {
includeInRecommended: boolean;
includeInSearch: boolean;
manageCollections: boolean;
-}
+ manageReadingLists: boolean;
+ collapseSeriesRelationships: boolean;
+}
\ No newline at end of file
diff --git a/UI/Web/src/app/_models/manga-reader/bookmark-info.ts b/UI/Web/src/app/_models/manga-reader/bookmark-info.ts
index e63c31390..26ee5e0bb 100644
--- a/UI/Web/src/app/_models/manga-reader/bookmark-info.ts
+++ b/UI/Web/src/app/_models/manga-reader/bookmark-info.ts
@@ -1,3 +1,4 @@
+import { FileDimension } from "src/app/manga-reader/_models/file-dimension";
import { LibraryType } from "../library";
import { MangaFormat } from "../manga-format";
@@ -8,4 +9,12 @@ export interface BookmarkInfo {
libraryId: number;
libraryType: LibraryType;
pages: number;
+ /**
+ * This will not always be present. Depends on if asked from backend.
+ */
+ pageDimensions?: Array<FileDimension>;
+ /**
+ * This will not always be present. Depends on if asked from backend.
+ */
+ doublePairs?: {[key: number]: number};
}
\ No newline at end of file
diff --git a/UI/Web/src/app/_models/metadata/age-rating.ts b/UI/Web/src/app/_models/metadata/age-rating.ts
index cbb2e86a5..0d70f2644 100644
--- a/UI/Web/src/app/_models/metadata/age-rating.ts
+++ b/UI/Web/src/app/_models/metadata/age-rating.ts
@@ -4,16 +4,18 @@ export enum AgeRating {
*/
NotApplicable = -1,
Unknown = 0,
- AdultsOnly = 1,
+ RatingPending = 1,
EarlyChildhood = 2,
Everyone = 3,
- Everyone10Plus = 4,
- G = 5,
- KidsToAdults = 6,
- Mature = 7,
- Mature15Plus = 8,
- Mature17Plus = 9,
- RatingPending = 10,
- Teen = 11,
- X18Plus = 12
+ G = 4,
+ Everyone10Plus = 5,
+ PG = 6,
+ KidsToAdults = 7,
+ Teen = 8,
+ Mature15Plus = 9,
+ Mature17Plus = 10,
+ Mature = 11,
+ R18Plus = 12,
+ AdultsOnly = 13,
+ X18Plus = 14
}
\ No newline at end of file
diff --git a/UI/Web/src/app/_models/preferences/preferences.ts b/UI/Web/src/app/_models/preferences/preferences.ts
index 17b30f672..96f2beb61 100644
--- a/UI/Web/src/app/_models/preferences/preferences.ts
+++ b/UI/Web/src/app/_models/preferences/preferences.ts
@@ -7,6 +7,7 @@ import { ReaderMode } from './reader-mode';
import { ReadingDirection } from './reading-direction';
import { ScalingOption } from './scaling-option';
import { SiteTheme } from './site-theme';
+import {WritingStyle} from "./writing-style";
export interface Preferences {
// Manga Reader
@@ -28,6 +29,7 @@ export interface Preferences {
bookReaderFontFamily: string;
bookReaderTapToPaginate: boolean;
bookReaderReadingDirection: ReadingDirection;
+ bookReaderWritingStyle: WritingStyle;
bookReaderThemeName: string;
bookReaderLayoutMode: BookPageLayoutMode;
bookReaderImmersiveMode: boolean;
@@ -38,9 +40,11 @@ export interface Preferences {
blurUnreadSummaries: boolean;
promptForDownloadSize: boolean;
noTransitions: boolean;
+ collapseSeriesRelationships: boolean;
}
export const readingDirections = [{text: 'Left to Right', value: ReadingDirection.LeftToRight}, {text: 'Right to Left', value: ReadingDirection.RightToLeft}];
+export const bookWritingStyles = [{text: 'Horizontal', value: WritingStyle.Horizontal}, {text: 'Vertical', value: WritingStyle.Vertical}];
export const scalingOptions = [{text: 'Automatic', value: ScalingOption.Automatic}, {text: 'Fit to Height', value: ScalingOption.FitToHeight}, {text: 'Fit to Width', value: ScalingOption.FitToWidth}, {text: 'Original', value: ScalingOption.Original}];
export const pageSplitOptions = [{text: 'Fit to Screen', value: PageSplitOption.FitSplit}, {text: 'Right to Left', value: PageSplitOption.SplitRightToLeft}, {text: 'Left to Right', value: PageSplitOption.SplitLeftToRight}, {text: 'No Split', value: PageSplitOption.NoSplit}];
export const readingModes = [{text: 'Left to Right', value: ReaderMode.LeftRight}, {text: 'Up to Down', value: ReaderMode.UpDown}, {text: 'Webtoon', value: ReaderMode.Webtoon}];
diff --git a/UI/Web/src/app/_models/preferences/site-theme.ts b/UI/Web/src/app/_models/preferences/site-theme.ts
index 7a5e919e6..675d4dad3 100644
--- a/UI/Web/src/app/_models/preferences/site-theme.ts
+++ b/UI/Web/src/app/_models/preferences/site-theme.ts
@@ -12,6 +12,7 @@
export interface SiteTheme {
id: number;
name: string;
+ normalizedName: string;
filePath: string;
isDefault: boolean;
provider: ThemeProvider;
diff --git a/UI/Web/src/app/_models/preferences/writing-style.ts b/UI/Web/src/app/_models/preferences/writing-style.ts
new file mode 100644
index 000000000..5fbade0cf
--- /dev/null
+++ b/UI/Web/src/app/_models/preferences/writing-style.ts
@@ -0,0 +1,7 @@
+/*
+ * Mode the user is reading the book in. Not applicable with ReaderMode.Webtoon
+ */
+export enum WritingStyle{
+ Horizontal = 0,
+ Vertical = 1,
+}
diff --git a/UI/Web/src/app/_models/reading-list.ts b/UI/Web/src/app/_models/reading-list.ts
index 10903da0e..daff4f57b 100644
--- a/UI/Web/src/app/_models/reading-list.ts
+++ b/UI/Web/src/app/_models/reading-list.ts
@@ -30,4 +30,8 @@ export interface ReadingList {
* If this is empty or null, the cover image isn't set. Do not use this externally.
*/
coverImage: string;
+ startingYear: number;
+ startingMonth: number;
+ endingYear: number;
+ endingMonth: number;
}
\ No newline at end of file
diff --git a/UI/Web/src/app/_models/reading-list/cbl/cbl-book-result.ts b/UI/Web/src/app/_models/reading-list/cbl/cbl-book-result.ts
index 64396558b..e5ac4b298 100644
--- a/UI/Web/src/app/_models/reading-list/cbl/cbl-book-result.ts
+++ b/UI/Web/src/app/_models/reading-list/cbl/cbl-book-result.ts
@@ -1,8 +1,18 @@
import { CblImportReason } from "./cbl-import-reason.enum";
export interface CblBookResult {
+ order: number;
series: string;
volume: string;
number: string;
+ /**
+ * For SeriesCollision
+ */
+ libraryId: number;
+ /**
+ * For SeriesCollision
+ */
+ seriesId: number;
+ readingListName: string;
reason: CblImportReason;
}
\ No newline at end of file
diff --git a/UI/Web/src/app/_models/reading-list/cbl/cbl-import-reason.enum.ts b/UI/Web/src/app/_models/reading-list/cbl/cbl-import-reason.enum.ts
index fd49469a7..a9a985804 100644
--- a/UI/Web/src/app/_models/reading-list/cbl/cbl-import-reason.enum.ts
+++ b/UI/Web/src/app/_models/reading-list/cbl/cbl-import-reason.enum.ts
@@ -7,4 +7,6 @@ export enum CblImportReason {
EmptyFile = 5,
SeriesCollision = 6,
AllChapterMissing = 7,
+ Success = 8,
+ InvalidFile = 9
}
\ No newline at end of file
diff --git a/UI/Web/src/app/_models/reading-list/cbl/cbl-import-summary.ts b/UI/Web/src/app/_models/reading-list/cbl/cbl-import-summary.ts
index 5ab7b1b5f..424de0a63 100644
--- a/UI/Web/src/app/_models/reading-list/cbl/cbl-import-summary.ts
+++ b/UI/Web/src/app/_models/reading-list/cbl/cbl-import-summary.ts
@@ -9,10 +9,8 @@ export interface CblConflictQuestion {
export interface CblImportSummary {
cblName: string;
+ fileName: string;
results: Array<CblBookResult>;
success: CblImportResult;
successfulInserts: Array<CblBookResult>;
- conflicts: Array<Series>;
- conflicts2: Array<CblConflictQuestion>;
-
}
\ No newline at end of file
diff --git a/UI/Web/src/app/_models/stats/client-info.ts b/UI/Web/src/app/_models/stats/client-info.ts
deleted file mode 100644
index 67916b8cf..000000000
--- a/UI/Web/src/app/_models/stats/client-info.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-import { DetailsVersion } from "./details-version";
-
-
-export interface ClientInfo {
- os: DetailsVersion,
- browser: DetailsVersion,
- platformType: string,
- kavitaUiVersion: string,
- screenResolution: string;
- usingDarkTheme: boolean;
-
- collectedAt?: Date;
-}
diff --git a/UI/Web/src/app/_models/stats/details-version.ts b/UI/Web/src/app/_models/stats/details-version.ts
deleted file mode 100644
index 10ce38263..000000000
--- a/UI/Web/src/app/_models/stats/details-version.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-export interface DetailsVersion {
- name: string;
- version: string;
-}
\ No newline at end of file
diff --git a/UI/Web/src/app/_services/account.service.ts b/UI/Web/src/app/_services/account.service.ts
index ee1dd2461..f0df81974 100644
--- a/UI/Web/src/app/_services/account.service.ts
+++ b/UI/Web/src/app/_services/account.service.ts
@@ -285,9 +285,9 @@ export class AccountService implements OnDestroy {
}
const jwtToken = JSON.parse(atob(this.currentUser.token.split('.')[1]));
- // set a timeout to refresh the token a minute before it expires
+ // set a timeout to refresh the token 10 mins before it expires
const expires = new Date(jwtToken.exp * 1000);
- const timeout = expires.getTime() - Date.now() - (60 * 1000);
+ const timeout = expires.getTime() - Date.now() - (60 * 10000);
this.refreshTokenTimeout = setTimeout(() => this.refreshToken().subscribe(() => {}), timeout);
}
diff --git a/UI/Web/src/app/_services/action.service.ts b/UI/Web/src/app/_services/action.service.ts
index 34578ca26..a5c896334 100644
--- a/UI/Web/src/app/_services/action.service.ts
+++ b/UI/Web/src/app/_services/action.service.ts
@@ -537,12 +537,18 @@ export class ActionService implements OnDestroy {
* @param chapters? Chapters, should have id
* @param callback Optional callback to perform actions after API completes
*/
- deleteMultipleSeries(seriesIds: Array<Series>, callback?: VoidActionCallback) {
+ async deleteMultipleSeries(seriesIds: Array<Series>, callback?: BooleanActionCallback) {
+ if (!await this.confirmService.confirm('Are you sure you want to delete ' + seriesIds.length + ' series? It will not modify files on disk.')) {
+ if (callback) {
+ callback(false);
+ }
+ return;
+ }
this.seriesService.deleteMultipleSeries(seriesIds.map(s => s.id)).pipe(take(1)).subscribe(() => {
this.toastr.success('Series deleted');
if (callback) {
- callback();
+ callback(true);
}
});
}
diff --git a/UI/Web/src/app/_services/image.service.ts b/UI/Web/src/app/_services/image.service.ts
index 3cc3a0355..0a54b00ac 100644
--- a/UI/Web/src/app/_services/image.service.ts
+++ b/UI/Web/src/app/_services/image.service.ts
@@ -13,6 +13,7 @@ export class ImageService implements OnDestroy {
baseUrl = environment.apiUrl;
apiKey: string = '';
+ encodedKey: string = '';
public placeholderImage = 'assets/images/image-placeholder-min.png';
public errorImage = 'assets/images/error-placeholder2-min.png';
public resetCoverImage = 'assets/images/image-reset-cover-min.png';
@@ -33,6 +34,7 @@ export class ImageService implements OnDestroy {
this.accountService.currentUser$.pipe(takeUntil(this.onDestroy)).subscribe(user => {
if (user) {
this.apiKey = user.apiKey;
+ this.encodedKey = encodeURIComponent(this.apiKey);
}
});
}
@@ -62,35 +64,35 @@ export class ImageService implements OnDestroy {
}
getLibraryCoverImage(libraryId: number) {
- return this.baseUrl + 'image/library-cover?libraryId=' + libraryId;
+ return `${this.baseUrl}image/library-cover?libraryId=${libraryId}&apiKey=${this.encodedKey}`;
}
getVolumeCoverImage(volumeId: number) {
- return this.baseUrl + 'image/volume-cover?volumeId=' + volumeId;
+ return `${this.baseUrl}image/volume-cover?volumeId=${volumeId}&apiKey=${this.encodedKey}`;
}
getSeriesCoverImage(seriesId: number) {
- return this.baseUrl + 'image/series-cover?seriesId=' + seriesId;
+ return `${this.baseUrl}image/series-cover?seriesId=${seriesId}&apiKey=${this.encodedKey}`;
}
getCollectionCoverImage(collectionTagId: number) {
- return this.baseUrl + 'image/collection-cover?collectionTagId=' + collectionTagId;
+ return `${this.baseUrl}image/collection-cover?collectionTagId=${collectionTagId}&apiKey=${this.encodedKey}`;
}
getReadingListCoverImage(readingListId: number) {
- return this.baseUrl + 'image/readinglist-cover?readingListId=' + readingListId;
+ return `${this.baseUrl}image/readinglist-cover?readingListId=${readingListId}&apiKey=${this.encodedKey}`;
}
getChapterCoverImage(chapterId: number) {
- return this.baseUrl + 'image/chapter-cover?chapterId=' + chapterId;
+ return `${this.baseUrl}image/chapter-cover?chapterId=${chapterId}&apiKey=${this.encodedKey}`;
}
getBookmarkedImage(chapterId: number, pageNum: number) {
- return this.baseUrl + 'image/bookmark?chapterId=' + chapterId + '&pageNum=' + pageNum + '&apiKey=' + encodeURIComponent(this.apiKey);
+ return `${this.baseUrl}image/bookmark?chapterId=${chapterId}&apiKey=${this.encodedKey}&pageNum=${pageNum}`;
}
getCoverUploadImage(filename: string) {
- return this.baseUrl + 'image/cover-upload?filename=' + encodeURIComponent(filename);
+ return `${this.baseUrl}image/cover-upload?filename=${encodeURIComponent(filename)}&apiKey=${this.encodedKey}`;
}
updateErroredImage(event: any) {
diff --git a/UI/Web/src/app/_services/member.service.ts b/UI/Web/src/app/_services/member.service.ts
index b06ee3e38..27f21e6bc 100644
--- a/UI/Web/src/app/_services/member.service.ts
+++ b/UI/Web/src/app/_services/member.service.ts
@@ -12,8 +12,8 @@ export class MemberService {
constructor(private httpClient: HttpClient) { }
- getMembers() {
- return this.httpClient.get<Member[]>(this.baseUrl + 'users');
+ getMembers(includePending: boolean = false) {
+ return this.httpClient.get<Member[]>(this.baseUrl + 'users?includePending=' + includePending);
}
getMemberNames() {
@@ -36,10 +36,6 @@ export class MemberService {
return this.httpClient.get<boolean>(this.baseUrl + 'users/has-reading-progress?libraryId=' + librayId);
}
- getPendingInvites() {
- return this.httpClient.get<Array<Member>>(this.baseUrl + 'users/pending');
- }
-
addSeriesToWantToRead(seriesIds: Array<number>) {
return this.httpClient.post<Array<Member>>(this.baseUrl + 'want-to-read/add-series', {seriesIds});
}
diff --git a/UI/Web/src/app/_services/message-hub.service.ts b/UI/Web/src/app/_services/message-hub.service.ts
index 8aed98ab0..28a85b19a 100644
--- a/UI/Web/src/app/_services/message-hub.service.ts
+++ b/UI/Web/src/app/_services/message-hub.service.ts
@@ -96,7 +96,7 @@ export class MessageHubService {
private hubConnection!: HubConnection;
private messagesSource = new ReplaySubject<Message<any>>(1);
- private onlineUsersSource = new BehaviorSubject<number[]>([]); // UserIds
+ private onlineUsersSource = new BehaviorSubject<string[]>([]); // UserNames
/**
* Any events that come from the backend
@@ -142,7 +142,7 @@ export class MessageHubService {
.start()
.catch(err => console.error(err));
- this.hubConnection.on(EVENTS.OnlineUsers, (usernames: number[]) => {
+ this.hubConnection.on(EVENTS.OnlineUsers, (usernames: string[]) => {
this.onlineUsersSource.next(usernames);
});
diff --git a/UI/Web/src/app/_services/reader.service.ts b/UI/Web/src/app/_services/reader.service.ts
index 51fe7ed90..7da1e85bc 100644
--- a/UI/Web/src/app/_services/reader.service.ts
+++ b/UI/Web/src/app/_services/reader.service.ts
@@ -16,6 +16,9 @@ import { FilterUtilitiesService } from '../shared/_services/filter-utilities.ser
import { FileDimension } from '../manga-reader/_models/file-dimension';
import screenfull from 'screenfull';
import { TextResonse } from '../_types/text-response';
+import { AccountService } from './account.service';
+import { Subject, takeUntil } from 'rxjs';
+import { OnDestroy } from '@angular/core';
export const CHAPTER_ID_DOESNT_EXIST = -1;
export const CHAPTER_ID_NOT_FETCHED = -2;
@@ -23,16 +26,29 @@ export const CHAPTER_ID_NOT_FETCHED = -2;
@Injectable({
providedIn: 'root'
})
-export class ReaderService {
+export class ReaderService implements OnDestroy {
baseUrl = environment.apiUrl;
+ encodedKey: string = '';
+ private onDestroy: Subject<void> = new Subject();
// Override background color for reader and restore it onDestroy
private originalBodyColor!: string;
constructor(private httpClient: HttpClient, private router: Router,
private location: Location, private utilityService: UtilityService,
- private filterUtilitySerivce: FilterUtilitiesService) { }
+ private filterUtilitySerivce: FilterUtilitiesService, private accountService: AccountService) {
+ this.accountService.currentUser$.pipe(takeUntil(this.onDestroy)).subscribe(user => {
+ if (user) {
+ this.encodedKey = encodeURIComponent(user.apiKey);
+ }
+ });
+ }
+
+ ngOnDestroy() {
+ this.onDestroy.next();
+ this.onDestroy.complete();
+ }
getNavigationArray(libraryId: number, seriesId: number, chapterId: number, format: MangaFormat) {
if (format === undefined) format = MangaFormat.ARCHIVE;
@@ -47,7 +63,7 @@ export class ReaderService {
}
downloadPdf(chapterId: number) {
- return this.baseUrl + 'reader/pdf?chapterId=' + chapterId;
+ return `${this.baseUrl}reader/pdf?chapterId=${chapterId}&apiKey=${this.encodedKey}`;
}
bookmark(seriesId: number, volumeId: number, chapterId: number, page: number) {
@@ -98,7 +114,11 @@ export class ReaderService {
}
getPageUrl(chapterId: number, page: number) {
- return this.baseUrl + 'reader/image?chapterId=' + chapterId + '&page=' + page;
+ return `${this.baseUrl}reader/image?chapterId=${chapterId}&apiKey=${this.encodedKey}&page=${page}`;
+ }
+
+ getThumbnailUrl(chapterId: number, page: number) {
+ return `${this.baseUrl}reader/thumbnail?chapterId=${chapterId}&apiKey=${this.encodedKey}&page=${page}`;
}
getBookmarkPageUrl(seriesId: number, apiKey: string, page: number) {
diff --git a/UI/Web/src/app/_services/reading-list.service.ts b/UI/Web/src/app/_services/reading-list.service.ts
index 1cbcd5a96..51cf74e1e 100644
--- a/UI/Web/src/app/_services/reading-list.service.ts
+++ b/UI/Web/src/app/_services/reading-list.service.ts
@@ -3,6 +3,7 @@ import { Injectable } from '@angular/core';
import { map } from 'rxjs/operators';
import { environment } from 'src/environments/environment';
import { UtilityService } from '../shared/_services/utility.service';
+import { Person } from '../_models/metadata/person';
import { PaginatedResult } from '../_models/pagination';
import { ReadingList, ReadingListItem } from '../_models/reading-list';
import { CblImportResult } from '../_models/reading-list/cbl/cbl-import-result.enum';
@@ -23,11 +24,12 @@ export class ReadingListService {
return this.httpClient.get<ReadingList>(this.baseUrl + 'readinglist?readingListId=' + readingListId);
}
- getReadingLists(includePromoted: boolean = true, pageNum?: number, itemsPerPage?: number) {
+ getReadingLists(includePromoted: boolean = true, sortByLastModified: boolean = false, pageNum?: number, itemsPerPage?: number) {
let params = new HttpParams();
params = this.utilityService.addPaginationIfExists(params, pageNum, itemsPerPage);
- return this.httpClient.post<PaginatedResult<ReadingList[]>>(this.baseUrl + 'readinglist/lists?includePromoted=' + includePromoted, {}, {observe: 'response', params}).pipe(
+ return this.httpClient.post<PaginatedResult<ReadingList[]>>(this.baseUrl + 'readinglist/lists?includePromoted=' + includePromoted
+ + '&sortByLastModified=' + sortByLastModified, {}, {observe: 'response', params}).pipe(
map((response: any) => {
return this.utilityService.createPaginatedResult(response, new PaginatedResult<ReadingList[]>());
})
@@ -95,7 +97,15 @@ export class ReadingListService {
return this.httpClient.get<boolean>(this.baseUrl + 'readinglist/name-exists?name=' + name);
}
+ validateCbl(form: FormData) {
+ return this.httpClient.post<CblImportSummary>(this.baseUrl + 'cbl/validate', form);
+ }
+
importCbl(form: FormData) {
- return this.httpClient.post<CblImportSummary>(this.baseUrl + 'readinglist/import-cbl', form);
+ return this.httpClient.post<CblImportSummary>(this.baseUrl + 'cbl/import', form);
+ }
+
+ getCharacters(readingListId: number) {
+ return this.httpClient.get<Array<Person>>(this.baseUrl + 'readinglist/characters?readingListId=' + readingListId);
}
}
diff --git a/UI/Web/src/app/_services/scroll.service.ts b/UI/Web/src/app/_services/scroll.service.ts
index 7e786f7ed..3a0837962 100644
--- a/UI/Web/src/app/_services/scroll.service.ts
+++ b/UI/Web/src/app/_services/scroll.service.ts
@@ -24,22 +24,31 @@ export class ScrollService {
}
get scrollPosition() {
- return (window.pageYOffset
- || document.documentElement.scrollTop
+ return (window.pageYOffset
+ || document.documentElement.scrollTop
|| document.body.scrollTop || 0);
}
- scrollTo(top: number, el: Element | Window = window) {
+ /*
+ * When in the scroll vertical position the scroll in the horizontal position is needed
+ */
+ get scrollPositionX() {
+ return (window.pageXOffset
+ || document.documentElement.scrollLeft
+ || document.body.scrollLeft || 0);
+ }
+
+ scrollTo(top: number, el: Element | Window = window, behavior: 'auto' | 'smooth' = 'smooth') {
el.scroll({
top: top,
- behavior: 'smooth'
+ behavior: behavior
});
}
-
- scrollToX(left: number, el: Element | Window = window) {
+
+ scrollToX(left: number, el: Element | Window = window, behavior: 'auto' | 'smooth' = 'auto') {
el.scroll({
left: left,
- behavior: 'auto'
+ behavior: behavior
});
}
diff --git a/UI/Web/src/app/_services/series.service.ts b/UI/Web/src/app/_services/series.service.ts
index 680688cff..733a8b2f1 100644
--- a/UI/Web/src/app/_services/series.service.ts
+++ b/UI/Web/src/app/_services/series.service.ts
@@ -67,10 +67,6 @@ export class SeriesService {
return this.httpClient.get<Volume[]>(this.baseUrl + 'series/volumes?seriesId=' + seriesId);
}
- getVolume(volumeId: number) {
- return this.httpClient.get<Volume>(this.baseUrl + 'series/volume?volumeId=' + volumeId);
- }
-
getChapter(chapterId: number) {
return this.httpClient.get<Chapter>(this.baseUrl + 'series/chapter?chapterId=' + chapterId);
}
diff --git a/UI/Web/src/app/admin/edit-user/edit-user.component.html b/UI/Web/src/app/admin/edit-user/edit-user.component.html
index 4a5e8a600..3c99feb24 100644
--- a/UI/Web/src/app/admin/edit-user/edit-user.component.html
+++ b/UI/Web/src/app/admin/edit-user/edit-user.component.html
@@ -23,7 +23,7 @@
<div class="col-md-6 col-sm-12">
<div class="mb-3" style="width:100%">
<label for="email" class="form-label">Email</label>
- <input class="form-control" type="email" id="email" formControlName="email">
+ <input class="form-control" inputmode="email" type="email" id="email" formControlName="email">
<div id="inviteForm-validations" class="invalid-feedback" *ngIf="userForm.dirty || userForm.touched" [class.is-invalid]="userForm.get('email')?.invalid && userForm.get('email')?.touched">
<div *ngIf="userForm.get('email')?.errors?.required">
This field is required
diff --git a/UI/Web/src/app/admin/invite-user/invite-user.component.html b/UI/Web/src/app/admin/invite-user/invite-user.component.html
index e67277ec6..bafdcca8d 100644
--- a/UI/Web/src/app/admin/invite-user/invite-user.component.html
+++ b/UI/Web/src/app/admin/invite-user/invite-user.component.html
@@ -5,7 +5,7 @@
</div>
<div class="modal-body scrollable-modal">
<p>
- Invite a user to your server. Enter their email in and we will send them an email to create an account. If you do not want to use our email service, you can <a href="https://wiki.kavitareader.com/en/guides/misc/email" rel="noopener noreferrer" target="_blank" rel="noopener noreferrer">host your own</a>
+ Invite a user to your server. Enter their email in and we will send them an email to create an account. If you do not want to use our email service, you can <a href="https://wiki.kavitareader.com/en/guides/misc/email" rel="noopener noreferrer" target="_blank">host your own</a>
email service or use a fake email (Forgot User will not work). A link will be presented regardless and can be used to setup the account manually.
</p>
@@ -13,7 +13,7 @@
<div class="row g-0">
<div class="mb-3" style="width:100%">
<label for="email" class="form-label">Email</label>
- <input class="form-control" type="email" id="email" formControlName="email" required [class.is-invalid]="inviteForm.get('email')?.invalid && inviteForm.get('email')?.touched">
+ <input class="form-control" type="email" inputmode="email" id="email" formControlName="email" required [class.is-invalid]="inviteForm.get('email')?.invalid && inviteForm.get('email')?.touched">
<div id="inviteForm-validations" class="invalid-feedback" *ngIf="inviteForm.dirty || inviteForm.touched">
<div *ngIf="email?.errors?.required">
This field is required
diff --git a/UI/Web/src/app/admin/invite-user/invite-user.component.ts b/UI/Web/src/app/admin/invite-user/invite-user.component.ts
index 0c4720505..5e87d7a1f 100644
--- a/UI/Web/src/app/admin/invite-user/invite-user.component.ts
+++ b/UI/Web/src/app/admin/invite-user/invite-user.component.ts
@@ -59,6 +59,7 @@ export class InviteUserComponent implements OnInit {
}
}, err => {
this.isSending = false;
+ this.toastr.error(err)
});
}
diff --git a/UI/Web/src/app/admin/manage-email-settings/manage-email-settings.component.html b/UI/Web/src/app/admin/manage-email-settings/manage-email-settings.component.html
index af12f5ab2..266e2c43e 100644
--- a/UI/Web/src/app/admin/manage-email-settings/manage-email-settings.component.html
+++ b/UI/Web/src/app/admin/manage-email-settings/manage-email-settings.component.html
@@ -13,7 +13,7 @@
<ng-template #emailServiceTooltip>Use fully qualified URL of the email service. Do not include ending slash.</ng-template>
<span class="visually-hidden" id="settings-emailservice-help"><ng-container [ngTemplateOutlet]="emailServiceTooltip"></ng-container></span>
<div class="input-group">
- <input id="settings-emailservice" aria-describedby="settings-emailservice-help" class="form-control" formControlName="emailServiceUrl" type="text" aria-describedby="change-bookmarks-dir">
+ <input id="settings-emailservice" aria-describedby="settings-emailservice-help" class="form-control" formControlName="emailServiceUrl" type="url" autocapitalize="off" inputmode="url" aria-describedby="change-bookmarks-dir">
<button class="btn btn-outline-secondary" (click)="resetEmailServiceUrl()">
Reset
</button>
@@ -23,6 +23,19 @@
</div>
</div>
+ <div class="mb-3">
+ <label for="settings-hostname" class="form-label">Host Name</label>&nbsp;<i class="fa fa-info-circle" placement="right" [ngbTooltip]="hostNameTooltip" role="button" tabindex="0"></i>
+ <ng-template #hostNameTooltip>Domain Name (of Reverse Proxy). If set, email generation will always use this.</ng-template>
+ <span class="visually-hidden" id="settings-hostname-help">Domain Name (of Reverse Proxy). If set, email generation will always use this.</span>
+ <input id="settings-hostname" aria-describedby="settings-hostname-help" class="form-control" formControlName="hostName" type="text"
+ [class.is-invalid]="settingsForm.get('hostName')?.invalid && settingsForm.get('hostName')?.touched">
+ <div id="hostname-validations" class="invalid-feedback" *ngIf="settingsForm.dirty || settingsForm.touched">
+ <div *ngIf="settingsForm.get('hostName')?.errors?.pattern">
+ Host name must start with http(s) and not end in /
+ </div>
+ </div>
+ </div>
+
<div class="col-auto d-flex d-md-block justify-content-sm-center text-md-end">
<button type="button" class="flex-fill btn btn-secondary me-2" (click)="resetToDefaults()">Reset to Default</button>
<button type="button" class="flex-fill btn btn-secondary me-2" (click)="resetForm()">Reset</button>
diff --git a/UI/Web/src/app/admin/manage-email-settings/manage-email-settings.component.ts b/UI/Web/src/app/admin/manage-email-settings/manage-email-settings.component.ts
index 480ac55b3..dd436e010 100644
--- a/UI/Web/src/app/admin/manage-email-settings/manage-email-settings.component.ts
+++ b/UI/Web/src/app/admin/manage-email-settings/manage-email-settings.component.ts
@@ -21,19 +21,23 @@ export class ManageEmailSettingsComponent implements OnInit {
this.settingsService.getServerSettings().pipe(take(1)).subscribe((settings: ServerSettings) => {
this.serverSettings = settings;
this.settingsForm.addControl('emailServiceUrl', new FormControl(this.serverSettings.emailServiceUrl, [Validators.required]));
+ this.settingsForm.addControl('hostName', new FormControl(this.serverSettings.hostName, []));
});
}
resetForm() {
this.settingsForm.get('emailServiceUrl')?.setValue(this.serverSettings.emailServiceUrl);
+ this.settingsForm.get('hostName')?.setValue(this.serverSettings.hostName);
this.settingsForm.markAsPristine();
}
async saveSettings() {
const modelSettings = Object.assign({}, this.serverSettings);
modelSettings.emailServiceUrl = this.settingsForm.get('emailServiceUrl')?.value;
-
- this.settingsService.updateServerSettings(modelSettings).pipe(take(1)).subscribe(async (settings: ServerSettings) => {
+ modelSettings.hostName = this.settingsForm.get('hostName')?.value;
+
+
+ this.settingsService.updateServerSettings(modelSettings).pipe(take(1)).subscribe((settings: ServerSettings) => {
this.serverSettings = settings;
this.resetForm();
this.toastr.success('Server settings updated');
@@ -43,7 +47,7 @@ export class ManageEmailSettingsComponent implements OnInit {
}
resetToDefaults() {
- this.settingsService.resetServerSettings().pipe(take(1)).subscribe(async (settings: ServerSettings) => {
+ this.settingsService.resetServerSettings().pipe(take(1)).subscribe((settings: ServerSettings) => {
this.serverSettings = settings;
this.resetForm();
this.toastr.success('Server settings updated');
@@ -53,7 +57,7 @@ export class ManageEmailSettingsComponent implements OnInit {
}
resetEmailServiceUrl() {
- this.settingsService.resetEmailServerSettings().pipe(take(1)).subscribe(async (settings: ServerSettings) => {
+ this.settingsService.resetEmailServerSettings().pipe(take(1)).subscribe((settings: ServerSettings) => {
this.serverSettings.emailServiceUrl = settings.emailServiceUrl;
this.resetForm();
this.toastr.success('Email Service Reset');
@@ -63,9 +67,10 @@ export class ManageEmailSettingsComponent implements OnInit {
}
testEmailServiceUrl() {
- this.settingsService.testEmailServerSettings(this.settingsForm.get('emailServiceUrl')?.value || '').pipe(take(1)).subscribe(async (result: EmailTestResult) => {
+ if (this.settingsForm.get('emailServiceUrl')?.value === '') return;
+ this.settingsService.testEmailServerSettings(this.settingsForm.get('emailServiceUrl')?.value).pipe(take(1)).subscribe(async (result: EmailTestResult) => {
if (result.successful) {
- this.toastr.success('Email Service Url validated');
+ this.toastr.success('Email Service was reachable');
} else {
this.toastr.error('Email Service Url did not respond. ' + result.errorMessage);
}
diff --git a/UI/Web/src/app/admin/manage-media-settings/manage-media-settings.component.html b/UI/Web/src/app/admin/manage-media-settings/manage-media-settings.component.html
index c86087667..cb0997bc0 100644
--- a/UI/Web/src/app/admin/manage-media-settings/manage-media-settings.component.html
+++ b/UI/Web/src/app/admin/manage-media-settings/manage-media-settings.component.html
@@ -27,6 +27,20 @@
</div>
</div>
+ <div class="row g-0">
+ <div class="mb-3">
+ <label for="settings-bookmarksdir" class="form-label">Bookmarks Directory</label>&nbsp;<i class="fa fa-info-circle" placement="right" [ngbTooltip]="bookmarksDirectoryTooltip" role="button" tabindex="0"></i>
+ <ng-template #bookmarksDirectoryTooltip>Location where bookmarks will be stored. Bookmarks are source files and can be large. Choose a location with adequate storage. Directory is managed; other files within directory will be deleted. If Docker, mount an additional volume and use that.</ng-template>
+ <span class="visually-hidden" id="settings-bookmarksdir-help"><ng-container [ngTemplateOutlet]="bookmarksDirectoryTooltip"></ng-container></span>
+ <div class="input-group">
+ <input readonly id="settings-bookmarksdir" aria-describedby="settings-bookmarksdir-help" class="form-control" formControlName="bookmarksDirectory" type="text" aria-describedby="change-bookmarks-dir">
+ <button id="change-bookmarks-dir" class="btn btn-primary" (click)="openDirectoryChooser(settingsForm.get('bookmarksDirectory')?.value, 'bookmarksDirectory')">
+ Change
+ </button>
+ </div>
+ </div>
+ </div>
+
<div class="col-auto d-flex d-md-block justify-content-sm-center text-md-end">
<button type="button" class="flex-fill btn btn-secondary me-2" (click)="resetToDefaults()">Reset to Default</button>
<button type="button" class="flex-fill btn btn-secondary me-2" (click)="resetForm()">Reset</button>
diff --git a/UI/Web/src/app/admin/manage-media-settings/manage-media-settings.component.ts b/UI/Web/src/app/admin/manage-media-settings/manage-media-settings.component.ts
index 12a97481c..e7153b6f1 100644
--- a/UI/Web/src/app/admin/manage-media-settings/manage-media-settings.component.ts
+++ b/UI/Web/src/app/admin/manage-media-settings/manage-media-settings.component.ts
@@ -4,6 +4,8 @@ import { ToastrService } from 'ngx-toastr';
import { take } from 'rxjs';
import { SettingsService } from '../settings.service';
import { ServerSettings } from '../_models/server-settings';
+import { DirectoryPickerComponent, DirectoryPickerResult } from '../_modals/directory-picker/directory-picker.component';
+import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
@Component({
selector: 'app-manage-media-settings',
@@ -15,23 +17,25 @@ export class ManageMediaSettingsComponent implements OnInit {
serverSettings!: ServerSettings;
settingsForm: FormGroup = new FormGroup({});
- constructor(private settingsService: SettingsService, private toastr: ToastrService) { }
+ constructor(private settingsService: SettingsService, private toastr: ToastrService, private modalService: NgbModal, ) { }
ngOnInit(): void {
this.settingsService.getServerSettings().pipe(take(1)).subscribe((settings: ServerSettings) => {
this.serverSettings = settings;
this.settingsForm.addControl('convertBookmarkToWebP', new FormControl(this.serverSettings.convertBookmarkToWebP, [Validators.required]));
this.settingsForm.addControl('convertCoverToWebP', new FormControl(this.serverSettings.convertCoverToWebP, [Validators.required]));
+ this.settingsForm.addControl('bookmarksDirectory', new FormControl(this.serverSettings.bookmarksDirectory, [Validators.required]));
});
}
resetForm() {
this.settingsForm.get('convertBookmarkToWebP')?.setValue(this.serverSettings.convertBookmarkToWebP);
this.settingsForm.get('convertCoverToWebP')?.setValue(this.serverSettings.convertCoverToWebP);
+ this.settingsForm.get('bookmarksDirectory')?.setValue(this.serverSettings.bookmarksDirectory);
this.settingsForm.markAsPristine();
}
- async saveSettings() {
+ saveSettings() {
const modelSettings = Object.assign({}, this.serverSettings);
modelSettings.convertBookmarkToWebP = this.settingsForm.get('convertBookmarkToWebP')?.value;
modelSettings.convertCoverToWebP = this.settingsForm.get('convertCoverToWebP')?.value;
@@ -46,7 +50,7 @@ export class ManageMediaSettingsComponent implements OnInit {
}
resetToDefaults() {
- this.settingsService.resetServerSettings().pipe(take(1)).subscribe(async (settings: ServerSettings) => {
+ this.settingsService.resetServerSettings().pipe(take(1)).subscribe((settings: ServerSettings) => {
this.serverSettings = settings;
this.resetForm();
this.toastr.success('Server settings updated');
@@ -54,4 +58,16 @@ export class ManageMediaSettingsComponent implements OnInit {
console.error('error: ', err);
});
}
+
+ openDirectoryChooser(existingDirectory: string, formControl: string) {
+ const modalRef = this.modalService.open(DirectoryPickerComponent, { scrollable: true, size: 'lg' });
+ modalRef.componentInstance.startingFolder = existingDirectory || '';
+ modalRef.componentInstance.helpUrl = '';
+ modalRef.closed.subscribe((closeResult: DirectoryPickerResult) => {
+ if (closeResult.success && closeResult.folderPath !== '') {
+ this.settingsForm.get(formControl)?.setValue(closeResult.folderPath);
+ this.settingsForm.markAsDirty();
+ }
+ });
+ }
}
diff --git a/UI/Web/src/app/admin/manage-settings/manage-settings.component.html b/UI/Web/src/app/admin/manage-settings/manage-settings.component.html
index d77dc147c..3acffc643 100644
--- a/UI/Web/src/app/admin/manage-settings/manage-settings.component.html
+++ b/UI/Web/src/app/admin/manage-settings/manage-settings.component.html
@@ -1,36 +1,29 @@
<div class="container-fluid">
<form [formGroup]="settingsForm" *ngIf="serverSettings !== undefined">
- <p class="text-warning pt-2">Changing Port requires a manual restart of Kavita to take effect.</p>
- <div class="mb-3">
+ <div class="alert alert-warning" role="alert">
+ <strong>Notice:</strong> Changing Port or Base Url requires a manual restart of Kavita to take effect.
+ </div>
+ <!-- <div class="mb-3">
<label for="settings-cachedir" class="form-label">Cache Directory</label>&nbsp;<i class="fa fa-info-circle" placement="right" [ngbTooltip]="cacheDirectoryTooltip" role="button" tabindex="0"></i>
<ng-template #cacheDirectoryTooltip>Where the server places temporary files when reading. This will be cleaned up on a regular basis.</ng-template>
<span class="visually-hidden" id="settings-cachedir-help">Where the server places temporary files when reading. This will be cleaned up on a regular basis.</span>
<input readonly id="settings-cachedir" aria-describedby="settings-cachedir-help" class="form-control" formControlName="cacheDirectory" type="text">
- </div>
+ </div> -->
<div class="mb-3">
- <label for="settings-bookmarksdir" class="form-label">Bookmarks Directory</label>&nbsp;<i class="fa fa-info-circle" placement="right" [ngbTooltip]="bookmarksDirectoryTooltip" role="button" tabindex="0"></i>
- <ng-template #bookmarksDirectoryTooltip>Location where bookmarks will be stored. Bookmarks are source files and can be large. Choose a location with adequate storage. Directory is managed; other files within directory will be deleted. If Docker, mount an additional volume and use that.</ng-template>
- <span class="visually-hidden" id="settings-bookmarksdir-help"><ng-container [ngTemplateOutlet]="bookmarksDirectoryTooltip"></ng-container></span>
+ <label for="settings-baseurl" class="form-label">Base Url</label>&nbsp;<i class="fa fa-info-circle" placement="right" [ngbTooltip]="baseUrlTooltip" role="button" tabindex="0"></i>
+ <ng-template #baseUrlTooltip>Use this if you want to host Kavita on a base url ie) yourdomain.com/kavita. Not supported on Docker using non-root user.</ng-template>
+ <span class="visually-hidden" id="settings-cachedir-help">Use this if you want to host Kavita on a base url ie) yourdomain.com/kavita. Not supported on Docker using non-root user.</span>
<div class="input-group">
- <input readonly id="settings-bookmarksdir" aria-describedby="settings-bookmarksdir-help" class="form-control" formControlName="bookmarksDirectory" type="text" aria-describedby="change-bookmarks-dir">
- <button id="change-bookmarks-dir" class="btn btn-primary" (click)="openDirectoryChooser(settingsForm.get('bookmarksDirectory')?.value, 'bookmarksDirectory')">
- Change
- </button>
- </div>
- </div>
-
- <div class="mb-3">
- <label for="settings-hostname" class="form-label">Host Name</label>&nbsp;<i class="fa fa-info-circle" placement="right" [ngbTooltip]="hostNameTooltip" role="button" tabindex="0"></i>
- <ng-template #hostNameTooltip>Domain Name (of Reverse Proxy). If set, email generation will always use this.</ng-template>
- <span class="visually-hidden" id="settings-hostname-help">Domain Name (of Reverse Proxy). If set, email generation will always use this.</span>
- <input id="settings-hostname" aria-describedby="settings-hostname-help" class="form-control" formControlName="hostName" type="text"
- [class.is-invalid]="settingsForm.get('hostName')?.invalid && settingsForm.get('hostName')?.touched">
- <div id="hostname-validations" class="invalid-feedback" *ngIf="settingsForm.dirty || settingsForm.touched">
- <div *ngIf="settingsForm.get('hostName')?.errors?.pattern">
- Host name must start with http(s) and not end in /
- </div>
+ <input id="settings-baseurl" aria-describedby="settings-baseurl-help" class="form-control" formControlName="baseUrl" type="text"
+ [class.is-invalid]="settingsForm.get('baseUrl')?.invalid && settingsForm.get('baseUrl')?.touched">
+ <button class="btn btn-outline-secondary" (click)="resetBaseUrl()">Reset</button>
</div>
+ <div id="baseurl-validations" class="invalid-feedback" *ngIf="settingsForm.dirty || settingsForm.touched">
+ <div *ngIf="settingsForm.get('baseUrl')?.errors?.pattern">
+ Base URL must start and end with /
+ </div>
+ </div>
</div>
<div class="row g-0 mb-2">
@@ -64,7 +57,7 @@
<ng-template #backupTasksTooltip>The number of backups to maintain. Default is 30, minumum is 1, maximum is 30.</ng-template>
<span class="visually-hidden" id="backup-tasks-help">The number of backups to maintain. Default is 30, minumum is 1, maximum is 30.</span>
<input id="backup-tasks" aria-describedby="backup-tasks-help" class="form-control" formControlName="totalBackups"
- type="number" step="1" min="1" max="30" onkeypress="return event.charCode >= 48 && event.charCode <= 57"
+ type="number" inputmode="numeric" step="1" min="1" max="30" onkeypress="return event.charCode >= 48 && event.charCode <= 57"
[class.is-invalid]="settingsForm.get('totalBackups')?.invalid && settingsForm.get('totalBackups')?.touched">
<ng-container *ngIf="settingsForm.get('totalBackups')?.errors as errors">
<p class="invalid-feedback" *ngIf="errors.min">
@@ -84,7 +77,7 @@
<ng-template #logTasksTooltip>The number of logs to maintain. Default is 30, minumum is 1, maximum is 30.</ng-template>
<span class="visually-hidden" id="log-tasks-help">The number of backups to maintain. Default is 30, minumum is 1, maximum is 30.</span>
<input id="log-tasks" aria-describedby="log-tasks-help" class="form-control" formControlName="totalLogs"
- type="number" step="1" min="1" max="30" onkeypress="return event.charCode >= 48 && event.charCode <= 57"
+ type="number" inputmode="numeric" step="1" min="1" max="30" onkeypress="return event.charCode >= 48 && event.charCode <= 57"
[class.is-invalid]="settingsForm.get('totalLogs')?.invalid && settingsForm.get('totalLogs')?.touched">
<ng-container *ngIf="settingsForm.get('totalLogs')?.errors as errors">
<p class="invalid-feedback" *ngIf="errors.min">
diff --git a/UI/Web/src/app/admin/manage-settings/manage-settings.component.ts b/UI/Web/src/app/admin/manage-settings/manage-settings.component.ts
index 53d697db1..1122fd34a 100644
--- a/UI/Web/src/app/admin/manage-settings/manage-settings.component.ts
+++ b/UI/Web/src/app/admin/manage-settings/manage-settings.component.ts
@@ -1,11 +1,10 @@
import { Component, OnInit } from '@angular/core';
import { FormGroup, Validators, FormControl } from '@angular/forms';
-import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { ToastrService } from 'ngx-toastr';
import { take } from 'rxjs/operators';
import { TagBadgeCursor } from 'src/app/shared/tag-badge/tag-badge.component';
+import { ServerService } from 'src/app/_services/server.service';
import { SettingsService } from '../settings.service';
-import { DirectoryPickerComponent, DirectoryPickerResult } from '../_modals/directory-picker/directory-picker.component';
import { ServerSettings } from '../_models/server-settings';
const ValidIpAddress = /^(\s*((([12]?\d{1,2}\.){3}[12]?\d{1,2})|(([\da-f]{0,4}\:){0,7}([\da-f]{0,4})))\s*\,)*\s*((([12]?\d{1,2}\.){3}[12]?\d{1,2})|(([\da-f]{0,4}\:){0,7}([\da-f]{0,4})))\s*$/i;
@@ -27,7 +26,7 @@ export class ManageSettingsComponent implements OnInit {
}
constructor(private settingsService: SettingsService, private toastr: ToastrService,
- private modalService: NgbModal) { }
+ private serverService: ServerService) { }
ngOnInit(): void {
this.settingsService.getTaskFrequencies().pipe(take(1)).subscribe(frequencies => {
@@ -39,7 +38,6 @@ export class ManageSettingsComponent implements OnInit {
this.settingsService.getServerSettings().pipe(take(1)).subscribe((settings: ServerSettings) => {
this.serverSettings = settings;
this.settingsForm.addControl('cacheDirectory', new FormControl(this.serverSettings.cacheDirectory, [Validators.required]));
- this.settingsForm.addControl('bookmarksDirectory', new FormControl(this.serverSettings.bookmarksDirectory, [Validators.required]));
this.settingsForm.addControl('taskScan', new FormControl(this.serverSettings.taskScan, [Validators.required]));
this.settingsForm.addControl('taskBackup', new FormControl(this.serverSettings.taskBackup, [Validators.required]));
this.settingsForm.addControl('ipAddresses', new FormControl(this.serverSettings.ipAddresses, [Validators.required, Validators.pattern(ValidIpAddress)]));
@@ -47,19 +45,25 @@ export class ManageSettingsComponent implements OnInit {
this.settingsForm.addControl('loggingLevel', new FormControl(this.serverSettings.loggingLevel, [Validators.required]));
this.settingsForm.addControl('allowStatCollection', new FormControl(this.serverSettings.allowStatCollection, [Validators.required]));
this.settingsForm.addControl('enableOpds', new FormControl(this.serverSettings.enableOpds, [Validators.required]));
- this.settingsForm.addControl('baseUrl', new FormControl(this.serverSettings.baseUrl, [Validators.required]));
+ this.settingsForm.addControl('baseUrl', new FormControl(this.serverSettings.baseUrl, [Validators.pattern(/^(\/[\w-]+)*\/$/)]));
this.settingsForm.addControl('emailServiceUrl', new FormControl(this.serverSettings.emailServiceUrl, [Validators.required]));
this.settingsForm.addControl('totalBackups', new FormControl(this.serverSettings.totalBackups, [Validators.required, Validators.min(1), Validators.max(30)]));
this.settingsForm.addControl('totalLogs', new FormControl(this.serverSettings.totalLogs, [Validators.required, Validators.min(1), Validators.max(30)]));
this.settingsForm.addControl('enableFolderWatching', new FormControl(this.serverSettings.enableFolderWatching, [Validators.required]));
this.settingsForm.addControl('convertBookmarkToWebP', new FormControl(this.serverSettings.convertBookmarkToWebP, []));
this.settingsForm.addControl('hostName', new FormControl(this.serverSettings.hostName, [Validators.pattern(/^(http:|https:)+[^\s]+[\w]$/)]));
+
+ this.serverService.getServerInfo().subscribe(info => {
+ if (info.isDocker) {
+ this.settingsForm.get('ipAddresses')?.disable();
+ this.settingsForm.get('port')?.disable();
+ }
+ })
});
}
resetForm() {
this.settingsForm.get('cacheDirectory')?.setValue(this.serverSettings.cacheDirectory);
- this.settingsForm.get('bookmarksDirectory')?.setValue(this.serverSettings.bookmarksDirectory);
this.settingsForm.get('scanTask')?.setValue(this.serverSettings.taskScan);
this.settingsForm.get('taskBackup')?.setValue(this.serverSettings.taskBackup);
this.settingsForm.get('ipAddresses')?.setValue(this.serverSettings.ipAddresses);
@@ -79,8 +83,8 @@ export class ManageSettingsComponent implements OnInit {
async saveSettings() {
const modelSettings = this.settingsForm.value;
-
- this.settingsService.updateServerSettings(modelSettings).pipe(take(1)).subscribe(async (settings: ServerSettings) => {
+ modelSettings.bookmarksDirectory = this.serverSettings.bookmarksDirectory;
+ this.settingsService.updateServerSettings(modelSettings).pipe(take(1)).subscribe((settings: ServerSettings) => {
this.serverSettings = settings;
this.resetForm();
this.toastr.success('Server settings updated');
@@ -90,7 +94,7 @@ export class ManageSettingsComponent implements OnInit {
}
resetToDefaults() {
- this.settingsService.resetServerSettings().pipe(take(1)).subscribe(async (settings: ServerSettings) => {
+ this.settingsService.resetServerSettings().pipe(take(1)).subscribe((settings: ServerSettings) => {
this.serverSettings = settings;
this.resetForm();
this.toastr.success('Server settings updated');
@@ -100,24 +104,24 @@ export class ManageSettingsComponent implements OnInit {
}
resetIPAddresses() {
- this.settingsService.resetIPAddressesSettings().pipe(take(1)).subscribe(async (settings: ServerSettings) => {
+ this.settingsService.resetIPAddressesSettings().pipe(take(1)).subscribe((settings: ServerSettings) => {
this.serverSettings.ipAddresses = settings.ipAddresses;
- this.settingsForm.get("ipAddresses")?.setValue(this.serverSettings.ipAddresses);
+ this.settingsForm.get('ipAddresses')?.setValue(this.serverSettings.ipAddresses);
this.toastr.success('IP Addresses Reset');
}, (err: any) => {
console.error('error: ', err);
});
}
- openDirectoryChooser(existingDirectory: string, formControl: string) {
- const modalRef = this.modalService.open(DirectoryPickerComponent, { scrollable: true, size: 'lg' });
- modalRef.componentInstance.startingFolder = existingDirectory || '';
- modalRef.componentInstance.helpUrl = '';
- modalRef.closed.subscribe((closeResult: DirectoryPickerResult) => {
- if (closeResult.success && closeResult.folderPath !== '') {
- this.settingsForm.get(formControl)?.setValue(closeResult.folderPath);
- this.settingsForm.markAsDirty();
- }
+ resetBaseUrl() {
+ this.settingsService.resetBaseUrl().pipe(take(1)).subscribe((settings: ServerSettings) => {
+ this.serverSettings.baseUrl = settings.baseUrl;
+ this.settingsForm.get('baseUrl')?.setValue(this.serverSettings.baseUrl);
+ this.toastr.success('Base Url Reset');
+ }, (err: any) => {
+ console.error('error: ', err);
});
}
+
+
}
diff --git a/UI/Web/src/app/admin/manage-users/manage-users.component.html b/UI/Web/src/app/admin/manage-users/manage-users.component.html
index 2c32c009d..4e8fc2e41 100644
--- a/UI/Web/src/app/admin/manage-users/manage-users.component.html
+++ b/UI/Web/src/app/admin/manage-users/manage-users.component.html
@@ -1,61 +1,35 @@
<div class="container-fluid">
- <ng-container>
- <div class="row mb-2">
- <div class="col-8"><h3>Pending Invites</h3></div>
- <div class="col-4"><button class="btn btn-primary float-end" (click)="inviteUser()"><i class="fa fa-plus" aria-hidden="true"></i><span class="phone-hidden">&nbsp;Invite</span></button></div>
- </div>
- <ul class="list-group">
- <li class="list-group-item no-hover" *ngFor="let invite of pendingInvites; let idx = index;">
- <div>
- <h4>
- <span id="member-name--{{idx}}">{{invite.username | titlecase}} </span>
- <div class="float-end">
- <button class="btn btn-danger btn-sm me-2" (click)="deleteUser(invite)">Cancel</button>
- <button class="btn btn-secondary btn-sm me-2" (click)="resendEmail(invite)">Resend</button>
- <button class="btn btn-secondary btn-sm" (click)="setup(invite)">Setup</button>
- </div>
- </h4>
-
- <div>Invited: {{invite.created | date: 'short'}}</div>
- </div>
- </li>
- <li *ngIf="loadingMembers" class="list-group-item no-hover">
- <div class="spinner-border text-secondary" role="status">
- <span class="invisible">Loading...</span>
- </div>
- </li>
- <li class="list-group-item no-hover" *ngIf="pendingInvites.length === 0 && !loadingMembers">
- There are no invited Users
- </li>
- </ul>
- </ng-container>
-
-
-
- <h3 class="mt-3">Active Users</h3>
+ <div class="row mb-2">
+ <div class="col-8"><h3>Active Users</h3></div>
+ <div class="col-4"><button class="btn btn-primary float-end" (click)="inviteUser()"><i class="fa fa-plus" aria-hidden="true"></i><span class="phone-hidden">&nbsp;Invite</span></button></div>
+ </div>
+
<ul class="list-group">
<li *ngFor="let member of members; let idx = index;" class="list-group-item no-hover">
<div>
<h4>
- <i class="presence fa fa-circle" title="Active" aria-hidden="true" *ngIf="false && (messageHub.onlineUsers$ | async)?.includes(member.id)"></i>
<span id="member-name--{{idx}}">{{member.username | titlecase}} </span>
<span *ngIf="member.username === loggedInUsername">
<i class="fas fa-star" aria-hidden="true"></i>
<span class="visually-hidden">(You)</span>
</span>
+ <span class="badge bg-secondary text-dark" *ngIf="member.isPending">Pending</span>
<div class="float-end" *ngIf="canEditMember(member)">
<button class="btn btn-danger btn-sm me-2" (click)="deleteUser(member)" placement="top" ngbTooltip="Delete User" attr.aria-label="Delete User {{member.username | titlecase}}"><i class="fa fa-trash" aria-hidden="true"></i></button>
- <button class="btn btn-secondary btn-sm me-2" (click)="updatePassword(member)" placement="top" ngbTooltip="Change Password" attr.aria-label="Change Password for {{member.username | titlecase}}"><i class="fa fa-key" aria-hidden="true"></i></button>
- <button class="btn btn-primary btn-sm" (click)="openEditUser(member)" placement="top" ngbTooltip="Edit" attr.aria-label="Edit {{member.username | titlecase}}"><i class="fa fa-pen" aria-hidden="true"></i></button>
+ <button class="btn btn-primary btn-sm me-2" (click)="openEditUser(member)" placement="top" ngbTooltip="Edit" attr.aria-label="Edit {{member.username | titlecase}}"><i class="fa fa-pen" aria-hidden="true"></i></button>
+
+ <button *ngIf="member.isPending" class="btn btn-secondary btn-sm me-2" (click)="resendEmail(member)" placement="top" ngbTooltip="Resend Invite" attr.aria-label="Delete Invite {{member.username | titlecase}}">Resend</button>
+ <button *ngIf="member.isPending" class="btn btn-secondary btn-sm me-2" (click)="setup(member)" placement="top" ngbTooltip="Setup User" attr.aria-label="Setup User {{member.username | titlecase}}">Setup</button>
+ <button *ngIf="!member.isPending" class="btn btn-secondary btn-sm" (click)="updatePassword(member)" placement="top" ngbTooltip="Change Password" attr.aria-label="Change Password for {{member.username | titlecase}}"><i class="fa fa-key" aria-hidden="true"></i></button>
</div>
</h4>
<div class="user-info">
<div>Last Active:
<span *ngIf="member.lastActive === '0001-01-01T00:00:00'; else activeDate">Never</span>
<ng-template #activeDate>
- {{member.lastActive | date: 'short'}}
+ {{member.lastActive | date: 'short'}} <i class="presence fa fa-circle ms-1" title="Online Now" aria-hidden="true" *ngIf="(messageHub.onlineUsers$ | async)?.includes(member.username)"></i>
</ng-template>
</div>
<div *ngIf="!hasAdminRole(member)">Sharing: {{formatLibraries(member)}}</div>
diff --git a/UI/Web/src/app/admin/manage-users/manage-users.component.scss b/UI/Web/src/app/admin/manage-users/manage-users.component.scss
index 418fbb3f3..51b0797b0 100644
--- a/UI/Web/src/app/admin/manage-users/manage-users.component.scss
+++ b/UI/Web/src/app/admin/manage-users/manage-users.component.scss
@@ -1,5 +1,6 @@
.presence {
font-size: 12px;
+ color: var(--primary-color);
}
.user-info > div {
diff --git a/UI/Web/src/app/admin/manage-users/manage-users.component.ts b/UI/Web/src/app/admin/manage-users/manage-users.component.ts
index 3bb43a2d2..cf9989629 100644
--- a/UI/Web/src/app/admin/manage-users/manage-users.component.ts
+++ b/UI/Web/src/app/admin/manage-users/manage-users.component.ts
@@ -1,9 +1,8 @@
import { Component, OnDestroy, OnInit } from '@angular/core';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
-import { catchError, take } from 'rxjs/operators';
+import { take } from 'rxjs/operators';
import { MemberService } from 'src/app/_services/member.service';
import { Member } from 'src/app/_models/auth/member';
-import { User } from 'src/app/_models/user';
import { AccountService } from 'src/app/_services/account.service';
import { ToastrService } from 'ngx-toastr';
import { ResetPasswordModalComponent } from '../_modals/reset-password-modal/reset-password-modal.component';
@@ -23,7 +22,6 @@ import { Router } from '@angular/router';
export class ManageUsersComponent implements OnInit, OnDestroy {
members: Member[] = [];
- pendingInvites: Member[] = [];
loggedInUsername = '';
loadingMembers = false;
@@ -47,8 +45,6 @@ export class ManageUsersComponent implements OnInit, OnDestroy {
ngOnInit(): void {
this.loadMembers();
-
- this.loadPendingInvites();
}
ngOnDestroy() {
@@ -58,7 +54,7 @@ export class ManageUsersComponent implements OnInit, OnDestroy {
loadMembers() {
this.loadingMembers = true;
- this.memberService.getMembers().subscribe(members => {
+ this.memberService.getMembers(true).subscribe(members => {
this.members = members;
// Show logged in user at the top of the list
this.members.sort((a: Member, b: Member) => {
@@ -75,24 +71,6 @@ export class ManageUsersComponent implements OnInit, OnDestroy {
});
}
- loadPendingInvites() {
- this.pendingInvites = [];
- this.memberService.getPendingInvites().subscribe(members => {
- this.pendingInvites = members;
- // Show logged in user at the top of the list
- this.pendingInvites.sort((a: Member, b: Member) => {
- if (a.username === this.loggedInUsername) return 1;
- if (b.username === this.loggedInUsername) return 1;
-
- const nameA = a.username.toUpperCase();
- const nameB = b.username.toUpperCase();
- if (nameA < nameB) return -1;
- if (nameA > nameB) return 1;
- return 0;
- })
- });
- }
-
canEditMember(member: Member): boolean {
return this.loggedInUsername !== member.username;
}
@@ -111,7 +89,6 @@ export class ManageUsersComponent implements OnInit, OnDestroy {
this.memberService.deleteMember(member.username).subscribe(() => {
setTimeout(() => {
this.loadMembers();
- this.loadPendingInvites();
this.toastr.success(member.username + ' has been deleted.');
}, 30); // SetTimeout because I've noticed this can run super fast and not give enough time for data to flush
});
@@ -121,10 +98,12 @@ export class ManageUsersComponent implements OnInit, OnDestroy {
inviteUser() {
const modalRef = this.modalService.open(InviteUserComponent, {size: 'lg'});
modalRef.closed.subscribe((successful: boolean) => {
- this.loadPendingInvites();
+ this.loadMembers();
});
}
+ log(o: any) {console.log(o)}
+
resendEmail(member: Member) {
this.serverService.isServerAccessible().subscribe(canAccess => {
this.accountService.resendConfirmationEmail(member.id).subscribe(async (email) => {
diff --git a/UI/Web/src/app/admin/role-selector/role-selector.component.ts b/UI/Web/src/app/admin/role-selector/role-selector.component.ts
index 1e703cf41..776b47ec0 100644
--- a/UI/Web/src/app/admin/role-selector/role-selector.component.ts
+++ b/UI/Web/src/app/admin/role-selector/role-selector.component.ts
@@ -53,8 +53,15 @@ export class RoleSelectorComponent implements OnInit {
foundRole[0].selected = true;
}
});
- this.cdRef.markForCheck();
+ } else {
+ // For new users, preselect LoginRole
+ this.selectedRoles.forEach(role => {
+ if (role.data == 'Login') {
+ role.selected = true;
+ }
+ });
}
+ this.cdRef.markForCheck();
}
handleModelUpdate() {
diff --git a/UI/Web/src/app/admin/settings.service.ts b/UI/Web/src/app/admin/settings.service.ts
index a35649d1a..558eade38 100644
--- a/UI/Web/src/app/admin/settings.service.ts
+++ b/UI/Web/src/app/admin/settings.service.ts
@@ -1,5 +1,6 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
+import { map } from 'rxjs';
import { environment } from 'src/environments/environment';
import { TextResonse } from '../_types/text-response';
import { ServerSettings } from './_models/server-settings';
@@ -25,6 +26,10 @@ export class SettingsService {
return this.http.get<ServerSettings>(this.baseUrl + 'settings');
}
+ getBaseUrl() {
+ return this.http.get<string>(this.baseUrl + 'settings/base-url', TextResonse);
+ }
+
updateServerSettings(model: ServerSettings) {
return this.http.post<ServerSettings>(this.baseUrl + 'settings', model);
}
@@ -37,6 +42,10 @@ export class SettingsService {
return this.http.post<ServerSettings>(this.baseUrl + 'settings/reset-ip-addresses', {});
}
+ resetBaseUrl() {
+ return this.http.post<ServerSettings>(this.baseUrl + 'settings/reset-base-url', {});
+ }
+
resetEmailServerSettings() {
return this.http.post<ServerSettings>(this.baseUrl + 'settings/reset-email-url', {});
}
@@ -58,6 +67,6 @@ export class SettingsService {
}
getOpdsEnabled() {
- return this.http.get<boolean>(this.baseUrl + 'settings/opds-enabled', TextResonse);
+ return this.http.get<string>(this.baseUrl + 'settings/opds-enabled', TextResonse).pipe(map(d => d === 'true'));
}
}
diff --git a/UI/Web/src/app/all-series/_components/all-series/all-series.component.html b/UI/Web/src/app/all-series/_components/all-series/all-series.component.html
index cb2eee35f..0845d2596 100644
--- a/UI/Web/src/app/all-series/_components/all-series/all-series.component.html
+++ b/UI/Web/src/app/all-series/_components/all-series/all-series.component.html
@@ -2,7 +2,7 @@
<h2 title>
{{title}}
</h2>
- <h6 subtitle *ngIf="pagination">{{pagination.totalItems}} Series</h6>
+ <h6 subtitle *ngIf="pagination">{{pagination.totalItems | number}} Series</h6>
</app-side-nav-companion-bar>
<app-bulk-operations [actionCallback]="bulkActionCallback"></app-bulk-operations>
<app-card-detail-layout
diff --git a/UI/Web/src/app/all-series/_components/all-series/all-series.component.ts b/UI/Web/src/app/all-series/_components/all-series/all-series.component.ts
index 0817c55af..a820b419c 100644
--- a/UI/Web/src/app/all-series/_components/all-series/all-series.component.ts
+++ b/UI/Web/src/app/all-series/_components/all-series/all-series.component.ts
@@ -78,7 +78,8 @@ export class AllSeriesComponent implements OnInit, OnDestroy {
});
break;
case Action.Delete:
- this.actionService.deleteMultipleSeries(selectedSeries, () => {
+ this.actionService.deleteMultipleSeries(selectedSeries, (successful) => {
+ if (!successful) return;
this.loadPage();
this.bulkSelectionService.deselectAll();
});
diff --git a/UI/Web/src/app/base-url.provider.ts b/UI/Web/src/app/base-url.provider.ts
new file mode 100644
index 000000000..d16dd02f7
--- /dev/null
+++ b/UI/Web/src/app/base-url.provider.ts
@@ -0,0 +1,3 @@
+export function getBaseUrl() : string {
+ return document.getElementsByTagName('base')[0]?.getAttribute('href') || '/';
+}
diff --git a/UI/Web/src/app/book-reader/_components/book-reader/book-reader.component.html b/UI/Web/src/app/book-reader/_components/book-reader/book-reader.component.html
index d894c5bd8..4f2024005 100644
--- a/UI/Web/src/app/book-reader/_components/book-reader/book-reader.component.html
+++ b/UI/Web/src/app/book-reader/_components/book-reader/book-reader.component.html
@@ -1,4 +1,4 @@
-<div class="container-flex {{darkMode ? 'dark-mode' : ''}} reader-container {{ColumnLayout}}" tabindex="0" #reader>
+<div class="container-flex {{darkMode ? 'dark-mode' : ''}} reader-container {{ColumnLayout}} {{WritingStyleClass}}" tabindex="0" #reader>
<div class="fixed-top" #stickyTop>
<a class="visually-hidden-focusable focus-visible" href="javascript:void(0);" (click)="moveFocus()">Skip to main content</a>
<ng-container [ngTemplateOutlet]="actionBar"></ng-container>
@@ -32,7 +32,7 @@
</div>
<div class="d-flex align-items-center justify-content-between text-center row g-0">
<button class="btn btn-small btn-icon col-1" [disabled]="prevChapterDisabled" (click)="loadPrevChapter()" title="Prev Chapter/Volume"><i class="fa fa-fast-backward" aria-hidden="true"></i></button>
- <div class="col-1">{{pageNum}}</div>
+ <div class="col-1" (click)="goToPage(0)">{{pageNum}}</div>
<div class="col-8">
<ngb-progressbar style="cursor: pointer" title="Go to page" (click)="goToPage()" type="primary" height="5px" [value]="pageNum" [max]="maxPages - 1"></ngb-progressbar>
</div>
@@ -52,6 +52,7 @@
(styleUpdate)="updateReaderStyles($event)"
(clickToPaginateChanged)="showPaginationOverlay($event)"
(fullscreen)="toggleFullscreen()"
+ (bookReaderWritingStyle)="updateWritingStyle($event)"
(layoutModeUpdate)="updateLayoutMode($event)"
(readingDirection)="updateReadingDirection($event)"
(immersiveMode)="updateImmersiveMode($event)"
@@ -72,27 +73,27 @@
</app-drawer>
</div>
- <div #readingSection class="reading-section {{ColumnLayout}}" [ngClass]="{'immersive' : immersiveMode || !actionBarVisible}" [@isLoading]="isLoading ? true : false">
-
+ <div #readingSection class="reading-section {{ColumnLayout}} {{WritingStyleClass}}" [ngStyle]="{'width': PageWidthForPagination}" [ngClass]="{'immersive' : immersiveMode || !actionBarVisible}" [@isLoading]="isLoading ? true : false">
+
<ng-container *ngIf="clickToPaginate">
<div class="left {{clickOverlayClass('left')}} no-observe" [ngClass]="{'immersive' : immersiveMode}"
(click)="movePage(readingDirection === ReadingDirection.LeftToRight ? PAGING_DIRECTION.BACKWARDS : PAGING_DIRECTION.FORWARD)"
tabindex="-1" [ngStyle]="{height: PageHeightForPagination}"></div>
- <div class="{{scrollbarNeeded ? 'right-with-scrollbar' : 'right'}} {{clickOverlayClass('right')}} no-observe"
+ <div class="{{scrollbarNeeded ? 'right-with-scrollbar' : 'right'}} {{clickOverlayClass('right')}} no-observe"
[ngClass]="{'immersive' : immersiveMode}"
(click)="movePage(readingDirection === ReadingDirection.LeftToRight ? PAGING_DIRECTION.FORWARD : PAGING_DIRECTION.BACKWARDS)"
tabindex="-1" [ngStyle]="{height: PageHeightForPagination}"></div>
</ng-container>
+ <div #bookContainer class="book-container {{WritingStyleClass}}" [ngClass]="{'immersive' : immersiveMode}">
- <div #bookContainer class="book-container" [ngClass]="{'immersive' : immersiveMode}">
-
- <div #readingHtml class="book-content {{ColumnLayout}}" [ngStyle]="{'max-height': ColumnHeight, 'column-width': ColumnWidth}"
- [ngClass]="{'immersive': immersiveMode && actionBarVisible}"
- [innerHtml]="page" *ngIf="page !== undefined" (click)="toggleMenu($event)" (mousedown)="mouseDown($event)"></div>
+ <div #readingHtml class="book-content {{ColumnLayout}} {{WritingStyleClass}}" [ngStyle]="{'max-height': ColumnHeight, 'max-width': VerticalBookContentWidth, 'width': VerticalBookContentWidth, 'column-width': ColumnWidth}"
+ [ngClass]="{'immersive': immersiveMode && actionBarVisible}"
+ [innerHtml]="page" *ngIf="page !== undefined" (click)="toggleMenu($event)" (mousedown)="mouseDown($event)" (wheel)="onWheel($event)"></div>
- <div *ngIf="page !== undefined && (scrollbarNeeded || layoutMode !== BookPageLayoutMode.Default)" (click)="$event.stopPropagation();"
- [ngClass]="{'bottom-bar': layoutMode !== BookPageLayoutMode.Default}">
+ <div *ngIf="page !== undefined && (scrollbarNeeded || layoutMode !== BookPageLayoutMode.Default) && !(writingStyle === WritingStyle.Vertical && layoutMode === BookPageLayoutMode.Default)"
+ (click)="$event.stopPropagation();"
+ [ngClass]="{'bottom-bar': layoutMode !== BookPageLayoutMode.Default}">
<ng-container [ngTemplateOutlet]="actionBar"></ng-container>
</div>
</div>
diff --git a/UI/Web/src/app/book-reader/_components/book-reader/book-reader.component.scss b/UI/Web/src/app/book-reader/_components/book-reader/book-reader.component.scss
index 10012af05..976a3134f 100644
--- a/UI/Web/src/app/book-reader/_components/book-reader/book-reader.component.scss
+++ b/UI/Web/src/app/book-reader/_components/book-reader/book-reader.component.scss
@@ -1,36 +1,43 @@
@font-face {
font-family: "Fira_Sans";
src: url(../../../../assets/fonts/Fira_Sans/FiraSans-Regular.ttf) format("truetype");
+ font-display: swap;
}
@font-face {
font-family: "Lato";
src: url(../../../../assets/fonts/Lato/Lato-Regular.ttf) format("truetype");
+ font-display: swap;
}
@font-face {
font-family: "Libre_Baskerville";
src: url(../../../../assets/fonts/Libre_Baskerville/LibreBaskerville-Regular.ttf) format("truetype");
+ font-display: swap;
}
@font-face {
font-family: "Merriweather";
src: url(../../../../assets/fonts/Merriweather/Merriweather-Regular.ttf) format("truetype");
+ font-display: swap;
}
@font-face {
font-family: "Nanum_Gothic";
src: url(../../../../assets/fonts/Nanum_Gothic/NanumGothic-Regular.ttf) format("truetype");
+ font-display: swap;
}
@font-face {
font-family: "RocknRoll_One";
src: url(../../../../assets/fonts/RocknRoll_One/RocknRollOne-Regular.ttf) format("truetype");
+ font-display: swap;
}
@font-face {
font-family: "OpenDyslexic2";
src: url(../../../../assets/fonts/OpenDyslexic2/OpenDyslexic-Regular.otf) format("opentype");
+ font-display: swap;
}
:root {
@@ -80,6 +87,7 @@ $action-bar-height: 38px;
.fixed-top {
z-index: 1022;
+ direction: ltr;
}
.dark-mode .overlay {
@@ -88,7 +96,7 @@ $action-bar-height: 38px;
.action-bar {
- background-color: var(--br-actionbar-bg-color);
+ background-color: var(--br-actionbar-bg-color);
overflow: hidden;
box-shadow: 0 0 6px 0 rgb(0 0 0 / 70%);
max-height: $action-bar-height;
@@ -102,13 +110,13 @@ $action-bar-height: 38px;
-webkit-box-orient: vertical;
overflow: hidden;
}
-
+
@media(max-width: 875px) {
.book-title {
display: none;
}
- }
-
+ }
+
.book-title {
margin-top: 10px;
text-align: center;
@@ -135,6 +143,10 @@ $action-bar-height: 38px;
&.column-layout-2 {
height: calc(var(--vh) * 100);
}
+
+ &.writing-style-vertical {
+ direction: rtl;
+ }
}
.reading-section {
@@ -144,6 +156,7 @@ $action-bar-height: 38px;
padding-top: $action-bar-height;
padding-bottom: $action-bar-height;
position: relative;
+ direction: ltr;
//background-color: green !important;
@@ -160,12 +173,18 @@ $action-bar-height: 38px;
//padding-top: 0px;
//padding-bottom: 0px;
}
+
+ &.writing-style-vertical {
+ writing-mode: vertical-rl;
+ height: 100%;
+ }
}
.book-container {
position: relative;
height: 100%;
+
//background-color: purple !important;
&.column-layout-1 {
@@ -175,6 +194,12 @@ $action-bar-height: 38px;
&.column-layout-2 {
height: calc((var(--vh, 1vh) * 100) - $action-bar-height);
}
+
+ &.writing-style-vertical {
+ // Fixes an issue where chrome will cut of margins, doesn't seem to affect other browsers
+ overflow: auto;
+ }
+
}
.book-content {
@@ -185,17 +210,31 @@ $action-bar-height: 38px;
&.column-layout-1 {
height: calc((var(--vh) * 100) - calc($action-bar-height)); // * 2
+
+ &.writing-style-vertical {
+ padding: 0 10px 0 0;
+ margin: 20px 0;
+ }
}
&.column-layout-2 {
height: calc((var(--vh) * 100) - calc($action-bar-height)); // * 2
+
+ &.writing-style-vertical {
+ padding: 0 10px 0 0;
+ margin: 20px 0;
+ }
}
- &.immersive {
- // Note: I removed this for bug: https://github.com/Kareadita/Kavita/issues/1726
- //height: calc((var(--vh, 1vh) * 100) - $action-bar-height);
+ &.writing-style-vertical {
+ height: auto;
}
+ // &.immersive {
+ // // Note: I removed this for bug: https://github.com/Kareadita/Kavita/issues/1726
+ // //height: calc((var(--vh, 1vh) * 100) - $action-bar-height);
+ // }
+
a, :link {
color: var(--brtheme-link-text-color);
}
@@ -221,6 +260,8 @@ $action-bar-height: 38px;
position: fixed;
width: 100%;
bottom: 0px;
+ left: 0px;
+ writing-mode: horizontal-tb;
}
@@ -235,7 +276,7 @@ $action-bar-height: 38px;
overflow-wrap: break-word;
}
-
+
}
.column-layout-2 {
@@ -247,7 +288,7 @@ $action-bar-height: 38px;
overflow-wrap: break-word;
}
-
+
}
@@ -262,11 +303,18 @@ $action-bar-height: 38px;
::ng-deep .kavita-scale-width-container {
width: auto;
max-height: calc(var(--book-reader-content-max-height) - ($action-bar-height)) !important;
+ max-width: calc(var(--book-reader-content-max-width)) !important;
+ position: var(--book-reader-content-position) !important;
+ top: var(--book-reader-content-top) !important;
+ left: var(--book-reader-content-left) !important;
+ transform: var(--book-reader-content-transform) !important;
+
}
// This is applied to images in the backend
::ng-deep .kavita-scale-width {
- max-width: 100%;
+ max-height: calc(var(--book-reader-content-max-height) - ($action-bar-height)) !important;
+ max-width: calc(var(--book-reader-content-max-width)) !important;
object-fit: contain;
object-position: top center;
break-inside: avoid;
@@ -286,7 +334,7 @@ $action-bar-height: 38px;
position: absolute;
right: 0px;
top: $action-bar-height;
- width: 20%;
+ width: 20vw;
z-index: 3;
cursor: pointer;
background: transparent;
@@ -323,7 +371,7 @@ $action-bar-height: 38px;
position: absolute;
left: 0px;
top: $action-bar-height;
- width: 20%;
+ width: 20vw;
background: transparent;
border-color: transparent;
border: none !important;
@@ -335,6 +383,7 @@ $action-bar-height: 38px;
&.immersive {
top: 0px;
}
+
}
@@ -353,7 +402,7 @@ $action-bar-height: 38px;
.btn {
&.btn-secondary {
- color: var(--br-actionbar-button-text-color);
+ color: var(--br-actionbar-button-text-color);
border-color: transparent;
background-color: unset;
@@ -361,7 +410,7 @@ $action-bar-height: 38px;
border-color: var(--br-actionbar-button-hover-border-color);
}
}
-
+
&.btn-outline-secondary {
border-color: transparent;
background-color: unset;
@@ -373,7 +422,7 @@ $action-bar-height: 38px;
span {
background-color: unset;
- color: var(--br-actionbar-button-text-color);
+ color: var(--br-actionbar-button-text-color);
}
i {
diff --git a/UI/Web/src/app/book-reader/_components/book-reader/book-reader.component.ts b/UI/Web/src/app/book-reader/_components/book-reader/book-reader.component.ts
index ac2086c7f..26d683c7c 100644
--- a/UI/Web/src/app/book-reader/_components/book-reader/book-reader.component.ts
+++ b/UI/Web/src/app/book-reader/_components/book-reader/book-reader.component.ts
@@ -17,6 +17,7 @@ import { animate, state, style, transition, trigger } from '@angular/animations'
import { Stack } from 'src/app/shared/data-structures/stack';
import { MemberService } from 'src/app/_services/member.service';
import { ReadingDirection } from 'src/app/_models/preferences/reading-direction';
+import {WritingStyle} from "../../../_models/preferences/writing-style";
import { MangaFormat } from 'src/app/_models/manga-format';
import { LibraryService } from 'src/app/_services/library.service';
import { LibraryType } from 'src/app/_models/library';
@@ -42,11 +43,12 @@ interface HistoryPoint {
/**
* XPath to scroll to
*/
- scrollPart: string;
+ scrollPart: string;
}
const TOP_OFFSET = -50 * 1.5; // px the sticky header takes up // TODO: Do I need this or can I change it with new fixed top height
+const COLUMN_GAP = 20; // px
/**
* Styles that should be applied on the top level book-content tag
*/
@@ -120,7 +122,10 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
* TODO: See if continuousChaptersStack can be moved into reader service so we can reduce code duplication between readers (and also use ChapterInfo with it instead)
*/
continuousChaptersStack: Stack<number> = new Stack();
-
+ /*
+ * The current page only contains an image. This is used to determine if we should show the image in the center of the screen.
+ */
+ isSingleImagePage = false;
/**
* Belongs to the drawer component
*/
@@ -151,6 +156,7 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
clickToPaginateVisualOverlay = false;
clickToPaginateVisualOverlayTimeout: any = undefined; // For animation
clickToPaginateVisualOverlayTimeout2: any = undefined; // For kicking off animation, giving enough time to render html
+ updateImageSizeTimeout: any = undefined;
/**
* This is the html we get from the server
*/
@@ -201,6 +207,8 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
* Used for showing/hiding bottom action bar. Calculates if there is enough scroll to show it.
* Will hide if all content in book is absolute positioned
*/
+
+ horizontalScrollbarNeeded = false;
scrollbarNeeded = false;
readingDirection: ReadingDirection = ReadingDirection.LeftToRight;
clickToPaginate = false;
@@ -250,6 +258,8 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
*/
pagingDirection: PAGING_DIRECTION = PAGING_DIRECTION.FORWARD;
+ writingStyle: WritingStyle = WritingStyle.Horizontal;
+
private readonly onDestroy = new Subject<void>();
@ViewChild('bookContainer', {static: false}) bookContainerElemRef!: ElementRef<HTMLDivElement>;
@@ -266,6 +276,9 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
return BookPageLayoutMode;
}
+ get WritingStyle() {
+ return WritingStyle;
+ }
get TabID(): typeof TabID {
return TabID;
}
@@ -346,26 +359,36 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
}
get ColumnWidth() {
+ const base = this.writingStyle === WritingStyle.Vertical ? this.windowHeight : this.windowWidth;
switch (this.layoutMode) {
case BookPageLayoutMode.Default:
return 'unset';
case BookPageLayoutMode.Column1:
- return (this.windowWidth /2) + 'px';
+ return (base / 2) + 'px';
case BookPageLayoutMode.Column2:
- return ((this.windowWidth / 4)) + 'px';
+ return (base / 4) + 'px';
+ default:
+ return 'unset';
}
}
get ColumnHeight() {
- if (this.layoutMode !== BookPageLayoutMode.Default) {
+ if (this.layoutMode !== BookPageLayoutMode.Default || this.writingStyle === WritingStyle.Vertical) {
// Take the height after page loads, subtract the top/bottom bar
const height = this.windowHeight - (this.topOffset * 2);
- this.document.documentElement.style.setProperty('--book-reader-content-max-height', `${height}px`);
return height + 'px';
}
return 'unset';
}
+ get VerticalBookContentWidth() {
+ if (this.layoutMode !== BookPageLayoutMode.Default && this.writingStyle !== WritingStyle.Horizontal ) {
+ const width = this.getVerticalPageWidth()
+ return width + 'px';
+ }
+ return '';
+ }
+
get ColumnLayout() {
switch (this.layoutMode) {
case BookPageLayoutMode.Default:
@@ -377,6 +400,22 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
}
}
+ get WritingStyleClass() {
+ switch (this.writingStyle) {
+ case WritingStyle.Horizontal:
+ return '';
+ case WritingStyle.Vertical:
+ return 'writing-style-vertical';
+ }
+ }
+
+ get PageWidthForPagination() {
+ if (this.layoutMode === BookPageLayoutMode.Default && this.writingStyle === WritingStyle.Vertical && this.horizontalScrollbarNeeded) {
+ return 'unset';
+ }
+ return '100%'
+ }
+
get PageHeightForPagination() {
if (this.layoutMode === BookPageLayoutMode.Default) {
// if the book content is less than the height of the container, override and return height of container for pagination area
@@ -531,7 +570,7 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
this.router.navigate(this.readerService.getNavigationArray(info.libraryId, info.seriesId, this.chapterId, info.seriesFormat), {queryParams: params});
return;
}
-
+
this.bookTitle = info.bookTitle;
this.cdRef.markForCheck();
@@ -554,8 +593,7 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
this.libraryType = type;
});
- this.updateImagesWithHeight();
-
+ this.updateImageSizes();
if (this.pageNum >= this.maxPages) {
this.pageNum = this.maxPages - 1;
@@ -599,7 +637,7 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
onResize(){
// Update the window Height
this.updateWidthAndHeightCalcs();
-
+ this.updateImageSizes();
const resumeElement = this.getFirstVisibleElementXPath();
if (this.layoutMode !== BookPageLayoutMode.Default && resumeElement !== null && resumeElement !== undefined) {
this.scrollTo(resumeElement); // This works pretty well, but not perfect
@@ -625,6 +663,17 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
}
}
+ onWheel(event: WheelEvent) {
+ // This allows the user to scroll the page horizontally without holding shift
+ if (this.layoutMode !== BookPageLayoutMode.Default || this.writingStyle !== WritingStyle.Vertical) {
+ return;
+ }
+ if (event.deltaY !== 0) {
+ event.preventDefault()
+ this.scrollService.scrollToX( event.deltaY + this.reader.nativeElement.scrollLeft, this.reader.nativeElement);
+ }
+}
+
closeReader() {
this.readerService.closeReader(this.readingListMode, this.readingListId);
}
@@ -674,7 +723,7 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
this.isLoading = false;
this.cdRef.markForCheck();
return;
- }
+ }
if (this.prevChapterId === CHAPTER_ID_NOT_FETCHED || this.prevChapterId === this.chapterId && !this.prevChapterPrefetched) {
this.readerService.getPrevChapter(this.seriesId, this.volumeId, this.chapterId, this.readingListId).pipe(take(1)).subscribe(chapterId => {
@@ -788,9 +837,13 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
this.cdRef.markForCheck();
this.bookService.getBookPage(this.chapterId, this.pageNum).pipe(take(1)).subscribe(content => {
+ this.isSingleImagePage = this.checkSingleImagePage(content) // This needs be performed before we set this.page to avoid image jumping
+ this.updateSingleImagePageStyles()
this.page = this.domSanitizer.bypassSecurityTrustHtml(content); // PERF: Potential optimization to prefetch next/prev page and store in localStorage
+
+
this.cdRef.markForCheck();
-
+
setTimeout(() => {
this.addLinkClickHandlers();
this.updateReaderStyles(this.pageStyles);
@@ -806,30 +859,80 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
.map(img => new Promise(resolve => { img.onload = img.onerror = resolve; })))
.then(() => {
this.setupPage(part, scrollTop);
- this.updateImagesWithHeight();
+ this.updateImageSizes();
});
}, 10);
});
}
/**
- * Applies a max-height inline css property on each image in the page if the layout mode is column-based, else it removes the property
+ * Updates the image properties to fit the current layout mode and screen size
*/
- updateImagesWithHeight() {
- const images = this.readingSectionElemRef?.nativeElement.querySelectorAll('img') || [];
+ updateImageSizes() {
+ const isVerticalWritingStyle = this.writingStyle === WritingStyle.Vertical;
+ const height = this.windowHeight - (this.topOffset * 2);
+ let maxHeight = 'unset';
+ let maxWidth = '';
+ switch (this.layoutMode) {
+ case BookPageLayoutMode.Default:
+ if (isVerticalWritingStyle) {
+ maxHeight = `${height}px`;
+ } else {
+ maxWidth = `${this.getVerticalPageWidth()}px`;
+ }
+ break
- if (this.layoutMode !== BookPageLayoutMode.Default) {
- const height = (parseInt(this.ColumnHeight.replace('px', ''), 10) - (this.topOffset * 2)) + 'px';
- Array.from(images).forEach(img => {
- this.renderer.setStyle(img, 'max-height', height);
- });
+ case BookPageLayoutMode.Column1:
+ maxHeight = `${height}px`;
+ maxWidth = `${this.getVerticalPageWidth()}px`;
+ break
+
+ case BookPageLayoutMode.Column2:
+ maxWidth = `${this.getVerticalPageWidth()}px`;
+ if (isVerticalWritingStyle && !this.isSingleImagePage) {
+ maxHeight = `${height / 2}px`;
+ } else {
+ maxHeight = `${height}px`;
+ }
+ break
+ }
+ this.document.documentElement.style.setProperty('--book-reader-content-max-height', maxHeight);
+ this.document.documentElement.style.setProperty('--book-reader-content-max-width', maxWidth);
+
+ }
+
+ updateSingleImagePageStyles() {
+ if (this.isSingleImagePage && this.layoutMode !== BookPageLayoutMode.Default) {
+ this.document.documentElement.style.setProperty('--book-reader-content-position', 'absolute');
+ this.document.documentElement.style.setProperty('--book-reader-content-top', '50%');
+ this.document.documentElement.style.setProperty('--book-reader-content-left', '50%');
+ this.document.documentElement.style.setProperty('--book-reader-content-transform', 'translate(-50%, -50%)');
} else {
- Array.from(images).forEach(img => {
- this.renderer.removeStyle(img, 'max-height');
- });
+ this.document.documentElement.style.setProperty('--book-reader-content-position', '');
+ this.document.documentElement.style.setProperty('--book-reader-content-top', '');
+ this.document.documentElement.style.setProperty('--book-reader-content-left', '');
+ this.document.documentElement.style.setProperty('--book-reader-content-transform', '');
}
}
+ checkSingleImagePage(content: string) {
+ // Exclude the style element from the HTML content as it messes up innerText
+ const htmlContent = content.replace(/<style>.*<\/style>/s, '');
+
+ const parser = new DOMParser();
+ const doc = parser.parseFromString(htmlContent, 'text/html');
+ const html = doc.querySelector('html');
+
+ if (html?.innerText.trim() !== '') {
+ return false;
+ }
+
+ const images = doc.querySelectorAll('img, svg');
+ return images.length === 1;
+
+ }
+
+
setupPage(part?: string | undefined, scrollTop?: number | undefined) {
this.isLoading = false;
this.cdRef.markForCheck();
@@ -846,11 +949,20 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
this.scrollTo(part);
} else if (scrollTop !== undefined && scrollTop !== 0) {
this.scrollService.scrollTo(scrollTop, this.reader.nativeElement);
+ } else if ((this.writingStyle === WritingStyle.Vertical) && (this.layoutMode === BookPageLayoutMode.Default)) {
+ setTimeout(()=> this.scrollService.scrollToX(this.bookContentElemRef.nativeElement.clientWidth, this.reader.nativeElement));
} else {
if (this.layoutMode === BookPageLayoutMode.Default) {
this.scrollService.scrollTo(0, this.reader.nativeElement);
- } else {
+ } else if (this.writingStyle === WritingStyle.Vertical) {
+ if (this.pagingDirection === PAGING_DIRECTION.BACKWARDS) {
+ setTimeout(() => this.scrollService.scrollTo(this.bookContentElemRef.nativeElement.scrollHeight, this.bookContentElemRef.nativeElement, 'auto'));
+ } else {
+ setTimeout(() => this.scrollService.scrollTo(0, this.bookContentElemRef.nativeElement,'auto' ));
+ }
+ }
+ else {
this.reader.nativeElement.children
// We need to check if we are paging back, because we need to adjust the scroll
if (this.pagingDirection === PAGING_DIRECTION.BACKWARDS) {
@@ -858,7 +970,7 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
} else {
setTimeout(() => this.scrollService.scrollToX(0, this.bookContentElemRef.nativeElement));
}
- }
+ }
}
// we need to click the document before arrow keys will scroll down.
@@ -909,7 +1021,7 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
/**
* Given a direction, calls the next or prev page method
- * @param direction Direction to move
+ * @param direction Direction to move
*/
movePage(direction: PAGING_DIRECTION) {
if (direction === PAGING_DIRECTION.BACKWARDS) {
@@ -931,7 +1043,11 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
if (currentVirtualPage > 1) {
// -2 apparently goes back 1 virtual page...
- this.scrollService.scrollToX((currentVirtualPage - 2) * pageWidth, this.bookContentElemRef.nativeElement);
+ if (this.writingStyle === WritingStyle.Vertical) {
+ this.scrollService.scrollTo((currentVirtualPage - 2) * pageWidth, this.bookContentElemRef.nativeElement, 'auto');
+ } else {
+ this.scrollService.scrollToX((currentVirtualPage - 2) * pageWidth, this.bookContentElemRef.nativeElement);
+ }
this.handleScrollEvent();
return;
}
@@ -956,14 +1072,17 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
}
this.pagingDirection = PAGING_DIRECTION.FORWARD;
-
// We need to handle virtual paging before we increment the actual page
if (this.layoutMode !== BookPageLayoutMode.Default) {
const [currentVirtualPage, totalVirtualPages, pageWidth] = this.getVirtualPage();
if (currentVirtualPage < totalVirtualPages) {
// +0 apparently goes forward 1 virtual page...
- this.scrollService.scrollToX((currentVirtualPage) * pageWidth, this.bookContentElemRef.nativeElement);
+ if (this.writingStyle === WritingStyle.Vertical) {
+ this.scrollService.scrollTo( (currentVirtualPage) * pageWidth, this.bookContentElemRef.nativeElement, 'auto');
+ } else {
+ this.scrollService.scrollToX((currentVirtualPage) * pageWidth, this.bookContentElemRef.nativeElement);
+ }
this.handleScrollEvent();
return;
}
@@ -985,47 +1104,75 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
}
/**
- *
+ *
* @returns Total Page width (excluding margin)
*/
getPageWidth() {
if (this.readingSectionElemRef == null) return 0;
-
const margin = (this.readingSectionElemRef.nativeElement.clientWidth * (parseInt(this.pageStyles['margin-left'], 10) / 100)) * 2;
- const columnGap = 20;
- return this.readingSectionElemRef.nativeElement.clientWidth - margin + columnGap;
+
+ return this.readingSectionElemRef.nativeElement.clientWidth - margin + COLUMN_GAP;
+ }
+
+ getPageHeight() {
+ if (this.readingSectionElemRef == null) return 0;
+ const height = (parseInt(this.ColumnHeight.replace('px', ''), 10));
+
+ return height - COLUMN_GAP;
+ }
+
+ getVerticalPageWidth() {
+ const margin = (window.innerWidth * (parseInt(this.pageStyles['margin-left'], 10) / 100)) * 2;
+ const windowWidth = window.innerWidth || document.documentElement.clientWidth;
+ return windowWidth - margin;
}
/**
* currentVirtualPage starts at 1
- * @returns
+ * @returns
*/
getVirtualPage() {
- if (this.bookContentElemRef === undefined || this.readingSectionElemRef === undefined) return [1, 1, 0];
+ if (!this.bookContentElemRef || !this.readingSectionElemRef) return [1, 1, 0];
- const scrollOffset = this.bookContentElemRef.nativeElement.scrollLeft;
- const totalScroll = this.bookContentElemRef.nativeElement.scrollWidth;
- const pageWidth = this.getPageWidth();
- const delta = totalScroll - scrollOffset;
-
- const totalVirtualPages = Math.max(1, Math.round((totalScroll) / pageWidth));
+ const [scrollOffset, totalScroll] = this.getScrollOffsetAndTotalScroll();
+ const pageSize = this.getPageSize();
+ const totalVirtualPages = Math.max(1, Math.round(totalScroll / pageSize));
+ const delta = scrollOffset - totalScroll;
let currentVirtualPage = 1;
- // If first virtual page, i.e. totalScroll and delta are the same value
- if (totalScroll - delta === 0) {
+ //If first virtual page, i.e. totalScroll and delta are the same value
+ if (totalScroll === delta) {
currentVirtualPage = 1;
- // If second virtual page
- } else if (totalScroll - delta === pageWidth) {
+ // If second virtual page
+ } else if (totalScroll - delta === pageSize) {
currentVirtualPage = 2;
-
- // Otherwise do math to get correct page. i.e. scrollOffset + pageWidth (this accounts for first page offset)
+ // Otherwise do math to get correct page. i.e. scroll + pageHeight/pageWidth (this accounts for first page offset)
} else {
- currentVirtualPage = Math.min(Math.max(1, Math.round((scrollOffset + pageWidth) / pageWidth)), totalVirtualPages);
- }
+ currentVirtualPage = Math.min(Math.max(1, Math.round((scrollOffset + pageSize) / pageSize)), totalVirtualPages);
+ }
+
+ return [currentVirtualPage, totalVirtualPages, pageSize];
+
+ }
- return [currentVirtualPage, totalVirtualPages, pageWidth];
+ private getScrollOffsetAndTotalScroll() {
+ const { nativeElement: bookContent } = this.bookContentElemRef;
+ const scrollOffset = this.writingStyle === WritingStyle.Vertical
+ ? bookContent.scrollTop
+ : bookContent.scrollLeft;
+ const totalScroll = this.writingStyle === WritingStyle.Vertical
+ ? bookContent.scrollHeight
+ : bookContent.scrollWidth;
+ return [scrollOffset, totalScroll];
}
+ private getPageSize() {
+ return this.writingStyle === WritingStyle.Vertical
+ ? this.getPageHeight()
+ : this.getPageWidth();
+ }
+
+
getFirstVisibleElementXPath() {
let resumeElement: string | null = null;
if (this.bookContentElemRef === null) return null;
@@ -1059,6 +1206,8 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
// Before we apply styles, let's get an element on the screen so we can scroll to it after any shifts
const resumeElement: string | null | undefined = this.getFirstVisibleElementXPath();
+ // Needs to update the image size when reading mode is vertically
+ this.updateImageSizes();
// Line Height must be placed on each element in the page
@@ -1097,7 +1246,7 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
/**
* Applies styles and classes that control theme
- * @param theme
+ * @param theme
*/
updateColorTheme(theme: BookTheme) {
// Remove all themes
@@ -1121,6 +1270,7 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
// Recalculate if bottom action bar is needed
this.scrollbarNeeded = this.bookContentElemRef?.nativeElement?.clientHeight > this.reader?.nativeElement?.clientHeight;
+ this.horizontalScrollbarNeeded = this.bookContentElemRef?.nativeElement?.clientWidth > this.reader?.nativeElement?.clientWidth;
this.cdRef.markForCheck();
}
@@ -1148,7 +1298,12 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
if (element === null) return;
- if (this.layoutMode === BookPageLayoutMode.Default) {
+ if(this.layoutMode === BookPageLayoutMode.Default && this.writingStyle === WritingStyle.Vertical ) {
+ const windowWidth = window.innerWidth || document.documentElement.clientWidth;
+ const scrollLeft = element.getBoundingClientRect().left + window.pageXOffset - (windowWidth - element.getBoundingClientRect().width);
+ setTimeout(() => this.scrollService.scrollToX(scrollLeft, this.reader.nativeElement, 'smooth'), 10);
+ }
+ else if ((this.layoutMode === BookPageLayoutMode.Default) && (this.writingStyle === WritingStyle.Horizontal)) {
const fromTopOffset = element.getBoundingClientRect().top + window.pageYOffset + TOP_OFFSET;
// We need to use a delay as webkit browsers (aka apple devices) don't always have the document rendered by this point
setTimeout(() => this.scrollService.scrollTo(fromTopOffset, this.reader.nativeElement), 10);
@@ -1210,7 +1365,7 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
this.isFullscreen = true;
this.cdRef.markForCheck();
// HACK: This is a bug with how browsers change the background color for fullscreen mode
- this.renderer.setStyle(this.reader.nativeElement, 'background', this.themeService.getCssVariable('--bs-body-color'));
+ this.renderer.setStyle(this.reader.nativeElement, 'background', this.themeService.getCssVariable('--bs-body-color'));
if (!this.darkMode) {
this.renderer.setStyle(this.reader.nativeElement, 'background', 'white');
}
@@ -1218,13 +1373,36 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
}
}
+ updateWritingStyle(writingStyle: WritingStyle) {
+ this.writingStyle = writingStyle;
+ setTimeout(() => this.updateImageSizes());
+ if (this.layoutMode !== BookPageLayoutMode.Default) {
+ const lastSelector = this.lastSeenScrollPartPath;
+ setTimeout(() => {
+ this.scrollTo(lastSelector);
+ });
+ } else if (this.bookContentElemRef !== undefined) {
+ const resumeElement = this.getFirstVisibleElementXPath();
+ if (resumeElement) {
+ setTimeout(() => {
+ this.scrollTo(resumeElement);
+ });
+ }
+ }
+ this.cdRef.markForCheck();
+ }
+
updateLayoutMode(mode: BookPageLayoutMode) {
const layoutModeChanged = mode !== this.layoutMode;
this.layoutMode = mode;
this.cdRef.markForCheck();
- // Remove any max-heights from column layout
- this.updateImagesWithHeight();
+ this.clearTimeout(this.updateImageSizeTimeout);
+ this.updateImageSizeTimeout = setTimeout( () => {
+ this.updateImageSizes()
+ }, 200);
+
+ this.updateSingleImagePageStyles()
// Calulate if bottom actionbar is needed. On a timeout to get accurate heights
if (this.bookContentElemRef == null) {
@@ -1233,10 +1411,11 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
}
setTimeout(() => {
this.scrollbarNeeded = this.bookContentElemRef?.nativeElement?.clientHeight > this.reader?.nativeElement?.clientHeight;
+ this.horizontalScrollbarNeeded = this.bookContentElemRef?.nativeElement?.clientWidth > this.reader?.nativeElement?.clientWidth;
this.cdRef.markForCheck();
});
- // When I switch layout, I might need to resume the progress point.
+ // When I switch layout, I might need to resume the progress point.
if (mode === BookPageLayoutMode.Default && layoutModeChanged) {
const lastSelector = this.lastSeenScrollPartPath;
setTimeout(() => this.scrollTo(lastSelector));
@@ -1263,7 +1442,6 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
setTimeout(() => {
if (renderer === undefined || elem === undefined) return;
if (this.immersiveMode) {
- renderer.setStyle(elem, 'height', 'calc(var(--vh, 1vh) * 100)', RendererStyleFlags2.Important);
} else {
renderer.setStyle(elem, 'height', 'calc(var(--vh, 1vh) * 100 - ' + this.topOffset + 'px)', RendererStyleFlags2.Important);
}
diff --git a/UI/Web/src/app/book-reader/_components/reader-settings/reader-settings.component.html b/UI/Web/src/app/book-reader/_components/reader-settings/reader-settings.component.html
index f28ce296e..30c5e8520 100644
--- a/UI/Web/src/app/book-reader/_components/reader-settings/reader-settings.component.html
+++ b/UI/Web/src/app/book-reader/_components/reader-settings/reader-settings.component.html
@@ -70,6 +70,16 @@
<span class="phone-hidden">&nbsp;{{readingDirectionModel === ReadingDirection.LeftToRight ? 'Left to Right' : 'Right to Left'}}</span>
</button>
</div>
+ <div class="controls" style="display: flex; justify-content: space-between; align-items: center; ">
+ <label for="writing-style" class="form-label">Writing Style <i class="fa fa-info-circle" aria-hidden="true" placement="top" [ngbTooltip]="writingStyleTooltip" role="button" tabindex="0" aria-describedby="writingStyle-help"></i></label>
+ <ng-template #writingStyleTooltip>Changes the direction of the text. Horizontal is left to right, vertical is top to bottom.</ng-template>
+ <span class="visually-hidden" id="writingStyle-help"><ng-container [ngTemplateOutlet]="writingStyleTooltip"></ng-container></span>
+ <button (click)="toggleWritingStyle()" id="writing-style" class="btn btn-icon" aria-labelledby="writingStyle-help" title="{{writingStyleModel === WritingStyle.Horizontal ? 'Horizontal' : 'Vertical'}}">
+ <i class="fa {{writingStyleModel === WritingStyle.Horizontal ? 'fa-arrows-left-right' : 'fa-arrows-up-down' }}" aria-hidden="true"></i>
+ <span class="phone-hidden"> {{writingStyleModel === WritingStyle.Horizontal ? 'Horizontal' : 'Vertical' }}</span>
+ </button>
+
+ </div>
<div class="controls" style="display:flex; justify-content:space-between; align-items:center;">
<label for="tap-pagination" class="form-label">Tap Pagination&nbsp;<i class="fa fa-info-circle" aria-hidden="true" placement="top" [ngbTooltip]="tapPaginationTooltip" role="button" tabindex="0" aria-describedby="tapPagination-help"></i></label>
<ng-template #tapPaginationTooltip>Click the edges of the screen to paginate</ng-template>
@@ -116,10 +126,10 @@
<div class="btn-group d-flex justify-content-center" role="group" aria-label="Layout Mode">
<input type="radio" formControlName="layoutMode" [value]="BookPageLayoutMode.Default" class="btn-check" id="layout-mode-default" autocomplete="off">
<label class="btn btn-outline-primary" for="layout-mode-default">Scroll</label>
-
+
<input type="radio" formControlName="layoutMode" [value]="BookPageLayoutMode.Column1" class="btn-check" id="layout-mode-col1" autocomplete="off">
<label class="btn btn-outline-primary" for="layout-mode-col1">1 Column</label>
-
+
<input type="radio" formControlName="layoutMode" [value]="BookPageLayoutMode.Column2" class="btn-check" id="layout-mode-col2" autocomplete="off">
<label class="btn btn-outline-primary" for="layout-mode-col2">2 Column</label>
</div>
@@ -150,4 +160,4 @@
</ngb-panel>
</ngb-accordion>
-</form>
\ No newline at end of file
+</form>
diff --git a/UI/Web/src/app/book-reader/_components/reader-settings/reader-settings.component.ts b/UI/Web/src/app/book-reader/_components/reader-settings/reader-settings.component.ts
index 0860c0b64..694e41857 100644
--- a/UI/Web/src/app/book-reader/_components/reader-settings/reader-settings.component.ts
+++ b/UI/Web/src/app/book-reader/_components/reader-settings/reader-settings.component.ts
@@ -5,6 +5,7 @@ import { Subject, take, takeUntil } from 'rxjs';
import { BookPageLayoutMode } from 'src/app/_models/readers/book-page-layout-mode';
import { BookTheme } from 'src/app/_models/preferences/book-theme';
import { ReadingDirection } from 'src/app/_models/preferences/reading-direction';
+import { WritingStyle } from 'src/app/_models/preferences/writing-style';
import { ThemeProvider } from 'src/app/_models/preferences/site-theme';
import { User } from 'src/app/_models/user';
import { AccountService } from 'src/app/_services/account.service';
@@ -88,6 +89,10 @@ export class ReaderSettingsComponent implements OnInit, OnDestroy {
* Outputs when reading direction is changed
*/
@Output() readingDirection: EventEmitter<ReadingDirection> = new EventEmitter();
+ /**
+ * Outputs when reading mode is changed
+ */
+ @Output() bookReaderWritingStyle: EventEmitter<WritingStyle> = new EventEmitter();
/**
* Outputs when immersive mode is changed
*/
@@ -106,6 +111,9 @@ export class ReaderSettingsComponent implements OnInit, OnDestroy {
readingDirectionModel: ReadingDirection = ReadingDirection.LeftToRight;
+ writingStyleModel: WritingStyle = WritingStyle.Horizontal;
+
+
activeTheme: BookTheme | undefined;
isFullscreen: boolean = false;
@@ -129,6 +137,10 @@ export class ReaderSettingsComponent implements OnInit, OnDestroy {
return ReadingDirection;
}
+ get WritingStyle() {
+ return WritingStyle;
+ }
+
constructor(private bookService: BookService, private accountService: AccountService,
@@ -160,7 +172,12 @@ export class ReaderSettingsComponent implements OnInit, OnDestroy {
if (this.user.preferences.bookReaderReadingDirection === undefined) {
this.user.preferences.bookReaderReadingDirection = ReadingDirection.LeftToRight;
}
+ if (this.user.preferences.bookReaderWritingStyle === undefined) {
+ this.user.preferences.bookReaderWritingStyle = WritingStyle.Horizontal;
+ }
this.readingDirectionModel = this.user.preferences.bookReaderReadingDirection;
+ this.writingStyleModel = this.user.preferences.bookReaderWritingStyle;
+
this.settingsForm.addControl('bookReaderFontFamily', new FormControl(this.user.preferences.bookReaderFontFamily, []));
@@ -194,11 +211,13 @@ export class ReaderSettingsComponent implements OnInit, OnDestroy {
this.settingsForm.addControl('bookReaderMargin', new FormControl(this.user.preferences.bookReaderMargin, []));
this.settingsForm.get('bookReaderMargin')?.valueChanges.pipe(takeUntil(this.onDestroy)).subscribe(value => {
- this.pageStyles['margin-left'] = value + '%';
- this.pageStyles['margin-right'] = value + '%';
+ this.pageStyles['margin-left'] = value + 'vw';
+ this.pageStyles['margin-right'] = value + 'vw';
this.styleUpdate.emit(this.pageStyles);
});
+
+
this.settingsForm.addControl('layoutMode', new FormControl(this.user.preferences.bookReaderLayoutMode || BookPageLayoutMode.Default, []));
this.settingsForm.get('layoutMode')?.valueChanges.pipe(takeUntil(this.onDestroy)).subscribe((layoutMode: BookPageLayoutMode) => {
this.layoutModeUpdate.emit(layoutMode);
@@ -218,6 +237,7 @@ export class ReaderSettingsComponent implements OnInit, OnDestroy {
// Emit first time so book reader gets the setting
this.readingDirection.emit(this.readingDirectionModel);
+ this.bookReaderWritingStyle.emit(this.writingStyleModel);
this.clickToPaginateChanged.emit(this.user.preferences.bookReaderTapToPaginate);
this.layoutModeUpdate.emit(this.user.preferences.bookReaderLayoutMode);
this.immersiveMode.emit(this.user.preferences.bookReaderImmersiveMode);
@@ -239,7 +259,7 @@ export class ReaderSettingsComponent implements OnInit, OnDestroy {
resetSettings() {
if (this.user) {
- this.setPageStyles(this.user.preferences.bookReaderFontFamily, this.user.preferences.bookReaderFontSize + '%', this.user.preferences.bookReaderMargin + '%', this.user.preferences.bookReaderLineSpacing + '%');
+ this.setPageStyles(this.user.preferences.bookReaderFontFamily, this.user.preferences.bookReaderFontSize + '%', this.user.preferences.bookReaderMargin + 'vw', this.user.preferences.bookReaderLineSpacing + '%');
} else {
this.setPageStyles();
}
@@ -252,6 +272,7 @@ export class ReaderSettingsComponent implements OnInit, OnDestroy {
this.settingsForm.get('bookReaderTapToPaginate')?.setValue(this.user.preferences.bookReaderTapToPaginate);
this.settingsForm.get('bookReaderLayoutMode')?.setValue(this.user.preferences.bookReaderLayoutMode);
this.settingsForm.get('bookReaderImmersiveMode')?.setValue(this.user.preferences.bookReaderImmersiveMode);
+ this.settingsForm.get('bookReaderWritingStyle')?.setValue(this.user.preferences.bookReaderWritingStyle);
this.cdRef.detectChanges();
this.styleUpdate.emit(this.pageStyles);
}
@@ -265,9 +286,9 @@ export class ReaderSettingsComponent implements OnInit, OnDestroy {
|| this.document.body.clientWidth;
- let defaultMargin = '15%';
+ let defaultMargin = '15vw';
if (windowWidth <= mobileBreakpointMarginOverride) {
- defaultMargin = '5%';
+ defaultMargin = '5vw';
}
this.pageStyles = {
'font-family': fontFamily || this.pageStyles['font-family'] || 'default',
@@ -296,6 +317,17 @@ export class ReaderSettingsComponent implements OnInit, OnDestroy {
this.readingDirection.emit(this.readingDirectionModel);
}
+ toggleWritingStyle() {
+ if (this.writingStyleModel === WritingStyle.Horizontal) {
+ this.writingStyleModel = WritingStyle.Vertical
+ } else {
+ this.writingStyleModel = WritingStyle.Horizontal
+ }
+
+ this.cdRef.markForCheck();
+ this.bookReaderWritingStyle.emit(this.writingStyleModel);
+ }
+
toggleFullscreen() {
this.isFullscreen = !this.isFullscreen;
this.cdRef.markForCheck();
diff --git a/UI/Web/src/app/bookmark/_components/bookmarks/bookmarks.component.html b/UI/Web/src/app/bookmark/_components/bookmarks/bookmarks.component.html
index 78dbf6dc2..89a96c0a1 100644
--- a/UI/Web/src/app/bookmark/_components/bookmarks/bookmarks.component.html
+++ b/UI/Web/src/app/bookmark/_components/bookmarks/bookmarks.component.html
@@ -2,7 +2,7 @@
<h2 title>
Bookmarks
</h2>
- <h6 subtitle>{{series.length}} Series</h6>
+ <h6 subtitle>{{series.length | number}} Series</h6>
</app-side-nav-companion-bar>
<app-bulk-operations [actionCallback]="bulkActionCallback"></app-bulk-operations>
<app-card-detail-layout
diff --git a/UI/Web/src/app/cards/_modals/edit-series-modal/edit-series-modal.component.html b/UI/Web/src/app/cards/_modals/edit-series-modal/edit-series-modal.component.html
index d3ac12f9e..a64c2bd67 100644
--- a/UI/Web/src/app/cards/_modals/edit-series-modal/edit-series-modal.component.html
+++ b/UI/Web/src/app/cards/_modals/edit-series-modal/edit-series-modal.component.html
@@ -88,7 +88,7 @@
<label for="release-year" class="form-label">Release Year</label>
<div class="input-group {{metadata.releaseYearLocked ? 'lock-active' : ''}}">
<ng-container [ngTemplateOutlet]="lock" [ngTemplateOutletContext]="{ item: metadata, field: 'releaseYearLocked' }"></ng-container>
- <input type="number" class="form-control" id="release-year" formControlName="releaseYear" maxlength="4" minlength="4" [class.is-invalid]="editSeriesForm.get('releaseYear')?.invalid && editSeriesForm.get('releaseYear')?.touched">
+ <input type="number" inputmode="numeric" class="form-control" id="release-year" formControlName="releaseYear" maxlength="4" minlength="4" [class.is-invalid]="editSeriesForm.get('releaseYear')?.invalid && editSeriesForm.get('releaseYear')?.touched">
<ng-container *ngIf="editSeriesForm.get('releaseYear')?.errors as errors">
<p class="invalid-feedback" *ngIf="errors.pattern">
This must be a valid year greater than 1000 and 4 characters long
@@ -379,10 +379,12 @@
</div>
<div class="row g-0 mb-2" *ngIf="metadata">
<div class="col-md-6">
- Max Items: {{metadata.maxCount}} <i class="fa fa-info-circle ms-1" placement="right" ngbTooltip="Max of Volume/Issue field in ComicInfo. Used in conjunction with total items to determine publication status." role="button" tabindex="0"></i>
+ Max Items: {{metadata.maxCount}}
+ <i class="fa fa-info-circle ms-1" placement="right" ngbTooltip="Highest Count found across all ComicInfo in the Series" role="button" tabindex="0"></i>
</div>
- <div class="col-md-6" title="">
- Total Items: {{metadata.totalCount}} <i class="fa fa-info-circle ms-1" placement="right" ngbTooltip="Total number of issues/volumes in the series" role="button" tabindex="0"></i>
+ <div class="col-md-6">
+ Total Items: {{metadata.totalCount}}
+ <i class="fa fa-info-circle ms-1" placement="right" ngbTooltip="Max Issue or Volume field from all ComicInfo in the series" role="button" tabindex="0"></i>
</div>
<div class="col-md-6">Publication Status: {{metadata.publicationStatus | publicationStatus}}</div>
<div class="col-md-6">Total Pages: {{series.pages}}</div>
diff --git a/UI/Web/src/app/cards/_modals/edit-series-modal/edit-series-modal.component.ts b/UI/Web/src/app/cards/_modals/edit-series-modal/edit-series-modal.component.ts
index 8faf56b37..a81d1b825 100644
--- a/UI/Web/src/app/cards/_modals/edit-series-modal/edit-series-modal.component.ts
+++ b/UI/Web/src/app/cards/_modals/edit-series-modal/edit-series-modal.component.ts
@@ -278,6 +278,9 @@ export class EditSeriesModalComponent implements OnInit, OnDestroy {
this.collectionTagSettings.compareFn = (options: CollectionTag[], filter: string) => {
return options.filter(m => this.utilityService.filter(m.title, filter));
}
+ this.collectionTagSettings.compareFnForAdd = (options: CollectionTag[], filter: string) => {
+ return options.filter(m => this.utilityService.filterMatches(m.title, filter));
+ }
this.collectionTagSettings.selectionCompareFn = (a: CollectionTag, b: CollectionTag) => {
return a.title === b.title;
}
@@ -310,6 +313,9 @@ export class EditSeriesModalComponent implements OnInit, OnDestroy {
this.tagsSettings.selectionCompareFn = (a: Tag, b: Tag) => {
return a.id == b.id;
}
+ this.tagsSettings.compareFnForAdd = (options: Tag[], filter: string) => {
+ return options.filter(m => this.utilityService.filterMatches(m.title, filter));
+ }
if (this.metadata.tags) {
this.tagsSettings.savedData = this.metadata.tags;
@@ -331,6 +337,9 @@ export class EditSeriesModalComponent implements OnInit, OnDestroy {
this.genreSettings.compareFn = (options: Genre[], filter: string) => {
return options.filter(m => this.utilityService.filter(m.title, filter));
}
+ this.genreSettings.compareFnForAdd = (options: Genre[], filter: string) => {
+ return options.filter(m => this.utilityService.filterMatches(m.title, filter));
+ }
this.genreSettings.selectionCompareFn = (a: Genre, b: Genre) => {
return a.title == b.title;
}
@@ -372,6 +381,9 @@ export class EditSeriesModalComponent implements OnInit, OnDestroy {
this.languageSettings.compareFn = (options: Language[], filter: string) => {
return options.filter(m => this.utilityService.filter(m.title, filter));
}
+ this.languageSettings.compareFnForAdd = (options: Language[], filter: string) => {
+ return options.filter(m => this.utilityService.filterMatches(m.title, filter));
+ }
this.languageSettings.fetchFn = (filter: string) => of(this.validLanguages)
.pipe(map(items => this.languageSettings.compareFn(items, filter)));
@@ -426,6 +438,9 @@ export class EditSeriesModalComponent implements OnInit, OnDestroy {
personSettings.compareFn = (options: Person[], filter: string) => {
return options.filter(m => this.utilityService.filter(m.name, filter));
}
+ personSettings.compareFnForAdd = (options: Person[], filter: string) => {
+ return options.filter(m => this.utilityService.filterMatches(m.name, filter));
+ }
personSettings.selectionCompareFn = (a: Person, b: Person) => {
return a.name == b.name && a.role == b.role;
diff --git a/UI/Web/src/app/cards/bulk-operations/bulk-operations.component.html b/UI/Web/src/app/cards/bulk-operations/bulk-operations.component.html
index 08a2cbd55..c251e9d8b 100644
--- a/UI/Web/src/app/cards/bulk-operations/bulk-operations.component.html
+++ b/UI/Web/src/app/cards/bulk-operations/bulk-operations.component.html
@@ -4,7 +4,7 @@
<span class="highlight">
<i class="fa fa-check me-1" aria-hidden="true"></i>
- {{selectionCount}} items selected
+ {{selectionCount | number}} items selected
</span>
<span>
diff --git a/UI/Web/src/app/cards/card-detail-layout/card-detail-layout.component.html b/UI/Web/src/app/cards/card-detail-layout/card-detail-layout.component.html
index 1443eed49..3c0c28ce0 100644
--- a/UI/Web/src/app/cards/card-detail-layout/card-detail-layout.component.html
+++ b/UI/Web/src/app/cards/card-detail-layout/card-detail-layout.component.html
@@ -52,7 +52,7 @@
<ng-template #jumpBar>
<div class="jump-bar">
<ng-container *ngFor="let jumpKey of jumpBarKeysToRender; let i = index;">
- <button class="btn btn-link" [ngClass]="{'disabled': hasCustomSort()}" (click)="scrollTo(jumpKey)">
+ <button class="btn btn-link" [ngClass]="{'disabled': hasCustomSort()}" (click)="scrollTo(jumpKey)" [ngbTooltip]="jumpKey.size + ' Series'" placement="left">
{{jumpKey.title}}
</button>
</ng-container>
diff --git a/UI/Web/src/app/cards/card-detail-layout/card-detail-layout.component.scss b/UI/Web/src/app/cards/card-detail-layout/card-detail-layout.component.scss
index 5ebd517e9..c4aa6459a 100644
--- a/UI/Web/src/app/cards/card-detail-layout/card-detail-layout.component.scss
+++ b/UI/Web/src/app/cards/card-detail-layout/card-detail-layout.component.scss
@@ -102,7 +102,7 @@
virtual-scroller.empty {
display: none;
- }
+}
h2 {
display: inline-block;
diff --git a/UI/Web/src/app/cards/series-info-cards/series-info-cards.component.html b/UI/Web/src/app/cards/series-info-cards/series-info-cards.component.html
index 09c5cac07..524745e1d 100644
--- a/UI/Web/src/app/cards/series-info-cards/series-info-cards.component.html
+++ b/UI/Web/src/app/cards/series-info-cards/series-info-cards.component.html
@@ -12,7 +12,7 @@
<ng-container *ngIf="seriesMetadata.ageRating">
<div class="col-lg-1 col-md-4 col-sm-4 col-4 mb-3">
<app-icon-and-title label="Age Rating" [clickable]="true" fontClasses="fas fa-eye" (click)="handleGoTo(FilterQueryParam.AgeRating, seriesMetadata.ageRating)" title="Age Rating">
- {{metadataService.getAgeRating(this.seriesMetadata.ageRating) | async}}
+ {{this.seriesMetadata.ageRating | ageRating | async}}
</app-icon-and-title>
</div>
<div class="vr d-none d-lg-block m-2"></div>
diff --git a/UI/Web/src/app/collections/_components/all-collections/all-collections.component.html b/UI/Web/src/app/collections/_components/all-collections/all-collections.component.html
index 85937d6c8..402fcaf6e 100644
--- a/UI/Web/src/app/collections/_components/all-collections/all-collections.component.html
+++ b/UI/Web/src/app/collections/_components/all-collections/all-collections.component.html
@@ -2,7 +2,7 @@
<h2 title>
Collections
</h2>
- <h6 subtitle>{{collections.length}} Items</h6>
+ <h6 subtitle>{{collections.length | number}} Items</h6>
</app-side-nav-companion-bar>
<app-card-detail-layout
[isLoading]="isLoading"
diff --git a/UI/Web/src/app/collections/_components/collection-detail/collection-detail.component.ts b/UI/Web/src/app/collections/_components/collection-detail/collection-detail.component.ts
index e0484a38e..787ea8a41 100644
--- a/UI/Web/src/app/collections/_components/collection-detail/collection-detail.component.ts
+++ b/UI/Web/src/app/collections/_components/collection-detail/collection-detail.component.ts
@@ -103,7 +103,8 @@ export class CollectionDetailComponent implements OnInit, OnDestroy, AfterConten
});
break;
case Action.Delete:
- this.actionService.deleteMultipleSeries(selectedSeries, () => {
+ this.actionService.deleteMultipleSeries(selectedSeries, successful => {
+ if (!successful) return;
this.bulkSelectionService.deselectAll();
this.loadPage();
this.cdRef.markForCheck();
diff --git a/UI/Web/src/app/library-detail/library-detail.component.html b/UI/Web/src/app/library-detail/library-detail.component.html
index 8454aa6d4..c8767de67 100644
--- a/UI/Web/src/app/library-detail/library-detail.component.html
+++ b/UI/Web/src/app/library-detail/library-detail.component.html
@@ -40,6 +40,6 @@
</ul>
</div>
</app-side-nav-companion-bar>
-<h6 subtitle class="subtitle-with-actionables" *ngIf="active.fragment === ''">{{pagination.totalItems}} Series</h6>
+<h6 subtitle class="subtitle-with-actionables" *ngIf="active.fragment === ''">{{pagination.totalItems | number}} Series</h6>
<app-bulk-operations [actionCallback]="bulkActionCallback"></app-bulk-operations>
<div [ngbNavOutlet]="nav"></div>
diff --git a/UI/Web/src/app/library-detail/library-detail.component.ts b/UI/Web/src/app/library-detail/library-detail.component.ts
index adf884a6b..c3a62a590 100644
--- a/UI/Web/src/app/library-detail/library-detail.component.ts
+++ b/UI/Web/src/app/library-detail/library-detail.component.ts
@@ -95,7 +95,8 @@ export class LibraryDetailComponent implements OnInit, OnDestroy {
});
break;
case Action.Delete:
- this.actionService.deleteMultipleSeries(selectedSeries, () => {
+ this.actionService.deleteMultipleSeries(selectedSeries, (successful) => {
+ if (!successful) return;
this.bulkSelectionService.deselectAll();
this.loadPage();
});
diff --git a/UI/Web/src/app/manga-reader/_components/canvas-renderer/canvas-renderer.component.html b/UI/Web/src/app/manga-reader/_components/canvas-renderer/canvas-renderer.component.html
index c72f27f42..bf2da9d5e 100644
--- a/UI/Web/src/app/manga-reader/_components/canvas-renderer/canvas-renderer.component.html
+++ b/UI/Web/src/app/manga-reader/_components/canvas-renderer/canvas-renderer.component.html
@@ -1,6 +1,6 @@
<div class="image-container {{imageFitClass$ | async}}"
[ngClass]="{'d-none': !renderWithCanvas }"
[style.filter]="(darkenss$ | async) ?? '' | safeStyle">
- <canvas #content ondragstart="return false;" onselectstart="return false;"></canvas>
+ <canvas #content ondragstart="return false;" onselectstart="return false;" class="{{imageFitClass$ | async}}"></canvas>
</div>
diff --git a/UI/Web/src/app/manga-reader/_components/canvas-renderer/canvas-renderer.component.scss b/UI/Web/src/app/manga-reader/_components/canvas-renderer/canvas-renderer.component.scss
index 74ffdb37e..a10b4213c 100644
--- a/UI/Web/src/app/manga-reader/_components/canvas-renderer/canvas-renderer.component.scss
+++ b/UI/Web/src/app/manga-reader/_components/canvas-renderer/canvas-renderer.component.scss
@@ -1,26 +1 @@
@use '../../../../manga-reader-common';
-
-.full-height {
- width: auto;
- margin: 0 auto;
- max-height: calc(var(--vh)*100);
- vertical-align: top;
-
- &.wide {
- height: 100vh;
- }
- }
-
- .original {
- align-self: center;
- width: auto;
- margin: 0 auto;
- vertical-align: top;
- }
-
- .full-width {
- width: 100%;
- margin: 0 auto;
- vertical-align: top;
- max-width: fit-content;
- }
diff --git a/UI/Web/src/app/manga-reader/_components/canvas-renderer/canvas-renderer.component.ts b/UI/Web/src/app/manga-reader/_components/canvas-renderer/canvas-renderer.component.ts
index b759d5f68..7a539fa40 100644
--- a/UI/Web/src/app/manga-reader/_components/canvas-renderer/canvas-renderer.component.ts
+++ b/UI/Web/src/app/manga-reader/_components/canvas-renderer/canvas-renderer.component.ts
@@ -8,6 +8,8 @@ import { ReaderSetting } from '../../_models/reader-setting';
import { ImageRenderer } from '../../_models/renderer';
import { ManagaReaderService } from '../../_series/managa-reader.service';
+const ValidSplits = [PageSplitOption.SplitLeftToRight, PageSplitOption.SplitRightToLeft];
+
@Component({
selector: 'app-canvas-renderer',
templateUrl: './canvas-renderer.component.html',
@@ -51,7 +53,7 @@ export class CanvasRendererComponent implements OnInit, AfterViewInit, OnDestroy
constructor(private readonly cdRef: ChangeDetectorRef, private mangaReaderService: ManagaReaderService, private readerService: ReaderService) { }
ngOnInit(): void {
- this.readerSettings$.pipe(takeUntil(this.onDestroy), tap(value => {
+ this.readerSettings$.pipe(takeUntil(this.onDestroy), tap((value: ReaderSetting) => {
this.fit = value.fitting;
this.pageSplit = value.pageSplit;
this.layoutMode = value.layoutMode;
@@ -70,9 +72,9 @@ export class CanvasRendererComponent implements OnInit, AfterViewInit, OnDestroy
this.imageFitClass$ = this.readerSettings$.pipe(
takeUntil(this.onDestroy),
- map(values => values.fitting),
+ map((values: ReaderSetting) => values.fitting),
map(fit => {
- if (fit === FITTING_OPTION.WIDTH || this.layoutMode === LayoutMode.Single) return fit;
+ if (fit === FITTING_OPTION.WIDTH) return fit; // || this.layoutMode === LayoutMode.Single (so that we can check the wide stuff)
if (this.canvasImage === null) return fit;
// Would this ever execute given that we perform splitting only in this renderer?
@@ -178,12 +180,19 @@ export class CanvasRendererComponent implements OnInit, AfterViewInit, OnDestroy
if (!this.ctx || !this.canvas) return;
this.canvasImage = img[0];
this.cdRef.markForCheck();
+
+ if (this.layoutMode !== LayoutMode.Single || !ValidSplits.includes(this.pageSplit)) {
+ return;
+ }
const needsSplitting = this.updateSplitPage();
if (!needsSplitting) return;
- if (this.currentImageSplitPart === SPLIT_PAGE_PART.NO_SPLIT) return;
+
+ // This is toggling true when manga reader shouldn't use this code
this.renderWithCanvas = true;
+ if (this.currentImageSplitPart === SPLIT_PAGE_PART.NO_SPLIT) return;
+
this.setCanvasSize();
if (needsSplitting && this.currentImageSplitPart === SPLIT_PAGE_PART.LEFT_PART) {
diff --git a/UI/Web/src/app/manga-reader/_components/double-renderer-no-cover/double-no-cover-renderer.component.scss b/UI/Web/src/app/manga-reader/_components/double-renderer-no-cover/double-no-cover-renderer.component.scss
index f2d9d0f7c..e1238ef7b 100644
--- a/UI/Web/src/app/manga-reader/_components/double-renderer-no-cover/double-no-cover-renderer.component.scss
+++ b/UI/Web/src/app/manga-reader/_components/double-renderer-no-cover/double-no-cover-renderer.component.scss
@@ -1,6 +1,8 @@
@use '../../../../manga-reader-common';
.image-container {
+ height: calc(100vh); // override as on single, we -34px for the potential scrollbar
+
#image-1 {
&.double {
margin: 0 0 0 auto;
diff --git a/UI/Web/src/app/manga-reader/_components/double-renderer/double-renderer.component.ts b/UI/Web/src/app/manga-reader/_components/double-renderer/double-renderer.component.ts
index 9e4edf3a2..d512d3cd4 100644
--- a/UI/Web/src/app/manga-reader/_components/double-renderer/double-renderer.component.ts
+++ b/UI/Web/src/app/manga-reader/_components/double-renderer/double-renderer.component.ts
@@ -132,6 +132,7 @@ export class DoubleRendererComponent implements OnInit, OnDestroy, ImageRenderer
if (value[0] && value[1].fitting === FITTING_OPTION.WIDTH) return 'fit-to-width-double-offset';
if (value[0] && value[1].fitting === FITTING_OPTION.HEIGHT) return 'fit-to-height-double-offset';
if (value[0] && value[1].fitting === FITTING_OPTION.ORIGINAL) return 'original-double-offset';
+ if (this.mangaReaderService.isWidePage(this.pageNum) ) return 'double-offset';
return '';
}),
filter(_ => this.isValid()),
diff --git a/UI/Web/src/app/manga-reader/_components/double-reverse-renderer/double-reverse-renderer.component.scss b/UI/Web/src/app/manga-reader/_components/double-reverse-renderer/double-reverse-renderer.component.scss
index f93ef2fba..e0682758f 100644
--- a/UI/Web/src/app/manga-reader/_components/double-reverse-renderer/double-reverse-renderer.component.scss
+++ b/UI/Web/src/app/manga-reader/_components/double-reverse-renderer/double-reverse-renderer.component.scss
@@ -2,6 +2,8 @@
// Overrides for reverse
.image-container {
+ height: calc(100vh); // override as on single, we -34px for the potential scrollbar
+
&.reverse {
overflow: unset;
display: flex;
diff --git a/UI/Web/src/app/manga-reader/_components/double-reverse-renderer/double-reverse-renderer.component.ts b/UI/Web/src/app/manga-reader/_components/double-reverse-renderer/double-reverse-renderer.component.ts
index 08b236a70..9ccd53bee 100644
--- a/UI/Web/src/app/manga-reader/_components/double-reverse-renderer/double-reverse-renderer.component.ts
+++ b/UI/Web/src/app/manga-reader/_components/double-reverse-renderer/double-reverse-renderer.component.ts
@@ -133,6 +133,7 @@ export class DoubleReverseRendererComponent implements OnInit, OnDestroy, ImageR
if (value[0] && value[1].fitting === FITTING_OPTION.WIDTH) return 'fit-to-width-double-offset';
if (value[0] && value[1].fitting === FITTING_OPTION.HEIGHT) return 'fit-to-height-double-offset';
if (value[0] && value[1].fitting === FITTING_OPTION.ORIGINAL) return 'original-double-offset';
+ if (this.mangaReaderService.isWidePage(this.pageNum) ) return 'double-offset';
return '';
}),
filter(_ => this.isValid()),
diff --git a/UI/Web/src/app/manga-reader/_components/infinite-scroller/infinite-scroller.component.scss b/UI/Web/src/app/manga-reader/_components/infinite-scroller/infinite-scroller.component.scss
index f56c62ced..3f0b243c5 100644
--- a/UI/Web/src/app/manga-reader/_components/infinite-scroller/infinite-scroller.component.scss
+++ b/UI/Web/src/app/manga-reader/_components/infinite-scroller/infinite-scroller.component.scss
@@ -31,7 +31,12 @@ img, .full-width {
height: auto;
}
-
+// This is to force hardware acceleration to help address https://github.com/Kareadita/Kavita/issues/1848
+*:not(html) {
+ -webkit-transform: translate3d(0, 0, 0);
+ -moz-transform: translate3d(0, 0, 0);
+ transform: translate3d(0, 0, 0);
+}
@keyframes move-up-down {
0%, 100% {
diff --git a/UI/Web/src/app/manga-reader/_components/manga-reader/manga-reader.component.ts b/UI/Web/src/app/manga-reader/_components/manga-reader/manga-reader.component.ts
index 3d29a0059..b0f5b3f7a 100644
--- a/UI/Web/src/app/manga-reader/_components/manga-reader/manga-reader.component.ts
+++ b/UI/Web/src/app/manga-reader/_components/manga-reader/manga-reader.component.ts
@@ -31,8 +31,8 @@ import { DoubleRendererComponent } from '../double-renderer/double-renderer.comp
import { DoubleReverseRendererComponent } from '../double-reverse-renderer/double-reverse-renderer.component';
import { SingleRendererComponent } from '../single-renderer/single-renderer.component';
import { ChapterInfo } from '../../_models/chapter-info';
-import { SwipeEvent } from 'ng-swipe';
import { DoubleNoCoverRendererComponent } from '../double-renderer-no-cover/double-no-cover-renderer.component';
+import { SwipeEvent } from 'src/app/ng-swipe/ag-swipe.core';
const PREFETCH_PAGES = 10;
@@ -373,15 +373,23 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {
if (this.FittingOption !== FITTING_OPTION.HEIGHT) {
return this.mangaReaderService.getPageDimensions(this.pageNum)?.height + 'px';
}
+
return this.readingArea?.nativeElement?.clientHeight + 'px';
}
// This is for the pagination area
get MaxHeight() {
- if (this.FittingOption !== FITTING_OPTION.HEIGHT) {
- return this.mangaReaderService.getPageDimensions(this.pageNum)?.height + 'px';
+ if (this.FittingOption === FITTING_OPTION.HEIGHT) {
+ return 'calc(var(--vh) * 100)';
+ }
+
+ const needsScrolling = this.readingArea?.nativeElement?.scrollHeight > this.readingArea?.nativeElement?.clientHeight;
+ if (this.readingArea?.nativeElement?.clientHeight <= this.mangaReaderService.getPageDimensions(this.pageNum)?.height!) {
+ if (needsScrolling) {
+ return Math.min(this.readingArea?.nativeElement?.scrollHeight, this.mangaReaderService.getPageDimensions(this.pageNum)?.height!) + 'px';
+ }
}
- return 'calc(var(--vh) * 100)';
+ return this.readingArea?.nativeElement?.clientHeight + 'px';
}
get RightPaginationOffset() {
@@ -392,7 +400,6 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {
}
get SplitIconClass() {
- // TODO: make this a pipe
if (this.mangaReaderService.isSplitLeftToRight(this.pageSplitOption)) {
return 'left-side';
} else if (this.mangaReaderService.isNoSplit(this.pageSplitOption)) {
@@ -520,7 +527,7 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {
this.generalSettingsForm.get('pageSplitOption')?.setValue(this.user.preferences.pageSplitOption);
this.generalSettingsForm.get('pageSplitOption')?.enable();
this.generalSettingsForm.get('fittingOption')?.enable();
- this.generalSettingsForm.get('emulateBook')?.disable();
+ this.generalSettingsForm.get('emulateBook')?.enable();
} else {
this.generalSettingsForm.get('pageSplitOption')?.setValue(PageSplitOption.NoSplit);
this.generalSettingsForm.get('pageSplitOption')?.disable();
@@ -807,6 +814,7 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {
this.subtitle = 'Bookmarks';
this.libraryType = bookmarkInfo.libraryType;
this.maxPages = bookmarkInfo.pages;
+ this.mangaReaderService.load(bookmarkInfo);
// Due to change detection rules in Angular, we need to re-create the options object to apply the change
const newOptions: Options = Object.assign({}, this.pageOptions);
@@ -815,10 +823,6 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {
this.inSetup = false;
this.cdRef.markForCheck();
- for (let i = 0; i < PREFETCH_PAGES; i++) {
- this.cachedImages.push(new Image())
- }
-
this.goToPageEvent = new BehaviorSubject<number>(this.pageNum);
this.render();
@@ -1626,7 +1630,9 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {
data.readingDirection = this.readingDirection;
data.emulateBook = modelSettings.emulateBook;
data.swipeToPaginate = modelSettings.swipeToPaginate;
- this.accountService.updatePreferences(data).subscribe((updatedPrefs) => {
+ data.pageSplitOption = parseInt(modelSettings.pageSplitOption, 10);
+
+ this.accountService.updatePreferences(data).subscribe(updatedPrefs => {
this.toastr.success('User preferences updated');
if (this.user) {
this.user.preferences = updatedPrefs;
diff --git a/UI/Web/src/app/manga-reader/_components/single-renderer/single-renderer.component.html b/UI/Web/src/app/manga-reader/_components/single-renderer/single-renderer.component.html
index db30021c6..cc00d7562 100644
--- a/UI/Web/src/app/manga-reader/_components/single-renderer/single-renderer.component.html
+++ b/UI/Web/src/app/manga-reader/_components/single-renderer/single-renderer.component.html
@@ -1,6 +1,6 @@
<ng-container *ngIf="isValid() && !this.mangaReaderService.shouldSplit(this.currentImage, this.pageSplit)">
- <div class="image-container {{imageFitClass$ | async}}"
- [style.filter]="(darkenss$ | async) ?? '' | safeStyle">
+ <div class="image-container {{imageFitClass$ | async}} {{emulateBookClass$ | async}}"
+ [style.filter]="(darkenss$ | async) ?? '' | safeStyle" [style.height]="(imageContainerHeight$ | async) ?? '' | safeStyle">
<ng-container *ngIf="currentImage">
<img alt=" "
#image [src]="currentImage.src"
diff --git a/UI/Web/src/app/manga-reader/_components/single-renderer/single-renderer.component.scss b/UI/Web/src/app/manga-reader/_components/single-renderer/single-renderer.component.scss
index daeafd50b..a10b4213c 100644
--- a/UI/Web/src/app/manga-reader/_components/single-renderer/single-renderer.component.scss
+++ b/UI/Web/src/app/manga-reader/_components/single-renderer/single-renderer.component.scss
@@ -1 +1 @@
-@use '../../../../manga-reader-common';
\ No newline at end of file
+@use '../../../../manga-reader-common';
diff --git a/UI/Web/src/app/manga-reader/_components/single-renderer/single-renderer.component.ts b/UI/Web/src/app/manga-reader/_components/single-renderer/single-renderer.component.ts
index 7f5137289..101da6e13 100644
--- a/UI/Web/src/app/manga-reader/_components/single-renderer/single-renderer.component.ts
+++ b/UI/Web/src/app/manga-reader/_components/single-renderer/single-renderer.component.ts
@@ -27,9 +27,11 @@ export class SingleRendererComponent implements OnInit, OnDestroy, ImageRenderer
@Output() imageHeight: EventEmitter<number> = new EventEmitter<number>();
imageFitClass$!: Observable<string>;
+ imageContainerHeight$!: Observable<string>;
showClickOverlayClass$!: Observable<string>;
readerModeClass$!: Observable<string>;
darkenss$: Observable<string> = of('brightness(100%)');
+ emulateBookClass$!: Observable<string>;
currentImage!: HTMLImageElement;
layoutMode: LayoutMode = LayoutMode.Single;
pageSplit: PageSplitOption = PageSplitOption.FitSplit;
@@ -43,7 +45,7 @@ export class SingleRendererComponent implements OnInit, OnDestroy, ImageRenderer
get LayoutMode() {return LayoutMode;}
constructor(private readonly cdRef: ChangeDetectorRef, public mangaReaderService: ManagaReaderService,
- @Inject(DOCUMENT) private document: Document, private readerService: ReaderService) { }
+ @Inject(DOCUMENT) private document: Document) { }
ngOnInit(): void {
this.readerModeClass$ = this.readerSettings$.pipe(
@@ -53,13 +55,35 @@ export class SingleRendererComponent implements OnInit, OnDestroy, ImageRenderer
takeUntil(this.onDestroy)
);
+ this.emulateBookClass$ = this.readerSettings$.pipe(
+ map(data => data.emulateBook),
+ map(enabled => enabled ? 'book-shadow' : ''),
+ filter(_ => this.isValid()),
+ takeUntil(this.onDestroy)
+ );
+
+ this.imageContainerHeight$ = this.readerSettings$.pipe(
+ map(values => values.fitting),
+ map(mode => {
+ if ( mode !== FITTING_OPTION.HEIGHT) return '';
+
+ const readingArea = this.document.querySelector('.reading-area');
+ if (!readingArea) return 'calc(100vh)';
+
+ if (this.currentImage.width - readingArea.scrollWidth > 0) {
+ return 'calc(100vh - 34px)'
+ }
+ return 'calc(100vh)'
+ }),
+ filter(_ => this.isValid()),
+ takeUntil(this.onDestroy)
+ );
+
this.pageNum$.pipe(
takeUntil(this.onDestroy),
tap(pageInfo => {
this.pageNum = pageInfo.pageNum;
this.maxPages = pageInfo.maxPages;
-
- // TODO: Put this here this.currentImage = this.getPagez
}),
).subscribe(() => {});
@@ -103,7 +127,7 @@ export class SingleRendererComponent implements OnInit, OnDestroy, ImageRenderer
this.mangaReaderService.shouldRenderAsFitSplit(this.pageSplit)
) {
// Rewriting to fit to width for this cover image
- return FITTING_OPTION.WIDTH + ' fit-to-screen';
+ return FITTING_OPTION.WIDTH + ' fit-to-screen wide';
}
return fit;
diff --git a/UI/Web/src/app/manga-reader/_series/managa-reader.service.ts b/UI/Web/src/app/manga-reader/_series/managa-reader.service.ts
index 49641b80c..9bdf4c03c 100644
--- a/UI/Web/src/app/manga-reader/_series/managa-reader.service.ts
+++ b/UI/Web/src/app/manga-reader/_series/managa-reader.service.ts
@@ -5,6 +5,7 @@ import { ReaderService } from 'src/app/_services/reader.service';
import { ChapterInfo } from '../_models/chapter-info';
import { DimensionMap } from '../_models/file-dimension';
import { FITTING_OPTION } from '../_models/reader-enums';
+import { BookmarkInfo } from 'src/app/_models/manga-reader/bookmark-info';
@Injectable({
providedIn: 'root'
@@ -19,7 +20,7 @@ export class ManagaReaderService {
this.renderer = rendererFactory.createRenderer(null, null);
}
- load(chapterInfo: ChapterInfo) {
+ load(chapterInfo: ChapterInfo | BookmarkInfo) {
chapterInfo.pageDimensions!.forEach(d => {
this.pageDimensions[d.pageNumber] = {
height: d.height,
diff --git a/UI/Web/src/app/manga-reader/manga-reader.module.ts b/UI/Web/src/app/manga-reader/manga-reader.module.ts
index 303e5182c..37a8bfc9c 100644
--- a/UI/Web/src/app/manga-reader/manga-reader.module.ts
+++ b/UI/Web/src/app/manga-reader/manga-reader.module.ts
@@ -17,8 +17,8 @@ import { DoubleRendererComponent } from './_components/double-renderer/double-re
import { DoubleReverseRendererComponent } from './_components/double-reverse-renderer/double-reverse-renderer.component';
import { MangaReaderComponent } from './_components/manga-reader/manga-reader.component';
import { FittingIconPipe } from './_pipes/fitting-icon.pipe';
-import { SwipeModule } from 'ng-swipe';
import { DoubleNoCoverRendererComponent } from './_components/double-renderer-no-cover/double-no-cover-renderer.component';
+import { NgSwipeModule } from '../ng-swipe/ng-swipe.module';
@NgModule({
declarations: [
@@ -45,7 +45,7 @@ import { DoubleNoCoverRendererComponent } from './_components/double-renderer-no
SharedModule,
ReaderSharedModule,
- SwipeModule
+ NgSwipeModule
],
exports: [
MangaReaderComponent
diff --git a/UI/Web/src/app/metadata-filter/metadata-filter.component.html b/UI/Web/src/app/metadata-filter/metadata-filter.component.html
index c0be87a77..220ece6af 100644
--- a/UI/Web/src/app/metadata-filter/metadata-filter.component.html
+++ b/UI/Web/src/app/metadata-filter/metadata-filter.component.html
@@ -318,10 +318,10 @@
<div class="col-md-2 me-3">
<form [formGroup]="seriesNameGroup">
<div class="mb-3">
- <label for="series-name" class="form-label">Series Name</label>&nbsp;<i class="fa fa-info-circle" aria-hidden="true" placement="right" [ngbTooltip]="seriesNameFilterTooltip" role="button" tabindex="0"></i>
+ <label for="series-name" class="form-label me-1">Series Name</label><i class="fa fa-info-circle" aria-hidden="true" placement="right" [ngbTooltip]="seriesNameFilterTooltip" role="button" tabindex="0"></i>
<span class="visually-hidden" id="filter-series-name-help"><ng-container [ngTemplateOutlet]="seriesNameFilterTooltip"></ng-container></span>
<ng-template #seriesNameFilterTooltip>Series name will filter against Name, Sort Name, or Localized Name</ng-template>
- <input type="text" id="series-name" formControlName="seriesNameQuery" class="form-control" aria-describedby="filter-series-name-help">
+ <input type="text" id="series-name" formControlName="seriesNameQuery" class="form-control" aria-describedby="filter-series-name-help" (keyup.enter)="apply()">
</div>
</form>
</div>
@@ -329,14 +329,14 @@
<form [formGroup]="releaseYearRange" class="d-flex justify-content-between">
<div class="mb-3">
<label for="release-year-min" class="form-label">Release</label>
- <input type="text" id="release-year-min" formControlName="min" class="form-control" style="width: 62px" placeholder="Min">
+ <input type="text" id="release-year-min" formControlName="min" class="form-control" style="width: 62px" placeholder="Min" (keyup.enter)="apply()">
</div>
<div style="margin-top: 37px !important;">
<i class="fa-solid fa-minus" aria-hidden="true"></i>
</div>
<div class="mb-3" style="margin-top: 0.5rem">
<label for="release-year-max" class="form-label"><span class="visually-hidden">Max</span></label>
- <input type="text" id="release-year-max" formControlName="max" class="form-control" style="width: 62px" placeholder="Max">
+ <input type="text" id="release-year-max" formControlName="max" class="form-control" style="width: 62px" placeholder="Max" (keyup.enter)="apply()">
</div>
</form>
</div>
diff --git a/UI/Web/src/app/metadata-filter/metadata-filter.component.ts b/UI/Web/src/app/metadata-filter/metadata-filter.component.ts
index a7c1798e9..d809f2566 100644
--- a/UI/Web/src/app/metadata-filter/metadata-filter.component.ts
+++ b/UI/Web/src/app/metadata-filter/metadata-filter.component.ts
@@ -329,6 +329,7 @@ export class MetadataFilterComponent implements OnInit, OnDestroy {
this.ageRatingSettings.compareFn = (options: AgeRatingDto[], filter: string) => {
return options.filter(m => this.utilityService.filter(m.title, filter));
}
+
this.ageRatingSettings.selectionCompareFn = (a: AgeRatingDto, b: AgeRatingDto) => {
return a.title == b.title;
@@ -622,6 +623,7 @@ export class MetadataFilterComponent implements OnInit, OnDestroy {
this.readProgressGroup.get('inProgress')?.setValue(true);
this.sortGroup.get('sortField')?.setValue(SortField.SortName);
this.isAscendingSort = true;
+ this.seriesNameGroup.get('seriesNameQuery')?.setValue('');
this.cdRef.markForCheck();
// Apply any presets which will trigger the apply
this.loadFromPresetsAndSetup();
diff --git a/UI/Web/src/app/nav/_components/events-widget/events-widget.component.html b/UI/Web/src/app/nav/_components/events-widget/events-widget.component.html
index 4d131097e..3c12ba651 100644
--- a/UI/Web/src/app/nav/_components/events-widget/events-widget.component.html
+++ b/UI/Web/src/app/nav/_components/events-widget/events-widget.component.html
@@ -92,7 +92,7 @@
<ng-template #progressEvent>
<li class="list-group-item dark-menu-item">
<div class="h6 mb-1">{{message.title}}</div>
- <div class="accent-text mb-1" *ngIf="message.subTitle !== ''">{{message.subTitle}}</div>
+ <div class="accent-text mb-1" *ngIf="message.subTitle !== ''" [title]="message.subTitle">{{message.subTitle}}</div>
<div class="progress-container row g-0 align-items-center">
<div class="col-2">{{prettyPrintProgress(message.body.progress) + '%'}}</div>
<div class="col-10 progress" style="height: 5px;">
@@ -122,7 +122,7 @@
<ng-container *ngFor="let download of activeDownloads">
<li class="list-group-item dark-menu-item">
<div class="h6 mb-1">Downloading {{download.entityType | sentenceCase}}</div>
- <div class="accent-text mb-1" *ngIf="download.subTitle !== ''">{{download.subTitle}}</div>
+ <div class="accent-text mb-1" *ngIf="download.subTitle !== ''" [title]="download.subTitle">{{download.subTitle}}</div>
<div class="progress-container row g-0 align-items-center">
<div class="col-2">{{download.progress}}%</div>
<div class="col-10 progress" style="height: 5px;">
diff --git a/UI/Web/src/app/nav/_components/grouped-typeahead/grouped-typeahead.component.html b/UI/Web/src/app/nav/_components/grouped-typeahead/grouped-typeahead.component.html
index 1a1773133..7b697e505 100644
--- a/UI/Web/src/app/nav/_components/grouped-typeahead/grouped-typeahead.component.html
+++ b/UI/Web/src/app/nav/_components/grouped-typeahead/grouped-typeahead.component.html
@@ -1,7 +1,7 @@
<form [formGroup]="typeaheadForm" class="grouped-typeahead">
<div class="typeahead-input" [ngClass]="{'focused': hasFocus}" (click)="onInputFocus($event)">
<div class="search">
- <input #input [id]="id" type="text" autocomplete="off" formControlName="typeahead" [placeholder]="placeholder"
+ <input #input [id]="id" type="text" inputmode="search" autocomplete="off" formControlName="typeahead" [placeholder]="placeholder"
aria-haspopup="listbox" aria-owns="dropdown" aria-expanded="hasFocus && (grouppedData.persons.length || grouppedData.collections.length || grouppedData.series.length || grouppedData.persons.length || grouppedData.tags.length || grouppedData.genres.length)"
aria-autocomplete="list" (focusout)="close($event)" (focus)="open($event)" role="search"
>
diff --git a/UI/Web/src/app/nav/_components/grouped-typeahead/grouped-typeahead.component.scss b/UI/Web/src/app/nav/_components/grouped-typeahead/grouped-typeahead.component.scss
index 878ae4a38..b1705ff03 100644
--- a/UI/Web/src/app/nav/_components/grouped-typeahead/grouped-typeahead.component.scss
+++ b/UI/Web/src/app/nav/_components/grouped-typeahead/grouped-typeahead.component.scss
@@ -59,7 +59,7 @@ form {
border: none;
&:focus-visible {
- width: calc(100vw - 175px);
+ width: calc(100vw - 180px);
}
&:empty {
diff --git a/UI/Web/src/app/nav/_components/nav-header/nav-header.component.html b/UI/Web/src/app/nav/_components/nav-header/nav-header.component.html
index 7e1459ee1..a9006678d 100644
--- a/UI/Web/src/app/nav/_components/nav-header/nav-header.component.html
+++ b/UI/Web/src/app/nav/_components/nav-header/nav-header.component.html
@@ -1,202 +1,27 @@
<nav class="navbar navbar-expand-md navbar-dark fixed-top" *ngIf="navService?.navbarVisible$ | async">
- <div class="container-fluid">
- <a class="visually-hidden-focusable focus-visible" href="javascript:void(0);" (click)="moveFocus()">Skip to main content</a>
- <a class="side-nav-toggle" *ngIf="navService?.sideNavVisibility$ | async" (click)="hideSideNav()"><i class="fas fa-bars"></i></a>
- <a class="navbar-brand dark-exempt" routerLink="/libraries" routerLinkActive="active">
- <svg
- width="28px"
- height="28px"
- viewBox="0 0 135.46666 135.46667"
- version="1.1"
- id="svg5"
- xml:space="preserve"
-
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:svg="http://www.w3.org/2000/svg">
- <g id="layer1"
- transform="translate(-34.013356,-59.091761)">
- <image
- width="135.46666"
- height="135.46666"
- preserveAspectRatio="none"
- style="image-rendering:optimizeQuality"
- xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAMAAADDpiTIAAACE1BMVEUAAABQvplGxZNXt6FO2sxG
-wppKx5RJx5RIxpRHxZNGxZVJxpNLw5ZIxpRLyJFHw5BIxZJKxJVIyJRIx5RIxpRIxZRFxZNKyJZI
-xpRKyJRJyZVIxZRKx5VKx5RJxpNHx5RHu4xXuJNJx5NJxpRJyJZMv49KxZNKxpNIyJFIw5NHxpNI
-x5RJxZRHyZRJx5VJyJVIx5NJx5VIyJVHxZJIx5RHxpVHxpNHxJNFxJRGxI1JyJVIxZNJxZRJxJJM
-x5VKyJRGx5RGxpNJx5NFxpNKx5dKxZNJyJRFzJlKxpZLxZVKyZRGxZVHxJZLyJNJxJZKxpT///9C
-THLk5+/9/f3n6vFX0ffl6PD+/v9CSXHm6fD7+/1EZHhMypjl5uvl9u5FTnRLyJXR1eBLyJZEYXdM
-zJhKypfj5u1JyZVMypfv+v5T0PdW0ffr7fPo6/Fx2Phd0vf5+vvv8fVKxZT5+/zt7/RCRnFEX3f3
-+Pp02Pj19vld0/fO0t1CSHFGxZNCxJBIyJREUnU7RW1JwJJGg4BGjoRFd33X2uVEcnxIso5IrI1H
-nohQWHxEaHk+SG9HmYdDV3XS8OO659Ov5M1+1bCGjKVey59It5D7/f1JvpHn9/Dg9Ou+wdCa3cFs
-0KdgaIhEbXpDXXZIpIrw+vXEyNWk38V5gZvw8vbx+/5S0PfI69vFyNWus8SfpbhocI6J3vlu1/hO
-0Pe/V/w3AAAAT3RSTlMABzIFAhLF0rRiSDYi6lMpbD/typ1XTPfA9vHm3KOHdRYL+vh9Du/ajlAe
-1XE7reTNuyaW4LiLXToa+8eS+PPogSunffy9tgrzvvnzfvl+T9nnOAAAH1hJREFUeNrs3Flz2jAQ
-AGBhMAaDua9yhiNAKBCOnDRp0yPpdDpT/QE9aDTS1P+if7017STNRSCEYEv7vfHEw0qrXa0AqcOv
-9+LawDyuHU0/hYLGQclqfz//9ev8e9sqHRjB0KfpUe3YHGjxnu5HQBYBPRoxw63psDDqlNrnlNhC
-MMboH/ia84kxJoRN6Hm71BkVhtNW2IxE9QACHvW1p+USZ6F0x2qQOVswSvGTKGXCJnMNq5MOnSVy
-Wu8rAt5RnyTD3UOj1CAOwSh+JsoEcTRKxmE3nJzUEXC5HS1bPTRSzNnwjOIXQpmTEljKOKxmtR0E
-XEnXjqeFcmO+5/FGzPNBo1yYHms6Am4SNS9CHSf2jOINo8xZBZ3QhRlFwAX8k73uO0sQIih+NdT5
-Putdd28CDeNWRXNn6baz8fEWOKmgnT7LQSbYDj3ZuvxgE5viLaI2sT9ctpJQE7yyaLZSxpww7AKM
-cFyuZCERvBa/Vru0CBHYRQQh1mVNg4pg43yRVrrpkq1/LxE0062ID4GN8Z1URzNuU+xS1OazUfUE
-1sBGBLTWqOHi6F+vgcaopcEM6aVN+oU3ro/+9Rp4U+hPEHgxemyY4sQT0f+LEp4axqA3fBGBSLcs
-3Fj1LcaIKHcjcBSsayf8rcld1fEtT/DmtzAMD9ehHZVtL6X+uyixy0caAs9Sj13luedS/12M569i
-8JJkdad9g3l589+ghBn9UwRW8bG776673vUIst/9iMCyBpWi93P/bYwXKwMEluA3Q00uRe6/jfJm
-yIRp0VN8sYIkR/+DxUAhBoOCRXzZoLTh/7cEgllYAgvDjyUHS+Ax/pgC4f+3BGJQC9xjjqkS4XcQ
-OjYR+N9gOFMm/A4yG0JTeCOeycvY+C1CeT4TR8BxWk2pFn4H5akqXBAjVE8cyHbrtyzGDxLKj4ly
-afITK+snSeeQyuIVtWq/+8isom4poP9Q8vC/Vwq0FH08uGd476XfJjBi7CH1RCtfbAzm7C8V1X5Z
-6EuUIPvfoLyUUGpAEBkLyP63MDGOIFXUPxc5Bnfw4mdFLgUGQSj+HsJIUIX5wO7Fe8Vb/8eR9xe7
-SHInQSj+Hkd58ATJzFcrwvZfiBRrErcD8Ss4/Z/CyJW0d8NhC4r/JXArjGS0k4HefzlMZCT8TXHS
-gOpvWZQbSSQXfw2av9UawppUD4dPh1D9rYaRoUTvxZJvofpbGX8ryzEQSED6f94xkJDiL4Z0qP6f
-3w1I8FYoDne/69wMe/5SKLcP6X8NZN/br4YD/bxEf/SyDSLf93AhsJsRkP7XREXGsyPi3hiO/9/s
-3U9LIzEUAPD4Z9tKxbZaKy1SLdKDVi0epIhgFVkoXpIPEIYhZNgeBQ+eks/QP8yhpb2UXvyW68Iu
-uKsrCzOTvMy+39nbe87k/ck0Ol9enBAn5bH6j4dsObkueNzF419MeNfBiwNFPP7FeRQsEres1bH7
-EycR1J0aDjXKbvy2gzv8ftmhpfHDXJq/9WaHz3PObIlsZvD4nwCZceQC4V0W458ImXXig9P5fSz/
-EsL3HWgIlHD6kxzeBr8kUtnGW/8J6m8Dnw5u9bD9k6igt0UA261i/BMWVHcJWJ0qtv8SJ6odAtTG
-EcbfAHEE9OpY5wHjb4R4APkM6OD/vyniCGAG7OL73xwB7yS4hfE3SVSBVYOV2n/8yWcbvtVAdYRK
-2P8zrb8NqCucb2P8jeu3wUyG7nD+ZwPfBzId3mxh/K3gLRAbIl92cP/DErkD4PZwI4fxt0bmrG+K
-rpUx/hbJ8hqxq47vf6t4nVhVxOu/dvlBkVh0vIcNYMvE3jGxZrWLC0DWBd1VYskJNgAg4K0TYkXz
-AgsAEORFk1iwjgUgFLK8Tsw7xQEQGP1TYlyligUgGH61QgwrtLEAACRoF4hRzWssAEDh103yOTwA
-ppvZg2ARn//gmOwJl2rYAQZH1ErEkKsWPgAAClpXxIiVczwAgCTPV4gJB44WAEprrf71z5zED4gB
-pZ6gEQw8S6aD4XIcKq0+j74Kx8vhYOpZMqARiF6JJO4wy2kUE2bTYjALtfp7+MPZYMFsmtAoePaQ
-fARSB8Bjli2Gc60+Dv98uGCWedC7ARuB73gCMPY8CjV9R4ejZ2adF3VDbIMkqtAV1PkEYGw61u/i
-P54yADwajegWSIJWLiVNQwKwx5miv1GzRwaBRyOSl3/UgtAqQBgJwNiIqjfhpyMGgwe6FszXRGoS
-gI3eJgCU+MeQAKKWJ29BmwGDSQC21PQnvWRQeJAnw7eSpikBnsb61/nviUHh0ejkLUnE2Y2fqgRg
-k1DRVyqcMDA8Gp1/c0YS0Mhwmq4EYENNX+khg8OjMeCZBonfPadpS4CnsYb1AogpASi/Jz+AqwCg
-JQB7UZSqFwaIR19BrARWvkqavgR4nCs1h9EB+s7effQ2EUQBHH+OTTOdiN57Fb3DgY5ASDPYJovN
-II1Wa2PABoc4GBBCiCI4cAAuCARX4AR8RDBlAeN4Z9v4zfL+t1yiyPnFs56dl40UAHOOpyDaZgiW
-QAD85b17aLYAogTAxAyItCkL7UQCeCMlilsAkQOwF06BKFvssEQCePXu3SuOqagAMGcxRNicYzKZ
-APjbtxxVkQGQx+ZAZK2eUGUJBfAC0yZAlABYdcJqiKqjDksqgOfPOaqiA8CcoxBR02fZiQXwGtE2
-cMQA7FnTIZqOOCyxABqodgEiBcCcIxBJ2f1SIwDLIx5t+TxHVZQA5P4sRNDyQcH0AbA+XbvVsw88
-0UUJgInB5Zj2ANUAfP5ypUcfz13mie4nAET7gct2lrUCuHblXI+uXicAPirvXAZhW+IwAjBmyAEw
-Zwmqj4DxAGg06wXv6sMjXLmR4XohpurvS54AMH0UXOww5ABaQ5WcSpVigyvWKFZysVUplBQAYLkl
-sHe+RA7Aqim/8k2uWLOSi7HKe40A5Py9EKJMuMeBXLrEbnQWNYDSUE61Qp4rlS/kYq3eC8CNztqv
-YoiciRkIXnaFDPP7f/royYWbHV2MGMCIOoCiKoBiriN9AC7e7OjCk0dPwwiQK7IQuPRxEeLX/+Dh
-/dG75zsLDSD4n2vN4h65q0rAwi9FF893dnf0/sMHIQiI42kI2voyC96DJ6NnuxQ1AH5becG+zRW7
-nYuxylCjF4CzXRp98oAFr7weApY6EOYN4OHoWS0A+O26yiowVFf7/bvfMqaGai2uDMAV8PBSmFGx
-FARrdjnM+n//rCYAPF9SyeI+skqxZXF1AG73w1wHlGdDoFLjRQgAj0bHAEA7gQEAjD4KAUCMT0GQ
-ppVZCACP7xKA6ADcfRwCACtP0/cG4PbsPAGIDsD5Z+FmBVPa3gDcLhCAKAFcYEzzW0BqniAAnhkC
-QMxLgd+yxyQB8MwQAPJY1v9dAMEIgGeGAGDC9x2BvXMlAfDOFABy7l7/5wAIgHemAPB9LuDwAkkA
-FDIGgFxwGPy0zmEEQCFjADBnHfho3xabAKhkDgB7yz5Qb5PDCIBK5gBgziZQ7uSEKgFQyiAA1Qkn
-/ewCmwXA8o77zIqpUAA07QdnTgiTADSaBZPmAoZLfQIgTmRArYH50iAAyZoLiBGAnD8Aau12mDkA
-rLryK1/jitU0zAXoB8Cc3arjoLZBABI2FxAnAFtxVHSSYAYBSNpcQIwAmJgECqXnGQVA/c+1ojwX
-EPMS0OwbgHlp8G7yXGkSAH47Z9pcwEi/AMi5k9UuAY0C0D7Er1LNz1xAbSiuirUWDwZA02XguEW2
-YQB4/lXJu1f+5gJelWIqb/H+AbAXjQOvpl1ipgFIUvECYJemgVebBQFQzzQAYjN4tH2NTQDUMw2A
-vWa7941gAqCeaQCYs8lzE4AA+Mg4AF5bAQNzJQHwkXEA5NwB6NUqhxEAHxkHgDmroEeprVUC4Cfz
-AFS3pnqNg5yWBMBP5gGQp/f2/r+wBMBP5gFgzpKeKwAB8JWBAHqtAZNXSgLgKwMByJWTYawOOYwA
-+MpAAMw5BGOUGhQEwF8mAhCDqbF3gcwEYKmEYyzAsvoOYOy9oKUOMxFAq1lQqelnLuD3t0zOXICb
-sxS6ltkmTATQylWU/0WrYo2hJM4FuIltGejWlKk2BgAfr/boShLmAob7DMCeOgW6NVswBABunbvT
-M5oLCJ+YDd1ajAEA/3C5dxbNBYROLIYujVtbxgDAb5Z5cwHD/QZQXjsO/m2mlCYCUD7EX/EzFxDn
-RWBxpN8ApJzZ/SiAkQAU5wKK/uYCikMxVaw1uEYA6ocCMqeEoQC4lVfJ8vctY6vvG0HfEqcy0NmG
-qbapAJKUHgD21A3dng9EAPpfUADhnyN0UBAABGkCIA5CR+lBAoAhXQAG0/9OBBEABHkCiGtCaH2V
-EQAEaQLAqp0XAesEAcCQLgBiHfxV+gABQJE2AAfSnbeCCQCGdAHovCWcLTMCgCFdAFg5C3+2ShAA
-FGkDIFbBn00kADjSB2Di32cBaAnAkSYAnWcCBlZKAoAibQDkygH43R7BkACwgkRzAQESe+B3O5AA
-GBkuxFazwZVrNAuxNTyCBMAO+N08HABKhUouSDQXECAxD9yWLSqjADAc6HWnuYBAlRct+/MaEAWA
-ei5INBcQ6irQHQlJPgCaCxhrPGQJEgDBlgCaCwiWWOIC2IUEwEighzXRXECwxC742fKNVcYYAgC8
-0YzxPH6LK9eKcS6giWAu4HvVjcvhR9tnScYYBgCc52OK5gL+Sc7aDj+aabe/xgHgf08jAGbP/Osx
-YQQAQzoBuA8RW0cA0KQTgHsucBcBQJNWALv+elg8AcCQRgDuA+U3LKSLQDTpBGAv3ADtBlbI9pcE
-AEM6AcgVA9BujmDtCACGdAJgYg60m0EA8KQXwAxod5AA4EkjAHdIfCIBwJM+AO7R8MwgAcCTXgCD
-mT9mAggAhrQBcGcD3LlQAoAhbQDcCVF3GwAHACsfUxbnKO4Ho5kLcDcCsoJ9DwMAmgvQCoCJLABM
-wgMg5rmAFles9T/MBbg3hM/gAUCHQnUDOAMAO/AAoGPhugHsAIDNBOD/BXAEAObhAUBLgG4ApwDS
-vx4XiwBAzHMB6heB/8VcwLeqW9O/NwIRAGh//CrGlN+5gLgqoJkL+LkV6J4HwgAgzrkA3hHOn0Mb
-APdM0PQ1qAD8731l7+56mgiiMI4fthVaCSgSXowIKITgC0Z5qYmBxEDUqBezaRsIzVxMmi32QpIS
-mpDGCz+GX1dKYaGlhd2LOXt29/ldebmJ/2TK7pwZ5gBWHpGzY9QFBCABbwBmx6E1ozoQgAS8ASiz
-dv0pAAFIwByAfkh5BCAJdwB5WqipDgQgAXMAtQUqIABJuAMo0EZVdSAACZgDqG7QLgKQhDuAXcoh
-AEm4A8jRMN4DSMIcgBmmEQQgCXcAI7SJACThDmCTniEASbgDeEZjsgIo+fA5mCOAMVpRlyQEcGpv
-Q0i4uQCbzyFoLkCpFfqpbMBcQCzmApT6STvKBmwKjcWmUKV26K+yAdvCY7EtXKm/5P8TAaQxAIUl
-IO1LAH4EpvxHIP4MTPmfgXgRJOo52F8E4VWwLOyvgvExSBb2j0H4HCwL++dgbAiRhX1DCLaEycK+
-JQybQmVh3xSKbeGysG8Lx2CILOyDIRgNk4V9NAzDobKwD4diPFwW9vFwHBAhC/sBETgiRhb2I2Jw
-SJQs7IdE4Zg4Wc/BfkwcDopM+0GROCo25UfF0nccFp3aTaH6OxHtygkA28LZj4vHhRHpDmADV8ak
-ewlYxqVRqZ4L0HlcG4dr45xPuDhSznOwBmA+Obg6Vhjuq2NxebQw3JdH4/p4YSK4Pp5yCEAO3gBy
-1LaNAOTgDWCb2h4jADl4A3hMbdMIQA7eAKapzXlp1DkEIAFnAOalQ22Xe4IQgARMAfj7gdq+jdTV
-OQQgAWcA9ZFvdGFLq3MIQALOAPQWdawiADFYA1iljjwCEIM1gDx1TOBHoBisPwInqGP9iVFKyQig
-ZM2BiK/BguYCzJN16njxpq6UkhBAo3m4b0nIuQB7zyFmLqD+5gXRjT8DBARgeS6g5QbUSsVcgN6i
-K/NCAsCmUNYA5unKlJAAsC2cNYApuuIsGaWSH0A5aADlYpdkBmCWHLqyOFcTEYDtJcANKBVLQG1u
-kXyzWkQAlucCGm5AjTTMBehZurYhIwDMBXAGsEHXPgoJwHUPrHF7yHwOxgA+0jVnyQgJIO04Auj9
-DdiZDUAAIvAE4M8E+HIaAYjAFoDO0U3LCEAGvgCW6aaHWAJk4FsCHpKvMyGKACRgCcCfC72WGdYI
-QAKuAPRwhrqsIgAR2AJYpW6v6ghAAq4A6q+o2/pKFQEIwBRAdWWdumUmNQIQgCkAPZmhHtsIQAKu
-ALap13QNAQjAFEBtmnq9HqsigOjxBFAde029sl+0hABKlmAu4Cb9JUu37HnRB9D4bXEuoOUG1rL5
-HALmArw9um3CGHUBcwFJnwswZoJ8vXsCkrwpFHMB/fYC+J5rdS7B28IxF3BJP6d+ppIeAOYCbo2E
-9H4STvgSgLkA/1NwP9kPWinMBSR/LkB/yFJfC17EAbiVk+OyLc1TN7DTZtmW45OKG3EA3gL158yY
-yF8EHfgwF2ApADPjUH9DkzryANKOIQA9OUQDfPYQQDhxDMD7TIOMLhkEEEoMAzBLozTI0Ps6Aggl
-hgHU3w/RQPMeAgglhgF48zTY2g+DAMKIXwDmxxrRXWsAAggjfgH4K0B/ex4CCCN+AXh7dBdnxiCA
-EGIXgHnq0F0ysxoBhBC7APRshu701kMAIcQuAO8tDeJPCCGA4OIWgD8RNNg7jQCCi1sA+h3dZ/wX
-AggubgH8Gqf7PJirIoDAYhZAde4B3avgIYDAYhaAV6D7jc4YBBBUvAIwM6N0v8ysRgBBxSuA9kuA
-APJ2A/hXiVapdNdkYiVa/+wGkKcgFjerFgP4U96P1uFxs1Vx+6i0mseH+9Eq/7EYQHVzkQIpeFYD
-KEbt6Gi/eeb2OGvuHx0Vo2Y1AK9AwThPTaIDuJgUPelaCUonxej/9+0F4H8HCib7VSc9gPZ8RsP1
-Ncoi/vvtBqC/Zimg8VryAygWD/1l4OywKMR/9u6mpXEgDOD4UyxScqiiiCgo6klBEMFD1ZPivZ1p
-KA0d6LRM2ksCK+seRA8NrLnE3noL9FJ68eU7boTuyi576Mx0yGTi/5hTYH48yUCGqATglmHekh/K
-5wAA/n1Q/7s2688BQOhn8XN3zPIAoOfXa0l1X5P5rxYAO4b5Oz/p5gDA7JzurT7rrxBA9+QcODpk
-eQCAPw4Mf8MapQ4AOwSerrZpHgD07mq1O40GgDoAdPsKuNpheQCAnXpdnzdAlQDYDvBV2aR5ANC7
-v9dpACgDQDcrwFexRHIB4FanV0B1AEipCJxZNzQHALDvY51SBIDeWMBb8lmAEgAdz045p4E/cxz8
-WcOxU87rcADg+xCAu7KrBEAcdtItDB3PbvxnS2h7Tpj6zcVKALhl4K+wTFQAaKfcIBpP3x4a/j8E
-kgsPb9NxNGinnAoAZLkAApVdSQCaNgyCwTS27b+evXY8HQTBEGlasyU7AMRGgJEAPgrQKPTxn/xw
-lFzSuGZLcgAIteEaCyAhMJ54eJY3GWu9/JIA3A0Qq3BJzAWAhlE8E+DFkbazfwEAyGUBBDtyDQaQ
-CHjxcZL/ov36SwFwj0C0pVNiMAAUjEMHYyfUff7LASCnSyCcdUANBoCCkY2xPdJ//SUA0AMLxCuW
-mMkAUHvi+5M20j9xAKxUBIkqW9RkAMkIyMQAEAdAtyog1Q4zGUAzCsMoEzfaEv8OQK6Vta7BANDw
-9VX7HYAMgO7aCki2y0wGEIwy8QQQBsB2Qba9M9dgAMP3d5MngHu2B9KtEoMBoChCWUgQAFkF+fbX
-icEA2lnYBIoCIOv7sICsC1rl7zkbADJS87nKH72wYBEVr1mVu/7TI/pqYT0+9avcsWsQTX4r2P/5
-A331i527eWkciAIAPmVFEYUqiLB6UA89SfXkQQQVRPD2mNtAeyj94N0D42lKQj5IE0pyC7m1/U+3
-VViWZbfbziQpb+3vX3jTvK+ZFkb6WGkLaP4n8jhytjmgMMIZof4fw5traDwXR2/7CSiM9FDjOXiD
-FeZU45GAG25PQEFk6Go8BThlJsxXAuh6jlRiM3gJxGYo6Xgumi0BzB2ed0GjDvDDVq9679PUUbLQ
-UyCk5On0vVe9Vuhr5H/onh8yU+bzQETYAMtysyj2J6kSRUWft7wkynLLgg1ANJ8Bmqu99oEOnIMs
-mXDFjQk19SML54CO/muNFezgrAu0IFqziXEikL0kJxX7he7ZASvcSxvIQStOFTegHN+lFv259gsr
-3tUuwRMAmJl0o7IVEQw/tHevWAmajx2gB139rYQMcorx7zw2WSmeKdWBP+HQk7rxtyjGH/rPrByN
-B4pJANANFdegJhTTP0D7ocF+8bU7gQ+YTQVfm0gzkvFfdACluSD5CQCMdQ5ATDL+0L5g5andkSwD
-ANYvA6QHJPXvaqxE9SeSScDOe4KvRfRyGwjqPtVZqfYHFHtBwMgR693AIDkAgM5gn5Vr54RmEsCY
-izXiz4kWAP2THVayyz2ihWDCxerxT2jGv713yUrXfCNZBnycgP88/t23JvubbS8IOFttMaTSGc34
-a3SAWmo3NMsAwNFY8n+S4xHR+PdvvrFK3F8PgCR0Pa74Uop7NAfAAIPre1aRY5ojYQDbjpZeERFi
-Etkk+//FCPiYVeaI6CcAAIfxWCj+R0qM4yHRnz/A4Igtt50GfEJrFqRSid9v/sk0mNFc/64+Afjy
-m+FPiFkSTLmUSok5paTk0yDJyF39098Bm6vfks0Cc4h2HsV+EI5brXEY+HGU25TDD4PbOqvY6XeS
-S4Ef7NxJbuJAFAbglxAmQcAQBwQhDCIsGBLEimQDQYqiKIvuC9TCKpXVvkVfvdWtjhBiMnioV87/
-XYEn+3+D2Twd//0vGRp28r2D06hR7CbeT2DCm5AvCILJtA6AsRrMUAEsqNmAtBiNDW4FkkOMR6TJ
-5dLkViAh3OUlaTOsGzoTTg5ZH5JGlpkXYsnhuBZp1UYM0Eq0Sa8UmkGdlJ0izXo5VIA2Ktcj7dI3
-qABN1E2aGChiHKCHGBeJhVULFaCBaK2IicIUi6HYedMCsVGpogJi5lUrxEitafhG3TS/mjVipdTA
-UDhGslEiZm5RAfGRjVtiZ95HBcRE9ufEUP4TFRAL+ZknlvJ4BsRB9pn+/kRz5IDoyQbL5/9XEsSJ
-UMRcjvlvrfSBCoiU+8Gu/9tUw0wwSl6V2fxnW2WKzVBkxJTV/He3AnaDUREtRvuf/VZZXIhEQmXZ
-7H8PK2ZQARFQGSb3H8d1cwLX4iFzRK5LxujZHiogVI5nM7j/9C/VdjEUDJF029rvv09k1TESCo1b
-t8g4wyXawZCI5ZAMVBijGQiFGhvR/m8bzRSiYGCOmo3IUAMbHw8H5bj2gIx1NUEUDBr/Jldkshp2
-Q0GIKfvt3zHlDILAuRyVKZPx0jZmQueRrs3i69+grqwFXgNnEAvL7Nf/WgUTgdOpsQHHH369PAm8
-Bk4ixdMLJUiqg9fAKcSiY9ry55hKFt2AX47KJujx/6WLbsB/+jfo9uME+WtkQR/UNdtPv4IqvyML
-HiPFewKGP/tcdJrIggeJZueCkuwZk+HDs99nSrjBKxrCfcTi1eDVr2+PGSSBXaTIPNK3MHhooh3Y
-opoPRh1+B1KYYSawSbozQw//znNh3SEMrjnqzkp2+N9WvH/DPwn8573dG/PZX4iGWYTBv6TIGnn2
-H1z6RxXvgT/tnc1W4jAUxyFYaAstQkWqFHBKhYKIfIsIR8eFHwuPL3AXOTnJmb6Frz7F1YwbUUHa
-JL8X6OL/T+7Nzc0tpkWPi76fL5GvzgUvCsC8ynHldw0OLRB4zPQfsGLf9ftdTvfHVNBUgNDxvgiV
-v4+4qgmZCmBarHHV9fUN8gdl0SyAaflA7OD/P+c9sbJBmPcEqfuvjT7AwlgA8EBPSN6RMtNECAsA
-SZu8tfxuhmRJAAuE8pdEK/t/zgI8T5jDUv6PSJo2txbAQGxTyv8RKV1t8HgoxLSh6jL2r8V59Zi3
-6iChx1V58Fuf3/4FcDRchsGFH5NBz5HhqpvhJBnAQDJdWfT9PL/M+3L8IwGh5XtTnG7PDYOmThDn
-bQBD4ExRQvJ1TjT7mcY0G2D0+Unj853vT7KX9R0Wv+5BAszxs7wM+dkxitkr0jiFAgy02DPFbfXb
-AsOufUTj8RcKHNAjuztMSDbLHvL6buQ9EKrv9j0kt/6tkJzV+vMIeyBUf96vzWS5f4sks57VoFHM
-CQnQhuVlpfpbJ4XqAwOiVSlmAMagjuRdz0+RK1Wdl4hsBAToi1Mtifi6b6coBe/pJoDdZgQ4gODm
-ySvIE99uyLUXVhNgNzsBAYCmtWjLpb9TUsO2f20wgJ/8Ow1efc+49ttDGfUjQU6/VVsuAJCtuwAT
-AHBb6q0uV360UNDlyHZWLtjW+BnCVto79ugSyZgfUU5QqTY5KxIACAje3KoPAIAUzya1EpLXe5Hn
-dFjQ/Emm4sIKRvDXhWewwq1kJr5WGMqnvHHioYMOuwvVahkuvBEwgvEaqoeyB/CGa7QsddE9RJ2H
-hCSm7Cm5rK55i57db1WaSwwBY4QQHPKP6CGEEBYqj5fNSqtv9xaepmdzirzV4YeU0smjma7Vp6M7
-NZ0ZV4zm4/L1dfnYNCrjTFq9G03rmj5D+Y4i0OHuL3GFPJytaM54AAAAAElFTkSuQmCC
-"
- id="image71"
- x="34.013355"
- y="59.091763"/></g></svg>
- <span class="d-none d-md-inline logo"> Kavita</span>
- </a>
- <ul class="navbar-nav col me-auto">
-
- <div class="nav-item" *ngIf="(accountService.currentUser$ | async) as user">
- <label for="nav-search" class="form-label visually-hidden">Search series</label>
- <div class="ng-autocomplete">
- <app-grouped-typeahead
- #search
- id="nav-search"
- [minQueryLength]="2"
- initialValue=""
- placeholder="Search…"
- [grouppedData]="searchResults"
- (inputChanged)="onChangeSearch($event)"
- (clearField)="clearSearch()"
- (focusChanged)="focusUpdate($event)"
- >
+ <div class="container-fluid">
+ <a class="visually-hidden-focusable focus-visible" href="javascript:void(0);" (click)="moveFocus()">Skip to main content</a>
+ <a class="side-nav-toggle" *ngIf="navService?.sideNavVisibility$ | async" (click)="hideSideNav()"><i class="fas fa-bars"></i></a>
+ <a class="navbar-brand dark-exempt" routerLink="/libraries" routerLinkActive="active">
+ <img width="28px" height="28px" class="logo" src="assets/images/logo.png" alt="kavita icon" aria-hidden="true"/>
+ <span class="d-none d-md-inline logo"> Kavita</span>
+ </a>
+ <ul class="navbar-nav col me-auto">
+
+ <div class="nav-item" *ngIf="(accountService.currentUser$ | async) as user">
+ <label for="nav-search" class="form-label visually-hidden">Search series</label>
+ <div class="ng-autocomplete">
+ <app-grouped-typeahead
+ #search
+ id="nav-search"
+ [minQueryLength]="2"
+ initialValue=""
+ placeholder="Search…"
+ [grouppedData]="searchResults"
+ (inputChanged)="onChangeSearch($event)"
+ (clearField)="clearSearch()"
+ (focusChanged)="focusUpdate($event)"
+ >
<ng-template #libraryTemplate let-item>
<div style="display: flex;padding: 5px;" (click)="clickLibraryResult(item)">
@@ -213,10 +38,13 @@ NZ0ZV4zm4/L1dfnYNCrjTFq9G03rmj5D+Y4i0OHuL3GFPJytaM54AAAAAElFTkSuQmCC
</div>
<div class="ms-1">
<app-series-format [format]="item.format"></app-series-format>
- <span *ngIf="item.name.toLowerCase().trim().indexOf(searchTerm) >= 0; else localizedName">{{item.name}}</span>
- <ng-template #localizedName>
- <span [innerHTML]="item.localizedName"></span>
- </ng-template>
+ <ng-container *ngIf="searchTerm.toLowerCase().trim() as st">
+ <span *ngIf="item.name.toLowerCase().trim().indexOf(st) >= 0; else localizedName">{{item.name}}</span>
+ <ng-template #localizedName>
+ <span [innerHTML]="item.localizedName"></span>
+ </ng-template>
+ </ng-container>
+
<div class="text-light fst-italic" style="font-size: 0.8rem;">in {{item.libraryName}}</div>
</div>
</div>
@@ -260,7 +88,7 @@ NZ0ZV4zm4/L1dfnYNCrjTFq9G03rmj5D+Y4i0OHuL3GFPJytaM54AAAAAElFTkSuQmCC
<ng-template #personTemplate let-item>
<div style="display: flex;padding: 5px;" class="clickable" (click)="goToPerson(item.role, item.id)">
<div class="ms-1">
-
+
<div [innerHTML]="item.name"></div>
<div class="text-light fst-italic">{{item.role | personRole}}</div>
</div>
@@ -275,7 +103,7 @@ NZ0ZV4zm4/L1dfnYNCrjTFq9G03rmj5D+Y4i0OHuL3GFPJytaM54AAAAAElFTkSuQmCC
</div>
</ng-template>
-
+
<ng-template #chapterTemplate let-item>
<div style="display: flex;padding: 5px;" class="clickable" (click)="clickChapterSearchResult(item)">
@@ -302,44 +130,44 @@ NZ0ZV4zm4/L1dfnYNCrjTFq9G03rmj5D+Y4i0OHuL3GFPJytaM54AAAAAElFTkSuQmCC
</ng-template>
</app-grouped-typeahead>
- </div>
</div>
- </ul>
-
- <ng-container *ngIf="!searchFocused">
- <div class="back-to-top" *ngIf="backToTopNeeded">
- <button class="btn btn-icon scroll-to-top" (click)="scrollToTop()">
- <i class="fa fa-angle-double-up nav" aria-hidden="true"></i>
- <span class="visually-hidden">Scroll to Top</span>
- </button>
+ </div>
+ </ul>
+
+ <ng-container *ngIf="!searchFocused">
+ <div class="back-to-top" *ngIf="backToTopNeeded">
+ <button class="btn btn-icon scroll-to-top" (click)="scrollToTop()">
+ <i class="fa fa-angle-double-up nav" aria-hidden="true"></i>
+ <span class="visually-hidden">Scroll to Top</span>
+ </button>
+ </div>
+
+ <ng-container *ngIf="(accountService.currentUser$ | async) as user">
+ <div class="nav-item">
+ <app-nav-events-toggle [user]="user"></app-nav-events-toggle>
+ </div>
+ <div class="nav-item not-xs-only">
+ <a routerLink="/admin/dashboard" *ngIf="user.roles.includes('Admin')" class="dark-exempt btn btn-icon" title="Server Settings">
+ <i class="fa fa-cogs nav" aria-hidden="true"></i>
+ <span class="visually-hidden">Server Settings</span>
+ </a>
</div>
- <ng-container *ngIf="(accountService.currentUser$ | async) as user">
- <div class="nav-item">
- <app-nav-events-toggle [user]="user"></app-nav-events-toggle>
- </div>
- <div class="nav-item not-xs-only">
- <a routerLink="/admin/dashboard" *ngIf="user.roles.includes('Admin')" class="dark-exempt btn btn-icon" title="Server Settings">
- <i class="fa fa-cogs nav" aria-hidden="true"></i>
- <span class="visually-hidden">Server Settings</span>
- </a>
- </div>
-
- <div ngbDropdown class="nav-item dropdown" display="dynamic" placement="bottom-right" *ngIf="(accountService.currentUser$ | async) as user" dropdown>
- <button class="btn btn-outline-secondary primary-text" ngbDropdownToggle>
- <i class="fa-solid fa-user-circle align-self-center phone-hidden d-xs-inline-block d-sm-inline-block d-md-none"></i><span class="d-none d-xs-none d-sm-none d-md-inline-block">{{user.username | sentenceCase}}</span>
- </button>
- <div ngbDropdownMenu>
- <a class="xs-only" ngbDropdownItem routerLink="/admin/dashboard" *ngIf="user.roles.includes('Admin')">Server Settings</a>
- <a ngbDropdownItem routerLink="/preferences/">Settings</a>
- <a ngbDropdownItem href="https://wiki.kavitareader.com" rel="noopener noreferrer" target="_blank">Help</a>
- <a ngbDropdownItem routerLink="/announcements/" *ngIf="accountService.hasAdminRole(user)">Announcements</a>
- <a ngbDropdownItem (click)="logout()">Logout</a>
- </div>
+ <div ngbDropdown class="nav-item dropdown" display="dynamic" placement="bottom-right" *ngIf="(accountService.currentUser$ | async) as user" dropdown>
+ <button class="btn btn-outline-secondary primary-text" ngbDropdownToggle>
+ <i class="fa-solid fa-user-circle align-self-center phone-hidden d-xs-inline-block d-sm-inline-block d-md-none"></i><span class="d-none d-xs-none d-sm-none d-md-inline-block">{{user.username | sentenceCase}}</span>
+ </button>
+ <div ngbDropdownMenu>
+ <a class="xs-only" ngbDropdownItem routerLink="/admin/dashboard" *ngIf="user.roles.includes('Admin')">Server Settings</a>
+ <a ngbDropdownItem routerLink="/preferences/">Settings</a>
+ <a ngbDropdownItem href="https://wiki.kavitareader.com" rel="noopener noreferrer" target="_blank">Help</a>
+ <a ngbDropdownItem routerLink="/announcements/" *ngIf="accountService.hasAdminRole(user)">Announcements</a>
+ <a ngbDropdownItem (click)="logout()">Logout</a>
</div>
- </ng-container>
+ </div>
</ng-container>
- </div>
+ </ng-container>
+ </div>
</nav>
-
\ No newline at end of file
+
diff --git a/UI/Web/src/app/ng-swipe/ag-swipe.core.ts b/UI/Web/src/app/ng-swipe/ag-swipe.core.ts
new file mode 100644
index 000000000..eed00f17b
--- /dev/null
+++ b/UI/Web/src/app/ng-swipe/ag-swipe.core.ts
@@ -0,0 +1,103 @@
+import { fromEvent, Observable, race, Subscription } from 'rxjs';
+import { elementAt, map, switchMap, takeUntil, tap } from 'rxjs/operators';
+
+export interface SwipeCoordinates {
+ x: number;
+ y: number;
+ }
+
+ export enum SwipeDirection {
+ X = 'x',
+ Y = 'y'
+ }
+
+ export interface SwipeStartEvent {
+ x: number;
+ y: number;
+ direction: SwipeDirection;
+ }
+
+ export interface SwipeEvent {
+ direction: SwipeDirection;
+ distance: number;
+ }
+
+ export interface SwipeSubscriptionConfig {
+ domElement: HTMLElement;
+ onSwipeMove?: (event: SwipeEvent) => void;
+ onSwipeEnd?: (event: SwipeEvent) => void;
+ }
+
+
+export function createSwipeSubscription({ domElement, onSwipeMove, onSwipeEnd }: SwipeSubscriptionConfig): Subscription {
+ if (!(domElement instanceof HTMLElement)) {
+ throw new Error('Provided domElement should be an instance of HTMLElement');
+ }
+
+ if ((typeof onSwipeMove !== 'function') && (typeof onSwipeEnd !== 'function')) {
+ throw new Error('At least one of the following swipe event handler functions should be provided: onSwipeMove and/or onSwipeEnd');
+ }
+
+ const touchStarts$ = fromEvent<TouchEvent>(domElement, 'touchstart').pipe(map(getTouchCoordinates));
+ const touchMoves$ = fromEvent<TouchEvent>(domElement, 'touchmove').pipe(map(getTouchCoordinates));
+ const touchEnds$ = fromEvent<TouchEvent>(domElement, 'touchend').pipe(map(getTouchCoordinates));
+ const touchCancels$ = fromEvent<TouchEvent>(domElement, 'touchcancel');
+
+ const touchStartsWithDirection$: Observable<SwipeStartEvent> = touchStarts$.pipe(
+ switchMap((touchStartEvent: SwipeCoordinates) => touchMoves$.pipe(
+ elementAt(3),
+ map((touchMoveEvent: SwipeCoordinates) => ({
+ x: touchStartEvent.x,
+ y: touchStartEvent.y,
+ direction: getTouchDirection(touchStartEvent, touchMoveEvent)
+ })
+ ))
+ )
+ );
+
+ return touchStartsWithDirection$.pipe(
+ switchMap(touchStartEvent => touchMoves$.pipe(
+ map(touchMoveEvent => getTouchDistance(touchStartEvent, touchMoveEvent)),
+ tap((coordinates: SwipeCoordinates) => {
+ if (typeof onSwipeMove !== 'function') { return; }
+ onSwipeMove(getSwipeEvent(touchStartEvent, coordinates));
+ }),
+ takeUntil(race(
+ touchEnds$.pipe(
+ map(touchEndEvent => getTouchDistance(touchStartEvent, touchEndEvent)),
+ tap((coordinates: SwipeCoordinates) => {
+ if (typeof onSwipeEnd !== 'function') { return; }
+ onSwipeEnd(getSwipeEvent(touchStartEvent, coordinates));
+ })
+ ),
+ touchCancels$
+ ))
+ ))
+ ).subscribe();
+}
+
+function getTouchCoordinates(touchEvent: TouchEvent): SwipeCoordinates {
+ return {
+ x: touchEvent.changedTouches[0].clientX,
+ y: touchEvent.changedTouches[0].clientY
+ };
+}
+
+function getTouchDistance(startCoordinates: SwipeCoordinates, moveCoordinates: SwipeCoordinates): SwipeCoordinates {
+ return {
+ x: moveCoordinates.x - startCoordinates.x,
+ y: moveCoordinates.y - startCoordinates.y
+ };
+}
+
+function getTouchDirection(startCoordinates: SwipeCoordinates, moveCoordinates: SwipeCoordinates): SwipeDirection {
+ const { x, y } = getTouchDistance(startCoordinates, moveCoordinates);
+ return Math.abs(x) < Math.abs(y) ? SwipeDirection.Y : SwipeDirection.X;
+}
+
+function getSwipeEvent(touchStartEvent: SwipeStartEvent, coordinates: SwipeCoordinates): SwipeEvent {
+ return {
+ direction: touchStartEvent.direction,
+ distance: coordinates[touchStartEvent.direction]
+ };
+}
diff --git a/UI/Web/src/app/ng-swipe/ng-swipe.directive.ts b/UI/Web/src/app/ng-swipe/ng-swipe.directive.ts
new file mode 100644
index 000000000..1e5bdc387
--- /dev/null
+++ b/UI/Web/src/app/ng-swipe/ng-swipe.directive.ts
@@ -0,0 +1,32 @@
+import { Directive, ElementRef, EventEmitter, NgZone, OnDestroy, OnInit, Output } from '@angular/core';
+import { Subscription } from 'rxjs';
+import { createSwipeSubscription, SwipeEvent } from './ag-swipe.core';
+
+@Directive({
+ selector: '[ngSwipe]'
+})
+export class SwipeDirective implements OnInit, OnDestroy {
+ private swipeSubscription: Subscription | undefined;
+
+ @Output() swipeMove: EventEmitter<SwipeEvent> = new EventEmitter<SwipeEvent>();
+ @Output() swipeEnd: EventEmitter<SwipeEvent> = new EventEmitter<SwipeEvent>();
+
+ constructor(
+ private elementRef: ElementRef,
+ private zone: NgZone
+ ) {}
+
+ ngOnInit() {
+ this.zone.runOutsideAngular(() => {
+ this.swipeSubscription = createSwipeSubscription({
+ domElement: this.elementRef.nativeElement,
+ onSwipeMove: (swipeMoveEvent: SwipeEvent) => this.swipeMove.emit(swipeMoveEvent),
+ onSwipeEnd: (swipeEndEvent: SwipeEvent) => this.swipeEnd.emit(swipeEndEvent)
+ });
+ });
+ }
+
+ ngOnDestroy() {
+ this.swipeSubscription?.unsubscribe?.();
+ }
+}
diff --git a/UI/Web/src/app/ng-swipe/ng-swipe.module.ts b/UI/Web/src/app/ng-swipe/ng-swipe.module.ts
new file mode 100644
index 000000000..31c10ea89
--- /dev/null
+++ b/UI/Web/src/app/ng-swipe/ng-swipe.module.ts
@@ -0,0 +1,18 @@
+import { NgModule } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { SwipeDirective } from './ng-swipe.directive';
+
+// All code in this module is based on https://github.com/aGoncharuks/ag-swipe and may contain further enhancements or bugfixes.
+
+@NgModule({
+ declarations: [
+ SwipeDirective
+ ],
+ imports: [
+ CommonModule
+ ],
+ exports: [
+ SwipeDirective
+ ]
+})
+export class NgSwipeModule { }
diff --git a/UI/Web/src/app/pdf-reader/_components/pdf-reader/pdf-reader.component.html b/UI/Web/src/app/pdf-reader/_components/pdf-reader/pdf-reader.component.html
index 568fbbc1c..b2e9d9d8f 100644
--- a/UI/Web/src/app/pdf-reader/_components/pdf-reader/pdf-reader.component.html
+++ b/UI/Web/src/app/pdf-reader/_components/pdf-reader/pdf-reader.component.html
@@ -22,13 +22,11 @@
[showHandToolButton]="true"
[showOpenFileButton]="false"
[showPrintButton]="false"
- [showBookmarkButton]="false"
[showRotateButton]="false"
[showDownloadButton]="false"
[showPropertiesButton]="false"
[(zoom)]="zoomSetting"
[showSecondaryToolbarButton]="true"
-
[showBorders]="true"
[theme]="theme"
[formTheme]="theme"
diff --git a/UI/Web/src/app/pipe/age-rating.pipe.ts b/UI/Web/src/app/pipe/age-rating.pipe.ts
index f810692d9..80b81725b 100644
--- a/UI/Web/src/app/pipe/age-rating.pipe.ts
+++ b/UI/Web/src/app/pipe/age-rating.pipe.ts
@@ -2,23 +2,41 @@ import { Pipe, PipeTransform } from '@angular/core';
import { Observable, of } from 'rxjs';
import { AgeRating } from '../_models/metadata/age-rating';
import { AgeRatingDto } from '../_models/metadata/age-rating-dto';
-import { MetadataService } from '../_services/metadata.service';
@Pipe({
name: 'ageRating'
})
export class AgeRatingPipe implements PipeTransform {
- constructor(private metadataService: MetadataService) {}
+ constructor() {}
transform(value: AgeRating | AgeRatingDto | undefined): Observable<string> {
- if (value === undefined || value === null) return of('undefined');
+ if (value === undefined || value === null) return of('Unknown');
if (value.hasOwnProperty('title')) {
return of((value as AgeRatingDto).title);
}
- return this.metadataService.getAgeRating((value as AgeRating));
+ switch(value) {
+ case AgeRating.Unknown: return of('Unknown');
+ case AgeRating.EarlyChildhood: return of('Early Childhood');
+ case AgeRating.AdultsOnly: return of('Adults Only 18+');
+ case AgeRating.Everyone: return of('Everyone');
+ case AgeRating.Everyone10Plus: return of('Everyone 10+');
+ case AgeRating.G: return of('G');
+ case AgeRating.KidsToAdults: return of('Kids to Adults');
+ case AgeRating.Mature: return of('Mature');
+ case AgeRating.Mature15Plus: return of('MA15+');
+ case AgeRating.Mature17Plus: return of('Mature 17+');
+ case AgeRating.RatingPending: return of('Rating Pending');
+ case AgeRating.Teen: return of('Teen');
+ case AgeRating.X18Plus: return of('X18+');
+ case AgeRating.NotApplicable: return of('Not Applicable');
+ case AgeRating.PG: return of('PG');
+ case AgeRating.R18Plus: return of('R18+')
+ }
+
+ return of('Unknown');
}
}
diff --git a/UI/Web/src/app/pipe/pipe.module.ts b/UI/Web/src/app/pipe/pipe.module.ts
index e98720776..41fed32da 100644
--- a/UI/Web/src/app/pipe/pipe.module.ts
+++ b/UI/Web/src/app/pipe/pipe.module.ts
@@ -17,6 +17,7 @@ import { SafeStylePipe } from './safe-style.pipe';
import { DefaultDatePipe } from './default-date.pipe';
import { BytesPipe } from './bytes.pipe';
import { TimeAgoPipe } from './time-ago.pipe';
+import { TimeDurationPipe } from './time-duration.pipe';
@@ -39,6 +40,7 @@ import { TimeAgoPipe } from './time-ago.pipe';
DefaultDatePipe,
BytesPipe,
TimeAgoPipe,
+ TimeDurationPipe,
],
imports: [
CommonModule,
@@ -60,7 +62,8 @@ import { TimeAgoPipe } from './time-ago.pipe';
SafeStylePipe,
DefaultDatePipe,
BytesPipe,
- TimeAgoPipe
+ TimeAgoPipe,
+ TimeDurationPipe
]
})
export class PipeModule { }
diff --git a/UI/Web/src/app/pipe/time-ago.pipe.ts b/UI/Web/src/app/pipe/time-ago.pipe.ts
index c67b51b41..fe8aa4eb6 100644
--- a/UI/Web/src/app/pipe/time-ago.pipe.ts
+++ b/UI/Web/src/app/pipe/time-ago.pipe.ts
@@ -33,9 +33,9 @@ and modified
})
export class TimeAgoPipe implements PipeTransform, OnDestroy {
- private timer: number | null = null;
- constructor(private changeDetectorRef: ChangeDetectorRef, private ngZone: NgZone) {}
- transform(value:string) {
+ private timer: number | null = null;
+ constructor(private readonly changeDetectorRef: ChangeDetectorRef, private ngZone: NgZone) {}
+ transform(value: string) {
this.removeTimer();
const d = new Date(value);
const now = new Date();
@@ -61,37 +61,37 @@ export class TimeAgoPipe implements PipeTransform, OnDestroy {
return '';
}
- if (seconds <= 45) {
- return 'just now';
- }
- if (seconds <= 90) {
- return 'a minute ago';
- }
- if (minutes <= 45) {
- return minutes + ' minutes ago';
- }
- if (minutes <= 90) {
- return 'an hour ago';
- }
- if (hours <= 22) {
- return hours + ' hours ago';
- }
- if (hours <= 36) {
- return 'a day ago';
- }
- if (days <= 25) {
- return days + ' days ago';
- }
- if (days <= 45) {
- return 'a month ago';
- }
- if (days <= 345) {
- return months + ' months ago';
- }
- if (days <= 545) {
- return 'a year ago';
- }
- return years + ' years ago';
+ if (seconds <= 45) {
+ return 'just now';
+ }
+ if (seconds <= 90) {
+ return 'a minute ago';
+ }
+ if (minutes <= 45) {
+ return minutes + ' minutes ago';
+ }
+ if (minutes <= 90) {
+ return 'an hour ago';
+ }
+ if (hours <= 22) {
+ return hours + ' hours ago';
+ }
+ if (hours <= 36) {
+ return 'a day ago';
+ }
+ if (days <= 25) {
+ return days + ' days ago';
+ }
+ if (days <= 45) {
+ return 'a month ago';
+ }
+ if (days <= 345) {
+ return months + ' months ago';
+ }
+ if (days <= 545) {
+ return 'a year ago';
+ }
+ return years + ' years ago';
}
ngOnDestroy(): void {
diff --git a/UI/Web/src/app/pipe/time-duration.pipe.ts b/UI/Web/src/app/pipe/time-duration.pipe.ts
new file mode 100644
index 000000000..728c1b1f0
--- /dev/null
+++ b/UI/Web/src/app/pipe/time-duration.pipe.ts
@@ -0,0 +1,26 @@
+import { Pipe, PipeTransform } from '@angular/core';
+
+/**
+ * Converts hours -> days, months, years, etc
+ */
+@Pipe({
+ name: 'timeDuration'
+})
+export class TimeDurationPipe implements PipeTransform {
+
+ transform(hours: number): string {
+ if (hours === 0) return `${hours} hours`;
+ if (hours < 1) {
+ return `${(hours * 60).toFixed(1)} minutes`;
+ } else if (hours < 24) {
+ return `${hours.toFixed(1)} hours`;
+ } else if (hours < 720) {
+ return `${(hours / 24).toFixed(1)} days`;
+ } else if (hours < 8760) {
+ return `${(hours / 720).toFixed(1)} months`;
+ } else {
+ return `${(hours / 8760).toFixed(1)} years`;
+ }
+ }
+
+}
diff --git a/UI/Web/src/app/reading-list/_components/draggable-ordered-list/draggable-ordered-list.component.html b/UI/Web/src/app/reading-list/_components/draggable-ordered-list/draggable-ordered-list.component.html
index e8fa22c44..fc9dbc36d 100644
--- a/UI/Web/src/app/reading-list/_components/draggable-ordered-list/draggable-ordered-list.component.html
+++ b/UI/Web/src/app/reading-list/_components/draggable-ordered-list/draggable-ordered-list.component.html
@@ -1,25 +1,58 @@
-<div cdkDropList class="{{items.length > 0 ? 'example-list list-group-flush' : ''}}" (cdkDropListDropped)="drop($event)">
- <div class="example-box" *ngFor="let item of items; index as i" cdkDrag [cdkDragData]="item" cdkDragBoundary=".example-list">
- <div class="d-flex list-container">
- <div class="me-3 align-middle">
- <i class="fa fa-grip-vertical drag-handle" aria-hidden="true" cdkDragHandle></i>
+<ng-container>
+
+ <ng-container *ngIf="items.length > 100; else dragList">
+ <div class="example-list list-group-flush">
+ <virtual-scroller #scroll [items]="items" [bufferAmount]="BufferAmount" [parentScroll]="parentScroll">
+ <div class="example-box" *ngFor="let item of scroll.viewPortItems; index as i; trackBy: trackByIdentity">
+ <div class="d-flex list-container">
+ <div class="me-3 align-middle">
+ <div style="padding-top: 40px">
+ <label for="reorder-{{i}}" class="form-label visually-hidden">Reorder</label>
+ <input *ngIf="accessibilityMode" id="reorder-{{i}}" class="form-control" type="number" inputmode="numeric" min="0" [max]="items.length - 1" [value]="i" style="width: 60px"
+ (focusout)="updateIndex(i, item)" (keydown.enter)="updateIndex(i, item)" aria-describedby="instructions">
+ </div>
+ </div>
+
+ <ng-container [ngTemplateOutlet]="itemTemplate" [ngTemplateOutletContext]="{ $implicit: item, idx: i }"></ng-container>
+
+ <button class="btn btn-icon float-end" (click)="removeItem(item, i)" *ngIf="showRemoveButton">
+ <i class="fa fa-times" aria-hidden="true"></i>
+ <span class="visually-hidden" attr.aria-labelledby="item.id--{{i}}">Remove item</span>
+ </button>
+ </div>
+ </div>
+ </virtual-scroller>
</div>
-
- <ng-container [ngTemplateOutlet]="itemTemplate" [ngTemplateOutletContext]="{ $implicit: item, idx: i }"></ng-container>
-
- <div class="align-middle" style="padding-top: 40px">
- <label for="reorder-{{i}}" class="form-label visually-hidden">Reorder</label>
- <input *ngIf="accessibilityMode" id="reorder-{{i}}" class="form-control" type="number" min="0" [max]="items.length - 1" [value]="i" style="width: 60px" (focusout)="updateIndex(i, item)" (keydown.enter)="updateIndex(i, item)" aria-describedby="instructions">
+ </ng-container>
+ <ng-template #dragList>
+ <div cdkDropList class="{{items.length > 0 ? 'example-list list-group-flush' : ''}}" (cdkDropListDropped)="drop($event)">
+ <div class="example-box" *ngFor="let item of items; index as i" cdkDrag [cdkDragData]="item" cdkDragBoundary=".example-list">
+ <div class="d-flex list-container">
+ <div class="me-3 align-middle">
+ <div class="align-middle" style="padding-top: 40px" *ngIf="accessibilityMode">
+ <label for="reorder-{{i}}" class="form-label visually-hidden">Reorder</label>
+ <input id="reorder-{{i}}" class="form-control" type="number" inputmode="numeric" min="0" [max]="items.length - 1" [value]="i" style="width: 60px"
+ (focusout)="updateIndex(i, item)" (keydown.enter)="updateIndex(i, item)" aria-describedby="instructions">
+ </div>
+ <i *ngIf="!accessibilityMode" class="fa fa-grip-vertical drag-handle" aria-hidden="true" cdkDragHandle></i>
+ </div>
+
+ <ng-container [ngTemplateOutlet]="itemTemplate" [ngTemplateOutletContext]="{ $implicit: item, idx: i }"></ng-container>
+
+ <button class="btn btn-icon float-end" (click)="removeItem(item, i)" *ngIf="showRemoveButton">
+ <i class="fa fa-times" aria-hidden="true"></i>
+ <span class="visually-hidden" attr.aria-labelledby="item.id--{{i}}">Remove item</span>
+ </button>
+ </div>
</div>
- <button class="btn btn-icon float-end" (click)="removeItem(item, i)" *ngIf="showRemoveButton">
- <i class="fa fa-times" aria-hidden="true"></i>
- <span class="visually-hidden" attr.aria-labelledby="item.id--{{i}}">Remove item</span>
- </button>
</div>
-
- </div>
-</div>
+ </ng-template>
+
+
+
+ <p class="visually-hidden" id="instructions">
+ When you put a number in the reorder input, the item will be inserted at that location and all other items will have their order updated.
+ </p>
+
-<p class="visually-hidden" id="instructions">
- When you put a number in the reorder input, the item will be inserted at that location and all other items will have their order updated.
-</p>
\ No newline at end of file
+</ng-container>
\ No newline at end of file
diff --git a/UI/Web/src/app/reading-list/_components/draggable-ordered-list/draggable-ordered-list.component.scss b/UI/Web/src/app/reading-list/_components/draggable-ordered-list/draggable-ordered-list.component.scss
index 7a1d96b9a..1cab9d886 100644
--- a/UI/Web/src/app/reading-list/_components/draggable-ordered-list/draggable-ordered-list.component.scss
+++ b/UI/Web/src/app/reading-list/_components/draggable-ordered-list/draggable-ordered-list.component.scss
@@ -9,11 +9,12 @@
.example-box {
margin: 5px 0;
- //border-bottom: solid 1px #ccc;
display: flex;
flex-direction: row;
box-sizing: border-box;
font-size: 14px;
+ max-height: 140px;
+ height: 140px;
.drag-handle {
cursor: move;
@@ -59,3 +60,14 @@
border-radius: 5px;
width: 100%;
}
+
+
+
+.virtual-scroller, virtual-scroller {
+ width: 100%;
+ height: calc(var(--vh) * 100 - 173px);
+}
+
+virtual-scroller.empty {
+ display: none;
+}
\ No newline at end of file
diff --git a/UI/Web/src/app/reading-list/_components/draggable-ordered-list/draggable-ordered-list.component.ts b/UI/Web/src/app/reading-list/_components/draggable-ordered-list/draggable-ordered-list.component.ts
index b57200424..d7a80dfac 100644
--- a/UI/Web/src/app/reading-list/_components/draggable-ordered-list/draggable-ordered-list.component.ts
+++ b/UI/Web/src/app/reading-list/_components/draggable-ordered-list/draggable-ordered-list.component.ts
@@ -1,5 +1,6 @@
import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop';
-import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChild, EventEmitter, Input, Output, TemplateRef } from '@angular/core';
+import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChild, EventEmitter, Input, Output, TemplateRef, TrackByFunction, ViewChild } from '@angular/core';
+import { VirtualScrollerComponent } from '@iharbeck/ngx-virtual-scroller';
export interface IndexUpdateEvent {
fromPosition: number;
@@ -26,10 +27,19 @@ export class DraggableOrderedListComponent {
*/
@Input() showRemoveButton: boolean = true;
@Input() items: Array<any> = [];
+ /**
+ * Parent scroll for virtualize pagination
+ */
+ @Input() parentScroll!: Element | Window;
+ @Input() trackByIdentity: TrackByFunction<any> = (index: number, item: any) => `${item.id}_${item.order}_${item.title}`;
@Output() orderUpdated: EventEmitter<IndexUpdateEvent> = new EventEmitter<IndexUpdateEvent>();
@Output() itemRemove: EventEmitter<ItemRemoveEvent> = new EventEmitter<ItemRemoveEvent>();
@ContentChild('draggableItem') itemTemplate!: TemplateRef<any>;
+ get BufferAmount() {
+ return Math.min(this.items.length / 20, 20);
+ }
+
constructor(private readonly cdRef: ChangeDetectorRef) { }
drop(event: CdkDragDrop<string[]>) {
diff --git a/UI/Web/src/app/reading-list/_components/reading-list-detail/reading-list-detail.component.html b/UI/Web/src/app/reading-list/_components/reading-list-detail/reading-list-detail.component.html
index 98753546c..4507e327a 100644
--- a/UI/Web/src/app/reading-list/_components/reading-list-detail/reading-list-detail.component.html
+++ b/UI/Web/src/app/reading-list/_components/reading-list-detail/reading-list-detail.component.html
@@ -1,73 +1,134 @@
-<app-side-nav-companion-bar>
- <h2 title>
- <span *ngIf="actions.length > 0">
- <app-card-actionables (actionHandler)="performAction($event)" [actions]="actions" [attr.labelBy]="readingList?.title"></app-card-actionables>
- </span>
- {{readingList?.title}}
- <span *ngIf="readingList?.promoted" class="ms-1">(<i class="fa fa-angle-double-up" aria-hidden="true"></i>)</span>
- </h2>
- <h6 subtitle class="subtitle-with-actionables">{{items.length}} Items</h6>
-</app-side-nav-companion-bar>
-<div class="container-fluid mt-2" *ngIf="readingList">
-
- <div class="row mb-3">
- <div class="col-md-2 col-xs-4 col-sm-6 d-none d-sm-block" *ngIf="readingList.coverImage !== '' && readingList.coverImage !== undefined && readingList.coverImage !== null">
- <app-image maxWidth="300px" maxHeight="400px" [imageUrl]="readingListImage"></app-image>
- </div>
- <div class="col-md-10 col-xs-8 col-sm-6 mt-2">
- <div class="row g-0 mb-3">
- <div class="col-auto me-2">
- <!-- Action row-->
- <button class="btn btn-primary" title="Read from beginning" (click)="read()">
- <span>
- <i class="fa fa-book" aria-hidden="true"></i>
- <span class="read-btn--text">&nbsp;Read</span>
- </span>
- </button>
- <button class="btn btn-primary ms-2" title="Continue from last reading position" (click)="continue()">
- <span>
- <i class="fa fa-book-open" aria-hidden="true"></i>
- <span class="read-btn--text">&nbsp;Continue</span>
- </span>
- </button>
- </div>
- <div class="col-auto">
- <button class="btn btn-secondary" (click)="removeRead()" [disabled]="readingList.promoted && !this.isAdmin">
+<app-side-nav-companion-bar [hasExtras]="readingList !== undefined" [extraDrawer]="extrasDrawer">
+ <h2 title>
+ <app-card-actionables (actionHandler)="performAction($event)" [actions]="actions" [attr.labelBy]="readingList?.title" *ngIf="actions.length > 0"></app-card-actionables>
+ {{readingList?.title}}
+ <span *ngIf="readingList?.promoted" class="ms-1">(<i class="fa fa-angle-double-up" aria-hidden="true"></i>)</span>
+ </h2>
+ <h6 subtitle class="subtitle-with-actionables">{{items.length | number}} Items</h6>
+
+ <ng-template #extrasDrawer let-offcanvas>
+ <div style="margin-top: 56px" *ngIf="readingList">
+ <div class="offcanvas-header">
+ <h4 class="offcanvas-title" id="offcanvas-basic-title">Page Settings</h4>
+ <button type="button" class="btn-close" aria-label="Close" (click)="offcanvas.dismiss()"></button>
+ </div>
+ <div class="offcanvas-body">
+ <div class="row g-0">
+ <div class="col-md-12 col-sm-12 pe-2 mb-3">
+ <button class="btn btn-danger" (click)="removeRead()" [disabled]="readingList.promoted && !this.isAdmin">
+ <span>
+ <i class="fa fa-check"></i>
+ </span>
+ <span class="read-btn--text">&nbsp;Remove Read</span>
+ </button>
+
+ <div class="col-auto ms-2 mt-2" *ngIf="!(readingList?.promoted && !this.isAdmin)">
+ <div class="form-check form-check-inline">
+ <input class="form-check-input" type="checkbox" id="accessibility-mode" [value]="accessibilityMode" (change)="updateAccesibilityMode()">
+ <label class="form-check-label" for="accessibility-mode">Order Numbers</label>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </ng-template>
+ </app-side-nav-companion-bar>
+ <div class="container-fluid mt-2" *ngIf="readingList" >
+
+ <div class="row mb-3">
+ <div class="col-md-2 col-xs-4 col-sm-6 d-none d-sm-block" *ngIf="readingList.coverImage !== '' && readingList.coverImage !== undefined && readingList.coverImage !== null">
+ <app-image maxWidth="300px" maxHeight="400px" [imageUrl]="readingListImage"></app-image>
+ </div>
+ <div class="col-md-10 col-xs-8 col-sm-6 mt-2">
+ <div class="row g-0 mb-3">
+ <div class="col-auto me-2">
+ <!-- Action row-->
+ <div class="btn-group me-3">
+ <button type="button" class="btn btn-primary" (click)="continue()">
<span>
- <i class="fa fa-check"></i>
+ <i class="fa fa-book-open" aria-hidden="true"></i>
+ <span class="read-btn--text">&nbsp;Continue</span>
</span>
- <span class="read-btn--text">&nbsp;Remove Read</span>
- </button>
- </div>
- <!-- TODO: Move this in companion bar's page actions -->
- <div class="col-auto ms-2 mt-2" *ngIf="!(readingList?.promoted && !this.isAdmin)">
- <div class="form-check form-check-inline">
- <input class="form-check-input" type="checkbox" id="accessibilit-mode" [value]="accessibilityMode" (change)="accessibilityMode = !accessibilityMode">
- <label class="form-check-label" for="accessibilit-mode">Order Numbers</label>
+ </button>
+ <div class="btn-group" ngbDropdown role="group" aria-label="Read options">
+ <button type="button" class="btn btn-primary dropdown-toggle-split" ngbDropdownToggle></button>
+ <div class="dropdown-menu" ngbDropdownMenu>
+ <button ngbDropdownItem (click)="read()">
+ <span>
+ <i class="fa fa-book" aria-hidden="true"></i>
+ <span class="read-btn--text">&nbsp;Read</span>
+ </span>
+ </button>
+ <button ngbDropdownItem (click)="continue(true)">
+ <span>
+ <i class="fa fa-book-open" aria-hidden="true"></i>
+ <span class="read-btn--text">&nbsp;Continue</span>
+ (<i class="fa fa-glasses ms-1" aria-hidden="true"></i>)
+ <span class="visually-hidden">(Incognito)</span>
+ </span>
+ </button>
+ <button ngbDropdownItem (click)="read(true)">
+ <span>
+ <i class="fa fa-book" aria-hidden="true"></i>
+ <span class="read-btn--text">&nbsp;Read</span>
+ (<i class="fa fa-glasses ms-1" aria-hidden="true"></i>)
+ <span class="visually-hidden">(Incognito)</span>
+ </span>
+ </button>
+ </div>
+ </div>
+ </div>
</div>
</div>
- </div>
- <!-- Summary row-->
- <div class="row g-0 mt-2">
- <app-read-more [text]="readingListSummary" [maxLength]="250"></app-read-more>
+ <div class="row g-0 mt-2" *ngIf="readingList.startingYear !== 0">
+ <h4 class="reading-list-years">
+ <ng-container *ngIf="readingList.startingMonth > 0">{{readingList.startingMonth | date:'MMM'}}</ng-container>
+ <ng-container *ngIf="readingList.startingMonth > 0 && readingList.startingYear > 0">, </ng-container>
+ <ng-container *ngIf="readingList.startingYear > 0">{{readingList.startingYear}}</ng-container>
+ —
+ <ng-container *ngIf="readingList.endingYear > 0">
+ <ng-container *ngIf="readingList.endingMonth > 0">{{readingList.endingMonth}}</ng-container>
+ <ng-container *ngIf="readingList.endingMonth > 0 && readingList.endingYear > 0">, </ng-container>
+ <ng-container *ngIf="readingList.endingYear > 0">{{readingList.endingYear}}</ng-container>
+ </ng-container>
+
+ </h4>
+ </div>
+ <!-- Summary row-->
+ <div class="row g-0 mt-2">
+ <app-read-more [text]="readingListSummary" [maxLength]="250"></app-read-more>
+ </div>
</div>
</div>
- </div>
-
- <div class="row mb-3" cdkScrollable>
- <div class="mx-auto" style="width: 200px;">
- <ng-container *ngIf="items.length === 0 && !isLoading">
- Nothing added
+
+ <div class="row mb-3">
+ <ng-container *ngIf="characters$ | async as characters">
+ <div class="row" *ngIf="characters && characters.length > 0">
+ <h5>Characters</h5>
+ <app-badge-expander [items]="characters">
+ <ng-template #badgeExpanderItem let-item let-position="idx">
+ <app-person-badge a11y-click="13,32" class="col-auto" [person]="item"></app-person-badge>
+ </ng-template>
+ </app-badge-expander>
+ </div>
</ng-container>
- <app-loading [loading]="isLoading"></app-loading>
</div>
-
- <!-- TODO: This needs virtualization -->
- <app-draggable-ordered-list [items]="items" (orderUpdated)="orderUpdated($event)" [accessibilityMode]="accessibilityMode" [showRemoveButton]="false">
- <ng-template #draggableItem let-item let-position="idx">
- <app-reading-list-item class="content-container" [item]="item" [position]="position" [libraryTypes]="libraryTypes"
- [promoted]="item.promoted" (read)="readChapter($event)" (remove)="itemRemoved($event, position)"></app-reading-list-item>
- </ng-template>
- </app-draggable-ordered-list>
- </div>
-</div>
\ No newline at end of file
+
+ <div class="row mb-3 scroll-container" #scrollingBlock>
+ <div class="mx-auto" style="width: 200px;">
+ <ng-container *ngIf="items.length === 0 && !isLoading">
+ Nothing added
+ </ng-container>
+ <app-loading [loading]="isLoading"></app-loading>
+ </div>
+
+ <app-draggable-ordered-list [items]="items" (orderUpdated)="orderUpdated($event)" [accessibilityMode]="accessibilityMode"
+ [showRemoveButton]="false">
+ <ng-template #draggableItem let-item let-position="idx">
+ <app-reading-list-item [ngClass]="{'content-container': items.length < 100, 'non-virtualized-container': items.length >= 100}" [item]="item" [position]="position" [libraryTypes]="libraryTypes"
+ [promoted]="item.promoted" (read)="readChapter($event)" (remove)="itemRemoved($event, position)"></app-reading-list-item>
+ </ng-template>
+ </app-draggable-ordered-list>
+ </div>
+ </div>
\ No newline at end of file
diff --git a/UI/Web/src/app/reading-list/_components/reading-list-detail/reading-list-detail.component.scss b/UI/Web/src/app/reading-list/_components/reading-list-detail/reading-list-detail.component.scss
index 9129ac012..1ce6ed148 100644
--- a/UI/Web/src/app/reading-list/_components/reading-list-detail/reading-list-detail.component.scss
+++ b/UI/Web/src/app/reading-list/_components/reading-list-detail/reading-list-detail.component.scss
@@ -1,3 +1,32 @@
.content-container {
width: 100%;
+}
+
+.non-virtualized-container {
+ width: 100%;
+ max-height: 140px;
+ height: 140px;
+}
+
+.dropdown-toggle-split {
+ border-top-right-radius: 6px !important;
+ border-bottom-right-radius: 6px !important;
+ border-top-left-radius: 0px !important;
+ border-bottom-left-radius: 0px !important;
+}
+
+.reading-list-years {
+ color: var(--input-placeholder-color);
+}
+
+.scroll-container {
+ display: flex;
+ flex-direction: row;
+ width: 100%;
+ height: calc((var(--vh) *100) - 173px);
+ margin-bottom: 10px;
+
+ &.empty {
+ height: auto;
+ }
}
\ No newline at end of file
diff --git a/UI/Web/src/app/reading-list/_components/reading-list-detail/reading-list-detail.component.ts b/UI/Web/src/app/reading-list/_components/reading-list-detail/reading-list-detail.component.ts
index bd6255945..7e50fcf1a 100644
--- a/UI/Web/src/app/reading-list/_components/reading-list-detail/reading-list-detail.component.ts
+++ b/UI/Web/src/app/reading-list/_components/reading-list-detail/reading-list-detail.component.ts
@@ -13,9 +13,10 @@ import { ActionService } from 'src/app/_services/action.service';
import { ImageService } from 'src/app/_services/image.service';
import { ReadingListService } from 'src/app/_services/reading-list.service';
import { IndexUpdateEvent } from '../draggable-ordered-list/draggable-ordered-list.component';
-import { forkJoin } from 'rxjs';
+import { forkJoin, Observable } from 'rxjs';
import { ReaderService } from 'src/app/_services/reader.service';
import { LibraryService } from 'src/app/_services/library.service';
+import { Person } from 'src/app/_models/metadata/person';
@Component({
selector: 'app-reading-list-detail',
@@ -40,6 +41,7 @@ export class ReadingListDetailComponent implements OnInit {
readingListImage: string = '';
libraryTypes: {[key: number]: LibraryType} = {};
+ characters$!: Observable<Person[]>;
get MangaFormat(): typeof MangaFormat {
return MangaFormat;
@@ -59,6 +61,7 @@ export class ReadingListDetailComponent implements OnInit {
return;
}
this.listId = parseInt(listId, 10);
+ this.characters$ = this.readingListService.getCharacters(this.listId);
this.readingListImage = this.imageService.randomize(this.imageService.getReadingListCoverImage(this.listId));
forkJoin([
@@ -115,11 +118,7 @@ export class ReadingListDetailComponent implements OnInit {
}
readChapter(item: ReadingListItem) {
- let reader = 'manga';
if (!this.readingList) return;
- if (item.seriesFormat === MangaFormat.EPUB) {
- reader = 'book;'
- }
const params = this.readerService.getQueryParamsObject(false, true, this.readingList.id);
this.router.navigate(this.readerService.getNavigationArray(item.libraryId, item.seriesId, item.chapterId, item.seriesFormat), {queryParams: params});
}
@@ -178,13 +177,15 @@ export class ReadingListDetailComponent implements OnInit {
});
}
- read() {
+ read(inconitoMode: boolean = false) {
if (!this.readingList) return;
const firstItem = this.items[0];
- this.router.navigate(this.readerService.getNavigationArray(firstItem.libraryId, firstItem.seriesId, firstItem.chapterId, firstItem.seriesFormat), {queryParams: {readingListId: this.readingList.id}});
+ this.router.navigate(
+ this.readerService.getNavigationArray(firstItem.libraryId, firstItem.seriesId, firstItem.chapterId, firstItem.seriesFormat),
+ {queryParams: {readingListId: this.readingList.id, inconitoMode: inconitoMode}});
}
- continue() {
+ continue(inconitoMode: boolean = false) {
// TODO: Can I do this in the backend?
if (!this.readingList) return;
let currentlyReadingChapter = this.items[0];
@@ -196,6 +197,13 @@ export class ReadingListDetailComponent implements OnInit {
break;
}
- this.router.navigate(this.readerService.getNavigationArray(currentlyReadingChapter.libraryId, currentlyReadingChapter.seriesId, currentlyReadingChapter.chapterId, currentlyReadingChapter.seriesFormat), {queryParams: {readingListId: this.readingList.id}});
+ this.router.navigate(
+ this.readerService.getNavigationArray(currentlyReadingChapter.libraryId, currentlyReadingChapter.seriesId, currentlyReadingChapter.chapterId, currentlyReadingChapter.seriesFormat),
+ {queryParams: {readingListId: this.readingList.id, inconitoMode: inconitoMode}});
+ }
+
+ updateAccesibilityMode() {
+ this.accessibilityMode = !this.accessibilityMode;
+ this.cdRef.markForCheck();
}
}
diff --git a/UI/Web/src/app/reading-list/_components/reading-list-item/reading-list-item.component.html b/UI/Web/src/app/reading-list/_components/reading-list-item/reading-list-item.component.html
index f6393b0f4..e83fc8bc9 100644
--- a/UI/Web/src/app/reading-list/_components/reading-list-item/reading-list-item.component.html
+++ b/UI/Web/src/app/reading-list/_components/reading-list-item/reading-list-item.component.html
@@ -1,10 +1,12 @@
<div class="d-flex flex-row g-0 mb-2">
<div class="pe-2">
<app-image width="106px" maxHeight="125px" class="img-top me-3" [imageUrl]="imageService.getChapterCoverImage(item.chapterId)"></app-image>
- <div class="not-read-badge" *ngIf="item.pagesRead === 0 && item.pagesTotal > 0"></div>
- <div class="progress-banner" *ngIf="item.pagesRead < item.pagesTotal && item.pagesTotal > 0 && item.pagesRead !== item.pagesTotal">
- <p><ngb-progressbar type="primary" height="5px" [value]="item.pagesRead" [max]="item.pagesTotal"></ngb-progressbar></p>
- </div>
+ <ng-container *ngIf="item.pagesRead === 0 && item.pagesTotal > 0">
+ <div class="not-read-badge" ></div>
+ </ng-container>
+ <div class="progress-banner" *ngIf="item.pagesRead < item.pagesTotal && item.pagesTotal > 0 && item.pagesRead !== item.pagesTotal">
+ <p><ngb-progressbar type="primary" height="5px" [value]="item.pagesRead" [max]="item.pagesTotal"></ngb-progressbar></p>
+ </div>
</div>
<div class="flex-grow-1">
@@ -12,18 +14,18 @@
<h5 class="mb-1 pb-0" id="item.id--{{position}}">
{{item.title}}
<div class="float-end">
- <button class="btn btn-primary" (click)="readChapter(item)">
+ <button class="btn btn-danger" (click)="remove.emit(item)">
+ <span>
+ <i class="fa fa-trash me-1" aria-hidden="true"></i>
+ </span>
+ <span class="d-none d-sm-inline-block">Remove</span>
+ </button>
+ <button class="btn btn-primary ms-2" (click)="readChapter(item)">
<span>
<i class="fa fa-book me-1" aria-hidden="true"></i>
</span>
<span class="d-none d-sm-inline-block">Read</span>
</button>
- <button class="btn btn-danger ms-2" (click)="remove.emit(item)">
- <span>
- <i class="fa fa-trash me-1" aria-hidden="true"></i>
- </span>
- <span class="d-none d-sm-inline-block">Remove</span>
- </button>
</div>
</h5>
@@ -36,8 +38,10 @@
<a href="/library/{{item.libraryId}}/series/{{item.seriesId}}">{{item.seriesName}}</a>
</div>
+ <!-- TODO: Let's add summary here-->
+
<div class="ps-1 mt-2" *ngIf="item.releaseDate !== '0001-01-01T00:00:00'">
- Released: {{item.releaseDate | date:'short'}}
+ Released: {{item.releaseDate | date:'longDate'}}
</div>
</div>
</div>
diff --git a/UI/Web/src/app/reading-list/_components/reading-list-item/reading-list-item.component.scss b/UI/Web/src/app/reading-list/_components/reading-list-item/reading-list-item.component.scss
index 297f9bb78..f2038b729 100644
--- a/UI/Web/src/app/reading-list/_components/reading-list-item/reading-list-item.component.scss
+++ b/UI/Web/src/app/reading-list/_components/reading-list-item/reading-list-item.component.scss
@@ -1,3 +1,5 @@
+$image-height: 125px;
+
.progress-banner {
height: 5px;
@@ -13,10 +15,20 @@
position: relative;
}
-.not-read-badge {
+.badge-container {
+ border-radius: 4px;
+ display: block;
+ height: $image-height;
+ overflow: hidden;
+ pointer-events: none;
position: absolute;
- top: 8px;
- left: 108px;
+ width: 106px;
+}
+
+.not-read-badge {
+ position: relative;
+ top: -125px;
+ left: 78px;
width: 0;
height: 0;
border-style: solid;
diff --git a/UI/Web/src/app/reading-list/_components/reading-lists/reading-lists.component.html b/UI/Web/src/app/reading-list/_components/reading-lists/reading-lists.component.html
index e3af78958..a796d1631 100644
--- a/UI/Web/src/app/reading-list/_components/reading-lists/reading-lists.component.html
+++ b/UI/Web/src/app/reading-list/_components/reading-lists/reading-lists.component.html
@@ -3,7 +3,7 @@
<app-card-actionables [actions]="globalActions" (actionHandler)="performGlobalAction($event)"></app-card-actionables>
<span>Reading Lists</span>
</h2>
- <h6 subtitle *ngIf="pagination">{{pagination.totalItems}} Items</h6>
+ <h6 subtitle class="subtitle-with-actionables" *ngIf="pagination">{{pagination.totalItems | number}} Items</h6>
</app-side-nav-companion-bar>
<app-card-detail-layout
diff --git a/UI/Web/src/app/reading-list/_components/reading-lists/reading-lists.component.ts b/UI/Web/src/app/reading-list/_components/reading-lists/reading-lists.component.ts
index c105121fc..f3440ede2 100644
--- a/UI/Web/src/app/reading-list/_components/reading-lists/reading-lists.component.ts
+++ b/UI/Web/src/app/reading-list/_components/reading-lists/reading-lists.component.ts
@@ -28,7 +28,7 @@ export class ReadingListsComponent implements OnInit {
isAdmin: boolean = false;
jumpbarKeys: Array<JumpKey> = [];
actions: {[key: number]: Array<ActionItem<ReadingList>>} = {};
- globalActions: Array<ActionItem<any>> = []; //[{action: Action.Import, title: 'Import CBL', children: [], requiresAdmin: true, callback: this.importCbl.bind(this)}]
+ globalActions: Array<ActionItem<any>> = [{action: Action.Import, title: 'Import CBL', children: [], requiresAdmin: true, callback: this.importCbl.bind(this)}];
constructor(private readingListService: ReadingListService, public imageService: ImageService, private actionFactoryService: ActionFactoryService,
private accountService: AccountService, private toastr: ToastrService, private router: Router, private actionService: ActionService,
@@ -63,6 +63,7 @@ export class ReadingListsComponent implements OnInit {
importCbl() {
const ref = this.ngbModal.open(ImportCblModalComponent, {size: 'xl'});
ref.closed.subscribe(result => this.loadPage());
+ ref.dismissed.subscribe(_ => this.loadPage());
}
handleReadingListActionCallback(action: ActionItem<ReadingList>, readingList: ReadingList) {
@@ -96,7 +97,7 @@ export class ReadingListsComponent implements OnInit {
this.loadingLists = true;
this.cdRef.markForCheck();
- this.readingListService.getReadingLists(true).pipe(take(1)).subscribe((readingLists: PaginatedResult<ReadingList[]>) => {
+ this.readingListService.getReadingLists(true, false).pipe(take(1)).subscribe((readingLists: PaginatedResult<ReadingList[]>) => {
this.lists = readingLists.result;
this.pagination = readingLists.pagination;
this.jumpbarKeys = this.jumpbarService.getJumpKeys(readingLists.result, (rl: ReadingList) => rl.title);
diff --git a/UI/Web/src/app/reading-list/_components/step-tracker/step-tracker.component.html b/UI/Web/src/app/reading-list/_components/step-tracker/step-tracker.component.html
new file mode 100644
index 000000000..8f3f10754
--- /dev/null
+++ b/UI/Web/src/app/reading-list/_components/step-tracker/step-tracker.component.html
@@ -0,0 +1,11 @@
+
+<div class="card card-timeline px-2 mb-3 border-none">
+ <ul class="bs4-order-tracking">
+ <ng-container *ngFor="let step of steps">
+ <li class="step" [ngClass]="{'active': step.index === currentStep}">
+ <div><i class="{{step.icon}}"></i></div>
+ {{step.title}}
+ </li>
+ </ng-container>
+ </ul>
+</div>
\ No newline at end of file
diff --git a/UI/Web/src/app/reading-list/_components/step-tracker/step-tracker.component.scss b/UI/Web/src/app/reading-list/_components/step-tracker/step-tracker.component.scss
new file mode 100644
index 000000000..6849760a6
--- /dev/null
+++ b/UI/Web/src/app/reading-list/_components/step-tracker/step-tracker.component.scss
@@ -0,0 +1,80 @@
+
+.bs4-order-tracking {
+ overflow: hidden;
+ color: #878788;
+ padding-left: 0px;
+ margin-top: 30px
+ }
+
+ .bs4-order-tracking li {
+ list-style-type: none;
+ font-size: 17px;
+ width: 25%;
+ float: left;
+ position: relative;
+ font-weight: 400;
+ color: #878788;
+ text-align: center
+ }
+
+ .bs4-order-tracking li:first-child:before {
+ margin-left: 15px !important;
+ padding-left: 11px !important;
+ text-align: left !important
+ }
+
+ .bs4-order-tracking li:last-child:before {
+ margin-right: 5px !important;
+ padding-right: 11px !important;
+ text-align: right !important
+ }
+
+ .bs4-order-tracking li>div {
+ color: #fff;
+ width: 50px;
+ text-align: center;
+ line-height: 50px;
+ display: block;
+ font-size: 20px;
+ background: #878788;
+ border-radius: 50%;
+ margin: auto
+ }
+
+ .bs4-order-tracking li:after {
+ content: '';
+ width: 150%;
+ height: 2px;
+ background: #878788;
+ position: absolute;
+ left: 0%;
+ right: 0%;
+ top: 25px;
+ z-index: -1
+ }
+
+ .bs4-order-tracking li:first-child:after {
+ left: 50%
+ }
+
+ .bs4-order-tracking li:last-child:after {
+ left: 0% !important;
+ width: 0% !important
+ }
+
+ .bs4-order-tracking li.active {
+ font-weight: bold;
+ color: var(--primary-color);
+ }
+
+ .bs4-order-tracking li.active>div {
+ background: var(--primary-color);
+ }
+
+ .bs4-order-tracking li.active:after {
+ background: var(--primary-color);
+ }
+
+ .card-timeline {
+ z-index: 0
+ }
diff --git a/UI/Web/src/app/reading-list/_components/step-tracker/step-tracker.component.ts b/UI/Web/src/app/reading-list/_components/step-tracker/step-tracker.component.ts
new file mode 100644
index 000000000..2581cc565
--- /dev/null
+++ b/UI/Web/src/app/reading-list/_components/step-tracker/step-tracker.component.ts
@@ -0,0 +1,26 @@
+import { Component, Input, ChangeDetectionStrategy, OnInit, ChangeDetectorRef } from '@angular/core';
+import { BehaviorSubject, ReplaySubject } from 'rxjs';
+
+
+export interface TimelineStep {
+ title: string;
+ active: boolean;
+ icon: string;
+ index: number;
+}
+
+
+@Component({
+ selector: 'app-step-tracker',
+ templateUrl: './step-tracker.component.html',
+ styleUrls: ['./step-tracker.component.scss'],
+ changeDetection: ChangeDetectionStrategy.OnPush
+})
+export class StepTrackerComponent {
+ @Input() steps: Array<TimelineStep> = [];
+ @Input() currentStep: number = 0;
+
+
+ constructor(private readonly cdRef: ChangeDetectorRef) {}
+
+}
diff --git a/UI/Web/src/app/reading-list/_modals/add-to-list-modal/add-to-list-modal.component.ts b/UI/Web/src/app/reading-list/_modals/add-to-list-modal/add-to-list-modal.component.ts
index fc8212d3e..af84420b9 100644
--- a/UI/Web/src/app/reading-list/_modals/add-to-list-modal/add-to-list-modal.component.ts
+++ b/UI/Web/src/app/reading-list/_modals/add-to-list-modal/add-to-list-modal.component.ts
@@ -73,7 +73,7 @@ export class AddToListModalComponent implements OnInit, AfterViewInit {
this.listForm.addControl('filterQuery', new FormControl('', []));
this.loading = true;
- this.readingListService.getReadingLists(false).subscribe(lists => {
+ this.readingListService.getReadingLists(false, true).subscribe(lists => {
this.lists = lists.result;
this.loading = false;
});
diff --git a/UI/Web/src/app/reading-list/_modals/edit-reading-list-modal/edit-reading-list-modal.component.html b/UI/Web/src/app/reading-list/_modals/edit-reading-list-modal/edit-reading-list-modal.component.html
index 7148693fa..d77d722a8 100644
--- a/UI/Web/src/app/reading-list/_modals/edit-reading-list-modal/edit-reading-list-modal.component.html
+++ b/UI/Web/src/app/reading-list/_modals/edit-reading-list-modal/edit-reading-list-modal.component.html
@@ -1,6 +1,6 @@
<div class="modal-header">
- <h4 class="modal-title" id="modal-basic-title">Edit {{readingList.title}} Reading List</h4>
+ <h4 class="modal-title" id="modal-basic-title">Edit Reading List: {{readingList.title}}</h4>
<button type="button" class="btn-close" aria-label="Close" (click)="close()"></button>
</div>
<div class="modal-body scrollable-modal {{utilityService.getActiveBreakpoint() === Breakpoint.Mobile ? '' : 'd-flex'}}">
@@ -36,6 +36,60 @@
</div>
</ng-container>
</div>
+
+ <div class="row g-0 mb-3">
+ <div class="col-md-6 col-sm-12">
+ <h6 id="starting-year-header">Starting</h6>
+ <div class="col-md-6 col-sm-12" *ngIf="reviewGroup.get('startingMonth') as formControl" style="width: 90%">
+ <label for="start-month" class="form-label">Month</label>
+ <input id="start-month" class="form-control" formControlName="startingMonth"
+ type="number" inputmode="numeric" [class.is-invalid]="formControl?.invalid && formControl?.touched"
+ aria-describedby="starting-year-header">
+ <div id="inviteForm-validations" class="invalid-feedback" *ngIf="reviewGroup.dirty || reviewGroup.touched">
+ <div *ngIf="formControl.errors?.min || formControl.errors?.max">
+ Must be between 1 and 12 or blank
+ </div>
+ </div>
+ </div>
+ <div class="col-md-6 col-sm-12" *ngIf="reviewGroup.get('startingYear') as formControl" style="width: 90%">
+ <label for="start-year" class="form-label">Year</label>
+ <input id="start-year" class="form-control" formControlName="startingYear" type="number" inputmode="numeric"
+ [class.is-invalid]="formControl.invalid && formControl.touched"
+ aria-describedby="starting-year-header">
+ <div id="inviteForm-validations" class="invalid-feedback" *ngIf="reviewGroup.dirty || reviewGroup.touched">
+ <div *ngIf="formControl.errors?.min || formControl.errors?.max">
+ Must be greater than 1000, 0 or blank
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <div class="col-md-6 col-sm-12">
+ <h6 id="ending-year-heading">Ending</h6>
+ <div class="col-md-6 col-sm-12" *ngIf="reviewGroup.get('endingMonth') as formControl" style="width: 90%">
+ <label for="library-name" class="form-label">Month</label>
+ <input id="library-name" class="form-control" formControlName="endingMonth" type="number" inputmode="numeric"
+ [class.is-invalid]="formControl?.invalid && formControl?.touched"
+ aria-describedby="ending-year-header">
+ <div id="inviteForm-validations" class="invalid-feedback" *ngIf="reviewGroup.dirty || reviewGroup.touched">
+ <div *ngIf="formControl.errors?.min || formControl.errors?.max">
+ Must be between 1 and 12 or blank
+ </div>
+ </div>
+ </div>
+ <div class="col-md-6 col-sm-12" *ngIf="reviewGroup.get('endingYear') as formControl" style="width: 90%">
+ <label for="library-name" class="form-label">Year</label>
+ <input id="library-name" class="form-control" formControlName="endingYear" type="number" inputmode="numeric"
+ [class.is-invalid]="formControl?.invalid && formControl?.touched"
+ aria-describedby="ending-year-header">
+ <div id="inviteForm-validations" class="invalid-feedback" *ngIf="reviewGroup.dirty || reviewGroup.touched">
+ <div *ngIf="formControl.errors?.min || formControl.errors?.max">
+ Must be greater than 1000, 0 or blank
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
<div class="row g-0 mb-3">
<label for="summary" class="form-label">Summary</label>
@@ -55,7 +109,7 @@
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" (click)="close()">Close</button>
- <button type="submit" class="btn btn-primary" [disabled]="!reviewGroup.valid" (click)="save()">Save</button>
+ <button type="submit" class="btn btn-primary" (click)="save()">Save</button>
</div>
diff --git a/UI/Web/src/app/reading-list/_modals/edit-reading-list-modal/edit-reading-list-modal.component.ts b/UI/Web/src/app/reading-list/_modals/edit-reading-list-modal/edit-reading-list-modal.component.ts
index 6b12f2bcc..f7b0f2252 100644
--- a/UI/Web/src/app/reading-list/_modals/edit-reading-list-modal/edit-reading-list-modal.component.ts
+++ b/UI/Web/src/app/reading-list/_modals/edit-reading-list-modal/edit-reading-list-modal.component.ts
@@ -49,8 +49,14 @@ export class EditReadingListModalComponent implements OnInit, OnDestroy {
title: new FormControl(this.readingList.title, { nonNullable: true, validators: [Validators.required] }),
summary: new FormControl(this.readingList.summary, { nonNullable: true, validators: [] }),
promoted: new FormControl(this.readingList.promoted, { nonNullable: true, validators: [] }),
+ startingMonth: new FormControl(this.readingList.startingMonth, { nonNullable: true, validators: [Validators.min(1), Validators.max(12)] }),
+ startingYear: new FormControl(this.readingList.startingYear, { nonNullable: true, validators: [Validators.min(1000)] }),
+ endingMonth: new FormControl(this.readingList.endingMonth, { nonNullable: true, validators: [Validators.min(1), Validators.max(12)] }),
+ endingYear: new FormControl(this.readingList.endingYear, { nonNullable: true, validators: [Validators.min(1000)] }),
});
+ this.coverImageLocked = this.readingList.coverImageLocked;
+
this.reviewGroup.get('title')?.valueChanges.pipe(
debounceTime(100),
distinctUntilChanged(),
@@ -68,6 +74,13 @@ export class EditReadingListModalComponent implements OnInit, OnDestroy {
).subscribe();
this.imageUrls.push(this.imageService.randomize(this.imageService.getReadingListCoverImage(this.readingList.id)));
+ if (!this.readingList.items || this.readingList.items.length === 0) {
+ this.readingListService.getListItems(this.readingList.id).subscribe(items => {
+ this.imageUrls.push(...(items).map(rli => this.imageService.getChapterCoverImage(rli.chapterId)));
+ });
+ } else {
+ this.imageUrls.push(...(this.readingList.items).map(rli => this.imageService.getChapterCoverImage(rli.chapterId)));
+ }
}
ngOnDestroy() {
@@ -83,6 +96,10 @@ export class EditReadingListModalComponent implements OnInit, OnDestroy {
if (this.reviewGroup.value.title.trim() === '') return;
const model = {...this.reviewGroup.value, readingListId: this.readingList.id, coverImageLocked: this.coverImageLocked};
+ model.startingMonth = model.startingMonth || 0;
+ model.startingYear = model.startingYear || 0;
+ model.endingMonth = model.endingMonth || 0;
+ model.endingYear = model.endingYear || 0;
const apis = [this.readingListService.update(model)];
if (this.selectedCover !== '') {
@@ -101,6 +118,8 @@ export class EditReadingListModalComponent implements OnInit, OnDestroy {
updateSelectedIndex(index: number) {
this.coverImageIndex = index;
+ console.log(this.coverImageIndex)
+ this.cdRef.detectChanges();
}
updateSelectedImage(url: string) {
diff --git a/UI/Web/src/app/reading-list/_modals/import-cbl-modal/import-cbl-modal.component.html b/UI/Web/src/app/reading-list/_modals/import-cbl-modal/import-cbl-modal.component.html
index 9599def22..ac392d645 100644
--- a/UI/Web/src/app/reading-list/_modals/import-cbl-modal/import-cbl-modal.component.html
+++ b/UI/Web/src/app/reading-list/_modals/import-cbl-modal/import-cbl-modal.component.html
@@ -1,55 +1,126 @@
<div class="modal-header">
- <h4 class="modal-title" id="modal-basic-title">CBL Import: {{currentStep.title}}</h4>
+ <h4 class="modal-title" id="modal-basic-title">CBL Import</h4>
<button type="button" class="btn-close" aria-label="Close" (click)="close()"></button>
</div>
-<div class="modal-body scrollable-modal {{utilityService.getActiveBreakpoint() === Breakpoint.Mobile ? '' : 'd-flex'}}">
-
- <div class="row g-0" *ngIf="currentStep.index === 0">
- <p>Import a .cbl file as a reading list</p>
- <form [formGroup]="uploadForm" enctype="multipart/form-data">
- <file-upload formControlName="files"></file-upload>
- </form>
+<div class="modal-body scrollable-modal">
+ <div class="row g-0" style="min-width: 135px;">
+ <app-step-tracker [steps]="steps" [currentStep]="currentStepIndex"></app-step-tracker>
</div>
-
- <ng-container *ngIf="currentStep.index === 1">
- <div class="row g-0">
- <ng-container *ngIf="validateSummary; else noValidateIssues">
- <h5>There are issues with the CBL that will prevent an import. Correct these issues then try again.</h5>
- <ol class="list-group list-group-flush" >
- <li class="list-group-item no-hover" *ngFor="let result of validateSummary.results">
- {{result | cblConflictReason}}
- </li>
- </ol>
- </ng-container>
- <ng-template #noValidateIssues>No issues found with CBL, press next.</ng-template>
- </div>
- </ng-container>
-
- <ng-container *ngIf="currentStep.index === 2 && dryRunSummary">
- <div class="row g-0">
- <h5>This is a dry run and shows what will happen if you press Next</h5>
- <h6>The import was a {{dryRunSummary.success}}</h6>
- <ul class="list-group list-group-flush" *ngIf="dryRunSummary">
- <li class="list-group-item no-hover" *ngFor="let result of dryRunSummary.results">
- {{result | cblConflictReason}}
- </li>
- </ul>
- <ul class="list-group list-group-flush" *ngIf="dryRunSummary">
- <li class="list-group-item no-hover" *ngFor="let result of dryRunSummary.successfulInserts">
- {{result | cblConflictReason}}
- </li>
- </ul>
+
+ <!-- This is going to need to have a fixed height with a scrollbar-->
+ <div>
+ <div class="row g-0" *ngIf="currentStepIndex === Step.Import">
+ <p>To get started, import a .cbl file. Kavita will perform multiple checks before importing. Some steps will block moving forward due to issues with the file.</p>
+ <form [formGroup]="uploadForm" enctype="multipart/form-data">
+ <file-upload formControlName="files"></file-upload>
+ </form>
</div>
- </ng-container>
+
+ <ng-container *ngIf="currentStepIndex === Step.Validate">
+ <p>All files have been validated to see if there are any operations to do on the list. Any lists have have failed will not move to the next step. Fix the CBL files and retry.</p>
+ <div class="row g-0">
+
+ <ngb-accordion #a="ngbAccordion">
+ <ngb-panel *ngFor="let fileToProcess of filesToProcess">
+ <ng-container *ngIf="fileToProcess.validateSummary as summary">
+ <ng-template ngbPanelTitle>
+ <ng-container [ngTemplateOutlet]="heading" [ngTemplateOutletContext]="{ summary: summary, filename: fileToProcess.fileName }"></ng-container>
+ </ng-template>
+
+ <ng-template ngbPanelContent>
+ <ng-container *ngIf="summary.results.length > 0; else noValidateIssues">
+ <h5>There are issues with the CBL that will prevent an import. Correct these issues then try again.</h5>
+ <ol class="list-group list-group-numbered list-group-flush" >
+ <li class="list-group-item no-hover" *ngFor="let result of summary.results"
+ [innerHTML]="result | cblConflictReason | safeHtml">
+ </li>
+ </ol>
+ </ng-container>
+ <ng-template #noValidateIssues>
+ <div class="justify-content-center col">
+ <div class="d-flex align-items-center">
+ <div class="flex-shrink-0">
+ <i class="fa-solid fa-circle-check" style="font-size: 24px" aria-hidden="true"></i>
+ </div>
+ <div class="flex-grow-1 ms-3">
+ Looks good
+ </div>
+ </div>
+ No issues found with CBL, press next.
+ </div>
+ </ng-template>
+ </ng-template>
+ </ng-container>
+ </ngb-panel>
+ </ngb-accordion>
+ </div>
+ </ng-container>
+
+ <ng-container *ngIf="currentStepIndex === Step.DryRun">
+ <div class="row g-0">
+ <p>This is a dry run and shows what will happen if you press Next and perform the import. All Failures will not be imported.</p>
+ <ngb-accordion #a="ngbAccordion">
+ <ngb-panel *ngFor="let fileToProcess of filesToProcess">
+ <ng-container *ngIf="fileToProcess.dryRunSummary as summary">
+ <ng-template ngbPanelTitle>
+ <ng-container [ngTemplateOutlet]="heading" [ngTemplateOutletContext]="{ summary: summary, filename: fileToProcess.fileName }"></ng-container>
+ </ng-template>
+
+ <ng-template ngbPanelContent>
+ <ng-container [ngTemplateOutlet]="resultsList" [ngTemplateOutletContext]="{ summary: summary }"></ng-container>
+ </ng-template>
+ </ng-container>
+ </ngb-panel>
+ </ngb-accordion>
+ </div>
+ </ng-container>
+
+ <ng-container *ngIf="currentStepIndex === Step.Finalize">
+ <div class="row g-0">
+ <ngb-accordion #a="ngbAccordion">
+ <ngb-panel *ngFor="let fileToProcess of filesToProcess">
+ <ng-container *ngIf="fileToProcess.finalizeSummary as summary">
+ <ng-template ngbPanelTitle>
+ <ng-container [ngTemplateOutlet]="heading" [ngTemplateOutletContext]="{ summary: summary, filename: fileToProcess.fileName }"></ng-container>
+ </ng-template>
+
+ <ng-template ngbPanelContent>
+ <ng-container [ngTemplateOutlet]="resultsList" [ngTemplateOutletContext]="{ summary: summary }"></ng-container>
+ </ng-template>
+ </ng-container>
+ </ngb-panel>
+ </ngb-accordion>
+ </div>
+ </ng-container>
+ </div>
+
+ <ng-template #resultsList let-summary="summary">
+ <ul class="list-group list-group-flush">
+ <li class="list-group-item no-hover" *ngFor="let result of summary.results"
+ innerHTML="{{result.order + 1}}. {{result | cblConflictReason | safeHtml}}"></li>
+ </ul>
+ </ng-template>
+
+ <ng-template #heading let-filename="filename" let-summary="summary">
+ <ng-container *ngIf="summary.success | cblImportResult as success">
+ <ng-container [ngSwitch]="summary.success">
+ <span *ngSwitchCase="CblImportResult.Success" class="badge bg-primary me-1">{{success}}</span>
+ <span *ngSwitchCase="CblImportResult.Fail" class="badge bg-danger me-1">{{success}}</span>
+ <span *ngSwitchCase="CblImportResult.Partial" class="badge bg-warning me-1">{{success}}</span>
+ </ng-container>
+ </ng-container>
+ <span>{{filename}}<span *ngIf="summary.cblName">: ({{summary.cblName}})</span></span>
+ </ng-template>
</div>
<div class="modal-footer">
<a class="btn btn-icon" href="https://wiki.kavitareader.com/en/guides/get-started-using-your-library/reading-lists#creating-a-reading-list-via-cbl" target="_blank" rel="noopener noreferrer">Help</a>
<button type="button" class="btn btn-secondary" (click)="close()">Close</button>
- <button type="button" class="btn btn-primary" (click)="nextStep()" [disabled]="!canMoveToNextStep()">Next</button>
+ <button type="button" class="btn btn-primary" (click)="prevStep()" [disabled]="!canMoveToPrevStep()">Prev</button>
+ <button type="button" class="btn btn-primary" (click)="nextStep()" [disabled]="!canMoveToNextStep()">{{NextButtonLabel}}</button>
</div>
diff --git a/UI/Web/src/app/reading-list/_modals/import-cbl-modal/import-cbl-modal.component.scss b/UI/Web/src/app/reading-list/_modals/import-cbl-modal/import-cbl-modal.component.scss
index b9a1733a7..8d2d93ff5 100644
--- a/UI/Web/src/app/reading-list/_modals/import-cbl-modal/import-cbl-modal.component.scss
+++ b/UI/Web/src/app/reading-list/_modals/import-cbl-modal/import-cbl-modal.component.scss
@@ -1,3 +1,41 @@
.file-input {
- display: none;
- }
\ No newline at end of file
+ display: none;
+}
+
+::ng-deep .file-info {
+ width: 83%;
+ float: left;
+}
+
+::ng-deep .file-buttons {
+ float: right;
+}
+
+file-upload {
+ background: none;
+ height: auto;
+}
+
+::ng-deep .upload-input {
+ color: var(--input-text-color) !important;
+}
+
+::ng-deep file-upload-list-item {
+ color: var(--input-text-color) !important;
+}
+
+::ng-deep .remove-btn {
+ background: #C0392B;
+ border-radius: 3px;
+ color: var(--input-text-color) !important;
+ font-weight: bold;
+ padding: 3px 5px;
+}
+
+::ng-deep .reading-list-success--item {
+ color: var(--primary-color);
+}
+
+::ng-deep .reading-list-fail--item {
+ color: var(--error-color);
+}
\ No newline at end of file
diff --git a/UI/Web/src/app/reading-list/_modals/import-cbl-modal/import-cbl-modal.component.ts b/UI/Web/src/app/reading-list/_modals/import-cbl-modal/import-cbl-modal.component.ts
index d3981c5d3..1777f4373 100644
--- a/UI/Web/src/app/reading-list/_modals/import-cbl-modal/import-cbl-modal.component.ts
+++ b/UI/Web/src/app/reading-list/_modals/import-cbl-modal/import-cbl-modal.component.ts
@@ -2,9 +2,20 @@ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, View
import { FormControl, FormGroup } from '@angular/forms';
import { FileUploadValidators } from '@iplab/ngx-file-upload';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
+import { ToastrService } from 'ngx-toastr';
+import { forkJoin } from 'rxjs';
import { Breakpoint, UtilityService } from 'src/app/shared/_services/utility.service';
+import { CblImportResult } from 'src/app/_models/reading-list/cbl/cbl-import-result.enum';
import { CblImportSummary } from 'src/app/_models/reading-list/cbl/cbl-import-summary';
import { ReadingListService } from 'src/app/_services/reading-list.service';
+import { TimelineStep } from '../../_components/step-tracker/step-tracker.component';
+
+interface FileStep {
+ fileName: string;
+ validateSummary: CblImportSummary | undefined;
+ dryRunSummary: CblImportSummary | undefined;
+ finalizeSummary: CblImportSummary | undefined;
+}
enum Step {
Import = 0,
@@ -24,7 +35,6 @@ export class ImportCblModalComponent {
@ViewChild('fileUpload') fileUpload!: ElementRef<HTMLInputElement>;
fileUploadControl = new FormControl<undefined | Array<File>>(undefined, [
- FileUploadValidators.filesLimit(1),
FileUploadValidators.accept(['.cbl']),
]);
@@ -32,108 +42,193 @@ export class ImportCblModalComponent {
files: this.fileUploadControl
});
- importSummaries: Array<CblImportSummary> = [];
- validateSummary: CblImportSummary | undefined;
- dryRunSummary: CblImportSummary | undefined;
+ isLoading: boolean = false;
- steps = [
- {title: 'Import CBL', index: Step.Import},
- {title: 'Validate File', index: Step.Validate},
- {title: 'Dry Run', index: Step.DryRun},
- {title: 'Final Import', index: Step.Finalize},
+ steps: Array<TimelineStep> = [
+ {title: 'Import CBLs', index: Step.Import, active: true, icon: 'fa-solid fa-file-arrow-up'},
+ {title: 'Validate CBL', index: Step.Validate, active: false, icon: 'fa-solid fa-spell-check'},
+ {title: 'Dry Run', index: Step.DryRun, active: false, icon: 'fa-solid fa-gears'},
+ {title: 'Final Import', index: Step.Finalize, active: false, icon: 'fa-solid fa-floppy-disk'},
];
- currentStep = this.steps[0];
+ currentStepIndex = this.steps[0].index;
+
+ filesToProcess: Array<FileStep> = [];
+ failedFiles: Array<FileStep> = [];
get Breakpoint() { return Breakpoint; }
get Step() { return Step; }
+ get CblImportResult() { return CblImportResult; }
+
+ get FileCount() {
+ const files = this.uploadForm.get('files')?.value;
+ if (!files) return 0;
+ return files.length;
+ }
+
+ get NextButtonLabel() {
+ switch(this.currentStepIndex) {
+ case Step.DryRun:
+ return 'Import';
+ case Step.Finalize:
+ return 'Restart'
+ default:
+ return 'Next';
+ }
+ }
constructor(private ngModal: NgbActiveModal, private readingListService: ReadingListService,
- public utilityService: UtilityService, private readonly cdRef: ChangeDetectorRef) {}
+ public utilityService: UtilityService, private readonly cdRef: ChangeDetectorRef,
+ private toastr: ToastrService) {}
close() {
this.ngModal.close();
}
nextStep() {
+ if (this.currentStepIndex === Step.Import && !this.isFileSelected()) return;
+ //if (this.currentStepIndex === Step.Validate && this.validateSummary && this.validateSummary.results.length > 0) return;
- if (this.currentStep.index >= Step.Finalize) return;
- if (this.currentStep.index === Step.Import && !this.isFileSelected()) return;
- if (this.currentStep.index === Step.Validate && this.validateSummary && this.validateSummary.results.length > 0) return;
-
- switch (this.currentStep.index) {
+ this.isLoading = true;
+ switch (this.currentStepIndex) {
case Step.Import:
- this.importFile();
+ const files = this.uploadForm.get('files')?.value;
+ if (!files) {
+ this.toastr.error('You need to select files to move forward');
+ return;
+ }
+ // Load each file into filesToProcess and group their data
+ let pages = [];
+ for (let i = 0; i < files.length; i++) {
+ const formData = new FormData();
+ formData.append('cbl', files[i]);
+ formData.append('dryRun', true + '');
+ pages.push(this.readingListService.validateCbl(formData));
+ }
+ forkJoin(pages).subscribe(results => {
+ this.filesToProcess = [];
+ results.forEach(cblImport => {
+ this.filesToProcess.push({
+ fileName: cblImport.fileName,
+ validateSummary: cblImport,
+ dryRunSummary: undefined,
+ finalizeSummary: undefined
+ });
+ });
+
+ this.filesToProcess = this.filesToProcess.sort((a, b) => b.validateSummary!.success - a.validateSummary!.success);
+
+ this.currentStepIndex++;
+ this.isLoading = false;
+ this.cdRef.markForCheck();
+ });
break;
case Step.Validate:
+ this.failedFiles = this.filesToProcess.filter(item => item.validateSummary?.success === CblImportResult.Fail);
+ this.filesToProcess = this.filesToProcess.filter(item => item.validateSummary?.success != CblImportResult.Fail);
+ this.dryRun();
break;
case Step.DryRun:
+ this.failedFiles.push(...this.filesToProcess.filter(item => item.dryRunSummary?.success === CblImportResult.Fail));
+ this.filesToProcess = this.filesToProcess.filter(item => item.dryRunSummary?.success != CblImportResult.Fail);
+ this.import();
break;
case Step.Finalize:
// Clear the models and allow user to do another import
+ this.uploadForm.get('files')?.setValue(undefined);
+ this.currentStepIndex = Step.Import;
+ this.isLoading = false;
+ this.filesToProcess = [];
+ this.failedFiles = [];
+ this.cdRef.markForCheck();
break;
}
}
+ prevStep() {
+ if (this.currentStepIndex === Step.Import) return;
+ this.currentStepIndex--;
+ }
+
canMoveToNextStep() {
- switch (this.currentStep.index) {
+ switch (this.currentStepIndex) {
case Step.Import:
return this.isFileSelected();
case Step.Validate:
- return this.validateSummary && this.validateSummary.results.length > 0;
+ return this.filesToProcess.filter(item => item.validateSummary?.success != CblImportResult.Fail).length > 0;
case Step.DryRun:
- return true;
+ return this.filesToProcess.filter(item => item.dryRunSummary?.success != CblImportResult.Fail).length > 0;
case Step.Finalize:
return true;
+ default:
+ return false;
}
}
+ canMoveToPrevStep() {
+ switch (this.currentStepIndex) {
+ case Step.Import:
+ case Step.Finalize:
+ return false;
+ default:
+ return true;
+ }
+ }
+
+
isFileSelected() {
const files = this.uploadForm.get('files')?.value;
if (files) return files.length > 0;
return false;
}
- importFile() {
- const files = this.uploadForm.get('files')?.value;
- if (!files) return;
-
- const formData = new FormData();
- formData.append('cbl', files[0]);
- formData.append('dryRun', (this.currentStep.index !== Step.Finalize) + '');
- this.readingListService.importCbl(formData).subscribe(res => {
- console.log('Result: ', res);
- if (this.currentStep.index === Step.Import) {
- this.validateSummary = res;
- }
- if (this.currentStep.index === Step.DryRun) {
- this.dryRunSummary = res;
- }
- this.importSummaries.push(res);
- this.currentStep.index++;
- this.cdRef.markForCheck();
- });
- }
-
- // onFileSelected(event: any) {
- // console.log('event: ', event);
- // if (!(event.target as HTMLInputElement).files === null || (event.target as HTMLInputElement).files?.length === 0) return;
- // const file = (event.target as HTMLInputElement).files![0];
+ dryRun() {
- // if (file) {
+ const filenamesAllowedToProcess = this.filesToProcess.map(p => p.fileName);
+ const files = (this.uploadForm.get('files')?.value || []).filter(f => filenamesAllowedToProcess.includes(f.name));
- // //this.fileName = file.name;
-
- // const formData = new FormData();
+ let pages = [];
+ for (let i = 0; i < files.length; i++) {
+ const formData = new FormData();
+ formData.append('cbl', files[i]);
+ formData.append('dryRun', 'true');
+ pages.push(this.readingListService.importCbl(formData));
+ }
+ forkJoin(pages).subscribe(results => {
+ results.forEach(cblImport => {
+ const index = this.filesToProcess.findIndex(p => p.fileName === cblImport.fileName);
+ this.filesToProcess[index].dryRunSummary = cblImport;
+ });
+ this.filesToProcess = this.filesToProcess.sort((a, b) => b.dryRunSummary!.success - a.dryRunSummary!.success);
+
+ this.isLoading = false;
+ this.currentStepIndex++;
+ this.cdRef.markForCheck();
+ });
+ }
- // formData.append("cbl", file);
+ import() {
+ const filenamesAllowedToProcess = this.filesToProcess.map(p => p.fileName);
+ const files = (this.uploadForm.get('files')?.value || []).filter(f => filenamesAllowedToProcess.includes(f.name));
- // this.readingListService.importCbl(formData).subscribe(res => {
- // this.importSummaries.push(res);
- // this.cdRef.markForCheck();
- // });
- // this.fileUpload.value = '';
- // }
- // }
+ let pages = [];
+ for (let i = 0; i < files.length; i++) {
+ const formData = new FormData();
+ formData.append('cbl', files[i]);
+ formData.append('dryRun', 'false');
+ pages.push(this.readingListService.importCbl(formData));
+ }
+ forkJoin(pages).subscribe(results => {
+ results.forEach(cblImport => {
+ const index = this.filesToProcess.findIndex(p => p.fileName === cblImport.fileName);
+ this.filesToProcess[index].finalizeSummary = cblImport;
+ });
+
+ this.isLoading = false;
+ this.currentStepIndex++;
+ this.toastr.success('Reading List imported');
+ this.cdRef.markForCheck();
+ });
+ }
}
diff --git a/UI/Web/src/app/reading-list/_pipes/cbl-conflict-reason.pipe.ts b/UI/Web/src/app/reading-list/_pipes/cbl-conflict-reason.pipe.ts
index b48cd6ea4..92517c544 100644
--- a/UI/Web/src/app/reading-list/_pipes/cbl-conflict-reason.pipe.ts
+++ b/UI/Web/src/app/reading-list/_pipes/cbl-conflict-reason.pipe.ts
@@ -2,31 +2,36 @@ import { Pipe, PipeTransform } from '@angular/core';
import { CblBookResult } from 'src/app/_models/reading-list/cbl/cbl-book-result';
import { CblImportReason } from 'src/app/_models/reading-list/cbl/cbl-import-reason.enum';
+const failIcon = '<i aria-hidden="true" class="reading-list-fail--item fa-solid fa-circle-xmark me-1"></i>';
+const successIcon = '<i aria-hidden="true" class="reading-list-success--item fa-solid fa-circle-check me-1"></i>';
+
@Pipe({
name: 'cblConflictReason'
})
export class CblConflictReasonPipe implements PipeTransform {
transform(result: CblBookResult): string {
- if (result.reason === undefined)
- return result.series + ' volume ' + result.volume + ' number ' + result.number + ' mapped successfully';
switch (result.reason) {
case CblImportReason.AllSeriesMissing:
- return 'Your account is missing access to all series in the list or Kavita does not have anything present in the list.';
+ return failIcon + 'Your account is missing access to all series in the list or Kavita does not have anything present in the list.';
case CblImportReason.ChapterMissing:
- return 'Chapter ' + result.number + ' is missing from Kavita. This item will be skipped.';
+ return failIcon + result.series + ': ' + 'Chapter ' + result.number + ' is missing from Kavita. This item will be skipped.';
case CblImportReason.EmptyFile:
- return 'The Cbl file is empty, nothing to be done.';
+ return failIcon + 'The cbl file is empty, nothing to be done.';
case CblImportReason.NameConflict:
- return 'A reading list already exists on your account that matches the Cbl file.';
+ return failIcon + 'A reading list (' + result.readingListName + ') already exists on your account that matches the cbl file.';
case CblImportReason.SeriesCollision:
- return 'The series, ' + result.series + ', collides with another series of the same name in another library.';
+ return failIcon + 'The series, ' + `<a href="/library/${result.libraryId}/series/${result.seriesId}" target="_blank">${result.series}</a>` + ', collides with another series of the same name in another library.';
case CblImportReason.SeriesMissing:
- return 'The series, ' + result.series + ', is missing from Kavita or your account does not have permission. All items with this series will be skipped from import.';
+ return failIcon + 'The series, ' + result.series + ', is missing from Kavita or your account does not have permission. All items with this series will be skipped from import.';
case CblImportReason.VolumeMissing:
- return 'Volume ' + result.volume + ' is missing from Kavita. All items with this volume number will be skipped.';
+ return failIcon + result.series + ': ' + 'Volume ' + result.volume + ' is missing from Kavita. All items with this volume number will be skipped.';
case CblImportReason.AllChapterMissing:
- return 'All chapters cannot be matched to Chapters in Kavita.';
+ return failIcon + 'All chapters cannot be matched to Chapters in Kavita.';
+ case CblImportReason.Success:
+ return successIcon + result.series + ' volume ' + result.volume + ' number ' + result.number + ' mapped successfully.';
+ case CblImportReason.InvalidFile:
+ return failIcon + 'The file is corrupted or not matching the expected tags/spec.';
}
}
diff --git a/UI/Web/src/app/reading-list/_pipes/cbl-import-result.pipe.ts b/UI/Web/src/app/reading-list/_pipes/cbl-import-result.pipe.ts
new file mode 100644
index 000000000..fef49d805
--- /dev/null
+++ b/UI/Web/src/app/reading-list/_pipes/cbl-import-result.pipe.ts
@@ -0,0 +1,19 @@
+import { Pipe, PipeTransform } from '@angular/core';
+import { CblImportResult } from 'src/app/_models/reading-list/cbl/cbl-import-result.enum';
+
+@Pipe({
+ name: 'cblImportResult'
+})
+export class CblImportResultPipe implements PipeTransform {
+
+ transform(result: CblImportResult): string {
+ switch (result) {
+ case CblImportResult.Success:
+ return 'Success';
+ case CblImportResult.Partial:
+ return 'Partial';
+ case CblImportResult.Fail:
+ return 'Failure';
+ }
+ }
+}
diff --git a/UI/Web/src/app/reading-list/reading-list.module.ts b/UI/Web/src/app/reading-list/reading-list.module.ts
index 679281e24..778d8b111 100644
--- a/UI/Web/src/app/reading-list/reading-list.module.ts
+++ b/UI/Web/src/app/reading-list/reading-list.module.ts
@@ -8,7 +8,7 @@ import { ReactiveFormsModule } from '@angular/forms';
import { EditReadingListModalComponent } from './_modals/edit-reading-list-modal/edit-reading-list-modal.component';
import { PipeModule } from '../pipe/pipe.module';
import { SharedModule } from '../shared/shared.module';
-import { NgbAccordionModule, NgbNavModule, NgbProgressbarModule, NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap';
+import { NgbAccordionModule, NgbDropdownModule, NgbNavModule, NgbProgressbarModule, NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap';
import { SharedSideNavCardsModule } from '../shared-side-nav-cards/shared-side-nav-cards.module';
import { ReadingListDetailComponent } from './_components/reading-list-detail/reading-list-detail.component';
import { ReadingListItemComponent } from './_components/reading-list-item/reading-list-item.component';
@@ -16,7 +16,9 @@ import { ReadingListsComponent } from './_components/reading-lists/reading-lists
import { ImportCblModalComponent } from './_modals/import-cbl-modal/import-cbl-modal.component';
import { FileUploadModule } from '@iplab/ngx-file-upload';
import { CblConflictReasonPipe } from './_pipes/cbl-conflict-reason.pipe';
-
+import { StepTrackerComponent } from './_components/step-tracker/step-tracker.component';
+import { CblImportResultPipe } from './_pipes/cbl-import-result.pipe';
+import { VirtualScrollerModule } from '@iharbeck/ngx-virtual-scroller';
@NgModule({
declarations: [
@@ -28,6 +30,8 @@ import { CblConflictReasonPipe } from './_pipes/cbl-conflict-reason.pipe';
ReadingListItemComponent,
ImportCblModalComponent,
CblConflictReasonPipe,
+ StepTrackerComponent,
+ CblImportResultPipe,
],
imports: [
CommonModule,
@@ -36,6 +40,7 @@ import { CblConflictReasonPipe } from './_pipes/cbl-conflict-reason.pipe';
NgbNavModule,
NgbProgressbarModule,
NgbTooltipModule,
+ NgbDropdownModule,
PipeModule,
SharedModule,
@@ -44,6 +49,7 @@ import { CblConflictReasonPipe } from './_pipes/cbl-conflict-reason.pipe';
ReadingListRoutingModule,
NgbAccordionModule, // Import CBL
FileUploadModule, // Import CBL
+ VirtualScrollerModule,
],
exports: [
AddToListModalComponent,
diff --git a/UI/Web/src/app/registration/_components/confirm-email/confirm-email.component.html b/UI/Web/src/app/registration/_components/confirm-email/confirm-email.component.html
index fc56639d9..ac8ff8a43 100644
--- a/UI/Web/src/app/registration/_components/confirm-email/confirm-email.component.html
+++ b/UI/Web/src/app/registration/_components/confirm-email/confirm-email.component.html
@@ -23,7 +23,7 @@
<div class="mb-3" style="width:100%">
<label for="email" class="form-label">Email</label>
- <input class="form-control" type="email" id="email" formControlName="email" required readonly
+ <input class="form-control" type="email" inputmode="email" id="email" formControlName="email" required readonly
[class.is-invalid]="registerForm.get('email')?.invalid && registerForm.get('email')?.touched">
<div id="inviteForm-validations" class="invalid-feedback" *ngIf="registerForm.dirty || registerForm.touched">
<div *ngIf="registerForm.get('email')?.errors?.required">
@@ -41,12 +41,12 @@
Password must be between 6 and 32 characters in length
</ng-template>
<span class="visually-hidden" id="password-help"><ng-container [ngTemplateOutlet]="passwordTooltip"></ng-container></span>
- <input id="password" class="form-control" maxlength="32" minlength="6" formControlName="password" type="password" aria-describedby="password-help">
+ <input id="password" class="form-control" maxlength="32" minlength="6" pattern="^.{6,32}$" formControlName="password" type="password" aria-describedby="password-help">
<div id="inviteForm-validations" class="invalid-feedback" *ngIf="registerForm.dirty || registerForm.touched">
<div *ngIf="registerForm.get('password')?.errors?.required">
This field is required
</div>
- <div *ngIf="registerForm.get('password')?.errors?.minlength || registerForm.get('password')?.errors?.maxLength">
+ <div *ngIf="registerForm.get('password')?.errors?.minlength || registerForm.get('password')?.errors?.maxLength || registerForm.get('password')?.errors?.pattern">
Password must be between 6 and 32 characters in length
</div>
</div>
diff --git a/UI/Web/src/app/registration/_components/confirm-email/confirm-email.component.ts b/UI/Web/src/app/registration/_components/confirm-email/confirm-email.component.ts
index 99e355a69..d32fc8b68 100644
--- a/UI/Web/src/app/registration/_components/confirm-email/confirm-email.component.ts
+++ b/UI/Web/src/app/registration/_components/confirm-email/confirm-email.component.ts
@@ -19,9 +19,9 @@ export class ConfirmEmailComponent {
token: string = '';
registerForm: FormGroup = new FormGroup({
- email: new FormControl('', [Validators.required, Validators.email]),
+ email: new FormControl('', [Validators.required]),
username: new FormControl('', [Validators.required]),
- password: new FormControl('', [Validators.required, Validators.maxLength(32), Validators.minLength(6)]),
+ password: new FormControl('', [Validators.required, Validators.maxLength(32), Validators.minLength(6), Validators.pattern("^.{6,32}$")]),
});
/**
diff --git a/UI/Web/src/app/registration/_components/register/register.component.html b/UI/Web/src/app/registration/_components/register/register.component.html
index a828634fd..bd68668b2 100644
--- a/UI/Web/src/app/registration/_components/register/register.component.html
+++ b/UI/Web/src/app/registration/_components/register/register.component.html
@@ -20,7 +20,7 @@
<span class="visually-hidden" id="email-help">
<ng-container [ngTemplateOutlet]="emailTooltip"></ng-container>
</span>
- <input class="form-control" type="email" id="email" formControlName="email" required aria-describedby="email-help"
+ <input class="form-control" type="email" inputmode="email" id="email" formControlName="email" required aria-describedby="email-help"
[class.is-invalid]="registerForm.get('email')?.invalid && registerForm.get('email')?.touched">
<div id="inviteForm-validations" class="invalid-feedback" *ngIf="registerForm.dirty || registerForm.touched">
<div *ngIf="registerForm.get('email')?.errors?.required">
@@ -38,20 +38,20 @@
Password must be between 6 and 32 characters in length
</ng-template>
<span class="visually-hidden" id="password-help"><ng-container [ngTemplateOutlet]="passwordTooltip"></ng-container></span>
- <input id="password" class="form-control" maxlength="32" minlength="6" formControlName="password"
+ <input id="password" class="form-control" maxlength="32" minlength="6" pattern="^.{6,32}$" formControlName="password"
type="password" aria-describedby="password-help" [class.is-invalid]="registerForm.get('password')?.invalid && registerForm.get('password')?.touched">
<div id="inviteForm-validations" class="invalid-feedback" *ngIf="registerForm.dirty || registerForm.touched">
<div *ngIf="registerForm.get('password')?.errors?.required">
This field is required
</div>
- <div *ngIf="registerForm.get('password')?.errors?.minlength || registerForm.get('password')?.errors?.maxLength">
+ <div *ngIf="registerForm.get('password')?.errors?.minlength || registerForm.get('password')?.errors?.maxLength || registerForm.get('password')?.errors?.pattern">
Password must be between 6 and 32 characters in length
</div>
</div>
</div>
<div class="float-end">
- <button class="btn btn-secondary alt" type="submit">Register</button>
+ <button class="btn btn-secondary alt" type="submit" [disabled]="!registerForm.valid">Register</button>
</div>
</form>
</ng-container>
diff --git a/UI/Web/src/app/registration/_components/register/register.component.ts b/UI/Web/src/app/registration/_components/register/register.component.ts
index d6d19d168..84c1b0410 100644
--- a/UI/Web/src/app/registration/_components/register/register.component.ts
+++ b/UI/Web/src/app/registration/_components/register/register.component.ts
@@ -18,9 +18,9 @@ import { MemberService } from 'src/app/_services/member.service';
export class RegisterComponent {
registerForm: FormGroup = new FormGroup({
- email: new FormControl('', [Validators.email]),
+ email: new FormControl('', [Validators.required]),
username: new FormControl('', [Validators.required]),
- password: new FormControl('', [Validators.required, Validators.maxLength(32), Validators.minLength(6)]),
+ password: new FormControl('', [Validators.required, Validators.maxLength(32), Validators.minLength(6), Validators.pattern("^.{6,32}$")]),
});
constructor(private router: Router, private accountService: AccountService,
diff --git a/UI/Web/src/app/registration/_components/reset-password/reset-password.component.html b/UI/Web/src/app/registration/_components/reset-password/reset-password.component.html
index 2ef13e63e..53937b11c 100644
--- a/UI/Web/src/app/registration/_components/reset-password/reset-password.component.html
+++ b/UI/Web/src/app/registration/_components/reset-password/reset-password.component.html
@@ -5,7 +5,7 @@
<form [formGroup]="registerForm" (ngSubmit)="submit()">
<div class="mb-3" style="width:100%">
<label for="email" class="form-label">Email</label>
- <input class="form-control custom-input" type="email" id="email" formControlName="email" [class.is-invalid]="registerForm.get('email')?.invalid && registerForm.get('email')?.touched">
+ <input class="form-control custom-input" type="email" inputmode="email" id="email" formControlName="email" [class.is-invalid]="registerForm.get('email')?.invalid && registerForm.get('email')?.touched">
<div id="inviteForm-validations" class="invalid-feedback" *ngIf="registerForm.dirty || registerForm.touched">
<div *ngIf="registerForm.get('email')?.errors?.required">
This field is required
diff --git a/UI/Web/src/app/registration/_modals/add-email-to-account-migration-modal/add-email-to-account-migration-modal.component.html b/UI/Web/src/app/registration/_modals/add-email-to-account-migration-modal/add-email-to-account-migration-modal.component.html
index 948716c53..780a42c98 100644
--- a/UI/Web/src/app/registration/_modals/add-email-to-account-migration-modal/add-email-to-account-migration-modal.component.html
+++ b/UI/Web/src/app/registration/_modals/add-email-to-account-migration-modal/add-email-to-account-migration-modal.component.html
@@ -24,7 +24,7 @@
<div class="mb-3" style="width:100%">
<label for="email" class="form-label">Email</label>
- <input class="form-control" type="email" id="email" formControlName="email" [class.is-invalid]="registerForm.get('email')?.invalid && registerForm.get('email')?.touched">
+ <input class="form-control" type="email" inputmode="email" id="email" formControlName="email" [class.is-invalid]="registerForm.get('email')?.invalid && registerForm.get('email')?.touched">
<div id="inviteForm-validations" class="invalid-feedback" *ngIf="registerForm.dirty || registerForm.touched">
<div *ngIf="registerForm.get('email')?.errors?.required">
This field is required
diff --git a/UI/Web/src/app/registration/user-login/user-login.component.html b/UI/Web/src/app/registration/user-login/user-login.component.html
index 93354e7dc..f8d2f85f5 100644
--- a/UI/Web/src/app/registration/user-login/user-login.component.html
+++ b/UI/Web/src/app/registration/user-login/user-login.component.html
@@ -9,9 +9,15 @@
<input class="form-control custom-input" formControlName="username" id="username" type="text" autofocus placeholder="Username">
</div>
- <div class="mb-3">
+ <div class="mb-2">
<label for="password" class="form-label visually-hidden">Password</label>
- <input class="form-control custom-input" formControlName="password" id="password" type="password" placeholder="Password">
+ <input class="form-control custom-input" formControlName="password" name="password"
+ id="password" type="password" pattern="^.{6,32}$" placeholder="Password">
+ <div id="inviteForm-validations" class="invalid-feedback" *ngIf="loginForm.get('password')?.errors?.pattern" >
+ <div class="" *ngIf="loginForm.get('password')?.errors?.pattern">
+ Password must be between 6 and 32 characters in length
+ </div>
+ </div>
</div>
<div class="mb-3">
diff --git a/UI/Web/src/app/registration/user-login/user-login.component.ts b/UI/Web/src/app/registration/user-login/user-login.component.ts
index 585cf2935..4e23efa53 100644
--- a/UI/Web/src/app/registration/user-login/user-login.component.ts
+++ b/UI/Web/src/app/registration/user-login/user-login.component.ts
@@ -22,7 +22,7 @@ export class UserLoginComponent implements OnInit {
//model: any = {username: '', password: ''};
loginForm: FormGroup = new FormGroup({
username: new FormControl('', [Validators.required]),
- password: new FormControl('', [Validators.required])
+ password: new FormControl('', [Validators.required, Validators.maxLength(32), Validators.minLength(6), Validators.pattern("^.{6,32}$")])
});
/**
diff --git a/UI/Web/src/app/series-detail/_components/series-detail/series-detail.component.html b/UI/Web/src/app/series-detail/_components/series-detail/series-detail.component.html
index 0fa0cf33f..e919489ac 100644
--- a/UI/Web/src/app/series-detail/_components/series-detail/series-detail.component.html
+++ b/UI/Web/src/app/series-detail/_components/series-detail/series-detail.component.html
@@ -63,6 +63,9 @@
<app-tag-badge [selectionMode]="TagBadgeCursor.NotAllowed" fillStyle="filled">{{unreadCount}}</app-tag-badge>
</div>
<app-image height="100%" maxHeight="400px" objectFit="contain" background="none" [imageUrl]="seriesImage"></app-image>
+ <div class="progress-banner" *ngIf="series.pagesRead < series.pages && hasReadingProgress && currentlyReadingChapter && !currentlyReadingChapter.isSpecial">
+ <ngb-progressbar type="primary" height="5px" [value]="series.pagesRead" [max]="series.pages"></ngb-progressbar>
+ </div>
<div class="under-image" *ngIf="series.pagesRead < series.pages && hasReadingProgress && currentlyReadingChapter && !currentlyReadingChapter.isSpecial">
Continue {{ContinuePointTitle}}
</div>
@@ -70,13 +73,29 @@
<div class="col-xlg-10 col-lg-8 col-md-8 col-xs-8 col-sm-6 mt-2">
<div class="row g-0">
<div class="col-auto">
- <button class="btn btn-primary" (click)="read()">
- <span>
- <i class="fa {{showBook ? 'fa-book-open' : 'fa-book'}} me-1"></i>
- </span>
- <span class="d-none d-sm-inline-block">{{(hasReadingProgress) ? 'Continue' : 'Read'}}</span>
- </button>
+ <div class="btn-group">
+ <button type="button" class="btn btn-primary" (click)="read()">
+ <span>
+ <i class="fa {{showBook ? 'fa-book-open' : 'fa-book'}}" aria-hidden="true"></i>
+ <span class="read-btn--text">&nbsp;{{(hasReadingProgress) ? 'Continue' : 'Read'}}</span>
+ </span>
+ </button>
+ <div class="btn-group" ngbDropdown role="group" display="dynamic" aria-label="Read options">
+ <button type="button" class="btn btn-primary dropdown-toggle-split" ngbDropdownToggle></button>
+ <div class="dropdown-menu" ngbDropdownMenu>
+ <button ngbDropdownItem (click)="read(true)">
+ <span>
+ <i class="fa fa-glasses" aria-hidden="true"></i>
+ <span class="read-btn--text">&nbsp;{{(hasReadingProgress) ? 'Continue' : 'Read'}} Incognito</span>
+ </span>
+ </button>
+
+ </div>
+ </div>
+ </div>
+
</div>
+
<div class="col-auto ms-2">
<button class="btn btn-secondary" (click)="toggleWantToRead()" title="{{isWantToRead ? 'Remove from' : 'Add to'}} Want to Read">
<span>
diff --git a/UI/Web/src/app/series-detail/_components/series-detail/series-detail.component.scss b/UI/Web/src/app/series-detail/_components/series-detail/series-detail.component.scss
index 039d42757..d652cf937 100644
--- a/UI/Web/src/app/series-detail/_components/series-detail/series-detail.component.scss
+++ b/UI/Web/src/app/series-detail/_components/series-detail/series-detail.component.scss
@@ -53,3 +53,14 @@
.info-container {
align-items: flex-start;
}
+
+::ng-deep .progress {
+ border-radius: 0px;
+}
+
+.dropdown-toggle-split {
+ border-top-right-radius: 6px !important;
+ border-bottom-right-radius: 6px !important;
+ border-top-left-radius: 0px !important;
+ border-bottom-left-radius: 0px !important;
+}
\ No newline at end of file
diff --git a/UI/Web/src/app/series-detail/_components/series-detail/series-detail.component.ts b/UI/Web/src/app/series-detail/_components/series-detail/series-detail.component.ts
index 0da5f8472..f4107f278 100644
--- a/UI/Web/src/app/series-detail/_components/series-detail/series-detail.component.ts
+++ b/UI/Web/src/app/series-detail/_components/series-detail/series-detail.component.ts
@@ -654,14 +654,14 @@ export class SeriesDetailComponent implements OnInit, OnDestroy, AfterContentChe
});
}
- read() {
+ read(incognitoMode: boolean = false) {
if (this.currentlyReadingChapter !== undefined) {
- this.openChapter(this.currentlyReadingChapter);
+ this.openChapter(this.currentlyReadingChapter, incognitoMode);
return;
}
this.readerService.getCurrentChapter(this.seriesId).subscribe(chapter => {
- this.openChapter(chapter);
+ this.openChapter(chapter, incognitoMode);
});
}
diff --git a/UI/Web/src/app/series-detail/series-detail.module.ts b/UI/Web/src/app/series-detail/series-detail.module.ts
index 2ecaf7344..5c127c0d2 100644
--- a/UI/Web/src/app/series-detail/series-detail.module.ts
+++ b/UI/Web/src/app/series-detail/series-detail.module.ts
@@ -1,7 +1,7 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { SeriesDetailRoutingModule } from './series-detail-routing.module';
-import { NgbCollapseModule, NgbNavModule, NgbRatingModule, NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap';
+import { NgbCollapseModule, NgbDropdownModule, NgbNavModule, NgbProgressbarModule, NgbRatingModule, NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap';
import { SeriesMetadataDetailComponent } from './_components/series-metadata-detail/series-metadata-detail.component';
import { ReviewSeriesModalComponent } from './_modals/review-series-modal/review-series-modal.component';
import { SharedModule } from '../shared/shared.module';
@@ -26,6 +26,8 @@ import { SeriesDetailComponent } from './_components/series-detail/series-detail
NgbNavModule,
NgbRatingModule,
NgbTooltipModule, // Series Detail, Extras Drawer
+ NgbProgressbarModule,
+ NgbDropdownModule,
TypeaheadModule,
PipeModule,
diff --git a/UI/Web/src/app/shared/_services/download.service.ts b/UI/Web/src/app/shared/_services/download.service.ts
index 65724520b..d935b2228 100644
--- a/UI/Web/src/app/shared/_services/download.service.ts
+++ b/UI/Web/src/app/shared/_services/download.service.ts
@@ -5,7 +5,6 @@ import { environment } from 'src/environments/environment';
import { ConfirmService } from '../confirm.service';
import { Chapter } from 'src/app/_models/chapter';
import { Volume } from 'src/app/_models/volume';
-import { ToastrService } from 'ngx-toastr';
import { asyncScheduler, BehaviorSubject, Observable, tap, finalize, of, filter } from 'rxjs';
import { SAVER, Saver } from '../_providers/saver.provider';
import { download, Download } from '../_models/download';
@@ -57,8 +56,7 @@ export class DownloadService {
public activeDownloads$ = this.downloadsSource.asObservable();
constructor(private httpClient: HttpClient, private confirmService: ConfirmService,
- private toastr: ToastrService, @Inject(SAVER) private save: Saver,
- private accountService: AccountService) { }
+ @Inject(SAVER) private save: Saver, private accountService: AccountService) { }
/**
* Returns the entity subtitle (for the event widget) for a given entity
diff --git a/UI/Web/src/app/shared/_services/utility.service.ts b/UI/Web/src/app/shared/_services/utility.service.ts
index a2660f141..845629612 100644
--- a/UI/Web/src/app/shared/_services/utility.service.ts
+++ b/UI/Web/src/app/shared/_services/utility.service.ts
@@ -92,11 +92,17 @@ export class UtilityService {
}
filter(input: string, filter: string): boolean {
- if (input === null || filter === null) return false;
+ if (input === null || filter === null || input === undefined || filter === undefined) return false;
const reg = /[_\.\-]/gi;
return input.toUpperCase().replace(reg, '').includes(filter.toUpperCase().replace(reg, ''));
}
+ filterMatches(input: string, filter: string): boolean {
+ if (input === null || filter === null || input === undefined || filter === undefined) return false;
+ const reg = /[_\.\-]/gi;
+ return input.toUpperCase().replace(reg, '') === filter.toUpperCase().replace(reg, '');
+ }
+
isVolume(d: any) {
return d != null && d.hasOwnProperty('chapters');
}
diff --git a/UI/Web/src/app/shared/circular-loader/circular-loader.component.scss b/UI/Web/src/app/shared/circular-loader/circular-loader.component.scss
index 817949cd8..98817f4f2 100644
--- a/UI/Web/src/app/shared/circular-loader/circular-loader.component.scss
+++ b/UI/Web/src/app/shared/circular-loader/circular-loader.component.scss
@@ -1,7 +1,7 @@
.number {
position: absolute;
top: 50%;
- left: 50%;
+ left: 46%;
font-size: 18px;
}
diff --git a/UI/Web/src/app/shared/circular-loader/circular-loader.component.ts b/UI/Web/src/app/shared/circular-loader/circular-loader.component.ts
index 9e630b608..1a3681080 100644
--- a/UI/Web/src/app/shared/circular-loader/circular-loader.component.ts
+++ b/UI/Web/src/app/shared/circular-loader/circular-loader.component.ts
@@ -34,7 +34,7 @@ export class CircularLoaderComponent {
/**
* The height in pixels of the loader
*/
- @Input() height: string = '100px';
+ @Input() height: string = '100px';
/**
* Centers the icon in the middle of the loader. Best for card use.
*/
diff --git a/UI/Web/src/app/sidenav/_components/side-nav-item/side-nav-item.component.html b/UI/Web/src/app/sidenav/_components/side-nav-item/side-nav-item.component.html
index 04d1d45b7..32eef8876 100644
--- a/UI/Web/src/app/sidenav/_components/side-nav-item/side-nav-item.component.html
+++ b/UI/Web/src/app/sidenav/_components/side-nav-item/side-nav-item.component.html
@@ -5,9 +5,17 @@
</ng-container>
<ng-template #useLink>
- <a class="side-nav-item" href="javascript:void(0);" [ngClass]="{'closed': (navService.sideNavCollapsed$ | async), 'active': highlighted}" [routerLink]="link">
- <ng-container [ngTemplateOutlet]="inner"></ng-container>
- </a>
+ <ng-container *ngIf="external; else internal">
+ <a class="side-nav-item" [href]="link" [ngClass]="{'closed': (navService.sideNavCollapsed$ | async), 'active': highlighted}" rel="noopener noreferrer" target="_blank">
+ <ng-container [ngTemplateOutlet]="inner"></ng-container>
+ </a>
+ </ng-container>
+ <ng-template #internal>
+ <a class="side-nav-item" href="javascript:void(0);" [ngClass]="{'closed': (navService.sideNavCollapsed$ | async), 'active': highlighted}" [routerLink]="link">
+ <ng-container [ngTemplateOutlet]="inner"></ng-container>
+ </a>
+ </ng-template>
+
</ng-template>
diff --git a/UI/Web/src/app/sidenav/_components/side-nav-item/side-nav-item.component.scss b/UI/Web/src/app/sidenav/_components/side-nav-item/side-nav-item.component.scss
index ec41533f5..d62f8e526 100644
--- a/UI/Web/src/app/sidenav/_components/side-nav-item/side-nav-item.component.scss
+++ b/UI/Web/src/app/sidenav/_components/side-nav-item/side-nav-item.component.scss
@@ -27,6 +27,8 @@
span {
+ display:flex;
+
&:last-child {
flex-grow: 1;
justify-content: end;
diff --git a/UI/Web/src/app/sidenav/_components/side-nav-item/side-nav-item.component.ts b/UI/Web/src/app/sidenav/_components/side-nav-item/side-nav-item.component.ts
index a93c2fb49..62c66ab6c 100644
--- a/UI/Web/src/app/sidenav/_components/side-nav-item/side-nav-item.component.ts
+++ b/UI/Web/src/app/sidenav/_components/side-nav-item/side-nav-item.component.ts
@@ -25,6 +25,10 @@ export class SideNavItemComponent implements OnInit, OnDestroy {
* If a link should be generated when clicked. By default (undefined), no link will be generated
*/
@Input() link: string | undefined;
+ /**
+ * If external, link will be used as full href and rel will be applied
+ */
+ @Input() external: boolean = false;
@Input() comparisonMethod: 'startsWith' | 'equals' = 'equals';
diff --git a/UI/Web/src/app/sidenav/_components/side-nav/side-nav.component.html b/UI/Web/src/app/sidenav/_components/side-nav/side-nav.component.html
index b3bef6a15..c7c7f05c8 100644
--- a/UI/Web/src/app/sidenav/_components/side-nav/side-nav.component.html
+++ b/UI/Web/src/app/sidenav/_components/side-nav/side-nav.component.html
@@ -10,7 +10,11 @@
<app-side-nav-item icon="fa-home" title="Home" link="/libraries/"></app-side-nav-item>
<app-side-nav-item icon="fa-star" title="Want To Read" link="/want-to-read/"></app-side-nav-item>
<app-side-nav-item icon="fa-list" title="Collections" link="/collections/"></app-side-nav-item>
- <app-side-nav-item icon="fa-list-ol" title="Reading Lists" link="/lists/"></app-side-nav-item>
+ <app-side-nav-item icon="fa-list-ol" title="Reading Lists" link="/lists/">
+ <ng-container actions>
+ <app-card-actionables [actions]="readingListActions" labelBy="Reading Lists" iconClass="fa-ellipsis-v" (actionHandler)="importCbl()"></app-card-actionables>
+ </ng-container>
+ </app-side-nav-item>
<app-side-nav-item icon="fa-bookmark" title="Bookmarks" link="/bookmarks/"></app-side-nav-item>
<app-side-nav-item icon="fa-regular fa-rectangle-list" title="All Series" link="/all-series/" *ngIf="libraries.length > 0"></app-side-nav-item>
<div class="mb-2 mt-3 ms-2 me-2" *ngIf="libraries.length > 10 && (navService?.sideNavCollapsed$ | async) === false">
@@ -28,4 +32,7 @@
</app-side-nav-item>
</div>
<div class="side-nav-overlay" (click)="toggleNavBar()" [ngClass]="{'closed' : (navService.sideNavCollapsed$ | async)}"></div>
+ <div class="bottom" [ngClass]="{'closed' : (navService.sideNavCollapsed$ | async), 'hidden': (navService.sideNavVisibility$ | async) === false}">
+ <app-side-nav-item [ngClass]="'donate'" icon="fa-heart" title="Donate" link="https://opencollective.com/kavita" [external]="true"></app-side-nav-item>
+ </div>
</ng-container>
\ No newline at end of file
diff --git a/UI/Web/src/app/sidenav/_components/side-nav/side-nav.component.scss b/UI/Web/src/app/sidenav/_components/side-nav/side-nav.component.scss
index 69fb59652..2ebfde18a 100644
--- a/UI/Web/src/app/sidenav/_components/side-nav/side-nav.component.scss
+++ b/UI/Web/src/app/sidenav/_components/side-nav/side-nav.component.scss
@@ -1,8 +1,68 @@
+.bottom {
+ position: absolute;
+ bottom: 12px;
+ width: 190px;
+ background: var(--navbar-bg-color);
+ border-radius: var(--side-nav-border-radius);
+ font-size: 12px;
+ transition: width var(--side-nav-openclose-transition);
+ z-index: 999;
+
+ &.closed {
+ width: 50px;
+ overflow-x: hidden;
+ overflow-y: auto;
+ }
+}
+
+:host ::ng-deep .bottom .donate .side-nav-item {
+ justify-content: center;
+ min-height: 25px;
+ align-items: center;
+
+ :hover {
+ background-color: unset;
+ }
+ }
+
+:host ::ng-deep .bottom .donate .side-nav-item span {
+ flex-grow: unset !important;
+ min-width: unset !important;;
+}
+
+:host ::ng-deep .bottom .donate .side-nav-item span div {
+ min-width: unset !important;
+}
+
+:host ::ng-deep .bottom .donate .side-nav-item span div i{
+ font-size: 12px !important;
+}
+
+
+
+:host ::ng-deep .bottom .donate .side-nav-item.closed span.phone-hidden div {
+ width: 100%;
+}
+
+:host ::ng-deep .bottom .donate .side-nav-item.closed span.side-nav-text div {
+ width: 0;
+}
+
+@media (max-width: 576px) {
+ :host ::ng-deep .bottom .donate .side-nav-item.closed {
+ display: none;
+ }
+
+ :host ::ng-deep .bottom .donate .side-nav-item span.phone-hidden {
+ display: block !important;
+ }
+}
+
.side-nav {
padding-bottom: 10px;
width: 190px;
background-color: var(--side-nav-bg-color);
- height: calc((var(--vh)*100) - 85px);
+ height: calc((var(--vh)*100) - 115px);
position: fixed;
margin: 0;
left: 10px;
@@ -36,7 +96,7 @@
padding: 10px 0;
width: 55vw;
background-color: var(--side-nav-mobile-bg-color);
- height: calc((var(--vh)*100) - 56px);
+ height: calc((var(--vh)*100) - 125px);
position: fixed;
margin: 0;
left: 0;
diff --git a/UI/Web/src/app/sidenav/_components/side-nav/side-nav.component.ts b/UI/Web/src/app/sidenav/_components/side-nav/side-nav.component.ts
index d3c29f8ef..096b9724b 100644
--- a/UI/Web/src/app/sidenav/_components/side-nav/side-nav.component.ts
+++ b/UI/Web/src/app/sidenav/_components/side-nav/side-nav.component.ts
@@ -3,6 +3,8 @@ import { NavigationEnd, Router } from '@angular/router';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { Subject } from 'rxjs';
import { filter, map, shareReplay, take, takeUntil } from 'rxjs/operators';
+import { ImportCblModalComponent } from 'src/app/reading-list/_modals/import-cbl-modal/import-cbl-modal.component';
+import { ReadingList } from 'src/app/_models/reading-list';
import { ImageService } from 'src/app/_services/image.service';
import { EVENTS, MessageHubService } from 'src/app/_services/message-hub.service';
import { Breakpoint, UtilityService } from '../../../shared/_services/utility.service';
@@ -23,6 +25,7 @@ export class SideNavComponent implements OnInit, OnDestroy {
libraries: Library[] = [];
actions: ActionItem<Library>[] = [];
+ readingListActions = [{action: Action.Import, title: 'Import CBL', children: [], requiresAdmin: true, callback: this.importCbl.bind(this)}];
filterQuery: string = '';
filterLibrary = (library: Library) => {
@@ -36,7 +39,7 @@ export class SideNavComponent implements OnInit, OnDestroy {
public utilityService: UtilityService, private messageHub: MessageHubService,
private actionFactoryService: ActionFactoryService, private actionService: ActionService,
public navService: NavService, private router: Router, private readonly cdRef: ChangeDetectorRef,
- private modalService: NgbModal, private imageService: ImageService) {
+ private ngbModal: NgbModal, private imageService: ImageService) {
this.router.events.pipe(
filter(event => event instanceof NavigationEnd),
@@ -97,6 +100,9 @@ export class SideNavComponent implements OnInit, OnDestroy {
}
}
+ importCbl() {
+ const ref = this.ngbModal.open(ImportCblModalComponent, {size: 'xl'});
+ }
performAction(action: ActionItem<Library>, library: Library) {
if (typeof action.callback === 'function') {
diff --git a/UI/Web/src/app/sidenav/_modals/library-settings-modal/library-settings-modal.component.html b/UI/Web/src/app/sidenav/_modals/library-settings-modal/library-settings-modal.component.html
index 236652626..ded5d9ea6 100644
--- a/UI/Web/src/app/sidenav/_modals/library-settings-modal/library-settings-modal.component.html
+++ b/UI/Web/src/app/sidenav/_modals/library-settings-modal/library-settings-modal.component.html
@@ -11,9 +11,9 @@
</div>
<form [formGroup]="libraryForm">
<div class="modal-body scrollable-modal {{utilityService.getActiveBreakpoint() === Breakpoint.Mobile ? '' : 'd-flex'}}">
- <ul ngbNav #nav="ngbNav" [(activeId)]="active" class="nav-pills"
+ <ul ngbNav #nav="ngbNav" [(activeId)]="active" class="nav-pills"
orientation="{{utilityService.getActiveBreakpoint() === Breakpoint.Mobile ? 'horizontal' : 'vertical'}}" style="min-width: 135px;">
-
+
<li [ngbNavItem]="TabID.General">
<a ngbNavLink>{{TabID.General}}</a>
<ng-template ngbNavContent>
@@ -39,7 +39,7 @@
</select>
</div>
<div *ngIf="!isAddLibrary">
- Last Scanned:
+ Last Scanned:
<span *ngIf="library.lastScanned === '0001-01-01T00:00:00'; else activeDate">Never</span>
<ng-template #activeDate>
{{library.lastScanned | date: 'short'}}
@@ -79,7 +79,7 @@
<ng-template ngbNavContent>
<p *ngIf="isAddLibrary" class="alert alert-secondary" role="alert">Custom library image icons are optional</p>
<p>Library image should not be large. Aim for a small file, 32x32 pixels in size. Kavita does not perform validation on size.</p>
- <app-cover-image-chooser [(imageUrls)]="imageUrls"
+ <app-cover-image-chooser [(imageUrls)]="imageUrls"
[showReset]="false"
[showApplyButton]="true"
(applyCover)="applyCoverImage($event)"
@@ -96,16 +96,30 @@
<div class="col-md-12 col-sm-12 pe-2 mb-2">
<div class="mb-3 mt-1">
<div class="form-check form-switch">
- <input type="checkbox" id="manage-collections" role="switch" formControlName="manageCollections" class="form-check-input" aria-labelledby="auto-close-label">
+ <input type="checkbox" id="manage-collections" role="switch" formControlName="manageCollections" class="form-check-input">
<label class="form-check-label" for="manage-collections">Manage Collections</label>
</div>
</div>
<p class="accent">
- Should Kavita create and update Collections from SeriesGroup tags found within ComicInfo.xml files
+ Should Kavita create Collections from SeriesGroup tags found within ComicInfo.xml files
</p>
</div>
</div>
+ <div class="row">
+ <div class="col-md-12 col-sm-12 pe-2 mb-2">
+ <div class="mb-3 mt-1">
+ <div class="form-check form-switch">
+ <input type="checkbox" id="manage-readinglists" role="switch" formControlName="manageReadingLists" class="form-check-input">
+ <label class="form-check-label" for="manage-readinglists">Manage Reading Lists</label>
+ </div>
+ </div>
+ <p class="accent">
+ Should Kavita create Reading Lists from StoryArc/StoryArcNumber and AlternativeSeries/AlternativeCount tags found within ComicInfo.xml files
+ </p>
+ </div>
+ </div>
+
<div class="row">
<div class="col-md-12 col-sm-12 pe-2 mb-2">
<div class="mb-3 mt-1">
@@ -169,7 +183,7 @@
<button type="button" class="btn btn-light" (click)="forceScan()" position="above" ngbTooltip="This will force a scan on the library, treating like a fresh scan">Force Scan</button>
<button type="button" class="btn btn-light" (click)="reset()">Reset</button>
<button type="button" class="btn btn-secondary" (click)="close()">Cancel</button>
-
+
<ng-container *ngIf="isAddLibrary && setupStep !== 3; else editLibraryButton">
<button type="button" class="btn btn-primary" (click)="nextStep()" [disabled]="isNextDisabled() || libraryForm.invalid">Next</button>
</ng-container>
diff --git a/UI/Web/src/app/sidenav/_modals/library-settings-modal/library-settings-modal.component.ts b/UI/Web/src/app/sidenav/_modals/library-settings-modal/library-settings-modal.component.ts
index af9099ce2..9cafc2118 100644
--- a/UI/Web/src/app/sidenav/_modals/library-settings-modal/library-settings-modal.component.ts
+++ b/UI/Web/src/app/sidenav/_modals/library-settings-modal/library-settings-modal.component.ts
@@ -47,12 +47,14 @@ export class LibrarySettingsModalComponent implements OnInit, OnDestroy {
includeInRecommended: new FormControl<boolean>(true, { nonNullable: true, validators: [Validators.required] }),
includeInSearch: new FormControl<boolean>(true, { nonNullable: true, validators: [Validators.required] }),
manageCollections: new FormControl<boolean>(true, { nonNullable: true, validators: [Validators.required] }),
+ manageReadingLists: new FormControl<boolean>(true, { nonNullable: true, validators: [Validators.required] }),
+ collapseSeriesRelationships: new FormControl<boolean>(false, { nonNullable: true, validators: [Validators.required] }),
});
selectedFolders: string[] = [];
madeChanges = false;
libraryTypes: string[] = []
-
+
isAddLibrary = false;
setupStep = StepID.General;
private readonly onDestroy = new Subject<void>();
@@ -62,7 +64,7 @@ export class LibrarySettingsModalComponent implements OnInit, OnDestroy {
get StepID() { return StepID; }
constructor(public utilityService: UtilityService, private uploadService: UploadService, private modalService: NgbModal,
- private settingService: SettingsService, public modal: NgbActiveModal, private confirmService: ConfirmService,
+ private settingService: SettingsService, public modal: NgbActiveModal, private confirmService: ConfirmService,
private libraryService: LibraryService, private toastr: ToastrService, private readonly cdRef: ChangeDetectorRef,
private imageService: ImageService) { }
@@ -85,7 +87,7 @@ export class LibrarySettingsModalComponent implements OnInit, OnDestroy {
}
this.libraryForm.get('name')?.valueChanges.pipe(
- debounceTime(100),
+ debounceTime(100),
distinctUntilChanged(),
switchMap(name => this.libraryService.libraryNameExists(name)),
tap(exists => {
@@ -93,7 +95,7 @@ export class LibrarySettingsModalComponent implements OnInit, OnDestroy {
if (!exists || isExistingName) {
this.libraryForm.get('name')?.setErrors(null);
} else {
- this.libraryForm.get('name')?.setErrors({duplicateName: true})
+ this.libraryForm.get('name')?.setErrors({duplicateName: true})
}
this.cdRef.markForCheck();
}),
@@ -108,7 +110,7 @@ export class LibrarySettingsModalComponent implements OnInit, OnDestroy {
this.onDestroy.next();
this.onDestroy.complete();
}
-
+
setValues() {
if (this.library !== undefined) {
@@ -119,6 +121,8 @@ export class LibrarySettingsModalComponent implements OnInit, OnDestroy {
this.libraryForm.get('includeInRecommended')?.setValue(this.library.includeInRecommended);
this.libraryForm.get('includeInSearch')?.setValue(this.library.includeInSearch);
this.libraryForm.get('manageCollections')?.setValue(this.library.manageCollections);
+ this.libraryForm.get('manageReadingLists')?.setValue(this.library.manageReadingLists);
+ this.libraryForm.get('collapseSeriesRelationships')?.setValue(this.library.collapseSeriesRelationships);
this.selectedFolders = this.library.folders;
this.madeChanges = false;
this.cdRef.markForCheck();
@@ -155,7 +159,7 @@ export class LibrarySettingsModalComponent implements OnInit, OnDestroy {
model.type = parseInt(model.type, 10);
if (model.type !== this.library.type) {
- if (!await this.confirmService.confirm(`Changing library type will trigger a new scan with different parsing rules and may lead to
+ if (!await this.confirmService.confirm(`Changing library type will trigger a new scan with different parsing rules and may lead to
series being re-created and hence you may loose progress and bookmarks. You should backup before you do this. Are you sure you want to continue?`)) return;
}
@@ -217,7 +221,7 @@ export class LibrarySettingsModalComponent implements OnInit, OnDestroy {
isNextDisabled() {
switch (this.setupStep) {
- case StepID.General:
+ case StepID.General:
return this.libraryForm.get('name')?.invalid || this.libraryForm.get('type')?.invalid;
case StepID.Folder:
return this.selectedFolders.length === 0;
diff --git a/UI/Web/src/app/statistics/_components/reading-activity/reading-activity.component.html b/UI/Web/src/app/statistics/_components/reading-activity/reading-activity.component.html
index b9e2841d1..4be892294 100644
--- a/UI/Web/src/app/statistics/_components/reading-activity/reading-activity.component.html
+++ b/UI/Web/src/app/statistics/_components/reading-activity/reading-activity.component.html
@@ -40,7 +40,7 @@
[roundDomains]="true"
[autoScale]="true"
xAxisLabel="Time"
- yAxisLabel="Reading Activity"
+ yAxisLabel="Hours Read"
[timeline]="false"
[results]="data"
>
diff --git a/UI/Web/src/app/statistics/_components/server-stats/server-stats.component.html b/UI/Web/src/app/statistics/_components/server-stats/server-stats.component.html
index a9d0e4ebe..0aa64bf13 100644
--- a/UI/Web/src/app/statistics/_components/server-stats/server-stats.component.html
+++ b/UI/Web/src/app/statistics/_components/server-stats/server-stats.component.html
@@ -66,7 +66,7 @@
<ng-container>
<div class="col-auto mb-2">
<app-icon-and-title label="Total Read Time" [clickable]="false" fontClasses="fas fa-eye" title="Total Read Time: {{stats.totalReadingTime | number}}">
- {{stats.totalReadingTime | compactNumber}} Hours
+ {{stats.totalReadingTime | timeDuration}}
</app-icon-and-title>
</div>
</ng-container>
diff --git a/UI/Web/src/app/statistics/_components/server-stats/server-stats.component.ts b/UI/Web/src/app/statistics/_components/server-stats/server-stats.component.ts
index f79a229b9..d88bff1a9 100644
--- a/UI/Web/src/app/statistics/_components/server-stats/server-stats.component.ts
+++ b/UI/Web/src/app/statistics/_components/server-stats/server-stats.component.ts
@@ -101,7 +101,7 @@ export class ServerStatsComponent implements OnDestroy {
ref.componentInstance.title = 'Genres';
ref.componentInstance.clicked = (item: string) => {
const params: any = {};
- params[FilterQueryParam.Genres] = item;
+ params[FilterQueryParam.Genres] = genres.filter(g => g.title === item)[0].id;
params[FilterQueryParam.Page] = 1;
this.router.navigate(['all-series'], {queryParams: params});
};
@@ -115,7 +115,7 @@ export class ServerStatsComponent implements OnDestroy {
ref.componentInstance.title = 'Tags';
ref.componentInstance.clicked = (item: string) => {
const params: any = {};
- params[FilterQueryParam.Tags] = item;
+ params[FilterQueryParam.Tags] = tags.filter(g => g.title === item)[0].id;
params[FilterQueryParam.Page] = 1;
this.router.navigate(['all-series'], {queryParams: params});
};
diff --git a/UI/Web/src/app/statistics/_components/user-stats-info-cards/user-stats-info-cards.component.html b/UI/Web/src/app/statistics/_components/user-stats-info-cards/user-stats-info-cards.component.html
index 398cc99f1..740be1b45 100644
--- a/UI/Web/src/app/statistics/_components/user-stats-info-cards/user-stats-info-cards.component.html
+++ b/UI/Web/src/app/statistics/_components/user-stats-info-cards/user-stats-info-cards.component.html
@@ -20,7 +20,7 @@
<ng-container >
<div class="col-auto mb-2">
<app-icon-and-title label="Time Spent Reading" [clickable]="false" fontClasses="fas fa-eye" title="Time Spent Reading: {{timeSpentReading | number}}">
- {{timeSpentReading | compactNumber}} hours
+ {{timeSpentReading | timeDuration}}
</app-icon-and-title>
</div>
<div class="vr d-none d-lg-block m-2"></div>
@@ -28,8 +28,8 @@
<ng-container>
<div class="col-auto mb-2">
- <app-icon-and-title label="Average Hours Read / Week" [clickable]="false" fontClasses="fas fa-eye" title="Average Hours Read / Week: {{avgHoursPerWeekSpentReading | number:'1.0-2'}}">
- {{avgHoursPerWeekSpentReading | compactNumber | number: '1.0-2'}} hours
+ <app-icon-and-title label="Average Reading / Week" [clickable]="false" fontClasses="fas fa-eye">
+ {{avgHoursPerWeekSpentReading | timeDuration}}
</app-icon-and-title>
</div>
<div class="vr d-none d-lg-block m-2"></div>
diff --git a/UI/Web/src/app/statistics/_components/user-stats-info-cards/user-stats-info-cards.component.ts b/UI/Web/src/app/statistics/_components/user-stats-info-cards/user-stats-info-cards.component.ts
index e4009099c..959b17152 100644
--- a/UI/Web/src/app/statistics/_components/user-stats-info-cards/user-stats-info-cards.component.ts
+++ b/UI/Web/src/app/statistics/_components/user-stats-info-cards/user-stats-info-cards.component.ts
@@ -34,7 +34,7 @@ export class UserStatsInfoCardsComponent {
const numberPipe = new CompactNumberPipe();
this.statsService.getWordsPerYear().subscribe(yearCounts => {
const ref = this.modalService.open(GenericListModalComponent, { scrollable: true });
- ref.componentInstance.items = yearCounts.map(t => `${t.name}: ${numberPipe.transform(t.value)} pages`);
+ ref.componentInstance.items = yearCounts.map(t => `${t.name}: ${numberPipe.transform(t.value)} words`);
ref.componentInstance.title = 'Words Read By Year';
});
}
diff --git a/UI/Web/src/app/typeahead/_components/typeahead.component.ts b/UI/Web/src/app/typeahead/_components/typeahead.component.ts
index 28dd38cae..5bc79395b 100644
--- a/UI/Web/src/app/typeahead/_components/typeahead.component.ts
+++ b/UI/Web/src/app/typeahead/_components/typeahead.component.ts
@@ -236,16 +236,16 @@ export class TypeaheadComponent implements OnInit, OnDestroy {
this.filteredOptions = this.typeaheadForm.get('typeahead')!.valueChanges
.pipe(
// Adjust input box to grow
- tap(val => {
+ tap((val: string) => {
if (this.inputElem != null && this.inputElem.nativeElement != null) {
this.renderer2.setStyle(this.inputElem.nativeElement, 'width', 15 * (val.trim().length + 1) + 'px');
this.focusedIndex = 0;
}
}),
- map(val => val.trim()),
+ map((val: string) => val.trim()),
auditTime(this.settings.debounce),
//distinctUntilChanged(), // ?!: BUG Doesn't trigger the search to run when filtered array changes
- filter(val => {
+ filter((val: string) => {
// If minimum filter characters not met, do not filter
if (this.settings.minCharacters === 0) return true;
@@ -256,11 +256,11 @@ export class TypeaheadComponent implements OnInit, OnDestroy {
return true;
}),
- switchMap(val => {
+ switchMap((val: string) => {
this.isLoadingOptions = true;
return this.settings.fetchFn(val.trim()).pipe(takeUntil(this.onDestroy), map((items: any[]) => items.filter(item => this.filterSelected(item))));
}),
- tap((filteredOptions) => {
+ tap((filteredOptions: any[]) => {
this.isLoadingOptions = false;
this.focusedIndex = 0;
this.cdRef.markForCheck();
@@ -398,6 +398,7 @@ export class TypeaheadComponent implements OnInit, OnDestroy {
}
this.toggleSelection(opt);
+ console.log('Selected ', opt);
this.resetField();
this.onInputFocus();
@@ -410,6 +411,7 @@ export class TypeaheadComponent implements OnInit, OnDestroy {
const newItem = this.settings.addTransformFn(title);
this.newItemAdded.emit(newItem);
this.toggleSelection(newItem);
+ console.log('Selected ', newItem);
this.resetField();
this.onInputFocus();
@@ -482,14 +484,43 @@ export class TypeaheadComponent implements OnInit, OnDestroy {
updateShowAddItem(options: any[]) {
// ?! BUG This will still technicially allow you to add the same thing as a previously added item. (Code will just toggle it though)
- this.showAddItem = this.settings.addIfNonExisting && this.typeaheadControl.value.trim()
- && this.typeaheadControl.value.trim().length >= Math.max(this.settings.minCharacters, 1)
- && this.typeaheadControl.dirty
- && (typeof this.settings.compareFn == 'function' && this.settings.compareFn(options, this.typeaheadControl.value.trim()).length === 0);
+ this.showAddItem = false;
+ this.cdRef.markForCheck();
+ if (!this.settings.addIfNonExisting) return;
+
+ const inputText = this.typeaheadControl.value.trim();
+ if (inputText.length < Math.max(this.settings.minCharacters, 1)) return;
+ if (!this.typeaheadControl.dirty) return; // Do we need this?
+
+ // Check if this new option will interfere with any existing ones not shown
+
+ if (typeof this.settings.compareFnForAdd == 'function') {
+ console.log('filtered options: ', this.optionSelection.selected());
+ const willDuplicateExist = this.settings.compareFnForAdd(this.optionSelection.selected(), inputText);
+ console.log('duplicate check: ', willDuplicateExist);
+ if (willDuplicateExist.length > 0) {
+ console.log("can't show add, duplicates will exist");
+ return;
+ }
+ }
+
+ if (typeof this.settings.compareFn == 'function') {
+ // The problem here is that compareFn can report that duplicate will exist as it does contains not match
+ const matches = this.settings.compareFn(options, inputText);
+ console.log('matches for ', inputText, ': ', matches);
+ console.log('matches include input string: ', matches.includes(this.settings.addTransformFn(inputText)));
+ if (matches.length > 0 && matches.includes(this.settings.addTransformFn(inputText))) {
+ console.log("can't show add, there are still ");
+ return;
+ }
+ }
+
+ this.showAddItem = true;
if (this.showAddItem) {
this.hasFocus = true;
}
+ this.cdRef.markForCheck();
}
toggleLock(event: any) {
diff --git a/UI/Web/src/app/typeahead/_models/typeahead-settings.ts b/UI/Web/src/app/typeahead/_models/typeahead-settings.ts
index c0cbe648f..12424a1bc 100644
--- a/UI/Web/src/app/typeahead/_models/typeahead-settings.ts
+++ b/UI/Web/src/app/typeahead/_models/typeahead-settings.ts
@@ -29,9 +29,13 @@ export class TypeaheadSettings<T> {
savedData!: T[] | T;
/**
* Function to compare the elements. Should return all elements that fit the matching criteria.
- * This is only used with non-Observable based fetchFn, but must be defined for all uses of typeahead (TODO)
+ * This is only used with non-Observable based fetchFn, but must be defined for all uses of typeahead.
*/
compareFn!: ((optionList: T[], filter: string) => T[]);
+ /**
+ * Must be defined when addIfNonExisting is true. Used to ensure no duplicates exist when adding.
+ */
+ compareFnForAdd!: ((optionList: T[], filter: string) => T[]);
/**
* Function which is used for comparing objects when keeping track of state.
* Useful over shallow equal when you have image urls that have random numbers on them.
diff --git a/UI/Web/src/app/user-settings/edit-device/edit-device.component.html b/UI/Web/src/app/user-settings/edit-device/edit-device.component.html
index 3aaa5dfbc..da6223701 100644
--- a/UI/Web/src/app/user-settings/edit-device/edit-device.component.html
+++ b/UI/Web/src/app/user-settings/edit-device/edit-device.component.html
@@ -17,7 +17,7 @@
<span class="visually-hidden" id="email-help">The number of backups to maintain. Default is 30, minumum is 1, maximum is 30.</span>
<input id="email" aria-describedby="email-help"
- class="form-control" formControlName="email" type="email"
+ class="form-control" formControlName="email" type="email" inputmode="email"
placeholder="[email protected]" [class.is-invalid]="settingsForm.get('email')?.invalid && settingsForm.get('email')?.touched">
<ng-container *ngIf="settingsForm.get('email')?.errors as errors">
<p class="invalid-feedback" *ngIf="errors.email">
diff --git a/UI/Web/src/app/user-settings/theme-manager/theme-manager.component.html b/UI/Web/src/app/user-settings/theme-manager/theme-manager.component.html
index 6760c4218..bdc093d8d 100644
--- a/UI/Web/src/app/user-settings/theme-manager/theme-manager.component.html
+++ b/UI/Web/src/app/user-settings/theme-manager/theme-manager.component.html
@@ -9,7 +9,7 @@
</div>
<p *ngIf="isAdmin">
- Looking for a light or e-ink theme? We have some custom themes you can use on our <a href="https://wiki.kavitareader.com/en/guides/settings/themes" target="_blank" rel="noopener noreferrer">wiki</a>.
+ Looking for a light or e-ink theme? We have some custom themes you can use on our <a href="https://github.com/Kareadita/Themes" target="_blank" rel="noopener noreferrer">theme github</a>.
</p>
<div class="row g-0">
diff --git a/UI/Web/src/app/user-settings/user-preferences/user-preferences.component.html b/UI/Web/src/app/user-settings/user-preferences/user-preferences.component.html
index c92d9c08f..4f90e6267 100644
--- a/UI/Web/src/app/user-settings/user-preferences/user-preferences.component.html
+++ b/UI/Web/src/app/user-settings/user-preferences/user-preferences.component.html
@@ -47,7 +47,7 @@
<input type="checkbox" id="auto-close" role="switch" formControlName="blurUnreadSummaries" class="form-check-input" aria-describedby="settings-global-blurUnreadSummaries-help" [value]="true" aria-labelledby="auto-close-label">
<label class="form-check-label" for="auto-close">Blur Unread Summaries</label><i class="fa fa-info-circle ms-1" aria-hidden="true" placement="right" [ngbTooltip]="blurUnreadSummariesTooltip" role="button" tabindex="0"></i>
</div>
-
+
<ng-template #blurUnreadSummariesTooltip>Blurs summary text on volumes or chapters that have no read progress (to avoid spoilers)</ng-template>
<span class="visually-hidden" id="settings-global-blurUnreadSummaries-help">Blurs summary text on volumes or chapters that have no read progress (to avoid spoilers)</span>
</div>
@@ -59,7 +59,7 @@
<input type="checkbox" id="prompt-download" role="switch" formControlName="promptForDownloadSize" class="form-check-input" aria-describedby="settings-global-promptForDownloadSize-help" [value]="true" aria-labelledby="auto-close-label">
<label class="form-check-label" for="prompt-download">Prompt on Download</label><i class="fa fa-info-circle ms-1" aria-hidden="true" placement="right" [ngbTooltip]="promptForDownloadSizeTooltip" role="button" tabindex="0"></i>
</div>
-
+
<ng-template #promptForDownloadSizeTooltip>Prompt when a download exceedes 100MB in size</ng-template>
<span class="visually-hidden" id="settings-global-promptForDownloadSize-help">Prompt when a download exceedes 100MB in size</span>
</div>
@@ -77,6 +77,19 @@
</div>
</div>
+ <div class="row g-0">
+ <div class="col-md-12 col-sm-12 pe-2 mb-2">
+ <div class="mb-3 mt-1">
+ <div class="form-check form-switch">
+ <input type="checkbox" id="collapse-relationships" role="switch" formControlName="collapseSeriesRelationships" aria-describedby="settings-collapse-relationships-help" class="form-check-input" aria-labelledby="auto-close-label">
+ <label class="form-check-label" for="collapse-relationships">Collapse Series Relationships</label>
+ </div>
+ </div>
+ <ng-template #noTransitionsTooltip>Experiemental: Should Kavita show Series that have no relationships or is the parent/prequel</ng-template>
+ <span class="visually-hidden" id="settings-collapse-relationships-help">Experiemental: Should Kavita show Series that have no relationships or is the parent/prequel</span>
+ </div>
+ </div>
+
<div class="col-auto d-flex d-md-block justify-content-sm-center text-md-end mb-3">
<button type="button" class="flex-fill btn btn-secondary me-2" (click)="resetForm()" aria-describedby="reading-panel">Reset</button>
<button type="submit" class="flex-fill btn btn-primary" (click)="save()" aria-describedby="reading-panel" [disabled]="!settingsForm.dirty">Save</button>
@@ -142,11 +155,12 @@
<div class="col-md-6 col-sm-12 pe-2 mb-2">
<label for="settings-backgroundcolor-option" class="form-label">Background Color</label>
<input [value]="user.preferences.backgroundColor"
- class="form-control"
- (colorPickerChange)="handleBackgroundColorChange()"
- [style.background]="user.preferences.backgroundColor"
- [cpAlphaChannel]="'disabled'"
- [(colorPicker)]="user.preferences.backgroundColor"/>
+ class="form-control"
+ id="settings-backgroundcolor-option"
+ (colorPickerChange)="handleBackgroundColorChange()"
+ [style.background]="user.preferences.backgroundColor"
+ [cpAlphaChannel]="'disabled'"
+ [(colorPicker)]="user.preferences.backgroundColor"/>
</div>
</div>
@@ -251,6 +265,15 @@
</div>
<div class="row g-0">
+ <div class="col-md-6 col-sm-12 pe-2 mb-3">
+ <label for="settings-book-writing-style" class="form-label me-1">Writing Style</label><i class="fa fa-info-circle" aria-hidden="true" aria-describedby="settings-book-writing-style-help" placement="right" [ngbTooltip]="bookWritingStyleToolTip" role="button" tabindex="0"></i>
+ <ng-template #bookWritingStyleToolTip>Changes the direction of the text. Horizontal is left to right, vertical is top to bottom.</ng-template>
+ <span class="visually-hidden" id="settings-book-writing-style-help"><ng-container [ngTemplateOutlet]="bookWritingStyleToolTip"></ng-container></span>
+ <select class="form-select" aria-describedby="settings-book-writing-style-help" formControlName="bookReaderWritingStyle" id="settings-book-writing-style" >
+ <option *ngFor="let opt of bookWritingStyles" [value]="opt.value">{{opt.text | titlecase}}</option>
+ </select>
+ </div>
+
<div class="col-md-6 col-sm-12 pe-2 mb-3">
<label for="settings-book-layout-mode" class="form-label">Layout Mode</label>&nbsp;<i class="fa fa-info-circle" aria-hidden="true" placement="right" [ngbTooltip]="bookLayoutModeTooltip" role="button" tabindex="0"></i>
<ng-template #bookLayoutModeTooltip>How content should be laid out. Scroll is as the book packs it. 1 or 2 Column fits to the height of the device and fits 1 or 2 columns of text per page</ng-template>
@@ -259,26 +282,28 @@
<option *ngFor="let opt of bookLayoutModes" [value]="opt.value">{{opt.text | titlecase}}</option>
</select>
</div>
+ </div>
+ <div class="row g-0">
<div class="col-md-6 col-sm-12 pe-2 mb-3">
- <label for="settings-color-theme-option" class="form-label">Color Theme</label>&nbsp;<i class="fa fa-info-circle" aria-hidden="true" placement="right" [ngbTooltip]="bookColorThemeTooltip" role="button" tabindex="0"></i>
- <ng-template #bookColorThemeTooltip>What color theme to apply to the book reader content and menuing</ng-template>
- <span class="visually-hidden" id="settings-color-theme-option-help"><ng-container [ngTemplateOutlet]="bookColorThemeTooltip"></ng-container></span>
- <select class="form-select" aria-describedby="settings-color-theme-option-help" formControlName="bookReaderThemeName" id="settings-color-theme-option">
- <option *ngFor="let opt of bookColorThemes" [value]="opt.name">{{opt.name | titlecase}}</option>
- </select>
- </div>
+ <label for="settings-color-theme-option" class="form-label">Color Theme</label>&nbsp;<i class="fa fa-info-circle" aria-hidden="true" placement="right" [ngbTooltip]="bookColorThemeTooltip" role="button" tabindex="0"></i>
+ <ng-template #bookColorThemeTooltip>What color theme to apply to the book reader content and menuing</ng-template>
+ <span class="visually-hidden" id="settings-color-theme-option-help"><ng-container [ngTemplateOutlet]="bookColorThemeTooltip"></ng-container></span>
+ <select class="form-select" aria-describedby="settings-color-theme-option-help" formControlName="bookReaderThemeName" id="settings-color-theme-option">
+ <option *ngFor="let opt of bookColorThemes" [value]="opt.name">{{opt.name | titlecase}}</option>
+ </select>
+ </div>
</div>
<div class="row g-0">
<div class="col-md-4 col-sm-12 pe-2 mb-3">
<label for="fontsize" class="form-label range-label">Font Size</label>
- <input type="range" class="form-range" id="fontsize"
+ <input type="range" class="form-range" id="fontsize"
min="50" max="300" step="10" formControlName="bookReaderFontSize">
<span class="range-text">{{settingsForm.get('bookReaderFontSize')?.value + '%'}}</span>
</div>
-
+
<div class="col-md-4 col-sm-12 pe-2 mb-3">
<div class="range-label">
@@ -286,7 +311,7 @@
<ng-template #bookLineHeightOptionTooltip>How much spacing between the lines of the book</ng-template>
<span class="visually-hidden" id="settings-booklineheight-option-help">How much spacing between the lines of the book</span>
</div>
- <input type="range" class="form-range" id="linespacing" min="100" max="200" step="10"
+ <input type="range" class="form-range" id="linespacing" min="100" max="200" step="10"
formControlName="bookReaderLineSpacing" aria-describedby="settings-booklineheight-option-help">
<span class="range-text">{{settingsForm.get('bookReaderLineSpacing')?.value + '%'}}</span>
</div>
@@ -315,8 +340,8 @@
<ng-container *ngIf="tab.fragment === FragmentID.Clients">
+ <div class="alert alert-warning" role="alert" *ngIf="!opdsEnabled">OPDS is not enabled on this server. This will not affect Tachiyomi users.</div>
<p>All 3rd Party clients will either use the API key or the Connection Url below. These are like passwords, keep it private.</p>
- <p class="alert alert-warning" role="alert" *ngIf="!opdsEnabled">OPDS is not enabled on this server.</p>
<app-api-key tooltipText="The API key is like a password. Keep it secret, Keep it safe."></app-api-key>
<app-api-key title="OPDS URL" [showRefresh]="false" [transform]="makeUrl"></app-api-key>
</ng-container>
diff --git a/UI/Web/src/app/user-settings/user-preferences/user-preferences.component.ts b/UI/Web/src/app/user-settings/user-preferences/user-preferences.component.ts
index 04ac999a3..ce43fe363 100644
--- a/UI/Web/src/app/user-settings/user-preferences/user-preferences.component.ts
+++ b/UI/Web/src/app/user-settings/user-preferences/user-preferences.component.ts
@@ -3,7 +3,17 @@ import { FormControl, FormGroup } from '@angular/forms';
import { ToastrService } from 'ngx-toastr';
import { take, takeUntil } from 'rxjs/operators';
import { Title } from '@angular/platform-browser';
-import { readingDirections, scalingOptions, pageSplitOptions, readingModes, Preferences, bookLayoutModes, layoutModes, pageLayoutModes } from 'src/app/_models/preferences/preferences';
+import {
+ readingDirections,
+ scalingOptions,
+ pageSplitOptions,
+ readingModes,
+ Preferences,
+ bookLayoutModes,
+ layoutModes,
+ pageLayoutModes,
+ bookWritingStyles
+} from 'src/app/_models/preferences/preferences';
import { User } from 'src/app/_models/user';
import { AccountService } from 'src/app/_services/account.service';
import { ActivatedRoute, Router } from '@angular/router';
@@ -12,6 +22,7 @@ import { BookPageLayoutMode } from 'src/app/_models/readers/book-page-layout-mod
import { forkJoin, Subject } from 'rxjs';
import { bookColorThemes } from 'src/app/book-reader/_components/reader-settings/reader-settings.component';
import { BookService } from 'src/app/book-reader/_services/book.service';
+import { environment } from 'src/environments/environment';
enum AccordionPanelID {
ImageReader = 'image-reader',
@@ -45,6 +56,7 @@ export class UserPreferencesComponent implements OnInit, OnDestroy {
bookLayoutModes = bookLayoutModes;
bookColorThemes = bookColorThemes;
pageLayoutModes = pageLayoutModes;
+ bookWritingStyles = bookWritingStyles;
settingsForm: FormGroup = new FormGroup({});
user: User | undefined = undefined;
@@ -65,6 +77,7 @@ export class UserPreferencesComponent implements OnInit, OnDestroy {
];
active = this.tabs[1];
opdsEnabled: boolean = false;
+ baseUrl: string = '';
makeUrl: (val: string) => string = (val: string) => {return this.transformKeyToOpdsUrl(val)};
private onDestroy = new Subject<void>();
@@ -94,6 +107,8 @@ export class UserPreferencesComponent implements OnInit, OnDestroy {
this.cdRef.markForCheck();
});
+ this.settingsService.getBaseUrl().subscribe(url => this.baseUrl = url);
+
this.settingsService.getOpdsEnabled().subscribe(res => {
this.opdsEnabled = res;
this.cdRef.markForCheck();
@@ -134,6 +149,7 @@ export class UserPreferencesComponent implements OnInit, OnDestroy {
this.settingsForm.addControl('bookReaderLineSpacing', new FormControl(this.user.preferences.bookReaderLineSpacing, []));
this.settingsForm.addControl('bookReaderMargin', new FormControl(this.user.preferences.bookReaderMargin, []));
this.settingsForm.addControl('bookReaderReadingDirection', new FormControl(this.user.preferences.bookReaderReadingDirection, []));
+ this.settingsForm.addControl('bookReaderWritingStyle', new FormControl(this.user.preferences.bookReaderWritingStyle, []))
this.settingsForm.addControl('bookReaderTapToPaginate', new FormControl(!!this.user.preferences.bookReaderTapToPaginate, []));
this.settingsForm.addControl('bookReaderLayoutMode', new FormControl(this.user.preferences.bookReaderLayoutMode || BookPageLayoutMode.Default, []));
this.settingsForm.addControl('bookReaderThemeName', new FormControl(this.user?.preferences.bookReaderThemeName || bookColorThemes[0].name, []));
@@ -144,6 +160,7 @@ export class UserPreferencesComponent implements OnInit, OnDestroy {
this.settingsForm.addControl('blurUnreadSummaries', new FormControl(this.user.preferences.blurUnreadSummaries, []));
this.settingsForm.addControl('promptForDownloadSize', new FormControl(this.user.preferences.promptForDownloadSize, []));
this.settingsForm.addControl('noTransitions', new FormControl(this.user.preferences.noTransitions, []));
+ this.settingsForm.addControl('collapseSeriesRelationships', new FormControl(this.user.preferences.collapseSeriesRelationships, []));
this.cdRef.markForCheck();
});
@@ -179,6 +196,7 @@ export class UserPreferencesComponent implements OnInit, OnDestroy {
this.settingsForm.get('bookReaderMargin')?.setValue(this.user.preferences.bookReaderMargin);
this.settingsForm.get('bookReaderTapToPaginate')?.setValue(this.user.preferences.bookReaderTapToPaginate);
this.settingsForm.get('bookReaderReadingDirection')?.setValue(this.user.preferences.bookReaderReadingDirection);
+ this.settingsForm.get('bookReaderWritingStyle')?.setValue(this.user.preferences.bookReaderWritingStyle);
this.settingsForm.get('bookReaderLayoutMode')?.setValue(this.user.preferences.bookReaderLayoutMode);
this.settingsForm.get('bookReaderThemeName')?.setValue(this.user.preferences.bookReaderThemeName);
this.settingsForm.get('theme')?.setValue(this.user.preferences.theme);
@@ -189,6 +207,7 @@ export class UserPreferencesComponent implements OnInit, OnDestroy {
this.settingsForm.get('noTransitions')?.setValue(this.user.preferences.noTransitions);
this.settingsForm.get('emulateBook')?.setValue(this.user.preferences.emulateBook);
this.settingsForm.get('swipeToPaginate')?.setValue(this.user.preferences.swipeToPaginate);
+ this.settingsForm.get('collapseSeriesRelationships')?.setValue(this.user.preferences.collapseSeriesRelationships);
this.cdRef.markForCheck();
this.settingsForm.markAsPristine();
}
@@ -211,6 +230,7 @@ export class UserPreferencesComponent implements OnInit, OnDestroy {
bookReaderMargin: modelSettings.bookReaderMargin,
bookReaderTapToPaginate: modelSettings.bookReaderTapToPaginate,
bookReaderReadingDirection: parseInt(modelSettings.bookReaderReadingDirection, 10),
+ bookReaderWritingStyle: parseInt(modelSettings.bookReaderWritingStyle, 10),
bookReaderLayoutMode: parseInt(modelSettings.bookReaderLayoutMode, 10),
bookReaderThemeName: modelSettings.bookReaderThemeName,
theme: modelSettings.theme,
@@ -220,7 +240,8 @@ export class UserPreferencesComponent implements OnInit, OnDestroy {
promptForDownloadSize: modelSettings.promptForDownloadSize,
noTransitions: modelSettings.noTransitions,
emulateBook: modelSettings.emulateBook,
- swipeToPaginate: modelSettings.swipeToPaginate
+ swipeToPaginate: modelSettings.swipeToPaginate,
+ collapseSeriesRelationships: modelSettings.collapseSeriesRelationships
};
this.observableHandles.push(this.accountService.updatePreferences(data).subscribe((updatedPrefs) => {
@@ -235,7 +256,11 @@ export class UserPreferencesComponent implements OnInit, OnDestroy {
transformKeyToOpdsUrl(key: string) {
- return `${location.origin}/api/opds/${key}`;
+ if (environment.production) {
+ return `${location.origin}` + `${this.baseUrl}${environment.apiUrl}opds/${key}`.replace('//', '/');
+ }
+
+ return `${location.origin}${this.baseUrl.replace('//', '/')}api/opds/${key}`;
}
handleBackgroundColorChange() {
diff --git a/UI/Web/src/app/want-to-read/_components/want-to-read/want-to-read.component.html b/UI/Web/src/app/want-to-read/_components/want-to-read/want-to-read.component.html
index eb1997852..88792a0e6 100644
--- a/UI/Web/src/app/want-to-read/_components/want-to-read/want-to-read.component.html
+++ b/UI/Web/src/app/want-to-read/_components/want-to-read/want-to-read.component.html
@@ -5,7 +5,7 @@
Want To Read
</h2>
</ng-container>
- <h6 subtitle>{{seriesPagination.totalItems}} Series</h6>
+ <h6 subtitle>{{seriesPagination.totalItems | number}} Series</h6>
</app-side-nav-companion-bar>
</div>
diff --git a/UI/Web/src/environments/environment.prod.ts b/UI/Web/src/environments/environment.prod.ts
index 011772854..eb399e6ff 100644
--- a/UI/Web/src/environments/environment.prod.ts
+++ b/UI/Web/src/environments/environment.prod.ts
@@ -1,5 +1,8 @@
+import { getBaseUrl } from "src/app/base-url.provider";
+const BASE_URL = getBaseUrl();
+
export const environment = {
production: true,
- apiUrl: '/api/',
- hubUrl: '/hubs/'
+ apiUrl: `${BASE_URL}api/`,
+ hubUrl:`${BASE_URL}hubs/`
};
diff --git a/UI/Web/src/index.html b/UI/Web/src/index.html
index 0fbecc5a8..4ce7fd914 100644
--- a/UI/Web/src/index.html
+++ b/UI/Web/src/index.html
@@ -14,10 +14,11 @@
<meta name="msapplication-config" content="assets/icons/browserconfig.xml">
<meta name="theme-color" content="#000000">
<meta name="apple-mobile-web-app-status-bar-style" content="#000000">
-
+ <!-- Don't allow indexing from Bots -->
+ <meta name='robots' content='none' />
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="mobile-web-app-capable" content="yes">
-
+
</head>
<body class="mat-typography default" theme="dark">
<app-root></app-root>
diff --git a/UI/Web/src/site.webmanifest b/UI/Web/src/site.webmanifest
index a77109e84..4bd350739 100644
--- a/UI/Web/src/site.webmanifest
+++ b/UI/Web/src/site.webmanifest
@@ -13,7 +13,7 @@
"type": "image/png"
}
],
- "theme_color": "#ffffff",
- "background_color": "#ffffff",
+ "theme_color": "#000000",
+ "background_color": "#000000",
"display": "standalone"
}
diff --git a/UI/Web/src/styles.scss b/UI/Web/src/styles.scss
index 829a19ace..88b964259 100644
--- a/UI/Web/src/styles.scss
+++ b/UI/Web/src/styles.scss
@@ -38,6 +38,7 @@
@import './theme/components/carousel';
@import './theme/components/offcanvas';
@import './theme/components/table';
+@import './theme/components/alerts';
@import './theme/utilities/utilities';
@@ -49,11 +50,13 @@
@font-face {
font-family: "EBGarmond";
src: url("assets/fonts/EBGarmond/EBGaramond-VariableFont_wght.ttf") format("truetype");
+ font-display: swap;
}
@font-face {
font-family: "Spartan";
src: url("assets/fonts/Spartan/Spartan-VariableFont_wght.ttf");
+ font-display: swap;
}
label, select, .clickable {
diff --git a/UI/Web/src/theme/components/_alerts.scss b/UI/Web/src/theme/components/_alerts.scss
new file mode 100644
index 000000000..78d9e4dd7
--- /dev/null
+++ b/UI/Web/src/theme/components/_alerts.scss
@@ -0,0 +1,5 @@
+.alert-warning {
+ --bs-alert-color: black;
+ --bs-alert-bg: #fff3cd;
+ --bs-alert-border-color: #ffecb5
+}
\ No newline at end of file
diff --git a/UI/Web/src/theme/components/_input.scss b/UI/Web/src/theme/components/_input.scss
index 231be419a..0553b9750 100644
--- a/UI/Web/src/theme/components/_input.scss
+++ b/UI/Web/src/theme/components/_input.scss
@@ -24,10 +24,10 @@ input:not([type="range"]), .form-control {
}
}
-.form-range::-webkit-slider-thumb:active {
+.form-range::-webkit-slider-thumb:active, .form-range::-moz-range-thumb:active {
background-color: var(--input-range-active-color);
}
-.form-range::-webkit-slider-thumb {
+.form-range::-webkit-slider-thumb, .form-range::-moz-range-thumb {
background-color: var(--input-range-color);
}
diff --git a/UI/Web/tsconfig.json b/UI/Web/tsconfig.json
index 21923596a..62185ece0 100644
--- a/UI/Web/tsconfig.json
+++ b/UI/Web/tsconfig.json
@@ -17,7 +17,7 @@
"moduleResolution": "node",
"importHelpers": true,
"target": "ES2022",
- "module": "es2020",
+ "module": "ES2022",
"useDefineForClassFields": false,
"lib": [
"ES2022",
diff --git a/build.sh b/build.sh
index 9721e9585..ef8ad3caf 100755
--- a/build.sh
+++ b/build.sh
@@ -75,17 +75,16 @@ BuildUI()
Package()
{
- local framework="$1"
- local runtime="$2"
+ local runtime="$1"
local lOutputFolder=../_output/"$runtime"/Kavita
- ProgressStart "Creating $runtime Package for $framework"
+ ProgressStart "Creating $runtime Package"
# TODO: Use no-restore? Because Build should have already done it for us
echo "Building"
cd API
- echo dotnet publish -c Release --self-contained --runtime $runtime -o "$lOutputFolder" --framework $framework
- dotnet publish -c Release --self-contained --runtime $runtime -o "$lOutputFolder" --framework $framework
+ echo dotnet publish -c Release --self-contained --runtime $runtime -o "$lOutputFolder"
+ dotnet publish -c Release --self-contained --runtime $runtime -o "$lOutputFolder"
echo "Recopying wwwroot due to bug"
cp -R ./wwwroot/* $lOutputFolder/wwwroot
@@ -114,7 +113,7 @@ Package()
tar -czvf ../kavita-$runtime.tar.gz Kavita
- ProgressEnd "Creating $runtime Package for $framework"
+ ProgressEnd "Creating $runtime Package"
}
@@ -130,21 +129,21 @@ dir=$PWD
if [[ -z "$RID" ]];
then
- Package "net6.0" "win-x64"
+ Package "win-x64"
cd "$dir"
- Package "net6.0" "win-x86"
+ Package "win-x86"
cd "$dir"
- Package "net6.0" "linux-x64"
+ Package "linux-x64"
cd "$dir"
- Package "net6.0" "linux-arm"
+ Package "linux-arm"
cd "$dir"
- Package "net6.0" "linux-arm64"
+ Package "linux-arm64"
cd "$dir"
- Package "net6.0" "linux-musl-x64"
+ Package "linux-musl-x64"
cd "$dir"
- Package "net6.0" "osx-x64"
+ Package "osx-x64"
cd "$dir"
else
- Package "net6.0" "$RID"
+ Package "$RID"
cd "$dir"
fi
diff --git a/entrypoint.sh b/entrypoint.sh
index e07ece683..abad49a14 100644
--- a/entrypoint.sh
+++ b/entrypoint.sh
@@ -1,5 +1,6 @@
#! /bin/bash
+# Removed - This is causing issues for Synology users
## Set default UID and GID for Kavita but allow overrides
#PUID=${PUID:-0}
#PGID=${PGID:-0}
@@ -18,13 +19,15 @@ if [ ! -f "/kavita/config/appsettings.json" ]; then
echo "Kavita configuration file does not exist, creating..."
echo '{
"TokenKey": "super secret unguessable key",
- "Port": 5000
+ "Port": 5000,
+ "IpAddresses": ""
}' >> /kavita/config/appsettings.json
fi
chmod +x Kavita
./Kavita
+
#if [[ "$PUID" -eq 0 ]]; then
# # Run as root
# ./Kavita
diff --git a/global.json b/global.json
index 97dd87392..36e1a9e95 100644
--- a/global.json
+++ b/global.json
@@ -1,6 +1,6 @@
{
"sdk": {
- "version": "6.0",
+ "version": "7.0.0",
"rollForward": "latestMajor",
"allowPrerelease": false
}
diff --git a/monorepo-build.sh b/monorepo-build.sh
index d4c4b9b7d..f2190b397 100755
--- a/monorepo-build.sh
+++ b/monorepo-build.sh
@@ -30,17 +30,16 @@ Build()
Package()
{
- local framework="$1"
- local runtime="$2"
+ local runtime="$1"
local lOutputFolder=../_output/"$runtime"/Kavita
- ProgressStart "Creating $runtime Package for $framework"
+ ProgressStart "Creating $runtime Package"
# TODO: Use no-restore? Because Build should have already done it for us
echo "Building"
cd API
- echo dotnet publish -c Release --no-restore --self-contained --runtime $runtime -o "$lOutputFolder" --framework $framework
- dotnet publish -c Release --no-restore --self-contained --runtime $runtime -o "$lOutputFolder" --framework $framework
+ echo dotnet publish -c Release --no-restore --self-contained --runtime $runtime -o "$lOutputFolder"
+ dotnet publish -c Release --no-restore --self-contained --runtime $runtime -o "$lOutputFolder"
echo "Renaming API -> Kavita"
mv "$lOutputFolder"/API "$lOutputFolder"/Kavita
@@ -64,7 +63,7 @@ Package()
cd ../$outputFolder/"$runtime"/
tar -czvf ../kavita-$runtime.tar.gz Kavita
- ProgressEnd "Creating $runtime Package for $framework"
+ ProgressEnd "Creating $runtime Package"
}
@@ -77,15 +76,15 @@ fi
#Build for x64
Build "linux-x64"
-Package "net6.0" "linux-x64"
+Package "linux-x64"
cd "$dir"
#Build for arm
Build "linux-arm"
-Package "net6.0" "linux-arm"
+Package "linux-arm"
cd "$dir"
#Build for arm64
Build "linux-arm64"
-Package "net6.0" "linux-arm64"
+Package "linux-arm64"
cd "$dir"
diff --git a/openapi.json b/openapi.json
index 06aec3b21..6f227b200 100644
--- a/openapi.json
+++ b/openapi.json
@@ -7,7 +7,7 @@
"name": "GPL-3.0",
"url": "https://github.com/Kareadita/Kavita/blob/develop/LICENSE"
},
- "version": "0.7.0.2"
+ "version": "0.7.2.0"
},
"servers": [
{
@@ -1024,6 +1024,185 @@
}
}
},
+ "/api/Cbl/validate": {
+ "post": {
+ "tags": [
+ "Cbl"
+ ],
+ "summary": "The first step in a cbl import. This validates the cbl file that if an import occured, would it be successful.\r\nIf this returns errors, the cbl will always be rejected by Kavita.",
+ "requestBody": {
+ "content": {
+ "multipart/form-data": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "ContentType": {
+ "type": "string"
+ },
+ "ContentDisposition": {
+ "type": "string"
+ },
+ "Headers": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ },
+ "Length": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "Name": {
+ "type": "string"
+ },
+ "FileName": {
+ "type": "string"
+ }
+ }
+ },
+ "encoding": {
+ "ContentType": {
+ "style": "form"
+ },
+ "ContentDisposition": {
+ "style": "form"
+ },
+ "Headers": {
+ "style": "form"
+ },
+ "Length": {
+ "style": "form"
+ },
+ "Name": {
+ "style": "form"
+ },
+ "FileName": {
+ "style": "form"
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Success",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "$ref": "#/components/schemas/CblImportSummaryDto"
+ }
+ },
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/CblImportSummaryDto"
+ }
+ },
+ "text/json": {
+ "schema": {
+ "$ref": "#/components/schemas/CblImportSummaryDto"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/api/Cbl/import": {
+ "post": {
+ "tags": [
+ "Cbl"
+ ],
+ "summary": "Performs the actual import (assuming dryRun = false)",
+ "requestBody": {
+ "content": {
+ "multipart/form-data": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "ContentType": {
+ "type": "string"
+ },
+ "ContentDisposition": {
+ "type": "string"
+ },
+ "Headers": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ },
+ "Length": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "Name": {
+ "type": "string"
+ },
+ "FileName": {
+ "type": "string"
+ },
+ "dryRun": {
+ "type": "boolean",
+ "default": false
+ }
+ }
+ },
+ "encoding": {
+ "ContentType": {
+ "style": "form"
+ },
+ "ContentDisposition": {
+ "style": "form"
+ },
+ "Headers": {
+ "style": "form"
+ },
+ "Length": {
+ "style": "form"
+ },
+ "Name": {
+ "style": "form"
+ },
+ "FileName": {
+ "style": "form"
+ },
+ "dryRun": {
+ "style": "form"
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Success",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "$ref": "#/components/schemas/CblImportSummaryDto"
+ }
+ },
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/CblImportSummaryDto"
+ }
+ },
+ "text/json": {
+ "schema": {
+ "$ref": "#/components/schemas/CblImportSummaryDto"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
"/api/Collection": {
"get": {
"tags": [
@@ -1666,6 +1845,13 @@
"type": "integer",
"format": "int32"
}
+ },
+ {
+ "name": "apiKey",
+ "in": "query",
+ "schema": {
+ "type": "string"
+ }
}
],
"responses": {
@@ -1690,6 +1876,13 @@
"type": "integer",
"format": "int32"
}
+ },
+ {
+ "name": "apiKey",
+ "in": "query",
+ "schema": {
+ "type": "string"
+ }
}
],
"responses": {
@@ -1714,6 +1907,13 @@
"type": "integer",
"format": "int32"
}
+ },
+ {
+ "name": "apiKey",
+ "in": "query",
+ "schema": {
+ "type": "string"
+ }
}
],
"responses": {
@@ -1738,6 +1938,13 @@
"type": "integer",
"format": "int32"
}
+ },
+ {
+ "name": "apiKey",
+ "in": "query",
+ "schema": {
+ "type": "string"
+ }
}
],
"responses": {
@@ -1762,6 +1969,13 @@
"type": "integer",
"format": "int32"
}
+ },
+ {
+ "name": "apiKey",
+ "in": "query",
+ "schema": {
+ "type": "string"
+ }
}
],
"responses": {
@@ -1786,6 +2000,13 @@
"type": "integer",
"format": "int32"
}
+ },
+ {
+ "name": "apiKey",
+ "in": "query",
+ "schema": {
+ "type": "string"
+ }
}
],
"responses": {
@@ -1851,6 +2072,13 @@
"schema": {
"type": "string"
}
+ },
+ {
+ "name": "apiKey",
+ "in": "query",
+ "schema": {
+ "type": "string"
+ }
}
],
"responses": {
@@ -1947,6 +2175,7 @@
"tags": [
"Library"
],
+ "summary": "Return all libraries in the Server",
"responses": {
"200": {
"description": "Success",
@@ -1985,10 +2214,12 @@
"tags": [
"Library"
],
+ "summary": "For a given library, generate the jump bar information",
"parameters": [
{
"name": "libraryId",
"in": "query",
+ "description": "",
"schema": {
"type": "integer",
"format": "int32"
@@ -2033,7 +2264,9 @@
"tags": [
"Library"
],
+ "summary": "Grants a user account access to a Library",
"requestBody": {
+ "description": "",
"content": {
"application/json": {
"schema": {
@@ -2081,10 +2314,12 @@
"tags": [
"Library"
],
+ "summary": "Scans a given library for file changes.",
"parameters": [
{
"name": "libraryId",
"in": "query",
+ "description": "",
"schema": {
"type": "integer",
"format": "int32"
@@ -2093,6 +2328,31 @@
{
"name": "force",
"in": "query",
+ "description": "If true, will ignore any optimizations to avoid file I/O and will treat similar to a first scan",
+ "schema": {
+ "type": "boolean",
+ "default": false
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Success"
+ }
+ }
+ }
+ },
+ "/api/Library/scan-all": {
+ "post": {
+ "tags": [
+ "Library"
+ ],
+ "summary": "Scans a given library for file changes. If another scan task is in progress, will reschedule the invocation for 3 hours in future.",
+ "parameters": [
+ {
+ "name": "force",
+ "in": "query",
+ "description": "If true, will ignore any optimizations to avoid file I/O and will treat similar to a first scan",
"schema": {
"type": "boolean",
"default": false
@@ -3248,10 +3508,12 @@
"tags": [
"Opds"
],
+ "summary": "This returns a streamed image following OPDS-PS v1.2",
"parameters": [
{
"name": "apiKey",
"in": "path",
+ "description": "",
"required": true,
"schema": {
"type": "string"
@@ -3260,6 +3522,7 @@
{
"name": "libraryId",
"in": "query",
+ "description": "",
"schema": {
"type": "integer",
"format": "int32"
@@ -3268,6 +3531,7 @@
{
"name": "seriesId",
"in": "query",
+ "description": "",
"schema": {
"type": "integer",
"format": "int32"
@@ -3276,6 +3540,7 @@
{
"name": "volumeId",
"in": "query",
+ "description": "",
"schema": {
"type": "integer",
"format": "int32"
@@ -3284,6 +3549,7 @@
{
"name": "chapterId",
"in": "query",
+ "description": "",
"schema": {
"type": "integer",
"format": "int32"
@@ -3292,6 +3558,7 @@
{
"name": "pageNumber",
"in": "query",
+ "description": "",
"schema": {
"type": "integer",
"format": "int32"
@@ -3393,6 +3660,13 @@
"type": "integer",
"format": "int32"
}
+ },
+ {
+ "name": "apiKey",
+ "in": "query",
+ "schema": {
+ "type": "string"
+ }
}
],
"responses": {
@@ -3428,6 +3702,14 @@
"format": "int32"
}
},
+ {
+ "name": "apiKey",
+ "in": "query",
+ "description": "User's API Key for authentication",
+ "schema": {
+ "type": "string"
+ }
+ },
{
"name": "extractPdf",
"in": "query",
@@ -3445,6 +3727,43 @@
}
}
},
+ "/api/Reader/thumbnail": {
+ "get": {
+ "tags": [
+ "Reader"
+ ],
+ "parameters": [
+ {
+ "name": "chapterId",
+ "in": "query",
+ "schema": {
+ "type": "integer",
+ "format": "int32"
+ }
+ },
+ {
+ "name": "pageNum",
+ "in": "query",
+ "schema": {
+ "type": "integer",
+ "format": "int32"
+ }
+ },
+ {
+ "name": "apiKey",
+ "in": "query",
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Success"
+ }
+ }
+ }
+ },
"/api/Reader/bookmark-image": {
"get": {
"tags": [
@@ -3553,6 +3872,7 @@
"Reader"
],
"summary": "Returns various information about a Chapter. Side effect: This will cache the chapter images for reading.",
+ "description": "This is generally the first call when attempting to read to allow pre-generation of assets needed for reading",
"parameters": [
{
"name": "chapterId",
@@ -3621,6 +3941,15 @@
"type": "integer",
"format": "int32"
}
+ },
+ {
+ "name": "includeDimensions",
+ "in": "query",
+ "description": "Include file dimensions (extra I/O). Defaults to true.",
+ "schema": {
+ "type": "boolean",
+ "default": true
+ }
}
],
"responses": {
@@ -4066,56 +4395,6 @@
}
}
},
- "/api/Reader/mark-chapter-until-as-read": {
- "post": {
- "tags": [
- "Reader"
- ],
- "summary": "Marks every chapter that is sorted below the passed number as Read. This will not mark any specials as read.",
- "description": "This is built for Tachiyomi and is not expected to be called by any other place",
- "parameters": [
- {
- "name": "seriesId",
- "in": "query",
- "schema": {
- "type": "integer",
- "format": "int32"
- }
- },
- {
- "name": "chapterNumber",
- "in": "query",
- "schema": {
- "type": "number",
- "format": "float"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "Success",
- "content": {
- "text/plain": {
- "schema": {
- "type": "boolean"
- }
- },
- "application/json": {
- "schema": {
- "type": "boolean"
- }
- },
- "text/json": {
- "schema": {
- "type": "boolean"
- }
- }
- }
- }
- },
- "deprecated": true
- }
- },
"/api/Reader/chapter-bookmarks": {
"get": {
"tags": [
@@ -4728,6 +5007,15 @@
"type": "boolean",
"default": true
}
+ },
+ {
+ "name": "sortByLastModified",
+ "in": "query",
+ "description": "Sort by last modified (most recent first) or by title (alphabetical)",
+ "schema": {
+ "type": "boolean",
+ "default": false
+ }
}
],
"responses": {
@@ -5198,6 +5486,56 @@
}
}
},
+ "/api/ReadingList/characters": {
+ "get": {
+ "tags": [
+ "ReadingList"
+ ],
+ "summary": "Returns a list of characters associated with the reading list",
+ "parameters": [
+ {
+ "name": "readingListId",
+ "in": "query",
+ "description": "",
+ "schema": {
+ "type": "integer",
+ "format": "int32"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Success",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/PersonDto"
+ }
+ }
+ },
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/PersonDto"
+ }
+ }
+ },
+ "text/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/PersonDto"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
"/api/ReadingList/next-chapter": {
"get": {
"tags": [
@@ -7040,19 +7378,6 @@
}
}
},
- "/api/Server/restart": {
- "post": {
- "tags": [
- "Server"
- ],
- "summary": "Attempts to Restart the server. Does not work, will shutdown the instance.",
- "responses": {
- "200": {
- "description": "Success"
- }
- }
- }
- },
"/api/Server/clear-cache": {
"post": {
"tags": [
@@ -7166,6 +7491,7 @@
"tags": [
"Server"
],
+ "summary": "Downloads all the log files via a zip",
"responses": {
"200": {
"description": "Success"
@@ -7208,6 +7534,7 @@
"tags": [
"Server"
],
+ "summary": "Pull the Changelog for Kavita from Github and display",
"responses": {
"200": {
"description": "Success",
@@ -7277,6 +7604,7 @@
"tags": [
"Server"
],
+ "summary": "Returns a list of reoccurring jobs. Scheduled ad-hoc jobs will not be returned.",
"responses": {
"200": {
"description": "Success",
@@ -7371,25 +7699,54 @@
"tags": [
"Settings"
],
- "requestBody": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ServerSettingDto"
- }
- },
- "text/json": {
- "schema": {
- "$ref": "#/components/schemas/ServerSettingDto"
- }
- },
- "application/*+json": {
- "schema": {
- "$ref": "#/components/schemas/ServerSettingDto"
- }
- }
- }
- },
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ServerSettingDto"
+ }
+ },
+ "text/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ServerSettingDto"
+ }
+ },
+ "application/*+json": {
+ "schema": {
+ "$ref": "#/components/schemas/ServerSettingDto"
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Success",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "$ref": "#/components/schemas/ServerSettingDto"
+ }
+ },
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ServerSettingDto"
+ }
+ },
+ "text/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ServerSettingDto"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/api/Settings/reset": {
+ "post": {
+ "tags": [
+ "Settings"
+ ],
"responses": {
"200": {
"description": "Success",
@@ -7414,11 +7771,12 @@
}
}
},
- "/api/Settings/reset": {
+ "/api/Settings/reset-ip-addresses": {
"post": {
"tags": [
"Settings"
],
+ "summary": "Resets the IP Addresses",
"responses": {
"200": {
"description": "Success",
@@ -7443,12 +7801,12 @@
}
}
},
- "/api/Settings/reset-ip-addresses": {
+ "/api/Settings/reset-base-url": {
"post": {
"tags": [
"Settings"
],
- "summary": "Resets the IP Addresses",
+ "summary": "Resets the Base url",
"responses": {
"200": {
"description": "Success",
@@ -8740,43 +9098,17 @@
"tags": [
"Users"
],
- "responses": {
- "200": {
- "description": "Success",
- "content": {
- "text/plain": {
- "schema": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/MemberDto"
- }
- }
- },
- "application/json": {
- "schema": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/MemberDto"
- }
- }
- },
- "text/json": {
- "schema": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/MemberDto"
- }
- }
- }
+ "summary": "Returns all users of this server",
+ "parameters": [
+ {
+ "name": "includePending",
+ "in": "query",
+ "description": "This will include pending members",
+ "schema": {
+ "type": "boolean",
+ "default": false
}
}
- }
- }
- },
- "/api/Users/pending": {
- "get": {
- "tags": [
- "Users"
],
"responses": {
"200": {
@@ -9592,6 +9924,9 @@
"bookReaderReadingDirection": {
"$ref": "#/components/schemas/ReadingDirection"
},
+ "bookReaderWritingStyle": {
+ "$ref": "#/components/schemas/WritingStyle"
+ },
"theme": {
"$ref": "#/components/schemas/SiteTheme"
},
@@ -9622,6 +9957,10 @@
"type": "boolean",
"description": "UI Site Global Setting: Should Kavita disable CSS transitions"
},
+ "collapseSeriesRelationships": {
+ "type": "boolean",
+ "description": "UI Site Global Setting: When showing series, only parent series or series with no relationships will be returned"
+ },
"appUser": {
"$ref": "#/components/schemas/AppUser"
},
@@ -9892,6 +10231,23 @@
"pages": {
"type": "integer",
"format": "int32"
+ },
+ "pageDimensions": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/FileDimensionDto"
+ },
+ "description": "List of all files with their inner archive structure maintained in filename and dimensions",
+ "nullable": true
+ },
+ "doublePairs": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "integer",
+ "format": "int32"
+ },
+ "description": "For Double Page reader, this will contain snap points to ensure the reader always resumes on correct page",
+ "nullable": true
}
},
"additionalProperties": false
@@ -9910,6 +10266,105 @@
},
"additionalProperties": false
},
+ "CblBookResult": {
+ "type": "object",
+ "properties": {
+ "order": {
+ "type": "integer",
+ "description": "Order in the CBL",
+ "format": "int32"
+ },
+ "series": {
+ "type": "string",
+ "nullable": true
+ },
+ "volume": {
+ "type": "string",
+ "nullable": true
+ },
+ "number": {
+ "type": "string",
+ "nullable": true
+ },
+ "libraryId": {
+ "type": "integer",
+ "description": "Used on Series conflict",
+ "format": "int32"
+ },
+ "seriesId": {
+ "type": "integer",
+ "description": "Used on Series conflict",
+ "format": "int32"
+ },
+ "readingListName": {
+ "type": "string",
+ "description": "The name of the reading list",
+ "nullable": true
+ },
+ "reason": {
+ "$ref": "#/components/schemas/CblImportReason"
+ }
+ },
+ "additionalProperties": false
+ },
+ "CblImportReason": {
+ "enum": [
+ 0,
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8,
+ 9
+ ],
+ "type": "integer",
+ "format": "int32"
+ },
+ "CblImportResult": {
+ "enum": [
+ 0,
+ 1,
+ 2
+ ],
+ "type": "integer",
+ "format": "int32"
+ },
+ "CblImportSummaryDto": {
+ "type": "object",
+ "properties": {
+ "cblName": {
+ "type": "string",
+ "nullable": true
+ },
+ "fileName": {
+ "type": "string",
+ "description": "Used only for Kavita's UI, the filename of the cbl",
+ "nullable": true
+ },
+ "results": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/CblBookResult"
+ },
+ "nullable": true
+ },
+ "success": {
+ "$ref": "#/components/schemas/CblImportResult"
+ },
+ "successfulInserts": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/CblBookResult"
+ },
+ "nullable": true
+ }
+ },
+ "additionalProperties": false,
+ "description": "Represents the summary from the Import of a given CBL"
+ },
"Chapter": {
"type": "object",
"properties": {
@@ -11439,7 +11894,11 @@
},
"manageCollections": {
"type": "boolean",
- "description": "Should this library create and manage collections from Metadata"
+ "description": "Should this library create collections from Metadata"
+ },
+ "manageReadingLists": {
+ "type": "boolean",
+ "description": "Should this library create reading lists from Metadata"
},
"created": {
"type": "string",
@@ -11526,6 +11985,10 @@
"type": "boolean",
"description": "Should this library create and manage collections from Metadata"
},
+ "manageReadingLists": {
+ "type": "boolean",
+ "description": "Should this library create and manage reading lists from Metadata"
+ },
"includeInSearch": {
"type": "boolean",
"description": "Include library series in Search"
@@ -11536,6 +11999,10 @@
"type": "string"
},
"nullable": true
+ },
+ "collapseSeriesRelationships": {
+ "type": "boolean",
+ "description": "When showing series, only parent series or series with no relationships will be returned"
}
},
"additionalProperties": false
@@ -11779,6 +12246,10 @@
"type": "string",
"nullable": true
},
+ "isPending": {
+ "type": "boolean",
+ "description": "If the member is still pending or not"
+ },
"ageRestriction": {
"$ref": "#/components/schemas/AgeRestrictionDto"
},
@@ -11822,9 +12293,6 @@
"password": {
"type": "string",
"nullable": true
- },
- "sendEmail": {
- "type": "boolean"
}
},
"additionalProperties": false
@@ -11950,6 +12418,10 @@
"type": "string",
"description": "For EPUB reader, this can be an optional string of the id of a part marker, to help resume reading position\r\non pages that combine multiple \"chapters\".",
"nullable": true
+ },
+ "lastModifiedUtc": {
+ "type": "string",
+ "format": "date-time"
}
},
"additionalProperties": false
@@ -12108,6 +12580,26 @@
"type": "string",
"format": "date-time"
},
+ "startingYear": {
+ "type": "integer",
+ "description": "Minimum Year the Reading List starts",
+ "format": "int32"
+ },
+ "startingMonth": {
+ "type": "integer",
+ "description": "Minimum Month the Reading List starts",
+ "format": "int32"
+ },
+ "endingYear": {
+ "type": "integer",
+ "description": "Maximum Year the Reading List starts",
+ "format": "int32"
+ },
+ "endingMonth": {
+ "type": "integer",
+ "description": "Maximum Month the Reading List starts",
+ "format": "int32"
+ },
"appUserId": {
"type": "integer",
"format": "int32"
@@ -12145,6 +12637,26 @@
"type": "string",
"description": "This is used to tell the UI if it should request a Cover Image or not. If null or empty, it has not been set.",
"nullable": true
+ },
+ "startingYear": {
+ "type": "integer",
+ "description": "Minimum Year the Reading List starts",
+ "format": "int32"
+ },
+ "startingMonth": {
+ "type": "integer",
+ "description": "Minimum Month the Reading List starts",
+ "format": "int32"
+ },
+ "endingYear": {
+ "type": "integer",
+ "description": "Maximum Year the Reading List starts",
+ "format": "int32"
+ },
+ "endingMonth": {
+ "type": "integer",
+ "description": "Maximum Month the Reading List starts",
+ "format": "int32"
}
},
"additionalProperties": false
@@ -12230,11 +12742,11 @@
"type": "string",
"nullable": true
},
- "chapterTitleName": {
+ "volumeNumber": {
"type": "string",
"nullable": true
},
- "volumeNumber": {
+ "chapterTitleName": {
"type": "string",
"nullable": true
},
@@ -12246,6 +12758,10 @@
"type": "integer",
"format": "int32"
},
+ "title": {
+ "type": "string",
+ "nullable": true
+ },
"libraryType": {
"$ref": "#/components/schemas/LibraryType"
},
@@ -12253,10 +12769,6 @@
"type": "string",
"nullable": true
},
- "title": {
- "type": "string",
- "nullable": true
- },
"releaseDate": {
"type": "string",
"description": "Release Date from Chapter",
@@ -13104,7 +13616,7 @@
},
"maxCount": {
"type": "integer",
- "description": "Max number of issues/volumes in the series (Max of Volume/Issue field in ComicInfo)",
+ "description": "Max number of issues/volumes in the series (Max of Volume/Number field in ComicInfo)",
"format": "int32"
},
"publicationStatus": {
@@ -13833,6 +14345,11 @@
"description": "Name of the Theme",
"nullable": true
},
+ "normalizedName": {
+ "type": "string",
+ "description": "Normalized name for lookups",
+ "nullable": true
+ },
"fileName": {
"type": "string",
"description": "File path to the content. Stored under API.Services.DirectoryService.SiteThemeDirectory.\r\nMust be a .css file",
@@ -14077,6 +14594,7 @@
"includeInRecommended",
"includeInSearch",
"manageCollections",
+ "manageReadingLists",
"name",
"type"
],
@@ -14113,6 +14631,9 @@
},
"manageCollections": {
"type": "boolean"
+ },
+ "manageReadingLists": {
+ "type": "boolean"
}
},
"additionalProperties": false
@@ -14300,6 +14821,22 @@
},
"coverImageLocked": {
"type": "boolean"
+ },
+ "startingMonth": {
+ "type": "integer",
+ "format": "int32"
+ },
+ "startingYear": {
+ "type": "integer",
+ "format": "int32"
+ },
+ "endingMonth": {
+ "type": "integer",
+ "format": "int32"
+ },
+ "endingYear": {
+ "type": "integer",
+ "format": "int32"
}
},
"additionalProperties": false
@@ -14590,12 +15127,15 @@
"additionalProperties": false
},
"UploadUrlDto": {
+ "required": [
+ "url"
+ ],
"type": "object",
"properties": {
"url": {
+ "minLength": 1,
"type": "string",
- "description": "External url",
- "nullable": true
+ "description": "External url"
}
},
"additionalProperties": false
@@ -14628,6 +15168,10 @@
},
"ageRestriction": {
"$ref": "#/components/schemas/AgeRestrictionDto"
+ },
+ "kavitaVersion": {
+ "type": "string",
+ "nullable": true
}
},
"additionalProperties": false
@@ -14659,6 +15203,8 @@
"bookReaderReadingDirection",
"bookReaderTapToPaginate",
"bookReaderThemeName",
+ "bookReaderWritingStyle",
+ "collapseSeriesRelationships",
"emulateBook",
"globalPageLayoutMode",
"layoutMode",
@@ -14669,7 +15215,8 @@
"readingDirection",
"scalingOption",
"showScreenHints",
- "swipeToPaginate"
+ "swipeToPaginate",
+ "theme"
],
"type": "object",
"properties": {
@@ -14698,7 +15245,8 @@
"description": "Manga Reader Option: Background color of the reader"
},
"swipeToPaginate": {
- "type": "boolean"
+ "type": "boolean",
+ "description": "Manga Reader Option: Should swiping trigger pagination"
},
"autoCloseMenu": {
"type": "boolean",
@@ -14735,6 +15283,9 @@
"bookReaderReadingDirection": {
"$ref": "#/components/schemas/ReadingDirection"
},
+ "bookReaderWritingStyle": {
+ "$ref": "#/components/schemas/WritingStyle"
+ },
"theme": {
"$ref": "#/components/schemas/SiteTheme"
},
@@ -14763,6 +15314,10 @@
"noTransitions": {
"type": "boolean",
"description": "UI Site Global Setting: Should Kavita disable CSS transitions"
+ },
+ "collapseSeriesRelationships": {
+ "type": "boolean",
+ "description": "When showing series, only parent series or series with no relationships will be returned"
}
},
"additionalProperties": false
@@ -14940,6 +15495,15 @@
}
},
"additionalProperties": false
+ },
+ "WritingStyle": {
+ "enum": [
+ 0,
+ 1
+ ],
+ "type": "integer",
+ "description": "Represents the writing styles for the book-reader",
+ "format": "int32"
}
},
"securitySchemes": {
@@ -14961,6 +15525,10 @@
"name": "Account",
"description": "All Account matters"
},
+ {
+ "name": "Cbl",
+ "description": "Responsible for the CBL import flow"
+ },
{
"name": "Collection",
"description": "APIs for Collections"