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.
C# annotationscbzcomicinfocomicscomics-readercross-platformcsharpepubepub-readerfreelinuxmangamedia-servermetadataopdsopds-feedpdfself-hostedubooquitywindows
v0.5.3 - Book Reader Enhancements, Related Series, and More! (#1272)
Joseph Milazzof9b3f1aeb5bf
diff --git a/.gitignore b/.gitignoreindex c8d68977f..eec036cbe 100644--- a/.gitignore+++ b/.gitignore@@ -517,10 +517,12 @@ UI/Web/dist//API/config/kavita.db-shm/API/config/kavita.db-wal/API/config/kavita.db-journal+/API/config/*.db+/API/config/*.bak+/API/config/*.backup/API/config/Hangfire.db/API/config/Hangfire-log.dbAPI/config/covers/-API/config/*.dbAPI/config/stats/*API/config/stats/app_stats.jsonAPI/config/pre-metadata/diff --git a/API.Benchmark/ParseScannedFilesBenchmarks.cs b/API.Benchmark/ParseScannedFilesBenchmarks.csindex 7c244a5d4..1dcca79b9 100644--- a/API.Benchmark/ParseScannedFilesBenchmarks.cs+++ b/API.Benchmark/ParseScannedFilesBenchmarks.cs@@ -1,5 +1,6 @@using System.IO;using System.IO.Abstractions;+using System.Threading.Tasks;using API.Entities.Enums;using API.Parser;using API.Services;@@ -46,7 +47,7 @@ namespace API.Benchmark/// Generate a list of Series and another list with/// </summary>[Benchmark]- public void MergeName()+ public async Task MergeName(){var libraryPath = Path.Join(Directory.GetCurrentDirectory(),"../../../Services/Test Data/ScannerService/Manga");@@ -61,7 +62,7 @@ namespace API.BenchmarkTitle = "A Town Where You Live",Volumes = "1"};- _parseScannedFiles.ScanLibrariesForSeries(LibraryType.Manga, new [] {libraryPath}, "Manga");+ await _parseScannedFiles.ScanLibrariesForSeries(LibraryType.Manga, new [] {libraryPath}, "Manga");_parseScannedFiles.MergeName(p1);}}diff --git a/API.Tests/API.Tests.csproj b/API.Tests/API.Tests.csprojindex 3b4b8cb94..708e253c0 100644--- a/API.Tests/API.Tests.csproj+++ b/API.Tests/API.Tests.csproj@@ -7,10 +7,10 @@</PropertyGroup><ItemGroup>- <PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="6.0.3" />+ <PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="6.0.4" /><PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" /><PackageReference Include="NSubstitute" Version="4.3.0" />- <PackageReference Include="System.IO.Abstractions.TestingHelpers" Version="16.1.25" />+ <PackageReference Include="System.IO.Abstractions.TestingHelpers" Version="17.0.3" /><PackageReference Include="xunit" Version="2.4.1" /><PackageReference Include="xunit.runner.visualstudio" Version="2.4.3"><IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>diff --git a/API.Tests/Comparers/ChapterSortComparerZeroFirstTests.cs b/API.Tests/Comparers/ChapterSortComparerZeroFirstTests.csindex 72d6908c6..df3934884 100644--- a/API.Tests/Comparers/ChapterSortComparerZeroFirstTests.cs+++ b/API.Tests/Comparers/ChapterSortComparerZeroFirstTests.cs@@ -14,4 +14,11 @@ public class ChapterSortComparerZeroFirstTests{Assert.Equal(expected, input.OrderBy(f => f, new ChapterSortComparerZeroFirst()).ToArray());}++ [Theory]+ [InlineData(new[] {1.0, 0.5, 0.3}, new[] {0.3, 0.5, 1.0})]+ public void ChapterSortComparerZeroFirstTest_Doubles(double[] input, double[] expected)+ {+ Assert.Equal(expected, input.OrderBy(f => f, new ChapterSortComparerZeroFirst()).ToArray());+ }}diff --git a/API.Tests/Comparers/NumericComparerTests.cs b/API.Tests/Comparers/NumericComparerTests.csindex 9a66e7666..8a1f23773 100644--- a/API.Tests/Comparers/NumericComparerTests.cs+++ b/API.Tests/Comparers/NumericComparerTests.cs@@ -11,6 +11,10 @@ public class NumericComparerTestsnew[] {"x1.jpg", "x10.jpg", "x3.jpg", "x4.jpg", "x11.jpg"},new[] {"x1.jpg", "x3.jpg", "x4.jpg", "x10.jpg", "x11.jpg"})]+ [InlineData(+ new[] {"x1.0.jpg", "0.5.jpg", "0.3.jpg"},+ new[] {"0.3.jpg", "0.5.jpg", "x1.0.jpg",}+ )]public void NumericComparerTest(string[] input, string[] expected){var nc = new NumericComparer();diff --git a/API.Tests/Entities/ComicInfoTests.cs b/API.Tests/Entities/ComicInfoTests.csindex 7b7106eb9..325299cf8 100644--- a/API.Tests/Entities/ComicInfoTests.cs+++ b/API.Tests/Entities/ComicInfoTests.cs@@ -16,7 +16,7 @@ public class ComicInfoTests[InlineData("Early Childhood", AgeRating.EarlyChildhood)][InlineData("Everyone 10+", AgeRating.Everyone10Plus)][InlineData("M", AgeRating.Mature)]- [InlineData("MA 15+", AgeRating.Mature15Plus)]+ [InlineData("MA15+", AgeRating.Mature15Plus)][InlineData("Mature 17+", AgeRating.Mature17Plus)][InlineData("Rating Pending", AgeRating.RatingPending)][InlineData("X18+", AgeRating.X18Plus)]diff --git a/API.Tests/Extensions/ChapterListExtensionsTests.cs b/API.Tests/Extensions/ChapterListExtensionsTests.csindex 845b1387b..a1beddf09 100644--- a/API.Tests/Extensions/ChapterListExtensionsTests.cs+++ b/API.Tests/Extensions/ChapterListExtensionsTests.cs@@ -1,4 +1,4 @@-using System.Collections.Generic;+using System.Collections.Generic;using System.Linq;using API.Entities;using API.Entities.Enums;@@ -83,9 +83,37 @@ namespace API.Tests.ExtensionsAssert.Equal(chapterList[0], actualChapter);}+ [Fact]+ public void GetChapterByRange_On_Duplicate_Files_Test_Should_Not_Error()+ {+ var info = new ParserInfo()+ {+ Chapters = "0",+ Edition = "",+ Format = MangaFormat.Archive,+ FullFilePath = "/manga/detective comics #001.cbz",+ Filename = "detective comics #001.cbz",+ IsSpecial = true,+ Series = "detective comics",+ Title = "detective comics",+ Volumes = "0"+ };++ var chapterList = new List<Chapter>()+ {+ CreateChapter("detective comics", "0", CreateFile("/manga/detective comics #001.cbz", MangaFormat.Archive), true),+ CreateChapter("detective comics", "0", CreateFile("/manga/detective comics #001.cbz", MangaFormat.Archive), true)+ };++ var actualChapter = chapterList.GetChapterByRange(info);++ Assert.Equal(chapterList[0], actualChapter);++ }+#region GetFirstChapterWithFiles- [Fact]+ [Fact]public void GetFirstChapterWithFiles_ShouldReturnAllChapters(){var chapterList = new List<Chapter>()diff --git a/API.Tests/Extensions/VolumeListExtensionsTests.cs b/API.Tests/Extensions/VolumeListExtensionsTests.csindex 48d39aa24..264437ecd 100644--- a/API.Tests/Extensions/VolumeListExtensionsTests.cs+++ b/API.Tests/Extensions/VolumeListExtensionsTests.cs@@ -9,67 +9,6 @@ namespace API.Tests.Extensions;public class VolumeListExtensionsTests{- #region FirstWithChapters-- [Fact]- public void FirstWithChapters_ReturnsVolumeWithChapters()- {- var volumes = new List<Volume>()- {- EntityFactory.CreateVolume("0", new List<Chapter>()),- EntityFactory.CreateVolume("1", new List<Chapter>()- {- EntityFactory.CreateChapter("1", false),- EntityFactory.CreateChapter("2", false),- }),- };-- Assert.Equal(volumes[1].Number, volumes.FirstWithChapters(false).Number);- Assert.Equal(volumes[1].Number, volumes.FirstWithChapters(true).Number);- }-- [Fact]- public void FirstWithChapters_Book()- {- 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),- }),- };-- Assert.Equal(volumes[0].Number, volumes.FirstWithChapters(true).Number);- }-- [Fact]- public void FirstWithChapters_NonBook()- {- 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),- }),- };-- Assert.Equal(volumes[0].Number, volumes.FirstWithChapters(false).Number);- }-- #endregion-#region GetCoverImage[Fact]diff --git a/API.Tests/Helpers/EntityFactory.cs b/API.Tests/Helpers/EntityFactory.csindex e98cd5730..3632ff9a0 100644--- a/API.Tests/Helpers/EntityFactory.cs+++ b/API.Tests/Helpers/EntityFactory.cs@@ -31,7 +31,7 @@ namespace API.Tests.Helpersreturn new Volume(){Name = volumeNumber,- Number = (int) API.Parser.Parser.MinimumNumberFromRange(volumeNumber),+ Number = (int) API.Parser.Parser.MinNumberFromRange(volumeNumber),Pages = pages,Chapters = chaps};@@ -43,7 +43,7 @@ namespace API.Tests.Helpers{IsSpecial = isSpecial,Range = range,- Number = API.Parser.Parser.MinimumNumberFromRange(range) + string.Empty,+ Number = API.Parser.Parser.MinNumberFromRange(range) + string.Empty,Files = files ?? new List<MangaFile>(),Pages = pageCount,diff --git a/API.Tests/Parser/DefaultParserTests.cs b/API.Tests/Parser/DefaultParserTests.csindex 200a6b16a..f32838dd3 100644--- a/API.Tests/Parser/DefaultParserTests.cs+++ b/API.Tests/Parser/DefaultParserTests.cs@@ -122,7 +122,7 @@ public class DefaultParserTestsfilepath = @"E:\Manga\Tenjo Tenge (Color)\Tenjo Tenge {Full Contact Edition} v01 (2011) (Digital) (ASTC).cbz";expected.Add(filepath, new ParserInfo{- Series = "Tenjo Tenge", Volumes = "1", Edition = "Full Contact Edition",+ Series = "Tenjo Tenge {Full Contact Edition}", Volumes = "1", Edition = "",Chapters = "0", Filename = "Tenjo Tenge {Full Contact Edition} v01 (2011) (Digital) (ASTC).cbz", Format = MangaFormat.Archive,FullFilePath = filepath});diff --git a/API.Tests/Parser/MangaParserTests.cs b/API.Tests/Parser/MangaParserTests.csindex 34c41015c..a3d298e82 100644--- a/API.Tests/Parser/MangaParserTests.cs+++ b/API.Tests/Parser/MangaParserTests.cs@@ -169,6 +169,8 @@ namespace API.Tests.Parser[InlineData("Love Hina - Volume 01 [Scans].pdf", "Love Hina")][InlineData("It's Witching Time! 001 (Digital) (Anonymous1234)", "It's Witching Time!")][InlineData("Zettai Karen Children v02 c003 - The Invisible Guardian (2) [JS Scans]", "Zettai Karen Children")]+ [InlineData("My Charms Are Wasted on Kuroiwa Medaka - Ch. 37.5 - Volume Extras", "My Charms Are Wasted on Kuroiwa Medaka")]+ [InlineData("Highschool of the Dead - Full Color Edition v02 [Uasaha] (Yen Press)", "Highschool of the Dead - Full Color Edition")]public void ParseSeriesTest(string filename, string expected){Assert.Equal(expected, API.Parser.Parser.ParseSeries(filename));@@ -252,13 +254,13 @@ namespace API.Tests.Parser[Theory][InlineData("Tenjou Tenge Omnibus", "Omnibus")]- [InlineData("Tenjou Tenge {Full Contact Edition}", "Full Contact Edition")]- [InlineData("Tenjo Tenge {Full Contact Edition} v01 (2011) (Digital) (ASTC).cbz", "Full Contact Edition")]+ [InlineData("Tenjou Tenge {Full Contact Edition}", "")]+ [InlineData("Tenjo Tenge {Full Contact Edition} v01 (2011) (Digital) (ASTC).cbz", "")][InlineData("Wotakoi - Love is Hard for Otaku Omnibus v01 (2018) (Digital) (danke-Empire)", "Omnibus")][InlineData("To Love Ru v01 Uncensored (Ch.001-007)", "Uncensored")][InlineData("Chobits Omnibus Edition v01 [Dark Horse]", "Omnibus Edition")][InlineData("[dmntsf.net] One Piece - Digital Colored Comics Vol. 20 Ch. 177 - 30 Million vs 81 Million.cbz", "")]- [InlineData("AKIRA - c003 (v01) [Full Color] [Darkhorse].cbz", "Full Color")]+ [InlineData("AKIRA - c003 (v01) [Full Color] [Darkhorse].cbz", "")][InlineData("Love Hina Omnibus v05 (2015) (Digital-HD) (Asgard-Empire).cbz", "Omnibus")]public void ParseEditionTest(string input, string expected){diff --git a/API.Tests/Parser/ParserTest.cs b/API.Tests/Parser/ParserTest.csindex ff1b4dc71..4ae75d91b 100644--- a/API.Tests/Parser/ParserTest.cs+++ b/API.Tests/Parser/ParserTest.cs@@ -63,6 +63,7 @@ namespace API.Tests.Parser[InlineData("- The Title", false, "The Title")][InlineData("[Suihei Kiki]_Kasumi_Otoko_no_Ko_[Taruby]_v1.1", false, "Kasumi Otoko no Ko v1.1")][InlineData("Batman - Detective Comics - Rebirth Deluxe Edition Book 04 (2019) (digital) (Son of Ultron-Empire)", true, "Batman - Detective Comics - Rebirth Deluxe Edition")]+ [InlineData("Something - Full Color Edition", false, "Something - Full Color Edition")]public void CleanTitleTest(string input, bool isComic, string expected){Assert.Equal(expected, CleanTitle(input, isComic));@@ -139,7 +140,7 @@ namespace API.Tests.Parser[InlineData("40.1_a", 0)]public void MinimumNumberFromRangeTest(string input, float expected){- Assert.Equal(expected, MinimumNumberFromRange(input));+ Assert.Equal(expected, MinNumberFromRange(input));}[Theory]@@ -152,7 +153,7 @@ namespace API.Tests.Parser[InlineData("40.1_a", 0)]public void MaximumNumberFromRangeTest(string input, float expected){- Assert.Equal(expected, MaximumNumberFromRange(input));+ Assert.Equal(expected, MaxNumberFromRange(input));}[Theory]@@ -179,6 +180,7 @@ namespace API.Tests.Parser[InlineData(".test.jpg", false)][InlineData("!test.jpg", true)][InlineData("test.webp", true)]+ [InlineData("test.gif", true)]public void IsImageTest(string filename, bool expected){Assert.Equal(expected, IsImage(filename));@@ -197,6 +199,7 @@ namespace API.Tests.Parser[InlineData("ch1/cover.png", true)][InlineData("ch1/backcover.png", false)][InlineData("backcover.png", false)]+ [InlineData("back_cover.png", false)]public void IsCoverImageTest(string inputPath, bool expected){Assert.Equal(expected, IsCoverImage(inputPath));diff --git a/API.Tests/Services/BookmarkServiceTests.cs b/API.Tests/Services/BookmarkServiceTests.csindex 0026ea678..13acf3684 100644--- a/API.Tests/Services/BookmarkServiceTests.cs+++ b/API.Tests/Services/BookmarkServiceTests.cs@@ -389,7 +389,7 @@ public class BookmarkServiceTestsVolumeId = 1}, $"{CacheDirectory}1/0001.jpg");- var files = await bookmarkService.GetBookmarkFilesById(1, new[] {1});+ var files = await bookmarkService.GetBookmarkFilesById(new[] {1});var actualFiles = ds.GetFiles(BookmarkDirectory, searchOption: SearchOption.AllDirectories);Assert.Equal(files.Select(API.Parser.Parser.NormalizePath).ToList(), actualFiles.Select(API.Parser.Parser.NormalizePath).ToList());}diff --git a/API.Tests/Services/CacheServiceTests.cs b/API.Tests/Services/CacheServiceTests.csindex 7a2cbada8..d5a8d4bee 100644--- a/API.Tests/Services/CacheServiceTests.cs+++ b/API.Tests/Services/CacheServiceTests.cs@@ -157,7 +157,8 @@ namespace API.Tests.Servicesfilesystem.AddDirectory($"{CacheDirectory}1/");var ds = new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), filesystem);var cleanupService = new CacheService(_logger, _unitOfWork, ds,- new ReadingItemService(Substitute.For<IArchiveService>(), Substitute.For<IBookService>(), Substitute.For<IImageService>(), ds));+ new ReadingItemService(Substitute.For<IArchiveService>(),+ Substitute.For<IBookService>(), Substitute.For<IImageService>(), ds), Substitute.For<IBookmarkService>());await ResetDB();var s = DbFactory.Series("Test");@@ -240,7 +241,8 @@ namespace API.Tests.Servicesfilesystem.AddFile($"{CacheDirectory}3/003.jpg", new MockFileData(""));var ds = new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), filesystem);var cleanupService = new CacheService(_logger, _unitOfWork, ds,- new ReadingItemService(Substitute.For<IArchiveService>(), Substitute.For<IBookService>(), Substitute.For<IImageService>(), ds));+ new ReadingItemService(Substitute.For<IArchiveService>(),+ Substitute.For<IBookService>(), Substitute.For<IImageService>(), ds), Substitute.For<IBookmarkService>());cleanupService.CleanupChapters(new []{1, 3});Assert.Empty(ds.GetFiles(CacheDirectory, searchOption:SearchOption.AllDirectories));@@ -260,7 +262,8 @@ namespace API.Tests.Servicesfilesystem.AddFile($"{DataDirectory}2.epub", new MockFileData(""));var ds = new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), filesystem);var cs = new CacheService(_logger, _unitOfWork, ds,- new ReadingItemService(Substitute.For<IArchiveService>(), Substitute.For<IBookService>(), Substitute.For<IImageService>(), ds));+ new ReadingItemService(Substitute.For<IArchiveService>(),+ Substitute.For<IBookService>(), Substitute.For<IImageService>(), ds), Substitute.For<IBookmarkService>());var c = new Chapter(){@@ -311,7 +314,8 @@ namespace API.Tests.Servicesvar ds = new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), filesystem);var cs = new CacheService(_logger, _unitOfWork, ds,- new ReadingItemService(Substitute.For<IArchiveService>(), Substitute.For<IBookService>(), Substitute.For<IImageService>(), ds));+ new ReadingItemService(Substitute.For<IArchiveService>(),+ Substitute.For<IBookService>(), Substitute.For<IImageService>(), ds), Substitute.For<IBookmarkService>());// Flatten to prepare for how GetFullPath expectsds.Flatten($"{CacheDirectory}1/");@@ -362,7 +366,8 @@ namespace API.Tests.Servicesvar ds = new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), filesystem);var cs = new CacheService(_logger, _unitOfWork, ds,- new ReadingItemService(Substitute.For<IArchiveService>(), Substitute.For<IBookService>(), Substitute.For<IImageService>(), ds));+ new ReadingItemService(Substitute.For<IArchiveService>(),+ Substitute.For<IBookService>(), Substitute.For<IImageService>(), ds), Substitute.For<IBookmarkService>());// Flatten to prepare for how GetFullPath expectsds.Flatten($"{CacheDirectory}1/");@@ -408,7 +413,8 @@ namespace API.Tests.Servicesvar ds = new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), filesystem);var cs = new CacheService(_logger, _unitOfWork, ds,- new ReadingItemService(Substitute.For<IArchiveService>(), Substitute.For<IBookService>(), Substitute.For<IImageService>(), ds));+ new ReadingItemService(Substitute.For<IArchiveService>(),+ Substitute.For<IBookService>(), Substitute.For<IImageService>(), ds), Substitute.For<IBookmarkService>());// Flatten to prepare for how GetFullPath expectsds.Flatten($"{CacheDirectory}1/");@@ -460,7 +466,8 @@ namespace API.Tests.Servicesvar ds = new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), filesystem);var cs = new CacheService(_logger, _unitOfWork, ds,- new ReadingItemService(Substitute.For<IArchiveService>(), Substitute.For<IBookService>(), Substitute.For<IImageService>(), ds));+ new ReadingItemService(Substitute.For<IArchiveService>(),+ Substitute.For<IBookService>(), Substitute.For<IImageService>(), ds), Substitute.For<IBookmarkService>());// Flatten to prepare for how GetFullPath expectsds.Flatten($"{CacheDirectory}1/");diff --git a/API.Tests/Services/CleanupServiceTests.cs b/API.Tests/Services/CleanupServiceTests.csindex 1dd131112..08d5f29a7 100644--- a/API.Tests/Services/CleanupServiceTests.cs+++ b/API.Tests/Services/CleanupServiceTests.cs@@ -11,6 +11,7 @@ using API.Entities.Enums;using API.Services;using API.Services.Tasks;using API.SignalR;+using API.Tests.Helpers;using AutoMapper;using Microsoft.AspNetCore.SignalR;using Microsoft.Data.Sqlite;@@ -125,23 +126,23 @@ public class CleanupServiceTestspublic async Task DeleteSeriesCoverImages_ShouldDeleteAll(){var filesystem = CreateFileSystem();- filesystem.AddFile($"{CoverImageDirectory}series_01.jpg", new MockFileData(""));- filesystem.AddFile($"{CoverImageDirectory}series_03.jpg", new MockFileData(""));- filesystem.AddFile($"{CoverImageDirectory}series_1000.jpg", new MockFileData(""));+ filesystem.AddFile($"{CoverImageDirectory}{ImageService.GetSeriesFormat(1)}.jpg", new MockFileData(""));+ filesystem.AddFile($"{CoverImageDirectory}{ImageService.GetSeriesFormat(3)}.jpg", new MockFileData(""));+ filesystem.AddFile($"{CoverImageDirectory}{ImageService.GetSeriesFormat(1000)}.jpg", new MockFileData(""));// Delete all Series to reset stateawait ResetDB();var s = DbFactory.Series("Test 1");- s.CoverImage = "series_01.jpg";+ s.CoverImage = $"{ImageService.GetSeriesFormat(1)}.jpg";s.LibraryId = 1;_context.Series.Add(s);s = DbFactory.Series("Test 2");- s.CoverImage = "series_03.jpg";+ s.CoverImage = $"{ImageService.GetSeriesFormat(3)}.jpg";s.LibraryId = 1;_context.Series.Add(s);s = DbFactory.Series("Test 3");- s.CoverImage = "series_1000.jpg";+ s.CoverImage = $"{ImageService.GetSeriesFormat(1000)}.jpg";s.LibraryId = 1;_context.Series.Add(s);@@ -158,20 +159,20 @@ public class CleanupServiceTestspublic async Task DeleteSeriesCoverImages_ShouldNotDeleteLinkedFiles(){var filesystem = CreateFileSystem();- filesystem.AddFile($"{CoverImageDirectory}series_01.jpg", new MockFileData(""));- filesystem.AddFile($"{CoverImageDirectory}series_03.jpg", new MockFileData(""));- filesystem.AddFile($"{CoverImageDirectory}series_1000.jpg", new MockFileData(""));+ filesystem.AddFile($"{CoverImageDirectory}{ImageService.GetSeriesFormat(1)}.jpg", new MockFileData(""));+ filesystem.AddFile($"{CoverImageDirectory}{ImageService.GetSeriesFormat(3)}.jpg", new MockFileData(""));+ filesystem.AddFile($"{CoverImageDirectory}{ImageService.GetSeriesFormat(1000)}.jpg", new MockFileData(""));// Delete all Series to reset stateawait ResetDB();// Add 2 series with cover imagesvar s = DbFactory.Series("Test 1");- s.CoverImage = "series_01.jpg";+ s.CoverImage = $"{ImageService.GetSeriesFormat(1)}.jpg";s.LibraryId = 1;_context.Series.Add(s);s = DbFactory.Series("Test 2");- s.CoverImage = "series_03.jpg";+ s.CoverImage = $"{ImageService.GetSeriesFormat(3)}.jpg";s.LibraryId = 1;_context.Series.Add(s);@@ -242,9 +243,9 @@ public class CleanupServiceTestspublic async Task DeleteTagCoverImages_ShouldNotDeleteLinkedFiles(){var filesystem = CreateFileSystem();- filesystem.AddFile($"{CoverImageDirectory}tag_01.jpg", new MockFileData(""));- filesystem.AddFile($"{CoverImageDirectory}tag_02.jpg", new MockFileData(""));- filesystem.AddFile($"{CoverImageDirectory}tag_1000.jpg", new MockFileData(""));+ filesystem.AddFile($"{CoverImageDirectory}{ImageService.GetCollectionTagFormat(1)}.jpg", new MockFileData(""));+ filesystem.AddFile($"{CoverImageDirectory}{ImageService.GetCollectionTagFormat(2)}.jpg", new MockFileData(""));+ filesystem.AddFile($"{CoverImageDirectory}{ImageService.GetCollectionTagFormat(1000)}.jpg", new MockFileData(""));// Delete all Series to reset stateawait ResetDB();@@ -255,9 +256,9 @@ public class CleanupServiceTestss.Metadata.CollectionTags.Add(new CollectionTag(){Title = "Something",- CoverImage ="tag_01.jpg"+ CoverImage = $"{ImageService.GetCollectionTagFormat(1)}.jpg"});- s.CoverImage = "series_01.jpg";+ s.CoverImage = $"{ImageService.GetSeriesFormat(1)}.jpg";s.LibraryId = 1;_context.Series.Add(s);@@ -266,9 +267,9 @@ public class CleanupServiceTestss.Metadata.CollectionTags.Add(new CollectionTag(){Title = "Something 2",- CoverImage ="tag_02.jpg"+ CoverImage = $"{ImageService.GetCollectionTagFormat(2)}.jpg"});- s.CoverImage = "series_03.jpg";+ s.CoverImage = $"{ImageService.GetSeriesFormat(3)}.jpg";s.LibraryId = 1;_context.Series.Add(s);@@ -285,6 +286,49 @@ public class CleanupServiceTests#endregion+ #region DeleteReadingListCoverImages+ [Fact]+ public async Task DeleteReadingListCoverImages_ShouldNotDeleteLinkedFiles()+ {+ var filesystem = CreateFileSystem();+ filesystem.AddFile($"{CoverImageDirectory}{ImageService.GetReadingListFormat(1)}.jpg", new MockFileData(""));+ filesystem.AddFile($"{CoverImageDirectory}{ImageService.GetReadingListFormat(2)}.jpg", new MockFileData(""));+ filesystem.AddFile($"{CoverImageDirectory}{ImageService.GetReadingListFormat(3)}.jpg", new MockFileData(""));++ // Delete all Series to reset state+ await ResetDB();++ _context.Users.Add(new AppUser()+ {+ UserName = "Joe",+ ReadingLists = new List<ReadingList>()+ {+ new ReadingList()+ {+ Title = "Something",+ NormalizedTitle = API.Parser.Parser.Normalize("Something"),+ CoverImage = $"{ImageService.GetReadingListFormat(1)}.jpg"+ },+ new ReadingList()+ {+ Title = "Something 2",+ NormalizedTitle = API.Parser.Parser.Normalize("Something 2"),+ CoverImage = $"{ImageService.GetReadingListFormat(2)}.jpg"+ }+ }+ });++ await _context.SaveChangesAsync();+ var ds = new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), filesystem);+ var cleanupService = new CleanupService(_logger, _unitOfWork, _messageHub,+ ds);++ await cleanupService.DeleteReadingListCoverImages();++ Assert.Equal(2, ds.GetFiles(CoverImageDirectory).Count());+ }+ #endregion+#region CleanupCacheDirectory[Fact]@@ -320,7 +364,7 @@ public class CleanupServiceTests#region CleanupBackups[Fact]- public void CleanupBackups_LeaveOneFile_SinceAllAreExpired()+ public async Task CleanupBackups_LeaveOneFile_SinceAllAreExpired(){var filesystem = CreateFileSystem();var filesystemFile = new MockFileData("")@@ -334,12 +378,12 @@ public class CleanupServiceTestsvar ds = new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), filesystem);var cleanupService = new CleanupService(_logger, _unitOfWork, _messageHub,ds);- cleanupService.CleanupBackups();+ await cleanupService.CleanupBackups();Assert.Single(ds.GetFiles(BackupDirectory, searchOption: SearchOption.AllDirectories));}[Fact]- public void CleanupBackups_LeaveLestExpired()+ public async Task CleanupBackups_LeaveLestExpired(){var filesystem = CreateFileSystem();var filesystemFile = new MockFileData("")@@ -356,7 +400,7 @@ public class CleanupServiceTestsvar ds = new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), filesystem);var cleanupService = new CleanupService(_logger, _unitOfWork, _messageHub,ds);- cleanupService.CleanupBackups();+ await cleanupService.CleanupBackups();Assert.True(filesystem.File.Exists($"{BackupDirectory}randomfile.zip"));}diff --git a/API.Tests/Services/DirectoryServiceTests.cs b/API.Tests/Services/DirectoryServiceTests.csindex 9a4bef08e..23a7dfad1 100644--- a/API.Tests/Services/DirectoryServiceTests.cs+++ b/API.Tests/Services/DirectoryServiceTests.cs@@ -17,6 +17,7 @@ namespace API.Tests.Services{private readonly ILogger<DirectoryService> _logger = Substitute.For<ILogger<DirectoryService>>();+#region TraverseTreeParallelForEach[Fact]public void TraverseTreeParallelForEach_JustArchives_ShouldBe28()@@ -575,19 +576,22 @@ namespace API.Tests.Services[Fact]public void CopyFilesToDirectory_ShouldAppendWhenTargetFileExists(){+const string testDirectory = "/manga/";var fileSystem = new MockFileSystem();- fileSystem.AddFile($"{testDirectory}file.zip", new MockFileData(""));- fileSystem.AddFile($"/manga/output/file (1).zip", new MockFileData(""));- fileSystem.AddFile($"/manga/output/file (2).zip", new MockFileData(""));+ fileSystem.AddFile(MockUnixSupport.Path($"{testDirectory}file.zip"), new MockFileData(""));+ fileSystem.AddFile(MockUnixSupport.Path($"/manga/output/file (1).zip"), new MockFileData(""));+ fileSystem.AddFile(MockUnixSupport.Path($"/manga/output/file (2).zip"), new MockFileData(""));var ds = new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), fileSystem);- ds.CopyFilesToDirectory(new []{$"{testDirectory}file.zip"}, "/manga/output/");- ds.CopyFilesToDirectory(new []{$"{testDirectory}file.zip"}, "/manga/output/");+ 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.Parser.Parser.NormalizePath).ToList();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- Assert.True(outputFiles.Contains(API.Parser.Parser.NormalizePath("/manga/output/file (3).zip")) || outputFiles.Contains(API.Parser.Parser.NormalizePath("C:/manga/output/file (3).zip")));+ // 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.Parser.Parser.NormalizePath("/manga/output/file (3).zip"))+ || outputFiles.Contains(API.Parser.Parser.NormalizePath("C:/manga/output/file (3).zip")));}#endregiondiff --git a/API.Tests/Services/ReaderServiceTests.cs b/API.Tests/Services/ReaderServiceTests.csindex 8439c69d3..cfb89935a 100644--- a/API.Tests/Services/ReaderServiceTests.cs+++ b/API.Tests/Services/ReaderServiceTests.cs@@ -11,6 +11,7 @@ using API.Entities;using API.Entities.Enums;using API.Helpers;using API.Services;+using API.SignalR;using API.Tests.Helpers;using AutoMapper;using Microsoft.Data.Sqlite;@@ -147,7 +148,7 @@ public class ReaderServiceTestsawait _context.SaveChangesAsync();- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>());+ 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));@@ -191,7 +192,7 @@ public class ReaderServiceTestsawait _context.SaveChangesAsync();- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>());+ var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());var successful = await readerService.SaveReadingProgress(new ProgressDto(){@@ -240,7 +241,7 @@ public class ReaderServiceTestsawait _context.SaveChangesAsync();- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>());+ var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());var successful = await readerService.SaveReadingProgress(new ProgressDto(){@@ -310,7 +311,7 @@ public class ReaderServiceTestsawait _context.SaveChangesAsync();- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>());+ var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());var volumes = await _unitOfWork.VolumeRepository.GetVolumes(1);readerService.MarkChaptersAsRead(await _unitOfWork.UserRepository.GetUserByIdAsync(1, AppUserIncludes.Progress), 1, volumes.First().Chapters);@@ -360,7 +361,7 @@ public class ReaderServiceTestsawait _context.SaveChangesAsync();- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>());+ var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());var volumes = (await _unitOfWork.VolumeRepository.GetVolumes(1)).ToList();readerService.MarkChaptersAsRead(await _unitOfWork.UserRepository.GetUserByIdAsync(1, AppUserIncludes.Progress), 1, volumes.First().Chapters);@@ -420,7 +421,7 @@ public class ReaderServiceTestsawait _context.SaveChangesAsync();- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>());+ var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());var nextChapter = await readerService.GetNextChapterIdAsync(1, 1, 1, 1);var actualChapter = await _unitOfWork.ChapterRepository.GetChapterAsync(nextChapter);@@ -466,7 +467,7 @@ public class ReaderServiceTestsawait _context.SaveChangesAsync();- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>());+ var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());var nextChapter = await readerService.GetNextChapterIdAsync(1, 1, 2, 1);@@ -508,7 +509,7 @@ public class ReaderServiceTestsawait _context.SaveChangesAsync();- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>());+ var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());var nextChapter = await readerService.GetNextChapterIdAsync(1, 2, 4, 1);@@ -551,7 +552,7 @@ public class ReaderServiceTestsawait _context.SaveChangesAsync();- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>());+ var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());var nextChapter = await readerService.GetNextChapterIdAsync(1, 2, 4, 1);@@ -587,7 +588,7 @@ public class ReaderServiceTestsawait _context.SaveChangesAsync();- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>());+ var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());var nextChapter = await readerService.GetNextChapterIdAsync(1, 1, 2, 1);@@ -628,7 +629,7 @@ public class ReaderServiceTestsawait _context.SaveChangesAsync();- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>());+ var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());var nextChapter = await readerService.GetNextChapterIdAsync(1, 1, 2, 1);@@ -669,7 +670,7 @@ public class ReaderServiceTestsawait _context.SaveChangesAsync();- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>());+ var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());var nextChapter = await readerService.GetNextChapterIdAsync(1, 1, 2, 1);@@ -708,7 +709,7 @@ public class ReaderServiceTestsawait _context.SaveChangesAsync();- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>());+ var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());var nextChapter = await readerService.GetNextChapterIdAsync(1, 1, 2, 1);@@ -751,7 +752,7 @@ public class ReaderServiceTestsawait _context.SaveChangesAsync();- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>());+ var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());var nextChapter = await readerService.GetNextChapterIdAsync(1, 1, 3, 1);@@ -793,7 +794,7 @@ public class ReaderServiceTestsawait _context.SaveChangesAsync();- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>());+ var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());var nextChapter = await readerService.GetNextChapterIdAsync(1, 2, 3, 1);@@ -846,7 +847,7 @@ public class ReaderServiceTestsawait _context.SaveChangesAsync();- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>());+ var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());var prevChapter = await readerService.GetPrevChapterIdAsync(1, 1, 2, 1);var actualChapter = await _unitOfWork.ChapterRepository.GetChapterAsync(prevChapter);@@ -892,7 +893,7 @@ public class ReaderServiceTestsawait _context.SaveChangesAsync();- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>());+ var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());var prevChapter = await readerService.GetPrevChapterIdAsync(1, 2, 3, 1);@@ -934,7 +935,7 @@ public class ReaderServiceTestsawait _context.SaveChangesAsync();- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>());+ var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());var prevChapter = await readerService.GetPrevChapterIdAsync(1, 2, 3, 1);@@ -972,7 +973,7 @@ public class ReaderServiceTestsawait _context.SaveChangesAsync();- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>());+ var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());var prevChapter = await readerService.GetPrevChapterIdAsync(1, 1, 1, 1);@@ -1007,7 +1008,7 @@ public class ReaderServiceTestsawait _context.SaveChangesAsync();- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>());+ var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());var prevChapter = await readerService.GetPrevChapterIdAsync(1, 1, 1, 1);@@ -1047,7 +1048,7 @@ public class ReaderServiceTestsawait _context.SaveChangesAsync();- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>());+ var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());var prevChapter = await readerService.GetPrevChapterIdAsync(1, 1, 1, 1);@@ -1095,7 +1096,7 @@ public class ReaderServiceTestsawait _context.SaveChangesAsync();- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>());+ var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());var prevChapter = await readerService.GetPrevChapterIdAsync(1, 2,5, 1);var chapterInfoDto = await _unitOfWork.ChapterRepository.GetChapterInfoDtoAsync(prevChapter);@@ -1137,7 +1138,7 @@ public class ReaderServiceTestsawait _context.SaveChangesAsync();- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>());+ var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());var prevChapter = await readerService.GetPrevChapterIdAsync(1, 1, 1, 1);@@ -1178,7 +1179,7 @@ public class ReaderServiceTestsawait _context.SaveChangesAsync();- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>());+ var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());var prevChapter = await readerService.GetPrevChapterIdAsync(1, 2, 4, 1);@@ -1221,7 +1222,7 @@ public class ReaderServiceTestsawait _context.SaveChangesAsync();- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>());+ var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());var prevChapter = await readerService.GetPrevChapterIdAsync(1, 1, 1, 1);@@ -1276,7 +1277,7 @@ public class ReaderServiceTestsawait _context.SaveChangesAsync();- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>());+ var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());var nextChapter = await readerService.GetContinuePoint(1, 1);@@ -1321,7 +1322,7 @@ public class ReaderServiceTestsawait _context.SaveChangesAsync();- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>());+ var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());// Save progress on first volume chapters and 1st of second volumeawait readerService.SaveReadingProgress(new ProgressDto()@@ -1404,7 +1405,7 @@ public class ReaderServiceTestsawait _context.SaveChangesAsync();- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>());+ var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());// Save progress on first volume and 1st chapter of second volumeawait readerService.SaveReadingProgress(new ProgressDto()@@ -1470,7 +1471,7 @@ public class ReaderServiceTestsawait _context.SaveChangesAsync();- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>());+ var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());// Save progress on first volume chapters and 1st of second volumeawait readerService.SaveReadingProgress(new ProgressDto()@@ -1538,7 +1539,7 @@ public class ReaderServiceTestsawait _context.SaveChangesAsync();- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>());+ var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());var nextChapter = await readerService.GetContinuePoint(1, 1);Assert.Equal("1", nextChapter.Range);@@ -1575,7 +1576,7 @@ public class ReaderServiceTestsawait _context.SaveChangesAsync();- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>());+ var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());// Save progress on first volume chapters and 1st of second volumeawait readerService.SaveReadingProgress(new ProgressDto()@@ -1640,7 +1641,7 @@ public class ReaderServiceTestsawait _context.SaveChangesAsync();- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>());+ var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());// Save progress on first volume chapters and 1st of second volumevar user = await _unitOfWork.UserRepository.GetUserByIdAsync(1, AppUserIncludes.Progress);@@ -1681,7 +1682,7 @@ public class ReaderServiceTestsawait _context.SaveChangesAsync();- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>());+ var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());// Save progress on first volume chapters and 1st of second volumeawait readerService.SaveReadingProgress(new ProgressDto()@@ -1753,7 +1754,7 @@ public class ReaderServiceTestsawait _context.SaveChangesAsync();- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>());+ 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 _context.SaveChangesAsync();@@ -1801,7 +1802,7 @@ public class ReaderServiceTestsawait _context.SaveChangesAsync();- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>());+ 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);@@ -1844,7 +1845,7 @@ public class ReaderServiceTestsawait _context.SaveChangesAsync();- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>());+ 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);@@ -1888,7 +1889,7 @@ public class ReaderServiceTestsawait _context.SaveChangesAsync();- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>());+ 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);@@ -1947,7 +1948,7 @@ public class ReaderServiceTestsawait _context.SaveChangesAsync();- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>());+ 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;@@ -2027,7 +2028,7 @@ public class ReaderServiceTestsawait _context.SaveChangesAsync();- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>());+ var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());await readerService.MarkSeriesAsRead(await _unitOfWork.UserRepository.GetUserByIdAsync(1, AppUserIncludes.Progress), 1);await _context.SaveChangesAsync();@@ -2078,7 +2079,7 @@ public class ReaderServiceTestsawait _context.SaveChangesAsync();- var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>());+ var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());var volumes = (await _unitOfWork.VolumeRepository.GetVolumes(1)).ToList();readerService.MarkChaptersAsRead(await _unitOfWork.UserRepository.GetUserByIdAsync(1, AppUserIncludes.Progress), 1, volumes.First().Chapters);diff --git a/API.Tests/Services/ScannerServiceTests.cs b/API.Tests/Services/ScannerServiceTests.csindex 280fe5c10..e3331bf6d 100644--- a/API.Tests/Services/ScannerServiceTests.cs+++ b/API.Tests/Services/ScannerServiceTests.cs@@ -125,5 +125,6 @@ namespace API.Tests.Services// }+}}diff --git a/API.Tests/Services/SeriesServiceTests.cs b/API.Tests/Services/SeriesServiceTests.csindex 1b9f5fd3f..217eb63e0 100644--- a/API.Tests/Services/SeriesServiceTests.cs+++ b/API.Tests/Services/SeriesServiceTests.cs@@ -22,6 +22,7 @@ using Microsoft.EntityFrameworkCore.Infrastructure;using Microsoft.Extensions.Logging;using NSubstitute;using Xunit;+using Xunit.Sdk;namespace API.Tests.Services;@@ -703,6 +704,85 @@ public class SeriesServiceTestsAssert.False(series.Metadata.GenresLocked); // GenreLocked is false unless the UI Explicitly says it should be locked}+ [Fact]+ 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);+ _context.Series.Add(s);++ _context.Person.Add(g);+ await _context.SaveChangesAsync();++ var success = await _seriesService.UpdateSeriesMetadata(new UpdateSeriesMetadataDto()+ {+ SeriesMetadata = new SeriesMetadataDto()+ {+ SeriesId = 1,+ Publishers = new List<PersonDto>() {new () {Id = 0, Name = "Existing Person", Role = PersonRole.Publisher}},+ },+ CollectionTags = new List<CollectionTagDto>()+ });++ Assert.True(success);++ var series = await _unitOfWork.SeriesRepository.GetSeriesByIdAsync(1);+ Assert.NotNull(series.Metadata);+ Assert.True(series.Metadata.People.Select(g => g.Name).All(g => g == "Existing Person"));+ Assert.False(series.Metadata.PublisherLocked); // PublisherLocked is false unless the UI Explicitly says it should be locked+ }++ [Fact]+ 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)};+ _context.Series.Add(s);++ _context.Person.Add(g);+ await _context.SaveChangesAsync();++ var success = await _seriesService.UpdateSeriesMetadata(new UpdateSeriesMetadataDto()+ {+ SeriesMetadata = new SeriesMetadataDto()+ {+ SeriesId = 1,+ Publishers = new List<PersonDto>() {new () {Id = 0, Name = "Existing Person", Role = PersonRole.Publisher}},+ PublishersLocked = true+ },+ CollectionTags = new List<CollectionTagDto>()+ });++ Assert.True(success);++ var series = await _unitOfWork.SeriesRepository.GetSeriesByIdAsync(1);+ Assert.NotNull(series.Metadata);+ Assert.True(series.Metadata.People.Select(g => g.Name).All(g => g == "Existing Person"));+ Assert.True(series.Metadata.PublisherLocked);+ }+[Fact]public async Task UpdateSeriesMetadata_ShouldLockIfTold(){@@ -745,4 +825,86 @@ public class SeriesServiceTests}#endregion++ #region GetFirstChapterForMetadata++ 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),+ }),+ }+ };+ }++ [Fact]+ public void GetFirstChapterForMetadata_Book_Test()+ {+ var series = CreateSeriesMock();++ var firstChapter = SeriesService.GetFirstChapterForMetadata(series, true);+ Assert.Same("1", firstChapter.Range);+ }++ [Fact]+ public void GetFirstChapterForMetadata_NonBook_ShouldReturnVolume1()+ {+ var series = CreateSeriesMock();++ var firstChapter = SeriesService.GetFirstChapterForMetadata(series, false);+ Assert.Same("1", firstChapter.Range);+ }++ [Fact]+ public void GetFirstChapterForMetadata_NonBook_ShouldReturnVolume1_WhenFirstChapterIsFloat()+ {+ var series = CreateSeriesMock();+ var files = new List<MangaFile>()+ {+ EntityFactory.CreateMangaFile("Test.cbz", MangaFormat.Archive, 1)+ };+ 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),+ };++ var firstChapter = SeriesService.GetFirstChapterForMetadata(series, false);+ Assert.Same("1.1", firstChapter.Range);+ }++ #endregion}diff --git a/API.Tests/Services/SiteThemeServiceTests.cs b/API.Tests/Services/SiteThemeServiceTests.csindex 3f3f18acf..246461fc8 100644--- a/API.Tests/Services/SiteThemeServiceTests.cs+++ b/API.Tests/Services/SiteThemeServiceTests.cs@@ -25,7 +25,7 @@ namespace API.Tests.Services;public class SiteThemeServiceTests{- private readonly ILogger<SiteThemeService> _logger = Substitute.For<ILogger<SiteThemeService>>();+ private readonly ILogger<ThemeService> _logger = Substitute.For<ILogger<ThemeService>>();private readonly IEventHub _messageHub = Substitute.For<IEventHub>();private readonly DbConnection _connection;@@ -87,7 +87,7 @@ public class SiteThemeServiceTestsUserName = "Joe",UserPreferences = new AppUserPreferences{- Theme = Seed.DefaultThemes[1]+ Theme = Seed.DefaultThemes[0]}});@@ -135,7 +135,7 @@ public class SiteThemeServiceTestsvar filesystem = CreateFileSystem();filesystem.AddFile($"{SiteThemeDirectory}custom.css", new MockFileData(""));var ds = new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), filesystem);- var siteThemeService = new SiteThemeService(ds, _unitOfWork, _messageHub);+ var siteThemeService = new ThemeService(ds, _unitOfWork, _messageHub);await siteThemeService.Scan();Assert.NotNull(await _unitOfWork.SiteThemeRepository.GetThemeDtoByName("custom"));@@ -148,7 +148,7 @@ public class SiteThemeServiceTestsvar filesystem = CreateFileSystem();filesystem.AddFile($"{SiteThemeDirectory}custom.css", new MockFileData(""));var ds = new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), filesystem);- var siteThemeService = new SiteThemeService(ds, _unitOfWork, _messageHub);+ var siteThemeService = new ThemeService(ds, _unitOfWork, _messageHub);await siteThemeService.Scan();Assert.NotNull(await _unitOfWork.SiteThemeRepository.GetThemeDtoByName("custom"));@@ -167,7 +167,7 @@ public class SiteThemeServiceTestsvar filesystem = CreateFileSystem();filesystem.AddFile($"{SiteThemeDirectory}custom.css", new MockFileData(""));var ds = new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), filesystem);- var siteThemeService = new SiteThemeService(ds, _unitOfWork, _messageHub);+ var siteThemeService = new ThemeService(ds, _unitOfWork, _messageHub);await siteThemeService.Scan();Assert.NotNull(await _unitOfWork.SiteThemeRepository.GetThemeDtoByName("custom"));@@ -188,7 +188,7 @@ public class SiteThemeServiceTestsvar filesystem = CreateFileSystem();filesystem.AddFile($"{SiteThemeDirectory}custom.css", new MockFileData("123"));var ds = new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), filesystem);- var siteThemeService = new SiteThemeService(ds, _unitOfWork, _messageHub);+ var siteThemeService = new ThemeService(ds, _unitOfWork, _messageHub);_context.SiteTheme.Add(new SiteTheme(){@@ -213,7 +213,7 @@ public class SiteThemeServiceTestsvar filesystem = CreateFileSystem();filesystem.AddFile($"{SiteThemeDirectory}custom.css", new MockFileData("123"));var ds = new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), filesystem);- var siteThemeService = new SiteThemeService(ds, _unitOfWork, _messageHub);+ var siteThemeService = new ThemeService(ds, _unitOfWork, _messageHub);_context.SiteTheme.Add(new SiteTheme(){@@ -241,7 +241,7 @@ public class SiteThemeServiceTestsvar filesystem = CreateFileSystem();filesystem.AddFile($"{SiteThemeDirectory}custom.css", new MockFileData("123"));var ds = new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), filesystem);- var siteThemeService = new SiteThemeService(ds, _unitOfWork, _messageHub);+ var siteThemeService = new ThemeService(ds, _unitOfWork, _messageHub);_context.SiteTheme.Add(new SiteTheme(){diff --git a/API.Tests/Services/Test Data/ArchiveService/Archives/macos_native.zip b/API.Tests/Services/Test Data/ArchiveService/Archives/macos_native.zipindex a84f32b35..c47021fd2 100644Binary files a/API.Tests/Services/Test Data/ArchiveService/Archives/macos_native.zip and b/API.Tests/Services/Test Data/ArchiveService/Archives/macos_native.zip differdiff --git a/API.Tests/Services/Test Data/ArchiveService/CoverImages/macos_native.zip b/API.Tests/Services/Test Data/ArchiveService/CoverImages/macos_native.zipindex a84f32b35..c47021fd2 100644Binary files a/API.Tests/Services/Test Data/ArchiveService/CoverImages/macos_native.zip and b/API.Tests/Services/Test Data/ArchiveService/CoverImages/macos_native.zip differdiff --git a/API/.dockerignore b/API/.dockerignoredeleted file mode 100644index cd967fc3a..000000000--- a/API/.dockerignore+++ /dev/null@@ -1,25 +0,0 @@-**/.dockerignore-**/.env-**/.git-**/.gitignore-**/.project-**/.settings-**/.toolstarget-**/.vs-**/.vscode-**/.idea-**/*.*proj.user-**/*.dbmdl-**/*.jfm-**/azds.yaml-**/bin-**/charts-**/docker-compose*-**/Dockerfile*-**/node_modules-**/npm-debug.log-**/obj-**/secrets.dev.yaml-**/values.dev.yaml-LICENSE-README.md\ No newline at end of filediff --git a/API/API.csproj b/API/API.csprojindex 492430a44..1099893a3 100644--- a/API/API.csproj+++ b/API/API.csproj@@ -40,39 +40,39 @@<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="11.0.0" /><PackageReference Include="Docnet.Core" Version="2.4.0-alpha.2" /><PackageReference Include="ExCSS" Version="4.1.0" />- <PackageReference Include="Flurl" Version="3.0.4" />- <PackageReference Include="Flurl.Http" Version="3.2.2" />+ <PackageReference Include="Flurl" Version="3.0.5" />+ <PackageReference Include="Flurl.Http" Version="3.2.3" /><PackageReference Include="Hangfire" Version="1.7.28" /><PackageReference Include="Hangfire.AspNetCore" Version="1.7.28" /><PackageReference Include="Hangfire.MaximumConcurrentExecutions" Version="1.1.0" /><PackageReference Include="Hangfire.MemoryStorage.Core" Version="1.4.0" /><PackageReference Include="HtmlAgilityPack" Version="1.11.42" /><PackageReference Include="MarkdownDeep.NET.Core" Version="1.5.0.4" />- <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.3" />- <PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="6.0.3" />- <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.3" />+ <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.4" />+ <PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="6.0.4" />+ <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.4" /><PackageReference Include="Microsoft.AspNetCore.SignalR" Version="1.1.0" />- <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.3">+ <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.4"><PrivateAssets>all</PrivateAssets><IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets></PackageReference>- <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.3" />+ <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.4" /><PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" /><PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="2.2.0" /><PackageReference Include="NetVips" Version="2.1.0" /><PackageReference Include="NetVips.Native" Version="8.12.2" /><PackageReference Include="NReco.Logging.File" Version="1.1.4" /><PackageReference Include="SharpCompress" Version="0.31.0" />- <PackageReference Include="SixLabors.ImageSharp" Version="2.1.0" />- <PackageReference Include="SonarAnalyzer.CSharp" Version="8.37.0.45539">+ <PackageReference Include="SixLabors.ImageSharp" Version="2.1.1" />+ <PackageReference Include="SonarAnalyzer.CSharp" Version="8.38.0.46746"><PrivateAssets>all</PrivateAssets><IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets></PackageReference>- <PackageReference Include="Swashbuckle.AspNetCore" Version="6.3.0" />+ <PackageReference Include="Swashbuckle.AspNetCore" Version="6.3.1" /><PackageReference Include="System.Drawing.Common" Version="6.0.0" /><PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.17.0" />- <PackageReference Include="System.IO.Abstractions" Version="16.1.25" />- <PackageReference Include="VersOne.Epub" Version="3.0.3.1" />+ <PackageReference Include="System.IO.Abstractions" Version="17.0.3" />+ <PackageReference Include="VersOne.Epub" Version="3.1.0" /></ItemGroup><ItemGroup>@@ -94,16 +94,12 @@</ItemGroup><ItemGroup>- <Compile Remove="Interfaces\IMetadataService.cs" /><Compile Remove="obj\**" /><Compile Remove="cache\**" /><Compile Remove="backups\**" /><Compile Remove="logs\**" /><Compile Remove="temp\**" /><Compile Remove="covers\**" />- <Compile Remove="DTOs\Email\SmtpConfig.cs" />- <Compile Remove="DTOs\Email\EmailOptionsDto.cs" />- <Compile Remove="Helpers\Converters\SmtpConverter.cs" /></ItemGroup><ItemGroup>diff --git a/API/Controllers/AccountController.cs b/API/Controllers/AccountController.csindex dfa30b18d..cc0b66ec1 100644--- a/API/Controllers/AccountController.cs+++ b/API/Controllers/AccountController.cs@@ -353,6 +353,7 @@ namespace API.Controllers_logger.LogInformation("{User} is inviting {Email} to the server", adminUser.UserName, dto.Email);// Check if there is an existing invite+ dto.Email = dto.Email.Trim();var emailValidationErrors = await _accountService.ValidateEmail(dto.Email);if (emailValidationErrors.Any()){@@ -454,6 +455,11 @@ namespace API.Controllers{var user = await _unitOfWork.UserRepository.GetUserByEmailAsync(dto.Email);+ if (user == null)+ {+ return BadRequest("The email does not match the registered email");+ }+// Validate Password and Usernamevar validationErrors = new List<ApiException>();validationErrors.AddRange(await _accountService.ValidateUsername(dto.Username));diff --git a/API/Controllers/BookController.cs b/API/Controllers/BookController.csindex 89b2d3de4..7b4b49a9f 100644--- a/API/Controllers/BookController.cs+++ b/API/Controllers/BookController.cs@@ -40,7 +40,7 @@ namespace API.Controllersif (dto.SeriesFormat == MangaFormat.Epub){var mangaFile = (await _unitOfWork.ChapterRepository.GetFilesForChapterAsync(chapterId)).First();- using var book = await EpubReader.OpenBookAsync(mangaFile.FilePath);+ using var book = await EpubReader.OpenBookAsync(mangaFile.FilePath, BookService.BookReaderOptions);bookTitle = book.Title;}@@ -63,7 +63,7 @@ namespace API.Controllerspublic async Task<ActionResult> GetBookPageResources(int chapterId, [FromQuery] string file){var chapter = await _unitOfWork.ChapterRepository.GetChapterAsync(chapterId);- var book = await EpubReader.OpenBookAsync(chapter.Files.ElementAt(0).FilePath);+ using var book = await EpubReader.OpenBookAsync(chapter.Files.ElementAt(0).FilePath, BookService.BookReaderOptions);var key = BookService.CleanContentKeys(file);if (!book.Content.AllFiles.ContainsKey(key)) return BadRequest("File was not found in book");@@ -87,7 +87,7 @@ namespace API.Controllerspublic async Task<ActionResult<ICollection<BookChapterItem>>> GetBookChapters(int chapterId){var chapter = await _unitOfWork.ChapterRepository.GetChapterAsync(chapterId);- using var book = await EpubReader.OpenBookAsync(chapter.Files.ElementAt(0).FilePath);+ using var book = await EpubReader.OpenBookAsync(chapter.Files.ElementAt(0).FilePath, BookService.BookReaderOptions);var mappings = await _bookService.CreateKeyToPageMappingAsync(book);var navItems = await book.GetNavigationAsync();@@ -211,8 +211,7 @@ namespace API.Controllersvar chapter = await _cacheService.Ensure(chapterId);var path = _cacheService.GetCachedEpubFile(chapter.Id, chapter);-- using var book = await EpubReader.OpenBookAsync(path);+ using var book = await EpubReader.OpenBookAsync(path, BookService.BookReaderOptions);var mappings = await _bookService.CreateKeyToPageMappingAsync(book);var counter = 0;diff --git a/API/Controllers/CollectionController.cs b/API/Controllers/CollectionController.csindex 6abc22955..a98e28952 100644--- a/API/Controllers/CollectionController.cs+++ b/API/Controllers/CollectionController.cs@@ -157,7 +157,7 @@ namespace API.Controllerstag.CoverImageLocked = false;tag.CoverImage = string.Empty;await _eventHub.SendMessageAsync(MessageFactory.CoverUpdate,- MessageFactory.CoverUpdateEvent(tag.Id, "collectionTag"), false);+ MessageFactory.CoverUpdateEvent(tag.Id, MessageFactoryEntityTypes.CollectionTag), false);_unitOfWork.CollectionTagRepository.Update(tag);}diff --git a/API/Controllers/DownloadController.cs b/API/Controllers/DownloadController.csindex b60fae6e8..433f16721 100644--- a/API/Controllers/DownloadController.cs+++ b/API/Controllers/DownloadController.cs@@ -171,7 +171,7 @@ namespace API.Controllersvar user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername());var series = await _unitOfWork.SeriesRepository.GetSeriesByIdAsync(downloadBookmarkDto.Bookmarks.First().SeriesId);- var files = await _bookmarkService.GetBookmarkFilesById(user.Id, downloadBookmarkDto.Bookmarks.Select(b => b.Id));+ var files = await _bookmarkService.GetBookmarkFilesById(downloadBookmarkDto.Bookmarks.Select(b => b.Id));var filename = $"{series.Name} - Bookmarks.zip";await _eventHub.SendMessageAsync(MessageFactory.NotificationProgress,diff --git a/API/Controllers/ImageController.cs b/API/Controllers/ImageController.csindex 8b58fe9b3..2393d0ea6 100644--- a/API/Controllers/ImageController.cs+++ b/API/Controllers/ImageController.cs@@ -88,6 +88,22 @@ namespace API.Controllersreturn PhysicalFile(path, "image/" + format, _directoryService.FileSystem.Path.GetFileName(path));}+ /// <summary>+ /// Returns cover image for a Reading List+ /// </summary>+ /// <param name="readingListId"></param>+ /// <returns></returns>+ [HttpGet("readinglist-cover")]+ public async Task<ActionResult> GetReadingListCoverImage(int readingListId)+ {+ 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(".", "");++ Response.AddCacheHeader(path);+ return PhysicalFile(path, "image/" + format, _directoryService.FileSystem.Path.GetFileName(path));+ }+/// <summary>/// Returns image for a given bookmark page/// </summary>diff --git a/API/Controllers/MetadataController.cs b/API/Controllers/MetadataController.csindex 39c7264d2..ea87456c0 100644--- a/API/Controllers/MetadataController.cs+++ b/API/Controllers/MetadataController.cs@@ -99,12 +99,12 @@ public class MetadataController : BaseApiController/// <param name="libraryIds">String separated libraryIds or null for all publication status</param>/// <returns></returns>[HttpGet("publication-status")]- public async Task<ActionResult<IList<AgeRatingDto>>> GetAllPublicationStatus(string? libraryIds)+ public ActionResult<IList<AgeRatingDto>> GetAllPublicationStatus(string? libraryIds){var ids = libraryIds?.Split(",").Select(int.Parse).ToList();- if (ids != null && ids.Count > 0)+ if (ids is {Count: > 0}){- return Ok(await _unitOfWork.SeriesRepository.GetAllPublicationStatusesDtosForLibrariesAsync(ids));+ return Ok(_unitOfWork.SeriesRepository.GetAllPublicationStatusesDtosForLibrariesAsync(ids));}return Ok(Enum.GetValues<PublicationStatus>().Select(t => new PublicationStatusDto()diff --git a/API/Controllers/OPDSController.cs b/API/Controllers/OPDSController.csindex eaa778121..a221f06c1 100644--- a/API/Controllers/OPDSController.cs+++ b/API/Controllers/OPDSController.cs@@ -389,12 +389,8 @@ public class OpdsController : BaseApiControllervar userParams = new UserParams(){PageNumber = pageNumber,- PageSize = 20};- var results = await _unitOfWork.SeriesRepository.GetOnDeck(userId, 0, userParams, _filterDto);- var listResults = results.DistinctBy(s => s.Name).Skip((userParams.PageNumber - 1) * userParams.PageSize)- .Take(userParams.PageSize).ToList();- var pagedList = new PagedList<SeriesDto>(listResults, listResults.Count, userParams.PageNumber, userParams.PageSize);+ var pagedList = await _unitOfWork.SeriesRepository.GetOnDeck(userId, 0, userParams, _filterDto);Response.AddPaginationHeader(pagedList.CurrentPage, pagedList.PageSize, pagedList.TotalCount, pagedList.TotalPages);diff --git a/API/Controllers/ReaderController.cs b/API/Controllers/ReaderController.csindex e2d067abd..7ced84d6a 100644--- a/API/Controllers/ReaderController.cs+++ b/API/Controllers/ReaderController.cs@@ -11,6 +11,8 @@ using API.Entities;using API.Extensions;using API.Services;using API.Services.Tasks;+using API.SignalR;+using Hangfire;using Microsoft.AspNetCore.Mvc;using Microsoft.Extensions.Logging;@@ -25,23 +27,21 @@ namespace API.Controllersprivate readonly IUnitOfWork _unitOfWork;private readonly ILogger<ReaderController> _logger;private readonly IReaderService _readerService;- private readonly IDirectoryService _directoryService;- private readonly ICleanupService _cleanupService;private readonly IBookmarkService _bookmarkService;+ private readonly IEventHub _eventHub;/// <inheritdoc />public ReaderController(ICacheService cacheService,IUnitOfWork unitOfWork, ILogger<ReaderController> logger,- IReaderService readerService, IDirectoryService directoryService,- ICleanupService cleanupService, IBookmarkService bookmarkService)+ IReaderService readerService, IBookmarkService bookmarkService,+ IEventHub eventHub){_cacheService = cacheService;_unitOfWork = unitOfWork;_logger = logger;_readerService = readerService;- _directoryService = directoryService;- _cleanupService = cleanupService;_bookmarkService = bookmarkService;+ _eventHub = eventHub;}/// <summary>@@ -73,6 +73,41 @@ namespace API.Controllers}}+ /// <summary>+ /// Returns an image for a given bookmark series. Side effect: This will cache the bookmark images for reading.+ /// </summary>+ /// <param name="seriesId"></param>+ /// <param name="apiKey">Api key for the user the bookmarks are on</param>+ /// <param name="page"></param>+ /// <remarks>We must use api key as bookmarks could be leaked to other users via the API</remarks>+ /// <returns></returns>+ [HttpGet("bookmark-image")]+ public async Task<ActionResult> GetBookmarkImage(int seriesId, string apiKey, int page)+ {+ if (page < 0) page = 0;+ var userId = await _unitOfWork.UserRepository.GetUserIdByApiKeyAsync(apiKey);+ var totalPages = await _cacheService.CacheBookmarkForSeries(userId, seriesId);+ if (page > totalPages)+ {+ page = totalPages;+ }++ try+ {+ 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(".", "");++ Response.AddCacheHeader(path, TimeSpan.FromMinutes(10).Seconds);+ return PhysicalFile(path, "image/" + format, Path.GetFileName(path));+ }+ catch (Exception)+ {+ _cacheService.CleanupBookmarks(new []{ seriesId });+ throw;+ }+ }+/// <summary>/// Returns various information about a Chapter. Side effect: This will cache the chapter images for reading./// </summary>@@ -81,6 +116,7 @@ namespace API.Controllers[HttpGet("chapter-info")]public async Task<ActionResult<ChapterInfoDto>> GetChapterInfo(int chapterId){+ if (chapterId <= 0) return null; // This can happen occasionally from UI, we should just ignorevar chapter = await _cacheService.Ensure(chapterId);if (chapter == null) return BadRequest("Could not find Chapter");@@ -104,6 +140,28 @@ namespace API.Controllers});}+ /// <summary>+ /// 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>+ /// <returns></returns>+ [HttpGet("bookmark-info")]+ public async Task<ActionResult<BookmarkInfoDto>> GetBookmarkInfo(int seriesId)+ {+ var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername());+ var totalPages = await _cacheService.CacheBookmarkForSeries(user.Id, seriesId);+ var series = await _unitOfWork.SeriesRepository.GetSeriesByIdAsync(seriesId, SeriesIncludes.None);++ return Ok(new BookmarkInfoDto()+ {+ SeriesName = series.Name,+ SeriesFormat = series.Format,+ SeriesId = series.Id,+ LibraryId = series.LibraryId,+ Pages = totalPages,+ });+ }+[HttpPost("mark-read")]public async Task<ActionResult> MarkRead(MarkReadDto markReadDto)@@ -111,13 +169,9 @@ namespace API.Controllersvar user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername(), AppUserIncludes.Progress);await _readerService.MarkSeriesAsRead(user, markReadDto.SeriesId);- if (await _unitOfWork.CommitAsync())- {- return Ok();- }-+ if (!await _unitOfWork.CommitAsync()) return BadRequest("There was an issue saving progress");- return BadRequest("There was an issue saving progress");+ return Ok();}@@ -132,13 +186,9 @@ namespace API.Controllersvar user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername(), AppUserIncludes.Progress);await _readerService.MarkSeriesAsUnread(user, markReadDto.SeriesId);- if (await _unitOfWork.CommitAsync())- {- return Ok();- }-+ if (!await _unitOfWork.CommitAsync()) return BadRequest("There was an issue saving progress");- return BadRequest("There was an issue saving progress");+ return Ok();}/// <summary>@@ -514,6 +564,7 @@ namespace API.Controllersif (await _bookmarkService.BookmarkPage(user, bookmarkDto, path)){+ BackgroundJob.Enqueue(() => _cacheService.CleanupBookmarkCache(bookmarkDto.SeriesId));return Ok();}@@ -533,6 +584,7 @@ namespace API.Controllersif (await _bookmarkService.RemoveBookmarkPage(user, bookmarkDto)){+ BackgroundJob.Enqueue(() => _cacheService.CleanupBookmarkCache(bookmarkDto.SeriesId));return Ok();}diff --git a/API/Controllers/ReadingListController.cs b/API/Controllers/ReadingListController.csindex 83cdc1a04..1b72b20d2 100644--- a/API/Controllers/ReadingListController.cs+++ b/API/Controllers/ReadingListController.cs@@ -7,6 +7,7 @@ using API.DTOs.ReadingLists;using API.Entities;using API.Extensions;using API.Helpers;+using API.SignalR;using Microsoft.AspNetCore.Mvc;namespace API.Controllers@@ -14,11 +15,13 @@ namespace API.Controllerspublic class ReadingListController : BaseApiController{private readonly IUnitOfWork _unitOfWork;+ private readonly IEventHub _eventHub;private readonly ChapterSortComparerZeroFirst _chapterSortComparerForInChapterSorting = new ChapterSortComparerZeroFirst();- public ReadingListController(IUnitOfWork unitOfWork)+ public ReadingListController(IUnitOfWork unitOfWork, IEventHub eventHub){_unitOfWork = unitOfWork;+ _eventHub = eventHub;}/// <summary>@@ -208,12 +211,8 @@ namespace API.Controllers{return BadRequest("A list of this name already exists");}- user.ReadingLists.Add(new ReadingList()- {- Promoted = false,- Title = dto.Title,- Summary = string.Empty- });++ user.ReadingLists.Add(DbFactory.ReadingList(dto.Title, string.Empty, false));if (!_unitOfWork.HasChanges()) return BadRequest("There was a problem creating list");@@ -233,9 +232,12 @@ namespace API.Controllersvar readingList = await _unitOfWork.ReadingListRepository.GetReadingListByIdAsync(dto.ReadingListId);if (readingList == null) return BadRequest("List does not exist");++if (!string.IsNullOrEmpty(dto.Title)){readingList.Title = dto.Title; // Should I check if this is unique?+ readingList.NormalizedTitle = Parser.Parser.Normalize(readingList.Title);}if (!string.IsNullOrEmpty(dto.Title)){@@ -244,6 +246,19 @@ namespace API.ControllersreadingList.Promoted = dto.Promoted;+ readingList.CoverImageLocked = dto.CoverImageLocked;++ if (!dto.CoverImageLocked)+ {+ readingList.CoverImageLocked = false;+ readingList.CoverImage = string.Empty;+ await _eventHub.SendMessageAsync(MessageFactory.CoverUpdate,+ MessageFactory.CoverUpdateEvent(readingList.Id, MessageFactoryEntityTypes.ReadingList), false);+ _unitOfWork.ReadingListRepository.Update(readingList);+ }+++_unitOfWork.ReadingListRepository.Update(readingList);if (await _unitOfWork.CommitAsync())@@ -455,14 +470,7 @@ namespace API.Controllersforeach (var chapter in chaptersForSeries){if (existingChapterExists.Contains(chapter.Id)) continue;-- readingList.Items.Add(new ReadingListItem()- {- Order = index,- ChapterId = chapter.Id,- SeriesId = seriesId,- VolumeId = chapter.VolumeId- });+ readingList.Items.Add(DbFactory.ReadingListItem(index, seriesId, chapter.VolumeId, chapter.Id));index += 1;}diff --git a/API/Controllers/RecommendedController.cs b/API/Controllers/RecommendedController.csnew file mode 100644index 000000000..acd200b97--- /dev/null+++ b/API/Controllers/RecommendedController.cs@@ -0,0 +1,90 @@+using System.Collections.Generic;+using System.Threading.Tasks;+using API.Data;+using API.DTOs;+using API.Extensions;+using API.Helpers;+using Microsoft.AspNetCore.Mvc;++namespace API.Controllers;++public class RecommendedController : BaseApiController+{+ private readonly IUnitOfWork _unitOfWork;++ public RecommendedController(IUnitOfWork unitOfWork)+ {+ _unitOfWork = unitOfWork;+ }+++ /// <summary>+ /// Quick Reads are series that are less than 2K pages in total.+ /// </summary>+ /// <param name="libraryId">Library to restrict series to</param>+ /// <returns></returns>+ [HttpGet("quick-reads")]+ public async Task<ActionResult<PagedList<SeriesDto>>> GetQuickReads(int libraryId, [FromQuery] UserParams userParams)+ {+ var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername());++ userParams ??= new UserParams();+ var series = await _unitOfWork.SeriesRepository.GetQuickReads(user.Id, libraryId, userParams);++ Response.AddPaginationHeader(series.CurrentPage, series.PageSize, series.TotalCount, series.TotalPages);+ return Ok(series);+ }++ /// <summary>+ /// Highly Rated based on other users ratings. Will pull series with ratings > 4.0, weighted by count of other users.+ /// </summary>+ /// <param name="libraryId">Library to restrict series to</param>+ /// <returns></returns>+ [HttpGet("highly-rated")]+ public async Task<ActionResult<PagedList<SeriesDto>>> GetHighlyRated(int libraryId, [FromQuery] UserParams userParams)+ {+ var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername());++ userParams ??= new UserParams();+ var series = await _unitOfWork.SeriesRepository.GetHighlyRated(user.Id, libraryId, userParams);+ await _unitOfWork.SeriesRepository.AddSeriesModifiers(user.Id, series);+ Response.AddPaginationHeader(series.CurrentPage, series.PageSize, series.TotalCount, series.TotalPages);+ return Ok(series);+ }++ /// <summary>+ /// Chooses a random genre and shows series that are in that without reading progress+ /// </summary>+ /// <param name="libraryId">Library to restrict series to</param>+ /// <returns></returns>+ [HttpGet("more-in")]+ public async Task<ActionResult<PagedList<SeriesDto>>> GetMoreIn(int libraryId, int genreId, [FromQuery] UserParams userParams)+ {+ var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername());++ userParams ??= new UserParams();+ var series = await _unitOfWork.SeriesRepository.GetMoreIn(user.Id, libraryId, genreId, userParams);+ await _unitOfWork.SeriesRepository.AddSeriesModifiers(user.Id, series);++ Response.AddPaginationHeader(series.CurrentPage, series.PageSize, series.TotalCount, series.TotalPages);+ return Ok(series);+ }++ /// <summary>+ /// Series that are fully read by the user in no particular order+ /// </summary>+ /// <param name="libraryId">Library to restrict series to</param>+ /// <returns></returns>+ [HttpGet("rediscover")]+ public async Task<ActionResult<PagedList<SeriesDto>>> GetRediscover(int libraryId, [FromQuery] UserParams userParams)+ {+ var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync(User.GetUsername());++ userParams ??= new UserParams();+ var series = await _unitOfWork.SeriesRepository.GetRediscover(user.Id, libraryId, userParams);++ Response.AddPaginationHeader(series.CurrentPage, series.PageSize, series.TotalCount, series.TotalPages);+ return Ok(series);+ }++}diff --git a/API/Controllers/SeriesController.cs b/API/Controllers/SeriesController.csindex 3aad34d99..34e90d818 100644--- a/API/Controllers/SeriesController.cs+++ b/API/Controllers/SeriesController.cs@@ -6,8 +6,10 @@ using API.Data;using API.Data.Repositories;using API.DTOs;using API.DTOs.Filtering;+using API.DTOs.SeriesDetail;using API.Entities;using API.Entities.Enums;+using API.Entities.Metadata;using API.Extensions;using API.Helpers;using API.Services;@@ -214,13 +216,6 @@ namespace API.Controllersreturn Ok(await _unitOfWork.SeriesRepository.GetRecentlyUpdatedSeries(userId));}- [HttpPost("recently-added-chapters")]- public async Task<ActionResult<IEnumerable<RecentlyAddedItemDto>>> GetRecentlyAddedChaptersAlt()- {- var userId = await _unitOfWork.UserRepository.GetUserIdByUsernameAsync(User.GetUsername());- return Ok(await _unitOfWork.SeriesRepository.GetRecentlyAddedChapters(userId));- }-[HttpPost("all")]public async Task<ActionResult<IEnumerable<SeriesDto>>> GetAllSeries(FilterDto filterDto, [FromQuery] UserParams userParams, [FromQuery] int libraryId = 0){@@ -248,12 +243,8 @@ namespace API.Controllers[HttpPost("on-deck")]public async Task<ActionResult<IEnumerable<SeriesDto>>> GetOnDeck(FilterDto filterDto, [FromQuery] UserParams userParams, [FromQuery] int libraryId = 0){- // NOTE: This has to be done manually like this due to the DistinctBy requirementvar userId = await _unitOfWork.UserRepository.GetUserIdByUsernameAsync(User.GetUsername());- var results = await _unitOfWork.SeriesRepository.GetOnDeck(userId, libraryId, userParams, filterDto);-- var listResults = results.DistinctBy(s => s.Name).Skip((userParams.PageNumber - 1) * userParams.PageSize).Take(userParams.PageSize).ToList();- var pagedList = new PagedList<SeriesDto>(listResults, listResults.Count, userParams.PageNumber, userParams.PageSize);+ var pagedList = await _unitOfWork.SeriesRepository.GetOnDeck(userId, libraryId, userParams, filterDto);await _unitOfWork.SeriesRepository.AddSeriesModifiers(userId, pagedList);@@ -346,5 +337,105 @@ namespace API.Controllersvar userId = await _unitOfWork.UserRepository.GetUserIdByUsernameAsync(User.GetUsername());return await _seriesService.GetSeriesDetail(seriesId, userId);}++ /// <summary>+ /// Returns the series for the MangaFile id. If the user does not have access (shouldn't happen by the UI),+ /// then null is returned+ /// </summary>+ /// <param name="mangaFileId"></param>+ /// <returns></returns>+ [HttpGet("series-for-mangafile")]+ public async Task<ActionResult<SeriesDto>> GetSeriesForMangaFile(int mangaFileId)+ {+ var userId = await _unitOfWork.UserRepository.GetUserIdByUsernameAsync(User.GetUsername());+ return Ok(await _unitOfWork.SeriesRepository.GetSeriesForMangaFile(mangaFileId, userId));+ }++ /// <summary>+ /// Returns the series for the Chapter id. If the user does not have access (shouldn't happen by the UI),+ /// then null is returned+ /// </summary>+ /// <param name="chapterId"></param>+ /// <returns></returns>+ [HttpGet("series-for-chapter")]+ public async Task<ActionResult<SeriesDto>> GetSeriesForChapter(int chapterId)+ {+ var userId = await _unitOfWork.UserRepository.GetUserIdByUsernameAsync(User.GetUsername());+ return Ok(await _unitOfWork.SeriesRepository.GetSeriesForChapter(chapterId, userId));+ }++ /// <summary>+ /// Fetches the related series for a given series+ /// </summary>+ /// <param name="seriesId"></param>+ /// <param name="relation">Type of Relationship to pull back</param>+ /// <returns></returns>+ [HttpGet("related")]+ public async Task<ActionResult<IEnumerable<SeriesDto>>> GetRelatedSeries(int seriesId, RelationKind relation)+ {+ // Send back a custom DTO with each type or maybe sorted in some way+ var userId = await _unitOfWork.UserRepository.GetUserIdByUsernameAsync(User.GetUsername());+ return Ok(await _unitOfWork.SeriesRepository.GetSeriesForRelationKind(userId, seriesId, relation));+ }++ [HttpGet("all-related")]+ public async Task<ActionResult<RelatedSeriesDto>> GetAllRelatedSeries(int seriesId)+ {+ // Send back a custom DTO with each type or maybe sorted in some way+ var userId = await _unitOfWork.UserRepository.GetUserIdByUsernameAsync(User.GetUsername());+ return Ok(await _unitOfWork.SeriesRepository.GetRelatedSeries(userId, seriesId));+ }++ [Authorize(Policy="RequireAdminRole")]+ [HttpPost("update-related")]+ public async Task<ActionResult> UpdateRelatedSeries(UpdateRelatedSeriesDto dto)+ {+ var series = await _unitOfWork.SeriesRepository.GetSeriesByIdAsync(dto.SeriesId, SeriesIncludes.Related);++ 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);+ UpdateRelationForKind(dto.Contains, series.Relations.Where(r => r.RelationKind == RelationKind.Contains).ToList(), series, RelationKind.Contains);+ UpdateRelationForKind(dto.Others, series.Relations.Where(r => r.RelationKind == RelationKind.Other).ToList(), series, RelationKind.Other);+ UpdateRelationForKind(dto.SideStories, series.Relations.Where(r => r.RelationKind == RelationKind.SideStory).ToList(), series, RelationKind.SideStory);+ UpdateRelationForKind(dto.SpinOffs, series.Relations.Where(r => r.RelationKind == RelationKind.SpinOff).ToList(), series, RelationKind.SpinOff);+ UpdateRelationForKind(dto.AlternativeSettings, series.Relations.Where(r => r.RelationKind == RelationKind.AlternativeSetting).ToList(), series, RelationKind.AlternativeSetting);+ UpdateRelationForKind(dto.AlternativeVersions, series.Relations.Where(r => r.RelationKind == RelationKind.AlternativeVersion).ToList(), series, RelationKind.AlternativeVersion);+ UpdateRelationForKind(dto.Doujinshis, series.Relations.Where(r => r.RelationKind == RelationKind.Doujinshi).ToList(), series, RelationKind.Doujinshi);+ UpdateRelationForKind(dto.Prequels, series.Relations.Where(r => r.RelationKind == RelationKind.Prequel).ToList(), series, RelationKind.Prequel);+ UpdateRelationForKind(dto.Sequels, series.Relations.Where(r => r.RelationKind == RelationKind.Sequel).ToList(), series, RelationKind.Sequel);++ if (!_unitOfWork.HasChanges()) return Ok();+ if (await _unitOfWork.CommitAsync()) return Ok();+++ return BadRequest("There was an issue updating relationships");+ }++ private void UpdateRelationForKind(IList<int> dtoTargetSeriesIds, IEnumerable<SeriesRelation> adaptations, Series series, RelationKind kind)+ {+ foreach (var adaptation in adaptations.Where(adaptation => !dtoTargetSeriesIds.Contains(adaptation.TargetSeriesId)))+ {+ // If the seriesId isn't in dto, it means we've removed or reclassified+ series.Relations.Remove(adaptation);+ }++ // At this point, we only have things to add+ foreach (var targetSeriesId in dtoTargetSeriesIds)+ {+ // This ensures we don't allow any duplicates to be added+ if (series.Relations.SingleOrDefault(r =>+ r.RelationKind == kind && r.TargetSeriesId == targetSeriesId) !=+ null) continue;++ series.Relations.Add(new SeriesRelation()+ {+ Series = series,+ SeriesId = series.Id,+ TargetSeriesId = targetSeriesId,+ RelationKind = kind+ });+ _unitOfWork.SeriesRepository.Update(series);+ }+ }}}diff --git a/API/Controllers/ThemeController.cs b/API/Controllers/ThemeController.csindex f6775d2dc..bf68e8641 100644--- a/API/Controllers/ThemeController.cs+++ b/API/Controllers/ThemeController.cs@@ -2,6 +2,7 @@using System.Threading.Tasks;using API.Data;using API.DTOs.Theme;+using API.Extensions;using API.Services;using API.Services.Tasks;using Kavita.Common;@@ -13,13 +14,13 @@ namespace API.Controllers;public class ThemeController : BaseApiController{private readonly IUnitOfWork _unitOfWork;- private readonly ISiteThemeService _siteThemeService;+ private readonly IThemeService _themeService;private readonly ITaskScheduler _taskScheduler;- public ThemeController(IUnitOfWork unitOfWork, ISiteThemeService siteThemeService, ITaskScheduler taskScheduler)+ public ThemeController(IUnitOfWork unitOfWork, IThemeService themeService, ITaskScheduler taskScheduler){_unitOfWork = unitOfWork;- _siteThemeService = siteThemeService;+ _themeService = themeService;_taskScheduler = taskScheduler;}@@ -39,9 +40,9 @@ public class ThemeController : BaseApiController[Authorize("RequireAdminRole")][HttpPost("update-default")]- public async Task<ActionResult> UpdateDefault(UpdateDefaultSiteThemeDto dto)+ public async Task<ActionResult> UpdateDefault(UpdateDefaultThemeDto dto){- await _siteThemeService.UpdateDefault(dto.ThemeId);+ await _themeService.UpdateDefault(dto.ThemeId);return Ok();}@@ -54,7 +55,7 @@ public class ThemeController : BaseApiController{try{- return Ok(await _siteThemeService.GetContent(themeId));+ return Ok(await _themeService.GetContent(themeId));}catch (KavitaException ex){diff --git a/API/Controllers/UploadController.cs b/API/Controllers/UploadController.csindex 4d07d4225..ca84acc8b 100644--- a/API/Controllers/UploadController.cs+++ b/API/Controllers/UploadController.cs@@ -5,6 +5,7 @@ using API.Data;using API.DTOs.Uploads;using API.Extensions;using API.Services;+using API.SignalR;using Flurl.Http;using Microsoft.AspNetCore.Authorization;using Microsoft.AspNetCore.Mvc;@@ -24,16 +25,18 @@ namespace API.Controllersprivate readonly ILogger<UploadController> _logger;private readonly ITaskScheduler _taskScheduler;private readonly IDirectoryService _directoryService;+ private readonly IEventHub _eventHub;/// <inheritdoc />public UploadController(IUnitOfWork unitOfWork, IImageService imageService, ILogger<UploadController> logger,- ITaskScheduler taskScheduler, IDirectoryService directoryService)+ ITaskScheduler taskScheduler, IDirectoryService directoryService, IEventHub eventHub){_unitOfWork = unitOfWork;_imageService = imageService;_logger = logger;_taskScheduler = taskScheduler;_directoryService = directoryService;+ _eventHub = eventHub;}/// <summary>@@ -99,6 +102,8 @@ namespace API.Controllersif (_unitOfWork.HasChanges()){+ await _eventHub.SendMessageAsync(MessageFactory.CoverUpdate,+ MessageFactory.CoverUpdateEvent(series.Id, MessageFactoryEntityTypes.Series), false);await _unitOfWork.CommitAsync();return Ok();}@@ -145,6 +150,8 @@ namespace API.Controllersif (_unitOfWork.HasChanges()){await _unitOfWork.CommitAsync();+ await _eventHub.SendMessageAsync(MessageFactory.CoverUpdate,+ MessageFactory.CoverUpdateEvent(tag.Id, MessageFactoryEntityTypes.CollectionTag), false);return Ok();}@@ -158,6 +165,53 @@ namespace API.Controllersreturn BadRequest("Unable to save cover image to Collection Tag");}+ /// <summary>+ /// Replaces reading list cover image and locks it with a base64 encoded image+ /// </summary>+ /// <param name="uploadFileDto"></param>+ /// <returns></returns>+ [Authorize(Policy = "RequireAdminRole")]+ [RequestSizeLimit(8_000_000)]+ [HttpPost("reading-list")]+ public async Task<ActionResult> UploadReadingListCoverImageFromUrl(UploadFileDto uploadFileDto)+ {+ // Check if Url is non empty, request the image and place in temp, then ask image service to handle it.+ // See if we can do this all in memory without touching underlying system+ if (string.IsNullOrEmpty(uploadFileDto.Url))+ {+ return BadRequest("You must pass a url to use");+ }++ try+ {+ var filePath = _imageService.CreateThumbnailFromBase64(uploadFileDto.Url, $"{ImageService.GetReadingListFormat(uploadFileDto.Id)}");+ var readingList = await _unitOfWork.ReadingListRepository.GetReadingListByIdAsync(uploadFileDto.Id);++ if (!string.IsNullOrEmpty(filePath))+ {+ readingList.CoverImage = filePath;+ readingList.CoverImageLocked = true;+ _unitOfWork.ReadingListRepository.Update(readingList);+ }++ if (_unitOfWork.HasChanges())+ {+ await _unitOfWork.CommitAsync();+ await _eventHub.SendMessageAsync(MessageFactory.CoverUpdate,+ MessageFactory.CoverUpdateEvent(readingList.Id, MessageFactoryEntityTypes.ReadingList), false);+ return Ok();+ }++ }+ catch (Exception e)+ {+ _logger.LogError(e, "There was an issue uploading cover image for Reading List {Id}", uploadFileDto.Id);+ await _unitOfWork.RollbackAsync();+ }++ return BadRequest("Unable to save cover image to Reading List");+ }+/// <summary>/// Replaces chapter cover image and locks it with a base64 encoded image. This will update the parent volume's cover image./// </summary>@@ -193,6 +247,10 @@ namespace API.Controllersif (_unitOfWork.HasChanges()){await _unitOfWork.CommitAsync();+ await _eventHub.SendMessageAsync(MessageFactory.CoverUpdate,+ MessageFactory.CoverUpdateEvent(chapter.VolumeId, MessageFactoryEntityTypes.Volume), false);+ await _eventHub.SendMessageAsync(MessageFactory.CoverUpdate,+ MessageFactory.CoverUpdateEvent(chapter.Id, MessageFactoryEntityTypes.Chapter), false);return Ok();}diff --git a/API/Controllers/UsersController.cs b/API/Controllers/UsersController.csindex 3fda79468..97dae76a4 100644--- a/API/Controllers/UsersController.cs+++ b/API/Controllers/UsersController.cs@@ -82,11 +82,13 @@ namespace API.ControllersexistingPreferences.BookReaderMargin = preferencesDto.BookReaderMargin;existingPreferences.BookReaderLineSpacing = preferencesDto.BookReaderLineSpacing;existingPreferences.BookReaderFontFamily = preferencesDto.BookReaderFontFamily;- existingPreferences.BookReaderDarkMode = preferencesDto.BookReaderDarkMode;existingPreferences.BookReaderFontSize = preferencesDto.BookReaderFontSize;existingPreferences.BookReaderTapToPaginate = preferencesDto.BookReaderTapToPaginate;existingPreferences.BookReaderReadingDirection = preferencesDto.BookReaderReadingDirection;preferencesDto.Theme ??= await _unitOfWork.SiteThemeRepository.GetDefaultTheme();+ existingPreferences.BookThemeName = preferencesDto.BookReaderThemeName;+ existingPreferences.PageLayoutMode = preferencesDto.BookReaderLayoutMode;+ existingPreferences.BookReaderImmersiveMode = preferencesDto.BookReaderImmersiveMode;existingPreferences.Theme = await _unitOfWork.SiteThemeRepository.GetThemeById(preferencesDto.Theme.Id);// TODO: Remove this code - this overrides layout mode to be single until the mode is releaseddiff --git a/API/DTOs/Account/InviteUserDto.cs b/API/DTOs/Account/InviteUserDto.csindex 42d4bdf8e..9d0d9416d 100644--- a/API/DTOs/Account/InviteUserDto.cs+++ b/API/DTOs/Account/InviteUserDto.cs@@ -6,7 +6,7 @@ namespace API.DTOs.Account;public class InviteUserDto{[Required]- public string Email { get; init; }+ public string Email { get; set; }/// <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.diff --git a/API/DTOs/Filtering/FilterDto.cs b/API/DTOs/Filtering/FilterDto.csindex 1a8d9fc8b..892f9e6b9 100644--- a/API/DTOs/Filtering/FilterDto.cs+++ b/API/DTOs/Filtering/FilterDto.cs@@ -99,6 +99,5 @@ namespace API.DTOs.Filtering/// An optional name string to filter by. Empty string will ignore./// </summary>public string SeriesNameQuery { get; init; } = string.Empty;-}}diff --git a/API/DTOs/Filtering/SortField.cs b/API/DTOs/Filtering/SortField.csindex 0e465f6aa..3d78494bd 100644--- a/API/DTOs/Filtering/SortField.cs+++ b/API/DTOs/Filtering/SortField.cs@@ -5,4 +5,5 @@ public enum SortFieldSortName = 1,CreatedDate = 2,LastModifiedDate = 3,+ LastChapterAdded = 4}diff --git a/API/DTOs/MangaFileDto.cs b/API/DTOs/MangaFileDto.csindex 786f85df7..c1220e28d 100644--- a/API/DTOs/MangaFileDto.cs+++ b/API/DTOs/MangaFileDto.cs@@ -4,9 +4,10 @@ namespace API.DTOs{public class MangaFileDto{+ public int Id { get; init; }public string FilePath { get; init; }public int Pages { get; init; }public MangaFormat Format { get; init; }-+}-}\ No newline at end of file+}diff --git a/API/DTOs/Reader/BookmarkInfoDto.cs b/API/DTOs/Reader/BookmarkInfoDto.csnew file mode 100644index 000000000..a34eb81c2--- /dev/null+++ b/API/DTOs/Reader/BookmarkInfoDto.cs@@ -0,0 +1,13 @@+using API.Entities.Enums;++namespace API.DTOs.Reader;++public class BookmarkInfoDto+{+ public string SeriesName { get; set; }+ 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; }+}diff --git a/API/DTOs/ReadingLists/ReadingListDto.cs b/API/DTOs/ReadingLists/ReadingListDto.csindex e3837a2e3..3eb5ded79 100644--- a/API/DTOs/ReadingLists/ReadingListDto.cs+++ b/API/DTOs/ReadingLists/ReadingListDto.cs@@ -9,5 +9,6 @@/// Reading lists that are promoted are only done by admins/// </summary>public bool Promoted { get; set; }+ public bool CoverImageLocked { get; set; }}}diff --git a/API/DTOs/ReadingLists/UpdateReadingListDto.cs b/API/DTOs/ReadingLists/UpdateReadingListDto.csindex a9f6f0d59..5b8f69731 100644--- a/API/DTOs/ReadingLists/UpdateReadingListDto.cs+++ b/API/DTOs/ReadingLists/UpdateReadingListDto.cs@@ -6,5 +6,6 @@public string Title { get; set; }public string Summary { get; set; }public bool Promoted { get; set; }+ public bool CoverImageLocked { get; set; }}}diff --git a/API/DTOs/Search/SearchResultGroupDto.cs b/API/DTOs/Search/SearchResultGroupDto.csindex b21209dca..0a1fac402 100644--- a/API/DTOs/Search/SearchResultGroupDto.cs+++ b/API/DTOs/Search/SearchResultGroupDto.cs@@ -17,5 +17,8 @@ public class SearchResultGroupDtopublic 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; }+}diff --git a/API/DTOs/SeriesDetail/RelatedSeriesDto.cs b/API/DTOs/SeriesDetail/RelatedSeriesDto.csnew file mode 100644index 000000000..f3c3fd644--- /dev/null+++ b/API/DTOs/SeriesDetail/RelatedSeriesDto.cs@@ -0,0 +1,25 @@+using System.Collections.Generic;+using API.Entities.Enums;++namespace API.DTOs.SeriesDetail;++public class RelatedSeriesDto+{+ /// <summary>+ /// The parent relationship Series+ /// </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; }+}diff --git a/API/DTOs/SeriesDetailDto.cs b/API/DTOs/SeriesDetail/SeriesDetailDto.cssimilarity index 100%rename from API/DTOs/SeriesDetailDto.csrename to API/DTOs/SeriesDetail/SeriesDetailDto.csdiff --git a/API/DTOs/SeriesDetail/UpdateRelatedSeriesDto.cs b/API/DTOs/SeriesDetail/UpdateRelatedSeriesDto.csnew file mode 100644index 000000000..b39f91244--- /dev/null+++ b/API/DTOs/SeriesDetail/UpdateRelatedSeriesDto.cs@@ -0,0 +1,19 @@+using System.Collections.Generic;++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; }+}diff --git a/API/DTOs/SeriesDto.cs b/API/DTOs/SeriesDto.csindex 5f76634ff..a5756ceca 100644--- a/API/DTOs/SeriesDto.cs+++ b/API/DTOs/SeriesDto.cs@@ -22,6 +22,10 @@ namespace API.DTOs/// </summary>public DateTime LatestReadDate { get; set; }/// <summary>+ /// DateTime representing last time a chapter was added to the Series+ /// </summary>+ public DateTime LastChapterAdded { get; set; }+ /// <summary>/// Rating from logged in user. Calculated at API-time./// </summary>public int UserRating { get; set; }diff --git a/API/DTOs/SeriesMetadataDto.cs b/API/DTOs/SeriesMetadataDto.csindex d5ad24610..9a396f5d1 100644--- a/API/DTOs/SeriesMetadataDto.cs+++ b/API/DTOs/SeriesMetadataDto.cs@@ -45,11 +45,11 @@ namespace API.DTOs/// </summary>public string Language { get; set; } = string.Empty;/// <summary>- /// Number in the TotalCount of issues+ /// Max number of issues/volumes in the series (Max of Volume/Issue field in ComicInfo)/// </summary>- public int Count { get; set; }+ public int MaxCount { get; set; } = 0;/// <summary>- /// Total number of issues for the series+ /// Total number of issues/volumes for the series/// </summary>public int TotalCount { get; set; }/// <summary>@@ -69,16 +69,16 @@ namespace API.DTOspublic bool PublicationStatusLocked { get; set; }public bool GenresLocked { get; set; }public bool TagsLocked { get; set; }- public bool WriterLocked { get; set; }- public bool CharacterLocked { get; set; }- public bool ColoristLocked { get; set; }- public bool EditorLocked { get; set; }- public bool InkerLocked { get; set; }- public bool LettererLocked { get; set; }- public bool PencillerLocked { get; set; }- public bool PublisherLocked { get; set; }- public bool TranslatorLocked { get; set; }- public bool CoverArtistLocked { get; set; }+ public bool WritersLocked { get; set; }+ public bool CharactersLocked { get; set; }+ public bool ColoristsLocked { get; set; }+ public bool EditorsLocked { get; set; }+ public bool InkersLocked { get; set; }+ public bool LetterersLocked { get; set; }+ public bool PencillersLocked { get; set; }+ public bool PublishersLocked { get; set; }+ public bool TranslatorsLocked { get; set; }+ public bool CoverArtistsLocked { get; set; }public int SeriesId { get; set; }diff --git a/API/DTOs/Theme/SiteThemeDto.cs b/API/DTOs/Theme/SiteThemeDto.csindex e8b0460f9..7c44a1cd0 100644--- a/API/DTOs/Theme/SiteThemeDto.cs+++ b/API/DTOs/Theme/SiteThemeDto.cs@@ -4,6 +4,9 @@ using API.Services;namespace API.DTOs.Theme;+/// <summary>+/// Represents a set of css overrides the user can upload to Kavita and will load into webui+/// </summary>public class SiteThemeDto{public int Id { get; set; }diff --git a/API/DTOs/Theme/UpdateDefaultSiteThemeDto.cs b/API/DTOs/Theme/UpdateDefaultThemeDto.cssimilarity index 64%rename from API/DTOs/Theme/UpdateDefaultSiteThemeDto.csrename to API/DTOs/Theme/UpdateDefaultThemeDto.csindex d4bdb8e09..0f2b129f3 100644--- a/API/DTOs/Theme/UpdateDefaultSiteThemeDto.cs+++ b/API/DTOs/Theme/UpdateDefaultThemeDto.cs@@ -1,6 +1,6 @@namespace API.DTOs.Theme;-public class UpdateDefaultSiteThemeDto+public class UpdateDefaultThemeDto{public int ThemeId { get; set; }}diff --git a/API/DTOs/UserPreferencesDto.cs b/API/DTOs/UserPreferencesDto.csindex 4bfcb2d77..4fc2f6904 100644--- a/API/DTOs/UserPreferencesDto.cs+++ b/API/DTOs/UserPreferencesDto.cs@@ -1,4 +1,5 @@-using API.Entities;+using API.DTOs.Theme;+using API.Entities;using API.Entities.Enums;namespace API.DTOs@@ -74,5 +75,12 @@ namespace API.DTOs/// </summary>/// <remarks>Should default to Dark</remarks>public SiteTheme Theme { get; set; }+ public string BookReaderThemeName { get; set; }+ public BookPageLayoutMode BookReaderLayoutMode { get; set; }+ /// <summary>+ /// Book Reader Option: A flag that hides the menu-ing system behind a click on the screen. This should be used with tap to paginate, but the app doesn't enforce this.+ /// </summary>+ /// <remarks>Defaults to false</remarks>+ public bool BookReaderImmersiveMode { get; set; } = false;}}diff --git a/API/Data/DataContext.cs b/API/Data/DataContext.csindex 6822467a8..154cdf2fc 100644--- a/API/Data/DataContext.cs+++ b/API/Data/DataContext.cs@@ -41,6 +41,7 @@ namespace API.Datapublic DbSet<Genre> Genre { get; set; }public DbSet<Tag> Tag { get; set; }public DbSet<SiteTheme> SiteTheme { get; set; }+ public DbSet<SeriesRelation> SeriesRelation { get; set; }protected override void OnModelCreating(ModelBuilder builder)@@ -59,10 +60,28 @@ namespace API.Data.WithOne(u => u.Role).HasForeignKey(ur => ur.RoleId).IsRequired();++ builder.Entity<SeriesRelation>()+ .HasOne(pt => pt.Series)+ .WithMany(p => p.Relations)+ .HasForeignKey(pt => pt.SeriesId)+ .OnDelete(DeleteBehavior.ClientCascade);++ builder.Entity<SeriesRelation>()+ .HasOne(pt => pt.TargetSeries)+ .WithMany(t => t.RelationOf)+ .HasForeignKey(pt => pt.TargetSeriesId);++ builder.Entity<AppUserPreferences>()+ .Property(b => b.BookThemeName)+ .HasDefaultValue("Dark");+ builder.Entity<AppUserPreferences>()+ .Property(b => b.BackgroundColor)+ .HasDefaultValue("#000000");}- void OnEntityTracked(object sender, EntityTrackedEventArgs e)+ static void OnEntityTracked(object sender, EntityTrackedEventArgs e){if (!e.FromQuery && e.Entry.State == EntityState.Added && e.Entry.Entity is IEntityDate entity){@@ -72,7 +91,7 @@ namespace API.Data}- void OnEntityStateChanged(object sender, EntityStateChangedEventArgs e)+ static void OnEntityStateChanged(object sender, EntityStateChangedEventArgs e){if (e.NewState == EntityState.Modified && e.Entry.Entity is IEntityDate entity)entity.LastModified = DateTime.Now;diff --git a/API/Data/DbFactory.cs b/API/Data/DbFactory.csindex 46ebfbf10..ad97958da 100644--- a/API/Data/DbFactory.cs+++ b/API/Data/DbFactory.cs@@ -35,7 +35,7 @@ namespace API.Datareturn new Volume(){Name = volumeNumber,- Number = (int) Parser.Parser.MinimumNumberFromRange(volumeNumber),+ Number = (int) Parser.Parser.MinNumberFromRange(volumeNumber),Chapters = new List<Chapter>()};}@@ -46,7 +46,7 @@ namespace API.Datavar specialTitle = specialTreatment ? info.Filename : info.Chapters;return new Chapter(){- Number = specialTreatment ? "0" : Parser.Parser.MinimumNumberFromRange(info.Chapters) + string.Empty,+ Number = specialTreatment ? "0" : Parser.Parser.MinNumberFromRange(info.Chapters) + string.Empty,Range = specialTreatment ? info.Filename : info.Chapters,Title = (specialTreatment && info.Format == MangaFormat.Epub)? info.Title@@ -82,6 +82,29 @@ namespace API.Data};}+ public static ReadingList ReadingList(string title, string summary, bool promoted)+ {+ return new ReadingList()+ {+ NormalizedTitle = API.Parser.Parser.Normalize(title?.Trim()).ToUpper(),+ 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, bool external){return new Genre()diff --git a/API/Data/Metadata/ComicInfo.cs b/API/Data/Metadata/ComicInfo.csindex 040d7f6b7..0c236fd58 100644--- a/API/Data/Metadata/ComicInfo.cs+++ b/API/Data/Metadata/ComicInfo.cs@@ -14,6 +14,10 @@ namespace API.Data.Metadatapublic string Summary { get; set; } = string.Empty;public string Title { get; set; } = string.Empty;public string Series { get; set; } = string.Empty;+ /// <summary>+ /// Localized Series name. Not standard.+ /// </summary>+ public string LocalizedSeries { get; set; } = string.Empty;public string SeriesSort { get; set; } = string.Empty;public string Number { get; set; } = string.Empty;/// <summary>@@ -47,11 +51,11 @@ namespace API.Data.Metadata/// </summary>public float UserRating { get; set; }- public string AlternateSeries { get; set; } = string.Empty;public string StoryArc { get; set; } = string.Empty;public string SeriesGroup { get; set; } = string.Empty;- public string AlternativeSeries { get; set; } = string.Empty;- public string AlternativeNumber { get; set; } = string.Empty;+ public string AlternateNumber { get; set; } = string.Empty;+ public int AlternateCount { get; set; } = 0;+ public string AlternateSeries { get; set; } = string.Empty;/// <summary>/// This is Epub only: calibre:title_sort@@ -94,6 +98,10 @@ namespace API.Data.Metadata{if (info == null) return;+ info.Series = info.Series.Trim();+ info.SeriesSort = info.SeriesSort.Trim();+ info.LocalizedSeries = info.LocalizedSeries.Trim();+info.Writer = Parser.Parser.CleanAuthor(info.Writer);info.Colorist = Parser.Parser.CleanAuthor(info.Colorist);info.Editor = Parser.Parser.CleanAuthor(info.Editor);diff --git a/API/Data/MigrateRemoveExtraThemes.cs b/API/Data/MigrateRemoveExtraThemes.csnew file mode 100644index 000000000..1c9a1e9b0--- /dev/null+++ b/API/Data/MigrateRemoveExtraThemes.cs@@ -0,0 +1,56 @@+using System;+using System.Linq;+using System.Threading.Tasks;+using API.Services.Tasks;++namespace API.Data;++/// <summary>+/// In v0.5.3, we removed Light and E-Ink themes. This migration will remove the themes from the DB and default anyone on+/// null, E-Ink, or Light to Dark.+/// </summary>+public static class MigrateRemoveExtraThemes+{+ public static async Task Migrate(IUnitOfWork unitOfWork, IThemeService themeService)+ {+ Console.WriteLine("Removing Dark and E-Ink themes");++ var themes = (await unitOfWork.SiteThemeRepository.GetThemes()).ToList();++ if (themes.FirstOrDefault(t => t.Name.Equals("Light")) == null)+ {+ Console.WriteLine("Done. Nothing to do");+ return;+ }++ var darkTheme = themes.Single(t => t.Name.Equals("Dark"));+ var lightTheme = themes.Single(t => t.Name.Equals("Light"));+ var eInkTheme = themes.Single(t => t.Name.Equals("E-Ink"));++++ // Update default theme if it's not Dark or a custom theme+ await themeService.UpdateDefault(darkTheme.Id);++ // Update all users to Dark theme if they are on Light/E-Ink+ foreach (var pref in await unitOfWork.UserRepository.GetAllPreferencesByThemeAsync(lightTheme.Id))+ {+ pref.Theme = darkTheme;+ }+ foreach (var pref in await unitOfWork.UserRepository.GetAllPreferencesByThemeAsync(eInkTheme.Id))+ {+ pref.Theme = darkTheme;+ }++ // Remove Light/E-Ink themes+ foreach (var siteTheme in themes.Where(t => t.Name.Equals("Light") || t.Name.Equals("E-Ink")))+ {+ unitOfWork.SiteThemeRepository.Remove(siteTheme);+ }+ // Commit and call it a day+ await unitOfWork.CommitAsync();++ Console.WriteLine("Completed removing Dark and E-Ink themes");+ }++}diff --git a/API/Data/Migrations/20220410230540_SeriesLastChapterAddedAndReadingListNormalization.Designer.cs b/API/Data/Migrations/20220410230540_SeriesLastChapterAddedAndReadingListNormalization.Designer.csnew file mode 100644index 000000000..27d16bfde--- /dev/null+++ b/API/Data/Migrations/20220410230540_SeriesLastChapterAddedAndReadingListNormalization.Designer.cs@@ -0,0 +1,1469 @@+// <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("20220410230540_SeriesLastChapterAddedAndReadingListNormalization")]+ partial class SeriesLastChapterAddedAndReadingListNormalization+ {+ protected override void BuildTargetModel(ModelBuilder modelBuilder)+ {+#pragma warning disable 612, 618+ modelBuilder.HasAnnotation("ProductVersion", "6.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<string>("ApiKey")+ .HasColumnType("TEXT");++ b.Property<string>("ConcurrencyStamp")+ .IsConcurrencyToken()+ .HasColumnType("TEXT");++ b.Property<DateTime>("Created")+ .HasColumnType("TEXT");++ b.Property<string>("Email")+ .HasMaxLength(256)+ .HasColumnType("TEXT");++ b.Property<bool>("EmailConfirmed")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("LastActive")+ .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<string>("FileName")+ .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")+ .HasColumnType("TEXT");++ b.Property<bool>("BookReaderDarkMode")+ .HasColumnType("INTEGER");++ b.Property<string>("BookReaderFontFamily")+ .HasColumnType("TEXT");++ b.Property<int>("BookReaderFontSize")+ .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>("LayoutMode")+ .HasColumnType("INTEGER");++ b.Property<int>("PageSplitOption")+ .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<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>("LastModified")+ .HasColumnType("TEXT");++ 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("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>("Count")+ .HasColumnType("INTEGER");++ b.Property<string>("CoverImage")+ .HasColumnType("TEXT");++ b.Property<bool>("CoverImageLocked")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("Created")+ .HasColumnType("TEXT");++ b.Property<bool>("IsSpecial")+ .HasColumnType("INTEGER");++ b.Property<string>("Language")+ .HasColumnType("TEXT");++ b.Property<DateTime>("LastModified")+ .HasColumnType("TEXT");++ 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>("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.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.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<bool>("ExternalTag")+ .HasColumnType("INTEGER");++ b.Property<string>("NormalizedTitle")+ .HasColumnType("TEXT");++ b.Property<string>("Title")+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("NormalizedTitle", "ExternalTag")+ .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>("LastModified")+ .HasColumnType("TEXT");++ b.Property<DateTime>("LastScanned")+ .HasColumnType("TEXT");++ 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<int>("ChapterId")+ .HasColumnType("INTEGER");++ b.Property<string>("FilePath")+ .HasColumnType("TEXT");++ b.Property<int>("Format")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("LastModified")+ .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<int>("Count")+ .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<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<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<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.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>("AppUserId")+ .HasColumnType("INTEGER");++ b.Property<string>("CoverImage")+ .HasColumnType("TEXT");++ b.Property<bool>("CoverImageLocked")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("Created")+ .HasColumnType("TEXT");++ b.Property<DateTime>("LastModified")+ .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<string>("CoverImage")+ .HasColumnType("TEXT");++ b.Property<bool>("CoverImageLocked")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("Created")+ .HasColumnType("TEXT");++ b.Property<int>("Format")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("LastChapterAdded")+ .HasColumnType("TEXT");++ b.Property<DateTime>("LastModified")+ .HasColumnType("TEXT");++ b.Property<int>("LibraryId")+ .HasColumnType("INTEGER");++ b.Property<string>("LocalizedName")+ .HasColumnType("TEXT");++ b.Property<bool>("LocalizedNameLocked")+ .HasColumnType("INTEGER");++ b.Property<string>("Name")+ .HasColumnType("TEXT");++ b.Property<bool>("NameLocked")+ .HasColumnType("INTEGER");++ 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.HasKey("Id");++ b.HasIndex("LibraryId");++ b.HasIndex("Name", "NormalizedName", "LocalizedName", "LibraryId", "Format")+ .IsUnique();++ 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.SiteTheme", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<DateTime>("Created")+ .HasColumnType("TEXT");++ b.Property<string>("FileName")+ .HasColumnType("TEXT");++ b.Property<bool>("IsDefault")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("LastModified")+ .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<bool>("ExternalTag")+ .HasColumnType("INTEGER");++ b.Property<string>("NormalizedTitle")+ .HasColumnType("TEXT");++ b.Property<string>("Title")+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("NormalizedTitle", "ExternalTag")+ .IsUnique();++ b.ToTable("Tag");+ });++ modelBuilder.Entity("API.Entities.Volume", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<string>("CoverImage")+ .HasColumnType("TEXT");++ b.Property<DateTime>("Created")+ .HasColumnType("TEXT");++ b.Property<DateTime>("LastModified")+ .HasColumnType("TEXT");++ 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.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.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.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.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.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("Progresses");++ b.Navigation("Ratings");++ b.Navigation("ReadingLists");++ b.Navigation("UserPreferences");++ b.Navigation("UserRoles");+ });++ modelBuilder.Entity("API.Entities.Chapter", b =>+ {+ b.Navigation("Files");+ });++ 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("Volumes");+ });++ modelBuilder.Entity("API.Entities.Volume", b =>+ {+ b.Navigation("Chapters");+ });+#pragma warning restore 612, 618+ }+ }+}diff --git a/API/Data/Migrations/20220410230540_SeriesLastChapterAddedAndReadingListNormalization.cs b/API/Data/Migrations/20220410230540_SeriesLastChapterAddedAndReadingListNormalization.csnew file mode 100644index 000000000..445895472--- /dev/null+++ b/API/Data/Migrations/20220410230540_SeriesLastChapterAddedAndReadingListNormalization.cs@@ -0,0 +1,58 @@+using System;+using Microsoft.EntityFrameworkCore.Migrations;++#nullable disable++namespace API.Data.Migrations+{+ public partial class SeriesLastChapterAddedAndReadingListNormalization : Migration+ {+ protected override void Up(MigrationBuilder migrationBuilder)+ {+ migrationBuilder.AddColumn<DateTime>(+ name: "LastChapterAdded",+ table: "Series",+ type: "TEXT",+ nullable: false,+ defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));++ migrationBuilder.AddColumn<string>(+ name: "CoverImage",+ table: "ReadingList",+ type: "TEXT",+ nullable: true);++ migrationBuilder.AddColumn<bool>(+ name: "CoverImageLocked",+ table: "ReadingList",+ type: "INTEGER",+ nullable: false,+ defaultValue: false);++ migrationBuilder.AddColumn<string>(+ name: "NormalizedTitle",+ table: "ReadingList",+ type: "TEXT",+ nullable: true);+ }++ protected override void Down(MigrationBuilder migrationBuilder)+ {+ migrationBuilder.DropColumn(+ name: "LastChapterAdded",+ table: "Series");++ migrationBuilder.DropColumn(+ name: "CoverImage",+ table: "ReadingList");++ migrationBuilder.DropColumn(+ name: "CoverImageLocked",+ table: "ReadingList");++ migrationBuilder.DropColumn(+ name: "NormalizedTitle",+ table: "ReadingList");+ }+ }+}diff --git a/API/Data/Migrations/20220416211340_RemoveCustomIndex.Designer.cs b/API/Data/Migrations/20220416211340_RemoveCustomIndex.Designer.csnew file mode 100644index 000000000..dd2c6ce88--- /dev/null+++ b/API/Data/Migrations/20220416211340_RemoveCustomIndex.Designer.cs@@ -0,0 +1,1466 @@+// <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("20220416211340_RemoveCustomIndex")]+ partial class RemoveCustomIndex+ {+ protected override void BuildTargetModel(ModelBuilder modelBuilder)+ {+#pragma warning disable 612, 618+ modelBuilder.HasAnnotation("ProductVersion", "6.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<string>("ApiKey")+ .HasColumnType("TEXT");++ b.Property<string>("ConcurrencyStamp")+ .IsConcurrencyToken()+ .HasColumnType("TEXT");++ b.Property<DateTime>("Created")+ .HasColumnType("TEXT");++ b.Property<string>("Email")+ .HasMaxLength(256)+ .HasColumnType("TEXT");++ b.Property<bool>("EmailConfirmed")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("LastActive")+ .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<string>("FileName")+ .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")+ .HasColumnType("TEXT");++ b.Property<bool>("BookReaderDarkMode")+ .HasColumnType("INTEGER");++ b.Property<string>("BookReaderFontFamily")+ .HasColumnType("TEXT");++ b.Property<int>("BookReaderFontSize")+ .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>("LayoutMode")+ .HasColumnType("INTEGER");++ b.Property<int>("PageSplitOption")+ .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<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>("LastModified")+ .HasColumnType("TEXT");++ 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("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>("Count")+ .HasColumnType("INTEGER");++ b.Property<string>("CoverImage")+ .HasColumnType("TEXT");++ b.Property<bool>("CoverImageLocked")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("Created")+ .HasColumnType("TEXT");++ b.Property<bool>("IsSpecial")+ .HasColumnType("INTEGER");++ b.Property<string>("Language")+ .HasColumnType("TEXT");++ b.Property<DateTime>("LastModified")+ .HasColumnType("TEXT");++ 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>("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.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.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<bool>("ExternalTag")+ .HasColumnType("INTEGER");++ b.Property<string>("NormalizedTitle")+ .HasColumnType("TEXT");++ b.Property<string>("Title")+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("NormalizedTitle", "ExternalTag")+ .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>("LastModified")+ .HasColumnType("TEXT");++ b.Property<DateTime>("LastScanned")+ .HasColumnType("TEXT");++ 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<int>("ChapterId")+ .HasColumnType("INTEGER");++ b.Property<string>("FilePath")+ .HasColumnType("TEXT");++ b.Property<int>("Format")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("LastModified")+ .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<int>("Count")+ .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<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<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<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.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>("AppUserId")+ .HasColumnType("INTEGER");++ b.Property<string>("CoverImage")+ .HasColumnType("TEXT");++ b.Property<bool>("CoverImageLocked")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("Created")+ .HasColumnType("TEXT");++ b.Property<DateTime>("LastModified")+ .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<string>("CoverImage")+ .HasColumnType("TEXT");++ b.Property<bool>("CoverImageLocked")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("Created")+ .HasColumnType("TEXT");++ b.Property<int>("Format")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("LastChapterAdded")+ .HasColumnType("TEXT");++ b.Property<DateTime>("LastModified")+ .HasColumnType("TEXT");++ b.Property<int>("LibraryId")+ .HasColumnType("INTEGER");++ b.Property<string>("LocalizedName")+ .HasColumnType("TEXT");++ b.Property<bool>("LocalizedNameLocked")+ .HasColumnType("INTEGER");++ b.Property<string>("Name")+ .HasColumnType("TEXT");++ b.Property<bool>("NameLocked")+ .HasColumnType("INTEGER");++ 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.HasKey("Id");++ 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.SiteTheme", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<DateTime>("Created")+ .HasColumnType("TEXT");++ b.Property<string>("FileName")+ .HasColumnType("TEXT");++ b.Property<bool>("IsDefault")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("LastModified")+ .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<bool>("ExternalTag")+ .HasColumnType("INTEGER");++ b.Property<string>("NormalizedTitle")+ .HasColumnType("TEXT");++ b.Property<string>("Title")+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("NormalizedTitle", "ExternalTag")+ .IsUnique();++ b.ToTable("Tag");+ });++ modelBuilder.Entity("API.Entities.Volume", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<string>("CoverImage")+ .HasColumnType("TEXT");++ b.Property<DateTime>("Created")+ .HasColumnType("TEXT");++ b.Property<DateTime>("LastModified")+ .HasColumnType("TEXT");++ 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.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.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.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.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.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("Progresses");++ b.Navigation("Ratings");++ b.Navigation("ReadingLists");++ b.Navigation("UserPreferences");++ b.Navigation("UserRoles");+ });++ modelBuilder.Entity("API.Entities.Chapter", b =>+ {+ b.Navigation("Files");+ });++ 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("Volumes");+ });++ modelBuilder.Entity("API.Entities.Volume", b =>+ {+ b.Navigation("Chapters");+ });+#pragma warning restore 612, 618+ }+ }+}diff --git a/API/Data/Migrations/20220416211340_RemoveCustomIndex.cs b/API/Data/Migrations/20220416211340_RemoveCustomIndex.csnew file mode 100644index 000000000..eb60f2349--- /dev/null+++ b/API/Data/Migrations/20220416211340_RemoveCustomIndex.cs@@ -0,0 +1,25 @@+using Microsoft.EntityFrameworkCore.Migrations;++#nullable disable++namespace API.Data.Migrations+{+ public partial class RemoveCustomIndex : Migration+ {+ protected override void Up(MigrationBuilder migrationBuilder)+ {+ migrationBuilder.DropIndex(+ name: "IX_Series_Name_NormalizedName_LocalizedName_LibraryId_Format",+ table: "Series");+ }++ protected override void Down(MigrationBuilder migrationBuilder)+ {+ migrationBuilder.CreateIndex(+ name: "IX_Series_Name_NormalizedName_LocalizedName_LibraryId_Format",+ table: "Series",+ columns: new[] { "Name", "NormalizedName", "LocalizedName", "LibraryId", "Format" },+ unique: true);+ }+ }+}diff --git a/API/Data/Migrations/20220421214448_SeriesRelations.Designer.cs b/API/Data/Migrations/20220421214448_SeriesRelations.Designer.csnew file mode 100644index 000000000..11937eb15--- /dev/null+++ b/API/Data/Migrations/20220421214448_SeriesRelations.Designer.cs@@ -0,0 +1,1513 @@+// <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("20220421214448_SeriesRelations")]+ partial class SeriesRelations+ {+ protected override void BuildTargetModel(ModelBuilder modelBuilder)+ {+#pragma warning disable 612, 618+ modelBuilder.HasAnnotation("ProductVersion", "6.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<string>("ApiKey")+ .HasColumnType("TEXT");++ b.Property<string>("ConcurrencyStamp")+ .IsConcurrencyToken()+ .HasColumnType("TEXT");++ b.Property<DateTime>("Created")+ .HasColumnType("TEXT");++ b.Property<string>("Email")+ .HasMaxLength(256)+ .HasColumnType("TEXT");++ b.Property<bool>("EmailConfirmed")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("LastActive")+ .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<string>("FileName")+ .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")+ .HasColumnType("TEXT");++ b.Property<bool>("BookReaderDarkMode")+ .HasColumnType("INTEGER");++ b.Property<string>("BookReaderFontFamily")+ .HasColumnType("TEXT");++ b.Property<int>("BookReaderFontSize")+ .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>("LayoutMode")+ .HasColumnType("INTEGER");++ b.Property<int>("PageSplitOption")+ .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<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>("LastModified")+ .HasColumnType("TEXT");++ 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("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>("Count")+ .HasColumnType("INTEGER");++ b.Property<string>("CoverImage")+ .HasColumnType("TEXT");++ b.Property<bool>("CoverImageLocked")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("Created")+ .HasColumnType("TEXT");++ b.Property<bool>("IsSpecial")+ .HasColumnType("INTEGER");++ b.Property<string>("Language")+ .HasColumnType("TEXT");++ b.Property<DateTime>("LastModified")+ .HasColumnType("TEXT");++ 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>("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.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.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<bool>("ExternalTag")+ .HasColumnType("INTEGER");++ b.Property<string>("NormalizedTitle")+ .HasColumnType("TEXT");++ b.Property<string>("Title")+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("NormalizedTitle", "ExternalTag")+ .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>("LastModified")+ .HasColumnType("TEXT");++ b.Property<DateTime>("LastScanned")+ .HasColumnType("TEXT");++ 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<int>("ChapterId")+ .HasColumnType("INTEGER");++ b.Property<string>("FilePath")+ .HasColumnType("TEXT");++ b.Property<int>("Format")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("LastModified")+ .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<int>("Count")+ .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<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<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<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>("AppUserId")+ .HasColumnType("INTEGER");++ b.Property<string>("CoverImage")+ .HasColumnType("TEXT");++ b.Property<bool>("CoverImageLocked")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("Created")+ .HasColumnType("TEXT");++ b.Property<DateTime>("LastModified")+ .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<string>("CoverImage")+ .HasColumnType("TEXT");++ b.Property<bool>("CoverImageLocked")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("Created")+ .HasColumnType("TEXT");++ b.Property<int>("Format")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("LastChapterAdded")+ .HasColumnType("TEXT");++ b.Property<DateTime>("LastModified")+ .HasColumnType("TEXT");++ b.Property<int>("LibraryId")+ .HasColumnType("INTEGER");++ b.Property<string>("LocalizedName")+ .HasColumnType("TEXT");++ b.Property<bool>("LocalizedNameLocked")+ .HasColumnType("INTEGER");++ b.Property<string>("Name")+ .HasColumnType("TEXT");++ b.Property<bool>("NameLocked")+ .HasColumnType("INTEGER");++ 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.HasKey("Id");++ 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.SiteTheme", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<DateTime>("Created")+ .HasColumnType("TEXT");++ b.Property<string>("FileName")+ .HasColumnType("TEXT");++ b.Property<bool>("IsDefault")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("LastModified")+ .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<bool>("ExternalTag")+ .HasColumnType("INTEGER");++ b.Property<string>("NormalizedTitle")+ .HasColumnType("TEXT");++ b.Property<string>("Title")+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("NormalizedTitle", "ExternalTag")+ .IsUnique();++ b.ToTable("Tag");+ });++ modelBuilder.Entity("API.Entities.Volume", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<string>("CoverImage")+ .HasColumnType("TEXT");++ b.Property<DateTime>("Created")+ .HasColumnType("TEXT");++ b.Property<DateTime>("LastModified")+ .HasColumnType("TEXT");++ 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.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.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.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.Restrict)+ .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.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("Progresses");++ b.Navigation("Ratings");++ b.Navigation("ReadingLists");++ b.Navigation("UserPreferences");++ b.Navigation("UserRoles");+ });++ modelBuilder.Entity("API.Entities.Chapter", b =>+ {+ b.Navigation("Files");+ });++ 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/20220421214448_SeriesRelations.cs b/API/Data/Migrations/20220421214448_SeriesRelations.csnew file mode 100644index 000000000..1f6d5d7ab--- /dev/null+++ b/API/Data/Migrations/20220421214448_SeriesRelations.cs@@ -0,0 +1,55 @@+using Microsoft.EntityFrameworkCore.Migrations;++#nullable disable++namespace API.Data.Migrations+{+ public partial class SeriesRelations : Migration+ {+ protected override void Up(MigrationBuilder migrationBuilder)+ {+ migrationBuilder.CreateTable(+ name: "SeriesRelation",+ columns: table => new+ {+ Id = table.Column<int>(type: "INTEGER", nullable: false)+ .Annotation("Sqlite:Autoincrement", true),+ RelationKind = table.Column<int>(type: "INTEGER", nullable: false),+ TargetSeriesId = table.Column<int>(type: "INTEGER", nullable: false),+ SeriesId = table.Column<int>(type: "INTEGER", nullable: false)+ },+ constraints: table =>+ {+ table.PrimaryKey("PK_SeriesRelation", x => x.Id);+ table.ForeignKey(+ name: "FK_SeriesRelation_Series_SeriesId",+ column: x => x.SeriesId,+ principalTable: "Series",+ principalColumn: "Id",+ onDelete: ReferentialAction.Restrict);+ table.ForeignKey(+ name: "FK_SeriesRelation_Series_TargetSeriesId",+ column: x => x.TargetSeriesId,+ principalTable: "Series",+ principalColumn: "Id",+ onDelete: ReferentialAction.Cascade);+ });++ migrationBuilder.CreateIndex(+ name: "IX_SeriesRelation_SeriesId",+ table: "SeriesRelation",+ column: "SeriesId");++ migrationBuilder.CreateIndex(+ name: "IX_SeriesRelation_TargetSeriesId",+ table: "SeriesRelation",+ column: "TargetSeriesId");+ }++ protected override void Down(MigrationBuilder migrationBuilder)+ {+ migrationBuilder.DropTable(+ name: "SeriesRelation");+ }+ }+}diff --git a/API/Data/Migrations/20220425125505_ChangeCountToTotalCount.Designer.cs b/API/Data/Migrations/20220425125505_ChangeCountToTotalCount.Designer.csnew file mode 100644index 000000000..321cf7056--- /dev/null+++ b/API/Data/Migrations/20220425125505_ChangeCountToTotalCount.Designer.cs@@ -0,0 +1,1513 @@+// <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("20220425125505_ChangeCountToTotalCount")]+ partial class ChangeCountToTotalCount+ {+ protected override void BuildTargetModel(ModelBuilder modelBuilder)+ {+#pragma warning disable 612, 618+ modelBuilder.HasAnnotation("ProductVersion", "6.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<string>("ApiKey")+ .HasColumnType("TEXT");++ b.Property<string>("ConcurrencyStamp")+ .IsConcurrencyToken()+ .HasColumnType("TEXT");++ b.Property<DateTime>("Created")+ .HasColumnType("TEXT");++ b.Property<string>("Email")+ .HasMaxLength(256)+ .HasColumnType("TEXT");++ b.Property<bool>("EmailConfirmed")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("LastActive")+ .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<string>("FileName")+ .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")+ .HasColumnType("TEXT");++ b.Property<bool>("BookReaderDarkMode")+ .HasColumnType("INTEGER");++ b.Property<string>("BookReaderFontFamily")+ .HasColumnType("TEXT");++ b.Property<int>("BookReaderFontSize")+ .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>("LayoutMode")+ .HasColumnType("INTEGER");++ b.Property<int>("PageSplitOption")+ .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<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>("LastModified")+ .HasColumnType("TEXT");++ 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("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>("Count")+ .HasColumnType("INTEGER");++ b.Property<string>("CoverImage")+ .HasColumnType("TEXT");++ b.Property<bool>("CoverImageLocked")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("Created")+ .HasColumnType("TEXT");++ b.Property<bool>("IsSpecial")+ .HasColumnType("INTEGER");++ b.Property<string>("Language")+ .HasColumnType("TEXT");++ b.Property<DateTime>("LastModified")+ .HasColumnType("TEXT");++ 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>("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.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.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<bool>("ExternalTag")+ .HasColumnType("INTEGER");++ b.Property<string>("NormalizedTitle")+ .HasColumnType("TEXT");++ b.Property<string>("Title")+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("NormalizedTitle", "ExternalTag")+ .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>("LastModified")+ .HasColumnType("TEXT");++ b.Property<DateTime>("LastScanned")+ .HasColumnType("TEXT");++ 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<int>("ChapterId")+ .HasColumnType("INTEGER");++ b.Property<string>("FilePath")+ .HasColumnType("TEXT");++ b.Property<int>("Format")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("LastModified")+ .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<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<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>("AppUserId")+ .HasColumnType("INTEGER");++ b.Property<string>("CoverImage")+ .HasColumnType("TEXT");++ b.Property<bool>("CoverImageLocked")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("Created")+ .HasColumnType("TEXT");++ b.Property<DateTime>("LastModified")+ .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<string>("CoverImage")+ .HasColumnType("TEXT");++ b.Property<bool>("CoverImageLocked")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("Created")+ .HasColumnType("TEXT");++ b.Property<int>("Format")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("LastChapterAdded")+ .HasColumnType("TEXT");++ b.Property<DateTime>("LastModified")+ .HasColumnType("TEXT");++ b.Property<int>("LibraryId")+ .HasColumnType("INTEGER");++ b.Property<string>("LocalizedName")+ .HasColumnType("TEXT");++ b.Property<bool>("LocalizedNameLocked")+ .HasColumnType("INTEGER");++ b.Property<string>("Name")+ .HasColumnType("TEXT");++ b.Property<bool>("NameLocked")+ .HasColumnType("INTEGER");++ 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.HasKey("Id");++ 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.SiteTheme", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<DateTime>("Created")+ .HasColumnType("TEXT");++ b.Property<string>("FileName")+ .HasColumnType("TEXT");++ b.Property<bool>("IsDefault")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("LastModified")+ .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<bool>("ExternalTag")+ .HasColumnType("INTEGER");++ b.Property<string>("NormalizedTitle")+ .HasColumnType("TEXT");++ b.Property<string>("Title")+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("NormalizedTitle", "ExternalTag")+ .IsUnique();++ b.ToTable("Tag");+ });++ modelBuilder.Entity("API.Entities.Volume", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<string>("CoverImage")+ .HasColumnType("TEXT");++ b.Property<DateTime>("Created")+ .HasColumnType("TEXT");++ b.Property<DateTime>("LastModified")+ .HasColumnType("TEXT");++ 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.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.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.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.ClientCascade)+ .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.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("Progresses");++ b.Navigation("Ratings");++ b.Navigation("ReadingLists");++ b.Navigation("UserPreferences");++ b.Navigation("UserRoles");+ });++ modelBuilder.Entity("API.Entities.Chapter", b =>+ {+ b.Navigation("Files");+ });++ 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/20220425125505_ChangeCountToTotalCount.cs b/API/Data/Migrations/20220425125505_ChangeCountToTotalCount.csnew file mode 100644index 000000000..469430bc7--- /dev/null+++ b/API/Data/Migrations/20220425125505_ChangeCountToTotalCount.cs@@ -0,0 +1,48 @@+using Microsoft.EntityFrameworkCore.Migrations;++#nullable disable++namespace API.Data.Migrations+{+ public partial class ChangeCountToTotalCount : Migration+ {+ protected override void Up(MigrationBuilder migrationBuilder)+ {+ migrationBuilder.DropForeignKey(+ name: "FK_SeriesRelation_Series_SeriesId",+ table: "SeriesRelation");++ migrationBuilder.RenameColumn(+ name: "Count",+ table: "SeriesMetadata",+ newName: "TotalCount");++ migrationBuilder.AddForeignKey(+ name: "FK_SeriesRelation_Series_SeriesId",+ table: "SeriesRelation",+ column: "SeriesId",+ principalTable: "Series",+ principalColumn: "Id");+ }++ protected override void Down(MigrationBuilder migrationBuilder)+ {+ migrationBuilder.DropForeignKey(+ name: "FK_SeriesRelation_Series_SeriesId",+ table: "SeriesRelation");++ migrationBuilder.RenameColumn(+ name: "TotalCount",+ table: "SeriesMetadata",+ newName: "Count");++ migrationBuilder.AddForeignKey(+ name: "FK_SeriesRelation_Series_SeriesId",+ table: "SeriesRelation",+ column: "SeriesId",+ principalTable: "Series",+ principalColumn: "Id",+ onDelete: ReferentialAction.Restrict);+ }+ }+}diff --git a/API/Data/Migrations/20220425131122_AddMaxCountToSeriesMetadata.Designer.cs b/API/Data/Migrations/20220425131122_AddMaxCountToSeriesMetadata.Designer.csnew file mode 100644index 000000000..0580b7497--- /dev/null+++ b/API/Data/Migrations/20220425131122_AddMaxCountToSeriesMetadata.Designer.cs@@ -0,0 +1,1516 @@+// <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("20220425131122_AddMaxCountToSeriesMetadata")]+ partial class AddMaxCountToSeriesMetadata+ {+ protected override void BuildTargetModel(ModelBuilder modelBuilder)+ {+#pragma warning disable 612, 618+ modelBuilder.HasAnnotation("ProductVersion", "6.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<string>("ApiKey")+ .HasColumnType("TEXT");++ b.Property<string>("ConcurrencyStamp")+ .IsConcurrencyToken()+ .HasColumnType("TEXT");++ b.Property<DateTime>("Created")+ .HasColumnType("TEXT");++ b.Property<string>("Email")+ .HasMaxLength(256)+ .HasColumnType("TEXT");++ b.Property<bool>("EmailConfirmed")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("LastActive")+ .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<string>("FileName")+ .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")+ .HasColumnType("TEXT");++ b.Property<bool>("BookReaderDarkMode")+ .HasColumnType("INTEGER");++ b.Property<string>("BookReaderFontFamily")+ .HasColumnType("TEXT");++ b.Property<int>("BookReaderFontSize")+ .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>("LayoutMode")+ .HasColumnType("INTEGER");++ b.Property<int>("PageSplitOption")+ .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<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>("LastModified")+ .HasColumnType("TEXT");++ 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("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>("Count")+ .HasColumnType("INTEGER");++ b.Property<string>("CoverImage")+ .HasColumnType("TEXT");++ b.Property<bool>("CoverImageLocked")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("Created")+ .HasColumnType("TEXT");++ b.Property<bool>("IsSpecial")+ .HasColumnType("INTEGER");++ b.Property<string>("Language")+ .HasColumnType("TEXT");++ b.Property<DateTime>("LastModified")+ .HasColumnType("TEXT");++ 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>("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.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.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<bool>("ExternalTag")+ .HasColumnType("INTEGER");++ b.Property<string>("NormalizedTitle")+ .HasColumnType("TEXT");++ b.Property<string>("Title")+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("NormalizedTitle", "ExternalTag")+ .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>("LastModified")+ .HasColumnType("TEXT");++ b.Property<DateTime>("LastScanned")+ .HasColumnType("TEXT");++ 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<int>("ChapterId")+ .HasColumnType("INTEGER");++ b.Property<string>("FilePath")+ .HasColumnType("TEXT");++ b.Property<int>("Format")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("LastModified")+ .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<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>("AppUserId")+ .HasColumnType("INTEGER");++ b.Property<string>("CoverImage")+ .HasColumnType("TEXT");++ b.Property<bool>("CoverImageLocked")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("Created")+ .HasColumnType("TEXT");++ b.Property<DateTime>("LastModified")+ .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<string>("CoverImage")+ .HasColumnType("TEXT");++ b.Property<bool>("CoverImageLocked")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("Created")+ .HasColumnType("TEXT");++ b.Property<int>("Format")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("LastChapterAdded")+ .HasColumnType("TEXT");++ b.Property<DateTime>("LastModified")+ .HasColumnType("TEXT");++ b.Property<int>("LibraryId")+ .HasColumnType("INTEGER");++ b.Property<string>("LocalizedName")+ .HasColumnType("TEXT");++ b.Property<bool>("LocalizedNameLocked")+ .HasColumnType("INTEGER");++ b.Property<string>("Name")+ .HasColumnType("TEXT");++ b.Property<bool>("NameLocked")+ .HasColumnType("INTEGER");++ 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.HasKey("Id");++ 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.SiteTheme", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<DateTime>("Created")+ .HasColumnType("TEXT");++ b.Property<string>("FileName")+ .HasColumnType("TEXT");++ b.Property<bool>("IsDefault")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("LastModified")+ .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<bool>("ExternalTag")+ .HasColumnType("INTEGER");++ b.Property<string>("NormalizedTitle")+ .HasColumnType("TEXT");++ b.Property<string>("Title")+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("NormalizedTitle", "ExternalTag")+ .IsUnique();++ b.ToTable("Tag");+ });++ modelBuilder.Entity("API.Entities.Volume", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<string>("CoverImage")+ .HasColumnType("TEXT");++ b.Property<DateTime>("Created")+ .HasColumnType("TEXT");++ b.Property<DateTime>("LastModified")+ .HasColumnType("TEXT");++ 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.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.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.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.ClientCascade)+ .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.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("Progresses");++ b.Navigation("Ratings");++ b.Navigation("ReadingLists");++ b.Navigation("UserPreferences");++ b.Navigation("UserRoles");+ });++ modelBuilder.Entity("API.Entities.Chapter", b =>+ {+ b.Navigation("Files");+ });++ 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/20220425131122_AddMaxCountToSeriesMetadata.cs b/API/Data/Migrations/20220425131122_AddMaxCountToSeriesMetadata.csnew file mode 100644index 000000000..550dac20b--- /dev/null+++ b/API/Data/Migrations/20220425131122_AddMaxCountToSeriesMetadata.cs@@ -0,0 +1,26 @@+using Microsoft.EntityFrameworkCore.Migrations;++#nullable disable++namespace API.Data.Migrations+{+ public partial class AddMaxCountToSeriesMetadata : Migration+ {+ protected override void Up(MigrationBuilder migrationBuilder)+ {+ migrationBuilder.AddColumn<int>(+ name: "MaxCount",+ table: "SeriesMetadata",+ type: "INTEGER",+ nullable: false,+ defaultValue: 0);+ }++ protected override void Down(MigrationBuilder migrationBuilder)+ {+ migrationBuilder.DropColumn(+ name: "MaxCount",+ table: "SeriesMetadata");+ }+ }+}diff --git a/API/Data/Migrations/20220508162841_BookReaderUpdate.Designer.cs b/API/Data/Migrations/20220508162841_BookReaderUpdate.Designer.csnew file mode 100644index 000000000..b8e7c6082--- /dev/null+++ b/API/Data/Migrations/20220508162841_BookReaderUpdate.Designer.cs@@ -0,0 +1,1523 @@+// <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("20220508162841_BookReaderUpdate")]+ partial class BookReaderUpdate+ {+ protected override void BuildTargetModel(ModelBuilder modelBuilder)+ {+#pragma warning disable 612, 618+ modelBuilder.HasAnnotation("ProductVersion", "6.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<string>("ApiKey")+ .HasColumnType("TEXT");++ b.Property<string>("ConcurrencyStamp")+ .IsConcurrencyToken()+ .HasColumnType("TEXT");++ b.Property<DateTime>("Created")+ .HasColumnType("TEXT");++ b.Property<string>("Email")+ .HasMaxLength(256)+ .HasColumnType("TEXT");++ b.Property<bool>("EmailConfirmed")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("LastActive")+ .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<string>("FileName")+ .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<string>("BookReaderFontFamily")+ .HasColumnType("TEXT");++ b.Property<int>("BookReaderFontSize")+ .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<int>("LayoutMode")+ .HasColumnType("INTEGER");++ b.Property<int>("PageLayoutMode")+ .HasColumnType("INTEGER");++ b.Property<int>("PageSplitOption")+ .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<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>("LastModified")+ .HasColumnType("TEXT");++ 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("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>("Count")+ .HasColumnType("INTEGER");++ b.Property<string>("CoverImage")+ .HasColumnType("TEXT");++ b.Property<bool>("CoverImageLocked")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("Created")+ .HasColumnType("TEXT");++ b.Property<bool>("IsSpecial")+ .HasColumnType("INTEGER");++ b.Property<string>("Language")+ .HasColumnType("TEXT");++ b.Property<DateTime>("LastModified")+ .HasColumnType("TEXT");++ 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>("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.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.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<bool>("ExternalTag")+ .HasColumnType("INTEGER");++ b.Property<string>("NormalizedTitle")+ .HasColumnType("TEXT");++ b.Property<string>("Title")+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("NormalizedTitle", "ExternalTag")+ .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>("LastModified")+ .HasColumnType("TEXT");++ b.Property<DateTime>("LastScanned")+ .HasColumnType("TEXT");++ 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<int>("ChapterId")+ .HasColumnType("INTEGER");++ b.Property<string>("FilePath")+ .HasColumnType("TEXT");++ b.Property<int>("Format")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("LastModified")+ .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<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>("AppUserId")+ .HasColumnType("INTEGER");++ b.Property<string>("CoverImage")+ .HasColumnType("TEXT");++ b.Property<bool>("CoverImageLocked")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("Created")+ .HasColumnType("TEXT");++ b.Property<DateTime>("LastModified")+ .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<string>("CoverImage")+ .HasColumnType("TEXT");++ b.Property<bool>("CoverImageLocked")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("Created")+ .HasColumnType("TEXT");++ b.Property<int>("Format")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("LastChapterAdded")+ .HasColumnType("TEXT");++ b.Property<DateTime>("LastModified")+ .HasColumnType("TEXT");++ b.Property<int>("LibraryId")+ .HasColumnType("INTEGER");++ b.Property<string>("LocalizedName")+ .HasColumnType("TEXT");++ b.Property<bool>("LocalizedNameLocked")+ .HasColumnType("INTEGER");++ b.Property<string>("Name")+ .HasColumnType("TEXT");++ b.Property<bool>("NameLocked")+ .HasColumnType("INTEGER");++ 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.HasKey("Id");++ 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.SiteTheme", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<DateTime>("Created")+ .HasColumnType("TEXT");++ b.Property<string>("FileName")+ .HasColumnType("TEXT");++ b.Property<bool>("IsDefault")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("LastModified")+ .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<bool>("ExternalTag")+ .HasColumnType("INTEGER");++ b.Property<string>("NormalizedTitle")+ .HasColumnType("TEXT");++ b.Property<string>("Title")+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("NormalizedTitle", "ExternalTag")+ .IsUnique();++ b.ToTable("Tag");+ });++ modelBuilder.Entity("API.Entities.Volume", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<string>("CoverImage")+ .HasColumnType("TEXT");++ b.Property<DateTime>("Created")+ .HasColumnType("TEXT");++ b.Property<DateTime>("LastModified")+ .HasColumnType("TEXT");++ 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.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.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.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.ClientCascade)+ .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.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("Progresses");++ b.Navigation("Ratings");++ b.Navigation("ReadingLists");++ b.Navigation("UserPreferences");++ b.Navigation("UserRoles");+ });++ modelBuilder.Entity("API.Entities.Chapter", b =>+ {+ b.Navigation("Files");+ });++ 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/20220508162841_BookReaderUpdate.cs b/API/Data/Migrations/20220508162841_BookReaderUpdate.csnew file mode 100644index 000000000..6df40e5fd--- /dev/null+++ b/API/Data/Migrations/20220508162841_BookReaderUpdate.cs@@ -0,0 +1,56 @@+using Microsoft.EntityFrameworkCore.Migrations;++#nullable disable++namespace API.Data.Migrations+{+ public partial class BookReaderUpdate : Migration+ {+ protected override void Up(MigrationBuilder migrationBuilder)+ {+ migrationBuilder.RenameColumn(+ name: "BookReaderDarkMode",+ table: "AppUserPreferences",+ newName: "PageLayoutMode");++ migrationBuilder.AlterColumn<string>(+ name: "BackgroundColor",+ table: "AppUserPreferences",+ type: "TEXT",+ nullable: true,+ defaultValue: "#000000",+ oldClrType: typeof(string),+ oldType: "TEXT",+ oldNullable: true);++ migrationBuilder.AddColumn<string>(+ name: "BookThemeName",+ table: "AppUserPreferences",+ type: "TEXT",+ nullable: true,+ defaultValue: "Dark");+ }++ protected override void Down(MigrationBuilder migrationBuilder)+ {+ migrationBuilder.DropColumn(+ name: "BookThemeName",+ table: "AppUserPreferences");++ migrationBuilder.RenameColumn(+ name: "PageLayoutMode",+ table: "AppUserPreferences",+ newName: "BookReaderDarkMode");++ migrationBuilder.AlterColumn<string>(+ name: "BackgroundColor",+ table: "AppUserPreferences",+ type: "TEXT",+ nullable: true,+ oldClrType: typeof(string),+ oldType: "TEXT",+ oldNullable: true,+ oldDefaultValue: "#000000");+ }+ }+}diff --git a/API/Data/Migrations/20220513234708_BookReaderImmersiveMode.Designer.cs b/API/Data/Migrations/20220513234708_BookReaderImmersiveMode.Designer.csnew file mode 100644index 000000000..26c9a1397--- /dev/null+++ b/API/Data/Migrations/20220513234708_BookReaderImmersiveMode.Designer.cs@@ -0,0 +1,1526 @@+// <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("20220513234708_BookReaderImmersiveMode")]+ partial class BookReaderImmersiveMode+ {+ protected override void BuildTargetModel(ModelBuilder modelBuilder)+ {+#pragma warning disable 612, 618+ modelBuilder.HasAnnotation("ProductVersion", "6.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<string>("ApiKey")+ .HasColumnType("TEXT");++ b.Property<string>("ConcurrencyStamp")+ .IsConcurrencyToken()+ .HasColumnType("TEXT");++ b.Property<DateTime>("Created")+ .HasColumnType("TEXT");++ b.Property<string>("Email")+ .HasMaxLength(256)+ .HasColumnType("TEXT");++ b.Property<bool>("EmailConfirmed")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("LastActive")+ .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<string>("FileName")+ .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<string>("BookReaderFontFamily")+ .HasColumnType("TEXT");++ b.Property<int>("BookReaderFontSize")+ .HasColumnType("INTEGER");++ b.Property<bool>("BookReaderImmersiveMode")+ .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<int>("LayoutMode")+ .HasColumnType("INTEGER");++ b.Property<int>("PageLayoutMode")+ .HasColumnType("INTEGER");++ b.Property<int>("PageSplitOption")+ .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<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>("LastModified")+ .HasColumnType("TEXT");++ 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("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>("Count")+ .HasColumnType("INTEGER");++ b.Property<string>("CoverImage")+ .HasColumnType("TEXT");++ b.Property<bool>("CoverImageLocked")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("Created")+ .HasColumnType("TEXT");++ b.Property<bool>("IsSpecial")+ .HasColumnType("INTEGER");++ b.Property<string>("Language")+ .HasColumnType("TEXT");++ b.Property<DateTime>("LastModified")+ .HasColumnType("TEXT");++ 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>("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.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.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<bool>("ExternalTag")+ .HasColumnType("INTEGER");++ b.Property<string>("NormalizedTitle")+ .HasColumnType("TEXT");++ b.Property<string>("Title")+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("NormalizedTitle", "ExternalTag")+ .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>("LastModified")+ .HasColumnType("TEXT");++ b.Property<DateTime>("LastScanned")+ .HasColumnType("TEXT");++ 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<int>("ChapterId")+ .HasColumnType("INTEGER");++ b.Property<string>("FilePath")+ .HasColumnType("TEXT");++ b.Property<int>("Format")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("LastModified")+ .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<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>("AppUserId")+ .HasColumnType("INTEGER");++ b.Property<string>("CoverImage")+ .HasColumnType("TEXT");++ b.Property<bool>("CoverImageLocked")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("Created")+ .HasColumnType("TEXT");++ b.Property<DateTime>("LastModified")+ .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<string>("CoverImage")+ .HasColumnType("TEXT");++ b.Property<bool>("CoverImageLocked")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("Created")+ .HasColumnType("TEXT");++ b.Property<int>("Format")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("LastChapterAdded")+ .HasColumnType("TEXT");++ b.Property<DateTime>("LastModified")+ .HasColumnType("TEXT");++ b.Property<int>("LibraryId")+ .HasColumnType("INTEGER");++ b.Property<string>("LocalizedName")+ .HasColumnType("TEXT");++ b.Property<bool>("LocalizedNameLocked")+ .HasColumnType("INTEGER");++ b.Property<string>("Name")+ .HasColumnType("TEXT");++ b.Property<bool>("NameLocked")+ .HasColumnType("INTEGER");++ 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.HasKey("Id");++ 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.SiteTheme", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<DateTime>("Created")+ .HasColumnType("TEXT");++ b.Property<string>("FileName")+ .HasColumnType("TEXT");++ b.Property<bool>("IsDefault")+ .HasColumnType("INTEGER");++ b.Property<DateTime>("LastModified")+ .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<bool>("ExternalTag")+ .HasColumnType("INTEGER");++ b.Property<string>("NormalizedTitle")+ .HasColumnType("TEXT");++ b.Property<string>("Title")+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("NormalizedTitle", "ExternalTag")+ .IsUnique();++ b.ToTable("Tag");+ });++ modelBuilder.Entity("API.Entities.Volume", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<string>("CoverImage")+ .HasColumnType("TEXT");++ b.Property<DateTime>("Created")+ .HasColumnType("TEXT");++ b.Property<DateTime>("LastModified")+ .HasColumnType("TEXT");++ 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.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.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.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.ClientCascade)+ .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.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("Progresses");++ b.Navigation("Ratings");++ b.Navigation("ReadingLists");++ b.Navigation("UserPreferences");++ b.Navigation("UserRoles");+ });++ modelBuilder.Entity("API.Entities.Chapter", b =>+ {+ b.Navigation("Files");+ });++ 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/20220513234708_BookReaderImmersiveMode.cs b/API/Data/Migrations/20220513234708_BookReaderImmersiveMode.csnew file mode 100644index 000000000..f194a3b87--- /dev/null+++ b/API/Data/Migrations/20220513234708_BookReaderImmersiveMode.cs@@ -0,0 +1,26 @@+using Microsoft.EntityFrameworkCore.Migrations;++#nullable disable++namespace API.Data.Migrations+{+ public partial class BookReaderImmersiveMode : Migration+ {+ protected override void Up(MigrationBuilder migrationBuilder)+ {+ migrationBuilder.AddColumn<bool>(+ name: "BookReaderImmersiveMode",+ table: "AppUserPreferences",+ type: "INTEGER",+ nullable: false,+ defaultValue: false);+ }++ protected override void Down(MigrationBuilder migrationBuilder)+ {+ migrationBuilder.DropColumn(+ name: "BookReaderImmersiveMode",+ table: "AppUserPreferences");+ }+ }+}diff --git a/API/Data/Migrations/DataContextModelSnapshot.cs b/API/Data/Migrations/DataContextModelSnapshot.csindex d46e91af6..a8b5527d5 100644--- a/API/Data/Migrations/DataContextModelSnapshot.cs+++ b/API/Data/Migrations/DataContextModelSnapshot.cs@@ -15,7 +15,7 @@ namespace API.Data.Migrationsprotected override void BuildModel(ModelBuilder modelBuilder){#pragma warning disable 612, 618- modelBuilder.HasAnnotation("ProductVersion", "6.0.2");+ modelBuilder.HasAnnotation("ProductVersion", "6.0.4");modelBuilder.Entity("API.Entities.AppRole", b =>{@@ -166,10 +166,9 @@ namespace API.Data.Migrations.HasColumnType("INTEGER");b.Property<string>("BackgroundColor")- .HasColumnType("TEXT");-- b.Property<bool>("BookReaderDarkMode")- .HasColumnType("INTEGER");+ .ValueGeneratedOnAdd()+ .HasColumnType("TEXT")+ .HasDefaultValue("#000000");b.Property<string>("BookReaderFontFamily").HasColumnType("TEXT");@@ -177,6 +176,9 @@ namespace API.Data.Migrationsb.Property<int>("BookReaderFontSize").HasColumnType("INTEGER");+ b.Property<bool>("BookReaderImmersiveMode")+ .HasColumnType("INTEGER");+b.Property<int>("BookReaderLineSpacing").HasColumnType("INTEGER");@@ -189,9 +191,17 @@ namespace API.Data.Migrationsb.Property<bool>("BookReaderTapToPaginate").HasColumnType("INTEGER");+ b.Property<string>("BookThemeName")+ .ValueGeneratedOnAdd()+ .HasColumnType("TEXT")+ .HasDefaultValue("Dark");+b.Property<int>("LayoutMode").HasColumnType("INTEGER");+ b.Property<int>("PageLayoutMode")+ .HasColumnType("INTEGER");+b.Property<int>("PageSplitOption").HasColumnType("INTEGER");@@ -520,9 +530,6 @@ namespace API.Data.Migrationsb.Property<bool>("ColoristLocked").HasColumnType("INTEGER");- b.Property<int>("Count")- .HasColumnType("INTEGER");-b.Property<bool>("CoverArtistLocked").HasColumnType("INTEGER");@@ -544,6 +551,9 @@ namespace API.Data.Migrationsb.Property<bool>("LettererLocked").HasColumnType("INTEGER");+ b.Property<int>("MaxCount")+ .HasColumnType("INTEGER");+b.Property<bool>("PencillerLocked").HasColumnType("INTEGER");@@ -575,6 +585,9 @@ namespace API.Data.Migrationsb.Property<bool>("TagsLocked").HasColumnType("INTEGER");+ b.Property<int>("TotalCount")+ .HasColumnType("INTEGER");+b.Property<bool>("TranslatorLocked").HasColumnType("INTEGER");@@ -592,6 +605,30 @@ namespace API.Data.Migrationsb.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")@@ -621,12 +658,21 @@ namespace API.Data.Migrationsb.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>("LastModified").HasColumnType("TEXT");+ b.Property<string>("NormalizedTitle")+ .HasColumnType("TEXT");+b.Property<bool>("Promoted").HasColumnType("INTEGER");@@ -695,6 +741,9 @@ namespace API.Data.Migrationsb.Property<int>("Format").HasColumnType("INTEGER");+ b.Property<DateTime>("LastChapterAdded")+ .HasColumnType("TEXT");+b.Property<DateTime>("LastModified").HasColumnType("TEXT");@@ -732,9 +781,6 @@ namespace API.Data.Migrationsb.HasIndex("LibraryId");- b.HasIndex("Name", "NormalizedName", "LocalizedName", "LibraryId", "Format")- .IsUnique();-b.ToTable("Series");});@@ -1173,6 +1219,25 @@ namespace API.Data.Migrationsb.Navigation("Series");});+ modelBuilder.Entity("API.Entities.Metadata.SeriesRelation", b =>+ {+ b.HasOne("API.Entities.Series", "Series")+ .WithMany("Relations")+ .HasForeignKey("SeriesId")+ .OnDelete(DeleteBehavior.ClientCascade)+ .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")@@ -1442,6 +1507,10 @@ namespace API.Data.Migrationsb.Navigation("Ratings");+ b.Navigation("RelationOf");++ b.Navigation("Relations");+b.Navigation("Volumes");});diff --git a/API/Data/Repositories/CollectionTagRepository.cs b/API/Data/Repositories/CollectionTagRepository.csindex a519c774f..7fbf14dd5 100644--- a/API/Data/Repositories/CollectionTagRepository.cs+++ b/API/Data/Repositories/CollectionTagRepository.cs@@ -84,7 +84,6 @@ public class CollectionTagRepository : ICollectionTagRepositorypublic async Task<IEnumerable<CollectionTagDto>> GetAllTagDtosAsync(){return await _context.CollectionTag- .Select(c => c).OrderBy(c => c.NormalizedTitle).AsNoTracking().ProjectTo<CollectionTagDto>(_mapper.ConfigurationProvider)diff --git a/API/Data/Repositories/ReadingListRepository.cs b/API/Data/Repositories/ReadingListRepository.csindex 59c6ac5c2..0294d6224 100644--- a/API/Data/Repositories/ReadingListRepository.cs+++ b/API/Data/Repositories/ReadingListRepository.cs@@ -26,6 +26,8 @@ public interface IReadingListRepositoryvoid BulkRemove(IEnumerable<ReadingListItem> items);void Update(ReadingList list);Task<int> Count();+ Task<string> GetCoverImageAsync(int readingListId);+ Task<IList<string>> GetAllCoverImagesAsync();}public class ReadingListRepository : IReadingListRepository@@ -49,6 +51,24 @@ public class ReadingListRepository : IReadingListRepositoryreturn await _context.ReadingList.CountAsync();}+ 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+ .Select(t => t.CoverImage)+ .Where(t => !string.IsNullOrEmpty(t))+ .AsNoTracking()+ .ToListAsync();+ }+public void Remove(ReadingListItem item){_context.ReadingListItem.Remove(item);diff --git a/API/Data/Repositories/SeriesRepository.cs b/API/Data/Repositories/SeriesRepository.csindex bf634e5c7..c36bcc4cb 100644--- a/API/Data/Repositories/SeriesRepository.cs+++ b/API/Data/Repositories/SeriesRepository.cs@@ -11,6 +11,7 @@ using API.DTOs.Filtering;using API.DTOs.Metadata;using API.DTOs.ReadingLists;using API.DTOs.Search;+using API.DTOs.SeriesDetail;using API.Entities;using API.Entities.Enums;using API.Entities.Metadata;@@ -20,10 +21,23 @@ using API.Services.Tasks;using AutoMapper;using AutoMapper.QueryableExtensions;using Kavita.Common.Extensions;+using Microsoft.AspNetCore.Mvc;using Microsoft.EntityFrameworkCore;+using SQLitePCL;namespace API.Data.Repositories;+[Flags]+public enum SeriesIncludes+{+ None = 1,+ Volumes = 2,+ Metadata = 4,+ Related = 8,+ //Related = 16,+ //UserPreferences = 32+}+internal class RecentlyAddedSeries{public int LibraryId { get; init; }@@ -68,7 +82,7 @@ public interface ISeriesRepositoryTask<IEnumerable<Series>> GetSeriesForLibraryIdAsync(int libraryId);Task<SeriesDto> GetSeriesDtoByIdAsync(int seriesId, int userId);Task<bool> DeleteSeriesAsync(int seriesId);- Task<Series> GetSeriesByIdAsync(int seriesId);+ 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);@@ -80,7 +94,7 @@ public interface ISeriesRepository/// <returns></returns>Task AddSeriesModifiers(int userId, List<SeriesDto> series);Task<string> GetSeriesCoverImageAsync(int seriesId);- Task<IEnumerable<SeriesDto>> GetOnDeck(int userId, int libraryId, UserParams userParams, FilterDto filter, bool cutoffOnDate = true);+ 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<PagedList<SeriesDto>> GetSeriesDtoForCollectionAsync(int collectionId, int userId, UserParams userParams);@@ -92,11 +106,18 @@ public interface ISeriesRepositoryTask<Series> GetFullSeriesForSeriesIdAsync(int seriesId);Task<Chunk> GetChunkInfo(int libraryId = 0);Task<IList<SeriesMetadata>> GetSeriesMetadataForIdsAsync(IEnumerable<int> seriesIds);- Task<IList<AgeRatingDto>> GetAllAgeRatingsDtosForLibrariesAsync(List<int> libraryIds);- Task<IList<LanguageDto>> GetAllLanguagesForLibrariesAsync(List<int> libraryIds);- Task<IList<PublicationStatusDto>> GetAllPublicationStatusesDtosForLibrariesAsync(List<int> libraryIds);- Task<IList<GroupedSeriesDto>> GetRecentlyUpdatedSeries(int userId);- Task<IList<RecentlyAddedItemDto>> GetRecentlyAddedChapters(int userId);+ Task<IList<AgeRatingDto>> GetAllAgeRatingsDtosForLibrariesAsync(List<int> libraryIds); // TODO: Move to LibraryRepository+ Task<IList<LanguageDto>> GetAllLanguagesForLibrariesAsync(List<int> libraryIds); // TODO: Move to LibraryRepository+ IEnumerable<PublicationStatusDto> GetAllPublicationStatusesDtosForLibrariesAsync(List<int> libraryIds); // TODO: Move to LibraryRepository+ 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);+ Task<PagedList<SeriesDto>> GetQuickReads(int userId, int libraryId, UserParams userParams);+ 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);}public class SeriesRepository : ISeriesRepository@@ -232,7 +253,7 @@ public class SeriesRepository : ISeriesRepository/// <summary>/// Gets all series/// </summary>- /// <param name="libraryId"></param>+ /// <param name="libraryId">Restricts to just one library</param>/// <param name="userId"></param>/// <param name="userParams"></param>/// <param name="filter"></param>@@ -269,7 +290,7 @@ public class SeriesRepository : ISeriesRepositorypublic async Task<SearchResultGroupDto> SearchSeries(int userId, bool isAdmin, int[] libraryIds, string searchQuery){-+ const int maxRecords = 15;var result = new SearchResultGroupDto();var searchQueryNormalized = Parser.Parser.Normalize(searchQuery);@@ -283,6 +304,7 @@ public class SeriesRepository : ISeriesRepository.Where(l => EF.Functions.Like(l.Name, $"%{searchQuery}%")).OrderBy(l => l.Name).AsSplitQuery()+ .Take(maxRecords).ProjectTo<LibraryDto>(_mapper.ConfigurationProvider).ToListAsync();@@ -290,7 +312,7 @@ public class SeriesRepository : ISeriesRepositoryvar hasYearInQuery = !string.IsNullOrEmpty(justYear);var yearComparison = hasYearInQuery ? int.Parse(justYear) : 0;- result.Series = await _context.Series+ result.Series = _context.Series.Where(s => libraryIds.Contains(s.LibraryId)).Where(s => EF.Functions.Like(s.Name, $"%{searchQuery}%")|| EF.Functions.Like(s.OriginalName, $"%{searchQuery}%")@@ -301,14 +323,16 @@ public class SeriesRepository : ISeriesRepository.OrderBy(s => s.SortName).AsNoTracking().AsSplitQuery()+ .Take(maxRecords).ProjectTo<SearchResultDto>(_mapper.ConfigurationProvider)- .ToListAsync();+ .AsEnumerable();result.ReadingLists = await _context.ReadingList.Where(rl => rl.AppUserId == userId || rl.Promoted).Where(rl => EF.Functions.Like(rl.Title, $"%{searchQuery}%")).AsSplitQuery()+ .Take(maxRecords).ProjectTo<ReadingListDto>(_mapper.ConfigurationProvider).ToListAsync();@@ -318,6 +342,8 @@ public class SeriesRepository : ISeriesRepository.Where(s => s.Promoted || isAdmin).OrderBy(s => s.Title).AsNoTracking()+ .AsSplitQuery()+ .Take(maxRecords).OrderBy(c => c.NormalizedTitle).ProjectTo<CollectionTagDto>(_mapper.ConfigurationProvider).ToListAsync();@@ -326,6 +352,7 @@ public class SeriesRepository : ISeriesRepository.Where(sm => seriesIds.Contains(sm.SeriesId)).SelectMany(sm => sm.People.Where(t => EF.Functions.Like(t.Name, $"%{searchQuery}%"))).AsSplitQuery()+ .Take(maxRecords).Distinct().ProjectTo<PersonDto>(_mapper.ConfigurationProvider).ToListAsync();@@ -336,6 +363,7 @@ public class SeriesRepository : ISeriesRepository.AsSplitQuery().OrderBy(t => t.Title).Distinct()+ .Take(maxRecords).ProjectTo<GenreTagDto>(_mapper.ConfigurationProvider).ToListAsync();@@ -345,9 +373,34 @@ public class SeriesRepository : ISeriesRepository.AsSplitQuery().OrderBy(t => t.Title).Distinct()+ .Take(maxRecords).ProjectTo<TagDto>(_mapper.ConfigurationProvider).ToListAsync();+ var fileIds = _context.Series+ .Where(s => libraryIds.Contains(s.LibraryId))+ .AsSplitQuery()+ .SelectMany(s => s.Volumes)+ .SelectMany(v => v.Chapters)+ .SelectMany(c => c.Files.Select(f => f.Id));++ result.Files = await _context.MangaFile+ .Where(m => EF.Functions.Like(m.FilePath, $"%{searchQuery}%") && fileIds.Contains(m.Id))+ .AsSplitQuery()+ .Take(maxRecords)+ .ProjectTo<MangaFileDto>(_mapper.ConfigurationProvider)+ .ToListAsync();+++ result.Chapters = await _context.Chapter+ .Include(c => c.Files)+ .Where(c => EF.Functions.Like(c.TitleName, $"%{searchQuery}%"))+ .Where(c => c.Files.All(f => fileIds.Contains(f.Id)))+ .AsSplitQuery()+ .Take(maxRecords)+ .ProjectTo<ChapterDto>(_mapper.ConfigurationProvider)+ .ToListAsync();+return result;}@@ -377,19 +430,37 @@ public class SeriesRepository : ISeriesRepository/// </summary>/// <param name="seriesId"></param>/// <returns></returns>- public async Task<Series> GetSeriesByIdAsync(int seriesId)+ public async Task<Series> GetSeriesByIdAsync(int seriesId, SeriesIncludes includes = SeriesIncludes.Volumes | SeriesIncludes.Metadata){- return await _context.Series- .Include(s => s.Volumes)- .Include(s => s.Metadata)- .ThenInclude(m => m.CollectionTags)- .Include(s => s.Metadata)- .ThenInclude(m => m.Genres)- .Include(s => s.Metadata)- .ThenInclude(m => m.People)+ var query = _context.Series.Where(s => s.Id == seriesId)- .AsSplitQuery()- .SingleOrDefaultAsync();+ .AsSplitQuery();++ if (includes.HasFlag(SeriesIncludes.Volumes))+ {+ query = query.Include(s => s.Volumes);+ }++ if (includes.HasFlag(SeriesIncludes.Related))+ {+ query = query.Include(s => s.Relations)+ .ThenInclude(r => r.TargetSeries)+ .Include(s => s.RelationOf);+ }++ if (includes.HasFlag(SeriesIncludes.Metadata))+ {+ query = query.Include(s => s.Metadata)+ .ThenInclude(m => m.CollectionTags)+ .Include(s => s.Metadata)+ .ThenInclude(m => m.Genres)+ .Include(s => s.Metadata)+ .ThenInclude(m => m.People)+ .Include(s => s.Metadata)+ .ThenInclude(m => m.Tags);+ }++ return await query.SingleOrDefaultAsync();}/// <summary>@@ -597,55 +668,48 @@ public class SeriesRepository : ISeriesRepository}/// <summary>- /// Returns Series that the user has some partial progress on. Sorts based on activity. Sort first by User progress, but if a series- /// has been updated recently, bump it to the front.+ /// Returns Series that the user has some partial progress on. Sorts based on activity. Sort first by User progress, then+ /// by when chapters have been added to series. Restricts progress in the past 30 days and chapters being added to last 7./// </summary>/// <param name="userId"></param>/// <param name="libraryId">Library to restrict to, if 0, will apply to all libraries</param>/// <param name="userParams">Pagination information</param>/// <param name="filter">Optional (default null) filter on query</param>/// <returns></returns>- public async Task<IEnumerable<SeriesDto>> GetOnDeck(int userId, int libraryId, UserParams userParams, FilterDto filter, bool cutoffOnDate = true)+ public async Task<PagedList<SeriesDto>> GetOnDeck(int userId, int libraryId, UserParams userParams, FilterDto filter){var cutoffProgressPoint = DateTime.Now - TimeSpan.FromDays(30);- var query = (await CreateFilteredSearchQueryable(userId, libraryId, filter))- .Join(_context.AppUserProgresses, s => s.Id, progress => progress.SeriesId, (s, progress) =>- new- {- Series = s,- PagesRead = _context.AppUserProgresses.Where(s1 => s1.SeriesId == s.Id && s1.AppUserId == userId)- .Sum(s1 => s1.PagesRead),- progress.AppUserId,- LastReadingProgress = _context.AppUserProgresses- .Where(p => p.Id == progress.Id && p.AppUserId == userId)- .Max(p => p.LastModified),- // This is only taking into account chapters that have progress on them, not all chapters in said series- //LastChapterCreated = _context.Chapter.Where(c => progress.ChapterId == c.Id).Max(c => c.Created),- LastChapterCreated = s.Volumes.SelectMany(v => v.Chapters).Max(c => c.Created)- });- if (cutoffOnDate)- {- query = query.Where(d => d.LastReadingProgress >= cutoffProgressPoint || d.LastChapterCreated >= cutoffProgressPoint);- }-- // I think I need another Join statement. The problem is the chapters are still limited to progress+ var cutoffLastAddedPoint = DateTime.Now - TimeSpan.FromDays(7);+ var libraryIds = GetLibraryIdsForUser(userId, libraryId);+ var usersSeriesIds = GetSeriesIdsForLibraryIds(libraryIds);- var retSeries = query.Where(s => s.AppUserId == userId- && s.PagesRead > 0- && s.PagesRead < s.Series.Pages)- .OrderByDescending(s => s.LastReadingProgress)- .ThenByDescending(s => s.LastChapterCreated)+ var query = _context.Series+ .Where(s => usersSeriesIds.Contains(s.Id))+ .Select(s => new+ {+ Series = s,+ PagesRead = _context.AppUserProgresses.Where(p => p.SeriesId == s.Id && p.AppUserId == userId)+ .Sum(s1 => s1.PagesRead),+ LatestReadDate = _context.AppUserProgresses+ .Where(p => p.SeriesId == s.Id && p.AppUserId == userId)+ .Max(p => p.LastModified),+ s.LastChapterAdded,+ })+ .Where(s => s.PagesRead > 0+ && s.PagesRead < s.Series.Pages)+ .Where(d => d.LatestReadDate >= cutoffProgressPoint || d.LastChapterAdded >= cutoffLastAddedPoint).OrderByDescending(s => s.LatestReadDate)+ .ThenByDescending(s => s.LastChapterAdded).Select(s => s.Series).ProjectTo<SeriesDto>(_mapper.ConfigurationProvider).AsSplitQuery().AsNoTracking();- // Pagination does not work for this query as when we pull the data back, we get multiple rows of the same series. See controller for pagination code- return await retSeries.ToListAsync();+ return await PagedList<SeriesDto>.CreateAsync(query, userParams.PageNumber, userParams.PageSize);}+private async Task<IQueryable<Series>> CreateFilteredSearchQueryable(int userId, int libraryId, FilterDto filter){var userLibraries = await GetUserLibraries(libraryId, userId);@@ -687,6 +751,7 @@ public class SeriesRepository : ISeriesRepositorySortField.SortName => query.OrderBy(s => s.SortName),SortField.CreatedDate => query.OrderBy(s => s.Created),SortField.LastModifiedDate => query.OrderBy(s => s.LastModified),+ SortField.LastChapterAdded => query.OrderBy(s => s.LastChapterAdded),_ => query};}@@ -697,6 +762,7 @@ public class SeriesRepository : ISeriesRepositorySortField.SortName => query.OrderByDescending(s => s.SortName),SortField.CreatedDate => query.OrderByDescending(s => s.Created),SortField.LastModifiedDate => query.OrderByDescending(s => s.LastModified),+ SortField.LastChapterAdded => query.OrderByDescending(s => s.LastChapterAdded),_ => query};}@@ -888,131 +954,258 @@ public class SeriesRepository : ISeriesRepository.ToList();}- public async Task<IList<PublicationStatusDto>> GetAllPublicationStatusesDtosForLibrariesAsync(List<int> libraryIds)+ public IEnumerable<PublicationStatusDto> GetAllPublicationStatusesDtosForLibrariesAsync(List<int> libraryIds){- return await _context.Series+ return _context.Series.Where(s => libraryIds.Contains(s.LibraryId)).Select(s => s.Metadata.PublicationStatus).Distinct()+ .AsEnumerable().Select(s => new PublicationStatusDto(){Value = s,Title = s.ToDescription()})- .OrderBy(s => s.Title)- .ToListAsync();+ .OrderBy(s => s.Title);}- private static string RecentlyAddedItemTitle(RecentlyAddedSeries item)- {- switch (item.LibraryType)- {- case LibraryType.Book:- return string.Empty;- case LibraryType.Comic:- return "Issue";- case LibraryType.Manga:- default:- return "Chapter";- }- }/// <summary>- /// Show all recently added chapters. Provide some mapping for chapter 0 -> Volume 1+ /// Return recently updated series, regardless of read progress, and group the number of volume or chapters added./// </summary>- /// <param name="userId"></param>+ /// <remarks>This provides 2 levels of pagination. Fetching the individual chapters only looks at 3000. Then when performing grouping+ /// in memory, we stop after 30 series. </remarks>+ /// <param name="userId">Used to ensure user has access to libraries</param>/// <returns></returns>- public async Task<IList<RecentlyAddedItemDto>> GetRecentlyAddedChapters(int userId)+ public async Task<IEnumerable<GroupedSeriesDto>> GetRecentlyUpdatedSeries(int userId, int pageSize = 30){- var ret = await GetRecentlyAddedChaptersQuery(userId);+ var seriesMap = new Dictionary<string, GroupedSeriesDto>();+ var index = 0;+ foreach (var item in await GetRecentlyAddedChaptersQuery(userId))+ {+ 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;+ }+ }++ return seriesMap.Values.AsEnumerable();+ }- var items = new List<RecentlyAddedItemDto>();- foreach (var item in ret)- {- var dto = new RecentlyAddedItemDto()- {- LibraryId = item.LibraryId,- LibraryType = item.LibraryType,- SeriesId = item.SeriesId,- SeriesName = item.SeriesName,- Created = item.Created,- Id = items.Count,- Format = item.Format- };+ public async Task<IEnumerable<SeriesDto>> GetSeriesForRelationKind(int userId, int seriesId, RelationKind kind)+ {+ var libraryIds = GetLibraryIdsForUser(userId);+ var usersSeriesIds = _context.Series+ .Where(s => libraryIds.Contains(s.LibraryId))+ .Select(s => s.Id);- // Add title and Volume/Chapter Id- var chapterTitle = RecentlyAddedItemTitle(item);- string title;- if (item.ChapterNumber.Equals(Parser.Parser.DefaultChapter))- {- if ((item.VolumeNumber + string.Empty).Equals(Parser.Parser.DefaultChapter))- {- title = item.ChapterTitle;- }- else- {- title = "Volume " + item.VolumeNumber;- }+ var targetSeries = _context.SeriesRelation+ .Where(sr =>+ sr.SeriesId == seriesId && sr.RelationKind == kind && usersSeriesIds.Contains(sr.TargetSeriesId))+ .Include(sr => sr.TargetSeries)+ .AsSplitQuery()+ .AsNoTracking()+ .Select(sr => sr.TargetSeriesId);- dto.VolumeId = item.VolumeId;- }- else- {- title = item.IsSpecial- ? item.ChapterRange- : $"{chapterTitle} {item.ChapterRange}";- dto.ChapterId = item.ChapterId;- }+ return await _context.Series+ .Where(s => targetSeries.Contains(s.Id))+ .AsSplitQuery()+ .AsNoTracking()+ .ProjectTo<SeriesDto>(_mapper.ConfigurationProvider)+ .ToListAsync();+ }- dto.Title = title;- items.Add(dto);- }+ private IQueryable<int> GetLibraryIdsForUser(int userId)+ {+ return _context.AppUser+ .Where(u => u.Id == userId)+ .SelectMany(l => l.Libraries.Select(lib => lib.Id));+ }++ public async Task<PagedList<SeriesDto>> GetMoreIn(int userId, int libraryId, int genreId, UserParams userParams)+ {+ var libraryIds = GetLibraryIdsForUser(userId, libraryId);+ var usersSeriesIds = GetSeriesIdsForLibraryIds(libraryIds);++ var query = _context.Series+ .Where(s => s.Metadata.Genres.Select(g => g.Id).Contains(genreId))+ .Where(s => usersSeriesIds.Contains(s.Id))+ .AsSplitQuery()+ .ProjectTo<SeriesDto>(_mapper.ConfigurationProvider);+++ return await PagedList<SeriesDto>.CreateAsync(query, userParams.PageNumber, userParams.PageSize);+ }++ public async Task<PagedList<SeriesDto>> GetRediscover(int userId, int libraryId, UserParams userParams)+ {+ var libraryIds = GetLibraryIdsForUser(userId, libraryId);+ var usersSeriesIds = GetSeriesIdsForLibraryIds(libraryIds);+ var distinctSeriesIdsWithProgress = _context.AppUserProgresses+ .Where(s => usersSeriesIds.Contains(s.SeriesId))+ .Select(p => p.SeriesId)+ .Distinct();++ var query = _context.Series+ .Where(s => distinctSeriesIdsWithProgress.Contains(s.Id) &&+ _context.AppUserProgresses.Where(s1 => s1.SeriesId == s.Id && s1.AppUserId == userId)+ .Sum(s1 => s1.PagesRead) >= s.Pages)+ .AsSplitQuery()+ .ProjectTo<SeriesDto>(_mapper.ConfigurationProvider);++ return await PagedList<SeriesDto>.CreateAsync(query, userParams.PageNumber, userParams.PageSize);+ }++ public async Task<SeriesDto> GetSeriesForMangaFile(int mangaFileId, int userId)+ {+ var libraryIds = GetLibraryIdsForUser(userId);+ return await _context.MangaFile+ .Where(m => m.Id == mangaFileId)+ .AsSplitQuery()+ .Select(f => f.Chapter)+ .Select(c => c.Volume)+ .Select(v => v.Series)+ .Where(s => libraryIds.Contains(s.LibraryId))+ .ProjectTo<SeriesDto>(_mapper.ConfigurationProvider)+ .SingleOrDefaultAsync();+ }++ public async Task<SeriesDto> GetSeriesForChapter(int chapterId, int userId)+ {+ var libraryIds = GetLibraryIdsForUser(userId);+ return await _context.Chapter+ .Where(m => m.Id == chapterId)+ .AsSplitQuery()+ .Select(c => c.Volume)+ .Select(v => v.Series)+ .Where(s => libraryIds.Contains(s.LibraryId))+ .ProjectTo<SeriesDto>(_mapper.ConfigurationProvider)+ .SingleOrDefaultAsync();+ }- return items;+ public async Task<PagedList<SeriesDto>> GetHighlyRated(int userId, int libraryId, UserParams userParams)+ {+ var libraryIds = GetLibraryIdsForUser(userId, libraryId);+ var usersSeriesIds = GetSeriesIdsForLibraryIds(libraryIds);+ var distinctSeriesIdsWithHighRating = _context.AppUserRating+ .Where(s => usersSeriesIds.Contains(s.SeriesId) && s.Rating > 4)+ .Select(p => p.SeriesId)+ .Distinct();+ var query = _context.Series+ .Where(s => distinctSeriesIdsWithHighRating.Contains(s.Id))+ .AsSplitQuery()+ .OrderByDescending(s => _context.AppUserRating.Where(r => r.SeriesId == s.Id).Select(r => r.Rating).Average())+ .ProjectTo<SeriesDto>(_mapper.ConfigurationProvider);++ return await PagedList<SeriesDto>.CreateAsync(query, userParams.PageNumber, userParams.PageSize);}+ public async Task<PagedList<SeriesDto>> GetQuickReads(int userId, int libraryId, UserParams userParams)+ {+ var libraryIds = GetLibraryIdsForUser(userId, libraryId);+ var usersSeriesIds = GetSeriesIdsForLibraryIds(libraryIds);+ var distinctSeriesIdsWithProgress = _context.AppUserProgresses+ .Where(s => usersSeriesIds.Contains(s.SeriesId))+ .Select(p => p.SeriesId)+ .Distinct();+++ var query = _context.Series+ .Where(s => s.Pages < 2000 && !distinctSeriesIdsWithProgress.Contains(s.Id) &&+ usersSeriesIds.Contains(s.Id))+ .Where(s => s.Metadata.PublicationStatus != PublicationStatus.OnGoing)+ .AsSplitQuery()+ .ProjectTo<SeriesDto>(_mapper.ConfigurationProvider);+++ return await PagedList<SeriesDto>.CreateAsync(query, userParams.PageNumber, userParams.PageSize);+ }+/// <summary>- /// Return recently updated series, regardless of read progress, and group the number of volume or chapters added.+ /// Returns all library ids for a user/// </summary>- /// <param name="userId">Used to ensure user has access to libraries</param>+ /// <param name="userId"></param>+ /// <param name="libraryId">0 for no library filter</param>/// <returns></returns>- public async Task<IList<GroupedSeriesDto>> GetRecentlyUpdatedSeries(int userId)+ private IQueryable<int> GetLibraryIdsForUser(int userId, int libraryId){- var ret = await GetRecentlyAddedChaptersQuery(userId, 150);+ return _context.AppUser+ .Where(u => u.Id == userId)+ .SelectMany(l => l.Libraries.Where(l => l.Id == libraryId || libraryId == 0).Select(lib => lib.Id));+ }+ public async Task<RelatedSeriesDto> GetRelatedSeries(int userId, int seriesId)+ {+ var libraryIds = GetLibraryIdsForUser(userId);+ var usersSeriesIds = GetSeriesIdsForLibraryIds(libraryIds);- var seriesMap = new Dictionary<string, GroupedSeriesDto>();- var index = 0;- foreach (var item in ret)+ return new RelatedSeriesDto(){- 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;- }- }+ SourceSeriesId = seriesId,+ Adaptations = await GetRelatedSeriesQuery(seriesId, usersSeriesIds, RelationKind.Adaptation),+ Characters = await GetRelatedSeriesQuery(seriesId, usersSeriesIds, RelationKind.Character),+ Prequels = await GetRelatedSeriesQuery(seriesId, usersSeriesIds, RelationKind.Prequel),+ Sequels = await GetRelatedSeriesQuery(seriesId, usersSeriesIds, RelationKind.Sequel),+ Contains = await GetRelatedSeriesQuery(seriesId, usersSeriesIds, RelationKind.Contains),+ SideStories = await GetRelatedSeriesQuery(seriesId, usersSeriesIds, RelationKind.SideStory),+ SpinOffs = await GetRelatedSeriesQuery(seriesId, usersSeriesIds, RelationKind.SpinOff),+ Others = await GetRelatedSeriesQuery(seriesId, usersSeriesIds, RelationKind.Other),+ AlternativeSettings = await GetRelatedSeriesQuery(seriesId, usersSeriesIds, RelationKind.AlternativeSetting),+ AlternativeVersions = await GetRelatedSeriesQuery(seriesId, usersSeriesIds, RelationKind.AlternativeVersion),+ Doujinshis = await GetRelatedSeriesQuery(seriesId, usersSeriesIds, RelationKind.Doujinshi),+ Parent = await _context.Series+ .SelectMany(s =>+ s.RelationOf.Where(r => r.TargetSeriesId == seriesId+ && usersSeriesIds.Contains(r.TargetSeriesId)+ && r.RelationKind != RelationKind.Prequel+ && r.RelationKind != RelationKind.Sequel)+ .Select(sr => sr.Series))+ .AsSplitQuery()+ .AsNoTracking()+ .ProjectTo<SeriesDto>(_mapper.ConfigurationProvider)+ .ToListAsync()+ };+ }- return seriesMap.Values.ToList();+ private IQueryable<int> GetSeriesIdsForLibraryIds(IQueryable<int> libraryIds)+ {+ return _context.Series+ .Where(s => libraryIds.Contains(s.LibraryId))+ .Select(s => s.Id);}- private async Task<List<RecentlyAddedSeries>> GetRecentlyAddedChaptersQuery(int userId, int maxRecords = 50)+ private async Task<IEnumerable<SeriesDto>> GetRelatedSeriesQuery(int seriesId, IEnumerable<int> usersSeriesIds, RelationKind kind)+ {+ return await _context.Series.SelectMany(s =>+ s.Relations.Where(sr => sr.RelationKind == kind && sr.SeriesId == seriesId && usersSeriesIds.Contains(sr.TargetSeriesId))+ .Select(sr => sr.TargetSeries))+ .AsSplitQuery()+ .AsNoTracking()+ .ProjectTo<SeriesDto>(_mapper.ConfigurationProvider)+ .ToListAsync();+ }++ private async Task<IEnumerable<RecentlyAddedSeries>> GetRecentlyAddedChaptersQuery(int userId, int maxRecords = 3000){var libraries = await _context.AppUser.Where(u => u.Id == userId)@@ -1021,7 +1214,7 @@ public class SeriesRepository : ISeriesRepositoryvar libraryIds = libraries.Select(l => l.LibraryId).ToList();var withinLastWeek = DateTime.Now - TimeSpan.FromDays(12);- var ret = await _context.Chapter+ var ret = _context.Chapter.Where(c => c.Created >= withinLastWeek).AsNoTracking().Include(c => c.Volume)@@ -1044,9 +1237,10 @@ public class SeriesRepository : ISeriesRepositoryVolumeNumber = c.Volume.Number,ChapterTitle = c.Title})- .Take(maxRecords)+ //.Take(maxRecords)+ .AsSplitQuery().Where(c => c.Created >= withinLastWeek && libraryIds.Contains(c.LibraryId))- .ToListAsync();+ .AsEnumerable();return ret;}}diff --git a/API/Data/Repositories/SiteThemeRepository.cs b/API/Data/Repositories/SiteThemeRepository.csindex a95fcda23..98f9c8c87 100644--- a/API/Data/Repositories/SiteThemeRepository.cs+++ b/API/Data/Repositories/SiteThemeRepository.cs@@ -19,7 +19,6 @@ public interface ISiteThemeRepositoryTask<SiteThemeDto> GetThemeDtoByName(string themeName);Task<SiteTheme> GetDefaultTheme();Task<IEnumerable<SiteTheme>> GetThemes();-Task<SiteTheme> GetThemeById(int themeId);}diff --git a/API/Data/Seed.cs b/API/Data/Seed.csindex ec0088aba..4ecd27da5 100644--- a/API/Data/Seed.cs+++ b/API/Data/Seed.cs@@ -21,35 +21,20 @@ namespace API.Data/// <summary>/// Generated on Startup. Seed.SeedSettings must run before/// </summary>- public static IList<ServerSetting> DefaultSettings;+ public static ImmutableArray<ServerSetting> DefaultSettings;- public static readonly IList<SiteTheme> DefaultThemes = new List<SiteTheme>- {- new()- {- Name = "Dark",- NormalizedName = Parser.Parser.Normalize("Dark"),- Provider = ThemeProvider.System,- FileName = "dark.scss",- IsDefault = true,- },- new()- {- Name = "Light",- NormalizedName = Parser.Parser.Normalize("Light"),- Provider = ThemeProvider.System,- FileName = "light.scss",- IsDefault = false,- },- new()+ public static readonly ImmutableArray<SiteTheme> DefaultThemes = ImmutableArray.Create(+ new List<SiteTheme>{- Name = "E-Ink",- NormalizedName = Parser.Parser.Normalize("E-Ink"),- Provider = ThemeProvider.System,- FileName = "e-ink.scss",- IsDefault = false,- },- };+ new()+ {+ Name = "Dark",+ NormalizedName = Parser.Parser.Normalize("Dark"),+ Provider = ThemeProvider.System,+ FileName = "dark.scss",+ IsDefault = true,+ }+ }.ToArray());public static async Task SeedRoles(RoleManager<AppRole> roleManager){@@ -90,24 +75,32 @@ namespace API.Datapublic static async Task SeedSettings(DataContext context, IDirectoryService directoryService){await context.Database.EnsureCreatedAsync();-- DefaultSettings = new List<ServerSetting>()+ DefaultSettings = ImmutableArray.Create(new List<ServerSetting>(){- new () {Key = ServerSettingKey.CacheDirectory, Value = directoryService.CacheDirectory},- new () {Key = ServerSettingKey.TaskScan, Value = "daily"},- new () {Key = ServerSettingKey.LoggingLevel, Value = "Information"}, // Not used from DB, but DB is sync with appSettings.json- new () {Key = ServerSettingKey.TaskBackup, Value = "daily"},- new () {Key = ServerSettingKey.BackupDirectory, Value = Path.GetFullPath(DirectoryService.BackupDirectory)},- new () {Key = ServerSettingKey.Port, Value = "5000"}, // Not used from DB, but DB is sync with appSettings.json- new () {Key = ServerSettingKey.AllowStatCollection, Value = "true"},- new () {Key = ServerSettingKey.EnableOpds, Value = "false"},- new () {Key = ServerSettingKey.EnableAuthentication, Value = "true"},- new () {Key = ServerSettingKey.BaseUrl, Value = "/"},- new () {Key = ServerSettingKey.InstallId, Value = HashUtil.AnonymousToken()},- new () {Key = ServerSettingKey.InstallVersion, Value = BuildInfo.Version.ToString()},- new () {Key = ServerSettingKey.BookmarkDirectory, Value = directoryService.BookmarkDirectory},- new () {Key = ServerSettingKey.EmailServiceUrl, Value = EmailService.DefaultApiUrl},- };+ new() {Key = ServerSettingKey.CacheDirectory, Value = directoryService.CacheDirectory},+ new() {Key = ServerSettingKey.TaskScan, Value = "daily"},+ new()+ {+ Key = ServerSettingKey.LoggingLevel, Value = "Information"+ }, // Not used from DB, but DB is sync with appSettings.json+ new() {Key = ServerSettingKey.TaskBackup, Value = "daily"},+ new()+ {+ Key = ServerSettingKey.BackupDirectory, Value = Path.GetFullPath(DirectoryService.BackupDirectory)+ },+ new()+ {+ Key = ServerSettingKey.Port, Value = "5000"+ }, // Not used from DB, but DB is sync with appSettings.json+ new() {Key = ServerSettingKey.AllowStatCollection, Value = "true"},+ new() {Key = ServerSettingKey.EnableOpds, Value = "false"},+ new() {Key = ServerSettingKey.EnableAuthentication, Value = "true"},+ new() {Key = ServerSettingKey.BaseUrl, Value = "/"},+ new() {Key = ServerSettingKey.InstallId, Value = HashUtil.AnonymousToken()},+ new() {Key = ServerSettingKey.InstallVersion, Value = BuildInfo.Version.ToString()},+ new() {Key = ServerSettingKey.BookmarkDirectory, Value = directoryService.BookmarkDirectory},+ new() {Key = ServerSettingKey.EmailServiceUrl, Value = EmailService.DefaultApiUrl},+ }.ToArray());foreach (var defaultSetting in DefaultSettings){diff --git a/API/Dockerfile b/API/Dockerfiledeleted file mode 100644index ce607a02f..000000000--- a/API/Dockerfile+++ /dev/null@@ -1,40 +0,0 @@-#This Dockerfile pulls the latest git commit and builds Kavita from source-FROM mcr.microsoft.com/dotnet/sdk:6.0-focal AS builder--ENV DEBIAN_FRONTEND=noninteractive-ARG TARGETPLATFORM--#Installs nodejs and npm-RUN curl -fsSL https://deb.nodesource.com/setup_14.x | bash - \- && apt-get install -y nodejs \- && rm -rf /var/lib/apt/lists/*--#Builds app based on platform-COPY build_target.sh /build_target.sh-RUN /build_target.sh--#Production image-FROM ubuntu:focal--#Move the output files to where they need to be-COPY --from=builder /Projects/Kavita/_output/build/Kavita /kavita--#Installs program dependencies-RUN apt-get update \- && apt-get install -y libicu-dev libssl1.1 pwgen \- && rm -rf /var/lib/apt/lists/*--#Creates the manga storage directory-RUN mkdir /manga /kavita/data--RUN cp /kavita/appsettings.Development.json /kavita/appsettings.json \- && sed -i 's/Data source=kavita.db/Data source=data\/kavita.db/g' /kavita/appsettings.json--COPY entrypoint.sh /entrypoint.sh--EXPOSE 5000--WORKDIR /kavita--ENTRYPOINT ["/bin/bash"]-CMD ["/entrypoint.sh"]diff --git a/API/Entities/AppUserPreferences.cs b/API/Entities/AppUserPreferences.csindex d35b82e39..bd68bc5ef 100644--- a/API/Entities/AppUserPreferences.cs+++ b/API/Entities/AppUserPreferences.cs@@ -25,6 +25,7 @@ namespace API.Entities/// </example>/// </summary>public ReaderMode ReaderMode { get; set; }+/// <summary>/// Manga Reader Option: Allow the menu to close after 6 seconds without interaction/// </summary>@@ -42,10 +43,6 @@ namespace API.Entities/// </summary>public string BackgroundColor { get; set; } = "#000000";/// <summary>- /// Book Reader Option: Should the background color be dark- /// </summary>- public bool BookReaderDarkMode { get; set; } = true;- /// <summary>/// Book Reader Option: Override extra Margin/// </summary>public int BookReaderMargin { get; set; } = 15;@@ -74,7 +71,22 @@ namespace API.Entities/// </summary>/// <remarks>Should default to Dark</remarks>public SiteTheme Theme { get; set; }-+ /// <summary>+ /// Book Reader Option: The color theme to decorate the book contents+ /// </summary>+ /// <remarks>Should default to Dark</remarks>+ public string BookThemeName { get; set; } = "Dark";+ /// <summary>+ /// Book Reader Option: The way a page from a book is rendered. Default is as book dictates, 1 column is fit to height,+ /// 2 column is fit to height, 2 columns+ /// </summary>+ /// <remarks>Defaults to Default</remarks>+ public BookPageLayoutMode PageLayoutMode { get; set; } = BookPageLayoutMode.Default;+ /// <summary>+ /// Book Reader Option: A flag that hides the menu-ing system behind a click on the screen. This should be used with tap to paginate, but the app doesn't enforce this.+ /// </summary>+ /// <remarks>Defaults to false</remarks>+ public bool BookReaderImmersiveMode { get; set; } = false;public AppUser AppUser { get; set; }diff --git a/API/Entities/Enums/AgeRating.cs b/API/Entities/Enums/AgeRating.csindex ed9deac25..82dbef7ae 100644--- a/API/Entities/Enums/AgeRating.cs+++ b/API/Entities/Enums/AgeRating.cs@@ -27,7 +27,7 @@ public enum AgeRatingKidsToAdults = 7,[Description("Teen")]Teen = 8,- [Description("MA 15+")]+ [Description("MA15+")]Mature15Plus = 9,[Description("Mature 17+")]Mature17Plus = 10,diff --git a/API/Entities/Enums/BookPageLayoutMode.cs b/API/Entities/Enums/BookPageLayoutMode.csnew file mode 100644index 000000000..dc61b5a1e--- /dev/null+++ b/API/Entities/Enums/BookPageLayoutMode.cs@@ -0,0 +1,13 @@+using System.ComponentModel;++namespace API.Entities.Enums;++public enum BookPageLayoutMode+{+ [Description("Default")]+ Default = 0,+ [Description("1 Column")]+ Column1 = 1,+ [Description("2 Column")]+ Column2 = 2+}diff --git a/API/Entities/Enums/PublicationStatus.cs b/API/Entities/Enums/PublicationStatus.csindex 69f700fc6..614bc0604 100644--- a/API/Entities/Enums/PublicationStatus.cs+++ b/API/Entities/Enums/PublicationStatus.cs@@ -18,6 +18,16 @@ public enum PublicationStatus/// Publication has finished releasing/// </summary>[Description("Completed")]- Completed = 2+ Completed = 2,+ /// <summary>+ /// Publication has been cancelled+ /// </summary>+ [Description("Cancelled")]+ Cancelled = 3,+ /// <summary>+ /// Publication has been completed, but Kavita doesn't have all issues/volumes accounted for+ /// </summary>+ [Description("Ended")]+ Ended = 4}diff --git a/API/Entities/Enums/RelationKind.cs b/API/Entities/Enums/RelationKind.csnew file mode 100644index 000000000..c01ab9571--- /dev/null+++ b/API/Entities/Enums/RelationKind.cs@@ -0,0 +1,66 @@+using System.ComponentModel;++namespace API.Entities.Enums;++/// <summary>+/// Represents a relationship between Series+/// </summary>+public enum RelationKind+{+ /// <summary>+ /// Story that occurred before the original.+ /// </summary>+ [Description("Prequel")]+ Prequel = 1,+ /// <summary>+ /// Direct continuation of the story.+ /// </summary>+ [Description("Sequel")]+ Sequel = 2,+ /// <summary>+ /// Uses characters of a different series, but is not an alternate setting or story.+ /// </summary>+ [Description("Spin Off")]+ SpinOff = 3,+ /// <summary>+ /// Manga/Anime/Light Novel adaptation+ /// </summary>+ [Description("Adaptation")]+ Adaptation = 4,+ /// <summary>+ /// Takes place sometime during the parent storyline.+ /// </summary>+ [Description("Side Story")]+ SideStory = 5,+ /// <summary>+ /// When characters appear in both series, but is not a spin-off+ /// </summary>+ [Description("Character")]+ Character = 6,+ /// <summary>+ /// When the story contains another story, useful for One-Shots+ /// </summary>+ [Description("Contains")]+ Contains = 7,+ /// <summary>+ /// When nothing else fits+ /// </summary>+ [Description("Other")]+ Other = 8,+ /// <summary>+ /// Same universe/world/reality/timeline, completely different characters+ /// </summary>+ [Description("Alternative Setting")]+ AlternativeSetting = 9,+ /// <summary>+ /// Same setting, same characters, story is told differently+ /// </summary>+ [Description("Alternative Version")]+ AlternativeVersion = 10,+ /// <summary>+ /// Doujinshi or Fan work+ /// </summary>+ [Description("Doujinshi")]+ Doujinshi = 11++}diff --git a/API/Entities/Interfaces/ITheme.cs b/API/Entities/Interfaces/ITheme.csnew file mode 100644index 000000000..216136569--- /dev/null+++ b/API/Entities/Interfaces/ITheme.cs@@ -0,0 +1,15 @@+using API.Entities.Enums.Theme;++namespace API.Entities.Interfaces;++/// <summary>+/// A theme in some kind+/// </summary>+public interface ITheme+{+ public string Name { get; set; }+ public string NormalizedName { get; set; }+ public string FileName { get; set; }+ public bool IsDefault { get; set; }+ public ThemeProvider Provider { get; set; }+}diff --git a/API/Entities/Metadata/SeriesMetadata.cs b/API/Entities/Metadata/SeriesMetadata.csindex 522f15d06..98e9fa8e9 100644--- a/API/Entities/Metadata/SeriesMetadata.cs+++ b/API/Entities/Metadata/SeriesMetadata.cs@@ -35,9 +35,13 @@ namespace API.Entities.Metadata/// </summary>public string Language { get; set; } = string.Empty;/// <summary>- /// Total number of issues in the series+ /// Total number of issues/volumes in the series/// </summary>- public int Count { get; set; } = 0;+ public int TotalCount { get; set; } = 0;+ /// <summary>+ /// Max number of issues/volumes in the series (Max of Volume/Issue field in ComicInfo)+ /// </summary>+ public int MaxCount { get; set; } = 0;public PublicationStatus PublicationStatus { get; set; }// Locksdiff --git a/API/Entities/Metadata/SeriesRelation.cs b/API/Entities/Metadata/SeriesRelation.csnew file mode 100644index 000000000..46e6c34b9--- /dev/null+++ b/API/Entities/Metadata/SeriesRelation.cs@@ -0,0 +1,25 @@+using System.Collections.Generic;+using System.ComponentModel.DataAnnotations.Schema;+using API.Entities.Enums;++namespace API.Entities.Metadata;++/// <summary>+/// A relation flows between one series and another.+/// Series ---kind---> target+/// </summary>+public class SeriesRelation+{+ public int Id { get; set; }+ public RelationKind RelationKind { get; set; }++ public virtual Series TargetSeries { get; set; }+ /// <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 virtual Series Series { get; set; }+ public int SeriesId { get; set; }+}diff --git a/API/Entities/ReadingList.cs b/API/Entities/ReadingList.csindex ef0b4bd9c..b665203c4 100644--- a/API/Entities/ReadingList.cs+++ b/API/Entities/ReadingList.cs@@ -11,11 +11,21 @@ namespace API.Entities{public int Id { get; init; }public 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; }/// <summary>/// Reading lists that are promoted are only done by admins/// </summary>public bool Promoted { 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 bool CoverImageLocked { get; set; }public ICollection<ReadingListItem> Items { get; set; }public DateTime Created { get; set; }diff --git a/API/Entities/Series.cs b/API/Entities/Series.csindex 12e169c07..1ddd8f082 100644--- a/API/Entities/Series.cs+++ b/API/Entities/Series.cs@@ -3,73 +3,84 @@ using System.Collections.Generic;using API.Entities.Enums;using API.Entities.Interfaces;using API.Entities.Metadata;-using Microsoft.EntityFrameworkCore;-namespace API.Entities+namespace API.Entities;++public class Series : IEntityDate{- [Index(nameof(Name), nameof(NormalizedName), nameof(LocalizedName), nameof(LibraryId), nameof(Format), IsUnique = true)]- public class Series : IEntityDate- {- public int Id { get; set; }- /// <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; }- /// <summary>- /// Used internally for name matching. <see cref="Parser.Parser.Normalize"/>- /// </summary>- public string NormalizedName { get; set; }- /// <summary>- /// The name used to sort the Series. By default, will be the same as Name.- /// </summary>- public 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; }- /// <summary>- /// Original Name on disk. Not exposed to UI.- /// </summary>- public string OriginalName { get; set; }- /// <summary>- /// Time of creation- /// </summary>- public DateTime Created { get; set; }- /// <summary>- /// Whenever a modification occurs. Ie) New volumes, removed volumes, title update, etc- /// </summary>- public DateTime LastModified { 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; }- /// <summary>- /// Denotes if the CoverImage has been overridden by the user. If so, it will not be updated during normal scan operations.- /// </summary>- public bool CoverImageLocked { get; set; }- /// <summary>- /// Sum of all Volume page counts- /// </summary>- public int Pages { get; set; }+ public int Id { get; set; }+ /// <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; }+ /// <summary>+ /// Used internally for name matching. <see cref="Parser.Parser.Normalize"/>+ /// </summary>+ public string NormalizedName { get; set; }+ /// <summary>+ /// The name used to sort the Series. By default, will be the same as Name.+ /// </summary>+ public 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; }+ /// <summary>+ /// Original Name on disk. Not exposed to UI.+ /// </summary>+ public string OriginalName { get; set; }+ /// <summary>+ /// Time of creation+ /// </summary>+ public DateTime Created { get; set; }+ /// <summary>+ /// Whenever a modification occurs. Ie) New volumes, removed volumes, title update, etc+ /// </summary>+ public DateTime LastModified { 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; }+ /// <summary>+ /// Denotes if the CoverImage has been overridden by the user. If so, it will not be updated during normal scan operations.+ /// </summary>+ public bool CoverImageLocked { get; set; }+ /// <summary>+ /// Sum of all Volume page counts+ /// </summary>+ public int Pages { get; set; }++ /// <summary>+ /// The type of all the files attached to this series+ /// </summary>+ public MangaFormat Format { get; set; } = MangaFormat.Unknown;++ public bool NameLocked { get; set; }+ public bool SortNameLocked { get; set; }+ public bool LocalizedNameLocked { get; set; }++ /// <summary>+ /// When a Chapter was last added onto the Series+ /// </summary>+ public DateTime LastChapterAdded { get; set; }++ public SeriesMetadata Metadata { get; set; }- /// <summary>- /// The type of all the files attached to this series- /// </summary>- public MangaFormat Format { get; set; } = MangaFormat.Unknown;+ public ICollection<AppUserRating> Ratings { get; set; } = new List<AppUserRating>();+ public ICollection<AppUserProgress> Progress { get; set; } = new List<AppUserProgress>();- public bool NameLocked { get; set; }- public bool SortNameLocked { get; set; }- public bool LocalizedNameLocked { get; set; }+ /// <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 SeriesMetadata Metadata { get; set; }- public ICollection<AppUserRating> Ratings { get; set; } = new List<AppUserRating>();- public ICollection<AppUserProgress> Progress { get; set; } = new List<AppUserProgress>();- // Relationships- public List<Volume> Volumes { get; set; }- public Library Library { get; set; }- public int LibraryId { get; set; }+ // Relationships+ public List<Volume> Volumes { get; set; }+ public Library Library { get; set; }+ public int LibraryId { get; set; }- }}diff --git a/API/Entities/SiteTheme.cs b/API/Entities/SiteTheme.csindex 87ebe95b1..a4847a7d6 100644--- a/API/Entities/SiteTheme.cs+++ b/API/Entities/SiteTheme.cs@@ -8,7 +8,7 @@ namespace API.Entities;/// <summary>/// Represents a set of css overrides the user can upload to Kavita and will load into webui/// </summary>-public class SiteTheme : IEntityDate+public class SiteTheme : IEntityDate, ITheme{public int Id { get; set; }/// <summary>@@ -23,6 +23,7 @@ public class SiteTheme : IEntityDate/// 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; }/// <summary>/// Only one theme can have this. Will auto-set this as default for new user accountsdiff --git a/API/Extensions/ApplicationServiceExtensions.cs b/API/Extensions/ApplicationServiceExtensions.csindex a4f51c67d..63e9dfdb9 100644--- a/API/Extensions/ApplicationServiceExtensions.cs+++ b/API/Extensions/ApplicationServiceExtensions.cs@@ -40,7 +40,7 @@ namespace API.Extensionsservices.AddScoped<IAccountService, AccountService>();services.AddScoped<IEmailService, EmailService>();services.AddScoped<IBookmarkService, BookmarkService>();- services.AddScoped<ISiteThemeService, SiteThemeService>();+ services.AddScoped<IThemeService, ThemeService>();services.AddScoped<ISeriesService, SeriesService>();diff --git a/API/Extensions/ChapterListExtensions.cs b/API/Extensions/ChapterListExtensions.csindex 6362c0571..a5d80bb92 100644--- a/API/Extensions/ChapterListExtensions.cs+++ b/API/Extensions/ChapterListExtensions.cs@@ -1,4 +1,4 @@-using System.Collections.Generic;+using System.Collections.Generic;using System.Linq;using API.Entities;using API.Parser;@@ -28,8 +28,8 @@ namespace API.Extensions{var specialTreatment = info.IsSpecialInfo();return specialTreatment- ? chapters.SingleOrDefault(c => c.Range == info.Filename || (c.Files.Select(f => f.FilePath).Contains(info.FullFilePath)))- : chapters.SingleOrDefault(c => c.Range == info.Chapters);+ ? chapters.FirstOrDefault(c => c.Range == info.Filename || (c.Files.Select(f => f.FilePath).Contains(info.FullFilePath)))+ : chapters.FirstOrDefault(c => c.Range == info.Chapters);}}-}\ No newline at end of file+}diff --git a/API/Extensions/VolumeListExtensions.cs b/API/Extensions/VolumeListExtensions.csindex 97126e28f..8933e04a5 100644--- a/API/Extensions/VolumeListExtensions.cs+++ b/API/Extensions/VolumeListExtensions.cs@@ -8,14 +8,6 @@ namespace API.Extensions{public static class VolumeListExtensions{- public static Volume FirstWithChapters(this IEnumerable<Volume> volumes, bool inBookSeries)- {- return inBookSeries- ? volumes.FirstOrDefault(v => v.Chapters.Any())- : volumes.OrderBy(v => v.Number, new ChapterSortComparer())- .FirstOrDefault(v => v.Chapters.Any());- }-/// <summary>/// Selects the first Volume to get the cover image from. For a book with only a special, the special will be returned./// If there are both specials and non-specials, then the first non-special will be returned.diff --git a/API/Helpers/AutoMapperProfiles.cs b/API/Helpers/AutoMapperProfiles.csindex 3765b7e47..db4bb8b3c 100644--- a/API/Helpers/AutoMapperProfiles.cs+++ b/API/Helpers/AutoMapperProfiles.cs@@ -6,6 +6,7 @@ using API.DTOs.Metadata;using API.DTOs.Reader;using API.DTOs.ReadingLists;using API.DTOs.Search;+using API.DTOs.SeriesDetail;using API.DTOs.Settings;using API.DTOs.Theme;using API.Entities;@@ -96,13 +97,23 @@ namespace API.Helpersopt =>opt.MapFrom(src => src.People.Where(p => p.Role == PersonRole.Editor)));+ // CreateMap<SeriesRelation, RelatedSeriesDto>()+ // .ForMember(dest => dest.Adaptations,+ // opt =>+ // opt.MapFrom(src => src.Where(p => p.Role == PersonRole.Writer)))CreateMap<AppUser, UserDto>();CreateMap<SiteTheme, SiteThemeDto>();CreateMap<AppUserPreferences, UserPreferencesDto>().ForMember(dest => dest.Theme,opt =>- opt.MapFrom(src => src.Theme));+ opt.MapFrom(src => src.Theme))+ .ForMember(dest => dest.BookReaderThemeName,+ opt =>+ opt.MapFrom(src => src.BookThemeName))+ .ForMember(dest => dest.BookReaderLayoutMode,+ opt =>+ opt.MapFrom(src => src.PageLayoutMode));CreateMap<AppUserBookmark, BookmarkDto>();diff --git a/API/Helpers/PersonHelper.cs b/API/Helpers/PersonHelper.csindex 36d544d4d..92551b200 100644--- a/API/Helpers/PersonHelper.cs+++ b/API/Helpers/PersonHelper.cs@@ -64,16 +64,14 @@ public static class PersonHelper/// </summary>/// <param name="existingPeople"></param>/// <param name="removeAllExcept"></param>- /// <param name="action">Callback for all entities that was removed</param>- public static void KeepOnlySamePeopleBetweenLists(ICollection<Person> existingPeople, ICollection<Person> removeAllExcept, Action<Person> action = null)+ /// <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){- var existing = existingPeople.ToList();- foreach (var person in existing)+ foreach (var person in existingPeople){var existingPerson = removeAllExcept.FirstOrDefault(p => p.Role == person.Role && person.NormalizedName.Equals(p.NormalizedName));if (existingPerson == null){- existingPeople.Remove(person);action?.Invoke(person);}}diff --git a/API/Parser/DefaultParser.cs b/API/Parser/DefaultParser.csindex d03bff199..9477fa072 100644--- a/API/Parser/DefaultParser.cs+++ b/API/Parser/DefaultParser.cs@@ -1,4 +1,4 @@-using System.IO;+using System.IO;using System.Linq;using API.Entities.Enums;using API.Services;@@ -132,11 +132,11 @@ public class DefaultParserif (!parsedVolume.Equals(Parser.DefaultVolume) || !parsedChapter.Equals(Parser.DefaultChapter)){- if ((ret.Volumes.Equals(Parser.DefaultVolume) || string.IsNullOrEmpty(ret.Volumes)) && !parsedVolume.Equals(Parser.DefaultVolume))+ if ((string.IsNullOrEmpty(ret.Volumes) || ret.Volumes.Equals(Parser.DefaultVolume)) && !parsedVolume.Equals(Parser.DefaultVolume)){ret.Volumes = parsedVolume;}- if ((ret.Chapters.Equals(Parser.DefaultChapter) || string.IsNullOrEmpty(ret.Chapters)) && !parsedChapter.Equals(Parser.DefaultChapter))+ if ((string.IsNullOrEmpty(ret.Chapters) || ret.Chapters.Equals(Parser.DefaultChapter)) && !parsedChapter.Equals(Parser.DefaultChapter)){ret.Chapters = parsedChapter;}diff --git a/API/Parser/Parser.cs b/API/Parser/Parser.csindex 63db72658..3edcf5d7c 100644--- a/API/Parser/Parser.cs+++ b/API/Parser/Parser.cs@@ -12,7 +12,7 @@ namespace API.Parserpublic const string DefaultVolume = "0";private static readonly TimeSpan RegexTimeout = TimeSpan.FromMilliseconds(500);- public const string ImageFileExtensions = @"^(\.png|\.jpeg|\.jpg|\.webp)";+ public const string ImageFileExtensions = @"^(\.png|\.jpeg|\.jpg|\.webp|\.gif)";public const string ArchiveFileExtensions = @"\.cbz|\.zip|\.rar|\.cbr|\.tar.gz|\.7zip|\.7z|\.cb7|\.cbt";public const string BookFileExtensions = @"\.epub|\.pdf";public const string MacOsMetadataFileStartsWith = @"._";@@ -43,7 +43,7 @@ namespace API.ParserMatchOptions, RegexTimeout);- private static readonly string XmlRegexExtensions = @"\.xml";+ private const string XmlRegexExtensions = @"\.xml";private static readonly Regex ImageRegex = new Regex(ImageFileExtensions,MatchOptions, RegexTimeout);private static readonly Regex ArchiveFileRegex = new Regex(ArchiveFileExtensions,@@ -54,7 +54,7 @@ namespace API.ParserMatchOptions, RegexTimeout);private static readonly Regex BookFileRegex = new Regex(BookFileExtensions,MatchOptions, RegexTimeout);- private static readonly Regex CoverImageRegex = new Regex(@"(?<![[a-z]\d])(?:!?)((?<!back)cover|folder)(?![\w\d])",+ private static readonly Regex CoverImageRegex = new Regex(@"(?<![[a-z]\d])(?:!?)(?<!back)(?<!back_)(?<!back-)(cover|folder)(?![\w\d])",MatchOptions, RegexTimeout);private static readonly Regex NormalizeRegex = new Regex(@"[^\p{L}0-9\+]",@@ -132,9 +132,9 @@ namespace API.Parsernew Regex(@"(?<Series>.*)(?:, Chapter )(?<Chapter>\d+)",MatchOptions, RegexTimeout),- // Please Go Home, Akutsu-San! - Chapter 038.5 - Volume Announcement.cbz+ // Please Go Home, Akutsu-San! - Chapter 038.5 - Volume Announcement.cbz, My Charms Are Wasted on Kuroiwa Medaka - Ch. 37.5 - Volume Extrasnew Regex(- @"(?<Series>.*)(\s|_|-)(?!Vol)(\s|_|-)(?:Chapter)(\s|_|-)(?<Chapter>\d+)",+ @"(?<Series>.+?)(\s|_|-)(?!Vol)(\s|_|-)((?:Chapter)|(?:Ch\.))(\s|_|-)(?<Chapter>\d+)",MatchOptions, RegexTimeout),// [dmntsf.net] One Piece - Digital Colored Comics Vol. 20 Ch. 177 - 30 Million vs 81 Million.cbznew Regex(@@ -452,10 +452,6 @@ namespace API.Parser};private static readonly Regex[] MangaEditionRegex = {// Tenjo Tenge {Full Contact Edition} v01 (2011) (Digital) (ASTC).cbz- new Regex(- @"(?<Edition>({|\(|\[).* Edition(}|\)|\]))",- MatchOptions, RegexTimeout),- // Tenjo Tenge {Full Contact Edition} v01 (2011) (Digital) (ASTC).cbznew Regex(@"(\b|_)(?<Edition>Omnibus(( |_)?Edition)?)(\b|_)?",MatchOptions, RegexTimeout),@@ -463,10 +459,6 @@ namespace API.Parsernew Regex(@"(\b|_)(?<Edition>Uncensored)(\b|_)",MatchOptions, RegexTimeout),- // AKIRA - c003 (v01) [Full Color] [Darkhorse].cbz- new Regex(- @"(\b|_)(?<Edition>Full(?: |_)Color)(\b|_)?",- MatchOptions, RegexTimeout),};private static readonly Regex[] CleanupRegex =@@ -934,7 +926,7 @@ namespace API.Parser}- public static float MaximumNumberFromRange(string range)+ public static float MinNumberFromRange(string range){try{@@ -944,7 +936,7 @@ namespace API.Parser}var tokens = range.Replace("_", string.Empty).Split("-");- return tokens.Max(float.Parse);+ return tokens.Min(float.Parse);}catch{@@ -952,7 +944,7 @@ namespace API.Parser}}- public static float MinimumNumberFromRange(string range)+ public static float MaxNumberFromRange(string range){try{@@ -962,7 +954,7 @@ namespace API.Parser}var tokens = range.Replace("_", string.Empty).Split("-");- return tokens.Min(float.Parse);+ return tokens.Max(float.Parse);}catch{@@ -1007,7 +999,7 @@ namespace API.Parserpublic static bool HasBlacklistedFolderInPath(string path){- return path.Contains("__MACOSX") || path.StartsWith("@Recently-Snapshot") || path.StartsWith("@recycle") || path.StartsWith("._");+ return path.Contains("__MACOSX") || path.StartsWith("@Recently-Snapshot") || path.StartsWith("@recycle") || path.StartsWith("._") || path.Contains(".qpkg");}diff --git a/API/Parser/ParserInfo.cs b/API/Parser/ParserInfo.csindex 07679ea25..caae49f84 100644--- a/API/Parser/ParserInfo.cs+++ b/API/Parser/ParserInfo.cs@@ -22,6 +22,10 @@ namespace API.Parser/// </summary>public string SeriesSort { get; set; } = string.Empty;/// <summary>+ /// This can be filled in from ComicInfo.xml/Epub during scanning. Will update the LocalizedName field on <see cref="Entities.Series"/>+ /// </summary>+ public string LocalizedSeries { get; set; } = string.Empty;+ /// <summary>/// Represents the parsed volumes from a file. By default, will be 0 which means that nothing could be parsed./// If Volumes is 0 and Chapters is 0, the file is a special. If Chapters is non-zero, then no volume could be parsed./// <example>Beastars Vol 3-4 will map to "3-4"</example>diff --git a/API/Services/ArchiveService.cs b/API/Services/ArchiveService.csindex fd29ea07d..97202b71d 100644--- a/API/Services/ArchiveService.cs+++ b/API/Services/ArchiveService.cs@@ -4,6 +4,7 @@ using System.Diagnostics;using System.IO;using System.IO.Compression;using System.Linq;+using System.Text;using System.Threading.Tasks;using System.Xml.Serialization;using API.Archive;@@ -436,6 +437,12 @@ namespace API.Servicesif (Directory.Exists(extractPath)) return;+ if (!_directoryService.FileSystem.File.Exists(archivePath))+ {+ _logger.LogError("{Archive} does not exist on disk", archivePath);+ throw new KavitaException($"{archivePath} does not exist on disk");+ }+var sw = Stopwatch.StartNew();trydiff --git a/API/Services/BookService.cs b/API/Services/BookService.csindex 9e9aa0ac2..fedd2ddb9 100644--- a/API/Services/BookService.cs+++ b/API/Services/BookService.cs@@ -20,6 +20,7 @@ using Microsoft.IO;using SixLabors.ImageSharp;using SixLabors.ImageSharp.PixelFormats;using VersOne.Epub;+using VersOne.Epub.Options;using Image = SixLabors.ImageSharp.Image;namespace API.Services@@ -59,6 +60,13 @@ namespace API.Servicesprivate readonly StylesheetParser _cssParser = new ();private static readonly RecyclableMemoryStreamManager StreamManager = new ();private const string CssScopeClass = ".book-content";+ public static readonly EpubReaderOptions BookReaderOptions = new()+ {+ PackageReaderOptions = new PackageReaderOptions()+ {+ IgnoreMissingToc = true+ }+ };public BookService(ILogger<BookService> logger, IDirectoryService directoryService, IImageService imageService){@@ -148,8 +156,7 @@ namespace API.Servicespublic async Task<string> ScopeStyles(string stylesheetHtml, string apiBase, string filename, EpubBookRef book){- // @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+ // @Import statements will be handled by browser, so we must inline the css into the original file that request it, so they can be Scopedvar prepend = filename.Length > 0 ? filename.Replace(Path.GetFileName(filename), string.Empty) : string.Empty;var importBuilder = new StringBuilder();foreach (Match match in Parser.Parser.CssImportUrlRegex.Matches(stylesheetHtml))@@ -175,6 +182,7 @@ namespace API.ServicesEscapeFontFamilyReferences(ref stylesheetHtml, apiBase, prepend);+// Check if there are any background images and rewrite those urlsEscapeCssImageReferences(ref stylesheetHtml, apiBase, book);@@ -237,68 +245,62 @@ namespace API.Servicesprivate static void ScopeImages(HtmlDocument doc, EpubBookRef book, string apiBase){- var images = doc.DocumentNode.SelectNodes("//img");- if (images != null)+ var images = doc.DocumentNode.SelectNodes("//img")+ ?? doc.DocumentNode.SelectNodes("//image");++ if (images == null) return;++ foreach (var image in images){- foreach (var image in images)+ string key = null;+ if (image.Attributes["src"] != null){- if (image.Name != "img") continue;+ key = "src";+ }+ else if (image.Attributes["xlink:href"] != null)+ {+ key = "xlink:href";+ }- // Need to do for xlink:href- if (image.Attributes["src"] != null)- {- var imageFile = image.Attributes["src"].Value;- if (!book.Content.Images.ContainsKey(imageFile))- {- // TODO: Refactor the Key code to a method to allow the hacks to be tested- var correctedKey = book.Content.Images.Keys.SingleOrDefault(s => s.EndsWith(imageFile));- if (correctedKey != null)- {- imageFile = correctedKey;- } else if (imageFile.StartsWith(".."))- {- // There are cases where the key is defined static like OEBPS/Images/1-4.jpg but reference is ../Images/1-4.jpg- correctedKey = book.Content.Images.Keys.SingleOrDefault(s => s.EndsWith(imageFile.Replace("..", string.Empty)));- if (correctedKey != null)- {- imageFile = correctedKey;- }- }+ if (string.IsNullOrEmpty(key)) continue;+ var imageFile = GetKeyForImage(book, image.Attributes[key].Value);+ image.Attributes.Remove(key);+ image.Attributes.Add(key, $"{apiBase}" + imageFile);+ // Add a custom class that the reader uses to ensure images stay within reader+ image.AddClass("kavita-scale-width");+ }- }+ }- image.Attributes.Remove("src");- image.Attributes.Add("src", $"{apiBase}" + imageFile);- }- }- }+ /// <summary>+ /// Returns the image key associated with the file. Contains some basic fallback logic.+ /// </summary>+ /// <param name="book"></param>+ /// <param name="imageFile"></param>+ /// <returns></returns>+ private static string GetKeyForImage(EpubBookRef book, string imageFile)+ {+ if (book.Content.Images.ContainsKey(imageFile)) return imageFile;- images = doc.DocumentNode.SelectNodes("//image");- if (images != null)+ var correctedKey = book.Content.Images.Keys.SingleOrDefault(s => s.EndsWith(imageFile));+ if (correctedKey != null){- foreach (var image in images)+ imageFile = correctedKey;+ }+ else if (imageFile.StartsWith(".."))+ {+ // There are cases where the key is defined static like OEBPS/Images/1-4.jpg but reference is ../Images/1-4.jpg+ correctedKey =+ book.Content.Images.Keys.SingleOrDefault(s => s.EndsWith(imageFile.Replace("..", string.Empty)));+ if (correctedKey != null){- if (image.Name != "image") continue;-- if (image.Attributes["xlink:href"] != null)- {- var imageFile = image.Attributes["xlink:href"].Value;- if (!book.Content.Images.ContainsKey(imageFile))- {- var correctedKey = book.Content.Images.Keys.SingleOrDefault(s => s.EndsWith(imageFile));- if (correctedKey != null)- {- imageFile = correctedKey;- }- }-- image.Attributes.Remove("xlink:href");- image.Attributes.Add("xlink:href", $"{apiBase}" + imageFile);- }+ imageFile = correctedKey;}}++ return imageFile;}private static string PrepareFinalHtml(HtmlDocument doc, HtmlNode body)@@ -317,12 +319,11 @@ namespace API.Servicesprivate static void RewriteAnchors(int page, HtmlDocument doc, Dictionary<string, int> mappings){var anchors = doc.DocumentNode.SelectNodes("//a");- if (anchors != null)+ if (anchors == null) return;++ foreach (var anchor in anchors){- foreach (var anchor in anchors)- {- BookService.UpdateLinks(anchor, mappings, page);- }+ UpdateLinks(anchor, mappings, page);}}@@ -383,23 +384,44 @@ namespace API.Servicestry{- using var epubBook = EpubReader.OpenBook(filePath);+ using var epubBook = EpubReader.OpenBook(filePath, BookReaderOptions);var publicationDate =epubBook.Schema.Package.Metadata.Dates.FirstOrDefault(date => date.Event == "publication")?.Date;+ if (string.IsNullOrEmpty(publicationDate))+ {+ publicationDate = epubBook.Schema.Package.Metadata.Dates.FirstOrDefault()?.Date;+ }+ var dateParsed = DateTime.TryParse(publicationDate, out var date);+ var year = 0;+ var month = 0;+ var day = 0;+ switch (dateParsed)+ {+ case true:+ year = date.Year;+ month = date.Month;+ day = date.Day;+ break;+ case false when !string.IsNullOrEmpty(publicationDate) && publicationDate.Length == 4:+ int.TryParse(publicationDate, out year);+ break;+ }+var info = new ComicInfo(){Summary = epubBook.Schema.Package.Metadata.Description,Writer = string.Join(",", epubBook.Schema.Package.Metadata.Creators.Select(c => Parser.Parser.CleanAuthor(c.Creator))),Publisher = string.Join(",", epubBook.Schema.Package.Metadata.Publishers),- Month = !string.IsNullOrEmpty(publicationDate) ? DateTime.Parse(publicationDate).Month : 0,- Day = !string.IsNullOrEmpty(publicationDate) ? DateTime.Parse(publicationDate).Day : 0,- Year = !string.IsNullOrEmpty(publicationDate) ? DateTime.Parse(publicationDate).Year : 0,+ Month = month,+ Day = day,+ Year = year,Title = epubBook.Title,Genre = string.Join(",", epubBook.Schema.Package.Metadata.Subjects.Select(s => s.ToLower().Trim())),LanguageISO = epubBook.Schema.Package.Metadata.Languages.FirstOrDefault() ?? string.Empty-};+ ComicInfo.CleanComicInfo(info);+// Parse tags not exposed via Libraryforeach (var metadataItem in epubBook.Schema.Package.Metadata.MetaItems){@@ -450,7 +472,7 @@ namespace API.Servicesreturn docReader.GetPageCount();}- using var epubBook = EpubReader.OpenBook(filePath);+ using var epubBook = EpubReader.OpenBook(filePath, BookReaderOptions);return epubBook.Content.Html.Count;}catch (Exception ex)@@ -504,7 +526,7 @@ namespace API.Servicestry{- using var epubBook = EpubReader.OpenBook(filePath);+ using var epubBook = EpubReader.OpenBook(filePath, BookReaderOptions);// <meta content="The Dark Tower" name="calibre:series"/>// <meta content="Wolves of the Calla" name="calibre:title_sort"/>@@ -669,8 +691,7 @@ namespace API.Servicesreturn GetPdfCoverImage(fileFilePath, fileName, outputDirectory);}- using var epubBook = EpubReader.OpenBook(fileFilePath);-+ using var epubBook = EpubReader.OpenBook(fileFilePath, BookReaderOptions);try{diff --git a/API/Services/BookmarkService.cs b/API/Services/BookmarkService.csindex 2f4cd8cdc..4468a79a1 100644--- a/API/Services/BookmarkService.cs+++ b/API/Services/BookmarkService.cs@@ -17,7 +17,8 @@ public interface IBookmarkServiceTask DeleteBookmarkFiles(IEnumerable<AppUserBookmark> bookmarks);Task<bool> BookmarkPage(AppUser userWithBookmarks, BookmarkDto bookmarkDto, string imageToBookmark);Task<bool> RemoveBookmarkPage(AppUser userWithBookmarks, BookmarkDto bookmarkDto);- Task<IEnumerable<string>> GetBookmarkFilesById(int userId, IEnumerable<int> bookmarkIds);+ Task<IEnumerable<string>> GetBookmarkFilesById(IEnumerable<int> bookmarkIds);+}public class BookmarkService : IBookmarkService@@ -141,7 +142,7 @@ public class BookmarkService : IBookmarkServicereturn true;}- public async Task<IEnumerable<string>> GetBookmarkFilesById(int userId, IEnumerable<int> bookmarkIds)+ public async Task<IEnumerable<string>> GetBookmarkFilesById(IEnumerable<int> bookmarkIds){var bookmarkDirectory =(await _unitOfWork.SettingsRepository.GetSettingAsync(ServerSettingKey.BookmarkDirectory)).Value;diff --git a/API/Services/CacheService.cs b/API/Services/CacheService.csindex ef2d3609a..f55d74734 100644--- a/API/Services/CacheService.cs+++ b/API/Services/CacheService.cs@@ -7,6 +7,7 @@ using API.Data;using API.Entities;using API.Entities.Enums;using API.Extensions;+using Kavita.Common;using Microsoft.Extensions.Logging;namespace API.Services@@ -25,9 +26,13 @@ namespace API.Services/// </summary>/// <param name="chapterIds">Volumes that belong to that library. Assume the library might have been deleted before this invocation.</param>void CleanupChapters(IEnumerable<int> chapterIds);+ void CleanupBookmarks(IEnumerable<int> seriesIds);string GetCachedPagePath(Chapter chapter, int page);+ string GetCachedBookmarkPagePath(int seriesId, int page);string GetCachedEpubFile(int chapterId, Chapter chapter);public void ExtractChapterFiles(string extractPath, IReadOnlyList<MangaFile> files);+ Task<int> CacheBookmarkForSeries(int userId, int seriesId);+ void CleanupBookmarkCache(int bookmarkDtoSeriesId);}public class CacheService : ICacheService{@@ -35,16 +40,36 @@ namespace API.Servicesprivate readonly IUnitOfWork _unitOfWork;private readonly IDirectoryService _directoryService;private readonly IReadingItemService _readingItemService;- private readonly NumericComparer _numericComparer;+ private readonly IBookmarkService _bookmarkService;public CacheService(ILogger<CacheService> logger, IUnitOfWork unitOfWork,- IDirectoryService directoryService, IReadingItemService readingItemService)+ IDirectoryService directoryService, IReadingItemService readingItemService,+ IBookmarkService bookmarkService){_logger = logger;_unitOfWork = unitOfWork;_directoryService = directoryService;_readingItemService = readingItemService;- _numericComparer = new NumericComparer();+ _bookmarkService = bookmarkService;+ }++ public string GetCachedBookmarkPagePath(int seriesId, int page)+ {+ // Calculate what chapter the page belongs to+ var path = GetBookmarkCachePath(seriesId);+ var files = _directoryService.GetFilesWithExtension(path, Parser.Parser.ImageFileExtensions);+ files = files+ .AsEnumerable()+ .OrderByNatural(Path.GetFileNameWithoutExtension)+ .ToArray();++ if (files.Length == 0)+ {+ return string.Empty;+ }++ // 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);}/// <summary>@@ -122,6 +147,12 @@ namespace API.Serviceselse if (file.Format == MangaFormat.Epub){removeNonImages = false;+ if (!_directoryService.FileSystem.File.Exists(files[0].FilePath))+ {+ _logger.LogError("{Archive} does not exist on disk", files[0].FilePath);+ throw new KavitaException($"{files[0].FilePath} does not exist on disk");+ }+_directoryService.ExistOrCreate(extractPath);_directoryService.CopyFileToDirectory(files[0].FilePath, extractPath);}@@ -146,6 +177,18 @@ namespace API.Services}}+ /// <summary>+ /// Removes the cached files and folders for a set of chapterIds+ /// </summary>+ /// <param name="seriesIds"></param>+ public void CleanupBookmarks(IEnumerable<int> seriesIds)+ {+ foreach (var series in seriesIds)+ {+ _directoryService.ClearAndDeleteDirectory(GetBookmarkCachePath(series));+ }+ }+/// <summary>/// Returns the cache path for a given Chapter. Should be cacheDirectory/{chapterId}/@@ -157,6 +200,11 @@ namespace API.Servicesreturn _directoryService.FileSystem.Path.GetFullPath(_directoryService.FileSystem.Path.Join(_directoryService.CacheDirectory, $"{chapterId}/"));}+ private string GetBookmarkCachePath(int seriesId)+ {+ return _directoryService.FileSystem.Path.GetFullPath(_directoryService.FileSystem.Path.Join(_directoryService.CacheDirectory, $"{seriesId}_bookmarks/"));+ }+/// <summary>/// Returns the absolute path of a cached page./// </summary>@@ -181,5 +229,29 @@ namespace API.Services// 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);}++ public async Task<int> CacheBookmarkForSeries(int userId, int seriesId)+ {+ var destDirectory = _directoryService.FileSystem.Path.Join(_directoryService.CacheDirectory, seriesId + "_bookmarks");+ if (_directoryService.Exists(destDirectory)) return _directoryService.GetFiles(destDirectory).Count();++ var bookmarkDtos = await _unitOfWork.UserRepository.GetBookmarkDtosForSeries(userId, seriesId);+ var files = (await _bookmarkService.GetBookmarkFilesById(bookmarkDtos.Select(b => b.Id))).ToList();+ _directoryService.CopyFilesToDirectory(files, destDirectory);+ _directoryService.Flatten(destDirectory);+ return files.Count;+ }++ /// <summary>+ /// Clears a cached bookmarks for a series id folder+ /// </summary>+ /// <param name="seriesId"></param>+ public void CleanupBookmarkCache(int seriesId)+ {+ var destDirectory = _directoryService.FileSystem.Path.Join(_directoryService.CacheDirectory, seriesId + "_bookmarks");+ if (!_directoryService.Exists(destDirectory)) return;++ _directoryService.ClearAndDeleteDirectory(destDirectory);+ }}}diff --git a/API/Services/DirectoryService.cs b/API/Services/DirectoryService.csindex cfbd2b138..d5765bc57 100644--- a/API/Services/DirectoryService.cs+++ b/API/Services/DirectoryService.cs@@ -69,7 +69,7 @@ namespace API.Servicesprivate readonly ILogger<DirectoryService> _logger;private static readonly Regex ExcludeDirectories = new Regex(- @"@eaDir|\.DS_Store|\.qpkg",+ @"@eaDir|\.DS_Store|\.qpkg|__MACOSX|@Recently-Snapshot|@recycle",RegexOptions.Compiled | RegexOptions.IgnoreCase);private static readonly Regex FileCopyAppend = new Regex(@"\(\d+\)",RegexOptions.Compiled | RegexOptions.IgnoreCase);diff --git a/API/Services/DownloadService.cs b/API/Services/DownloadService.csindex 7fc1418e6..76365d3d3 100644--- a/API/Services/DownloadService.cs+++ b/API/Services/DownloadService.cs@@ -45,12 +45,16 @@ public class DownloadService : IDownloadService{contentType = Path.GetExtension(filepath).ToLowerInvariant() switch{- ".cbz" => "application/zip",- ".cbr" => "application/vnd.rar",- ".cb7" => "application/x-compressed",+ ".cbz" => "application/x-cbz",+ ".cbr" => "application/x-cbr",+ ".cb7" => "application/x-cb7",+ ".cbt" => "application/x-cbt",".epub" => "application/epub+zip",".7z" => "application/x-7z-compressed",".7zip" => "application/x-7z-compressed",+ ".rar" => "application/vnd.rar",+ ".zip" => "application/zip",+ ".tar.gz" => "application/gzip",".pdf" => "application/pdf",_ => contentType};diff --git a/API/Services/ImageService.cs b/API/Services/ImageService.csindex cc852b5bb..6578b6f63 100644--- a/API/Services/ImageService.cs+++ b/API/Services/ImageService.cs@@ -26,8 +26,9 @@ public class ImageService : IImageServiceprivate readonly ILogger<ImageService> _logger;private readonly IDirectoryService _directoryService;public const string ChapterCoverImageRegex = @"v\d+_c\d+";- public const string SeriesCoverImageRegex = @"series_\d+";- public const string CollectionTagCoverImageRegex = @"tag_\d+";+ public const string SeriesCoverImageRegex = @"series\d+";+ public const string CollectionTagCoverImageRegex = @"tag\d+";+ public const string ReadingListCoverImageRegex = @"readinglist\d+";/// <summary>@@ -143,4 +144,16 @@ public class ImageService : IImageService{return $"tag{tagId}";}++ /// <summary>+ /// Returns the name format for a reading list cover image+ /// </summary>+ /// <param name="readingListId"></param>+ /// <returns></returns>+ public static string GetReadingListFormat(int readingListId)+ {+ return $"readinglist{readingListId}";+ }++}diff --git a/API/Services/MetadataService.cs b/API/Services/MetadataService.csindex 590582eb5..dcd356d88 100644--- a/API/Services/MetadataService.cs+++ b/API/Services/MetadataService.cs@@ -62,7 +62,7 @@ public class MetadataService : IMetadataService/// <param name="forceUpdate">Force updating cover image even if underlying file has not been modified or chapter already has a cover image</param>private async Task<bool> UpdateChapterCoverImage(Chapter chapter, bool forceUpdate){- var firstFile = chapter.Files.OrderBy(x => x.Chapter).FirstOrDefault();+ var firstFile = chapter.Files.MinBy(x => x.Chapter);if (!_cacheHelper.ShouldUpdateCoverImage(_directoryService.FileSystem.Path.Join(_directoryService.CoverImageDirectory, chapter.CoverImage), firstFile, chapter.Created, forceUpdate, chapter.CoverImageLocked))return false;@@ -72,7 +72,7 @@ public class MetadataService : IMetadataService_logger.LogDebug("[MetadataService] Generating cover image for {File}", firstFile.FilePath);chapter.CoverImage = _readingItemService.GetCoverImage(firstFile.FilePath, ImageService.GetChapterFormat(chapter.Id, chapter.VolumeId), firstFile.Format);await _eventHub.SendMessageAsync(MessageFactory.CoverUpdate,- MessageFactory.CoverUpdateEvent(chapter.Id, "chapter"), false);+ MessageFactory.CoverUpdateEvent(chapter.Id, MessageFactoryEntityTypes.Chapter), false);return true;}@@ -97,11 +97,12 @@ public class MetadataService : IMetadataServicenull, volume.Created, forceUpdate)) return false;volume.Chapters ??= new List<Chapter>();- var firstChapter = volume.Chapters.OrderBy(x => double.Parse(x.Number), _chapterSortComparerForInChapterSorting).FirstOrDefault();+ var firstChapter = volume.Chapters.MinBy(x => double.Parse(x.Number), _chapterSortComparerForInChapterSorting);if (firstChapter == null) return false;volume.CoverImage = firstChapter.CoverImage;- await _eventHub.SendMessageAsync(MessageFactory.CoverUpdate, MessageFactory.CoverUpdateEvent(volume.Id, "volume"), false);+ await _eventHub.SendMessageAsync(MessageFactory.CoverUpdate, MessageFactory.CoverUpdateEvent(volume.Id, MessageFactoryEntityTypes.Volume), false);+return true;}@@ -133,12 +134,11 @@ public class MetadataService : IMetadataServiceif (!_cacheHelper.CoverImageExists(coverImage)){- coverImage = series.Volumes[0].Chapters.OrderBy(c => double.Parse(c.Number), _chapterSortComparerForInChapterSorting)- .FirstOrDefault()?.CoverImage;+ coverImage = series.Volumes[0].Chapters.MinBy(c => double.Parse(c.Number), _chapterSortComparerForInChapterSorting)?.CoverImage;}}series.CoverImage = firstCover?.CoverImage ?? coverImage;- await _eventHub.SendMessageAsync(MessageFactory.CoverUpdate, MessageFactory.CoverUpdateEvent(series.Id, "series"), false);+ await _eventHub.SendMessageAsync(MessageFactory.CoverUpdate, MessageFactory.CoverUpdateEvent(series.Id, MessageFactoryEntityTypes.Series), false);}@@ -300,7 +300,7 @@ public class MetadataService : IMetadataServiceif (_unitOfWork.HasChanges() && await _unitOfWork.CommitAsync()){- await _eventHub.SendMessageAsync(MessageFactory.CoverUpdate, MessageFactory.CoverUpdateEvent(series.Id, "series"), false);+ await _eventHub.SendMessageAsync(MessageFactory.CoverUpdate, MessageFactory.CoverUpdateEvent(series.Id, MessageFactoryEntityTypes.Series), false);}_logger.LogInformation("[MetadataService] Updated metadata for {SeriesName} in {ElapsedMilliseconds} milliseconds", series.Name, sw.ElapsedMilliseconds);diff --git a/API/Services/ReaderService.cs b/API/Services/ReaderService.csindex ab586486d..8e3f5c47d 100644--- a/API/Services/ReaderService.cs+++ b/API/Services/ReaderService.cs@@ -9,6 +9,7 @@ using API.Data.Repositories;using API.DTOs;using API.Entities;using API.Extensions;+using API.SignalR;using Kavita.Common;using Microsoft.Extensions.Logging;@@ -33,13 +34,15 @@ public class ReaderService : IReaderService{private readonly IUnitOfWork _unitOfWork;private readonly ILogger<ReaderService> _logger;+ private readonly IEventHub _eventHub;private readonly ChapterSortComparer _chapterSortComparer = new ChapterSortComparer();private readonly ChapterSortComparerZeroFirst _chapterSortComparerForInChapterSorting = new ChapterSortComparerZeroFirst();- public ReaderService(IUnitOfWork unitOfWork, ILogger<ReaderService> logger)+ public ReaderService(IUnitOfWork unitOfWork, ILogger<ReaderService> logger, IEventHub eventHub){_unitOfWork = unitOfWork;_logger = logger;+ _eventHub = eventHub;}public static string FormatBookmarkFolderPath(string baseDirectory, int userId, int seriesId, int chapterId)@@ -211,9 +214,11 @@ public class ReaderService : IReaderService_unitOfWork.AppUserProgressRepository.Update(userProgress);}- if (!_unitOfWork.HasChanges()) return true;- if (await _unitOfWork.CommitAsync())+ if (!_unitOfWork.HasChanges() || await _unitOfWork.CommitAsync()){+ 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));return true;}}@@ -470,7 +475,7 @@ public class ReaderService : IReaderService{var chapters = volume.Chapters.OrderBy(c => float.Parse(c.Number))- .Where(c => !c.IsSpecial && Parser.Parser.MaximumNumberFromRange(c.Range) <= chapterNumber);+ .Where(c => !c.IsSpecial && Parser.Parser.MaxNumberFromRange(c.Range) <= chapterNumber);MarkChaptersAsRead(user, volume.SeriesId, chapters);}}diff --git a/API/Services/ReadingItemService.cs b/API/Services/ReadingItemService.csindex d791efd55..a5130c747 100644--- a/API/Services/ReadingItemService.cs+++ b/API/Services/ReadingItemService.cs@@ -33,7 +33,7 @@ public class ReadingItemService : IReadingItemService}/// <summary>- /// Gets the ComicInfo for the file if it exists. Null otherewise.+ /// Gets the ComicInfo for the file if it exists. Null otherwise./// </summary>/// <param name="filePath">Fully qualified path of file</param>/// <returns></returns>diff --git a/API/Services/SeriesService.cs b/API/Services/SeriesService.csindex 25f736e99..63fb87d66 100644--- a/API/Services/SeriesService.cs+++ b/API/Services/SeriesService.cs@@ -10,6 +10,7 @@ using API.DTOs.CollectionTags;using API.DTOs.Metadata;using API.Entities;using API.Entities.Enums;+using API.Extensions;using API.Helpers;using API.SignalR;using Microsoft.Extensions.Logging;@@ -41,6 +42,19 @@ public class SeriesService : ISeriesService_logger = logger;}+ /// <summary>+ /// Returns the first chapter for a series to extract metadata from (ie Summary, etc)+ /// </summary>+ /// <param name="series"></param>+ /// <param name="isBookLibrary"></param>+ /// <returns></returns>+ public static Chapter GetFirstChapterForMetadata(Series series, bool isBookLibrary)+ {+ return series.Volumes.OrderBy(v => v.Number, new ChapterSortComparer())+ .SelectMany(v => v.Chapters.OrderBy(c => float.Parse(c.Number), new ChapterSortComparer()))+ .FirstOrDefault();+ }+public async Task<bool> UpdateSeriesMetadata(UpdateSeriesMetadataDto updateSeriesMetadataDto){try@@ -137,24 +151,22 @@ public class SeriesService : ISeriesServiceUpdatePeopleList(PersonRole.CoverArtist, updateSeriesMetadataDto.SeriesMetadata.CoverArtists, series, allPeople,HandleAddPerson, () => series.Metadata.CoverArtistLocked = true);- if (!updateSeriesMetadataDto.SeriesMetadata.AgeRatingLocked) series.Metadata.AgeRatingLocked = false;- if (!updateSeriesMetadataDto.SeriesMetadata.PublicationStatusLocked) series.Metadata.PublicationStatusLocked = false;- if (!updateSeriesMetadataDto.SeriesMetadata.LanguageLocked) series.Metadata.LanguageLocked = false;- if (!updateSeriesMetadataDto.SeriesMetadata.GenresLocked) series.Metadata.GenresLocked = false;- if (!updateSeriesMetadataDto.SeriesMetadata.TagsLocked) series.Metadata.TagsLocked = false;- if (!updateSeriesMetadataDto.SeriesMetadata.CharacterLocked) series.Metadata.CharacterLocked = false;- if (!updateSeriesMetadataDto.SeriesMetadata.ColoristLocked) series.Metadata.ColoristLocked = false;- if (!updateSeriesMetadataDto.SeriesMetadata.EditorLocked) series.Metadata.EditorLocked = false;- if (!updateSeriesMetadataDto.SeriesMetadata.InkerLocked) series.Metadata.InkerLocked = false;- if (!updateSeriesMetadataDto.SeriesMetadata.LettererLocked) series.Metadata.LettererLocked = false;- if (!updateSeriesMetadataDto.SeriesMetadata.PencillerLocked) series.Metadata.PencillerLocked = false;- if (!updateSeriesMetadataDto.SeriesMetadata.PublisherLocked) series.Metadata.PublisherLocked = false;- if (!updateSeriesMetadataDto.SeriesMetadata.TranslatorLocked) series.Metadata.TranslatorLocked = false;- if (!updateSeriesMetadataDto.SeriesMetadata.CoverArtistLocked) series.Metadata.CoverArtistLocked = false;- if (!updateSeriesMetadataDto.SeriesMetadata.WriterLocked) series.Metadata.WriterLocked = false;- if (!updateSeriesMetadataDto.SeriesMetadata.SummaryLocked) series.Metadata.SummaryLocked = false;--+ series.Metadata.AgeRatingLocked = updateSeriesMetadataDto.SeriesMetadata.AgeRatingLocked;+ series.Metadata.PublicationStatusLocked = updateSeriesMetadataDto.SeriesMetadata.PublicationStatusLocked;+ series.Metadata.LanguageLocked = updateSeriesMetadataDto.SeriesMetadata.LanguageLocked;+ series.Metadata.GenresLocked = updateSeriesMetadataDto.SeriesMetadata.GenresLocked;+ series.Metadata.TagsLocked = updateSeriesMetadataDto.SeriesMetadata.TagsLocked;+ series.Metadata.CharacterLocked = updateSeriesMetadataDto.SeriesMetadata.CharactersLocked;+ series.Metadata.ColoristLocked = updateSeriesMetadataDto.SeriesMetadata.ColoristsLocked;+ series.Metadata.EditorLocked = updateSeriesMetadataDto.SeriesMetadata.EditorsLocked;+ series.Metadata.InkerLocked = updateSeriesMetadataDto.SeriesMetadata.InkersLocked;+ series.Metadata.LettererLocked = updateSeriesMetadataDto.SeriesMetadata.LetterersLocked;+ series.Metadata.PencillerLocked = updateSeriesMetadataDto.SeriesMetadata.PencillersLocked;+ series.Metadata.PublisherLocked = updateSeriesMetadataDto.SeriesMetadata.PublishersLocked;+ series.Metadata.TranslatorLocked = updateSeriesMetadataDto.SeriesMetadata.TranslatorsLocked;+ series.Metadata.CoverArtistLocked = updateSeriesMetadataDto.SeriesMetadata.CoverArtistsLocked;+ series.Metadata.WriterLocked = updateSeriesMetadataDto.SeriesMetadata.WritersLocked;+ series.Metadata.SummaryLocked = updateSeriesMetadataDto.SeriesMetadata.SummaryLocked;if (!_unitOfWork.HasChanges()){@@ -242,7 +254,6 @@ public class SeriesService : ISeriesService// At this point, all tags that aren't in dto have been removed.foreach (var tagTitle in tags.Select(t => t.Title)){- // This should be normalized namevar normalizedTitle = Parser.Parser.Normalize(tagTitle);var existingTag = allTags.SingleOrDefault(t => t.NormalizedTitle == normalizedTitle);if (existingTag != null)@@ -274,23 +285,21 @@ public class SeriesService : ISeriesServicevar isModified = false;// I want a union of these 2 lists. Return only elements that are in both lists, but the list types are differentvar existingTags = series.Metadata.Tags.ToList();- foreach (var existing in existingTags)+ foreach (var existing in existingTags.Where(existing => tags.SingleOrDefault(t => t.Id == existing.Id) == null)){- if (tags.SingleOrDefault(t => t.Id == existing.Id) == null)- {- // Remove tag- series.Metadata.Tags.Remove(existing);- isModified = true;- }+ // 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 existingTag = allTags.SingleOrDefault(t => t.Title == tagTitle);+ var normalizedTitle = Parser.Parser.Normalize(tagTitle);+ var existingTag = allTags.SingleOrDefault(t => t.NormalizedTitle.Equals(normalizedTitle));if (existingTag != null){- if (series.Metadata.Tags.All(t => t.Title != tagTitle))+ if (series.Metadata.Tags.All(t => t.NormalizedTitle != normalizedTitle)){handleAdd(existingTag);@@ -334,7 +343,7 @@ public class SeriesService : ISeriesServicevar existingTag = allTags.SingleOrDefault(t => t.Name == tag.Name && t.Role == tag.Role);if (existingTag != null){- if (series.Metadata.People.All(t => t.Name != tag.Name && t.Role == tag.Role))+ if (series.Metadata.People.Where(t => t.Role == tag.Role).All(t => !t.Name.Equals(tag.Name))){handleAdd(existingTag);isModified = true;@@ -447,7 +456,7 @@ public class SeriesService : ISeriesServicevar libraryType = await _unitOfWork.LibraryRepository.GetLibraryTypeAsync(series.LibraryId);var volumes = (await _unitOfWork.VolumeRepository.GetVolumesDtoAsync(seriesId, userId))- .OrderBy(v => float.Parse(v.Name))+ .OrderBy(v => Parser.Parser.MinNumberFromRange(v.Name)).ToList();var chapters = volumes.SelectMany(v => v.Chapters).ToList();@@ -475,10 +484,10 @@ public class SeriesService : ISeriesServiceforeach (var chapter in chapters){chapter.Title = FormatChapterTitle(chapter, libraryType);- if (chapter.IsSpecial)- {- specials.Add(chapter);- }+ if (!chapter.IsSpecial) continue;++ if (!string.IsNullOrEmpty(chapter.TitleName)) chapter.Title = chapter.TitleName;+ specials.Add(chapter);}diff --git a/API/Services/TaskScheduler.cs b/API/Services/TaskScheduler.csindex d749c20ca..585bec476 100644--- a/API/Services/TaskScheduler.cs+++ b/API/Services/TaskScheduler.cs@@ -36,7 +36,7 @@ public class TaskScheduler : ITaskSchedulerprivate readonly IStatsService _statsService;private readonly IVersionUpdaterService _versionUpdaterService;- private readonly ISiteThemeService _siteThemeService;+ private readonly IThemeService _themeService;public static BackgroundJobServer Client => new BackgroundJobServer();private static readonly Random Rnd = new Random();@@ -45,7 +45,7 @@ public class TaskScheduler : ITaskSchedulerpublic TaskScheduler(ICacheService cacheService, ILogger<TaskScheduler> logger, IScannerService scannerService,IUnitOfWork unitOfWork, IMetadataService metadataService, IBackupService backupService,ICleanupService cleanupService, IStatsService statsService, IVersionUpdaterService versionUpdaterService,- ISiteThemeService siteThemeService)+ IThemeService themeService){_cacheService = cacheService;_logger = logger;@@ -56,7 +56,7 @@ public class TaskScheduler : ITaskScheduler_cleanupService = cleanupService;_statsService = statsService;_versionUpdaterService = versionUpdaterService;- _siteThemeService = siteThemeService;+ _themeService = themeService;}public async Task ScheduleTasks()@@ -131,7 +131,7 @@ public class TaskScheduler : ITaskSchedulerpublic void ScanSiteThemes(){_logger.LogInformation("Starting Site Theme scan");- BackgroundJob.Enqueue(() => _siteThemeService.Scan());+ BackgroundJob.Enqueue(() => _themeService.Scan());}#endregion@@ -149,6 +149,7 @@ public class TaskScheduler : ITaskSchedulerpublic void ScanLibrary(int libraryId){_logger.LogInformation("Enqueuing library scan for: {LibraryId}", libraryId);+ // TODO: If a library scan is already queued up for libraryId, don't do anythingBackgroundJob.Enqueue(() => _scannerService.ScanLibrary(libraryId));// When we do a scan, force cache to re-unpack in case page numbers changeBackgroundJob.Enqueue(() => _cleanupService.CleanupCacheDirectory());diff --git a/API/Services/Tasks/CleanupService.cs b/API/Services/Tasks/CleanupService.csindex ee0af81cb..647c0a066 100644--- a/API/Services/Tasks/CleanupService.cs+++ b/API/Services/Tasks/CleanupService.cs@@ -64,6 +64,7 @@ namespace API.Services.Tasksawait DeleteChapterCoverImages();await SendProgress(0.7F, "Cleaning deleted cover images");await DeleteTagCoverImages();+ await DeleteReadingListCoverImages();await SendProgress(0.8F, "Cleaning deleted cover images");await SendProgress(1F, "Cleanup finished");_logger.LogInformation("Cleanup finished");@@ -116,6 +117,16 @@ namespace API.Services.Tasks_directoryService.DeleteFiles(files.Where(file => !images.Contains(_directoryService.FileSystem.Path.GetFileName(file))));}+ /// <summary>+ /// Removes all reading list images that are not in the database. They must follow <see cref="ImageService.ReadingListCoverImageRegex"/> filename pattern.+ /// </summary>+ public async Task DeleteReadingListCoverImages()+ {+ var images = await _unitOfWork.ReadingListRepository.GetAllCoverImagesAsync();+ var files = _directoryService.GetFiles(_directoryService.CoverImageDirectory, ImageService.ReadingListCoverImageRegex);+ _directoryService.DeleteFiles(files.Where(file => !images.Contains(_directoryService.FileSystem.Path.GetFileName(file))));+ }+/// <summary>/// Removes all files and directories in the cache directory/// </summary>@@ -171,7 +182,7 @@ namespace API.Services.Tasks/// </summary>public Task CleanupBookmarks(){- // This is disabled for now while we test and validate a new method of deleting bookmarks+ // TODO: This is disabled for now while we test and validate a new method of deleting bookmarksreturn Task.CompletedTask;// Search all files in bookmarks/ except bookmark files and delete those// var bookmarkDirectory =diff --git a/API/Services/Tasks/Scanner/ParseScannedFiles.cs b/API/Services/Tasks/Scanner/ParseScannedFiles.csindex ddefd00e3..92c0d6e1d 100644--- a/API/Services/Tasks/Scanner/ParseScannedFiles.cs+++ b/API/Services/Tasks/Scanner/ParseScannedFiles.cs@@ -109,7 +109,7 @@ namespace API.Services.Tasks.Scanner}if (!string.IsNullOrEmpty(info.ComicInfo.Series)){- info.Series = info.ComicInfo.Series;+ info.Series = info.ComicInfo.Series.Trim();}if (!string.IsNullOrEmpty(info.ComicInfo.Number)){@@ -119,16 +119,28 @@ namespace API.Services.Tasks.Scanner// Patch is SeriesSort from ComicInfoif (!string.IsNullOrEmpty(info.ComicInfo.TitleSort)){- info.SeriesSort = info.ComicInfo.TitleSort;+ info.SeriesSort = info.ComicInfo.TitleSort.Trim();}if (!string.IsNullOrEmpty(info.ComicInfo.SeriesSort)){- info.SeriesSort = info.ComicInfo.SeriesSort;+ info.SeriesSort = info.ComicInfo.SeriesSort.Trim();+ }++ if (!string.IsNullOrEmpty(info.ComicInfo.LocalizedSeries))+ {+ info.LocalizedSeries = info.ComicInfo.LocalizedSeries.Trim();}}- TrackSeries(info);+ try+ {+ TrackSeries(info);+ }+ catch (Exception ex)+ {+ _logger.LogError(ex, "There was an exception that occurred during tracking {FilePath}. Skipping this file", info.FullFilePath);+ }}@@ -144,13 +156,16 @@ namespace API.Services.Tasks.Scanner// Check if normalized info.Series already exists and if so, update info to use that name insteadinfo.Series = MergeName(info);+ var normalizedSeries = Parser.Parser.Normalize(info.Series);+ var normalizedLocalizedSeries = Parser.Parser.Normalize(info.LocalizedSeries);var existingKey = _scannedSeries.Keys.FirstOrDefault(ps =>- ps.Format == info.Format && ps.NormalizedName == Parser.Parser.Normalize(info.Series));+ ps.Format == info.Format && (ps.NormalizedName == normalizedSeries+ || ps.NormalizedName == normalizedLocalizedSeries));existingKey ??= new ParsedSeries(){Format = info.Format,Name = info.Series,- NormalizedName = Parser.Parser.Normalize(info.Series)+ NormalizedName = normalizedSeries};_scannedSeries.AddOrUpdate(existingKey, new List<ParserInfo>() {info}, (_, oldValue) =>@@ -174,8 +189,12 @@ namespace API.Services.Tasks.Scannerpublic string MergeName(ParserInfo info){var normalizedSeries = Parser.Parser.Normalize(info.Series);+ var normalizedLocalSeries = Parser.Parser.Normalize(info.LocalizedSeries);+ // We use FirstOrDefault because this was introduced late in development and users might have 2 series with both namesvar existingName =- _scannedSeries.SingleOrDefault(p => Parser.Parser.Normalize(p.Key.NormalizedName) == normalizedSeries && p.Key.Format == info.Format)+ _scannedSeries.FirstOrDefault(p =>+ (Parser.Parser.Normalize(p.Key.NormalizedName) == normalizedSeries ||+ Parser.Parser.Normalize(p.Key.NormalizedName) == normalizedLocalSeries) && p.Key.Format == info.Format).Key;if (existingName != null && !string.IsNullOrEmpty(existingName.Name)){diff --git a/API/Services/Tasks/ScannerService.cs b/API/Services/Tasks/ScannerService.csindex 85f01aa09..4bd37d009 100644--- a/API/Services/Tasks/ScannerService.cs+++ b/API/Services/Tasks/ScannerService.cs@@ -124,7 +124,9 @@ public class ScannerService : IScannerServicevar path = Directory.GetParent(existingFolder)?.FullName;if (!folderPaths.Contains(path) || !folderPaths.Any(p => p.Contains(path ?? string.Empty))){- _logger.LogInformation("[ScanService] Aborted: {SeriesName} has bad naming convention and sits at root of library. Cannot scan series without deletion occuring. Correct file names to have Series Name within it or perform Scan Library", series.OriginalName);+ _logger.LogCritical("[ScanService] Aborted: {SeriesName} has bad naming convention and sits at root of library. Cannot scan series without deletion occuring. Correct file names to have Series Name within it or perform Scan Library", series.OriginalName);+ await _eventHub.SendMessageAsync(MessageFactory.Error,+ MessageFactory.ErrorEvent($"Scan of {series.Name} aborted", $"{series.OriginalName} has bad naming convention and sits at root of library. Cannot scan series without deletion occuring. Correct file names to have Series Name within it or perform Scan Library"));return;}if (!string.IsNullOrEmpty(path))@@ -195,7 +197,7 @@ public class ScannerService : IScannerService// Check if any of the folder roots are not available (ie disconnected from network, etc) and fail if any of them areif (folders.Any(f => !_directoryService.IsDriveMounted(f))){- _logger.LogError("Some of the root folders for library ({LibraryName} are not accessible. Please check that drives are connected and rescan. Scan will be aborted", libraryName);+ _logger.LogCritical("Some of the root folders for library ({LibraryName} are not accessible. Please check that drives are connected and rescan. Scan will be aborted", libraryName);await _eventHub.SendMessageAsync(MessageFactory.Error,MessageFactory.ErrorEvent("Some of the root folders for library are not accessible. Please check that drives are connected and rescan. Scan will be aborted",@@ -213,12 +215,12 @@ public class ScannerService : IScannerService// That way logging and UI informing is all in one place with full context_logger.LogError("Some of the root folders for the library are empty. " +"Either your mount has been disconnected or you are trying to delete all series in the library. " +- "Scan will be aborted. " ++ "Scan has be aborted. " +"Check that your mount is connected or change the library's root folder and rescan");await _eventHub.SendMessageAsync(MessageFactory.Error, MessageFactory.ErrorEvent( $"Some of the root folders for the library, {libraryName}, are empty.","Either your mount has been disconnected or you are trying to delete all series in the library. " +- "Scan will be aborted. " ++ "Scan has be aborted. " +"Check that your mount is connected or change the library's root folder and rescan"));return false;@@ -267,18 +269,14 @@ public class ScannerService : IScannerServiceif (!await CheckMounts(library.Name, library.Folders.Select(f => f.Path).ToList())){_logger.LogCritical("Some of the root folders for library are not accessible. Please check that drives are connected and rescan. Scan will be aborted");+return;}_logger.LogInformation("[ScannerService] Beginning file scan on {LibraryName}", library.Name);- // await _eventHub.SendMessageAsync(SignalREvents.NotificationProgress,- // MessageFactory.ScanLibraryProgressEvent(libraryId, 0F));-var (totalFiles, scanElapsedTime, series) = await ScanFiles(library, library.Folders.Select(fp => fp.Path));- // var scanner = new ParseScannedFiles(_logger, _directoryService, _readingItemService);- // var series = scanner.ScanLibrariesForSeries(library.Type, library.Folders.Select(fp => fp.Path), out var totalFiles, out var scanElapsedTime);_logger.LogInformation("[ScannerService] Finished file scan. Updating database");foreach (var folderPath in library.Folders)@@ -307,6 +305,7 @@ public class ScannerService : IScannerService// await _eventHub.SendMessageAsync(SignalREvents.NotificationProgress,// MessageFactory.ScanLibraryProgressEvent(libraryId, 1F));+BackgroundJob.Enqueue(() => _metadataService.RefreshMetadata(libraryId, false));}@@ -464,10 +463,14 @@ public class ScannerService : IScannerServiceif (existingSeries != null) continue;var s = DbFactory.Series(infos[0].Series);- if (!string.IsNullOrEmpty(infos[0].SeriesSort))+ if (!s.SortNameLocked && !string.IsNullOrEmpty(infos[0].SeriesSort)){s.SortName = infos[0].SeriesSort;}+ if (!s.LocalizedNameLocked && !string.IsNullOrEmpty(infos[0].LocalizedSeries))+ {+ s.LocalizedName = infos[0].LocalizedSeries;+ }s.Format = key.Format;s.LibraryId = library.Id; // We have to manually set this since we aren't adding the series to the Library's series.newSeries.Add(s);@@ -536,6 +539,13 @@ public class ScannerService : IScannerService}}+ // parsedInfos[0] is not the first volume or chapter. We need to find it+ var localizedSeries = parsedInfos.Select(p => p.LocalizedSeries).FirstOrDefault(p => !string.IsNullOrEmpty(p));+ if (!series.LocalizedNameLocked && !string.IsNullOrEmpty(localizedSeries))+ {+ series.LocalizedName = localizedSeries;+ }+await _eventHub.SendMessageAsync(MessageFactory.NotificationProgress, MessageFactory.LibraryScanProgressEvent(library.Name, ProgressEventType.Ended, series.Name));UpdateSeriesMetadata(series, allPeople, allGenres, allTags, library.Type);@@ -564,8 +574,7 @@ public class ScannerService : IScannerServiceprivate static void UpdateSeriesMetadata(Series series, ICollection<Person> allPeople, ICollection<Genre> allGenres, ICollection<Tag> allTags, LibraryType libraryType){var isBook = libraryType == LibraryType.Book;- var firstVolume = series.Volumes.OrderBy(c => c.Number, new ChapterSortComparer()).FirstWithChapters(isBook);- var firstChapter = firstVolume?.Chapters.GetFirstChapterWithFiles();+ var firstChapter = SeriesService.GetFirstChapterForMetadata(series, isBook);var firstFile = firstChapter?.Files.FirstOrDefault();if (firstFile == null) return;@@ -585,14 +594,27 @@ public class ScannerService : IScannerService// Set the AgeRating as highest in all the comicInfosif (!series.Metadata.AgeRatingLocked) series.Metadata.AgeRating = chapters.Max(chapter => chapter.AgeRating);+ series.Metadata.TotalCount = chapters.Max(chapter => chapter.TotalCount);+ 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)+ {+ var maxVolume = series.Volumes.Max(v => (int) Parser.Parser.MaxNumberFromRange(v.Name));+ var maxChapter = chapters.Max(c => (int) Parser.Parser.MaxNumberFromRange(c.Range));+ if (maxVolume == series.Metadata.TotalCount) series.Metadata.MaxCount = maxVolume;+ else if (maxChapter == series.Metadata.TotalCount) series.Metadata.MaxCount = maxChapter;+ }+- series.Metadata.Count = chapters.Max(chapter => chapter.TotalCount);if (!series.Metadata.PublicationStatusLocked){series.Metadata.PublicationStatus = PublicationStatus.OnGoing;- if (chapters.Max(chapter => chapter.Count) >= series.Metadata.Count && series.Metadata.Count > 0)+ 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)+ {+ series.Metadata.PublicationStatus = PublicationStatus.Ended;}}@@ -695,9 +717,50 @@ public class ScannerService : IScannerService}}+ // 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();PersonHelper.KeepOnlySamePeopleBetweenLists(series.Metadata.People,- people, person => series.Metadata.People.Remove(person));+ people, person =>+ {+ switch (person.Role)+ {+ case PersonRole.Writer:+ if (!series.Metadata.WriterLocked) series.Metadata.People.Remove(person);+ break;+ case PersonRole.Penciller:+ if (!series.Metadata.PencillerLocked) series.Metadata.People.Remove(person);+ break;+ case PersonRole.Inker:+ if (!series.Metadata.InkerLocked) series.Metadata.People.Remove(person);+ break;+ case PersonRole.Colorist:+ if (!series.Metadata.ColoristLocked) series.Metadata.People.Remove(person);+ break;+ case PersonRole.Letterer:+ if (!series.Metadata.LettererLocked) series.Metadata.People.Remove(person);+ break;+ case PersonRole.CoverArtist:+ if (!series.Metadata.CoverArtistLocked) series.Metadata.People.Remove(person);+ break;+ case PersonRole.Editor:+ if (!series.Metadata.EditorLocked) series.Metadata.People.Remove(person);+ break;+ case PersonRole.Publisher:+ if (!series.Metadata.PublisherLocked) series.Metadata.People.Remove(person);+ break;+ case PersonRole.Character:+ if (!series.Metadata.CharacterLocked) series.Metadata.People.Remove(person);+ break;+ case PersonRole.Translator:+ if (!series.Metadata.TranslatorLocked) series.Metadata.People.Remove(person);+ break;+ case PersonRole.Other:+ default:+ series.Metadata.People.Remove(person);+ break;+ }+ });}@@ -720,7 +783,7 @@ public class ScannerService : IScannerService_logger.LogDebug("[ScannerService] Parsing {SeriesName} - Volume {VolumeNumber}", series.Name, volume.Name);var infos = parsedInfos.Where(p => p.Volumes == volumeNumber).ToArray();- UpdateChapters(volume, infos);+ UpdateChapters(series, volume, infos);volume.Pages = volume.Chapters.Sum(c => c.Pages);// Update all the metadata on the Chapters@@ -767,7 +830,7 @@ public class ScannerService : IScannerServiceseries.Name, startingVolumeCount, series.Volumes.Count);}- private void UpdateChapters(Volume volume, IList<ParserInfo> parsedInfos)+ private void UpdateChapters(Series series, Volume volume, IList<ParserInfo> parsedInfos){// Add new chaptersforeach (var info in parsedInfos)@@ -789,32 +852,20 @@ public class ScannerService : IScannerService{_logger.LogDebug("[ScannerService] Adding new chapter, {Series} - Vol {Volume} Ch {Chapter}", info.Series, info.Volumes, info.Chapters);- volume.Chapters.Add(DbFactory.Chapter(info));+ chapter = DbFactory.Chapter(info);+ volume.Chapters.Add(chapter);+ series.LastChapterAdded = DateTime.Now;}else{chapter.UpdateFrom(info);}- }-- // Add files- foreach (var info in parsedInfos)- {- var specialTreatment = info.IsSpecialInfo();- Chapter chapter;- try- {- chapter = volume.Chapters.GetChapterByRange(info);- }- catch (Exception ex)- {- _logger.LogError(ex, "There was an exception parsing chapter. Skipping {SeriesName} Vol {VolumeNumber} Chapter {ChapterNumber} - Special treatment: {NeedsSpecialTreatment}", info.Series, volume.Name, info.Chapters, specialTreatment);- continue;- }if (chapter == null) continue;+ // Add files+ var specialTreatment = info.IsSpecialInfo();AddOrUpdateFileForChapter(chapter, info);- chapter.Number = Parser.Parser.MinimumNumberFromRange(info.Chapters) + string.Empty;+ chapter.Number = Parser.Parser.MinNumberFromRange(info.Chapters) + string.Empty;chapter.Range = specialTreatment ? info.Filename : info.Chapters;}@@ -861,7 +912,7 @@ public class ScannerService : IScannerServiceprivate void UpdateChapterFromComicInfo(Chapter chapter, ICollection<Person> allPeople, ICollection<Tag> allTags, ICollection<Genre> allGenres, ComicInfo? info){- var firstFile = chapter.Files.OrderBy(x => x.Chapter).FirstOrDefault();+ var firstFile = chapter.Files.MinBy(x => x.Chapter);if (firstFile == null ||_cacheHelper.HasFileNotChangedSinceCreationOrLastScan(chapter, false, firstFile)) return;@@ -895,10 +946,16 @@ public class ScannerService : IScannerServicechapter.TotalCount = comicInfo.Count;}+ // This needs to check against both Number and Volume to calculate Countif (!string.IsNullOrEmpty(comicInfo.Number) && float.Parse(comicInfo.Number) > 0){chapter.Count = (int) Math.Floor(float.Parse(comicInfo.Number));}+ if (!string.IsNullOrEmpty(comicInfo.Volume) && float.Parse(comicInfo.Volume) > 0)+ {+ chapter.Count = Math.Max(chapter.Count, (int) Math.Floor(float.Parse(comicInfo.Volume)));+ }+diff --git a/API/Services/Tasks/SiteThemeService.cs b/API/Services/Tasks/SiteThemeService.csindex e0e1bc2d8..553730d3a 100644--- a/API/Services/Tasks/SiteThemeService.cs+++ b/API/Services/Tasks/SiteThemeService.cs@@ -1,5 +1,4 @@using System;-using System.Collections.Generic;using System.Linq;using System.Threading.Tasks;using API.Data;@@ -7,24 +6,23 @@ using API.Entities;using API.Entities.Enums.Theme;using API.SignalR;using Kavita.Common;-using Microsoft.AspNetCore.SignalR;namespace API.Services.Tasks;-public interface ISiteThemeService+public interface IThemeService{Task<string> GetContent(int themeId);Task Scan();Task UpdateDefault(int themeId);}-public class SiteThemeService : ISiteThemeService+public class ThemeService : IThemeService{private readonly IDirectoryService _directoryService;private readonly IUnitOfWork _unitOfWork;private readonly IEventHub _eventHub;- public SiteThemeService(IDirectoryService directoryService, IUnitOfWork unitOfWork, IEventHub eventHub)+ public ThemeService(IDirectoryService directoryService, IUnitOfWork unitOfWork, IEventHub eventHub){_directoryService = directoryService;_unitOfWork = unitOfWork;@@ -36,7 +34,6 @@ public class SiteThemeService : ISiteThemeService/// </summary>/// <param name="themeId"></param>/// <returns></returns>- /// <exception cref="KavitaException"></exception>public async Task<string> GetContent(int themeId){var theme = await _unitOfWork.SiteThemeRepository.GetThemeDto(themeId);@@ -55,7 +52,8 @@ public class SiteThemeService : ISiteThemeService{_directoryService.ExistOrCreate(_directoryService.SiteThemeDirectory);var reservedNames = Seed.DefaultThemes.Select(t => t.NormalizedName).ToList();- var themeFiles = _directoryService.GetFilesWithExtension(Parser.Parser.NormalizePath(_directoryService.SiteThemeDirectory), @"\.css")+ var themeFiles = _directoryService+ .GetFilesWithExtension(Parser.Parser.NormalizePath(_directoryService.SiteThemeDirectory), @"\.css").Where(name => !reservedNames.Contains(Parser.Parser.Normalize(name))).ToList();var allThemes = (await _unitOfWork.SiteThemeRepository.GetThemes()).ToList();@@ -91,7 +89,8 @@ public class SiteThemeService : ISiteThemeService});await _eventHub.SendMessageAsync(MessageFactory.NotificationProgress,- MessageFactory.SiteThemeProgressEvent(_directoryService.FileSystem.Path.GetFileName(themeFile), themeName, ProgressEventType.Updated));+ MessageFactory.SiteThemeProgressEvent(_directoryService.FileSystem.Path.GetFileName(themeFile), themeName,+ ProgressEventType.Updated));}@@ -116,10 +115,10 @@ public class SiteThemeService : ISiteThemeService}await _eventHub.SendMessageAsync(MessageFactory.NotificationProgress,- MessageFactory.SiteThemeProgressEvent("", "", ProgressEventType.Ended));-+ MessageFactory.SiteThemeProgressEvent("", "", ProgressEventType.Ended));}+/// <summary>/// Removes the theme and any references to it from Pref and sets them to the default at the time./// This commits to DB.diff --git a/API/SignalR/MessageFactory.cs b/API/SignalR/MessageFactory.csindex 53833e3f3..be3ab0acf 100644--- a/API/SignalR/MessageFactory.cs+++ b/API/SignalR/MessageFactory.cs@@ -7,6 +7,14 @@ using API.Entities;namespace API.SignalR{+ public static class MessageFactoryEntityTypes+ {+ public const string Series = "series";+ public const string Volume = "volume";+ public const string Chapter = "chapter";+ public const string CollectionTag = "collection";+ public const string ReadingList = "readingList";+ }public static class MessageFactory{/// <summary>@@ -58,6 +66,10 @@ namespace API.SignalR/// </summary>private const string SiteThemeProgress = "SiteThemeProgress";/// <summary>+ /// A custom book theme was removed or added+ /// </summary>+ private const string BookThemeProgress = "BookThemeProgress";+ /// <summary>/// A type of event that has progress (determinate or indeterminate)./// The underlying event will have a name to give details on how to handle./// </summary>@@ -78,6 +90,11 @@ namespace API.SignalR/// When a library is created/deleted in the Server/// </summary>public const string LibraryModified = "LibraryModified";+ /// <summary>+ /// A user's progress was modified+ /// </summary>+ public const string UserProgressUpdate = "UserProgressUpdate";+public static SignalRMessage ScanSeriesEvent(int libraryId, int seriesId, string seriesName)@@ -320,6 +337,25 @@ namespace API.SignalR};}+ public static SignalRMessage UserProgressUpdateEvent(int userId, string username, int seriesId, int volumeId, int chapterId, int pagesRead)+ {+ return new SignalRMessage()+ {+ Name = UserProgressUpdate,+ Title = "Updating User Progress",+ Progress = ProgressType.None,+ Body = new+ {+ UserId = userId,+ Username = username,+ SeriesId = seriesId,+ VolumeId = volumeId,+ ChapterId = chapterId,+ PagesRead = pagesRead,+ }+ };+ }+public static SignalRMessage SiteThemeProgressEvent(string subtitle, string themeName, string eventType){return new SignalRMessage()@@ -335,5 +371,21 @@ namespace API.SignalR}};}++ public static SignalRMessage BookThemeProgressEvent(string subtitle, string themeName, string eventType)+ {+ return new SignalRMessage()+ {+ Name = BookThemeProgress,+ Title = "Scanning Book Theme",+ SubTitle = subtitle,+ EventType = eventType,+ Progress = ProgressType.Indeterminate,+ Body = new+ {+ ThemeName = themeName,+ }+ };+ }}}diff --git a/API/Startup.cs b/API/Startup.csindex e1dd28a81..66f704489 100644--- a/API/Startup.cs+++ b/API/Startup.cs@@ -147,6 +147,7 @@ namespace API// Apply all migrations on startupvar logger = serviceProvider.GetRequiredService<ILogger<Program>>();var userManager = serviceProvider.GetRequiredService<UserManager<AppUser>>();+ var themeService = serviceProvider.GetRequiredService<IThemeService>();await MigrateBookmarks.Migrate(directoryService, unitOfWork,logger, cacheService);@@ -154,6 +155,8 @@ namespace API// Only run this if we are upgradingawait MigrateChangePasswordRoles.Migrate(unitOfWork, userManager);+ await MigrateRemoveExtraThemes.Migrate(unitOfWork, themeService);+// Update the version in the DB after all migrations are runvar installVersion = await unitOfWork.SettingsRepository.GetSettingAsync(ServerSettingKey.InstallVersion);installVersion.Value = BuildInfo.Version.ToString();diff --git a/API/config/kavita.db.dik b/API/config/kavita.db.dikdeleted file mode 100644index 4d71b8263..000000000Binary files a/API/config/kavita.db.dik and /dev/null differdiff --git a/API/config/kavita.db.new b/API/config/kavita.db.newdeleted file mode 100644index 774d54743..000000000Binary files a/API/config/kavita.db.new and /dev/null differdiff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex 5b0417947..7e1fae0be 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -54,4 +54,10 @@ Setup guides, FAQ, the more information we have on the [wiki](https://wiki.kavit- feature/parser-enhancements (Great)- bugfix/book-issues (Great)+### Swagger API ###+If you just want to play with Swagger, you can just+- cd Kavita/API+- dotnet run -c Debug+- Go to http://localhost:5000/swagger/index.html+If you have any questions about any of this, please let us know.diff --git a/Dockerfile b/Dockerfileindex 11db76ef8..7233214f6 100644--- a/Dockerfile+++ b/Dockerfile@@ -29,7 +29,7 @@ EXPOSE 5000WORKDIR /kavita-HEALTHCHECK --interval=300s --timeout=15s --start-period=30s --retries=3 CMD curl --fail http://localhost:5000 || exit 1+HEALTHCHECK --interval=30s --timeout=15s --start-period=30s --retries=3 CMD curl --fail http://localhost:5000 || exit 1ENTRYPOINT [ "/bin/bash" ]CMD ["/entrypoint.sh"]diff --git a/Kavita.Common/Kavita.Common.csproj b/Kavita.Common/Kavita.Common.csprojindex 8ceb83869..e838ff780 100644--- a/Kavita.Common/Kavita.Common.csproj+++ b/Kavita.Common/Kavita.Common.csproj@@ -4,19 +4,19 @@<TargetFramework>net6.0</TargetFramework><Company>kavitareader.com</Company><Product>Kavita</Product>- <AssemblyVersion>0.5.2.5</AssemblyVersion>+ <AssemblyVersion>0.5.3.0</AssemblyVersion><NeutralLanguage>en</NeutralLanguage></PropertyGroup><ItemGroup>- <PackageReference Include="Flurl.Http" Version="3.2.2" />+ <PackageReference Include="Flurl.Http" Version="3.2.3" /><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.37.0.45539">+ <PackageReference Include="SonarAnalyzer.CSharp" Version="8.38.0.46746"><PrivateAssets>all</PrivateAssets><IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets></PackageReference></ItemGroup>-</Project>\ No newline at end of file+</Project>diff --git a/README.md b/README.mdindex abc2ee070..e4f47b795 100644--- a/README.md+++ b/README.md@@ -1,10 +1,10 @@# [<img src="/Logo/kavita.svg" width="32" alt="">]() Kavita<div align="center">-!+-Kavita is a fast, feature rich, cross platform reading server. Built with a focus for manga,-and the goal of being a full solution for all your reading needs. Setup your own server and share+Kavita is a fast, feature rich, cross platform reading server. Built with a focus for manga,+and the goal of being a full solution for all your reading needs. Setup your own server and shareyour reading collection with your friends and family](https://github.com/Kareadita/Kavita/releases)@@ -20,7 +20,7 @@ your reading collection with your friends and family!## Goals- [x] Serve up Manga/Webtoons/Comics (cbr, cbz, zip/rar, 7zip, raw images) and Books (epub, pdf)- [x] First class responsive readers that work great on any device (phone, tablet, desktop)-- [x] Dark and Light themes+- [x] Dark mode and customizable theming support- [ ] Provide hooks into metadata providers to fetch metadata for Comics, Manga, and Books- [x] Metadata should allow for collections, want to read integration from 3rd party services, genres.- [x] Ability to manage users, access, and ratings@@ -43,47 +43,19 @@ Password: Demouser64```## Setup-### Non-Docker-- Unzip the archive for your target OS-- Place in a directory that is writable. If on windows, do not place in Program Files-- Linux users must ensure the directory & kavita.db is writable by Kavita (might require starting server once)-- Run Kavita-- If you are updating, copy everything over into install location. All Kavita data is stored in config/, so nothing will be overwritten.-- Open localhost:5000 and setup your account and libraries in the UI.-### Docker-Running your Kavita server in docker is super easy! Barely an inconvenience. You can run it with this command:--```-docker run --name kavita -p 5000:5000 \--v /your/manga/directory:/manga \--v /kavita/data/directory:/kavita/config \---restart unless-stopped \--d kizaing/kavita:latest-```--You can also run it via the docker-compose file:--```-version: '3'-services:- kavita:- image: kizaing/kavita:latest- container_name: kavita- volumes:- - ./manga:/manga- - ./config:/kavita/config- ports:- - "5000:5000"- restart: unless-stopped-```+The easiest way to get started is to visit our Wiki which has up-to-date information on a variety of+install methods and platforms.+[https://wiki.kavitareader.com/en/install](https://wiki.kavitareader.com/en/install)**Note: Kavita is under heavy development and is being updated all the time, so the tag for current builds is `:nightly`. The `:latest` tag will be the latest stable release.**## Feature Requests-Got a great idea? Throw it up on our [Feature Request site](https://feats.kavitareader.com/) or vote on another idea. Please check the [Project Board](https://github.com/Kareadita/Kavita/projects) first for a list of planned features.+Got a great idea? Throw it up on our [Feature Request site](https://feats.kavitareader.com/) or vote on another idea. Please check the [Project Board](https://github.com/Kareadita/Kavita/projects) first for a list of planned features before you submit an idea.## Notice-Kavita is being actively developed and should be considered beta software until the 1.0 release. Kavita may be subject to changes in how the platform functions as it is being built out toward the vision. You may lose data and have to restart. The Kavita team strives to avoid any data loss.+Kavita is being actively developed and should be considered beta software until the 1.0 release.+Kavita may be subject to changes in how the platform functions as it is being built out toward the+vision. You may lose data and have to restart. The Kavita team strives to avoid any data loss.## Contributors@@ -94,7 +66,7 @@ This project exists thanks to all the people who contribute. [Contribute](CONTRI## Donate-If you like Kavita, have gotten good use out of it or feel like you want to say thanks with a few bucks, feel free to donate. Money will go towards+If you like Kavita, have gotten good use out of it, or feel like you want to say thanks with a few bucks, feel free to donate. Money will go towardsexpenses related to Kavita. Back us through [OpenCollective](https://opencollective.com/Kavita#backer). You can also use [Paypal](https://www.paypal.com/paypalme/majora2007?locale.x=en_US), however your name will not show below.## Backers@@ -119,7 +91,7 @@ Thank you to [<img src="/Logo/jetbrains.svg" alt="" width="32"> JetBrains](http:* [<img src="/Logo/dottrace.svg" alt="" width="32"> dotTrace](http://www.jetbrains.com/dottrace/)## Palace-Designs-We would like to extend a big thank you to [<img src="/Logo/hosting-sponsor.png" alt="" width="128">](https://www.palace-designs.com/) who hosts our infrastructure pro-bono.+We would like to extend a big thank you to [<img src="/Logo/hosting-sponsor.png" alt="" width="128">](https://www.palace-designs.com/) who hosts our infrastructure pro-bono.### Licensediff --git a/UI/Web/.github/workflows/playwright.yml b/UI/Web/.github/workflows/playwright.ymlnew file mode 100644index 000000000..4d7b32a27--- /dev/null+++ b/UI/Web/.github/workflows/playwright.yml@@ -0,0 +1,27 @@+name: Playwright Tests+on:+ push:+ branches: [ main, master ]+ pull_request:+ branches: [ main, master ]+jobs:+ test:+ timeout-minutes: 60+ runs-on: ubuntu-latest+ steps:+ - uses: actions/checkout@v2+ - uses: actions/setup-node@v2+ with:+ node-version: '14.x'+ - name: Install dependencies+ run: npm ci+ - name: Install Playwright+ run: npx playwright install --with-deps+ - name: Run Playwright tests+ run: npx playwright test+ - uses: actions/upload-artifact@v2+ if: always()+ with:+ name: playwright-report+ path: playwright-report/+ retention-days: 30diff --git a/UI/Web/.gitignore b/UI/Web/.gitignorenew file mode 100644index 000000000..dbd64df83--- /dev/null+++ b/UI/Web/.gitignore@@ -0,0 +1,3 @@+node_modules/+test-results/+playwright-report/diff --git a/UI/Web/README.md b/UI/Web/README.mdindex 083807057..3e2904700 100644--- a/UI/Web/README.md+++ b/UI/Web/README.md@@ -20,7 +20,9 @@ Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.## Running end-to-end tests-Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).+~~Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).~~++Run `npx playwright test --reporter=line` or `npx playwright test` to run e2e tests.## Further helpdiff --git a/UI/Web/adminStorageState.json b/UI/Web/adminStorageState.jsonnew file mode 100644index 000000000..f4ec35503--- /dev/null+++ b/UI/Web/adminStorageState.json@@ -0,0 +1,4 @@+{+ "cookies": [],+ "origins": []+}\ No newline at end of filediff --git a/UI/Web/e2e/example.spec.ts.txt b/UI/Web/e2e/example.spec.ts.txtnew file mode 100644index 000000000..0e4037d83--- /dev/null+++ b/UI/Web/e2e/example.spec.ts.txt@@ -0,0 +1,398 @@+// import { test, expect, Page } from '@playwright/test';++// test.beforeEach(async ({ page }) => {+// await page.goto('https://demo.playwright.dev/todomvc');+// });++// const TODO_ITEMS = [+// 'buy some cheese',+// 'feed the cat',+// 'book a doctors appointment'+// ];++// test.describe('New Todo', () => {+// test('should allow me to add todo items', async ({ page }) => {+// // Create 1st todo.+// await page.locator('.new-todo').fill(TODO_ITEMS[0]);+// await page.locator('.new-todo').press('Enter');++// // Make sure the list only has one todo item.+// await expect(page.locator('.view label')).toHaveText([+// TODO_ITEMS[0]+// ]);++// // Create 2nd todo.+// await page.locator('.new-todo').fill(TODO_ITEMS[1]);+// await page.locator('.new-todo').press('Enter');++// // Make sure the list now has two todo items.+// await expect(page.locator('.view label')).toHaveText([+// TODO_ITEMS[0],+// TODO_ITEMS[1]+// ]);++// await checkNumberOfTodosInLocalStorage(page, 2);+// });++// test('should clear text input field when an item is added', async ({ page }) => {+// // Create one todo item.+// await page.locator('.new-todo').fill(TODO_ITEMS[0]);+// await page.locator('.new-todo').press('Enter');++// // Check that input is empty.+// await expect(page.locator('.new-todo')).toBeEmpty();+// await checkNumberOfTodosInLocalStorage(page, 1);+// });++// test('should append new items to the bottom of the list', async ({ page }) => {+// // Create 3 items.+// await createDefaultTodos(page);++// // Check test using different methods.+// await expect(page.locator('.todo-count')).toHaveText('3 items left');+// await expect(page.locator('.todo-count')).toContainText('3');+// await expect(page.locator('.todo-count')).toHaveText(/3/);++// // Check all items in one call.+// await expect(page.locator('.view label')).toHaveText(TODO_ITEMS);+// await checkNumberOfTodosInLocalStorage(page, 3);+// });++// test('should show #main and #footer when items added', async ({ page }) => {+// await page.locator('.new-todo').fill(TODO_ITEMS[0]);+// await page.locator('.new-todo').press('Enter');++// await expect(page.locator('.main')).toBeVisible();+// await expect(page.locator('.footer')).toBeVisible();+// await checkNumberOfTodosInLocalStorage(page, 1);+// });+// });++// test.describe('Mark all as completed', () => {+// test.beforeEach(async ({ page }) => {+// await createDefaultTodos(page);+// await checkNumberOfTodosInLocalStorage(page, 3);+// });++// test.afterEach(async ({ page }) => {+// await checkNumberOfTodosInLocalStorage(page, 3);+// });++// test('should allow me to mark all items as completed', async ({ page }) => {+// // Complete all todos.+// await page.locator('.toggle-all').check();++// // Ensure all todos have 'completed' class.+// await expect(page.locator('.todo-list li')).toHaveClass(['completed', 'completed', 'completed']);+// await checkNumberOfCompletedTodosInLocalStorage(page, 3);+// });++// test('should allow me to clear the complete state of all items', async ({ page }) => {+// // Check and then immediately uncheck.+// await page.locator('.toggle-all').check();+// await page.locator('.toggle-all').uncheck();++// // Should be no completed classes.+// await expect(page.locator('.todo-list li')).toHaveClass(['', '', '']);+// });++// test('complete all checkbox should update state when items are completed / cleared', async ({ page }) => {+// const toggleAll = page.locator('.toggle-all');+// await toggleAll.check();+// await expect(toggleAll).toBeChecked();+// await checkNumberOfCompletedTodosInLocalStorage(page, 3);++// // Uncheck first todo.+// const firstTodo = page.locator('.todo-list li').nth(0);+// await firstTodo.locator('.toggle').uncheck();++// // Reuse toggleAll locator and make sure its not checked.+// await expect(toggleAll).not.toBeChecked();++// await firstTodo.locator('.toggle').check();+// await checkNumberOfCompletedTodosInLocalStorage(page, 3);++// // Assert the toggle all is checked again.+// await expect(toggleAll).toBeChecked();+// });+// });++// test.describe('Item', () => {++// test('should allow me to mark items as complete', async ({ page }) => {+// // Create two items.+// for (const item of TODO_ITEMS.slice(0, 2)) {+// await page.locator('.new-todo').fill(item);+// await page.locator('.new-todo').press('Enter');+// }++// // Check first item.+// const firstTodo = page.locator('.todo-list li').nth(0);+// await firstTodo.locator('.toggle').check();+// await expect(firstTodo).toHaveClass('completed');++// // Check second item.+// const secondTodo = page.locator('.todo-list li').nth(1);+// await expect(secondTodo).not.toHaveClass('completed');+// await secondTodo.locator('.toggle').check();++// // Assert completed class.+// await expect(firstTodo).toHaveClass('completed');+// await expect(secondTodo).toHaveClass('completed');+// });++// test('should allow me to un-mark items as complete', async ({ page }) => {+// // Create two items.+// for (const item of TODO_ITEMS.slice(0, 2)) {+// await page.locator('.new-todo').fill(item);+// await page.locator('.new-todo').press('Enter');+// }++// const firstTodo = page.locator('.todo-list li').nth(0);+// const secondTodo = page.locator('.todo-list li').nth(1);+// await firstTodo.locator('.toggle').check();+// await expect(firstTodo).toHaveClass('completed');+// await expect(secondTodo).not.toHaveClass('completed');+// await checkNumberOfCompletedTodosInLocalStorage(page, 1);++// await firstTodo.locator('.toggle').uncheck();+// await expect(firstTodo).not.toHaveClass('completed');+// await expect(secondTodo).not.toHaveClass('completed');+// await checkNumberOfCompletedTodosInLocalStorage(page, 0);+// });++// test('should allow me to edit an item', async ({ page }) => {+// await createDefaultTodos(page);++// const todoItems = page.locator('.todo-list li');+// const secondTodo = todoItems.nth(1);+// await secondTodo.dblclick();+// await expect(secondTodo.locator('.edit')).toHaveValue(TODO_ITEMS[1]);+// await secondTodo.locator('.edit').fill('buy some sausages');+// await secondTodo.locator('.edit').press('Enter');++// // Explicitly assert the new text value.+// await expect(todoItems).toHaveText([+// TODO_ITEMS[0],+// 'buy some sausages',+// TODO_ITEMS[2]+// ]);+// await checkTodosInLocalStorage(page, 'buy some sausages');+// });+// });++// test.describe('Editing', () => {+// test.beforeEach(async ({ page }) => {+// await createDefaultTodos(page);+// await checkNumberOfTodosInLocalStorage(page, 3);+// });++// test('should hide other controls when editing', async ({ page }) => {+// const todoItem = page.locator('.todo-list li').nth(1);+// await todoItem.dblclick();+// await expect(todoItem.locator('.toggle')).not.toBeVisible();+// await expect(todoItem.locator('label')).not.toBeVisible();+// await checkNumberOfTodosInLocalStorage(page, 3);+// });++// test('should save edits on blur', async ({ page }) => {+// const todoItems = page.locator('.todo-list li');+// await todoItems.nth(1).dblclick();+// await todoItems.nth(1).locator('.edit').fill('buy some sausages');+// await todoItems.nth(1).locator('.edit').dispatchEvent('blur');++// await expect(todoItems).toHaveText([+// TODO_ITEMS[0],+// 'buy some sausages',+// TODO_ITEMS[2],+// ]);+// await checkTodosInLocalStorage(page, 'buy some sausages');+// });++// test('should trim entered text', async ({ page }) => {+// const todoItems = page.locator('.todo-list li');+// await todoItems.nth(1).dblclick();+// await todoItems.nth(1).locator('.edit').fill(' buy some sausages ');+// await todoItems.nth(1).locator('.edit').press('Enter');++// await expect(todoItems).toHaveText([+// TODO_ITEMS[0],+// 'buy some sausages',+// TODO_ITEMS[2],+// ]);+// await checkTodosInLocalStorage(page, 'buy some sausages');+// });++// test('should remove the item if an empty text string was entered', async ({ page }) => {+// const todoItems = page.locator('.todo-list li');+// await todoItems.nth(1).dblclick();+// await todoItems.nth(1).locator('.edit').fill('');+// await todoItems.nth(1).locator('.edit').press('Enter');++// await expect(todoItems).toHaveText([+// TODO_ITEMS[0],+// TODO_ITEMS[2],+// ]);+// });++// test('should cancel edits on escape', async ({ page }) => {+// const todoItems = page.locator('.todo-list li');+// await todoItems.nth(1).dblclick();+// await todoItems.nth(1).locator('.edit').press('Escape');+// await expect(todoItems).toHaveText(TODO_ITEMS);+// });+// });++// test.describe('Counter', () => {+// test('should display the current number of todo items', async ({ page }) => {+// await page.locator('.new-todo').fill(TODO_ITEMS[0]);+// await page.locator('.new-todo').press('Enter');+// await expect(page.locator('.todo-count')).toContainText('1');++// await page.locator('.new-todo').fill(TODO_ITEMS[1]);+// await page.locator('.new-todo').press('Enter');+// await expect(page.locator('.todo-count')).toContainText('2');++// await checkNumberOfTodosInLocalStorage(page, 2);+// });+// });++// test.describe('Clear completed button', () => {+// test.beforeEach(async ({ page }) => {+// await createDefaultTodos(page);+// });++// test('should display the correct text', async ({ page }) => {+// await page.locator('.todo-list li .toggle').first().check();+// await expect(page.locator('.clear-completed')).toHaveText('Clear completed');+// });++// test('should remove completed items when clicked', async ({ page }) => {+// const todoItems = page.locator('.todo-list li');+// await todoItems.nth(1).locator('.toggle').check();+// await page.locator('.clear-completed').click();+// await expect(todoItems).toHaveCount(2);+// await expect(todoItems).toHaveText([TODO_ITEMS[0], TODO_ITEMS[2]]);+// });++// test('should be hidden when there are no items that are completed', async ({ page }) => {+// await page.locator('.todo-list li .toggle').first().check();+// await page.locator('.clear-completed').click();+// await expect(page.locator('.clear-completed')).toBeHidden();+// });+// });++// test.describe('Persistence', () => {+// test('should persist its data', async ({ page }) => {+// for (const item of TODO_ITEMS.slice(0, 2)) {+// await page.locator('.new-todo').fill(item);+// await page.locator('.new-todo').press('Enter');+// }++// const todoItems = page.locator('.todo-list li');+// await todoItems.nth(0).locator('.toggle').check();+// await expect(todoItems).toHaveText([TODO_ITEMS[0], TODO_ITEMS[1]]);+// await expect(todoItems).toHaveClass(['completed', '']);++// // Ensure there is 1 completed item.+// checkNumberOfCompletedTodosInLocalStorage(page, 1);++// // Now reload.+// await page.reload();+// await expect(todoItems).toHaveText([TODO_ITEMS[0], TODO_ITEMS[1]]);+// await expect(todoItems).toHaveClass(['completed', '']);+// });+// });++// test.describe('Routing', () => {+// test.beforeEach(async ({ page }) => {+// await createDefaultTodos(page);+// // make sure the app had a chance to save updated todos in storage+// // before navigating to a new view, otherwise the items can get lost :(+// // in some frameworks like Durandal+// await checkTodosInLocalStorage(page, TODO_ITEMS[0]);+// });++// test('should allow me to display active items', async ({ page }) => {+// await page.locator('.todo-list li .toggle').nth(1).check();+// await checkNumberOfCompletedTodosInLocalStorage(page, 1);+// await page.locator('.filters >> text=Active').click();+// await expect(page.locator('.todo-list li')).toHaveCount(2);+// await expect(page.locator('.todo-list li')).toHaveText([TODO_ITEMS[0], TODO_ITEMS[2]]);+// });++// test('should respect the back button', async ({ page }) => {+// await page.locator('.todo-list li .toggle').nth(1).check();+// await checkNumberOfCompletedTodosInLocalStorage(page, 1);++// await test.step('Showing all items', async () => {+// await page.locator('.filters >> text=All').click();+// await expect(page.locator('.todo-list li')).toHaveCount(3);+// });++// await test.step('Showing active items', async () => {+// await page.locator('.filters >> text=Active').click();+// });++// await test.step('Showing completed items', async () => {+// await page.locator('.filters >> text=Completed').click();+// });++// await expect(page.locator('.todo-list li')).toHaveCount(1);+// await page.goBack();+// await expect(page.locator('.todo-list li')).toHaveCount(2);+// await page.goBack();+// await expect(page.locator('.todo-list li')).toHaveCount(3);+// });++// test('should allow me to display completed items', async ({ page }) => {+// await page.locator('.todo-list li .toggle').nth(1).check();+// await checkNumberOfCompletedTodosInLocalStorage(page, 1);+// await page.locator('.filters >> text=Completed').click();+// await expect(page.locator('.todo-list li')).toHaveCount(1);+// });++// test('should allow me to display all items', async ({ page }) => {+// await page.locator('.todo-list li .toggle').nth(1).check();+// await checkNumberOfCompletedTodosInLocalStorage(page, 1);+// await page.locator('.filters >> text=Active').click();+// await page.locator('.filters >> text=Completed').click();+// await page.locator('.filters >> text=All').click();+// await expect(page.locator('.todo-list li')).toHaveCount(3);+// });++// test('should highlight the currently applied filter', async ({ page }) => {+// await expect(page.locator('.filters >> text=All')).toHaveClass('selected');+// await page.locator('.filters >> text=Active').click();+// // Page change - active items.+// await expect(page.locator('.filters >> text=Active')).toHaveClass('selected');+// await page.locator('.filters >> text=Completed').click();+// // Page change - completed items.+// await expect(page.locator('.filters >> text=Completed')).toHaveClass('selected');+// });+// });++// async function createDefaultTodos(page: Page) {+// for (const item of TODO_ITEMS) {+// await page.locator('.new-todo').fill(item);+// await page.locator('.new-todo').press('Enter');+// }+// }++// async function checkNumberOfTodosInLocalStorage(page: Page, expected: number) {+// return await page.waitForFunction(e => {+// return JSON.parse(localStorage['react-todos']).length === e;+// }, expected);+// }++// async function checkNumberOfCompletedTodosInLocalStorage(page: Page, expected: number) {+// return await page.waitForFunction(e => {+// return JSON.parse(localStorage['react-todos']).filter(i => i.completed).length === e;+// }, expected);+// }++// async function checkTodosInLocalStorage(page: Page, title: string) {+// return await page.waitForFunction(t => {+// return JSON.parse(localStorage['react-todos']).map(i => i.title).includes(t);+// }, title);+// }diff --git a/UI/Web/e2e/src/app.e2e-spec.ts b/UI/Web/e2e/src/app.e2e-spec.tsdeleted file mode 100644index fb7ac99be..000000000--- a/UI/Web/e2e/src/app.e2e-spec.ts+++ /dev/null@@ -1,23 +0,0 @@-import { AppPage } from './app.po';-import { browser, logging } from 'protractor';--describe('workspace-project App', () => {- let page: AppPage;-- beforeEach(() => {- page = new AppPage();- });-- it('should display welcome message', async () => {- await page.navigateTo();- expect(await page.getTitleText()).toEqual('kavita-webui app is running!');- });-- afterEach(async () => {- // Assert that there are no errors emitted from the browser- const logs = await browser.manage().logs().get(logging.Type.BROWSER);- expect(logs).not.toContain(jasmine.objectContaining({- level: logging.Level.SEVERE,- } as logging.Entry));- });-});diff --git a/UI/Web/e2e/src/app.spec.ts b/UI/Web/e2e/src/app.spec.tsnew file mode 100644index 000000000..2f07e3839--- /dev/null+++ b/UI/Web/e2e/src/app.spec.ts@@ -0,0 +1,18 @@+import { test, expect } from '@playwright/test';++test('When not authenticated, should be redirected to login page', async ({ page }) => {+ await page.goto('http://localhost:4200/', { waitUntil: 'networkidle' });+ expect(page.url()).toBe('http://localhost:4200/login');+});++test('When not authenticated, should be redirected to login page from an authenticated page', async ({ page }) => {+ await page.goto('http://localhost:4200/library', { waitUntil: 'networkidle' });+ expect(page.url()).toBe('http://localhost:4200/login');+});++// Not sure how to test when we need localStorage: https://github.com/microsoft/playwright/issues/6258+// test('When authenticated, should be redirected to library page', async ({ page }) => {+// await page.goto('http://localhost:4200/', { waitUntil: 'networkidle' });+// console.log('url: ', page.url());+// expect(page.url()).toBe('http://localhost:4200/library');+// });\ No newline at end of filediff --git a/UI/Web/e2e/src/login/login.spec.ts b/UI/Web/e2e/src/login/login.spec.tsnew file mode 100644index 000000000..8a504f3f9--- /dev/null+++ b/UI/Web/e2e/src/login/login.spec.ts@@ -0,0 +1,43 @@+import { expect, test } from "@playwright/test";++test('When not authenticated, should be redirected to login page', async ({ page }) => {+ await page.goto('http://localhost:4200/', { waitUntil: 'networkidle' });+ expect(page.url()).toBe('http://localhost:4200/login');+});++test('Should be able to log in', async ({ page }) => {++ await page.goto('http://localhost:4200/login', { waitUntil: 'networkidle' });+ const username = page.locator('#username');+ expect(username).toBeEditable();+ const password = page.locator('#password');+ expect(password).toBeEditable();++ await username.type('Joe');+ await password.type('P4ssword');++ const button = page.locator('button[type="submit"]');+ await button.click();++ await page.waitForLoadState('networkidle');+ await page.waitForTimeout(200);+ expect(page.url()).toBe('http://localhost:4200/library');+});++test('Should get a toastr when no username', async ({ page }) => {++ await page.goto('http://localhost:4200/login', { waitUntil: 'networkidle' });+ const username = page.locator('#username');+ expect(username).toBeEditable();++ await username.type('');++ const button = page.locator('button[type="submit"]');+ await button.click();++ await page.waitForTimeout(100);+ const toastr = page.locator('#toast-container div[role="alertdialog"]')+ await expect(toastr).toHaveText('Invalid username');++ expect(page.url()).toBe('http://localhost:4200/login');+});\ No newline at end of filediff --git a/UI/Web/e2e/src/registration/forgot-password/forgot-password.spec.ts b/UI/Web/e2e/src/registration/forgot-password/forgot-password.spec.tsnew file mode 100644index 000000000..937651d9b--- /dev/null+++ b/UI/Web/e2e/src/registration/forgot-password/forgot-password.spec.ts@@ -0,0 +1,34 @@+import { expect, test } from "@playwright/test";++test('When on login page, clicking Forgot Password should redirect', async ({ page }) => {+ await page.goto('http://localhost:4200/login', { waitUntil: 'networkidle' });++ await page.click('a[routerlink="/registration/reset-password"]')+ await page.waitForLoadState('networkidle');++ expect(page.url()).toBe('http://localhost:4200/registration/reset-password');+});++test('Going directly to reset url should stay on the page', async ({page}) => {+ await page.goto('http://localhost:4200/registration/reset-password', { waitUntil: 'networkidle' });+ const email = page.locator('#email');+ expect(email).toBeEditable();+})++test('Submitting an email, should give a prompt to user, redirect back to login', async ({ page }) => {+ await page.goto('http://localhost:4200/registration/reset-password', { waitUntil: 'networkidle' });++ const email = page.locator('#email');+ expect(email).toBeEditable();++ await email.type('[email protected]');++ const button = page.locator('button[type="submit"]');+ await button.click();++ const toastr = page.locator('#toast-container div[role="alertdialog"]')+ await expect(toastr).toHaveText('An email will be sent to the email if it exists in our database');+ await page.waitForLoadState('networkidle');++ expect(page.url()).toBe('http://localhost:4200/login');+});\ No newline at end of filediff --git a/UI/Web/e2e/src/side-nav/side-nav.spec.ts b/UI/Web/e2e/src/side-nav/side-nav.spec.tsnew file mode 100644index 000000000..b74d07eea--- /dev/null+++ b/UI/Web/e2e/src/side-nav/side-nav.spec.ts@@ -0,0 +1,13 @@+import { expect, test } from "@playwright/test";++test.use({ storageState: 'storage/admin.json' });++test('When on login page, side nav should not render', async ({ page }) => {+ await page.goto('http://localhost:4200/login', { waitUntil: 'networkidle' });+ await expect(page.locator(".side-nav")).toHaveCount(0)+});++test('When on library page, side nav should render', async ({ page }) => {+ await page.goto('http://localhost:4200/library', { waitUntil: 'networkidle' });+ await expect(page.locator(".side-nav")).toHaveCount(1)+});\ No newline at end of filediff --git a/UI/Web/global-setup.ts b/UI/Web/global-setup.tsnew file mode 100644index 000000000..8db0f8bde--- /dev/null+++ b/UI/Web/global-setup.ts@@ -0,0 +1,46 @@+import { Browser, chromium, FullConfig, request } from '@playwright/test';++async function globalSetup(config: FullConfig) {+ let requestContext = await request.newContext();+ var token = await requestContext.post('http://localhost:5000/account/login', {+ form: {+ 'user': 'Joe',+ 'password': 'P4ssword'+ }+ });+ console.log(token.json());+ // Save signed-in state to 'storageState.json'.+ //await requestContext.storageState({ path: 'adminStorageState.json' });+ await requestContext.dispose();++ requestContext = await request.newContext();+ await requestContext.post('http://localhost:5000/account/login', {+ form: {+ 'user': 'nonadmin',+ 'password': 'P4ssword'+ }+ });+ // Save signed-in state to 'storageState.json'.+ //await requestContext.storageState({ path: 'nonAdminStorageState.json' });+ await requestContext.dispose();+}++++// async function globalSetup (config: FullConfig) {+// const browser = await chromium.launch()+// await saveStorage(browser, 'nonadmin', 'P4ssword', 'storage/user.json')+// await saveStorage(browser, 'Joe', 'P4ssword', 'storage/admin.json')+// await browser.close()+// }++async function saveStorage (browser: Browser, username: string, password: string, saveStoragePath: string) {+ const page = await browser.newPage()+ await page.goto('http://localhost:5000/account/login')+ await page.type('#username', username)+ await page.type('#password', password)+ await page.click('button[type="submit"]')+ await page.context().storageState({ path: saveStoragePath })+}++export default globalSetup;\ No newline at end of filediff --git a/UI/Web/nonAdminStorageState.json b/UI/Web/nonAdminStorageState.jsonnew file mode 100644index 000000000..f4ec35503--- /dev/null+++ b/UI/Web/nonAdminStorageState.json@@ -0,0 +1,4 @@+{+ "cookies": [],+ "origins": []+}\ No newline at end of filediff --git a/UI/Web/package-lock.json b/UI/Web/package-lock.jsonindex c0b0ce2cd..a5b7e35b3 100644--- a/UI/Web/package-lock.json+++ b/UI/Web/package-lock.json@@ -1599,6 +1599,17 @@"@babel/helper-plugin-utils": "^7.16.7"}},+ "@babel/plugin-transform-typescript": {+ "version": "7.16.8",+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.16.8.tgz",+ "integrity": "sha512-bHdQ9k7YpBDO2d0NVfkj51DpQcvwIzIusJ7mEUaMlbZq3Kt/U47j24inXZHQ5MDiYpCs+oZiwnXyKedE8+q7AQ==",+ "dev": true,+ "requires": {+ "@babel/helper-create-class-features-plugin": "^7.16.7",+ "@babel/helper-plugin-utils": "^7.16.7",+ "@babel/plugin-syntax-typescript": "^7.16.7"+ }+ },"@babel/plugin-transform-unicode-escapes": {"version": "7.16.7","resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.16.7.tgz",@@ -1721,6 +1732,17 @@"esutils": "^2.0.2"}},+ "@babel/preset-typescript": {+ "version": "7.16.7",+ "resolved": "https://registry.npmjs.org/@babel/preset-typescript/-/preset-typescript-7.16.7.tgz",+ "integrity": "sha512-WbVEmgXdIyvzB77AQjGBEyYPZx+8tTsO50XtfozQrkW8QB2rLJpH2lgx0TRw5EJrBxOZQ+wCcyPVQvS8tjEHpQ==",+ "dev": true,+ "requires": {+ "@babel/helper-plugin-utils": "^7.16.7",+ "@babel/helper-validator-option": "^7.16.7",+ "@babel/plugin-transform-typescript": "^7.16.7"+ }+ },"@babel/runtime": {"version": "7.16.7","resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.16.7.tgz",@@ -2553,6 +2575,278 @@"read-package-json-fast": "^2.0.1"}},+ "@playwright/test": {+ "version": "1.20.2",+ "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.20.2.tgz",+ "integrity": "sha512-unkLa+xe/lP7MVC0qpgadc9iSG1+LEyGBzlXhGS/vLGAJaSFs8DNfI89hNd5shHjWfNzb34JgPVnkRKCSNo5iw==",+ "dev": true,+ "requires": {+ "@babel/code-frame": "7.16.7",+ "@babel/core": "7.16.12",+ "@babel/helper-plugin-utils": "7.16.7",+ "@babel/plugin-proposal-class-properties": "7.16.7",+ "@babel/plugin-proposal-dynamic-import": "7.16.7",+ "@babel/plugin-proposal-export-namespace-from": "7.16.7",+ "@babel/plugin-proposal-logical-assignment-operators": "7.16.7",+ "@babel/plugin-proposal-nullish-coalescing-operator": "7.16.7",+ "@babel/plugin-proposal-numeric-separator": "7.16.7",+ "@babel/plugin-proposal-optional-chaining": "7.16.7",+ "@babel/plugin-proposal-private-methods": "7.16.11",+ "@babel/plugin-proposal-private-property-in-object": "7.16.7",+ "@babel/plugin-syntax-async-generators": "7.8.4",+ "@babel/plugin-syntax-json-strings": "7.8.3",+ "@babel/plugin-syntax-object-rest-spread": "7.8.3",+ "@babel/plugin-syntax-optional-catch-binding": "7.8.3",+ "@babel/plugin-transform-modules-commonjs": "7.16.8",+ "@babel/preset-typescript": "7.16.7",+ "colors": "1.4.0",+ "commander": "8.3.0",+ "debug": "4.3.3",+ "expect": "27.2.5",+ "jest-matcher-utils": "27.2.5",+ "json5": "2.2.1",+ "mime": "3.0.0",+ "minimatch": "3.0.4",+ "ms": "2.1.3",+ "open": "8.4.0",+ "pirates": "4.0.4",+ "playwright-core": "1.20.2",+ "rimraf": "3.0.2",+ "source-map-support": "0.4.18",+ "stack-utils": "2.0.5",+ "yazl": "2.5.1"+ },+ "dependencies": {+ "@babel/code-frame": {+ "version": "7.16.7",+ "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz",+ "integrity": "sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==",+ "dev": true,+ "requires": {+ "@babel/highlight": "^7.16.7"+ }+ },+ "@babel/core": {+ "version": "7.16.12",+ "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.16.12.tgz",+ "integrity": "sha512-dK5PtG1uiN2ikk++5OzSYsitZKny4wOCD0nrO4TqnW4BVBTQ2NGS3NgilvT/TEyxTST7LNyWV/T4tXDoD3fOgg==",+ "dev": true,+ "requires": {+ "@babel/code-frame": "^7.16.7",+ "@babel/generator": "^7.16.8",+ "@babel/helper-compilation-targets": "^7.16.7",+ "@babel/helper-module-transforms": "^7.16.7",+ "@babel/helpers": "^7.16.7",+ "@babel/parser": "^7.16.12",+ "@babel/template": "^7.16.7",+ "@babel/traverse": "^7.16.10",+ "@babel/types": "^7.16.8",+ "convert-source-map": "^1.7.0",+ "debug": "^4.1.0",+ "gensync": "^1.0.0-beta.2",+ "json5": "^2.1.2",+ "semver": "^6.3.0",+ "source-map": "^0.5.0"+ }+ },+ "@babel/helper-validator-identifier": {+ "version": "7.16.7",+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz",+ "integrity": "sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw==",+ "dev": true+ },+ "@babel/highlight": {+ "version": "7.17.9",+ "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.17.9.tgz",+ "integrity": "sha512-J9PfEKCbFIv2X5bjTMiZu6Vf341N05QIY+d6FvVKynkG1S7G0j3I0QoRtWIrXhZ+/Nlb5Q0MzqL7TokEJ5BNHg==",+ "dev": true,+ "requires": {+ "@babel/helper-validator-identifier": "^7.16.7",+ "chalk": "^2.0.0",+ "js-tokens": "^4.0.0"+ }+ },+ "agent-base": {+ "version": "6.0.2",+ "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",+ "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==",+ "dev": true,+ "requires": {+ "debug": "4"+ }+ },+ "ansi-styles": {+ "version": "5.2.0",+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz",+ "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==",+ "dev": true+ },+ "color-convert": {+ "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"+ }+ },+ "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==",+ "dev": true+ },+ "commander": {+ "version": "8.3.0",+ "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz",+ "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==",+ "dev": true+ },+ "expect": {+ "version": "27.2.5",+ "resolved": "https://registry.npmjs.org/expect/-/expect-27.2.5.tgz",+ "integrity": "sha512-ZrO0w7bo8BgGoP/bLz+HDCI+0Hfei9jUSZs5yI/Wyn9VkG9w8oJ7rHRgYj+MA7yqqFa0IwHA3flJzZtYugShJA==",+ "dev": true,+ "requires": {+ "@jest/types": "^27.2.5",+ "ansi-styles": "^5.0.0",+ "jest-get-type": "^27.0.6",+ "jest-matcher-utils": "^27.2.5",+ "jest-message-util": "^27.2.5",+ "jest-regex-util": "^27.0.6"+ }+ },+ "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+ },+ "https-proxy-agent": {+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz",+ "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==",+ "dev": true,+ "requires": {+ "agent-base": "6",+ "debug": "4"+ }+ },+ "jest-matcher-utils": {+ "version": "27.2.5",+ "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-27.2.5.tgz",+ "integrity": "sha512-qNR/kh6bz0Dyv3m68Ck2g1fLW5KlSOUNcFQh87VXHZwWc/gY6XwnKofx76Qytz3x5LDWT09/2+yXndTkaG4aWg==",+ "dev": true,+ "requires": {+ "chalk": "^4.0.0",+ "jest-diff": "^27.2.5",+ "jest-get-type": "^27.0.6",+ "pretty-format": "^27.2.5"+ },+ "dependencies": {+ "ansi-styles": {+ "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"+ }+ },+ "chalk": {+ "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"+ }+ }+ }+ },+ "json5": {+ "version": "2.2.1",+ "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz",+ "integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==",+ "dev": true+ },+ "mime": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz",+ "integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==",+ "dev": true+ },+ "ms": {+ "version": "2.1.3",+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",+ "dev": true+ },+ "pirates": {+ "version": "4.0.4",+ "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.4.tgz",+ "integrity": "sha512-ZIrVPH+A52Dw84R0L3/VS9Op04PuQ2SEoJL6bkshmiTic/HldyW9Tf7oH5mhJZBK7NmDx27vSMrYEXPXclpDKw==",+ "dev": true+ },+ "playwright-core": {+ "version": "1.20.2",+ "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.20.2.tgz",+ "integrity": "sha512-iV6+HftSPalynkq0CYJala1vaTOq7+gU9BRfKCdM9bAxNq/lFLrwbluug2Wt5OoUwbMABcnTThIEm3/qUhCdJQ==",+ "dev": true,+ "requires": {+ "colors": "1.4.0",+ "commander": "8.3.0",+ "debug": "4.3.3",+ "extract-zip": "2.0.1",+ "https-proxy-agent": "5.0.0",+ "jpeg-js": "0.4.3",+ "mime": "3.0.0",+ "pixelmatch": "5.2.1",+ "pngjs": "6.0.0",+ "progress": "2.0.3",+ "proper-lockfile": "4.1.2",+ "proxy-from-env": "1.1.0",+ "rimraf": "3.0.2",+ "socks-proxy-agent": "6.1.1",+ "stack-utils": "2.0.5",+ "ws": "8.4.2",+ "yauzl": "2.10.0",+ "yazl": "2.5.1"+ }+ },+ "semver": {+ "version": "6.3.0",+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",+ "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",+ "dev": true+ },+ "source-map-support": {+ "version": "0.4.18",+ "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.18.tgz",+ "integrity": "sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA==",+ "dev": true,+ "requires": {+ "source-map": "^0.5.6"+ }+ },+ "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"+ }+ },+ "ws": {+ "version": "8.4.2",+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.4.2.tgz",+ "integrity": "sha512-Kbk4Nxyq7/ZWqr/tarI9yIt/+iNNFOjBXEWgTb4ydaNHBNGgvf2QHbS9fdfsndfjFlFwEd4Al+mw83YkaD10ZA==",+ "dev": true+ }+ }+ },"@polka/url": {"version": "1.0.0-next.21","resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.21.tgz",@@ -2919,6 +3213,16 @@"integrity": "sha512-7tFImggNeNBVMsn0vLrpn1H1uPrUBdnARPTpZoitY37ZrdJREzf7I16tMrlK3hen349gr1NYh8CmZQa7CTG6Aw==","dev": true},+ "@types/yauzl": {+ "version": "2.9.2",+ "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.9.2.tgz",+ "integrity": "sha512-8uALY5LTvSuHgloDVUvWP3pIauILm+8/0pDMokuDYIoNsOkSwd5AiHBTSEJjKTDcZr5z8UpgOWZkxBF4iJftoA==",+ "dev": true,+ "optional": true,+ "requires": {+ "@types/node": "*"+ }+ },"@webassemblyjs/ast": {"version": "1.11.1","resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.1.tgz",@@ -3426,9 +3730,9 @@"dev": true},"async": {- "version": "2.6.3",- "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz",- "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==",+ "version": "2.6.4",+ "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz",+ "integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==","dev": true,"requires": {"lodash": "^4.17.14"@@ -3906,6 +4210,12 @@"ieee754": "^1.1.13"}},+ "buffer-crc32": {+ "version": "0.2.13",+ "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz",+ "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=",+ "dev": true+ },"buffer-from": {"version": "1.1.2","resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",@@ -4237,6 +4547,12 @@"integrity": "sha512-hUewv7oMjCp+wkBv5Rm0v87eJhq4woh5rSR+42YSQJKecCqgIqNkZ6lAlQms/BwHPJA5NKMRlpxPRv0n8HQW6g==","dev": true},+ "colors": {+ "version": "1.4.0",+ "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz",+ "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==",+ "dev": true+ },"combined-stream": {"version": "1.0.8","resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",@@ -5113,6 +5429,15 @@}}},+ "end-of-stream": {+ "version": "1.4.4",+ "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",+ "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",+ "dev": true,+ "requires": {+ "once": "^1.4.0"+ }+ },"enhanced-resolve": {"version": "5.9.0","resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.9.0.tgz",@@ -5558,6 +5883,29 @@"tmp": "^0.0.33"}},+ "extract-zip": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz",+ "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==",+ "dev": true,+ "requires": {+ "@types/yauzl": "^2.9.1",+ "debug": "^4.1.1",+ "get-stream": "^5.1.0",+ "yauzl": "^2.10.0"+ },+ "dependencies": {+ "get-stream": {+ "version": "5.2.0",+ "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz",+ "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==",+ "dev": true,+ "requires": {+ "pump": "^3.0.0"+ }+ }+ }+ },"extsprintf": {"version": "1.3.0","resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz",@@ -5639,6 +5987,15 @@"bser": "2.1.1"}},+ "fd-slicer": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz",+ "integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=",+ "dev": true,+ "requires": {+ "pend": "~1.2.0"+ }+ },"fetch-cookie": {"version": "0.11.0","resolved": "https://registry.npmjs.org/fetch-cookie/-/fetch-cookie-0.11.0.tgz",@@ -8301,6 +8658,12 @@}}},+ "jpeg-js": {+ "version": "0.4.3",+ "resolved": "https://registry.npmjs.org/jpeg-js/-/jpeg-js-0.4.3.tgz",+ "integrity": "sha512-ru1HWKek8octvUHFHvE5ZzQ1yAsJmIvRdGWvSoKV52XKyuyYA437QWDttXT8eZXDSbuMpHlLzPDZUPd6idIz+Q==",+ "dev": true+ },"js-tokens": {"version": "4.0.0","resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",@@ -9897,6 +10260,12 @@"integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==","dev": true},+ "pend": {+ "version": "1.2.0",+ "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz",+ "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=",+ "dev": true+ },"performance-now": {"version": "2.1.0","resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",@@ -9955,6 +10324,23 @@"nice-napi": "^1.0.2"}},+ "pixelmatch": {+ "version": "5.2.1",+ "resolved": "https://registry.npmjs.org/pixelmatch/-/pixelmatch-5.2.1.tgz",+ "integrity": "sha512-WjcAdYSnKrrdDdqTcVEY7aB7UhhwjYQKYhHiBXdJef0MOaQeYpUdQ+iVyBLa5YBKS8MPVPPMX7rpOByISLpeEQ==",+ "dev": true,+ "requires": {+ "pngjs": "^4.0.1"+ },+ "dependencies": {+ "pngjs": {+ "version": "4.0.1",+ "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-4.0.1.tgz",+ "integrity": "sha512-rf5+2/ioHeQxR6IxuYNYGFytUyG3lma/WW1nsmjeHlWwtb2aByla6dkVc8pmJ9nplzkTA0q2xx7mMWrOTqT4Gg==",+ "dev": true+ }+ }+ },"pkg-dir": {"version": "4.2.0","resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz",@@ -9964,6 +10350,86 @@"find-up": "^4.0.0"}},+ "playwright": {+ "version": "1.20.2",+ "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.20.2.tgz",+ "integrity": "sha512-p6GE8A/f2G7t8FIk/AwQ94nT7R7tyPRJyKt1FwRjwBDf4WdpgoAr4hDfMgHy+CkClR22adFjopGwhxXAPsewhg==",+ "dev": true,+ "requires": {+ "playwright-core": "1.20.2"+ },+ "dependencies": {+ "agent-base": {+ "version": "6.0.2",+ "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",+ "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==",+ "dev": true,+ "requires": {+ "debug": "4"+ }+ },+ "commander": {+ "version": "8.3.0",+ "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz",+ "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==",+ "dev": true+ },+ "https-proxy-agent": {+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz",+ "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==",+ "dev": true,+ "requires": {+ "agent-base": "6",+ "debug": "4"+ }+ },+ "mime": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz",+ "integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==",+ "dev": true+ },+ "playwright-core": {+ "version": "1.20.2",+ "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.20.2.tgz",+ "integrity": "sha512-iV6+HftSPalynkq0CYJala1vaTOq7+gU9BRfKCdM9bAxNq/lFLrwbluug2Wt5OoUwbMABcnTThIEm3/qUhCdJQ==",+ "dev": true,+ "requires": {+ "colors": "1.4.0",+ "commander": "8.3.0",+ "debug": "4.3.3",+ "extract-zip": "2.0.1",+ "https-proxy-agent": "5.0.0",+ "jpeg-js": "0.4.3",+ "mime": "3.0.0",+ "pixelmatch": "5.2.1",+ "pngjs": "6.0.0",+ "progress": "2.0.3",+ "proper-lockfile": "4.1.2",+ "proxy-from-env": "1.1.0",+ "rimraf": "3.0.2",+ "socks-proxy-agent": "6.1.1",+ "stack-utils": "2.0.5",+ "ws": "8.4.2",+ "yauzl": "2.10.0",+ "yazl": "2.5.1"+ }+ },+ "ws": {+ "version": "8.4.2",+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.4.2.tgz",+ "integrity": "sha512-Kbk4Nxyq7/ZWqr/tarI9yIt/+iNNFOjBXEWgTb4ydaNHBNGgvf2QHbS9fdfsndfjFlFwEd4Al+mw83YkaD10ZA==",+ "dev": true+ }+ }+ },+ "pngjs": {+ "version": "6.0.0",+ "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-6.0.0.tgz",+ "integrity": "sha512-TRzzuFRRmEoSW/p1KVAmiOgPco2Irlah+bGFCeNfJXxxYGwSw7YwAOAcd7X28K/m5bjBWKsC29KyoMfHbypayg==",+ "dev": true+ },"portfinder": {"version": "1.0.28","resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.28.tgz",@@ -10366,6 +10832,12 @@"integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==","dev": true},+ "progress": {+ "version": "2.0.3",+ "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz",+ "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==",+ "dev": true+ },"promise-inflight": {"version": "1.0.1","resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz",@@ -10400,6 +10872,25 @@"sisteransi": "^1.0.5"}},+ "proper-lockfile": {+ "version": "4.1.2",+ "resolved": "https://registry.npmjs.org/proper-lockfile/-/proper-lockfile-4.1.2.tgz",+ "integrity": "sha512-TjNPblN4BwAWMXU8s9AEz4JmQxnD1NNL7bNOY/AKUzyamc379FWASUhc/K1pL2noVb+XmZKLL68cjzLsiOAMaA==",+ "dev": true,+ "requires": {+ "graceful-fs": "^4.2.4",+ "retry": "^0.12.0",+ "signal-exit": "^3.0.2"+ },+ "dependencies": {+ "retry": {+ "version": "0.12.0",+ "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz",+ "integrity": "sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs=",+ "dev": true+ }+ }+ },"protractor": {"version": "7.0.0","resolved": "https://registry.npmjs.org/protractor/-/protractor-7.0.0.tgz",@@ -10761,6 +11252,12 @@}}},+ "proxy-from-env": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",+ "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==",+ "dev": true+ },"prr": {"version": "1.0.1","resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz",@@ -10773,6 +11270,16 @@"resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz","integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ=="},+ "pump": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",+ "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==",+ "dev": true,+ "requires": {+ "end-of-stream": "^1.1.0",+ "once": "^1.3.1"+ }+ },"punycode": {"version": "2.1.1","resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",@@ -12953,6 +13460,25 @@"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.0.0.tgz","integrity": "sha512-z9kApYUOCwoeZ78rfRYYWdiU/iNL6mwwYlkkZfJoyMR1xps+NEBX5X7XmRpxkZHhXJ6+Ey00IwKxBBSW9FIjyA=="},+ "yauzl": {+ "version": "2.10.0",+ "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz",+ "integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=",+ "dev": true,+ "requires": {+ "buffer-crc32": "~0.2.3",+ "fd-slicer": "~1.1.0"+ }+ },+ "yazl": {+ "version": "2.5.1",+ "resolved": "https://registry.npmjs.org/yazl/-/yazl-2.5.1.tgz",+ "integrity": "sha512-phENi2PLiHnHb6QBVot+dJnaAZ0xosj7p3fWl+znIjBDlnMI2PsZCJZ306BPTFOaHf5qdDEI8x5qFrSOBN5vrw==",+ "dev": true,+ "requires": {+ "buffer-crc32": "~0.2.3"+ }+ },"yn": {"version": "3.1.1","resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz",diff --git a/UI/Web/package.json b/UI/Web/package.jsonindex 235cbd85f..8d1020079 100644--- a/UI/Web/package.json+++ b/UI/Web/package.json@@ -49,12 +49,14 @@"@angular-devkit/build-angular": "~13.2.3","@angular/cli": "^13.2.3","@angular/compiler-cli": "~13.2.2",+ "@playwright/test": "^1.20.2","@types/jest": "^27.4.0","@types/node": "^17.0.17","codelyzer": "^6.0.2","jest": "^27.5.1","jest-preset-angular": "^11.1.0","karma-coverage": "~2.2.0",+ "playwright": "^1.20.2","protractor": "~7.0.0","ts-node": "~10.5.0","tslint": "^6.1.3",diff --git a/UI/Web/playwright.config.ts b/UI/Web/playwright.config.tsnew file mode 100644index 000000000..8c5e0ca57--- /dev/null+++ b/UI/Web/playwright.config.ts@@ -0,0 +1,106 @@+import type { PlaywrightTestConfig } from '@playwright/test';+import { devices } from '@playwright/test';++/**+ * Read environment variables from file.+ * https://github.com/motdotla/dotenv+ */+// require('dotenv').config();++/**+ * See https://playwright.dev/docs/test-configuration.+ */+const config: PlaywrightTestConfig = {+ testDir: './e2e',+ /* Maximum time one test can run for. */+ timeout: 30 * 1000,+ expect: {+ /**+ * Maximum time expect() should wait for the condition to be met.+ * For example in `await expect(locator).toHaveText();`+ */+ timeout: 5000+ },+ /* Fail the build on CI if you accidentally left test.only in the source code. */+ forbidOnly: !!process.env.CI,+ /* Retry on CI only */+ retries: process.env.CI ? 2 : 0,+ /* Opt out of parallel tests on CI. */+ workers: process.env.CI ? 1 : undefined,+ /* Reporter to use. See https://playwright.dev/docs/test-reporters */+ reporter: 'html',+ /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */+ use: {+ /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */+ actionTimeout: 0,+ /* Base URL to use in actions like `await page.goto('/')`. */+ baseURL: 'http://localhost:4200',++ /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */+ trace: 'on-first-retry',+ },+ globalSetup: require.resolve('./global-setup'),++ /* Configure projects for major browsers */+ projects: [+ {+ name: 'chromium',+ use: {+ ...devices['Desktop Chrome'],+ },+ },++ // {+ // name: 'firefox',+ // use: {+ // ...devices['Desktop Firefox'],+ // },+ // },++ // {+ // name: 'webkit',+ // use: {+ // ...devices['Desktop Safari'],+ // },+ // },++ /* Test against mobile viewports. */+ // {+ // name: 'Mobile Chrome',+ // use: {+ // ...devices['Pixel 5'],+ // },+ // },+ // {+ // name: 'Mobile Safari',+ // use: {+ // ...devices['iPhone 12'],+ // },+ // },++ /* Test against branded browsers. */+ // {+ // name: 'Microsoft Edge',+ // use: {+ // channel: 'msedge',+ // },+ // },+ // {+ // name: 'Google Chrome',+ // use: {+ // channel: 'chrome',+ // },+ // },+ ],++ /* Folder for test artifacts such as screenshots, videos, traces, etc. */+ // outputDir: 'test-results/',++ /* Run your local dev server before starting the tests */+ // webServer: {+ // command: 'npm run start',+ // port: 3000,+ // },+};++export default config;diff --git a/UI/Web/src/app/_interceptors/error.interceptor.ts b/UI/Web/src/app/_interceptors/error.interceptor.tsindex 8c3cdca61..d01eda14a 100644--- a/UI/Web/src/app/_interceptors/error.interceptor.ts+++ b/UI/Web/src/app/_interceptors/error.interceptor.ts@@ -100,12 +100,12 @@ export class ErrorInterceptor implements HttpInterceptor {const err = error.error;if (err.hasOwnProperty('message') && err.message.trim() !== '') {if (err.message != 'User is not authenticated') {- console.log('500 error: ', error);+ console.error('500 error: ', error);}this.toastr.error(err.message);} else if (error.hasOwnProperty('message') && error.message.trim() !== '') {if (error.message != 'User is not authenticated') {- console.log('500 error: ', error);+ console.error('500 error: ', error);}this.toastr.error(error.message);}diff --git a/UI/Web/src/app/_models/book-page-layout-mode.ts b/UI/Web/src/app/_models/book-page-layout-mode.tsnew file mode 100644index 000000000..aac6c3fdb--- /dev/null+++ b/UI/Web/src/app/_models/book-page-layout-mode.ts@@ -0,0 +1,5 @@+export enum BookPageLayoutMode {+ Default = 0,+ Column1 = 1,+ Column2 = 2,+}\ No newline at end of filediff --git a/UI/Web/src/app/_models/events/site-theme-progress-event.ts b/UI/Web/src/app/_models/events/site-theme-progress-event.tsdeleted file mode 100644index 23fab2939..000000000--- a/UI/Web/src/app/_models/events/site-theme-progress-event.ts+++ /dev/null@@ -1,3 +0,0 @@-export interface SiteThemeProgressEvent {- themeName: string;-}\ No newline at end of filediff --git a/UI/Web/src/app/_models/events/theme-progress-event.ts b/UI/Web/src/app/_models/events/theme-progress-event.tsnew file mode 100644index 000000000..84120e32a--- /dev/null+++ b/UI/Web/src/app/_models/events/theme-progress-event.ts@@ -0,0 +1,3 @@+export interface ThemeProgressEvent {+ themeName: string;+}\ No newline at end of filediff --git a/UI/Web/src/app/_models/events/user-progress-update-event.ts b/UI/Web/src/app/_models/events/user-progress-update-event.tsnew file mode 100644index 000000000..e36199c60--- /dev/null+++ b/UI/Web/src/app/_models/events/user-progress-update-event.ts@@ -0,0 +1,10 @@+export interface UserProgressUpdateEvent {+ userId: number;+ username: string;+ //entityId: number;+ //entityType: 'series' | 'collection' | 'chapter' | 'volume' | 'readingList';+ seriesId: number;+ volumeId: number;+ chapterId: number;+ pagesRead: number;+}\ No newline at end of filediff --git a/UI/Web/src/app/_models/manga-file.ts b/UI/Web/src/app/_models/manga-file.tsindex 159656807..5ae56ae2b 100644--- a/UI/Web/src/app/_models/manga-file.ts+++ b/UI/Web/src/app/_models/manga-file.ts@@ -1,6 +1,7 @@import { MangaFormat } from './manga-format';export interface MangaFile {+ id: number;filePath: string;pages: number;format: MangaFormat;diff --git a/UI/Web/src/app/_models/manga-reader/bookmark-info.ts b/UI/Web/src/app/_models/manga-reader/bookmark-info.tsnew file mode 100644index 000000000..e63c31390--- /dev/null+++ b/UI/Web/src/app/_models/manga-reader/bookmark-info.ts@@ -0,0 +1,11 @@+import { LibraryType } from "../library";+import { MangaFormat } from "../manga-format";++export interface BookmarkInfo {+ seriesName: string;+ seriesFormat: MangaFormat;+ seriesId: number;+ libraryId: number;+ libraryType: LibraryType;+ pages: number;+}\ No newline at end of filediff --git a/UI/Web/src/app/_models/metadata/publication-status.ts b/UI/Web/src/app/_models/metadata/publication-status.tsindex 7881da383..386010568 100644--- a/UI/Web/src/app/_models/metadata/publication-status.ts+++ b/UI/Web/src/app/_models/metadata/publication-status.ts@@ -1,5 +1,7 @@export enum PublicationStatus {OnGoing = 0,Hiatus = 1,- Completed = 2+ Completed = 2,+ Cancelled = 3,+ Ended = 4}\ No newline at end of filediff --git a/UI/Web/src/app/_models/preferences/book-theme.ts b/UI/Web/src/app/_models/preferences/book-theme.tsnew file mode 100644index 000000000..4b487fb12--- /dev/null+++ b/UI/Web/src/app/_models/preferences/book-theme.ts@@ -0,0 +1,26 @@+import { ThemeProvider } from "./site-theme";++/**+ * Theme for the the book reader contents+ */+ export interface BookTheme {+ name: string;+ provider: ThemeProvider;+ /**+ * Main color (usually background color) that represents the theme+ */+ colorHash: string;+ isDefault: boolean;+ /**+ * Is this theme providing dark mode to the reader aka Should we style the reader controls to be dark mode+ */+ isDarkTheme: boolean;+ /**+ * Used to identify the theme on style tag+ */+ selector: string;+ /**+ * Inner HTML+ */+ content: string;+ }diff --git a/UI/Web/src/app/_models/preferences/preferences.ts b/UI/Web/src/app/_models/preferences/preferences.tsindex 7fbdaf185..874dd09a9 100644--- a/UI/Web/src/app/_models/preferences/preferences.ts+++ b/UI/Web/src/app/_models/preferences/preferences.ts@@ -1,5 +1,6 @@import { LayoutMode } from 'src/app/manga-reader/_models/layout-mode';+import { BookPageLayoutMode } from '../book-page-layout-mode';import { PageSplitOption } from './page-split-option';import { ReaderMode } from './reader-mode';import { ReadingDirection } from './reading-direction';@@ -16,15 +17,17 @@ export interface Preferences {layoutMode: LayoutMode;backgroundColor: string;showScreenHints: boolean;-+// Book Reader- bookReaderDarkMode: boolean;bookReaderMargin: number;bookReaderLineSpacing: number;bookReaderFontSize: number;bookReaderFontFamily: string;bookReaderTapToPaginate: boolean;bookReaderReadingDirection: ReadingDirection;+ bookReaderThemeName: string;+ bookReaderLayoutMode: BookPageLayoutMode;+ bookReaderImmersiveMode: boolean;// Globaltheme: SiteTheme;@@ -35,3 +38,4 @@ export const scalingOptions = [{text: 'Automatic', value: ScalingOption.Automatiexport 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}];export const layoutModes = [{text: 'Single', value: LayoutMode.Single}, {text: 'Double', value: LayoutMode.Double}, {text: 'Double (Manga)', value: LayoutMode.DoubleReversed}];+export const bookLayoutModes = [{text: 'Default', value: BookPageLayoutMode.Default}, {text: '1 Column', value: BookPageLayoutMode.Column1}, {text: '2 Column', value: BookPageLayoutMode.Column2}];diff --git a/UI/Web/src/app/_models/reading-list.ts b/UI/Web/src/app/_models/reading-list.tsindex ad1a325b8..da7932acc 100644--- a/UI/Web/src/app/_models/reading-list.ts+++ b/UI/Web/src/app/_models/reading-list.ts@@ -19,5 +19,6 @@ export interface ReadingList {title: string;summary: string;promoted: boolean;+ coverImageLocked: boolean;items: Array<ReadingListItem>;}\ No newline at end of filediff --git a/UI/Web/src/app/_models/search/search-result-group.ts b/UI/Web/src/app/_models/search/search-result-group.tsindex 377593669..901e63548 100644--- a/UI/Web/src/app/_models/search/search-result-group.ts+++ b/UI/Web/src/app/_models/search/search-result-group.ts@@ -1,4 +1,6 @@+import { Chapter } from "../chapter";import { Library } from "../library";+import { MangaFile } from "../manga-file";import { SearchResult } from "../search-result";import { Tag } from "../tag";@@ -10,6 +12,8 @@ export class SearchResultGroup {persons: Array<Tag> = [];genres: Array<Tag> = [];tags: Array<Tag> = [];+ files: Array<MangaFile> = [];+ chapters: Array<Chapter> = [];reset() {this.libraries = [];@@ -19,5 +23,7 @@ export class SearchResultGroup {this.persons = [];this.genres = [];this.tags = [];+ this.files = [];+ this.chapters = [];}}\ No newline at end of filediff --git a/UI/Web/src/app/_models/series-detail/related-series.ts b/UI/Web/src/app/_models/series-detail/related-series.tsnew file mode 100644index 000000000..02d394382--- /dev/null+++ b/UI/Web/src/app/_models/series-detail/related-series.ts@@ -0,0 +1,17 @@+import { Series } from "../series";++export interface RelatedSeries {+ sourceSeriesId: number;+ sequels: Array<Series>;+ prequels: Array<Series>;+ spinOffs: Array<Series>;+ adaptations: Array<Series>;+ sideStories: Array<Series>;+ characters: Array<Series>;+ contains: Array<Series>;+ others: Array<Series>;+ alternativeSettings: Array<Series>;+ alternativeVersions: Array<Series>;+ doujinshis: Array<Series>;+ parent: Array<Series>;+}\ No newline at end of filediff --git a/UI/Web/src/app/_models/series-detail/relation-kind.ts b/UI/Web/src/app/_models/series-detail/relation-kind.tsnew file mode 100644index 000000000..203401af3--- /dev/null+++ b/UI/Web/src/app/_models/series-detail/relation-kind.ts@@ -0,0 +1,31 @@+export enum RelationKind {+ Prequel = 1,+ Sequel = 2,+ SpinOff = 3,+ Adaptation = 4,+ SideStory = 5,+ Character = 6,+ Contains = 7,+ Other = 8,+ AlternativeSetting = 9,+ AlternativeVersion = 10,+ Doujinshi = 11,+ /**+ * This is UI only. Backend will generate Parent series for everything but Prequel/Sequel+ */+ Parent = 12+}++export const RelationKinds = [+ {text: 'Prequel', value: RelationKind.Prequel},+ {text: 'Sequel', value: RelationKind.Sequel},+ {text: 'Spin Off', value: RelationKind.SpinOff},+ {text: 'Adaptation', value: RelationKind.Adaptation},+ {text: 'Alternative Setting', value: RelationKind.AlternativeSetting},+ {text: 'Alternative Version', value: RelationKind.AlternativeVersion},+ {text: 'Side Story', value: RelationKind.SideStory},+ {text: 'Character', value: RelationKind.Character},+ {text: 'Contains', value: RelationKind.Contains},+ {text: 'Doujinshi', value: RelationKind.Doujinshi},+ {text: 'Other', value: RelationKind.Other},+];\ No newline at end of filediff --git a/UI/Web/src/app/_models/series-filter.ts b/UI/Web/src/app/_models/series-filter.tsindex aeafb3331..c2b823ce3 100644--- a/UI/Web/src/app/_models/series-filter.ts+++ b/UI/Web/src/app/_models/series-filter.ts@@ -40,7 +40,8 @@ export interface SortOptions {export enum SortField {SortName = 1,Created = 2,- LastModified = 3+ LastModified = 3,+ LastChapterAdded = 4}export interface ReadStatus {diff --git a/UI/Web/src/app/_models/series-metadata.ts b/UI/Web/src/app/_models/series-metadata.tsindex 9905cc1a6..d15dcc2f8 100644--- a/UI/Web/src/app/_models/series-metadata.ts+++ b/UI/Web/src/app/_models/series-metadata.ts@@ -8,8 +8,11 @@ import { Tag } from "./tag";export interface SeriesMetadata {seriesId: number;summary: string;- collectionTags: Array<CollectionTag>;+ totalCount: number;+ maxCount: number;++ collectionTags: Array<CollectionTag>;genres: Array<Genre>;tags: Array<Tag>;writers: Array<Person>;diff --git a/UI/Web/src/app/_models/series.ts b/UI/Web/src/app/_models/series.tsindex 0e3123ac3..17b489b6e 100644--- a/UI/Web/src/app/_models/series.ts+++ b/UI/Web/src/app/_models/series.ts@@ -44,4 +44,8 @@ export interface Series {* DateTime that represents last time the logged in user read this series*/latestReadDate: string;+ /**+ * DateTime representing last time a chapter was added to the Series+ */+ lastChapterAdded: string;}diff --git a/UI/Web/src/app/_services/account.service.ts b/UI/Web/src/app/_services/account.service.tsindex 3057704cb..6238c7b6a 100644--- a/UI/Web/src/app/_services/account.service.ts+++ b/UI/Web/src/app/_services/account.service.ts@@ -7,7 +7,7 @@ import { Preferences } from '../_models/preferences/preferences';import { User } from '../_models/user';import { Router } from '@angular/router';import { MessageHubService } from './message-hub.service';-import { ThemeService } from '../theme.service';+import { ThemeService } from './theme.service';import { InviteUserResponse } from '../_models/invite-user-response';@Injectable({@@ -235,9 +235,7 @@ export class AccountService implements OnDestroy {// set a timeout to refresh the token a minute before it expiresconst expires = new Date(jwtToken.exp * 1000);const timeout = expires.getTime() - Date.now() - (60 * 1000);- this.refreshTokenTimeout = setTimeout(() => this.refreshToken().subscribe(() => {- console.log('Token Refreshed');- }), timeout);+ this.refreshTokenTimeout = setTimeout(() => this.refreshToken().subscribe(() => {}), timeout);}private stopRefreshTokenTimer() {diff --git a/UI/Web/src/app/_services/action-factory.service.ts b/UI/Web/src/app/_services/action-factory.service.tsindex 6f47bd178..b67a162bd 100644--- a/UI/Web/src/app/_services/action-factory.service.ts+++ b/UI/Web/src/app/_services/action-factory.service.ts@@ -17,10 +17,21 @@ export enum Action {Info = 5,RefreshMetadata = 6,Download = 7,+ /**+ * @deprecated This is no longer supported. Use the dedicated page instead+ */Bookmarks = 8,IncognitoRead = 9,AddToReadingList = 10,- AddToCollection = 11+ AddToCollection = 11,+ /**+ * Essentially a download, but handled differently. Needed so card bubbles it up for handling+ */+ DownloadBookmark = 12,+ /**+ * Open Series detail page for said series+ */+ ViewSeries = 13}export interface ActionItem<T> {@@ -47,6 +58,8 @@ export class ActionFactoryService {readingListActions: Array<ActionItem<ReadingList>> = [];+ bookmarkActions: Array<ActionItem<Series>> = [];+isAdmin = false;hasDownloadRole = false;@@ -181,6 +194,12 @@ export class ActionFactoryService {return actions;}+ getBookmarkActions(callback: (action: Action, series: Series) => void) {+ const actions = this.bookmarkActions.map(a => {return {...a}});+ actions.forEach(action => action.callback = callback);+ return actions;+ }+filterBookmarksForFormat(action: ActionItem<Series>, series: Series) {if (action.action === Action.Bookmarks && series?.format === MangaFormat.EPUB) return false;return true;@@ -206,12 +225,6 @@ export class ActionFactoryService {callback: this.dummyCallback,requiresAdmin: false},- {- action: Action.Bookmarks,- title: 'Bookmarks',- callback: this.dummyCallback,- requiresAdmin: false- },{action: Action.AddToReadingList,title: 'Add to Reading List',@@ -241,7 +254,7 @@ export class ActionFactoryService {},{action: Action.IncognitoRead,- title: 'Read in Incognito',+ title: 'Read Incognito',callback: this.dummyCallback,requiresAdmin: false},@@ -268,7 +281,7 @@ export class ActionFactoryService {},{action: Action.IncognitoRead,- title: 'Read in Incognito',+ title: 'Read Incognito',callback: this.dummyCallback,requiresAdmin: false},@@ -294,5 +307,26 @@ export class ActionFactoryService {requiresAdmin: false},];++ this.bookmarkActions = [+ {+ action: Action.ViewSeries,+ title: 'View Series',+ callback: this.dummyCallback,+ requiresAdmin: false+ },+ {+ action: Action.DownloadBookmark,+ title: 'Download',+ callback: this.dummyCallback,+ requiresAdmin: false+ },+ {+ action: Action.Delete,+ title: 'Clear',+ callback: this.dummyCallback,+ requiresAdmin: false+ },+ ]}}diff --git a/UI/Web/src/app/_services/action.service.ts b/UI/Web/src/app/_services/action.service.tsindex b6fc00704..7f05a02d8 100644--- a/UI/Web/src/app/_services/action.service.ts+++ b/UI/Web/src/app/_services/action.service.ts@@ -3,7 +3,6 @@ import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';import { ToastrService } from 'ngx-toastr';import { Subject } from 'rxjs';import { take } from 'rxjs/operators';-import { BookmarksModalComponent } from '../cards/_modals/bookmarks-modal/bookmarks-modal.component';import { BulkAddToCollectionComponent } from '../cards/_modals/bulk-add-to-collection/bulk-add-to-collection.component';import { AddToListModalComponent, ADD_FLOW } from '../reading-list/_modals/add-to-list-modal/add-to-list-modal.component';import { EditReadingListModalComponent } from '../reading-list/_modals/edit-reading-list-modal/edit-reading-list-modal.component';@@ -302,25 +301,6 @@ export class ActionService implements OnDestroy {});}-- openBookmarkModal(series: Series, callback?: SeriesActionCallback) {- if (this.bookmarkModalRef != null) { return; }- this.bookmarkModalRef = this.modalService.open(BookmarksModalComponent, { scrollable: true, size: 'lg' });- this.bookmarkModalRef.componentInstance.series = series;- this.bookmarkModalRef.closed.pipe(take(1)).subscribe(() => {- this.bookmarkModalRef = null;- if (callback) {- callback(series);- }- });- this.bookmarkModalRef.dismissed.pipe(take(1)).subscribe(() => {- this.bookmarkModalRef = null;- if (callback) {- callback(series);- }- });- }-addMultipleToReadingList(seriesId: number, volumes: Array<Volume>, chapters?: Array<Chapter>, callback?: VoidActionCallback) {if (this.readingListModalRef != null) { return; }this.readingListModalRef = this.modalService.open(AddToListModalComponent, { scrollable: true, size: 'md' });@@ -460,7 +440,7 @@ export class ActionService implements OnDestroy {}editReadingList(readingList: ReadingList, callback?: ReadingListActionCallback) {- const readingListModalRef = this.modalService.open(EditReadingListModalComponent, { scrollable: true, size: 'md' });+ const readingListModalRef = this.modalService.open(EditReadingListModalComponent, { scrollable: true, size: 'lg' });readingListModalRef.componentInstance.readingList = readingList;readingListModalRef.closed.pipe(take(1)).subscribe((list) => {if (callback && list !== undefined) {diff --git a/UI/Web/src/app/_services/image.service.ts b/UI/Web/src/app/_services/image.service.tsindex d0abe8c12..a6ab89927 100644--- a/UI/Web/src/app/_services/image.service.ts+++ b/UI/Web/src/app/_services/image.service.ts@@ -1,12 +1,10 @@-import { DOCUMENT } from '@angular/common';-import { Inject, Injectable, OnDestroy } from '@angular/core';+import { Injectable, OnDestroy } from '@angular/core';import { Subject } from 'rxjs';import { takeUntil } from 'rxjs/operators';import { environment } from 'src/environments/environment';-import { ThemeService } from '../theme.service';+import { ThemeService } from './theme.service';import { RecentlyAddedItem } from '../_models/recently-added-item';import { AccountService } from './account.service';-import { NavService } from './nav.service';@Injectable({providedIn: 'root'@@ -75,6 +73,10 @@ export class ImageService implements OnDestroy {return this.baseUrl + 'image/collection-cover?collectionTagId=' + collectionTagId;}+ getReadingListCoverImage(readingListId: number) {+ return this.baseUrl + 'image/readinglist-cover?readingListId=' + readingListId;+ }+getChapterCoverImage(chapterId: number) {return this.baseUrl + 'image/chapter-cover?chapterId=' + chapterId;}diff --git a/UI/Web/src/app/_services/library.service.ts b/UI/Web/src/app/_services/library.service.tsindex 7aea516f0..697de7b1c 100644--- a/UI/Web/src/app/_services/library.service.ts+++ b/UI/Web/src/app/_services/library.service.ts@@ -4,7 +4,6 @@ import { of } from 'rxjs';import { map, take } from 'rxjs/operators';import { environment } from 'src/environments/environment';import { Library, LibraryType } from '../_models/library';-import { SearchResult } from '../_models/search-result';import { SearchResultGroup } from '../_models/search/search-result-group';diff --git a/UI/Web/src/app/_services/message-hub.service.ts b/UI/Web/src/app/_services/message-hub.service.tsindex f53b9681f..852d8a906 100644--- a/UI/Web/src/app/_services/message-hub.service.ts+++ b/UI/Web/src/app/_services/message-hub.service.ts@@ -6,7 +6,7 @@ import { BehaviorSubject, ReplaySubject } from 'rxjs';import { environment } from 'src/environments/environment';import { LibraryModifiedEvent } from '../_models/events/library-modified-event';import { NotificationProgressEvent } from '../_models/events/notification-progress-event';-import { SiteThemeProgressEvent } from '../_models/events/site-theme-progress-event';+import { ThemeProgressEvent } from '../_models/events/theme-progress-event';import { User } from '../_models/user';export enum EVENTS {@@ -53,7 +53,11 @@ export enum EVENTS {/*** A library is created or removed from the instance*/- LibraryModified = 'LibraryModified'+ LibraryModified = 'LibraryModified',+ /**+ * A user updates an entities read progress+ */+ UserProgressUpdate = 'UserProgressUpdate',}export interface Message<T> {@@ -153,7 +157,7 @@ export class MessageHubService {this.hubConnection.on(EVENTS.SiteThemeProgress, resp => {this.messagesSource.next({event: EVENTS.SiteThemeProgress,- payload: resp.body as SiteThemeProgressEvent+ payload: resp.body as ThemeProgressEvent});});@@ -164,6 +168,13 @@ export class MessageHubService {});});+ this.hubConnection.on(EVENTS.UserProgressUpdate, resp => {+ this.messagesSource.next({+ event: EVENTS.UserProgressUpdate,+ payload: resp.body+ });+ });+this.hubConnection.on(EVENTS.Error, resp => {this.messagesSource.next({event: EVENTS.Error,diff --git a/UI/Web/src/app/_services/metadata.service.ts b/UI/Web/src/app/_services/metadata.service.tsindex 878dba34b..f99410894 100644--- a/UI/Web/src/app/_services/metadata.service.ts+++ b/UI/Web/src/app/_services/metadata.service.ts@@ -1,17 +1,15 @@import { HttpClient } from '@angular/common/http';import { Injectable } from '@angular/core';-import { Observable, of } from 'rxjs';+import { of } from 'rxjs';import { map } from 'rxjs/operators';import { environment } from 'src/environments/environment';import { UtilityService } from '../shared/_services/utility.service';-import { TypeaheadSettings } from '../typeahead/typeahead-settings';-import { ChapterMetadata } from '../_models/chapter-metadata';import { Genre } from '../_models/genre';import { AgeRating } from '../_models/metadata/age-rating';import { AgeRatingDto } from '../_models/metadata/age-rating-dto';import { Language } from '../_models/metadata/language';import { PublicationStatusDto } from '../_models/metadata/publication-status-dto';-import { Person, PersonRole } from '../_models/person';+import { Person } from '../_models/person';import { Tag } from '../_models/tag';@Injectable({diff --git a/UI/Web/src/app/_services/nav.service.ts b/UI/Web/src/app/_services/nav.service.tsindex a30e963e6..db1c6b048 100644--- a/UI/Web/src/app/_services/nav.service.ts+++ b/UI/Web/src/app/_services/nav.service.ts@@ -41,6 +41,8 @@ export class NavService {*/showNavBar() {this.renderer.setStyle(this.document.querySelector('body'), 'margin-top', '56px');+ this.renderer.setStyle(this.document.querySelector('body'), 'height', 'calc(var(--vh)*100 - 56px)');+ this.renderer.setStyle(this.document.querySelector('html'), 'height', 'calc(var(--vh)*100 - 56px)');this.navbarVisibleSource.next(true);}@@ -49,6 +51,8 @@ export class NavService {*/hideNavBar() {this.renderer.setStyle(this.document.querySelector('body'), 'margin-top', '0px');+ this.renderer.removeStyle(this.document.querySelector('body'), 'height');+ this.renderer.removeStyle(this.document.querySelector('html'), 'height');this.navbarVisibleSource.next(false);}diff --git a/UI/Web/src/app/_services/reader.service.ts b/UI/Web/src/app/_services/reader.service.tsindex 33a788a88..b41efcb93 100644--- a/UI/Web/src/app/_services/reader.service.ts+++ b/UI/Web/src/app/_services/reader.service.ts@@ -4,6 +4,7 @@ import { environment } from 'src/environments/environment';import { ChapterInfo } from '../manga-reader/_models/chapter-info';import { UtilityService } from '../shared/_services/utility.service';import { Chapter } from '../_models/chapter';+import { BookmarkInfo } from '../_models/manga-reader/bookmark-info';import { PageBookmark } from '../_models/page-bookmark';import { ProgressBookmark } from '../_models/progress-bookmark';import { Volume } from '../_models/volume';@@ -48,6 +49,14 @@ export class ReaderService {return this.httpClient.post(this.baseUrl + 'reader/remove-bookmarks', {seriesId});}+ /**+ * Used exclusively for reading multiple bookmarks from a series+ * @param seriesId+ */+ getBookmarkInfo(seriesId: number) {+ return this.httpClient.get<BookmarkInfo>(this.baseUrl + 'reader/bookmark-info?seriesId=' + seriesId);+ }+getProgress(chapterId: number) {return this.httpClient.get<ProgressBookmark>(this.baseUrl + 'reader/get-progress?chapterId=' + chapterId);}@@ -56,6 +65,10 @@ export class ReaderService {return this.baseUrl + 'reader/image?chapterId=' + chapterId + '&page=' + page;}+ getBookmarkPageUrl(seriesId: number, apiKey: string, page: number) {+ return this.baseUrl + 'reader/bookmark-image?seriesId=' + seriesId + '&page=' + page + '&apiKey=' + encodeURIComponent(apiKey);+ }+getChapterInfo(chapterId: number) {return this.httpClient.get<ChapterInfo>(this.baseUrl + 'reader/chapter-info?chapterId=' + chapterId);}diff --git a/UI/Web/src/app/_services/reading-list.service.ts b/UI/Web/src/app/_services/reading-list.service.tsindex e2c5c6104..dae0708b6 100644--- a/UI/Web/src/app/_services/reading-list.service.ts+++ b/UI/Web/src/app/_services/reading-list.service.ts@@ -2,6 +2,7 @@ import { HttpClient, HttpParams } from '@angular/common/http';import { Injectable } from '@angular/core';import { map } from 'rxjs/operators';import { environment } from 'src/environments/environment';+import { UtilityService } from '../shared/_services/utility.service';import { PaginatedResult } from '../_models/pagination';import { ReadingList, ReadingListItem } from '../_models/reading-list';import { ActionItem } from './action-factory.service';@@ -13,7 +14,7 @@ export class ReadingListService {baseUrl = environment.apiUrl;- constructor(private httpClient: HttpClient) { }+ constructor(private httpClient: HttpClient, private utilityService: UtilityService) { }getReadingList(readingListId: number) {return this.httpClient.get<ReadingList>(this.baseUrl + 'readinglist?readingListId=' + readingListId);@@ -21,11 +22,11 @@ export class ReadingListService {getReadingLists(includePromoted: boolean = true, pageNum?: number, itemsPerPage?: number) {let params = new HttpParams();- params = this._addPaginationIfExists(params, pageNum, itemsPerPage);+ params = this.utilityService.addPaginationIfExists(params, pageNum, itemsPerPage);return this.httpClient.post<PaginatedResult<ReadingList[]>>(this.baseUrl + 'readinglist/lists?includePromoted=' + includePromoted, {}, {observe: 'response', params}).pipe(map((response: any) => {- return this._cachePaginatedResults(response, new PaginatedResult<ReadingList[]>());+ return this.utilityService.createPaginatedResult(response, new PaginatedResult<ReadingList[]>());}));}@@ -86,29 +87,4 @@ export class ReadingListService {if (readingList?.promoted && !isAdmin) return false;return true;}-- _addPaginationIfExists(params: HttpParams, pageNum?: number, itemsPerPage?: number) {- // TODO: Move to utility service- if (pageNum !== null && pageNum !== undefined && itemsPerPage !== null && itemsPerPage !== undefined) {- params = params.append('pageNumber', pageNum + '');- params = params.append('pageSize', itemsPerPage + '');- }- return params;- }-- _cachePaginatedResults(response: any, paginatedVariable: PaginatedResult<any[]>) {- // TODO: Move to utility service- if (response.body === null) {- paginatedVariable.result = [];- } else {- paginatedVariable.result = response.body;- }-- const pageHeader = response.headers.get('Pagination');- if (pageHeader !== null) {- paginatedVariable.pagination = JSON.parse(pageHeader);- }-- return paginatedVariable;- }}diff --git a/UI/Web/src/app/_services/recommendation.service.ts b/UI/Web/src/app/_services/recommendation.service.tsnew file mode 100644index 000000000..ae3360ec3--- /dev/null+++ b/UI/Web/src/app/_services/recommendation.service.ts@@ -0,0 +1,45 @@+import { HttpClient, HttpParams } from '@angular/common/http';+import { Injectable } from '@angular/core';+import { map } from 'rxjs';+import { environment } from 'src/environments/environment';+import { UtilityService } from '../shared/_services/utility.service';+import { PaginatedResult } from '../_models/pagination';+import { Series } from '../_models/series';++@Injectable({+ providedIn: 'root'+})+export class RecommendationService {++ private baseUrl = environment.apiUrl;++ constructor(private httpClient: HttpClient, private utilityService: UtilityService) { }++ getQuickReads(libraryId: number, pageNum?: number, itemsPerPage?: number) {+ let params = new HttpParams();+ params = this.utilityService.addPaginationIfExists(params, pageNum, itemsPerPage);+ return this.httpClient.get<PaginatedResult<Series[]>>(this.baseUrl + 'recommended/quick-reads?libraryId=' + libraryId, {observe: 'response', params})+ .pipe(map(response => this.utilityService.createPaginatedResult(response)));+ }++ getHighlyRated(libraryId: number, pageNum?: number, itemsPerPage?: number) {+ let params = new HttpParams();+ params = this.utilityService.addPaginationIfExists(params, pageNum, itemsPerPage);+ return this.httpClient.get<PaginatedResult<Series[]>>(this.baseUrl + 'recommended/highly-rated?libraryId=' + libraryId, {observe: 'response', params})+ .pipe(map(response => this.utilityService.createPaginatedResult(response)));+ }++ getRediscover(libraryId: number, pageNum?: number, itemsPerPage?: number) {+ let params = new HttpParams();+ params = this.utilityService.addPaginationIfExists(params, pageNum, itemsPerPage);+ return this.httpClient.get<PaginatedResult<Series[]>>(this.baseUrl + 'recommended/rediscover?libraryId=' + libraryId, {observe: 'response', params})+ .pipe(map(response => this.utilityService.createPaginatedResult(response)));+ }++ getMoreIn(libraryId: number, genreId: number, pageNum?: number, itemsPerPage?: number) {+ let params = new HttpParams();+ params = this.utilityService.addPaginationIfExists(params, pageNum, itemsPerPage);+ return this.httpClient.get<PaginatedResult<Series[]>>(this.baseUrl + 'recommended/more-in?libraryId=' + libraryId + '&genreId=' + genreId, {observe: 'response', params})+ .pipe(map(response => this.utilityService.createPaginatedResult(response)));+ }+}diff --git a/UI/Web/src/app/scroll.service.ts b/UI/Web/src/app/_services/scroll.service.tssimilarity index 75%rename from UI/Web/src/app/scroll.service.tsrename to UI/Web/src/app/_services/scroll.service.tsindex 15e00b89d..7c4b07ea2 100644--- a/UI/Web/src/app/scroll.service.ts+++ b/UI/Web/src/app/_services/scroll.service.ts@@ -18,5 +18,12 @@ export class ScrollService {top: top,behavior: 'smooth'});- }+ }++ scrollToX(left: number, el: Element | Window = window) {+ el.scroll({+ left: left,+ behavior: 'auto'+ });+ }}diff --git a/UI/Web/src/app/_services/series.service.ts b/UI/Web/src/app/_services/series.service.tsindex e6c8e1cf2..e62ec97a9 100644--- a/UI/Web/src/app/_services/series.service.ts+++ b/UI/Web/src/app/_services/series.service.ts@@ -3,12 +3,13 @@ import { Injectable } from '@angular/core';import { of } from 'rxjs';import { map } from 'rxjs/operators';import { environment } from 'src/environments/environment';+import { UtilityService } from '../shared/_services/utility.service';import { Chapter } from '../_models/chapter';import { ChapterMetadata } from '../_models/chapter-metadata';import { CollectionTag } from '../_models/collection-tag';import { PaginatedResult } from '../_models/pagination';-import { RecentlyAddedItem } from '../_models/recently-added-item';import { Series } from '../_models/series';+import { RelatedSeries } from '../_models/series-detail/related-series';import { SeriesDetail } from '../_models/series-detail/series-detail';import { SeriesFilter } from '../_models/series-filter';import { SeriesGroup } from '../_models/series-group';@@ -25,43 +26,28 @@ export class SeriesService {paginatedResults: PaginatedResult<Series[]> = new PaginatedResult<Series[]>();paginatedSeriesForTagsResults: PaginatedResult<Series[]> = new PaginatedResult<Series[]>();- constructor(private httpClient: HttpClient, private imageService: ImageService) { }-- _cachePaginatedResults(response: any, paginatedVariable: PaginatedResult<any[]>) {- if (response.body === null) {- paginatedVariable.result = [];- } else {- paginatedVariable.result = response.body;- }-- const pageHeader = response.headers.get('Pagination');- if (pageHeader !== null) {- paginatedVariable.pagination = JSON.parse(pageHeader);- }-- return paginatedVariable;- }+ constructor(private httpClient: HttpClient, private imageService: ImageService, private utilityService: UtilityService) { }getAllSeries(pageNum?: number, itemsPerPage?: number, filter?: SeriesFilter) {let params = new HttpParams();- params = this._addPaginationIfExists(params, pageNum, itemsPerPage);+ params = this.utilityService.addPaginationIfExists(params, pageNum, itemsPerPage);const data = this.createSeriesFilter(filter);return this.httpClient.post<PaginatedResult<Series[]>>(this.baseUrl + 'series/all', data, {observe: 'response', params}).pipe(map((response: any) => {- return this._cachePaginatedResults(response, this.paginatedResults);+ return this.utilityService.createPaginatedResult(response, this.paginatedResults);}));}getSeriesForLibrary(libraryId: number, pageNum?: number, itemsPerPage?: number, filter?: SeriesFilter) {let params = new HttpParams();- params = this._addPaginationIfExists(params, pageNum, itemsPerPage);+ params = this.utilityService.addPaginationIfExists(params, pageNum, itemsPerPage);const data = this.createSeriesFilter(filter);return this.httpClient.post<PaginatedResult<Series[]>>(this.baseUrl + 'series?libraryId=' + libraryId, data, {observe: 'response', params}).pipe(map((response: any) => {- return this._cachePaginatedResults(response, this.paginatedResults);+ return this.utilityService.createPaginatedResult(response, this.paginatedResults);}));}@@ -90,8 +76,12 @@ export class SeriesService {return this.httpClient.get<ChapterMetadata>(this.baseUrl + 'series/chapter-metadata?chapterId=' + chapterId);}- getData(id: number) {- return of(id);+ getSeriesForMangaFile(mangaFileId: number) {+ return this.httpClient.get<Series | null>(this.baseUrl + 'series/series-for-mangafile?mangaFileId=' + mangaFileId);+ }++ getSeriesForChapter(chapterId: number) {+ return this.httpClient.get<Series | null>(this.baseUrl + 'series/series-for-chapter?chapterId=' + chapterId);}delete(seriesId: number) {@@ -121,11 +111,11 @@ export class SeriesService {getRecentlyAdded(libraryId: number = 0, pageNum?: number, itemsPerPage?: number, filter?: SeriesFilter) {const data = this.createSeriesFilter(filter);let params = new HttpParams();- params = this._addPaginationIfExists(params, pageNum, itemsPerPage);+ params = this.utilityService.addPaginationIfExists(params, pageNum, itemsPerPage);return this.httpClient.post<Series[]>(this.baseUrl + 'series/recently-added?libraryId=' + libraryId, data, {observe: 'response', params}).pipe(map(response => {- return this._cachePaginatedResults(response, new PaginatedResult<Series[]>());+ return this.utilityService.createPaginatedResult(response, new PaginatedResult<Series[]>());}));}@@ -133,19 +123,16 @@ export class SeriesService {getRecentlyUpdatedSeries() {return this.httpClient.post<SeriesGroup[]>(this.baseUrl + 'series/recently-updated-series', {});}- getRecentlyAddedChapters() {- return this.httpClient.post<RecentlyAddedItem[]>(this.baseUrl + 'series/recently-added-chapters', {});- }getOnDeck(libraryId: number = 0, pageNum?: number, itemsPerPage?: number, filter?: SeriesFilter) {const data = this.createSeriesFilter(filter);let params = new HttpParams();- params = this._addPaginationIfExists(params, pageNum, itemsPerPage);+ params = this.utilityService.addPaginationIfExists(params, pageNum, itemsPerPage);return this.httpClient.post<Series[]>(this.baseUrl + 'series/on-deck?libraryId=' + libraryId, data, {observe: 'response', params}).pipe(map(response => {- return this._cachePaginatedResults(response, new PaginatedResult<Series[]>());+ return this.utilityService.createPaginatedResult(response, new PaginatedResult<Series[]>());}));}@@ -176,28 +163,36 @@ export class SeriesService {getSeriesForTag(collectionTagId: number, pageNum?: number, itemsPerPage?: number) {let params = new HttpParams();- params = this._addPaginationIfExists(params, pageNum, itemsPerPage);+ params = this.utilityService.addPaginationIfExists(params, pageNum, itemsPerPage);return this.httpClient.get<PaginatedResult<Series[]>>(this.baseUrl + 'series/series-by-collection?collectionId=' + collectionTagId, {observe: 'response', params}).pipe(map((response: any) => {- return this._cachePaginatedResults(response, this.paginatedSeriesForTagsResults);+ return this.utilityService.createPaginatedResult(response, this.paginatedSeriesForTagsResults);}));}+ getRelatedForSeries(seriesId: number) {+ return this.httpClient.get<RelatedSeries>(this.baseUrl + 'series/all-related?seriesId=' + seriesId);+ }++ updateRelationships(seriesId: number, adaptations: Array<number>, characters: Array<number>,+ contains: Array<number>, others: Array<number>, prequels: Array<number>,+ sequels: Array<number>, sideStories: Array<number>, spinOffs: Array<number>,+ alternativeSettings: Array<number>, alternativeVersions: Array<number>, doujinshis: Array<number>) {+ return this.httpClient.post(this.baseUrl + 'series/update-related?seriesId=' + seriesId,+ {seriesId, adaptations, characters, sequels, prequels, contains, others, sideStories, spinOffs,+ alternativeSettings, alternativeVersions, doujinshis});+ }+getSeriesDetail(seriesId: number) {return this.httpClient.get<SeriesDetail>(this.baseUrl + 'series/series-detail?seriesId=' + seriesId);}- _addPaginationIfExists(params: HttpParams, pageNum?: number, itemsPerPage?: number) {- if (pageNum !== null && pageNum !== undefined && itemsPerPage !== null && itemsPerPage !== undefined) {- params = params.append('pageNumber', pageNum + '');- params = params.append('pageSize', itemsPerPage + '');- }- return params;- }+createSeriesFilter(filter?: SeriesFilter) {+ if (filter !== undefined) return filter;const data: SeriesFilter = {formats: [],libraries: [],@@ -228,8 +223,6 @@ export class SeriesService {seriesNameQuery: '',};- if (filter === undefined) return data;-- return filter;+ return data;}}diff --git a/UI/Web/src/app/theme.service.ts b/UI/Web/src/app/_services/theme.service.tssimilarity index 75%rename from UI/Web/src/app/theme.service.tsrename to UI/Web/src/app/_services/theme.service.tsindex bf6c33ba0..23dc8e90c 100644--- a/UI/Web/src/app/theme.service.ts+++ b/UI/Web/src/app/_services/theme.service.ts@@ -4,12 +4,10 @@ import { Inject, Injectable, OnDestroy, Renderer2, RendererFactory2, SecurityConimport { DomSanitizer } from '@angular/platform-browser';import { map, ReplaySubject, Subject, takeUntil } from 'rxjs';import { environment } from 'src/environments/environment';-import { ConfirmService } from './shared/confirm.service';-import { NotificationProgressEvent } from './_models/events/notification-progress-event';-import { SiteThemeProgressEvent } from './_models/events/site-theme-progress-event';-import { SiteTheme, ThemeProvider } from './_models/preferences/site-theme';-import { EVENTS, MessageHubService } from './_services/message-hub.service';-+import { ConfirmService } from '../shared/confirm.service';+import { NotificationProgressEvent } from '../_models/events/notification-progress-event';+import { SiteTheme, ThemeProvider } from '../_models/preferences/site-theme';+import { EVENTS, MessageHubService } from './message-hub.service';@Injectable({@@ -18,6 +16,7 @@ import { EVENTS, MessageHubService } from './_services/message-hub.service';export class ThemeService implements OnDestroy {public defaultTheme: string = 'dark';+ public defaultBookTheme: string = 'Dark';private currentThemeSource = new ReplaySubject<SiteTheme>(1);public currentTheme$ = this.currentThemeSource.asObservable();@@ -33,9 +32,9 @@ export class ThemeService implements OnDestroy {private readonly onDestroy = new Subject<void>();private renderer: Renderer2;private baseUrl = environment.apiUrl;-- constructor(rendererFactory: RendererFactory2, @Inject(DOCUMENT) private document: Document, private httpClient: HttpClient,++ constructor(rendererFactory: RendererFactory2, @Inject(DOCUMENT) private document: Document, private httpClient: HttpClient,messageHub: MessageHubService, private domSantizer: DomSanitizer, private confirmService: ConfirmService) {this.renderer = rendererFactory.createRenderer(null, null);@@ -48,7 +47,7 @@ export class ThemeService implements OnDestroy {if (notificationEvent.name !== EVENTS.SiteThemeProgress) return;if (notificationEvent.eventType === 'ended') {- this.getThemes().subscribe(() => {});+ if (notificationEvent.name === EVENTS.SiteThemeProgress) this.getThemes().subscribe(() => {});}});}@@ -62,6 +61,10 @@ export class ThemeService implements OnDestroy {return getComputedStyle(this.document.body).getPropertyValue('--color-scheme').trim();}+ getCssVariable(variable: string) {+ return getComputedStyle(this.document.body).getPropertyValue(variable).trim();+ }+isDarkTheme() {return this.getColorScheme().toLowerCase() === 'dark';}@@ -74,6 +77,13 @@ export class ThemeService implements OnDestroy {}));}+ /**+ * Used in book reader to remove all themes so book reader can provide custom theming options+ */+ clearThemes() {+ this.unsetThemes();+ }+setDefault(themeId: number) {return this.httpClient.post(this.baseUrl + 'theme/update-default', {themeId: themeId}).pipe(map(() => {// Refresh the cache when a default state is changed@@ -85,8 +95,25 @@ export class ThemeService implements OnDestroy {return this.httpClient.post(this.baseUrl + 'theme/scan', {});}+ /**+ * Sets the book theme on the body tag so css variable overrides can take place+ * @param selector brtheme- prefixed string+ */+ setBookTheme(selector: string) {+ this.unsetBookThemes();+ this.renderer.addClass(this.document.querySelector('body'), selector);+ }++ clearBookTheme() {+ this.unsetBookThemes();+ }- setTheme(themeName: string) {++ /**+ * Sets the theme as active. Will inject a style tag into document to load a custom theme and apply the selector to the body+ * @param themeName+ */+ setTheme(themeName: string) {const theme = this.themeCache.find(t => t.name.toLowerCase() === themeName.toLowerCase());if (theme) {this.unsetThemes();@@ -133,4 +160,10 @@ export class ThemeService implements OnDestroy {private unsetThemes() {this.themeCache.forEach(theme => this.document.body.classList.remove(theme.selector));}++ private unsetBookThemes() {+ Array.from(this.document.body.classList).filter(cls => cls.startsWith('brtheme-')).forEach(c => this.document.body.classList.remove(c));+ }++}diff --git a/UI/Web/src/app/_services/toggle.service.ts b/UI/Web/src/app/_services/toggle.service.tsnew file mode 100644index 000000000..8b335394a--- /dev/null+++ b/UI/Web/src/app/_services/toggle.service.ts@@ -0,0 +1,39 @@+import { Injectable } from '@angular/core';+import { NavigationStart, Router } from '@angular/router';+import { filter, ReplaySubject, take } from 'rxjs';++@Injectable({+ providedIn: 'root'+})+export class ToggleService {++ toggleState: boolean = false;+++ private toggleStateSource: ReplaySubject<boolean> = new ReplaySubject<boolean>(1);+ public toggleState$ = this.toggleStateSource.asObservable();++ constructor(router: Router) {+ router.events+ .pipe(filter(event => event instanceof NavigationStart))+ .subscribe((event) => {+ this.toggleState = false;+ this.toggleStateSource.next(this.toggleState);+ });+ this.toggleStateSource.next(false);+ }++ toggle() {+ this.toggleState = !this.toggleState;+ this.toggleStateSource.pipe(take(1)).subscribe(state => {+ this.toggleState = !state;+ this.toggleStateSource.next(this.toggleState);+ });++ }++ set(state: boolean) {+ this.toggleState = state;+ this.toggleStateSource.next(state);+ }+}diff --git a/UI/Web/src/app/_services/upload.service.ts b/UI/Web/src/app/_services/upload.service.tsindex 7d930e8e6..8f3c1d07a 100644--- a/UI/Web/src/app/_services/upload.service.ts+++ b/UI/Web/src/app/_services/upload.service.ts@@ -30,6 +30,10 @@ export class UploadService {return this.httpClient.post<number>(this.baseUrl + 'upload/collection', {id: tagId, url: this._cleanBase64Url(url)});}+ updateReadingListCoverImage(readingListId: number, url: string) {+ return this.httpClient.post<number>(this.baseUrl + 'upload/reading-list', {id: readingListId, url: this._cleanBase64Url(url)});+ }+updateChapterCoverImage(chapterId: number, url: string) {return this.httpClient.post<number>(this.baseUrl + 'upload/chapter', {id: chapterId, url: this._cleanBase64Url(url)});}diff --git a/UI/Web/src/app/admin/edit-user/edit-user.component.ts b/UI/Web/src/app/admin/edit-user/edit-user.component.tsindex ceec62cae..29b61caa5 100644--- a/UI/Web/src/app/admin/edit-user/edit-user.component.ts+++ b/UI/Web/src/app/admin/edit-user/edit-user.component.ts@@ -1,11 +1,9 @@import { Component, Input, OnInit } from '@angular/core';import { FormGroup, FormControl, Validators } from '@angular/forms';import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';-import { ConfirmService } from 'src/app/shared/confirm.service';import { Library } from 'src/app/_models/library';import { Member } from 'src/app/_models/member';import { AccountService } from 'src/app/_services/account.service';-import { ServerService } from 'src/app/_services/server.service';// TODO: Rename this to EditUserModal@Component({@@ -27,8 +25,7 @@ export class EditUserComponent implements OnInit {public get username() { return this.userForm.get('username'); }public get password() { return this.userForm.get('password'); }- constructor(public modal: NgbActiveModal, private accountService: AccountService, private serverService: ServerService,- private confirmService: ConfirmService) { }+ constructor(public modal: NgbActiveModal, private accountService: AccountService) { }ngOnInit(): void {this.userForm.addControl('email', new FormControl(this.member.email, [Validators.required, Validators.email]));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.htmlindex 495b3f6e9..1164627a7 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@@ -6,7 +6,8 @@</div><div class="modal-body"><p>- Invite a user to your server. Enter their email in and we will send them an email to create an account.+ 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" target="_blank" rel="noopener noreferrer">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 email account manually.</p><form [formGroup]="inviteForm" *ngIf="emailLink === ''">@@ -36,7 +37,7 @@<ng-container *ngIf="emailLink !== ''"><h4>User invited</h4><p>You can use the following link below to setup the account for your user or use the copy button. You may need to log out before using the link to register a new user.- If your server is externallyaccessible, an email will have been sent to the user and the links can be used by them to finish setting up their account.+ If your server is externally accessible, an email will have been sent to the user and the links can be used by them to finish setting up their account.</p><a class="email-link" href="{{emailLink}}" target="_blank">Setup user's account</a><app-api-key title="Invite Url" tooltipText="Copy this and paste in a new tab. You may need to log out." [showRefresh]="false" [transform]="makeLink"></app-api-key>@@ -44,6 +45,10 @@</div><div class="modal-footer">+ <!-- <div class="form-check form-switch">+ <input id="stat-collection" type="checkbox" aria-label="Stat Collection" class="form-check-input" formControlName="allowStatCollection" role="switch">+ <label for="stat-collection" class="form-check-label">Send Data</label>+ </div> --><button type="button" class="btn btn-secondary" (click)="close()">Cancel</button>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.tsindex b5066c99c..13f18b7eb 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@@ -42,7 +42,7 @@ export class InviteUserComponent implements OnInit {invite() {this.isSending = true;- const email = this.inviteForm.get('email')?.value;+ const email = this.inviteForm.get('email')?.value.trim();this.accountService.inviteUser({email,libraries: this.selectedLibraries,diff --git a/UI/Web/src/app/admin/manage-library/manage-library.component.ts b/UI/Web/src/app/admin/manage-library/manage-library.component.tsindex 19a314396..f9791f561 100644--- a/UI/Web/src/app/admin/manage-library/manage-library.component.ts+++ b/UI/Web/src/app/admin/manage-library/manage-library.component.ts@@ -42,8 +42,6 @@ export class ManageLibraryComponent implements OnInit, OnDestroy {distinctUntilChanged((prev: Message<ScanSeriesEvent | NotificationProgressEvent>, curr: Message<ScanSeriesEvent | NotificationProgressEvent>) =>this.hasMessageChanged(prev, curr))).subscribe((event: Message<ScanSeriesEvent | NotificationProgressEvent>) => {- console.log('scan event: ', event);-let libId = 0;if (event.event === EVENTS.ScanSeries) {libId = (event.payload as ScanSeriesEvent).libraryId;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.htmlindex f71101a89..be06070a1 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@@ -40,9 +40,9 @@<div class="mb-3"><label for="stat-collection" class="form-label" aria-describedby="collection-info">Allow Anonymous Usage Collection</label>- <p class="accent" id="collection-info">Send anonymous usage and error information to Kavita's servers. This includes information on your browser, error reporting as well as OS and runtime version. We will use this information to prioritize features, bug fixes, and preformance tuning. Requires restart to take effect.</p>+ <p class="accent" id="collection-info">Send anonymous usage and error information to Kavita's servers. This includes information on your browser, error reporting as well as OS and runtime version. We will use this information to prioritize features, bug fixes, and preformance tuning. Requires restart to take effect. See <a href="https://wiki.kavitareader.com/en/faq" target="_blank" referrerpolicy="no-refer">wiki</a> for what is collected.</p><div class="form-check form-switch">- <input id="stat-collection" type="checkbox" aria-label="Stat Collection" class="form-check-input" formControlName="allowStatCollection">+ <input id="stat-collection" type="checkbox" aria-label="Stat Collection" class="form-check-input" formControlName="allowStatCollection" role="switch"><label for="stat-collection" class="form-check-label">Send Data</label></div></div>@@ -80,7 +80,7 @@<h4>Reoccuring Tasks</h4><div class="mb-3"><label for="settings-tasks-scan" class="form-label">Library Scan</label> <i class="fa fa-info-circle" placement="right" [ngbTooltip]="taskScanTooltip" role="button" tabindex="0"></i>- <ng-template #taskScanTooltip>How often Kavita will scan and refresh metatdata around manga files.</ng-template>+ <ng-template #taskScanTooltip>How often Kavita will scan and refresh metadata around manga files.</ng-template><span class="visually-hidden" id="settings-tasks-scan-help">How often Kavita will scan and refresh metatdata around manga files.</span><select class="form-select" aria-describedby="settings-tasks-scan-help" formControlName="taskScan" id="settings-tasks-scan"><option *ngFor="let freq of taskFrequencies" [value]="freq">{{freq | titlecase}}</option>diff --git a/UI/Web/src/app/all-series/all-series-routing.module.ts b/UI/Web/src/app/all-series/all-series-routing.module.tsnew file mode 100644index 000000000..5e9969b4d--- /dev/null+++ b/UI/Web/src/app/all-series/all-series-routing.module.ts@@ -0,0 +1,20 @@+import { NgModule } from "@angular/core";+import { Routes, RouterModule } from "@angular/router";+import { AuthGuard } from "../_guards/auth.guard";+import { AllSeriesComponent } from "./all-series.component";+const routes: Routes = [+ {path: '**', component: AllSeriesComponent, pathMatch: 'full', canActivate: [AuthGuard]},+ {+ path: '',+ component: AllSeriesComponent,+ runGuardsAndResolvers: 'always',+ canActivate: [AuthGuard],+ }+];+++@NgModule({+ imports: [RouterModule.forChild(routes)],+ exports: [RouterModule]+})+export class AllSeriesRoutingModule { }\ No newline at end of filediff --git a/UI/Web/src/app/all-series/all-series.component.html b/UI/Web/src/app/all-series/all-series.component.htmlindex b47e3258b..198027462 100644--- a/UI/Web/src/app/all-series/all-series.component.html+++ b/UI/Web/src/app/all-series/all-series.component.html@@ -1,6 +1,5 @@-<app-side-nav-companion-bar [hasFilter]="true" [filterOpenByDefault]="filterSettings.openByDefault" (filterOpen)="filterOpen.emit($event)">+<app-side-nav-companion-bar [hasFilter]="true" [filterOpenByDefault]="filterSettings.openByDefault" (filterOpen)="filterOpen.emit($event)" [filterActive]="filterActive"><h2 title>- <app-card-actionables [actions]="actions"></app-card-actionables>All Series</h2><h6 subtitle>{{pagination?.totalItems}} Series</h6>@@ -16,6 +15,8 @@(pageChange)="onPageChange($event)"><ng-template #cardItem let-item let-position="idx">- <app-series-card [data]="item" [libraryId]="item.libraryId" (reload)="loadPage()" (selection)="bulkSelectionService.handleCardSelection('series', position, series.length, $event)" [selected]="bulkSelectionService.isCardSelected('series', position)" [allowSelection]="true"></app-series-card>+ <app-series-card [data]="item" [libraryId]="item.libraryId" (reload)="loadPage()"+ (selection)="bulkSelectionService.handleCardSelection('series', position, series.length, $event)"+ [selected]="bulkSelectionService.isCardSelected('series', position)" [allowSelection]="true"></app-series-card></ng-template></app-card-detail-layout>diff --git a/UI/Web/src/app/all-series/all-series.component.ts b/UI/Web/src/app/all-series/all-series.component.tsindex cfaeba6e2..7c4eab869 100644--- a/UI/Web/src/app/all-series/all-series.component.ts+++ b/UI/Web/src/app/all-series/all-series.component.ts@@ -5,12 +5,12 @@ import { Subject } from 'rxjs';import { take, debounceTime, takeUntil } from 'rxjs/operators';import { BulkSelectionService } from '../cards/bulk-selection.service';import { FilterSettings } from '../metadata-filter/filter-settings';+import { FilterUtilitiesService } from '../shared/_services/filter-utilities.service';import { KEY_CODES, UtilityService } from '../shared/_services/utility.service';-import { Library } from '../_models/library';import { Pagination } from '../_models/pagination';import { Series } from '../_models/series';import { FilterEvent, SeriesFilter } from '../_models/series-filter';-import { ActionItem, Action } from '../_services/action-factory.service';+import { Action } from '../_services/action-factory.service';import { ActionService } from '../_services/action.service';import { EVENTS, Message, MessageHubService } from '../_services/message-hub.service';import { SeriesService } from '../_services/series.service';@@ -25,11 +25,12 @@ export class AllSeriesComponent implements OnInit, OnDestroy {series: Series[] = [];loadingSeries = false;pagination!: Pagination;- actions: ActionItem<Library>[] = [];filter: SeriesFilter | undefined = undefined;onDestroy: Subject<void> = new Subject<void>();filterSettings: FilterSettings = new FilterSettings();filterOpen: EventEmitter<boolean> = new EventEmitter();+ filterActiveCheck!: SeriesFilter;+ filterActive: boolean = false;bulkActionCallback = (action: Action, data: any) => {const selectedSeriesIndexies = this.bulkSelectionService.getSelectedCardsForSource('series');@@ -71,14 +72,15 @@ export class AllSeriesComponent implements OnInit, OnDestroy {constructor(private router: Router, private seriesService: SeriesService,private titleService: Title, private actionService: ActionService,public bulkSelectionService: BulkSelectionService, private hubService: MessageHubService,- private utilityService: UtilityService, private route: ActivatedRoute) {+ private utilityService: UtilityService, private route: ActivatedRoute,+ private filterUtilityService: FilterUtilitiesService) {this.router.routeReuseStrategy.shouldReuseRoute = () => false;-this.titleService.setTitle('Kavita - All Series');- this.pagination = {currentPage: 0, itemsPerPage: 30, totalItems: 0, totalPages: 1};- [this.filterSettings.presets, this.filterSettings.openByDefault] = this.utilityService.filterPresetsFromUrl(this.route.snapshot, this.seriesService.createSeriesFilter());+ this.pagination = this.filterUtilityService.pagination(this.route.snapshot);+ [this.filterSettings.presets, this.filterSettings.openByDefault] = this.filterUtilityService.filterPresetsFromUrl(this.route.snapshot);+ this.filterActiveCheck = this.seriesService.createSeriesFilter();}ngOnInit(): void {@@ -109,20 +111,13 @@ export class AllSeriesComponent implements OnInit, OnDestroy {updateFilter(data: FilterEvent) {this.filter = data.filter;- if (this.pagination !== undefined && this.pagination !== null && !data.isFirst) {- this.pagination.currentPage = 1;- this.onPageChange(this.pagination);- } else {- this.loadPage();- }++ if (!data.isFirst) this.filterUtilityService.updateUrlFromFilter(this.pagination, this.filter);+ this.loadPage();}loadPage() {- // The filter is out of sync with the presets from typeaheads on first load but syncs afterwards- if (this.filter == undefined) {- this.filter = this.seriesService.createSeriesFilter();- }-+ this.filterActive = !this.utilityService.deepEqual(this.filter, this.filterActiveCheck);this.seriesService.getAllSeries(this.pagination?.currentPage, this.pagination?.itemsPerPage, this.filter).pipe(take(1)).subscribe(series => {this.series = series.result;this.pagination = series.pagination;@@ -132,15 +127,9 @@ export class AllSeriesComponent implements OnInit, OnDestroy {}onPageChange(pagination: Pagination) {- window.history.replaceState(window.location.href, '', window.location.href.split('?')[0] + '?page=' + this.pagination.currentPage);+ this.filterUtilityService.updateUrlFromFilter(this.pagination, undefined);this.loadPage();}trackByIdentity = (index: number, item: Series) => `${item.name}_${item.originalName}_${item.localizedName}_${item.pagesRead}`;-- getPage() {- const urlParams = new URLSearchParams(window.location.search);- return urlParams.get('page');- }-}diff --git a/UI/Web/src/app/all-series/all-series.module.ts b/UI/Web/src/app/all-series/all-series.module.tsnew file mode 100644index 000000000..1f6503d9b--- /dev/null+++ b/UI/Web/src/app/all-series/all-series.module.ts@@ -0,0 +1,21 @@+import { NgModule } from '@angular/core';+import { CommonModule } from '@angular/common';+import { AllSeriesComponent } from './all-series.component';+import { AllSeriesRoutingModule } from './all-series-routing.module';+import { SharedSideNavCardsModule } from '../shared-side-nav-cards/shared-side-nav-cards.module';++++@NgModule({+ declarations: [+ AllSeriesComponent+ ],+ imports: [+ CommonModule,+ AllSeriesRoutingModule,++ SharedSideNavCardsModule++ ]+})+export class AllSeriesModule { }diff --git a/UI/Web/src/app/app-routing.module.ts b/UI/Web/src/app/app-routing.module.tsindex 0ea1e0fa0..6a2bfff34 100644--- a/UI/Web/src/app/app-routing.module.ts+++ b/UI/Web/src/app/app-routing.module.ts@@ -1,22 +1,12 @@import { NgModule } from '@angular/core';-import { Routes, RouterModule } from '@angular/router';-import { LibraryDetailComponent } from './library-detail/library-detail.component';-import { SeriesDetailComponent } from './series-detail/series-detail.component';-import { RecentlyAddedComponent } from './recently-added/recently-added.component';-import { UserLoginComponent } from './user-login/user-login.component';+import { Routes, RouterModule, PreloadAllModules } from '@angular/router';import { AuthGuard } from './_guards/auth.guard';import { LibraryAccessGuard } from './_guards/library-access.guard';-import { DashboardComponent } from './dashboard/dashboard.component';-import { AllSeriesComponent } from './all-series/all-series.component';import { AdminGuard } from './_guards/admin.guard';-import { ThemeTestComponent } from './theme-test/theme-test.component';-import { ReadingListsComponent } from './reading-list/reading-lists/reading-lists.component';-import { AllCollectionsComponent } from './collections/all-collections/all-collections.component';// TODO: Once we modularize the components, use this and measure performance impact: https://angular.io/guide/lazy-loading-ngmodules#preloading-modules-+// TODO: Use Prefetching of LazyLoaded Modulesconst routes: Routes = [- {path: '', component: UserLoginComponent},{path: 'admin',canActivate: [AdminGuard],@@ -46,41 +36,53 @@ const routes: Routes = [loadChildren: () => import('../app/announcements/announcements.module').then(m => m.AnnouncementsModule)},{- path: '',+ path: 'bookmarks',+ loadChildren: () => import('../app/bookmark/bookmark.module').then(m => m.BookmarkModule)+ },+ {+ path: 'all-series',+ loadChildren: () => import('../app/all-series/all-series.module').then(m => m.AllSeriesModule)+ },+ {+ path: 'libraries',+ loadChildren: () => import('../app/dashboard/dashboard.module').then(m => m.DashboardModule)+ },+ {+ path: 'library',runGuardsAndResolvers: 'always',canActivate: [AuthGuard, LibraryAccessGuard],children: [- {path: 'library/:id', component: LibraryDetailComponent},- {path: 'library/:libraryId/series/:seriesId', component: SeriesDetailComponent},{- path: 'library/:libraryId/series/:seriesId/manga',+ path: ':libraryId',+ pathMatch: 'full',+ loadChildren: () => import('../app/library-detail/library-detail.module').then(m => m.LibraryDetailModule)+ },+ {+ path: ':libraryId/series/:seriesId',+ pathMatch: 'full',+ loadChildren: () => import('../app/series-detail/series-detail.module').then(m => m.SeriesDetailModule)+ },+ {+ path: ':libraryId/series/:seriesId/manga',loadChildren: () => import('../app/manga-reader/manga-reader.module').then(m => m.MangaReaderModule)},{- path: 'library/:libraryId/series/:seriesId/book',+ path: ':libraryId/series/:seriesId/book',loadChildren: () => import('../app/book-reader/book-reader.module').then(m => m.BookReaderModule)- }+ },]},{- path: '',- runGuardsAndResolvers: 'always',- canActivate: [AuthGuard],- children: [- {path: 'library', component: DashboardComponent},- {path: 'recently-added', component: RecentlyAddedComponent},- {path: 'all-series', component: AllSeriesComponent},-- ]+ path: 'theme',+ loadChildren: () => import('../app/dev-only/dev-only.module').then(m => m.DevOnlyModule)},- {path: 'theme', component: ThemeTestComponent},-- {path: 'login', component: UserLoginComponent}, // TODO: move this to registration module- {path: '**', component: UserLoginComponent, pathMatch: 'full'}+ {path: 'login', loadChildren: () => import('../app/registration/registration.module').then(m => m.RegistrationModule)},+ {path: '**', pathMatch: 'full', redirectTo: 'libraries'},+ {path: '', pathMatch: 'full', redirectTo: 'libraries'},];@NgModule({- imports: [RouterModule.forRoot(routes, {scrollPositionRestoration: 'enabled'})],+ imports: [RouterModule.forRoot(routes, {scrollPositionRestoration: 'enabled', preloadingStrategy: PreloadAllModules})],exports: [RouterModule]})export class AppRoutingModule { }diff --git a/UI/Web/src/app/app.component.html b/UI/Web/src/app/app.component.htmlindex 524a1c29f..ffa817a4b 100644--- a/UI/Web/src/app/app.component.html+++ b/UI/Web/src/app/app.component.html@@ -1,10 +1,10 @@<app-nav-header></app-nav-header>-<div [ngClass]="{'closed' : !(navService?.sideNavCollapsed$ | async), 'content-wrapper': navService.sideNavVisibility$ | async}">+<div [ngClass]="{'closed' : (navService?.sideNavCollapsed$ | async), 'content-wrapper': navService.sideNavVisibility$ | async}"><a id="content"></a>- <app-side-nav *ngIf="navService.sideNavVisibility$ | async"></app-side-nav>- <div class="container-fluid">- <div style="padding-top: 10px; padding-bottom: 65px;" *ngIf="navService.sideNavVisibility$ | async else noSideNav">- <div class="companion-bar" [ngClass]="{'companion-bar-content': (navService?.sideNavCollapsed$ | async)}">+ <app-side-nav *ngIf="navService.sideNavVisibility$ | async as sideNavVisibile"></app-side-nav>+ <div class="container-fluid" [ngClass]="{'g-0': !(navService.sideNavVisibility$ | async)}">+ <div style="padding: 20px 0;" *ngIf="navService.sideNavVisibility$ | async else noSideNav">+ <div class="companion-bar" [ngClass]="{'companion-bar-content': !(navService?.sideNavCollapsed$ | async)}"><router-outlet></router-outlet></div></div>diff --git a/UI/Web/src/app/app.component.ts b/UI/Web/src/app/app.component.tsindex 734c40c1b..01d9baafa 100644--- a/UI/Web/src/app/app.component.ts+++ b/UI/Web/src/app/app.component.ts@@ -35,12 +35,12 @@ export class AppComponent implements OnInit {});}- @HostListener('resize')- onResize() {+ @HostListener('window:resize', ['$event'])+ onResize(){this.setDocHeight();}- @HostListener('orientationchange')+ @HostListener('window:orientationchange', ['$event'])onOrientationChange() {this.setDocHeight();}@@ -62,6 +62,7 @@ export class AppComponent implements OnInit {setDocHeight() {// Sets a CSS variable for the actual device viewport height. Needed for mobile dev.- this.document.documentElement.style.setProperty('--vh', `${window.innerHeight/100}px`);+ let vh = window.innerHeight * 0.01;+ this.document.documentElement.style.setProperty('--vh', `${vh}px`);}}diff --git a/UI/Web/src/app/app.module.ts b/UI/Web/src/app/app.module.tsindex d790f027c..926fb3218 100644--- a/UI/Web/src/app/app.module.ts+++ b/UI/Web/src/app/app.module.ts@@ -1,93 +1,33 @@import { BrowserModule, Title } from '@angular/platform-browser';import { NgModule } from '@angular/core';-import { APP_BASE_HREF } from '@angular/common';import { AppRoutingModule } from './app-routing.module';import { AppComponent } from './app.component';import { BrowserAnimationsModule } from '@angular/platform-browser/animations';-import { FormsModule, ReactiveFormsModule } from '@angular/forms';import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';-import {- NgbAccordionModule, NgbCollapseModule, NgbDropdownModule, NgbNavModule, NgbPaginationModule, NgbPopoverModule, NgbRatingModule, NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap';-import { NavHeaderComponent } from './nav-header/nav-header.component';import { JwtInterceptor } from './_interceptors/jwt.interceptor';-import { UserLoginComponent } from './user-login/user-login.component';import { ToastrModule } from 'ngx-toastr';import { ErrorInterceptor } from './_interceptors/error.interceptor';-import { LibraryComponent } from './library/library.component';-import { SharedModule } from './shared/shared.module';-import { LibraryDetailComponent } from './library-detail/library-detail.component';-import { SeriesDetailComponent } from './series-detail/series-detail.component';-import { ReviewSeriesModalComponent } from './_modals/review-series-modal/review-series-modal.component';-import { CarouselModule } from './carousel/carousel.module';-import { TypeaheadModule } from './typeahead/typeahead.module';-import { RecentlyAddedComponent } from './recently-added/recently-added.component';-import { DashboardComponent } from './dashboard/dashboard.component';-import { CardsModule } from './cards/cards.module';-import { CollectionsModule } from './collections/collections.module';-import { ReadingListModule } from './reading-list/reading-list.module';import { SAVER, getSaver } from './shared/_providers/saver.provider';-import { EventsWidgetComponent } from './events-widget/events-widget.component';-import { SeriesMetadataDetailComponent } from './series-metadata-detail/series-metadata-detail.component';-import { AllSeriesComponent } from './all-series/all-series.component';-import { RegistrationModule } from './registration/registration.module';-import { GroupedTypeaheadComponent } from './grouped-typeahead/grouped-typeahead.component';-import { ThemeTestComponent } from './theme-test/theme-test.component';-import { PipeModule } from './pipe/pipe.module';-import { ColorPickerModule } from 'ngx-color-picker';import { SidenavModule } from './sidenav/sidenav.module';+import { NavModule } from './nav/nav.module';++@NgModule({declarations: [AppComponent,- NavHeaderComponent,- UserLoginComponent,- LibraryComponent,- LibraryDetailComponent,- SeriesDetailComponent,- ReviewSeriesModalComponent,- RecentlyAddedComponent,- DashboardComponent,- EventsWidgetComponent,- SeriesMetadataDetailComponent,- AllSeriesComponent,- GroupedTypeaheadComponent,- ThemeTestComponent,],imports: [HttpClientModule,BrowserModule,AppRoutingModule,BrowserAnimationsModule,- ReactiveFormsModule,- FormsModule, // EditCollection Modal-- NgbDropdownModule, // Nav- NgbPopoverModule, // Nav Events toggle- NgbRatingModule, // Series Detail & Filter- NgbNavModule,- NgbPaginationModule,-- NgbCollapseModule, // Login-- SharedModule,- CarouselModule,- TypeaheadModule,- CardsModule,- CollectionsModule,- ReadingListModule,- RegistrationModule,-- ColorPickerModule, // User preferences-- NgbAccordionModule, // ThemeTest Component only- PipeModule,-- PipeModule,- SidenavModule, // For sidenav+ SidenavModule,+ NavModule,ToastrModule.forRoot({positionClass: 'toast-bottom-right',diff --git a/UI/Web/src/app/book-reader/_models/book-black-theme.ts b/UI/Web/src/app/book-reader/_models/book-black-theme.tsnew file mode 100644index 000000000..cc588fb76--- /dev/null+++ b/UI/Web/src/app/book-reader/_models/book-black-theme.ts@@ -0,0 +1,126 @@+// Important note about themes. Must have one section with .reader-container that contains color, background-color and rest of the styles must be scoped to .book-content+export const BookBlackTheme = `+:root .brtheme-black {+ /* General */+ --color-scheme: dark;+ --bs-body-color: black;+ --hr-color: rgba(239, 239, 239, 0.125);+ --accent-bg-color: rgba(1, 4, 9, 0.5);+ --accent-text-color: lightgrey;+ --body-text-color: #efefef;+ --btn-icon-filter: invert(1) grayscale(100%) brightness(200%);++ /* Drawer */+ --drawer-bg-color: #292929;+ --drawer-text-color: white;+ --drawer-pagination-horizontal-rule: inset 0 -1px 0 rgb(255 255 255 / 20%);+ --drawer-pagination-border: 1px solid rgb(0 0 0 / 13%);+++ /* Accordion */+ --accordion-header-text-color: rgba(74, 198, 148, 0.9);+ --accordion-header-bg-color: rgba(52, 60, 70, 0.5);+ --accordion-body-bg-color: #292929;+ --accordion-body-border-color: rgba(239, 239, 239, 0.125);+ --accordion-body-text-color: var(--body-text-color);+ --accordion-header-collapsed-text-color: rgba(74, 198, 148, 0.9);+ --accordion-header-collapsed-bg-color: #292929;+ --accordion-button-focus-border-color: unset;+ --accordion-button-focus-box-shadow: unset;+ --accordion-active-body-bg-color: #292929;++ /* Buttons */+ --btn-focus-boxshadow-color: rgb(255 255 255 / 50%);+ --btn-primary-text-color: white;+ --btn-primary-bg-color: var(--primary-color);+ --btn-primary-border-color: var(--primary-color);+ --btn-primary-hover-text-color: white;+ --btn-primary-hover-bg-color: var(--primary-color-darker-shade);+ --btn-primary-hover-border-color: var(--primary-color-darker-shade);+ --btn-alt-bg-color: #424c72;+ --btn-alt-border-color: #444f75;+ --btn-alt-hover-bg-color: #3b4466;+ --btn-alt-focus-bg-color: #343c59;+ --btn-alt-focus-boxshadow-color: rgb(255 255 255 / 50%);+ --btn-fa-icon-color: white;+ --btn-disabled-bg-color: #343a40;+ --btn-disabled-text-color: white;+ --btn-disabled-border-color: #6c757d;++ /* Inputs */+ --input-bg-color: #343a40;+ --input-bg-readonly-color: #434648;+ --input-focused-border-color: #ccc;+ --input-text-color: #fff;+ --input-placeholder-color: #aeaeae;+ --input-border-color: #ccc;+ --input-focus-boxshadow-color: rgb(255 255 255 / 50%);++ /* Nav (Tabs) */+ --nav-tab-border-color: rgba(44, 118, 88, 0.7);+ --nav-tab-text-color: var(--body-text-color);+ --nav-tab-bg-color: var(--primary-color);+ --nav-tab-hover-border-color: var(--primary-color);+ --nav-tab-active-text-color: white;+ --nav-tab-border-hover-color: transparent;+ --nav-tab-hover-text-color: var(--body-text-color);+ --nav-tab-hover-bg-color: transparent;+ --nav-tab-border-top: rgba(44, 118, 88, 0.7);+ --nav-tab-border-left: rgba(44, 118, 88, 0.7);+ --nav-tab-border-bottom: rgba(44, 118, 88, 0.7);+ --nav-tab-border-right: rgba(44, 118, 88, 0.7);+ --nav-tab-hover-border-top: rgba(44, 118, 88, 0.7);+ --nav-tab-hover-border-left: rgba(44, 118, 88, 0.7);+ --nav-tab-hover-border-bottom: var(--bs-body-bg);+ --nav-tab-hover-border-right: rgba(44, 118, 88, 0.7);+ --nav-tab-active-hover-bg-color: var(--primary-color);+ --nav-link-bg-color: var(--primary-color);+ --nav-link-active-text-color: white;+ --nav-link-text-color: white;++++ /* Reading Bar */+ --br-actionbar-button-text-color: white;+ --br-actionbar-button-hover-border-color: #6c757d;+ --br-actionbar-bg-color: black;+}+}++++.book-content *:not(input), .book-content *:not(select), .book-content *:not(code), .book-content *:not(:link), .book-content *:not(.ngx-toastr) {+ color: #dcdcdc !important;+}++.book-content code {+ color: #e83e8c !important;+}++.book-content :link, .book-content a {+ color: #8db2e5 !important;+}++.book-content img, .book-content img[src] {+z-index: 1;+filter: brightness(0.85) !important;+background-color: initial !important;+}++.reader-container {+ color: #dcdcdc !important;+ background-image: none !important;+ background-color: black !important;+}++.book-content *:not(code), .book-content *:not(a) {+ background-color: black;+ box-shadow: none;+ text-shadow: none;+ border-radius: unset;+ color: #dcdcdc !important;+}++.book-content :visited, .book-content :visited *, .book-content :visited *[class] {color: rgb(211, 138, 138) !important}+.book-content :link:not(cite), :link .book-content *:not(cite) {color: #8db2e5 !important}+`;\ No newline at end of filediff --git a/UI/Web/src/app/book-reader/_models/book-dark-theme.ts b/UI/Web/src/app/book-reader/_models/book-dark-theme.tsnew file mode 100644index 000000000..cdfcef9f8--- /dev/null+++ b/UI/Web/src/app/book-reader/_models/book-dark-theme.ts@@ -0,0 +1,132 @@+// Important note about themes. Styles must be scoped to .book-content if not css variable overrides+export const BookDarkTheme = `+:root .brtheme-dark {+ /* General */+ --color-scheme: dark;+ --bs-body-color: #292929;+ --hr-color: rgba(239, 239, 239, 0.125);+ --accent-bg-color: rgba(1, 4, 9, 0.5);+ --accent-text-color: lightgrey;+ --body-text-color: #efefef;+ --btn-icon-filter: invert(1) grayscale(100%) brightness(200%);++ /* Drawer */+ --drawer-bg-color: #292929;+ --drawer-text-color: white;+ --drawer-pagination-horizontal-rule: inset 0 -1px 0 rgb(255 255 255 / 20%);+ --drawer-pagination-border: 1px solid rgb(0 0 0 / 13%);++ /* Accordion */+ --accordion-header-text-color: rgba(74, 198, 148, 0.9);+ --accordion-header-bg-color: rgba(52, 60, 70, 0.5);+ --accordion-body-bg-color: #292929;+ --accordion-body-border-color: rgba(239, 239, 239, 0.125);+ --accordion-body-text-color: var(--body-text-color);+ --accordion-header-collapsed-text-color: rgba(74, 198, 148, 0.9);+ --accordion-header-collapsed-bg-color: #292929;+ --accordion-button-focus-border-color: unset;+ --accordion-button-focus-box-shadow: unset;+ --accordion-active-body-bg-color: #292929;++ /* Buttons */+ --btn-focus-boxshadow-color: rgb(255 255 255 / 50%);+ --btn-primary-text-color: white;+ --btn-primary-bg-color: var(--primary-color);+ --btn-primary-border-color: var(--primary-color);+ --btn-primary-hover-text-color: white;+ --btn-primary-hover-bg-color: var(--primary-color-darker-shade);+ --btn-primary-hover-border-color: var(--primary-color-darker-shade);+ --btn-alt-bg-color: #424c72;+ --btn-alt-border-color: #444f75;+ --btn-alt-hover-bg-color: #3b4466;+ --btn-alt-focus-bg-color: #343c59;+ --btn-alt-focus-boxshadow-color: rgb(255 255 255 / 50%);+ --btn-fa-icon-color: white;+ --btn-disabled-bg-color: #343a40;+ --btn-disabled-text-color: white;+ --btn-disabled-border-color: #6c757d;++ /* Inputs */+ --input-bg-color: #343a40;+ --input-bg-readonly-color: #434648;+ --input-focused-border-color: #ccc;+ --input-text-color: #fff;+ --input-placeholder-color: #aeaeae;+ --input-border-color: #ccc;+ --input-focus-boxshadow-color: rgb(255 255 255 / 50%);++ /* Nav (Tabs) */+ --nav-tab-border-color: rgba(44, 118, 88, 0.7);+ --nav-tab-text-color: var(--body-text-color);+ --nav-tab-bg-color: var(--primary-color);+ --nav-tab-hover-border-color: var(--primary-color);+ --nav-tab-active-text-color: white;+ --nav-tab-border-hover-color: transparent;+ --nav-tab-hover-text-color: var(--body-text-color);+ --nav-tab-hover-bg-color: transparent;+ --nav-tab-border-top: rgba(44, 118, 88, 0.7);+ --nav-tab-border-left: rgba(44, 118, 88, 0.7);+ --nav-tab-border-bottom: rgba(44, 118, 88, 0.7);+ --nav-tab-border-right: rgba(44, 118, 88, 0.7);+ --nav-tab-hover-border-top: rgba(44, 118, 88, 0.7);+ --nav-tab-hover-border-left: rgba(44, 118, 88, 0.7);+ --nav-tab-hover-border-bottom: var(--bs-body-bg);+ --nav-tab-hover-border-right: rgba(44, 118, 88, 0.7);+ --nav-tab-active-hover-bg-color: var(--primary-color);+ --nav-link-bg-color: var(--primary-color);+ --nav-link-active-text-color: white;+ --nav-link-text-color: white;++ /* Checkboxes/Switch */+ --checkbox-checked-bg-color: var(--primary-color);+ --checkbox-border-color: var(--input-focused-border-color);+ --checkbox-focus-border-color: var(--primary-color);+ --checkbox-focus-boxshadow-color: rgb(255 255 255 / 50%);++++ /* Reading Bar */+ --br-actionbar-button-text-color: white;+ --br-actionbar-button-hover-border-color: #6c757d;+ --br-actionbar-bg-color: black;++}++++.book-content *:not(input), .book-content *:not(select), .book-content *:not(code), .book-content *:not(:link), .book-content *:not(.ngx-toastr) {+ color: #dcdcdc !important;+}++.book-content code {+ color: #e83e8c !important;+}++.book-content :link, .book-content a {+ color: #8db2e5 !important;+}++.book-content img, .book-content img[src] {+z-index: 1;+filter: brightness(0.85) !important;+background-color: initial !important;+}++.reader-container {+ color: #dcdcdc !important;+ background-image: none !important;+ background-color: #292929 !important;+}++.book-content *:not(code), .book-content *:not(a) {+ background-color: #292929;+ box-shadow: none;+ text-shadow: none;+ border-radius: unset;+ color: #dcdcdc !important;+}++.book-content :visited, .book-content :visited *, .book-content :visited *[class] {color: rgb(211, 138, 138) !important}+.book-content :link:not(cite), :link .book-content *:not(cite) {color: #8db2e5 !important}++`;\ No newline at end of filediff --git a/UI/Web/src/app/book-reader/_models/book-white-theme.ts b/UI/Web/src/app/book-reader/_models/book-white-theme.tsnew file mode 100644index 000000000..6b38dce13--- /dev/null+++ b/UI/Web/src/app/book-reader/_models/book-white-theme.ts@@ -0,0 +1,15 @@+// Important note about themes. Must have one section with .reader-container that contains color, background-color and rest of the styles must be scoped to .book-content+export const BookWhiteTheme = `+ :root .brtheme-white {+ --br-actionbar-bg-color: white;++ /* Drawer */+ --drawer-pagination-horizontal-rule: inset 0 -1px 0 rgb(0 0 0 / 13%);+ --drawer-pagination-border: 1px solid rgb(0 0 0 / 13%);+ }+ .reader-container {+ color: black !important;+ background-image: none !important;+ background-color: white !important;+ }+`;\ No newline at end of filediff --git a/UI/Web/src/app/book-reader/_models/theme-font.ts b/UI/Web/src/app/book-reader/_models/theme-font.tsnew file mode 100644index 000000000..06d3648dd--- /dev/null+++ b/UI/Web/src/app/book-reader/_models/theme-font.ts@@ -0,0 +1,15 @@+/**+ * A font family to inject into the book reader+ */+export interface ThemeFont {+ /**+ * Name/Font-family+ */+ fontFamily: string;+ /**+ * Where the font is loaded from?+ */+ fontSrc: string;+ format: 'truetype';++}\ No newline at end of filediff --git a/UI/Web/src/app/book-reader/book-reader.module.ts b/UI/Web/src/app/book-reader/book-reader.module.tsindex a572d1a96..50bd0060b 100644--- a/UI/Web/src/app/book-reader/book-reader.module.ts+++ b/UI/Web/src/app/book-reader/book-reader.module.ts@@ -5,12 +5,14 @@ import { BookReaderRoutingModule } from './book-reader.router.module';import { SharedModule } from '../shared/shared.module';import { SafeStylePipe } from './safe-style.pipe';import { ReactiveFormsModule } from '@angular/forms';-import { NgbProgressbarModule, NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap';import { PipeModule } from '../pipe/pipe.module';+import { NgbAccordionModule, NgbNavModule, NgbProgressbarModule, NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap';+import { TableOfContentsComponent } from './table-of-contents/table-of-contents.component';+import { ReaderSettingsComponent } from './reader-settings/reader-settings.component';@NgModule({- declarations: [BookReaderComponent, SafeStylePipe],+ declarations: [BookReaderComponent, SafeStylePipe, TableOfContentsComponent, ReaderSettingsComponent],imports: [CommonModule,BookReaderRoutingModule,@@ -19,6 +21,9 @@ import { PipeModule } from '../pipe/pipe.module';NgbProgressbarModule,NgbTooltipModule,PipeModule,+ NgbTooltipModule,+ NgbAccordionModule, // Drawer+ NgbNavModule, // Drawer], exports: [BookReaderComponent,SafeStylePipediff --git a/UI/Web/src/app/book-reader/book-reader/book-reader.component.html b/UI/Web/src/app/book-reader/book-reader/book-reader.component.htmlindex 93446c1d0..7750b91b5 100644--- a/UI/Web/src/app/book-reader/book-reader/book-reader.component.html+++ b/UI/Web/src/app/book-reader/book-reader/book-reader.component.html@@ -1,136 +1,112 @@-<div class="container-flex {{darkMode ? 'dark-mode' : ''}} reader-container" tabindex="0" #reader>+<div class="container-flex {{darkMode ? 'dark-mode' : ''}} reader-container {{ColumnLayout}}" 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>- <app-drawer #commentDrawer="drawer" [isOpen]="drawerOpen" [style.--drawer-width]="'300px'" [options]="{topOffset: topOffset}" [style.--drawer-background-color]="drawerBackgroundColor" (drawerClosed)="closeDrawer()">- <div header>- <h2 style="margin-top: 0.5rem">Book Settings- <button type="button" class="btn-close" aria-label="Close" (click)="commentDrawer.close()"></button>- </h2>- </div>- <div body class="drawer-body">- <div class="control-container">- <div class="controls">-- <form [formGroup]="settingsForm">- <div class="mb-3">- <label for="library-type" class="form-label">Font Family</label>- <select class="form-control" id="library-type" formControlName="bookReaderFontFamily">- <option [value]="opt" *ngFor="let opt of fontFamilies; let i = index">{{opt | titlecase}}</option>- </select>+ <app-drawer #commentDrawer="drawer" [(isOpen)]="drawerOpen" [options]="{topOffset: topOffset}">+ <h5 header>+ Book Settings+ </h5>+ <div subheader>+ <div class="pagination-cont">+ <ng-container *ngIf="layoutMode !== BookPageLayoutMode.Default">+ <div class="virt-pagination-cont">+ <div class="g-0 text-center">+ Page</div>- </form>- </div>- <div class="controls">- <label id="fontsize" class="form-label">Font Size</label>- <button (click)="updateFontSize(-10)" class="btn btn-icon" title="Decrease" aria-labelledby="fontsize"><i class="fa fa-minus" aria-hidden="true"></i></button>- <span>{{pageStyles['font-size']}}</span>- <button (click)="updateFontSize(10)" class="btn btn-icon" title="Increase" aria-labelledby="fontsize"><i class="fa fa-plus" aria-hidden="true"></i></button>- </div>- <div class="controls">- <label id="linespacing" class="form-label">Line Spacing</label>- <button (click)="updateLineSpacing(-10)" class="btn btn-icon" title="Decrease" aria-labelledby="linespacing"><i class="fa fa-minus" aria-hidden="true"></i></button>- <span>{{pageStyles['line-height']}}</span>- <button (click)="updateLineSpacing(10)" class="btn btn-icon" title="Increase" aria-labelledby="linespacing"><i class="fa fa-plus" aria-hidden="true"></i></button>- </div>- <div class="controls">- <label id="margin" class="form-label">Margin</label>- <button (click)="updateMargin(-5)" class="btn btn-icon" title="Remove Margin" aria-labelledby="margin"><i class="fa fa-minus" aria-hidden="true"></i></button>- <span>{{pageStyles['margin-right']}}</span>- <button (click)="updateMargin(5)" class="btn btn-icon" title="Add Margin" aria-labelledby="margin"><i class="fa fa-plus" aria-hidden="true"></i></button>- </div>- <div class="controls">- <label id="readingdirection" class="form-label">Reading Direction</label>- <button (click)="toggleReadingDirection()" class="btn btn-icon" aria-labelledby="readingdirection" title="{{readingDirection === 0 ? 'Left to Right' : 'Right to Left'}}"><i class="fa {{readingDirection === 0 ? 'fa-arrow-right' : 'fa-arrow-left'}} " aria-hidden="true"></i><span class="d-none d-sm-block"> {{readingDirection === 0 ? 'Left to Right' : 'Right to Left'}}</span></button>- </div>- <div class="controls">- <label id="darkmode" class="form-label">Dark Mode</label>- <button (click)="toggleDarkMode(false)" class="btn btn-icon" aria-labelledby="darkmode" title="Off"><i class="fa fa-sun" aria-hidden="true"></i></button>- <button (click)="toggleDarkMode(true)" class="btn btn-icon" aria-labelledby="darkmode" title="On"><i class="fa fa-moon" aria-hidden="true"></i></button>- </div>- <div class="controls">- <label id="tap-pagination" class="form-label">Tap Pagination <i class="fa fa-info-circle" aria-hidden="true" placement="top" [ngbTooltip]="tapPaginationTooltip" role="button" tabindex="0" aria-describedby="tap-pagination-help"></i></label>- <ng-template #tapPaginationTooltip>The ability to click the sides of the page to page left and right</ng-template>- <span class="visually-hidden" id="tap-pagination-help">The ability to click the sides of the page to page left and right</span>- <button (click)="toggleClickToPaginate()" class="btn btn-icon" aria-labelledby="tap-pagination"><i class="fa fa-arrows-alt-h {{clickToPaginate ? 'icon-primary-color' : ''}}" aria-hidden="true"></i> {{clickToPaginate ? 'On' : 'Off'}}</button>- </div>- <div class="controls">- <label id="fullscreen" class="form-label">Fullscreen <i class="fa fa-info-circle" aria-hidden="true" placement="top" [ngbTooltip]="fullscreenTooltip" role="button" tabindex="0" aria-describedby="fullscreen-help"></i></label>- <ng-template #fullscreenTooltip>Put reader in fullscreen mode</ng-template>- <span class="visually-hidden" id="fullscreen-help">- <ng-container [ngTemplateOutlet]="fullscreenTooltip"></ng-container>- </span>- <button (click)="toggleFullscreen()" class="btn btn-icon" aria-labelledby="fullscreen">- <i class="fa {{this.isFullscreen ? 'fa-compress-alt' : 'fa-expand-alt'}} {{isFullscreen ? 'icon-primary-color' : ''}}" aria-hidden="true"></i>- <span *ngIf="darkMode"> {{isFullscreen ? 'Exit' : 'Enter'}}</span>- </button>- </div>- <div class="row g-0 justify-content-between">- <button (click)="resetSettings()" class="btn btn-primary col">Reset to Defaults</button>- </div>- </div>- <div class="row g-0">- <button class="btn btn-small btn-icon col-1" style="padding-left: 0px" [disabled]="prevChapterDisabled" (click)="loadPrevChapter()" title="Prev Chapter/Volume"><i class="fa fa-fast-backward" aria-hidden="true"></i></button>- <div class="col-1 page-stub ps-1">{{pageNum}}</div>- <div class="col-8 pe-1" style="margin-top: 15px">- <ngb-progressbar style="cursor: pointer" title="Go to page" (click)="goToPage()" type="primary" height="5px" [value]="pageNum" [max]="maxPages - 1"></ngb-progressbar>- </div>- <div class="col-1 btn-icon page-stub pe-1" (click)="goToPage(maxPages - 1)" title="Go to last page">{{maxPages - 1}}</div>- <button class="btn btn-small btn-icon col-1" style="padding-right: 0px; padding-left: 0px" [disabled]="nextChapterDisabled" (click)="loadNextChapter()" title="Next Chapter/Volume"><i class="fa fa-fast-forward" aria-hidden="true"></i></button>- </div>- <div class="table-of-contents">- <h3>Table of Contents</h3>- <div *ngIf="chapters.length === 0">- <em>This book does not have Table of Contents set in the metadata or a toc file</em>+ <div class="d-flex align-items-center justify-content-between text-center row g-0" *ngIf="getVirtualPage() as vp" >+ <button class="btn btn-small btn-icon col-1" (click)="prevPage()" title="Prev Page">+ <i class="fa-solid fa-caret-left" aria-hidden="true"></i>+ </button>+ <div class="col-1">{{vp[0]}}</div>+ <div class="col-8">+ <ngb-progressbar title="virtual pages" type="primary" height="5px" (click)="loadPage()" [value]="vp[0]" [max]="vp[1]"></ngb-progressbar>+ </div>+ <div class="col-1 btn-icon" (click)="loadPage()" title="Go to last page">{{vp[1]}}</div>+ <button class="btn btn-small btn-icon col-1" (click)="nextPage()" title="Next Page"><i class="fa-solid fa-caret-right" aria-hidden="true"></i></button>+ </div>+ </div>+ </ng-container>++ <div class="g-0 text-center">+ Section</div>- <div *ngIf="chapters.length === 1; else nestedChildren">- <ul>- <li *ngFor="let chapter of chapters[0].children">- <a href="javascript:void(0);" (click)="loadChapterPage(chapter.page, chapter.part)">{{chapter.title}}</a>- </li>- </ul>+ <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-8">+ <ngb-progressbar style="cursor: pointer" title="Go to page" (click)="goToPage()" type="primary" height="5px" [value]="pageNum" [max]="maxPages - 1"></ngb-progressbar>+ </div>+ <div class="col-1 btn-icon" (click)="goToPage(maxPages - 1)" title="Go to last page">{{maxPages - 1}}</div>+ <button class="btn btn-small btn-icon col-1" [disabled]="nextChapterDisabled" (click)="loadNextChapter()" title="Next Chapter/Volume"><i class="fa fa-fast-forward" aria-hidden="true"></i></button></div>- <ng-template #nestedChildren>- <ul *ngFor="let chapterGroup of chapters" class="chapter-title">- <li class="{{chapterGroup.page == pageNum ? 'active': ''}}" (click)="loadChapterPage(chapterGroup.page, '')">- {{chapterGroup.title}}- </li>- <ul *ngFor="let chapter of chapterGroup.children">- <li class="{{cleanIdSelector(chapter.part) === currentPageAnchor ? 'active' : ''}}">- <a href="javascript:void(0);" (click)="loadChapterPage(chapter.page, chapter.part)">{{chapter.title}}</a>- </li>- </ul>- </ul>- </ng-template></div></div>+ <div body class="drawer-body">+ <nav role="navigation">+ <ul ngbNav #nav="ngbNav" [(activeId)]="activeTabId" class="reader-pills nav nav-pills mb-2" [destroyOnHide]="false">+ <li [ngbNavItem]="TabID.Settings">+ <a ngbNavLink>Settings</a>+ <ng-template ngbNavContent>+ <app-reader-settings+ (colorThemeUpdate)="updateColorTheme($event)"+ (styleUpdate)="updateReaderStyles($event)"+ (clickToPaginateChanged)="showPaginationOverlay($event)"+ (fullscreen)="toggleFullscreen()"+ (layoutModeUpdate)="updateLayoutMode($event)"+ (readingDirection)="updateReadingDirection($event)"+ (immersiveMode)="updateImmersiveMode($event)"+ ></app-reader-settings>+ </ng-template>+ </li>++ <li [ngbNavItem]="TabID.TableOfContents">+ <a ngbNavLink>Table of Contents</a>+ <ng-template ngbNavContent>+ <app-table-of-contents [chapters]="chapters" [chapterId]="chapterId" [pageNum]="pageNum" [currentPageAnchor]="currentPageAnchor" (loadChapter)="loadChapterPage($event)"></app-table-of-contents>+ </ng-template>+ </li>+ </ul>+ </nav>+ <div [ngbNavOutlet]="nav" class="mt-3"></div>+ </div></app-drawer></div>- <div #readingSection class="reading-section" [ngStyle]="{'padding-top': topOffset + 20 + 'px'}"- [@isLoading]="isLoading ? true : false" (click)="handleReaderClick($event)">+ <div #readingSection class="reading-section {{ColumnLayout}}" [@isLoading]="isLoading ? true : false">++ <ng-container *ngIf="clickToPaginate">+ <div class="left {{clickOverlayClass('left')}} no-observe"+ (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"+ (click)="movePage(readingDirection === ReadingDirection.LeftToRight ? PAGING_DIRECTION.FORWARD : PAGING_DIRECTION.BACKWARDS)"+ tabindex="-1" [ngStyle]="{height: PageHeightForPagination}"></div>+ </ng-container>++ <div class="book-container {{ColumnLayout}}">- <div #readingHtml class="book-content" [ngStyle]="{'padding-bottom': topOffset + 20 + 'px', 'margin': '0px 0px'}"- [innerHtml]="page" *ngIf="page !== undefined"></div>+ <div #readingHtml class="book-content {{ColumnLayout}}" [ngStyle]="{'max-height': ColumnHeight, 'column-width': ColumnWidth}"+ [innerHtml]="page" *ngIf="page !== undefined" (click)="toggleMenu($event)" (mousedown)="mouseDown($event)"></div>- <div class="left {{clickOverlayClass('left')}} no-observe" (click)="prevPage()" *ngIf="clickToPaginate" tabindex="-1"></div>- <div class="{{scrollbarNeeded ? 'right-with-scrollbar' : 'right'}} {{clickOverlayClass('right')}} no-observe" (click)="nextPage()" *ngIf="clickToPaginate" tabindex="-1"></div>- <div *ngIf="page !== undefined && scrollbarNeeded" (click)="$event.stopPropagation();">- <ng-container [ngTemplateOutlet]="actionBar"></ng-container>+ <div *ngIf="page !== undefined && (scrollbarNeeded || layoutMode !== BookPageLayoutMode.Default)" (click)="$event.stopPropagation();">+ <ng-container [ngTemplateOutlet]="actionBar"></ng-container>+ </div></div></div><ng-template #actionBar>- <div class="reading-bar row g-0 justify-content-between">- <button class="btn btn-outline-secondary btn-icon col-2 col-xs-1" (click)="prevPage()"- [disabled]="IsPrevDisabled"+ <div class="action-bar row g-0 justify-content-between" *ngIf="!immersiveMode || drawerOpen || actionBarVisible">+ <button class="btn btn-outline-secondary btn-icon col-2 col-xs-1" (click)="movePage(readingDirection === ReadingDirection.LeftToRight ? PAGING_DIRECTION.BACKWARDS : PAGING_DIRECTION.FORWARD)"+ [disabled]="readingDirection === ReadingDirection.LeftToRight ? IsPrevDisabled : IsNextDisabled"title="{{readingDirection === ReadingDirection.LeftToRight ? 'Previous' : 'Next'}} Page">- <i class="fa {{(readingDirection === ReadingDirection.LeftToRight ? IsPrevChapter : IsNextChapter) ? 'fa-angle-double-left' : 'fa-angle-left'}}" aria-hidden="true"></i>- <span class="d-none d-sm-block"> {{readingDirection === ReadingDirection.LeftToRight ? 'Previous' : 'Next'}}</span>+ <i class="fa {{(readingDirection === ReadingDirection.LeftToRight ? IsPrevChapter : IsNextChapter) ? 'fa-angle-double-left' : 'fa-angle-left'}} {{readingDirection === ReadingDirection.RightToLeft ? 'next-page-highlight' : ''}}" aria-hidden="true"></i>+ </button>+ <button *ngIf="!this.adhocPageHistory.isEmpty()" class="btn btn-outline-secondary btn-icon col-2 col-xs-1" (click)="goBack()" title="Go Back">+ <i class="fa fa-reply" aria-hidden="true"></i></button>- <button *ngIf="!this.adhocPageHistory.isEmpty()" class="btn btn-outline-secondary btn-icon col-2 col-xs-1" (click)="goBack()" title="Go Back"><i class="fa fa-reply" aria-hidden="true"></i><span class="d-none d-sm-block"> Go Back</span></button>- <button class="btn btn-secondary col-2 col-xs-1" (click)="toggleDrawer()"><i class="fa fa-bars" aria-hidden="true"></i><span class="d-none d-sm-block">Settings {{drawerOpen}}</span></button>+ <button class="btn btn-secondary col-2 col-xs-1" (click)="toggleDrawer()">+ <i class="fa fa-bars" aria-hidden="true"></i></button><div class="book-title col-2 d-none d-sm-block"><ng-container *ngIf="isLoading; else showTitle"><div class="spinner-border spinner-border-sm text-primary" style="border-radius: 50%;" role="status">@@ -138,16 +114,15 @@</div></ng-container><ng-template #showTitle>- <span class="book-title-text">{{bookTitle}}</span><span *ngIf="incognitoMode" (click)="turnOffIncognito()" role="button" aria-label="Incognito mode is on. Toggle to turn off.">(<i class="fa fa-glasses" aria-hidden="true"></i><span class="visually-hidden">Incognito Mode</span>)</span>+ <span class="book-title-text ms-1" [ngbTooltip]="bookTitle">{{bookTitle}}</span></ng-template></div>- <button class="btn btn-secondary col-2 col-xs-1" (click)="closeReader()"><i class="fa fa-times-circle" aria-hidden="true"></i><span class="d-none d-sm-block"> Close</span></button>+ <button class="btn btn-secondary col-2 col-xs-1" (click)="closeReader()"><i class="fa fa-times-circle" aria-hidden="true"></i></button><button class="btn btn-outline-secondary btn-icon col-2 col-xs-1"- [disabled]="IsNextDisabled"- (click)="nextPage()" title="{{readingDirection === ReadingDirection.LeftToRight ? 'Next' : 'Previous'}} Page">- <i class="fa {{(readingDirection === ReadingDirection.LeftToRight ? IsNextChapter : IsPrevChapter) ? 'fa-angle-double-right' : 'fa-angle-right'}}" aria-hidden="true"></i>- <span class="d-none d-sm-block">{{readingDirection === ReadingDirection.LeftToRight ? 'Next' : 'Previous'}} </span>+ [disabled]="readingDirection === ReadingDirection.LeftToRight ? IsNextDisabled : IsPrevDisabled"+ (click)="movePage(readingDirection === ReadingDirection.LeftToRight ? PAGING_DIRECTION.FORWARD : PAGING_DIRECTION.BACKWARDS)" title="{{readingDirection === ReadingDirection.LeftToRight ? 'Next' : 'Previous'}} Page">+ <i class="fa {{(readingDirection === ReadingDirection.LeftToRight ? IsNextChapter : IsPrevChapter) ? 'fa-angle-double-right' : 'fa-angle-right'}} {{readingDirection === ReadingDirection.LeftToRight ? 'next-page-highlight' : ''}}" aria-hidden="true"></i></button></div></ng-template>diff --git a/UI/Web/src/app/book-reader/book-reader/book-reader.component.scss b/UI/Web/src/app/book-reader/book-reader/book-reader.component.scssindex 1d70b604d..3eb8a3a7f 100644--- a/UI/Web/src/app/book-reader/book-reader/book-reader.component.scss+++ b/UI/Web/src/app/book-reader/book-reader/book-reader.component.scss@@ -28,144 +28,213 @@src: url(../../../assets/fonts/RocknRoll_One/RocknRollOne-Regular.ttf) format("truetype");}+@font-face {+ font-family: "OpenDyslexic2";+ src: url(../../../assets/fonts/OpenDyslexic2/OpenDyslexic-Regular.otf) format("opentype");+}++:root {+ --br-actionbar-button-text-color: #6c757d;+ --accordion-body-bg-color: black;+ --accordion-header-bg-color: grey;+ --br-actionbar-button-hover-border-color: #6c757d;+ --br-actionbar-bg-color: white;+}++$dark-form-background-no-opacity: rgb(1, 4, 9);$primary-color: #0062cc;+$action-bar-height: 38px;++// Drawer.control-container {padding-bottom: 5px;}-.table-of-contents li {- cursor: pointer;-- &.active {- font-weight: bold;- }-}-.page-stub {margin-top: 6px;padding-left: 2px;padding-right: 2px;}+.drawer-body {+ .reader-pills {+ justify-content: center;+ margin: 0 0.25rem;++ li a {+ border: 1px solid var(--primary-color);+ margin: 0 0.25rem;++ .active {+ border: unset;+ }+ }+ }+}++// Drawer End+.fixed-top {z-index: 1022;}-.dark-mode {+.dark-mode .overlay {+ opacity: 0;+}++::ng-deep .bg-warning {+ background-color: yellow;+}- color: #dcdcdc !important;- background-image: none !important;- background-color: #292929 !important;- *:not(code), *:not(a) {- background-color: #292929;- box-shadow: none;- text-shadow: none;- border-radius: unset;- color: #dcdcdc !important;+.action-bar {+ 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;+ height: $action-bar-height;++ .book-title-text {+ text-align: center;+ text-overflow: ellipsis;+ display: -webkit-box;+ -webkit-line-clamp: 1;+ -webkit-box-orient: vertical;+ overflow: hidden;+ }++ @media(max-width: 875px) {+ .book-title {+ display: none;+ }+ }++ .book-title {+ margin-top: 10px;+ text-align: center;+ text-transform: capitalize;+ max-height: inherit;}- *:not(input), *:not(code), *:not(:link) {- color: #dcdcdc !important;+ .next-page-highlight {+ color: var(--primary-color);}+}- code {- color: #e83e8c !important;+.reader-container {+ outline: none; // Only the reading section itself shouldn't receive any outline. We use it to shift focus in fullscreen mode+ overflow: auto;+ height: calc(var(--vh, 1vh) * 100);+ position: relative;++ &.column-layout-1 {+ height: calc(var(--vh) * 100);}- .btn-icon {- background-color: transparent;+ &.column-layout-2 {+ height: calc(var(--vh) * 100);}+}++.reading-section {+ width: 100%;+ //overflow: auto; // This will break progress reporting+ height: 100vh;+ padding-top: $action-bar-height;+ position: relative;- :link, a {- color: #8db2e5 !important;+ &.column-layout-1 {+ height: calc((var(--vh, 1vh) * 100) - $action-bar-height);}- img, img[src] {- z-index: 1;- filter: brightness(0.85) !important;- background-color: initial !important;+ &.column-layout-2 {+ height: calc((var(--vh, 1vh) * 100) - $action-bar-height);}-- :visited, :visited *, :visited *[class] {color: rgb(211, 138, 138) !important}- :link:not(cite), :link *:not(cite) {color: #8db2e5 !important}}-.reading-bar {- background-color: white;- overflow: hidden;- box-shadow: 0 0 6px 0 rgb(0 0 0 / 70%);-}+.book-container {+ position: relative;+ height: 100%;-.dark-mode {- .reading-bar, .book-title, .drawer-body, .drawer-container {- background-color: $dark-form-background-no-opacity;- }- button {- background-color: $dark-form-background-no-opacity;+ &.column-layout-1 {+ height: calc((var(--vh, 1vh) * 100) - $action-bar-height);}- .btn {- &.btn-secondary {- border-color: transparent;-- &:hover, &:focus {- border-color: #545b62;- }- }-- &.btn-outline-secondary {- border-color: transparent;-- &:hover, &:focus {- border-color: #545b62;- }- }-- span {- background-color: unset;- }-- i {- background-color: unset;- }+ &.column-layout-2 {+ height: calc((var(--vh, 1vh) * 100) - $action-bar-height);}}-::ng-deep .dark-mode .drawer-container {- .header, body, *:not(.progress-bar) {- background-color: $dark-form-background-no-opacity !important;+.book-content {+ position: relative;+ padding: 20px 0;+ margin: 0px 0px;++ &.column-layout-1 {+ height: calc((var(--vh) * 100) - calc($action-bar-height * 2));}-}-@media(max-width: 875px) {- .book-title {- display: none;+ &.column-layout-2 {+ height: calc((var(--vh) * 100) - calc($action-bar-height * 2));}--}-.book-title {- margin-top: 10px;- text-align: center;- text-transform: capitalize;+ a, :link {+ color: var(--brtheme-link-text-color);+ }++ background-color: var(--brtheme-bg-color);}-.reading-section {- max-height: 100vh;- width: 100%;- //overflow: auto; // This will break progress reporting+.pagination-cont {+ background: var(--br-actionbar-bg-color);+ border-radius: 5px;+ padding: 5px 15px;+ margin: 0 0 5px;+ border: var(--drawer-pagination-border);}-.reader-container {- outline: none; // Only the reading section itself shouldn't receive any outline. We use it to shift focus in fullscreen mode- overflow: auto;+.virt-pagination-cont {+ padding-bottom: 5px;+ margin-bottom: 5px;+ box-shadow: var(--drawer-pagination-horizontal-rule);}-.book-content {- position: relative;+++// This is essentially fitting the text to height and when you press next you are scrolling over by page width+.column-layout-1 {+ .book-content {+ column-count: 1;+ column-gap: 20px;+ overflow: hidden;+ word-break: break-word;+ overflow-wrap: break-word;++ &.debug {+ column-rule: 20px solid rebeccapurple;+ }+ }+++}++.column-layout-2 {+ .book-content {+ column-count: 2;+ column-gap: 20px;+ overflow: hidden;+ word-break: break-word;+ overflow-wrap: break-word;++ &.debug {+ column-rule: 20px solid rebeccapurple;+ }+ }+++}// A bunch of resets so books render correctly@@ -175,18 +244,15 @@ $primary-color: #0062cc;}}-.drawer-body {- padding-bottom: 20px;-}-.chapter-title {- padding-inline-start: 0px-}--::ng-deep .scale-width {+// This is applied to images in the backend+::ng-deep .kavita-scale-width {max-width: 100%;object-fit: contain;object-position: top center;+ break-inside: avoid;+ break-before: column;+ max-height: 100vh;}@@ -195,48 +261,43 @@ $primary-color: #0062cc;color: $primary-color;}-.dark-mode .overlay {- opacity: 0;-}.right {- position: fixed;+ position: absolute;right: 0px; // with scrollbar: 17px- top: 0px;+ top: $action-bar-height;width: 20%; // with scrollbar: 18%- height: 100%;+z-index: 2;cursor: pointer;- opacity: 0;background: transparent;}// This class pushes the click area to the left a bit to let users click the scrollbar.right-with-scrollbar {- position: fixed;+ position: absolute;right: 17px;- top: 0px;+ top: $action-bar-height;width: 18%;- height: 100%;z-index: 2;cursor: pointer;- opacity: 0;background: transparent;}.left {- position: fixed;+ position: absolute;left: 0px;- top: 0px;+ top: $action-bar-height;width: 20%;- height: 100%;+ background: transparent;+z-index: 2;cursor: pointer;- opacity: 0;- background: transparent;}++.highlight {background-color: rgba(65, 225, 100, 0.5) !important;animation: fadein .5s both;@@ -246,14 +307,17 @@ $primary-color: #0062cc;animation: fadein .5s both;}+++.btn {&.btn-secondary {- color: #6c757d;+ color: var(--br-actionbar-button-text-color);border-color: transparent;background-color: unset;&:hover, &:focus {- border-color: #545b62;+ border-color: var(--br-actionbar-button-hover-border-color);}}@@ -262,18 +326,18 @@ $primary-color: #0062cc;background-color: unset;&:hover, &:focus {- border-color: #545b62;+ border-color: var(--br-actionbar-button-hover-border-color); // #545b62;}}span {background-color: unset;- color: #6c757d;+ color: var(--br-actionbar-button-text-color); // #6c757d;}i {background-color: unset;- color: #6c757d;+ color: var(--br-actionbar-button-text-color);}&:active {diff --git a/UI/Web/src/app/book-reader/book-reader/book-reader.component.ts b/UI/Web/src/app/book-reader/book-reader/book-reader.component.tsindex e8657e2aa..0607ea408 100644--- a/UI/Web/src/app/book-reader/book-reader/book-reader.component.ts+++ b/UI/Web/src/app/book-reader/book-reader/book-reader.component.ts@@ -1,18 +1,15 @@import { AfterViewInit, Component, ElementRef, HostListener, Inject, OnDestroy, OnInit, Renderer2, RendererStyleFlags2, ViewChild } from '@angular/core';import {DOCUMENT, Location} from '@angular/common';-import { FormControl, FormGroup } from '@angular/forms';import { ActivatedRoute, Router } from '@angular/router';import { ToastrService } from 'ngx-toastr';-import { forkJoin, fromEvent, Subject } from 'rxjs';-import { debounceTime, take, takeUntil } from 'rxjs/operators';+import { forkJoin, fromEvent, of, Subject } from 'rxjs';+import { catchError, debounceTime, take, takeUntil, tap } from 'rxjs/operators';import { Chapter } from 'src/app/_models/chapter';-import { User } from 'src/app/_models/user';import { AccountService } from 'src/app/_services/account.service';import { NavService } from 'src/app/_services/nav.service';import { ReaderService } from 'src/app/_services/reader.service';import { SeriesService } from 'src/app/_services/series.service';import { DomSanitizer, SafeHtml } from '@angular/platform-browser';-import { BookService } from '../book.service';import { KEY_CODES, UtilityService } from 'src/app/shared/_services/utility.service';import { BookChapterItem } from '../_models/book-chapter-item';@@ -20,19 +17,22 @@ 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 { ScrollService } from 'src/app/scroll.service';import { MangaFormat } from 'src/app/_models/manga-format';import { LibraryService } from 'src/app/_services/library.service';import { LibraryType } from 'src/app/_models/library';-import { ThemeService } from 'src/app/theme.service';+import { BookTheme } from 'src/app/_models/preferences/book-theme';+import { BookPageLayoutMode } from 'src/app/_models/book-page-layout-mode';+import { PageStyle } from '../reader-settings/reader-settings.component';+import { User } from 'src/app/_models/user';+import { ThemeService } from 'src/app/_services/theme.service';+import { ScrollService } from 'src/app/_services/scroll.service';+import { PAGING_DIRECTION } from 'src/app/manga-reader/_models/reader-enums';+import { LayoutMode } from 'src/app/manga-reader/_models/layout-mode';-interface PageStyle {- 'font-family': string;- 'font-size': string;- 'line-height': string;- 'margin-left': string;- 'margin-right': string;+enum TabID {+ Settings = 1,+ TableOfContents = 2}interface HistoryPoint {@@ -40,7 +40,7 @@ interface HistoryPoint {scrollOffset: number;}-const TOP_OFFSET = -50 * 1.5; // px the sticky header takes up+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 heightconst CHAPTER_ID_NOT_FETCHED = -2;const CHAPTER_ID_DOESNT_EXIST = -1;@@ -77,6 +77,8 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {volumeId!: number;chapterId!: number;chapter!: Chapter;+ user!: User;+/*** Reading List id. Defaults to -1.*/@@ -86,43 +88,68 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {* If this is true, no progress will be saved.*/incognitoMode: boolean = false;-+/**- * If this is true, chapters will be fetched in the order of a reading list, rather than natural series order.+ * If this is true, chapters will be fetched in the order of a reading list, rather than natural series order.*/readingListMode: boolean = false;+ /**+ * The actual pages from the epub, used for showing on table of contents. This must be here as we need access to it for scroll anchors+ */chapters: Array<BookChapterItem> = [];-+ /**+ * Current Page+ */pageNum = 0;+ /**+ * Max Pages+ */maxPages = 1;+ /**+ * This allows for exploration into different chapters+ */adhocPageHistory: Stack<HistoryPoint> = new Stack<HistoryPoint>();/*** A stack of the chapter ids we come across during continuous reading mode. When we traverse a boundary, we use this to avoid extra API calls.* @see Stack*/- continuousChaptersStack: Stack<number> = new Stack();-- user!: User;+ continuousChaptersStack: Stack<number> = new Stack(); // 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)+ /**+ * Belongs to the drawer component+ */+ activeTabId: TabID = TabID.Settings;+ /**+ * Belongs to drawer component+ */drawerOpen = false;- isLoading = true;+ /**+ * If the action bar is visible+ */+ actionBarVisible = true;+ /**+ * Book reader setting that hides the menuing system+ */+ immersiveMode: boolean = false;+ /**+ * If we are loading from backend+ */+ isLoading = true;+ /**+ * Title of the book. Rendered in action bars+ */bookTitle: string = '';- settingsForm: FormGroup = new FormGroup({});- clickToPaginate = false;-+ /**+ * The boolean that decides if the clickToPaginate overlay is visible or not.+ */clickToPaginateVisualOverlay = false;clickToPaginateVisualOverlayTimeout: any = undefined; // For animationclickToPaginateVisualOverlayTimeout2: any = undefined; // For kicking off animation, giving enough time to render html-- page: SafeHtml | undefined = undefined; // This is the html we get from the server- styles: SafeHtml | undefined = undefined; // This is the css we get from the server-- @ViewChild('readingHtml', {static: false}) readingHtml!: ElementRef<HTMLDivElement>;- @ViewChild('readingSection', {static: false}) readingSectionElemRef!: ElementRef<HTMLDivElement>;- @ViewChild('stickyTop', {static: false}) stickyTopElemRef!: ElementRef<HTMLDivElement>;- @ViewChild('reader', {static: true}) reader!: ElementRef;-+ /**+ * This is the html we get from the server+ */+ page: SafeHtml | undefined = undefined;/*** Next Chapter Id. This is not garunteed to be a valid ChapterId. Prefetched on page load (non-blocking).*/@@ -157,29 +184,28 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {nextPageDisabled = false;/**- * Internal property used to capture all the different css properties to render on all elements+ * Internal property used to capture all the different css properties to render on all elements. This is a cached version that is updated from reader-settings component*/pageStyles!: PageStyle;+/**- * List of all font families user can select from+ * Offset for drawer and rendering canvas. Fixed to 62px.*/- fontFamilies: Array<string> = [];--- darkMode = false;- backgroundColor: string = 'white';- readerStyles: string = '';- darkModeStyleElem!: HTMLElement;- topOffset: number = 0; // Offset for drawer and rendering canvas+ topOffset: number = 38;/*** 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*/scrollbarNeeded = false;readingDirection: ReadingDirection = ReadingDirection.LeftToRight;-- private readonly onDestroy = new Subject<void>();-+ clickToPaginate = false;+ /**+ * Used solely for fullscreen to apply a hack+ */+ darkMode = true;+ /**+ * A anchors that map to the page number. When you click on one of these, we will load a given page up for the user.+ */pageAnchors: {[n: string]: number } = {};currentPageAnchor: string = '';/**@@ -190,182 +216,218 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {* Library Type used for rendering chapter or issue*/libraryType: LibraryType = LibraryType.Book;+ /**+ * If the web browser is in fullscreen mode+ */+ isFullscreen: boolean = false;/**- * Hack: Override background color for reader and restore it onDestroy+ * How to render the page content*/- originalBodyColor: string | undefined;+ layoutMode: BookPageLayoutMode = BookPageLayoutMode.Default;/**- * If the web browser is in fullscreen mode+ * Width of the document (in non-column layout), used for column layout virtual paging*/- isFullscreen: boolean = false;+ windowWidth: number = 0;+ windowHeight: number = 0;- darkModeStyles = `- *:not(input), *:not(select), *:not(code), *:not(:link), *:not(.ngx-toastr) {- color: #dcdcdc !important;- }+ /**+ * used to track if a click is a drag or not, for opening menu+ */+ mousePosition = {+ x: 0,+ y: 0+ };- code {- color: #e83e8c !important;- }+ /**+ * Used to keep track of direction user is paging, to help with virtual paging on column layout+ */+ pagingDirection: PAGING_DIRECTION = PAGING_DIRECTION.FORWARD;- :link, a {- color: #8db2e5 !important;- }+ private readonly onDestroy = new Subject<void>();- img, img[src] {- z-index: 1;- filter: brightness(0.85) !important;- background-color: initial !important;- }- `;+ @ViewChild('readingHtml', {static: false}) readingHtml!: ElementRef<HTMLDivElement>;+ @ViewChild('readingSection', {static: false}) readingSectionElemRef!: ElementRef<HTMLDivElement>;+ @ViewChild('stickyTop', {static: false}) stickyTopElemRef!: ElementRef<HTMLDivElement>;+ @ViewChild('reader', {static: true}) reader!: ElementRef;++++++ get BookPageLayoutMode() {+ return BookPageLayoutMode;+ }++ get TabID(): typeof TabID {+ return TabID;+ }get ReadingDirection(): typeof ReadingDirection {return ReadingDirection;}+ get PAGING_DIRECTION() {+ return PAGING_DIRECTION;+ }++ /**+ * Disables the Left most button+ */get IsPrevDisabled(): boolean {if (this.readingDirection === ReadingDirection.LeftToRight) {// Acting as Previous button- return this.prevPageDisabled && this.pageNum === 0;- } else {- // Acting as a Next button- return this.nextPageDisabled && this.pageNum + 1 > this.maxPages - 1;+ return this.isPrevPageDisabled();}++ // Acting as a Next button+ return this.isNextPageDisabled();}get IsNextDisabled(): boolean {if (this.readingDirection === ReadingDirection.LeftToRight) {// Acting as Next button- return this.nextPageDisabled && this.pageNum + 1 > this.maxPages - 1;- } else {- // Acting as Previous button- return this.prevPageDisabled && this.pageNum === 0;+ return this.isNextPageDisabled();}+ // Acting as Previous button+ return this.isPrevPageDisabled();+ }++ isNextPageDisabled() {+ const [currentVirtualPage, totalVirtualPages, _] = this.getVirtualPage();+ const condition = (this.nextPageDisabled || this.nextChapterId === CHAPTER_ID_DOESNT_EXIST) && this.pageNum + 1 > this.maxPages - 1;+ if (this.layoutMode !== BookPageLayoutMode.Default) {+ return condition && currentVirtualPage === totalVirtualPages;+ }+ return condition;+ }++ isPrevPageDisabled() {+ const [currentVirtualPage,,] = this.getVirtualPage();+ const condition = (this.prevPageDisabled || this.prevChapterId === CHAPTER_ID_DOESNT_EXIST) && this.pageNum === 0;+ if (this.layoutMode !== BookPageLayoutMode.Default) {+ return condition && currentVirtualPage === 0;+ }+ return condition;}+ /**+ * Determines if we show >> or >+ */get IsNextChapter(): boolean {- return this.pageNum + 1 >= this.maxPages;+ if (this.layoutMode === BookPageLayoutMode.Default) {+ return this.pageNum + 1 >= this.maxPages;+ }++ const [currentVirtualPage, totalVirtualPages, _] = this.getVirtualPage();+ if (this.readingHtml == null) return this.pageNum + 1 >= this.maxPages;++ return this.pageNum + 1 >= this.maxPages && (currentVirtualPage === totalVirtualPages);}+ /**+ * Determines if we show << or <+ */get IsPrevChapter(): boolean {- return this.pageNum === 0;+ if (this.layoutMode === BookPageLayoutMode.Default) {+ return this.pageNum === 0;+ }++ const [currentVirtualPage,,] = this.getVirtualPage();+ if (this.readingHtml == null) return this.pageNum + 1 >= this.maxPages;++ return this.pageNum === 0 && (currentVirtualPage === 0);+ }++ get ColumnWidth() {+ switch (this.layoutMode) {+ case BookPageLayoutMode.Default:+ return 'unset';+ case BookPageLayoutMode.Column1:+ return (this.windowWidth /2) + 'px';+ case BookPageLayoutMode.Column2:+ return ((this.windowWidth / 4)) + 'px';+ }+ }++ get ColumnHeight() {+ if (this.layoutMode !== BookPageLayoutMode.Default) {+ // Take the height after page loads, subtract the top/bottom bar+ return this.windowHeight - (this.topOffset *2) + 'px';+ }+ return 'unset';+ }++ get ColumnLayout() {+ switch (this.layoutMode) {+ case BookPageLayoutMode.Default:+ return '';+ case BookPageLayoutMode.Column1:+ return 'column-layout-1';+ case BookPageLayoutMode.Column2:+ return 'column-layout-2';+ }}- get drawerBackgroundColor() {- return this.darkMode ? '#010409': '#fff';+ get PageHeightForPagination() {+ if (this.layoutMode === BookPageLayoutMode.Default) {+ return (this.readingSectionElemRef?.nativeElement?.scrollHeight || 0) - (this.topOffset * 2) + 'px';+ }++ return this.ColumnHeight;}+constructor(private route: ActivatedRoute, private router: Router, private accountService: AccountService,private seriesService: SeriesService, private readerService: ReaderService, private location: Location,- private renderer: Renderer2, private navService: NavService, private toastr: ToastrService,+ private renderer: Renderer2, private navService: NavService, private toastr: ToastrService,private domSanitizer: DomSanitizer, private bookService: BookService, private memberService: MemberService,private scrollService: ScrollService, private utilityService: UtilityService, private libraryService: LibraryService,@Inject(DOCUMENT) private document: Document, private themeService: ThemeService) {this.navService.hideNavBar();+ this.themeService.clearThemes();this.navService.hideSideNav();-- this.darkModeStyleElem = this.renderer.createElement('style');- this.darkModeStyleElem.innerHTML = this.darkModeStyles;- this.fontFamilies = this.bookService.getFontFamilies();-- this.accountService.currentUser$.pipe(take(1)).subscribe(user => {- if (user) {- this.user = user;-- if (this.user.preferences.bookReaderFontFamily === undefined) {- this.user.preferences.bookReaderFontFamily = 'default';- }- if (this.user.preferences.bookReaderFontSize === undefined) {- this.user.preferences.bookReaderFontSize = 100;- }- if (this.user.preferences.bookReaderLineSpacing === undefined) {- this.user.preferences.bookReaderLineSpacing = 100;- }- if (this.user.preferences.bookReaderMargin === undefined) {- this.user.preferences.bookReaderMargin = 0;- }- if (this.user.preferences.bookReaderReadingDirection === undefined) {- this.user.preferences.bookReaderReadingDirection = ReadingDirection.LeftToRight;- }-- this.readingDirection = this.user.preferences.bookReaderReadingDirection;-- this.clickToPaginate = this.user.preferences.bookReaderTapToPaginate;-- this.settingsForm.addControl('bookReaderFontFamily', new FormControl(user.preferences.bookReaderFontFamily, []));-- this.settingsForm.get('bookReaderFontFamily')!.valueChanges.pipe(takeUntil(this.onDestroy)).subscribe(changes => {- this.updateFontFamily(changes);- });- }-- const bodyNode = this.document.querySelector('body');- if (bodyNode !== undefined && bodyNode !== null) {- this.originalBodyColor = bodyNode.style.background;- }- this.resetSettings();- });}/**- * After the page has loaded, setup the scroll handler. The scroll handler has 2 parts. One is if there are page anchors setup (aka page anchor elements linked with the- * table of content) then we calculate what has already been reached and grab the last reached one to save progress. If page anchors aren't setup (toc missing), then try to save progress+ * After the page has loaded, setup the scroll handler. The scroll handler has 2 parts. One is if there are page anchors setup (aka page anchor elements linked with the+ * table of content) then we calculate what has already been reached and grab the last reached one to save progress. If page anchors aren't setup (toc missing), then try to save progress* based on the last seen scroll part (xpath).*/ngAfterViewInit() {// check scroll offset and if offset is after any of the "id" markers, save progressfromEvent(this.reader.nativeElement, 'scroll')- .pipe(debounceTime(200), takeUntil(this.onDestroy)).subscribe((event) => {+ .pipe(+ debounceTime(200),+ takeUntil(this.onDestroy))+ .subscribe((event) => {if (this.isLoading) return;- // Highlight the current chapter we are on- if (Object.keys(this.pageAnchors).length !== 0) {- // get the height of the document so we can capture markers that are halfway on the document viewport- const verticalOffset = this.scrollService.scrollPosition + (this.document.body.offsetHeight / 2);-- const alreadyReached = Object.values(this.pageAnchors).filter((i: number) => i <= verticalOffset);- if (alreadyReached.length > 0) {- this.currentPageAnchor = Object.keys(this.pageAnchors)[alreadyReached.length - 1];- } else {- this.currentPageAnchor = '';- }- }+ this.handleScrollEvent();+ });+ }-- // Find the element that is on screen to bookmark against- const intersectingEntries = Array.from(this.readingSectionElemRef.nativeElement.querySelectorAll('div,o,p,ul,li,a,img,h1,h2,h3,h4,h5,h6,span'))- .filter(element => !element.classList.contains('no-observe'))- .filter(entry => {- return this.utilityService.isInViewport(entry, this.topOffset);- });-- intersectingEntries.sort((a: Element, b: Element) => {- const aTop = a.getBoundingClientRect().top;- const bTop = b.getBoundingClientRect().top;- if (aTop < bTop) {- return -1;- }- if (aTop > bTop) {- return 1;- }-- return 0;- });-- if (intersectingEntries.length > 0) {- let path = this.getXPathTo(intersectingEntries[0]);- if (path === '') { return; }- if (!path.startsWith('id')) {- path = '//html[1]/' + path;- }- this.lastSeenScrollPartPath = path;- }+ handleScrollEvent() {+ // Highlight the current chapter we are on+ if (Object.keys(this.pageAnchors).length !== 0) {+ // get the height of the document so we can capture markers that are halfway on the document viewport+ const verticalOffset = this.scrollService.scrollPosition + (this.document.body.offsetHeight / 2);- if (this.lastSeenScrollPartPath !== '') {- this.saveProgress();- }- });+ const alreadyReached = Object.values(this.pageAnchors).filter((i: number) => i <= verticalOffset);+ if (alreadyReached.length > 0) {+ this.currentPageAnchor = Object.keys(this.pageAnchors)[alreadyReached.length - 1];+ } else {+ this.currentPageAnchor = '';+ }+ }++ // Find the element that is on screen to bookmark against+ const xpath: string | null | undefined = this.getFirstVisibleElementXPath();+ if (xpath !== null && xpath !== undefined) this.lastSeenScrollPartPath = xpath;++ if (this.lastSeenScrollPartPath !== '') {+ this.saveProgress();+ }}saveProgress() {@@ -381,28 +443,17 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {}ngOnDestroy(): void {- const bodyNode = this.document.querySelector('body');- if (bodyNode !== undefined && bodyNode !== null && this.originalBodyColor !== undefined) {- bodyNode.style.background = this.originalBodyColor;- this.themeService.currentTheme$.pipe(take(1)).subscribe(theme => {- this.themeService.setTheme(theme.name);- });- }- this.navService.showNavBar();- this.navService.showSideNav();+ this.clearTimeout(this.clickToPaginateVisualOverlayTimeout);+ this.clearTimeout(this.clickToPaginateVisualOverlayTimeout2);- const head = this.document.querySelector('head');- this.renderer.removeChild(head, this.darkModeStyleElem);+ this.themeService.clearBookTheme();- if (this.clickToPaginateVisualOverlayTimeout !== undefined) {- clearTimeout(this.clickToPaginateVisualOverlayTimeout);- this.clickToPaginateVisualOverlayTimeout = undefined;- }- if (this.clickToPaginateVisualOverlayTimeout2 !== undefined) {- clearTimeout(this.clickToPaginateVisualOverlayTimeout2);- this.clickToPaginateVisualOverlayTimeout2 = undefined;- }+ this.themeService.currentTheme$.pipe(take(1)).subscribe(theme => {+ this.themeService.setTheme(theme.name);+ });+ this.navService.showNavBar();+ this.navService.showSideNav();this.readerService.exitFullscreen();this.onDestroy.next();@@ -415,7 +466,7 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {const chapterId = this.route.snapshot.paramMap.get('chapterId');if (libraryId === null || seriesId === null || chapterId === null) {- this.router.navigateByUrl('/library');+ this.router.navigateByUrl('/libraries');return;}@@ -439,7 +490,12 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {}});- this.init();+ this.accountService.currentUser$.pipe(take(1)).subscribe(user => {+ if (user) {+ this.user = user;+ this.init();+ }+ });}init() {@@ -449,11 +505,13 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {this.prevChapterDisabled = false;this.nextChapterPrefetched = false;++this.bookService.getBookInfo(this.chapterId).subscribe(info => {this.bookTitle = info.bookTitle;-+if (this.readingListMode && info.seriesFormat !== MangaFormat.EPUB) {- // Redirect to the manga reader.+ // Redirect to the manga reader.const params = this.readerService.getQueryParamsObject(this.incognitoMode, this.readingListMode, this.readingListId);this.router.navigate(['library', info.libraryId, 'series', info.seriesId, 'manga', this.chapterId], {queryParams: params});return;@@ -463,40 +521,51 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {chapter: this.seriesService.getChapter(this.chapterId),progress: this.readerService.getProgress(this.chapterId),chapters: this.bookService.getBookChapters(this.chapterId),- }).pipe(take(1)).subscribe(results => {+ }).subscribe(results => {this.chapter = results.chapter;this.volumeId = results.chapter.volumeId;this.maxPages = results.chapter.pages;this.chapters = results.chapters;this.pageNum = results.progress.pageNum;--+ if (results.progress.bookScrollId) this.lastSeenScrollPartPath = results.progress.bookScrollId;+++this.continuousChaptersStack.push(this.chapterId);this.libraryService.getLibraryType(this.libraryId).pipe(take(1)).subscribe(type => {this.libraryType = type;});---++ // We need to think about if the user modified this and this function call is a continuous reader one+ //this.updateLayoutMode(this.user.preferences.bookReaderLayoutMode || BookPageLayoutMode.Default);+ this.updateImagesWithHeight();++if (this.pageNum >= this.maxPages) {this.pageNum = this.maxPages - 1;this.saveProgress();}-+this.readerService.getNextChapter(this.seriesId, this.volumeId, this.chapterId, this.readingListId).pipe(take(1)).subscribe(chapterId => {this.nextChapterId = chapterId;if (chapterId === CHAPTER_ID_DOESNT_EXIST || chapterId === this.chapterId) {this.nextChapterDisabled = true;+ this.nextChapterPrefetched = true;+ return;}+ this.setPageNum(this.pageNum);});this.readerService.getPrevChapter(this.seriesId, this.volumeId, this.chapterId, this.readingListId).pipe(take(1)).subscribe(chapterId => {this.prevChapterId = chapterId;if (chapterId === CHAPTER_ID_DOESNT_EXIST || chapterId === this.chapterId) {this.prevChapterDisabled = true;+ this.prevChapterPrefetched = true; // If there is no prev chapter, then mark it as prefetched+ return;}+ this.setPageNum(this.pageNum);});-+// Check if user progress has part, if so load it so we scroll to itthis.loadPage(results.progress.bookScrollId || undefined);}, () => {@@ -505,22 +574,41 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {}, 200);});});+ }++ @HostListener('window:resize', ['$event'])+ onResize(event: any){+ // Update the window Height+ this.updateWidthAndHeightCalcs();-+ const resumeElement = this.getFirstVisibleElementXPath();+ if (this.layoutMode !== BookPageLayoutMode.Default && resumeElement !== null && resumeElement !== undefined) {+ this.scrollTo(resumeElement); // This works pretty well, but not perfect+ }+ }++ @HostListener('window:orientationchange', ['$event'])+ onOrientationChange() {+ // Update the window Height+ this.updateWidthAndHeightCalcs();+ const resumeElement = this.getFirstVisibleElementXPath();+ if (this.layoutMode !== BookPageLayoutMode.Default && resumeElement !== null && resumeElement !== undefined) {+ this.scrollTo(resumeElement); // This works pretty well, but not perfect+ }}@HostListener('window:keydown', ['$event'])handleKeyPress(event: KeyboardEvent) {if (event.key === KEY_CODES.RIGHT_ARROW) {- this.nextPage();+ this.movePage(this.readingDirection === ReadingDirection.LeftToRight ? PAGING_DIRECTION.FORWARD : PAGING_DIRECTION.BACKWARDS);} else if (event.key === KEY_CODES.LEFT_ARROW) {- this.prevPage();+ this.movePage(this.readingDirection === ReadingDirection.LeftToRight ? PAGING_DIRECTION.BACKWARDS : PAGING_DIRECTION.FORWARD);} else if (event.key === KEY_CODES.ESC_KEY) {this.closeReader();} else if (event.key === KEY_CODES.SPACE) {this.toggleDrawer();event.stopPropagation();- event.preventDefault();+ event.preventDefault();} else if (event.key === KEY_CODES.G) {this.goToPage();} else if (event.key === KEY_CODES.F) {@@ -556,6 +644,7 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {loadPrevChapter() {if (this.prevPageDisabled) { return; }+this.isLoading = true;this.continuousChaptersStack.pop();const prevChapter = this.continuousChaptersStack.peek();@@ -567,7 +656,11 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {}}- if (this.prevChapterId === CHAPTER_ID_NOT_FETCHED || this.prevChapterId === this.chapterId) {+ if (this.prevChapterPrefetched && this.prevChapterId === CHAPTER_ID_DOESNT_EXIST) {+ 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 => {this.prevChapterId = chapterId;this.loadChapter(chapterId, 'Prev');@@ -580,7 +673,7 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {loadChapter(chapterId: number, direction: 'Next' | 'Prev') {if (chapterId >= 0) {this.chapterId = chapterId;- this.continuousChaptersStack.push(chapterId);+ this.continuousChaptersStack.push(chapterId);// Load chapter Id onto route but don't reloadconst newRoute = this.readerService.getNextChapterUrl(this.router.url, this.chapterId, this.incognitoMode, this.readingListMode, this.readingListId);window.history.replaceState({}, '', newRoute);@@ -598,9 +691,9 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {}}- loadChapterPage(pageNum: number, part: string) {- this.setPageNum(pageNum);- this.loadPage('id("' + part + '")');+ loadChapterPage(event: {pageNum: number, part: string}) {+ this.setPageNum(event.pageNum);+ this.loadPage('id("' + event.part + '")');}closeReader() {@@ -611,34 +704,10 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {}}- resetSettings() {- const windowWidth = window.innerWidth- || this.document.documentElement.clientWidth- || this.document.body.clientWidth;-- let margin = '15%';- if (windowWidth <= 700) {- margin = '5%';- }- if (this.user) {- if (windowWidth > 700) {- margin = this.user.preferences.bookReaderMargin + '%';- }- this.pageStyles = {'font-family': this.user.preferences.bookReaderFontFamily, 'font-size': this.user.preferences.bookReaderFontSize + '%', 'margin-left': margin, 'margin-right': margin, 'line-height': this.user.preferences.bookReaderLineSpacing + '%'};-- this.toggleDarkMode(this.user.preferences.bookReaderDarkMode);- } else {- this.pageStyles = {'font-family': 'default', 'font-size': '100%', 'margin-left': margin, 'margin-right': margin, 'line-height': '100%'};- this.toggleDarkMode(false);- }-- this.settingsForm.get('bookReaderFontFamily')?.setValue(this.user.preferences.bookReaderFontFamily);- this.updateReaderStyles();- }/**- * Adds a click handler for any anchors that have 'kavita-page'. If 'kavita-page' present, changes page to kavita-page and optionally passes a part value- * from 'kavita-part', which will cause the reader to scroll to the marker.+ * Adds a click handler for any anchors that have 'kavita-page'. If 'kavita-page' present, changes page to kavita-page and optionally passes a part value+ * from 'kavita-part', which will cause the reader to scroll to the marker.*/addLinkClickHandlers() {var links = this.readingSectionElemRef.nativeElement.querySelectorAll('a');@@ -649,13 +718,13 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {if (this.adhocPageHistory.peek()?.page !== this.pageNum) {this.adhocPageHistory.push({page: this.pageNum, scrollOffset: window.pageYOffset});}-+var partValue = e.target.attributes.hasOwnProperty('kavita-part') ? e.target.attributes['kavita-part'].value : undefined;if (partValue && page === this.pageNum) {this.scrollTo(e.target.attributes['kavita-part'].value);return;}-+this.setPageNum(page);this.loadPage(partValue);});@@ -669,6 +738,7 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {}}+promptForPage() {const question = 'There are ' + (this.maxPages - 1) + ' pages. What page do you want to go to?';const goToPageNum = window.prompt(question, '');@@ -698,50 +768,21 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {this.pageNum = page;this.loadPage();-}- cleanIdSelector(id: string) {- const tokens = id.split('/');- if (tokens.length > 0) {- return tokens[0];- }- return id;- }- getPageMarkers(ids: Array<string>) {- try {- return this.document.querySelectorAll(ids.map(id => '#' + this.cleanIdSelector(id)).join(', '));- } catch (Exception) {- // Fallback to anchors instead. Some books have ids that are not valid for querySelectors, so anchors should be used instead- return this.document.querySelectorAll(ids.map(id => '[href="#' + id + '"]').join(', '));- }- }- setupPageAnchors() {- this.pageAnchors = {};- this.currentPageAnchor = '';- const ids = this.chapters.map(item => item.children).flat().filter(item => item.page === this.pageNum).map(item => item.part).filter(item => item.length > 0);- if (ids.length > 0) {- const elems = this.getPageMarkers(ids);- elems.forEach(elem => {- this.pageAnchors[elem.id] = elem.getBoundingClientRect().top;- });- }- }loadPage(part?: string | undefined, scrollTop?: number | undefined) {this.isLoading = true;- this.saveProgress();-this.bookService.getBookPage(this.chapterId, this.pageNum).pipe(take(1)).subscribe(content => {- this.page = this.domSanitizer.bypassSecurityTrustHtml(content);+ this.page = this.domSanitizer.bypassSecurityTrustHtml(content); // PERF: Potential optimization to prefetch next/prev page and store in localStorage+setTimeout(() => {this.addLinkClickHandlers();- this.updateReaderStyles();- // We need to get the offset after we ensure the title has rendered- requestAnimationFrame(() => this.topOffset = this.stickyTopElemRef.nativeElement?.getBoundingClientRect().height);+ this.updateReaderStyles(this.pageStyles);+ this.updateReaderStyles(this.pageStyles);const imgs = this.readingSectionElemRef.nativeElement.querySelectorAll('img');if (imgs === null || imgs.length === 0) {@@ -749,42 +790,71 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {return;}- // Apply scaling class to all images to ensure they scale down to max width to not blow out the reader- Array.from(imgs).forEach(img => this.renderer.addClass(img, 'scale-width'));-Promise.all(Array.from(imgs)- .filter(img => !img.complete)- .map(img => new Promise(resolve => { img.onload = img.onerror = resolve; })))- .then(() => {- this.setupPage(part, scrollTop);- });+ .filter(img => !img.complete)+ .map(img => new Promise(resolve => { img.onload = img.onerror = resolve; })))+ .then(() => {+ this.setupPage(part, scrollTop);+ this.updateImagesWithHeight();+ });}, 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+ */+ updateImagesWithHeight() {++ const images = this.readingSectionElemRef?.nativeElement.querySelectorAll('img') || [];++ if (this.layoutMode !== BookPageLayoutMode.Default) {+ const height = this.ColumnHeight;+ Array.from(images).forEach(img => {+ this.renderer.setStyle(img, 'max-height', height);+ });+ } else {+ Array.from(images).forEach(img => {+ this.renderer.removeStyle(img, 'max-height');+ });+ }+ }+setupPage(part?: string | undefined, scrollTop?: number | undefined) {this.isLoading = false;- this.scrollbarNeeded = this.readingHtml.nativeElement.clientHeight > this.readingSectionElemRef.nativeElement.clientHeight;++ // Virtual Paging stuff+ this.updateWidthAndHeightCalcs();+ this.updateLayoutMode(this.layoutMode || BookPageLayoutMode.Default);// Find all the part ids and their top offsetthis.setupPageAnchors();-+if (part !== undefined && part !== '') {this.scrollTo(part);} else if (scrollTop !== undefined && scrollTop !== 0) {this.scrollService.scrollTo(scrollTop, this.reader.nativeElement);} else {- this.scrollService.scrollTo(0, this.reader.nativeElement);++ if (this.layoutMode === BookPageLayoutMode.Default) {+ this.scrollService.scrollTo(0, this.reader.nativeElement);+ } 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) {+ setTimeout(() => this.scrollService.scrollToX(this.readingHtml.nativeElement.scrollWidth, this.readingHtml.nativeElement));+ } else {+ setTimeout(() => this.scrollService.scrollToX(0, this.readingHtml.nativeElement));+ }+ }}// we need to click the document before arrow keys will scroll down.this.reader.nativeElement.focus();+ this.saveProgress();}- setPageNum(pageNum: number) {- this.pageNum = Math.max(Math.min(pageNum, this.maxPages), 0);- }goBack() {if (!this.adhocPageHistory.isEmpty()) {@@ -796,26 +866,63 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {}}- clickOverlayClass(side: 'right' | 'left') {- if (!this.clickToPaginateVisualOverlay) {- return '';+ setPageNum(pageNum: number) {+ this.pageNum = Math.max(Math.min(pageNum, this.maxPages), 0);++ if (this.pageNum >= this.maxPages - 10) {+ // Tell server to cache the next chapter+ if (!this.nextChapterPrefetched && this.nextChapterId !== CHAPTER_ID_DOESNT_EXIST) { // && !this.nextChapterDisabled+ this.readerService.getChapterInfo(this.nextChapterId).pipe(take(1), catchError(err => {+ this.nextChapterDisabled = true;+ return of(null);+ })).subscribe(res => {+ this.nextChapterPrefetched = true;+ });+ }+ } else if (this.pageNum <= 10) {+ if (!this.prevChapterPrefetched && this.prevChapterId !== CHAPTER_ID_DOESNT_EXIST) { // && !this.prevChapterDisabled+ this.readerService.getChapterInfo(this.prevChapterId).pipe(take(1), catchError(err => {+ this.prevChapterDisabled = true;+ return of(null);+ })).subscribe(res => {+ this.prevChapterPrefetched = true;+ });+ }}+ }- if (this.readingDirection === ReadingDirection.LeftToRight) {- return side === 'right' ? 'highlight' : 'highlight-2';+ /**+ * Given a direction, calls the next or prev page method+ * @param direction Direction to move+ */+ movePage(direction: PAGING_DIRECTION) {+ if (direction === PAGING_DIRECTION.BACKWARDS) {+ this.prevPage();+ return;}- return side === 'right' ? 'highlight-2' : 'highlight';++ this.nextPage();}prevPage() {const oldPageNum = this.pageNum;-- if (this.readingDirection === ReadingDirection.LeftToRight) {- this.setPageNum(this.pageNum - 1);- } else {- this.setPageNum(this.pageNum + 1);++ this.pagingDirection = PAGING_DIRECTION.BACKWARDS;++ // We need to handle virtual paging before we increment the actual page+ if (this.layoutMode !== BookPageLayoutMode.Default) {+ const [currentVirtualPage, _, pageWidth] = this.getVirtualPage();++ if (currentVirtualPage > 1) {+ // -2 apparently goes back 1 virtual page...+ this.scrollService.scrollToX((currentVirtualPage - 2) * pageWidth, this.readingHtml.nativeElement);+ this.handleScrollEvent();+ return;+ }}+ this.setPageNum(this.pageNum - 1);+if (oldPageNum === 0) {// Move to next volume/chapter automaticallythis.loadPrevChapter();@@ -823,7 +930,6 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {}if (oldPageNum === this.pageNum) { return; }-this.loadPage();}@@ -832,6 +938,21 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {event.stopPropagation();event.preventDefault();}++ 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.readingHtml.nativeElement);+ this.handleScrollEvent();+ return;+ }+ }+const oldPageNum = this.pageNum;if (oldPageNum + 1 === this.maxPages) {// Move to next volume/chapter automatically@@ -840,77 +961,91 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {}- if (this.readingDirection === ReadingDirection.LeftToRight) {- this.setPageNum(this.pageNum + 1);- } else {- this.setPageNum(this.pageNum - 1);- }--+ this.setPageNum(this.pageNum + 1);if (oldPageNum === this.pageNum) { return; }-this.loadPage();}- updateFontSize(amount: number) {- let val = parseInt(this.pageStyles['font-size'].substr(0, this.pageStyles['font-size'].length - 1), 10);-- if (val + amount > 300 || val + amount < 50) {- return;- }+ /**+ *+ * @returns Total Page width (excluding margin)+ */+ getPageWidth() {+ if (this.readingSectionElemRef == null) return 0;- this.pageStyles['font-size'] = val + amount + '%';- this.updateReaderStyles();+ const margin = (this.readingSectionElemRef.nativeElement.clientWidth*(parseInt(this.pageStyles['margin-left'], 10) / 100))*2;+ const columnGap = 20;+ return this.readingSectionElemRef.nativeElement.clientWidth - margin + columnGap;}- updateFontFamily(familyName: string) {- if (familyName === null) familyName = '';- let cleanedName = familyName.replace(' ', '_').replace('!important', '').trim();- if (cleanedName === 'default') {- this.pageStyles['font-family'] = 'inherit';- } else {- this.pageStyles['font-family'] = "'" + cleanedName + "'";- }+ /**+ * currentVirtualPage starts at 1+ * @returns+ */+ getVirtualPage() {+ if (this.readingHtml === undefined || this.readingSectionElemRef === undefined) return [1, 1, 0];- this.updateReaderStyles();- }+ const scrollOffset = this.readingHtml.nativeElement.scrollLeft;+ const totalScroll = this.readingHtml.nativeElement.scrollWidth;+ const pageWidth = this.getPageWidth();+ const delta = totalScroll - scrollOffset;- updateMargin(amount: number) {- let cleanedValue = this.pageStyles['margin-left'].replace('%', '').replace('!important', '').trim();- let val = parseInt(cleanedValue, 10);+ const totalVirtualPages = Math.max(1, Math.round((totalScroll) / pageWidth));+ let currentVirtualPage = 1;- if (val + amount > 30 || val + amount < 0) {- return;- }+ // If first virtual page, i.e. totalScroll and delta are the same value+ if (totalScroll - delta === 0) {+ currentVirtualPage = 1;+ // If second virtual page+ } else if (totalScroll - delta === pageWidth) {+ currentVirtualPage = 2;- this.pageStyles['margin-left'] = (val + amount) + '%';- this.pageStyles['margin-right'] = (val + amount) + '%';+ // Otherwise do math to get correct page. i.e. scrollOffset + pageWidth (this accounts for first page offset)+ } else {+ currentVirtualPage = Math.min(Math.max(1, Math.round((scrollOffset + pageWidth) / pageWidth)), totalVirtualPages);+ }- this.updateReaderStyles();+ return [currentVirtualPage, totalVirtualPages, pageWidth];}- updateLineSpacing(amount: number) {- const cleanedValue = parseInt(this.pageStyles['line-height'].replace('%', '').replace('!important', '').trim(), 10);+ getFirstVisibleElementXPath() {+ let resumeElement: string | null = null;+ if (this.readingHtml === null) return null;- if (cleanedValue + amount > 250 || cleanedValue + amount < 100) {- return;- }+ const intersectingEntries = Array.from(this.readingHtml.nativeElement.querySelectorAll('div,o,p,ul,li,a,img,h1,h2,h3,h4,h5,h6,span'))+ .filter(element => !element.classList.contains('no-observe'))+ .filter(entry => {+ return this.utilityService.isInViewport(entry, this.topOffset);+ });- this.pageStyles['line-height'] = (cleanedValue + amount) + '%';+ intersectingEntries.sort(this.sortElements);- this.updateReaderStyles();+ if (intersectingEntries.length > 0) {+ let path = this.getXPathTo(intersectingEntries[0]);+ if (path === '') { return; }+ if (!path.startsWith('id')) {+ path = '//html[1]/' + path;+ }+ resumeElement = path;+ }+ return resumeElement;}/*** Applies styles onto the html of the book page*/- updateReaderStyles() {- if (this.readingHtml === undefined || !this.readingHtml.nativeElement) return;+ updateReaderStyles(pageStyles: PageStyle) {+ this.pageStyles = pageStyles;+ if (this.readingHtml === undefined || !this.readingHtml.nativeElement) return;++ // 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();+// Line Height must be placed on each element in the page-+// Apply page level overridesObject.entries(this.pageStyles).forEach(item => {if (item[1] == '100%' || item[1] == '0px' || item[1] == 'inherit') {@@ -935,76 +1070,57 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {}this.renderer.setStyle(elem, item[0], item[1], RendererStyleFlags2.Important);});-}+ // After layout shifts, we need to refocus the scroll bar+ if (this.layoutMode !== BookPageLayoutMode.Default && resumeElement !== null && resumeElement !== undefined) {+ this.updateWidthAndHeightCalcs();+ this.scrollTo(resumeElement); // This works pretty well, but not perfect+ }}+ /**+ * Applies styles and classes that control theme+ * @param theme+ */+ updateColorTheme(theme: BookTheme) {+ // Remove all themes+ Array.from(this.document.querySelectorAll('style[id^="brtheme-"]')).forEach(elem => elem.remove());- toggleDarkMode(force?: boolean) {- if (force !== undefined) {- this.darkMode = force;- } else {- this.darkMode = !this.darkMode;- }+ this.darkMode = theme.isDarkTheme;- this.setOverrideStyles();- }+ const styleElem = this.renderer.createElement('style');+ styleElem.id = theme.selector;+ styleElem.innerHTML = theme.content;- toggleReadingDirection() {- if (this.readingDirection === ReadingDirection.LeftToRight) {- this.readingDirection = ReadingDirection.RightToLeft;- } else {- this.readingDirection = ReadingDirection.LeftToRight;- }- }- getDarkModeBackgroundColor() {- return this.darkMode ? '#292929' : '#fff';+ this.renderer.appendChild(this.document.querySelector('.reading-section'), styleElem);+ // I need to also apply the selector onto the body so that any css variables will take effect+ this.themeService.setBookTheme(theme.selector);}- setOverrideStyles() {- const bodyNode = this.document.querySelector('body');- if (bodyNode !== undefined && bodyNode !== null) {- if (this.themeService.isDarkTheme()) {- bodyNode.classList.remove('bg-dark');- }-- bodyNode.style.background = this.getDarkModeBackgroundColor();- }- this.backgroundColor = this.getDarkModeBackgroundColor();- const head = this.document.querySelector('head');- if (this.darkMode) {- this.renderer.appendChild(head, this.darkModeStyleElem)- } else {- this.renderer.removeChild(head, this.darkModeStyleElem);- }+ updateWidthAndHeightCalcs() {+ this.windowHeight = Math.max(this.readingSectionElemRef.nativeElement.clientHeight, window.innerHeight);+ this.windowWidth = Math.max(this.readingSectionElemRef.nativeElement.clientWidth, window.innerWidth);++ // Recalculate if bottom action bar is needed+ this.scrollbarNeeded = this.readingHtml.nativeElement.clientHeight > this.reader.nativeElement.clientHeight;}toggleDrawer() {- this.topOffset = this.stickyTopElemRef.nativeElement?.offsetHeight;this.drawerOpen = !this.drawerOpen;- }- closeDrawer() {- this.drawerOpen = false;- }-- handleReaderClick(event: MouseEvent) {- if (this.drawerOpen) {- this.closeDrawer();- event.stopPropagation();- event.preventDefault();+ if (this.immersiveMode) {+ this.actionBarVisible = false;}}-scrollTo(partSelector: string) {if (partSelector.startsWith('#')) {partSelector = partSelector.substr(1, partSelector.length);}- let element = null;+ let element: Element | null = null;if (partSelector.startsWith('//') || partSelector.startsWith('id(')) {// Part selector is a XPATHelement = this.getElementFromXPath(partSelector);@@ -1013,37 +1129,16 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {}if (element === null) return;- 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);- }-- toggleClickToPaginate() {- this.clickToPaginate = !this.clickToPaginate;- if (this.clickToPaginateVisualOverlayTimeout2 !== undefined) {- clearTimeout(this.clickToPaginateVisualOverlayTimeout2);- this.clickToPaginateVisualOverlayTimeout2 = undefined;+ if (this.layoutMode === BookPageLayoutMode.Default) {+ 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);+ } else {+ setTimeout(() => (element as Element).scrollIntoView({'block': 'start', 'inline': 'start'}));}- if (!this.clickToPaginate) { return; }-- this.clickToPaginateVisualOverlayTimeout2 = setTimeout(() => {- this.showClickToPaginateVisualOverlay();- }, 200);}- showClickToPaginateVisualOverlay() {- this.clickToPaginateVisualOverlay = true;-- if (this.clickToPaginateVisualOverlay && this.clickToPaginateVisualOverlayTimeout !== undefined) {- clearTimeout(this.clickToPaginateVisualOverlayTimeout);- this.clickToPaginateVisualOverlayTimeout = undefined;- }- this.clickToPaginateVisualOverlayTimeout = setTimeout(() => {- this.clickToPaginateVisualOverlay = false;- }, 1000);-- }getElementFromXPath(path: string) {const node = this.document.evaluate(path, this.document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;@@ -1057,8 +1152,8 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {if (element === null) return '';if (element.id !== '') { return 'id("' + element.id + '")'; }if (element === this.document.body) { return element.tagName; }--++let ix = 0;const siblings = element.parentNode?.childNodes || [];for (let sibling of siblings) {@@ -1068,7 +1163,7 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {if (sibling.nodeType === 1 && sibling.tagName === element.tagName) {ix++;}-+}return '';}@@ -1095,10 +1190,141 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {this.readerService.enterFullscreen(this.reader.nativeElement, () => {this.isFullscreen = true;// 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'));if (!this.darkMode) {this.renderer.setStyle(this.reader.nativeElement, 'background', 'white');}});}}++ updateLayoutMode(mode: BookPageLayoutMode) {+ this.layoutMode = mode;++ // Remove any max-heights from column layout+ this.updateImagesWithHeight();++ // Calulate if bottom actionbar is needed. On a timeout to get accurate heights+ if (this.readingHtml == null) {+ setTimeout(() => this.updateLayoutMode(this.layoutMode), 10);+ return;+ }+ setTimeout(() => {this.scrollbarNeeded = this.readingHtml.nativeElement.clientHeight > this.reader.nativeElement.clientHeight;});+ }++ updateReadingDirection(readingDirection: ReadingDirection) {+ this.readingDirection = readingDirection;+ }++ updateImmersiveMode(immersiveMode: boolean) {+ this.immersiveMode = immersiveMode;+ if (this.immersiveMode && !this.drawerOpen) {+ this.actionBarVisible = false;+ }+ }++ // Table of Contents+ cleanIdSelector(id: string) {+ const tokens = id.split('/');+ if (tokens.length > 0) {+ return tokens[0];+ }+ return id;+ }++ getPageMarkers(ids: Array<string>) {+ try {+ return this.document.querySelectorAll(ids.map(id => '#' + this.cleanIdSelector(id)).join(', '));+ } catch (Exception) {+ // Fallback to anchors instead. Some books have ids that are not valid for querySelectors, so anchors should be used instead+ return this.document.querySelectorAll(ids.map(id => '[href="#' + id + '"]').join(', '));+ }+ }++ setupPageAnchors() {+ this.pageAnchors = {};+ this.currentPageAnchor = '';+ const ids = this.chapters.map(item => item.children).flat().filter(item => item.page === this.pageNum).map(item => item.part).filter(item => item.length > 0);+ if (ids.length > 0) {+ const elems = this.getPageMarkers(ids);+ elems.forEach(elem => {+ this.pageAnchors[elem.id] = elem.getBoundingClientRect().top;+ });+ }+ }++ // Settings Handlers+ showPaginationOverlay(clickToPaginate: boolean) {+ this.clickToPaginate = clickToPaginate;++ this.clearTimeout(this.clickToPaginateVisualOverlayTimeout2);+ if (!clickToPaginate) { return; }++ this.clickToPaginateVisualOverlayTimeout2 = setTimeout(() => {+ this.showClickToPaginateVisualOverlay();+ }, 200);+ }++ clearTimeout(timeoutId: number | undefined) {+ if (timeoutId !== undefined) {+ clearTimeout(timeoutId);+ timeoutId = undefined;+ }+ }++ showClickToPaginateVisualOverlay() {+ this.clickToPaginateVisualOverlay = true;++ if (this.clickToPaginateVisualOverlay && this.clickToPaginateVisualOverlayTimeout !== undefined) {+ clearTimeout(this.clickToPaginateVisualOverlayTimeout);+ this.clickToPaginateVisualOverlayTimeout = undefined;+ }+ this.clickToPaginateVisualOverlayTimeout = setTimeout(() => {+ this.clickToPaginateVisualOverlay = false;+ }, 1000);++ }++ /**+ * Responsible for returning the class to show an overlay or not+ * @param side+ * @returns+ */+ clickOverlayClass(side: 'right' | 'left') {+ // TODO: See if we can use RXjs or a component to manage this aka an observable that emits the highlight to show at any given time+ if (!this.clickToPaginateVisualOverlay) {+ return '';+ }++ if (this.readingDirection === ReadingDirection.LeftToRight) {+ return side === 'right' ? 'highlight' : 'highlight-2';+ }+ return side === 'right' ? 'highlight-2' : 'highlight';+ }++++ toggleMenu(event: MouseEvent) {+ const targetElement = (event.target as Element);+ const mouseOffset = 5;++ if (!this.immersiveMode) return;+ if (targetElement.getAttribute('onclick') !== null || targetElement.getAttribute('href') !== null || targetElement.getAttribute('role') !== null || targetElement.getAttribute('kavita-part') != null) {+ // Don't do anything, it's actionable+ return;+ }++ if (+ Math.abs(this.mousePosition.x - event.screenX) <= mouseOffset &&+ Math.abs(this.mousePosition.y - event.screenY) <= mouseOffset+ ) {+ this.actionBarVisible = !this.actionBarVisible;+ }++ }++ mouseDown($event: MouseEvent) {+ this.mousePosition.x = $event.screenX;+ this.mousePosition.y = $event.screenY;+ }}diff --git a/UI/Web/src/app/book-reader/book.service.ts b/UI/Web/src/app/book-reader/book.service.tsindex bef4ce73d..10d5b6f7c 100644--- a/UI/Web/src/app/book-reader/book.service.ts+++ b/UI/Web/src/app/book-reader/book.service.ts@@ -10,6 +10,16 @@ export interface BookPage {html: string;}+export interface FontFamily {+ /**+ * What the user should see+ */+ title: string;+ /**+ * The actual font face+ */+ family: string;+}@Injectable({providedIn: 'root'@@ -20,8 +30,10 @@ export class BookService {constructor(private http: HttpClient) { }- getFontFamilies() {- return ['default', 'EBGaramond', 'Fira Sans', 'Lato', 'Libre Baskerville', 'Merriweather', 'Nanum Gothic', 'RocknRoll One'];+ getFontFamilies(): Array<FontFamily> {+ return [{title: 'default', family: 'default'}, {title: 'EBGaramond', family: 'EBGaramond'}, {title: 'Fira Sans', family: 'Fira_Sans'},+ {title: 'Lato', family: 'Lato'}, {title: 'Libre Baskerville', family: 'Libre_Baskerville'}, {title: 'Merriweather', family: 'Merriweather'},+ {title: 'Nanum Gothic', family: 'Nanum_Gothic'}, {title: 'RocknRoll One', family: 'RocknRoll_One'}, {title: 'Open Dyslexic', family: 'OpenDyslexic2'}];}getBookChapters(chapterId: number) {diff --git a/UI/Web/src/app/book-reader/reader-settings/reader-settings.component.html b/UI/Web/src/app/book-reader/reader-settings/reader-settings.component.htmlnew file mode 100644index 000000000..0de05a19b--- /dev/null+++ b/UI/Web/src/app/book-reader/reader-settings/reader-settings.component.html@@ -0,0 +1,153 @@+<!-- IDEA: Move the whole reader drawer into this component and have it self contained -->+<form [formGroup]="settingsForm">+ <ngb-accordion [closeOthers]="false" #acc="ngbAccordion" [activeIds]="['general-panel', 'reader-panel', 'color-panel']">+ <ngb-panel id="general-panel" title="General Settings">+ <ng-template ngbPanelHeader>+ <h2 class="accordion-header">+ <button class="accordion-button" ngbPanelToggle type="button" [attr.aria-expanded]="acc.isExpanded('general-panel')" aria-controls="collapseOne">+ General Settings+ </button>+ </h2>+ </ng-template>+ <ng-template ngbPanelContent>+ <div class="control-container">+ <div class="controls">+ <div class="mb-3">+ <label for="library-type" class="form-label">Font Family</label>+ <select class="form-select" id="library-type" formControlName="bookReaderFontFamily">+ <option [value]="opt" *ngFor="let opt of fontOptions; let i = index">{{opt | titlecase}}</option>+ </select>+ </div>+ </div>+ <div class="row g-0 controls">+ <label for="fontsize" class="form-label col-6">Font Size</label>+ <span class="col-6 float-end" style="display: inline-flex;">+ <i class="fa-solid fa-font" style="font-size: 12px;"></i>+ <input type="range" class="form-range ms-2 me-2" id="fontsize" min="50" max="300" step="10" formControlName="bookReaderFontSize" [ngbTooltip]="settingsForm.get('bookReaderFontSize')?.value + '%'">+ <i class="fa-solid fa-font" style="font-size: 24px;"></i>+ </span>+ </div>++ <div class="row g-0 controls">+ <label for="linespacing" class="form-label col-6">Line Spacing</label>+ <span class="col-6 float-end" style="display: inline-flex;">+ 1x+ <input type="range" class="form-range ms-2 me-2" id="linespacing" min="100" max="200" step="10" formControlName="bookReaderLineSpacing" [ngbTooltip]="settingsForm.get('bookReaderLineSpacing')?.value + '%'">+ 2.5x+ </span>+ </div>++ <div class="row g-0 controls">+ <label for="margin" class="form-label col-6">Margin</label>+ <span class="col-6 float-end" style="display: inline-flex;">+ <i class="fa-solid fa-outdent"></i>+ <input type="range" class="form-range ms-2 me-2" id="margin" min="0" max="30" step="5" formControlName="bookReaderMargin" [ngbTooltip]="settingsForm.get('bookReaderMargin')?.value + '%'">+ <i class="fa-solid fa-indent"></i>+ </span>+ </div>++ <div class="row g-0 justify-content-between mt-2">+ <button (click)="resetSettings()" class="btn btn-primary col">Reset to Defaults</button>+ </div>+ </div>+ </ng-template>++ </ngb-panel>++ <ngb-panel id="reader-panel" title="Reader Settings">+ <ng-template ngbPanelHeader>+ <h2 class="accordion-header">+ <button class="accordion-button" ngbPanelToggle type="button" [attr.aria-expanded]="acc.isExpanded('reader-panel')" aria-controls="collapseOne">+ Reader Settings+ </button>+ </h2>+ </ng-template>+ <ng-template ngbPanelContent>+ <div class="controls" style="display:flex; justify-content:space-between; align-items:center;">+ <label id="readingdirection" class="form-label">Reading Direction</label>+ <button (click)="toggleReadingDirection()" class="btn btn-icon" aria-labelledby="readingdirection" title="{{readingDirectionModel === ReadingDirection.LeftToRight ? 'Left to Right' : 'Right to Left'}}">+ <i class="fa {{readingDirectionModel === ReadingDirection.LeftToRight ? 'fa-arrow-right' : 'fa-arrow-left'}} " aria-hidden="true"></i>+ <span class="phone-hidden"> {{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="tap-pagination" class="form-label">Tap Pagination <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>+ <span class="visually-hidden" id="tapPagination-help">+ <ng-container [ngTemplateOutlet]="tapPaginationTooltip"></ng-container>+ </span>+ <div class="form-check form-switch">+ <input type="checkbox" id="tap-pagination" formControlName="bookReaderTapToPaginate" class="form-check-input" aria-labelledby="tapPagination-help">+ <label>{{settingsForm.get('bookReaderTapToPaginate')?.value ? 'On' : 'Off'}} </label>+ </div>+ </div>+ <div class="controls" style="display:flex; justify-content:space-between; align-items:center;">+ <label for="immersive-mode" class="form-label">Immersive Mode <i class="fa fa-info-circle" aria-hidden="true" placement="top" [ngbTooltip]="immersiveModeTooltip" role="button" tabindex="0" aria-describedby="immersiveMode-help"></i></label>+ <ng-template #immersiveModeTooltip>This will hide the menu behind a click on the reader document and turn tap to paginate on</ng-template>+ <span class="visually-hidden" id="immersiveMode-help">+ <ng-container [ngTemplateOutlet]="immersiveModeTooltip"></ng-container>+ </span>+ <div class="form-check form-switch">+ <input type="checkbox" id="immersive-mode" formControlName="bookReaderImmersiveMode" class="form-check-input" aria-labelledby="immersiveMode-help">+ <label>{{settingsForm.get('bookReaderImmersiveMode')?.value ? 'On' : 'Off'}} </label>+ </div>+ </div>+ <!-- TODO: move this inline style into a class -->+ <div class="controls" style="display:flex; justify-content:space-between; align-items:center;">+ <label id="fullscreen" class="form-label">Fullscreen <i class="fa fa-info-circle" aria-hidden="true" placement="top"+ [ngbTooltip]="fullscreenTooltip" role="button" tabindex="1" aria-describedby="fullscreen-help"></i></label>+ <ng-template #fullscreenTooltip>Put reader in fullscreen mode</ng-template>+ <span class="visually-hidden" id="fullscreen-help">+ <ng-container [ngTemplateOutlet]="fullscreenTooltip"></ng-container>+ </span>+ <button (click)="toggleFullscreen()" class="btn btn-icon" aria-labelledby="fullscreen">+ <i class="fa {{this.isFullscreen ? 'fa-compress-alt' : 'fa-expand-alt'}} {{isFullscreen ? 'icon-primary-color' : ''}}" aria-hidden="true"></i>+ <span *ngIf="activeTheme?.isDarkTheme"> {{isFullscreen ? 'Exit' : 'Enter'}}</span>+ </button>+ </div>++ <div class="controls">+ <label id="layout-mode" class="form-label" style="margin-bottom:0.5rem">Layout Mode <i class="fa fa-info-circle" aria-hidden="true" placement="top" [ngbTooltip]="layoutTooltip" role="button" tabindex="1" aria-describedby="layout-help"></i></label>+ <ng-template #layoutTooltip>Default: Mirrors epub file (usually one long scrolling page per chapter).<br/>1 Column: Creates a single virtual page at a time.<br/>2 Column: Creates two virtual pages at a time laid out side-by-side.</ng-template>+ <span class="visually-hidden" id="layout-help">+ <ng-container [ngTemplateOutlet]="layoutTooltip"></ng-container>+ </span>+ <br>+ <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">Default</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>+ </div>+++ </ng-template>+ </ngb-panel>++ <ngb-panel id="color-panel" title="Color Theme">+ <ng-template ngbPanelHeader>+ <h2 class="accordion-header">+ <button class="accordion-button" ngbPanelToggle type="button" [attr.aria-expanded]="acc.isExpanded('color-panel')" aria-controls="collapseOne">+ Color Theme+ </button>+ </h2>+ </ng-template>+ <ng-template ngbPanelContent>+ <div class="controls">+ <ng-container *ngFor="let theme of themes">+ <button class="btn btn-icon color" (click)="setTheme(theme.name)" [ngClass]="{'active': activeTheme?.name === theme.name}">+ <div class="dot" [ngStyle]="{'background-color': theme.colorHash}"></div>+ {{theme.name}}+ </button>+ </ng-container>+ </div>+ </ng-template>+ </ngb-panel>++ </ngb-accordion>+</form>\ No newline at end of filediff --git a/UI/Web/src/app/book-reader/reader-settings/reader-settings.component.scss b/UI/Web/src/app/book-reader/reader-settings/reader-settings.component.scssnew file mode 100644index 000000000..f379f66c3--- /dev/null+++ b/UI/Web/src/app/book-reader/reader-settings/reader-settings.component.scss@@ -0,0 +1,49 @@+.controls {+ margin: 0.25rem 0 0.25rem;++ .form-select {+ option{+ background-color: var(--input-bg-color);+ }+ }++ .form-label {+ margin: 0;+ }++ .btn.btn-icon {+ display: flex;+ width: 50%;+ justify-content: center;+ align-items: center;+ &.color {+ display: unset;+ width: auto;++ .dot {+ height: 25px;+ width: 25px;+ border-radius: 50%;+ margin: 0 auto;+ }+ }+ }++ .form-check.form-switch {+ width: 50%;+ display: flex;+ justify-content: center;++ input {+ margin-right: 0.25rem;+ }+ }+}++.active {+ border: 1px solid var(--primary-color);+}++::ng-deep .accordion-body {+ padding: 0.25rem 1rem 1rem !important;+}diff --git a/UI/Web/src/app/book-reader/reader-settings/reader-settings.component.ts b/UI/Web/src/app/book-reader/reader-settings/reader-settings.component.tsnew file mode 100644index 000000000..8c4344d98--- /dev/null+++ b/UI/Web/src/app/book-reader/reader-settings/reader-settings.component.ts@@ -0,0 +1,290 @@+import { DOCUMENT } from '@angular/common';+import { Component, EventEmitter, Inject, Input, OnDestroy, OnInit, Output } from '@angular/core';+import { FormControl, FormGroup } from '@angular/forms';+import { Subject, take, takeUntil } from 'rxjs';+import { BookPageLayoutMode } from 'src/app/_models/book-page-layout-mode';+import { BookTheme } from 'src/app/_models/preferences/book-theme';+import { ReadingDirection } from 'src/app/_models/preferences/reading-direction';+import { ThemeProvider } from 'src/app/_models/preferences/site-theme';+import { User } from 'src/app/_models/user';+import { AccountService } from 'src/app/_services/account.service';+import { ThemeService } from 'src/app/_services/theme.service';+import { BookService, FontFamily } from '../book.service';+import { BookBlackTheme } from '../_models/book-black-theme';+import { BookDarkTheme } from '../_models/book-dark-theme';+import { BookWhiteTheme } from '../_models/book-white-theme';++/**+ * Used for book reader. Do not use for other components+ */+export interface PageStyle {+ 'font-family': string;+ 'font-size': string;+ 'line-height': string;+ 'margin-left': string;+ 'margin-right': string;+}++export const bookColorThemes = [+ {+ name: 'Dark',+ colorHash: '#292929',+ isDarkTheme: true,+ isDefault: true,+ provider: ThemeProvider.System,+ selector: 'brtheme-dark',+ content: BookDarkTheme+ },+ {+ name: 'Black',+ colorHash: '#000000',+ isDarkTheme: true,+ isDefault: false,+ provider: ThemeProvider.System,+ selector: 'brtheme-black',+ content: BookBlackTheme+ },+ {+ name: 'White',+ colorHash: '#FFFFFF',+ isDarkTheme: false,+ isDefault: false,+ provider: ThemeProvider.System,+ selector: 'brtheme-white',+ content: BookWhiteTheme+ },+];++const mobileBreakpointMarginOverride = 700;++@Component({+ selector: 'app-reader-settings',+ templateUrl: './reader-settings.component.html',+ styleUrls: ['./reader-settings.component.scss']+})+export class ReaderSettingsComponent implements OnInit, OnDestroy {+ /**+ * Outputs when clickToPaginate is changed+ */+ @Output() clickToPaginateChanged: EventEmitter<boolean> = new EventEmitter();+ /**+ * Outputs when a style is updated and the reader needs to render it+ */+ @Output() styleUpdate: EventEmitter<PageStyle> = new EventEmitter();+ /**+ * Outputs when a theme/dark mode is updated+ */+ @Output() colorThemeUpdate: EventEmitter<BookTheme> = new EventEmitter();+ /**+ * Outputs when a layout mode is updated+ */+ @Output() layoutModeUpdate: EventEmitter<BookPageLayoutMode> = new EventEmitter();+ /**+ * Outputs when fullscreen is toggled+ */+ @Output() fullscreen: EventEmitter<void> = new EventEmitter();+ /**+ * Outputs when reading direction is changed+ */+ @Output() readingDirection: EventEmitter<ReadingDirection> = new EventEmitter();+ /**+ * Outputs when immersive mode is changed+ */+ @Output() immersiveMode: EventEmitter<boolean> = new EventEmitter();++ user!: User;+ /**+ * List of all font families user can select from+ */+ fontOptions: Array<string> = [];+ fontFamilies: Array<FontFamily> = [];+ /**+ * Internal property used to capture all the different css properties to render on all elements+ */+ pageStyles!: PageStyle;++ readingDirectionModel: ReadingDirection = ReadingDirection.LeftToRight;++ activeTheme: BookTheme | undefined;++ isFullscreen: boolean = false;++ settingsForm: FormGroup = new FormGroup({});++ /**+ * System provided themes+ */+ themes: Array<BookTheme> = bookColorThemes;+++ private onDestroy: Subject<void> = new Subject();+++ get BookPageLayoutMode(): typeof BookPageLayoutMode {+ return BookPageLayoutMode;+ }++ get ReadingDirection() {+ return ReadingDirection;+ }++++ constructor(private bookService: BookService, private accountService: AccountService,+ @Inject(DOCUMENT) private document: Document, private themeService: ThemeService) {}++ ngOnInit(): void {++ this.fontFamilies = this.bookService.getFontFamilies();+ this.fontOptions = this.fontFamilies.map(f => f.title);++ this.accountService.currentUser$.pipe(take(1)).subscribe(user => {+ if (user) {+ this.user = user;++ if (this.user.preferences.bookReaderFontFamily === undefined) {+ this.user.preferences.bookReaderFontFamily = 'default';+ }+ if (this.user.preferences.bookReaderFontSize === undefined || this.user.preferences.bookReaderFontSize < 50) {+ this.user.preferences.bookReaderFontSize = 100;+ }+ if (this.user.preferences.bookReaderLineSpacing === undefined || this.user.preferences.bookReaderLineSpacing < 100) {+ this.user.preferences.bookReaderLineSpacing = 100;+ }+ if (this.user.preferences.bookReaderMargin === undefined) {+ this.user.preferences.bookReaderMargin = 0;+ }+ if (this.user.preferences.bookReaderReadingDirection === undefined) {+ this.user.preferences.bookReaderReadingDirection = ReadingDirection.LeftToRight;+ }+ this.readingDirectionModel = this.user.preferences.bookReaderReadingDirection;+++ this.settingsForm.addControl('bookReaderFontFamily', new FormControl(this.user.preferences.bookReaderFontFamily, []));+ this.settingsForm.get('bookReaderFontFamily')!.valueChanges.pipe(takeUntil(this.onDestroy)).subscribe(fontName => {+ const familyName = this.fontFamilies.filter(f => f.title === fontName)[0].family;+ if (familyName === 'default') {+ this.pageStyles['font-family'] = 'inherit';+ } else {+ this.pageStyles['font-family'] = "'" + familyName + "'";+ }++ this.styleUpdate.emit(this.pageStyles);+ });++ this.settingsForm.addControl('bookReaderFontSize', new FormControl(this.user.preferences.bookReaderFontSize, []));+ this.settingsForm.get('bookReaderFontSize')?.valueChanges.pipe(takeUntil(this.onDestroy)).subscribe(value => {+ this.pageStyles['font-size'] = value + '%';+ this.styleUpdate.emit(this.pageStyles);+ });++ this.settingsForm.addControl('bookReaderTapToPaginate', new FormControl(this.user.preferences.bookReaderTapToPaginate, []));+ this.settingsForm.get('bookReaderTapToPaginate')?.valueChanges.pipe(takeUntil(this.onDestroy)).subscribe(value => {+ this.clickToPaginateChanged.emit(value);+ });++ this.settingsForm.addControl('bookReaderLineSpacing', new FormControl(this.user.preferences.bookReaderLineSpacing, []));+ this.settingsForm.get('bookReaderLineSpacing')?.valueChanges.pipe(takeUntil(this.onDestroy)).subscribe(value => {+ this.pageStyles['line-height'] = value + '%';+ this.styleUpdate.emit(this.pageStyles);+ });++ 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.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);+ });++ this.settingsForm.addControl('bookReaderImmersiveMode', new FormControl(this.user.preferences.bookReaderImmersiveMode, []));+ this.settingsForm.get('bookReaderImmersiveMode')?.valueChanges.pipe(takeUntil(this.onDestroy)).subscribe((immersiveMode: boolean) => {+ if (immersiveMode) {+ this.settingsForm.get('bookReaderTapToPaginate')?.setValue(true);+ }+ this.immersiveMode.emit(immersiveMode);+ });+++ this.setTheme(this.user.preferences.bookReaderThemeName || this.themeService.defaultBookTheme);++ // Emit first time so book reader gets the setting+ this.readingDirection.emit(this.readingDirectionModel);+ this.clickToPaginateChanged.emit(this.user.preferences.bookReaderTapToPaginate);+ this.layoutModeUpdate.emit(this.user.preferences.bookReaderLayoutMode);+ this.immersiveMode.emit(this.user.preferences.bookReaderImmersiveMode);++ this.resetSettings();+ } else {+ this.resetSettings();+ }+++ });+ }++ ngOnDestroy(): void {+ this.onDestroy.next();+ this.onDestroy.complete();+ }+++ resetSettings() {+ if (this.user) {+ this.setPageStyles(this.user.preferences.bookReaderFontFamily, this.user.preferences.bookReaderFontSize + '%', this.user.preferences.bookReaderMargin + '%', this.user.preferences.bookReaderLineSpacing + '%');+ } else {+ this.setPageStyles();+ }++ this.settingsForm.get('bookReaderFontFamily')?.setValue(this.user.preferences.bookReaderFontFamily);+ this.styleUpdate.emit(this.pageStyles);+ }++ /**+ * Internal method to be used by resetSettings. Pass items in with quantifiers+ */+ setPageStyles(fontFamily?: string, fontSize?: string, margin?: string, lineHeight?: string, colorTheme?: string) {+ const windowWidth = window.innerWidth+ || this.document.documentElement.clientWidth+ || this.document.body.clientWidth;+++ let defaultMargin = '15%';+ if (windowWidth <= mobileBreakpointMarginOverride) {+ defaultMargin = '5%';+ }+ this.pageStyles = {+ 'font-family': fontFamily || this.pageStyles['font-family'] || 'default',+ 'font-size': fontSize || this.pageStyles['font-size'] || '100%',+ 'margin-left': margin || this.pageStyles['margin-left'] || defaultMargin,+ 'margin-right': margin || this.pageStyles['margin-right'] || defaultMargin,+ 'line-height': lineHeight || this.pageStyles['line-height'] || '100%'+ };++ }++ setTheme(themeName: string) {+ const theme = this.themes.find(t => t.name === themeName);+ this.activeTheme = theme;+ this.colorThemeUpdate.emit(theme);+ }++ toggleReadingDirection() {+ if (this.readingDirectionModel === ReadingDirection.LeftToRight) {+ this.readingDirectionModel = ReadingDirection.RightToLeft;+ } else {+ this.readingDirectionModel = ReadingDirection.LeftToRight;+ }++ this.readingDirection.emit(this.readingDirectionModel);+ }++ toggleFullscreen() {+ this.isFullscreen = !this.isFullscreen;+ this.fullscreen.emit();+ }+}diff --git a/UI/Web/src/app/book-reader/table-of-contents/table-of-contents.component.html b/UI/Web/src/app/book-reader/table-of-contents/table-of-contents.component.htmlnew file mode 100644index 000000000..6d43689df--- /dev/null+++ b/UI/Web/src/app/book-reader/table-of-contents/table-of-contents.component.html@@ -0,0 +1,25 @@+<div class="table-of-contents">+ <!-- <h3>Table of Contents</h3> -->+ <div *ngIf="chapters.length === 0">+ <em>This book does not have Table of Contents set in the metadata or a toc file</em>+ </div>+ <div *ngIf="chapters.length === 1; else nestedChildren">+ <ul>+ <li *ngFor="let chapter of chapters[0].children">+ <a href="javascript:void(0);" (click)="loadChapterPage(chapter.page, chapter.part)">{{chapter.title}}</a>+ </li>+ </ul>+ </div>+ <ng-template #nestedChildren>+ <ul *ngFor="let chapterGroup of chapters" class="chapter-title">+ <li class="{{chapterGroup.page == pageNum ? 'active': ''}}" (click)="loadChapterPage(chapterGroup.page, '')">+ {{chapterGroup.title}}+ </li>+ <ul *ngFor="let chapter of chapterGroup.children">+ <li class="{{cleanIdSelector(chapter.part) === currentPageAnchor ? 'active' : ''}}">+ <a href="javascript:void(0);" (click)="loadChapterPage(chapter.page, chapter.part)">{{chapter.title}}</a>+ </li>+ </ul>+ </ul>+ </ng-template>+</div>\ No newline at end of filediff --git a/UI/Web/src/app/book-reader/table-of-contents/table-of-contents.component.scss b/UI/Web/src/app/book-reader/table-of-contents/table-of-contents.component.scssnew file mode 100644index 000000000..e556f0e78--- /dev/null+++ b/UI/Web/src/app/book-reader/table-of-contents/table-of-contents.component.scss@@ -0,0 +1,11 @@+.table-of-contents li {+ cursor: pointer;++ &.active {+ font-weight: bold;+ }+}++.chapter-title {+ padding-inline-start: 1rem;+}\ No newline at end of filediff --git a/UI/Web/src/app/book-reader/table-of-contents/table-of-contents.component.ts b/UI/Web/src/app/book-reader/table-of-contents/table-of-contents.component.tsnew file mode 100644index 000000000..709e4d645--- /dev/null+++ b/UI/Web/src/app/book-reader/table-of-contents/table-of-contents.component.ts@@ -0,0 +1,48 @@+import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core';+import { Subject } from 'rxjs';+import { BookChapterItem } from '../_models/book-chapter-item';++@Component({+ selector: 'app-table-of-contents',+ templateUrl: './table-of-contents.component.html',+ styleUrls: ['./table-of-contents.component.scss']+})+export class TableOfContentsComponent implements OnInit, OnDestroy {++ @Input() chapterId!: number;+ @Input() pageNum!: number;+ @Input() currentPageAnchor!: string;+ @Input() chapters:Array<BookChapterItem> = [];++ @Output() loadChapter: EventEmitter<{pageNum: number, part: string}> = new EventEmitter();++++ private onDestroy: Subject<void> = new Subject();+++ pageAnchors: {[n: string]: number } = {};++ constructor() {}++ ngOnInit(): void {+ }++ ngOnDestroy(): void {+ this.onDestroy.next();+ this.onDestroy.complete();+ }++ cleanIdSelector(id: string) {+ const tokens = id.split('/');+ if (tokens.length > 0) {+ return tokens[0];+ }+ return id;+ }++ loadChapterPage(pageNum: number, part: string) {+ this.loadChapter.emit({pageNum, part});+ }++}diff --git a/UI/Web/src/app/bookmark/bookmark-routing.module.ts b/UI/Web/src/app/bookmark/bookmark-routing.module.tsnew file mode 100644index 000000000..66b13c29c--- /dev/null+++ b/UI/Web/src/app/bookmark/bookmark-routing.module.ts@@ -0,0 +1,22 @@+import { NgModule } from "@angular/core";+import { Routes, RouterModule } from "@angular/router";+import { AuthGuard } from "../_guards/auth.guard";+import { BookmarksComponent } from "./bookmarks/bookmarks.component";++const routes: Routes = [+ {path: '**', component: BookmarksComponent, pathMatch: 'full', canActivate: [AuthGuard]},+ {+ runGuardsAndResolvers: 'always',+ canActivate: [AuthGuard],+ children: [+ {path: '/bookmarks', component: BookmarksComponent},+ ]+ }+];+++@NgModule({+ imports: [RouterModule.forChild(routes)],+ exports: [RouterModule]+})+export class BookmarkRoutingModule { }\ No newline at end of filediff --git a/UI/Web/src/app/bookmark/bookmark.module.ts b/UI/Web/src/app/bookmark/bookmark.module.tsnew file mode 100644index 000000000..40d7716e1--- /dev/null+++ b/UI/Web/src/app/bookmark/bookmark.module.ts@@ -0,0 +1,21 @@+import { NgModule } from '@angular/core';+import { CommonModule } from '@angular/common';+import { BookmarkRoutingModule } from './bookmark-routing.module';+import { BookmarksComponent } from './bookmarks/bookmarks.component';+import { SharedSideNavCardsModule } from '../shared-side-nav-cards/shared-side-nav-cards.module';++++@NgModule({+ declarations: [+ BookmarksComponent+ ],+ imports: [+ CommonModule,++ SharedSideNavCardsModule,++ BookmarkRoutingModule+ ]+})+export class BookmarkModule { }diff --git a/UI/Web/src/app/bookmark/bookmarks/bookmarks.component.html b/UI/Web/src/app/bookmark/bookmarks/bookmarks.component.htmlnew file mode 100644index 000000000..42151ba2b--- /dev/null+++ b/UI/Web/src/app/bookmark/bookmarks/bookmarks.component.html@@ -0,0 +1,22 @@+<app-side-nav-companion-bar [hasFilter]="false">+ <h2 title>+ Bookmarks+ </h2>+ <h6 subtitle>{{series?.length}} Series</h6>+</app-side-nav-companion-bar>+<app-bulk-operations [actionCallback]="bulkActionCallback"></app-bulk-operations>+<app-card-detail-layout+ [isLoading]="loadingBookmarks"+ [items]="series">+ <ng-template #cardItem let-item let-position="idx">+ <app-card-item [entity]="item" (reload)="loadBookmarks()" [title]="item.name" [imageUrl]="imageService.getSeriesCoverImage(item.id)"+ [supressArchiveWarning]="true" (clicked)="viewBookmarks(item)" [count]="seriesIds[item.id]" [allowSelection]="true"+ [actions]="actions"+ [selected]="bulkSelectionService.isCardSelected('bookmark', position)" (selection)="bulkSelectionService.handleCardSelection('bookmark', position, series.length, $event)"+ ></app-card-item>+ </ng-template>++ <ng-template #noData>+ There are no bookmarks. Try creating <a href="https://wiki.kavitareader.com/en/guides/get-started-using-your-library/bookmarks" target="_blank">one <i class="fa fa-external-link-alt" aria-hidden="true"></i></a>.+ </ng-template>+</app-card-detail-layout>\ No newline at end of filediff --git a/API/DTOs/SeriesFilterDto.cs b/UI/Web/src/app/bookmark/bookmarks/bookmarks.component.scsssimilarity index 100%rename from API/DTOs/SeriesFilterDto.csrename to UI/Web/src/app/bookmark/bookmarks/bookmarks.component.scssdiff --git a/UI/Web/src/app/bookmark/bookmarks/bookmarks.component.ts b/UI/Web/src/app/bookmark/bookmarks/bookmarks.component.tsnew file mode 100644index 000000000..d8c939cc1--- /dev/null+++ b/UI/Web/src/app/bookmark/bookmarks/bookmarks.component.ts@@ -0,0 +1,168 @@+import { Component, HostListener, OnDestroy, OnInit } from '@angular/core';+import { Router } from '@angular/router';+import { ToastrService } from 'ngx-toastr';+import { take, takeWhile, finalize, Subject, forkJoin } from 'rxjs';+import { BulkSelectionService } from 'src/app/cards/bulk-selection.service';+import { ConfirmService } from 'src/app/shared/confirm.service';+import { DownloadService } from 'src/app/shared/_services/download.service';+import { KEY_CODES } from 'src/app/shared/_services/utility.service';+import { PageBookmark } from 'src/app/_models/page-bookmark';+import { Series } from 'src/app/_models/series';+import { Action, ActionFactoryService, ActionItem } from 'src/app/_services/action-factory.service';+import { ImageService } from 'src/app/_services/image.service';+import { ReaderService } from 'src/app/_services/reader.service';+import { SeriesService } from 'src/app/_services/series.service';++@Component({+ selector: 'app-bookmarks',+ templateUrl: './bookmarks.component.html',+ styleUrls: ['./bookmarks.component.scss']+})+export class BookmarksComponent implements OnInit, OnDestroy {++ bookmarks: Array<PageBookmark> = [];+ series: Array<Series> = [];+ loadingBookmarks: boolean = false;+ seriesIds: {[id: number]: number} = {};+ downloadingSeries: {[id: number]: boolean} = {};+ clearingSeries: {[id: number]: boolean} = {};+ actions: ActionItem<Series>[] = [];++ private onDestroy: Subject<void> = new Subject<void>();++ constructor(private readerService: ReaderService, private seriesService: SeriesService,+ private downloadService: DownloadService, private toastr: ToastrService,+ private confirmService: ConfirmService, public bulkSelectionService: BulkSelectionService,+ public imageService: ImageService, private actionFactoryService: ActionFactoryService,+ private router: Router) { }++ ngOnInit(): void {+ this.loadBookmarks();++ this.actions = this.actionFactoryService.getBookmarkActions(this.handleAction.bind(this));+ }++ ngOnDestroy() {+ this.onDestroy.next();+ this.onDestroy.complete();+ }++ @HostListener('document:keydown.shift', ['$event'])+ handleKeypress(event: KeyboardEvent) {+ if (event.key === KEY_CODES.SHIFT) {+ this.bulkSelectionService.isShiftDown = true;+ }+ }++ @HostListener('document:keyup.shift', ['$event'])+ handleKeyUp(event: KeyboardEvent) {+ if (event.key === KEY_CODES.SHIFT) {+ this.bulkSelectionService.isShiftDown = false;+ }+ }++ async handleAction(action: Action, series: Series) {+ switch (action) {+ case(Action.Delete):+ this.clearBookmarks(series);+ break;+ case(Action.DownloadBookmark):+ this.downloadBookmarks(series);+ break;+ case(Action.ViewSeries):+ this.router.navigate(['library', series.libraryId, 'series', series.id]);+ break;+ default:+ break;+ }+ }++ bulkActionCallback = async (action: Action, data: any) => {+ const selectedSeriesIndexies = this.bulkSelectionService.getSelectedCardsForSource('bookmark');+ const selectedSeries = this.series.filter((series, index: number) => selectedSeriesIndexies.includes(index + ''));+ const seriesIds = selectedSeries.map(item => item.id);++ switch (action) {+ case Action.DownloadBookmark:+ this.downloadService.downloadBookmarks(this.bookmarks.filter(bmk => seriesIds.includes(bmk.seriesId))).pipe(+ takeWhile(val => {+ return val.state != 'DONE';+ })).subscribe(() => {+ this.bulkSelectionService.deselectAll();+ });+ break;+ case Action.Delete:+ if (!await this.confirmService.confirm('Are you sure you want to clear all bookmarks for multiple series? This cannot be undone.')) {+ break;+ }++ forkJoin(seriesIds.map(id => this.readerService.clearBookmarks(id))).subscribe(() => {+ this.toastr.success('Bookmarks have been removed');+ this.bulkSelectionService.deselectAll();+ this.loadBookmarks();+ })+ break;+ default:+ break;+ }+ }++ loadBookmarks() {+ this.loadingBookmarks = true;+ this.readerService.getAllBookmarks().pipe(take(1)).subscribe(bookmarks => {+ this.bookmarks = bookmarks;+ this.seriesIds = {};+ this.bookmarks.forEach(bmk => {+ if (!this.seriesIds.hasOwnProperty(bmk.seriesId)) {+ this.seriesIds[bmk.seriesId] = 1;+ } else {+ this.seriesIds[bmk.seriesId] += 1;+ }+ this.downloadingSeries[bmk.seriesId] = false;+ this.clearingSeries[bmk.seriesId] = false;+ });++ const ids = Object.keys(this.seriesIds).map(k => parseInt(k, 10));+ this.seriesService.getAllSeriesByIds(ids).subscribe(series => {+ this.series = series;+ this.loadingBookmarks = false;+ });+ });+ }++ viewBookmarks(series: Series) {+ this.router.navigate(['library', series.libraryId, 'series', series.id, 'manga', 0], {queryParams: {incognitoMode: false, bookmarkMode: true}});+ }++ async clearBookmarks(series: Series) {+ if (!await this.confirmService.confirm('Are you sure you want to clear all bookmarks for ' + series.name + '? This cannot be undone.')) {+ return;+ }++ this.clearingSeries[series.id] = true;+ this.readerService.clearBookmarks(series.id).subscribe(() => {+ const index = this.series.indexOf(series);+ if (index > -1) {+ this.series.splice(index, 1);+ }+ this.clearingSeries[series.id] = false;+ this.toastr.success(series.name + '\'s bookmarks have been removed');+ });+ }++ getBookmarkPages(seriesId: number) {+ return this.seriesIds[seriesId];+ }++ downloadBookmarks(series: Series) {+ this.downloadingSeries[series.id] = true;+ this.downloadService.downloadBookmarks(this.bookmarks.filter(bmk => bmk.seriesId === series.id)).pipe(+ takeWhile(val => {+ return val.state != 'DONE';+ }),+ finalize(() => {+ this.downloadingSeries[series.id] = false;+ })).subscribe(() => {/* No Operation */});+ }++}diff --git a/UI/Web/src/app/cards/_modals/bookmarks-modal/bookmarks-modal.component.html b/UI/Web/src/app/cards/_modals/bookmarks-modal/bookmarks-modal.component.htmldeleted file mode 100644index 606ed1384..000000000--- a/UI/Web/src/app/cards/_modals/bookmarks-modal/bookmarks-modal.component.html+++ /dev/null@@ -1,29 +0,0 @@-<div class="modal-header">- <h4 class="modal-title" id="modal-basic-title">{{title}} Bookmarks</h4>- <button type="button" class="btn-close" aria-label="Close" (click)="close()">-- </button>-</div>-<div class="modal-body">- <p *ngIf="bookmarks.length > 0; else noBookmarks">- There are {{bookmarks.length}} pages bookmarked over {{uniqueChapters}} files.- </p>- <ng-template #noBookmarks>No bookmarks yet</ng-template>-- <div class="row g-0">- <div *ngFor="let bookmark of bookmarks; let idx = index">- <app-bookmark [bookmark]="bookmark" (bookmarkRemoved)="removeBookmark(bookmark, idx)" class="col-auto"></app-bookmark>- </div>- </div>-</div>-<div class="modal-footer">- <button type="button" class="btn btn-secondary" (click)="clearBookmarks()" [disabled]="(isDownloading || isClearing) || bookmarks.length === 0">- <span *ngIf="isClearing" class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>- <span>Clear{{isClearing ? 'ing...' : ''}}</span>- </button>- <button type="button" class="btn btn-secondary" (click)="downloadBookmarks()" [disabled]="(isDownloading || isClearing) || bookmarks.length === 0">- <span *ngIf="isDownloading" class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>- <span>Download{{isDownloading ? 'ing...' : ''}}</span>- </button>- <button type="button" class="btn btn-primary" (click)="close()">Close</button>-</div>diff --git a/UI/Web/src/app/cards/_modals/bookmarks-modal/bookmarks-modal.component.ts b/UI/Web/src/app/cards/_modals/bookmarks-modal/bookmarks-modal.component.tsdeleted file mode 100644index 38dd16ff7..000000000--- a/UI/Web/src/app/cards/_modals/bookmarks-modal/bookmarks-modal.component.ts+++ /dev/null@@ -1,77 +0,0 @@-import { Component, Input, OnInit } from '@angular/core';-import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';-import { ToastrService } from 'ngx-toastr';-import { finalize, take, takeWhile } from 'rxjs/operators';-import { DownloadService } from 'src/app/shared/_services/download.service';-import { PageBookmark } from 'src/app/_models/page-bookmark';-import { Series } from 'src/app/_models/series';-import { ImageService } from 'src/app/_services/image.service';-import { ReaderService } from 'src/app/_services/reader.service';--@Component({- selector: 'app-bookmarks-modal',- templateUrl: './bookmarks-modal.component.html',- styleUrls: ['./bookmarks-modal.component.scss']-})-export class BookmarksModalComponent implements OnInit {-- @Input() series!: Series;-- bookmarks: Array<PageBookmark> = [];- title: string = '';- subtitle: string = '';- isDownloading: boolean = false;- isClearing: boolean = false;-- uniqueChapters: number = 0;-- constructor(public imageService: ImageService, private readerService: ReaderService,- public modal: NgbActiveModal, private downloadService: DownloadService,- private toastr: ToastrService) { }-- ngOnInit(): void {- this.init();- }-- init() {- this.readerService.getBookmarksForSeries(this.series.id).pipe(take(1)).subscribe(bookmarks => {- this.bookmarks = bookmarks;- const chapters: {[id: number]: string} = {};- this.bookmarks.forEach(bmk => {- if (!chapters.hasOwnProperty(bmk.chapterId)) {- chapters[bmk.chapterId] = '';- }- });- this.uniqueChapters = Object.keys(chapters).length;- });- }-- close() {- this.modal.close();- }-- removeBookmark(bookmark: PageBookmark, index: number) {- this.bookmarks.splice(index, 1);- }-- downloadBookmarks() {- this.isDownloading = true;- this.downloadService.downloadBookmarks(this.bookmarks).pipe(- takeWhile(val => {- return val.state != 'DONE';- }),- finalize(() => {- this.isDownloading = false;- })).subscribe(() => {/* No Operation */});- }-- clearBookmarks() {- this.isClearing = true;- this.readerService.clearBookmarks(this.series.id).subscribe(() => {- this.isClearing = false;- this.init();- this.toastr.success(this.series.name + '\'s bookmarks have been removed');- });- }--}diff --git a/UI/Web/src/app/cards/_modals/bulk-add-to-collection/bulk-add-to-collection.component.html b/UI/Web/src/app/cards/_modals/bulk-add-to-collection/bulk-add-to-collection.component.htmlindex 8f5fd60df..0fa6d0888 100644--- a/UI/Web/src/app/cards/_modals/bulk-add-to-collection/bulk-add-to-collection.component.html+++ b/UI/Web/src/app/cards/_modals/bulk-add-to-collection/bulk-add-to-collection.component.html@@ -30,7 +30,7 @@<div style="width: 100%;"><div class="d-flex"><div class="col-9 col-lg-10">- <label class="visually-hidden" class="form-label" for="add-rlist">Collection</label>+ <label class="form-label visually-hidden" for="add-rlist">Collection</label><input width="100%" #title ngbAutofocus type="text" class="form-control mb-2" id="add-rlist" formControlName="title"></div><div class="col-2">diff --git a/UI/Web/src/app/cards/_modals/card-details-modal/card-details-modal.component.html b/UI/Web/src/app/cards/_modals/card-details-modal/card-details-modal.component.htmlindex 3bab2708c..b8f8e905e 100644--- a/UI/Web/src/app/cards/_modals/card-details-modal/card-details-modal.component.html+++ b/UI/Web/src/app/cards/_modals/card-details-modal/card-details-modal.component.html@@ -91,20 +91,6 @@<li [ngbNavItem]="tabs[3]" *ngIf="!tabs[3].disabled"><a ngbNavLink>{{tabs[3].title}}</a>- <ng-template ngbNavContent>- <div class="row g-0">- <ng-container *ngFor="let bookmark of bookmarks; let idx = index">- <app-bookmark [bookmark]="bookmark" class="col-auto" (bookmarkRemoved)="removeBookmark(bookmark, idx)"></app-bookmark>- </ng-container>- <ng-container *ngIf="bookmarks.length === 0">- No bookmarks yet- </ng-container>- </div>- </ng-template>- </li>-- <li [ngbNavItem]="tabs[4]" *ngIf="!tabs[4].disabled">- <a ngbNavLink>{{tabs[4].title}}</a><ng-template ngbNavContent><h4 *ngIf="!utilityService.isChapter(data)">{{utilityService.formatChapterName(libraryType) + 's'}}</h4><ul class="list-unstyled">diff --git a/UI/Web/src/app/cards/_modals/card-details-modal/card-details-modal.component.ts b/UI/Web/src/app/cards/_modals/card-details-modal/card-details-modal.component.tsindex d65215ef6..6c9b86133 100644--- a/UI/Web/src/app/cards/_modals/card-details-modal/card-details-modal.component.ts+++ b/UI/Web/src/app/cards/_modals/card-details-modal/card-details-modal.component.ts@@ -66,9 +66,8 @@ export class CardDetailsModalComponent implements OnInit {chapterActions: ActionItem<Chapter>[] = [];libraryType: LibraryType = LibraryType.Manga;- bookmarks: PageBookmark[] = [];- tabs = [{title: 'General', disabled: false}, {title: 'Metadata', disabled: false}, {title: 'Cover', disabled: false}, {title: 'Bookmarks', disabled: false}, {title: 'Info', disabled: false}];+ tabs = [{title: 'General', disabled: false}, {title: 'Metadata', disabled: false}, {title: 'Cover', disabled: false}, {title: 'Info', disabled: false}];active = this.tabs[0];chapterMetadata!: ChapterMetadata;@@ -95,23 +94,11 @@ export class CardDetailsModalComponent implements OnInit {ngOnInit(): void {this.isChapter = this.utilityService.isChapter(this.data);- console.log('isChapter: ', this.isChapter);this.chapter = this.utilityService.isChapter(this.data) ? (this.data as Chapter) : (this.data as Volume).chapters[0];this.imageUrls.push(this.imageService.getChapterCoverImage(this.chapter.id));- let bookmarkApi;- if (this.isChapter) {- bookmarkApi = this.readerService.getBookmarks(this.chapter.id);- } else {- bookmarkApi = this.readerService.getBookmarksForVolume(this.data.id);- }-- bookmarkApi.pipe(take(1)).subscribe(bookmarks => {- this.bookmarks = bookmarks;- });-this.seriesService.getChapterMetadata(this.chapter.id).subscribe(metadata => {this.chapterMetadata = metadata;@@ -241,10 +228,4 @@ export class CardDetailsModalComponent implements OnInit {this.router.navigate(['library', this.libraryId, 'series', this.seriesId, 'manga', chapter.id]);}}-- removeBookmark(bookmark: PageBookmark, index: number) {- this.readerService.unbookmark(bookmark.seriesId, bookmark.volumeId, bookmark.chapterId, bookmark.page).subscribe(() => {- this.bookmarks.splice(index, 1);- });- }}diff --git a/UI/Web/src/app/cards/_modals/edit-collection-tags/edit-collection-tags.component.html b/UI/Web/src/app/cards/_modals/edit-collection-tags/edit-collection-tags.component.htmlindex 27a3916f2..3e014b1af 100644--- a/UI/Web/src/app/cards/_modals/edit-collection-tags/edit-collection-tags.component.html+++ b/UI/Web/src/app/cards/_modals/edit-collection-tags/edit-collection-tags.component.html@@ -5,16 +5,15 @@</button></div>-<div class="modal-body">- <p>- This tag is currently {{tag?.promoted ? 'promoted' : 'not promoted'}} (<i class="fa fa-angle-double-up" aria-hidden="true"></i>).- Promotion means that the tag can be seen server-wide, not just for admin users. All series that have this tag will still have user-access restrictions placed on them.- </p>-- <ul ngbNav #nav="ngbNav" [(activeId)]="active" class="nav-tabs nav-pills">+<div class="modal-body {{utilityService.getActiveBreakpoint() === Breakpoint.Mobile ? '' : 'd-flex'}}">+ <ul ngbNav #nav="ngbNav" [(activeId)]="active" class="nav-pills" orientation="{{utilityService.getActiveBreakpoint() === Breakpoint.Mobile ? 'horizontal' : 'vertical'}}" style="min-width: 135px;"><li [ngbNavItem]="tabs[0]"><a ngbNavLink>{{tabs[0]}}</a><ng-template ngbNavContent>+ <p>+ This tag is currently {{tag?.promoted ? 'promoted' : 'not promoted'}} (<i class="fa fa-angle-double-up" aria-hidden="true"></i>).+ Promotion means that the tag can be seen server-wide, not just for admin users. All series that have this tag will still have user-access restrictions placed on them.+ </p><form [formGroup]="collectionTagForm"><div class="mb-3"><label for="summary" class="form-label">Summary</label>@@ -62,7 +61,7 @@</ul>- <div [ngbNavOutlet]="nav" class="mt-3"></div>+ <div [ngbNavOutlet]="nav" class="mt-3 ms-2"></div></div><div class="modal-footer">diff --git a/UI/Web/src/app/cards/_modals/edit-collection-tags/edit-collection-tags.component.ts b/UI/Web/src/app/cards/_modals/edit-collection-tags/edit-collection-tags.component.tsindex ba9d8a7fa..6defd7126 100644--- a/UI/Web/src/app/cards/_modals/edit-collection-tags/edit-collection-tags.component.ts+++ b/UI/Web/src/app/cards/_modals/edit-collection-tags/edit-collection-tags.component.ts@@ -4,6 +4,7 @@ import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';import { ToastrService } from 'ngx-toastr';import { forkJoin } from 'rxjs';import { ConfirmService } from 'src/app/shared/confirm.service';+import { Breakpoint, UtilityService } from 'src/app/shared/_services/utility.service';import { SelectionModel } from 'src/app/typeahead/typeahead.component';import { CollectionTag } from 'src/app/_models/collection-tag';import { Pagination } from 'src/app/_models/pagination';@@ -14,6 +15,7 @@ import { LibraryService } from 'src/app/_services/library.service';import { SeriesService } from 'src/app/_services/series.service';import { UploadService } from 'src/app/_services/upload.service';+@Component({selector: 'app-edit-collection-tags',templateUrl: './edit-collection-tags.component.html',@@ -39,11 +41,15 @@ export class EditCollectionTagsComponent implements OnInit {return this.selections != null && this.selections.hasSomeSelected();}+ get Breakpoint() {+ return Breakpoint;+ }constructor(public modal: NgbActiveModal, private seriesService: SeriesService,private collectionService: CollectionTagService, private toastr: ToastrService,private confirmSerivce: ConfirmService, private libraryService: LibraryService,- private imageService: ImageService, private uploadService: UploadService) { }+ private imageService: ImageService, private uploadService: UploadService,+ public utilityService: UtilityService) { }ngOnInit(): void {if (this.pagination == undefined) {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.htmlindex e6bf5a81a..08b135ef3 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@@ -10,318 +10,318 @@<form [formGroup]="editSeriesForm"><ul ngbNav #nav="ngbNav" [(activeId)]="active" class="nav-pills" orientation="{{utilityService.getActiveBreakpoint() === Breakpoint.Mobile ? 'horizontal' : 'vertical'}}" style="min-width: 135px;">- <li [ngbNavItem]="tabs[0]">- <a ngbNavLink>{{tabs[0]}}</a>- <ng-template ngbNavContent>- <div class="row g-0">- <div class="mb-3" style="width: 100%">- <label for="name" class="form-label">Name</label>- <div class="input-group {{series.nameLocked ? 'lock-active' : ''}}">- <ng-container [ngTemplateOutlet]="lock" [ngTemplateOutletContext]="{ item: series, field: 'nameLocked' }"></ng-container>- <input id="name" class="form-control" formControlName="name" type="text">- </div>+ <li [ngbNavItem]="tabs[TabID.General]">+ <a ngbNavLink>{{tabs[TabID.General]}}</a>+ <ng-template ngbNavContent>+ <div class="row g-0">+ <div class="mb-3" style="width: 100%">+ <label for="name" class="form-label">Name</label>+ <div class="input-group {{series.nameLocked ? 'lock-active' : ''}}">+ <ng-container [ngTemplateOutlet]="lock" [ngTemplateOutletContext]="{ item: series, field: 'nameLocked' }"></ng-container>+ <input id="name" class="form-control" formControlName="name" type="text"></div></div>+ </div>- <div class="row g-0">- <div class="mb-3" style="width: 100%">- <label for="sort-name" class="form-label">Sort Name</label>- <div class="input-group {{series.sortNameLocked ? 'lock-active' : ''}}">- <ng-container [ngTemplateOutlet]="lock" [ngTemplateOutletContext]="{ item: series, field: 'sortNameLocked' }"></ng-container>- <input id="sort-name" class="form-control" formControlName="sortName" type="text">- </div>+ <div class="row g-0">+ <div class="mb-3" style="width: 100%">+ <label for="sort-name" class="form-label">Sort Name</label>+ <div class="input-group {{series.sortNameLocked ? 'lock-active' : ''}}">+ <ng-container [ngTemplateOutlet]="lock" [ngTemplateOutletContext]="{ item: series, field: 'sortNameLocked' }"></ng-container>+ <input id="sort-name" class="form-control" formControlName="sortName" type="text"></div></div>+ </div>- <div class="row g-0">- <div class="mb-3" style="width: 100%">- <label for="localized-name" class="form-label">Localized Name</label>- <div class="input-group {{series.localizedNameLocked ? 'lock-active' : ''}}">- <ng-container [ngTemplateOutlet]="lock" [ngTemplateOutletContext]="{ item: series, field: 'localizedNameLocked' }"></ng-container>- <input id="localized-name" class="form-control" formControlName="localizedName" type="text">- </div>+ <div class="row g-0">+ <div class="mb-3" style="width: 100%">+ <label for="localized-name" class="form-label">Localized Name</label>+ <div class="input-group {{series.localizedNameLocked ? 'lock-active' : ''}}">+ <ng-container [ngTemplateOutlet]="lock" [ngTemplateOutletContext]="{ item: series, field: 'localizedNameLocked' }"></ng-container>+ <input id="localized-name" class="form-control" formControlName="localizedName" type="text"></div></div>+ </div>- <div class="row g-0" *ngIf="metadata">- <div class="mb-3" style="width: 100%">- <label for="summary" class="form-label">Summary</label>- <div class="input-group {{metadata?.summaryLocked ? 'lock-active' : ''}}">- <ng-container [ngTemplateOutlet]="lock" [ngTemplateOutletContext]="{ item: metadata, field: 'summaryLocked' }"></ng-container>- <textarea id="summary" class="form-control" formControlName="summary" rows="4"></textarea>- </div>+ <div class="row g-0" *ngIf="metadata">+ <div class="mb-3" style="width: 100%">+ <label for="summary" class="form-label">Summary</label>+ <div class="input-group {{metadata?.summaryLocked ? 'lock-active' : ''}}">+ <ng-container [ngTemplateOutlet]="lock" [ngTemplateOutletContext]="{ item: metadata, field: 'summaryLocked' }"></ng-container>+ <textarea id="summary" class="form-control" formControlName="summary" rows="4"></textarea></div></div>+ </div>- </ng-template>- </li>- <li [ngbNavItem]="tabs[1]" *ngIf="metadata">- <a ngbNavLink>{{tabs[1]}}</a>- <ng-template ngbNavContent>-- <div class="row g-0">- <div class="col-md-12">- <div class="mb-3">- <label for="collections" class="form-label">Collections </label>- <app-typeahead (selectedData)="updateCollections($event)" [settings]="collectionTagSettings" [locked]="true">- <ng-template #badgeItem let-item let-position="idx">- {{item.title}}- </ng-template>- <ng-template #optionItem let-item let-position="idx">- {{item.title}}- </ng-template>- </app-typeahead>- </div>- </div>- </div>-- <div class="row g-0">- <div class="col-md-12">- <div class="mb-3">- <label for="genres" class="form-label">Genres</label>- <app-typeahead (selectedData)="updateGenres($event)" [settings]="genreSettings"- [(locked)]="metadata.genresLocked" (onUnlock)="metadata.genresLocked = false"- (newItemAdded)="metadata.genresLocked = true" (selectedData)="metadata.genresLocked = true">- <ng-template #badgeItem let-item let-position="idx">- {{item.title}}- </ng-template>- <ng-template #optionItem let-item let-position="idx">- {{item.title}}- </ng-template>- </app-typeahead>- </div>- </div>- </div>-- <div class="row g-0">- <div class="col-md-12">- <div class="mb-3">- <label for="tags" class="form-label">Tags</label>- <app-typeahead (selectedData)="updateTags($event)" [settings]="tagsSettings"- [(locked)]="metadata.tagsLocked" (onUnlock)="metadata.tagsLocked = false"- (newItemAdded)="metadata.tagsLocked = true" (selectedData)="metadata.tagsLocked = true">- <ng-template #badgeItem let-item let-position="idx">- {{item.title}}- </ng-template>- <ng-template #optionItem let-item let-position="idx">- {{item.title}}- </ng-template>- </app-typeahead>- </div>- </div>- </div>+ </ng-template>+ </li>+ <li [ngbNavItem]="tabs[TabID.Metadata]" *ngIf="metadata">+ <a ngbNavLink>{{tabs[TabID.Metadata]}}</a>+ <ng-template ngbNavContent>- <div class="row g-0">- <div class="col-lg-4 col-md-12 pe-2">- <div class="mb-3">- <label for="language" class="form-label">Language</label>- <app-typeahead (selectedData)="updateLanguage($event)" [settings]="languageSettings"- [(locked)]="metadata.languageLocked" (onUnlock)="metadata.languageLocked = false"- (newItemAdded)="metadata.languageLocked = true" (selectedData)="metadata.languageLocked = true">- <ng-template #badgeItem let-item let-position="idx">- {{item.title}}- </ng-template>- <ng-template #optionItem let-item let-position="idx">- {{item.title}} ({{item.isoCode}})- </ng-template>- </app-typeahead>- </div>- </div>- <div class="col-lg-4 col-md-12 pe-2">- <div class="mb-3">- <label for="age-rating" class="form-label">Age Rating</label>- <div class="input-group {{metadata.ageRatingLocked ? 'lock-active' : ''}}">- <ng-container [ngTemplateOutlet]="lock" [ngTemplateOutletContext]="{ item: metadata, field: 'ageRatingLocked' }"></ng-container>- <select class="form-select"id="age-rating" formControlName="ageRating">- <option *ngFor="let opt of ageRatings" [value]="opt.value">{{opt.title | titlecase}}</option>- </select>- </div>- </div>- </div>- <div class="col-lg-4 col-md-12">- <div class="mb-3">- <label for="publication-status" class="form-label">Publication Status</label>- <div class="input-group {{metadata.publicationStatusLocked ? 'lock-active' : ''}}">- <ng-container [ngTemplateOutlet]="lock" [ngTemplateOutletContext]="{ item: metadata, field: 'publicationStatusLocked' }"></ng-container>- <select class="form-select"id="publication-status" formControlName="publicationStatus">- <option *ngFor="let opt of publicationStatuses" [value]="opt.value">{{opt.title | titlecase}}</option>- </select>- </div>- </div>- </div>- </div>- </ng-template>- </li>-- <li [ngbNavItem]="tabs[2]">- <a ngbNavLink>{{tabs[2]}}</a>- <ng-template ngbNavContent>- <div class="row g-0">+ <div class="row g-0">+ <div class="col-md-12"><div class="mb-3">- <label for="writer" class="form-label">Writer</label>- <app-typeahead (selectedData)="updatePerson($event, PersonRole.Writer)" [settings]="getPersonsSettings(PersonRole.Writer)"- [(locked)]="metadata.writersLocked" (onUnlock)="metadata.writersLocked = false"- (newItemAdded)="metadata.writersLocked = true" (selectedData)="metadata.writersLocked = true">+ <label for="collections" class="form-label">Collections </label>+ <app-typeahead (selectedData)="updateCollections($event)" [settings]="collectionTagSettings" [locked]="true"><ng-template #badgeItem let-item let-position="idx">- {{item.name}}+ {{item.title}}</ng-template><ng-template #optionItem let-item let-position="idx">- {{item.name}}+ {{item.title}}</ng-template></app-typeahead></div></div>- <div class="row g-0">+ </div>++ <div class="row g-0">+ <div class="col-md-12"><div class="mb-3">- <label for="cover-artist" class="form-label">Cover Artist</label>- <app-typeahead (selectedData)="updatePerson($event, PersonRole.CoverArtist)" [settings]="getPersonsSettings(PersonRole.CoverArtist)"- [(locked)]="metadata.coverArtistsLocked" (onUnlock)="metadata.coverArtistsLocked = false"- (newItemAdded)="metadata.coverArtistsLocked = true" (selectedData)="metadata.coverArtistsLocked = true">+ <label for="genres" class="form-label">Genres</label>+ <app-typeahead (selectedData)="updateGenres($event)" [settings]="genreSettings"+ [(locked)]="metadata.genresLocked" (onUnlock)="metadata.genresLocked = false"+ (newItemAdded)="metadata.genresLocked = true" (selectedData)="metadata.genresLocked = true"><ng-template #badgeItem let-item let-position="idx">- {{item.name}}+ {{item.title}}</ng-template><ng-template #optionItem let-item let-position="idx">- {{item.name}}+ {{item.title}}</ng-template></app-typeahead></div></div>+ </div>-- <div class="row g-0">+ <div class="row g-0">+ <div class="col-md-12"><div class="mb-3">- <label for="publisher" class="form-label">Publisher</label>- <app-typeahead (selectedData)="updatePerson($event, PersonRole.Publisher)" [settings]="getPersonsSettings(PersonRole.Publisher)"- [(locked)]="metadata.publishersLocked" (onUnlock)="metadata.publishersLocked = false"- (newItemAdded)="metadata.publishersLocked = true" (selectedData)="metadata.publishersLocked = true">+ <label for="tags" class="form-label">Tags</label>+ <app-typeahead (selectedData)="updateTags($event)" [settings]="tagsSettings"+ [(locked)]="metadata.tagsLocked" (onUnlock)="metadata.tagsLocked = false"+ (newItemAdded)="metadata.tagsLocked = true" (selectedData)="metadata.tagsLocked = true"><ng-template #badgeItem let-item let-position="idx">- {{item.name}}+ {{item.title}}</ng-template><ng-template #optionItem let-item let-position="idx">- {{item.name}}+ {{item.title}}</ng-template></app-typeahead></div></div>- <div class="row g-0">+ </div>++ <div class="row g-0">+ <div class="col-lg-4 col-md-12 pe-2"><div class="mb-3">- <label for="penciller" class="form-label">Penciller</label>- <app-typeahead (selectedData)="updatePerson($event, PersonRole.Penciller)" [settings]="getPersonsSettings(PersonRole.Penciller)"- [(locked)]="metadata.pencillersLocked" (onUnlock)="metadata.pencillersLocked = false"- (newItemAdded)="metadata.pencillersLocked = true" (selectedData)="metadata.pencillersLocked = true">+ <label for="language" class="form-label">Language</label>+ <app-typeahead (selectedData)="updateLanguage($event)" [settings]="languageSettings"+ [(locked)]="metadata.languageLocked" (onUnlock)="metadata.languageLocked = false"+ (newItemAdded)="metadata.languageLocked = true" (selectedData)="metadata.languageLocked = true"><ng-template #badgeItem let-item let-position="idx">- {{item.name}}+ {{item.title}}</ng-template><ng-template #optionItem let-item let-position="idx">- {{item.name}}+ {{item.title}} ({{item.isoCode}})</ng-template></app-typeahead></div></div>--- <div class="row g-0">+ <div class="col-lg-4 col-md-12 pe-2"><div class="mb-3">- <label for="letterer" class="form-label">Letterer</label>- <app-typeahead (selectedData)="updatePerson($event, PersonRole.Letterer)" [settings]="getPersonsSettings(PersonRole.Letterer)"- [(locked)]="metadata.letterersLocked" (onUnlock)="metadata.letterersLocked = false"- (newItemAdded)="metadata.letterersLocked = true" (selectedData)="metadata.letterersLocked = true">- <ng-template #badgeItem let-item let-position="idx">- {{item.name}}- </ng-template>- <ng-template #optionItem let-item let-position="idx">- {{item.name}}- </ng-template>- </app-typeahead>+ <label for="age-rating" class="form-label">Age Rating</label>+ <div class="input-group {{metadata.ageRatingLocked ? 'lock-active' : ''}}">+ <ng-container [ngTemplateOutlet]="lock" [ngTemplateOutletContext]="{ item: metadata, field: 'ageRatingLocked' }"></ng-container>+ <select class="form-select"id="age-rating" formControlName="ageRating">+ <option *ngFor="let opt of ageRatings" [value]="opt.value">{{opt.title | titlecase}}</option>+ </select>+ </div></div></div>- <div class="row g-0">+ <div class="col-lg-4 col-md-12"><div class="mb-3">- <label for="inker" class="form-label">Inker</label>- <app-typeahead (selectedData)="updatePerson($event, PersonRole.Inker)" [settings]="getPersonsSettings(PersonRole.Inker)"- [(locked)]="metadata.inkersLocked" (onUnlock)="metadata.inkersLocked = false"- (newItemAdded)="metadata.inkersLocked = true" (selectedData)="metadata.inkersLocked = true">- <ng-template #badgeItem let-item let-position="idx">- {{item.name}}- </ng-template>- <ng-template #optionItem let-item let-position="idx">- {{item.name}}- </ng-template>- </app-typeahead>+ <label for="publication-status" class="form-label">Publication Status</label>+ <div class="input-group {{metadata.publicationStatusLocked ? 'lock-active' : ''}}">+ <ng-container [ngTemplateOutlet]="lock" [ngTemplateOutletContext]="{ item: metadata, field: 'publicationStatusLocked' }"></ng-container>+ <select class="form-select"id="publication-status" formControlName="publicationStatus">+ <option *ngFor="let opt of publicationStatuses" [value]="opt.value">{{opt.title | titlecase}}</option>+ </select>+ </div></div></div>+ </div>+ </ng-template>+ </li>++ <li [ngbNavItem]="tabs[TabID.People]">+ <a ngbNavLink>{{tabs[TabID.People]}}</a>+ <ng-template ngbNavContent>+ <div class="row g-0">+ <div class="mb-3">+ <label for="writer" class="form-label">Writer</label>+ <app-typeahead (selectedData)="updatePerson($event, PersonRole.Writer)" [settings]="getPersonsSettings(PersonRole.Writer)"+ [(locked)]="metadata.writersLocked" (onUnlock)="metadata.writersLocked = false"+ (newItemAdded)="metadata.writersLocked = true" (selectedData)="metadata.writersLocked = true">+ <ng-template #badgeItem let-item let-position="idx">+ {{item.name}}+ </ng-template>+ <ng-template #optionItem let-item let-position="idx">+ {{item.name}}+ </ng-template>+ </app-typeahead>+ </div>+ </div>+ <div class="row g-0">+ <div class="mb-3">+ <label for="cover-artist" class="form-label">Cover Artist</label>+ <app-typeahead (selectedData)="updatePerson($event, PersonRole.CoverArtist)" [settings]="getPersonsSettings(PersonRole.CoverArtist)"+ [(locked)]="metadata.coverArtistsLocked" (onUnlock)="metadata.coverArtistsLocked = false"+ (newItemAdded)="metadata.coverArtistsLocked = true" (selectedData)="metadata.coverArtistsLocked = true">+ <ng-template #badgeItem let-item let-position="idx">+ {{item.name}}+ </ng-template>+ <ng-template #optionItem let-item let-position="idx">+ {{item.name}}+ </ng-template>+ </app-typeahead>+ </div>+ </div>+++ <div class="row g-0">+ <div class="mb-3">+ <label for="publisher" class="form-label">Publisher</label>+ <app-typeahead (selectedData)="updatePerson($event, PersonRole.Publisher)" [settings]="getPersonsSettings(PersonRole.Publisher)"+ [(locked)]="metadata.publishersLocked" (onUnlock)="metadata.publishersLocked = false"+ (newItemAdded)="metadata.publishersLocked = true" (selectedData)="metadata.publishersLocked = true">+ <ng-template #badgeItem let-item let-position="idx">+ {{item.name}}+ </ng-template>+ <ng-template #optionItem let-item let-position="idx">+ {{item.name}}+ </ng-template>+ </app-typeahead>+ </div>+ </div>+ <div class="row g-0">+ <div class="mb-3">+ <label for="penciller" class="form-label">Penciller</label>+ <app-typeahead (selectedData)="updatePerson($event, PersonRole.Penciller)" [settings]="getPersonsSettings(PersonRole.Penciller)"+ [(locked)]="metadata.pencillersLocked" (onUnlock)="metadata.pencillersLocked = false"+ (newItemAdded)="metadata.pencillersLocked = true" (selectedData)="metadata.pencillersLocked = true">+ <ng-template #badgeItem let-item let-position="idx">+ {{item.name}}+ </ng-template>+ <ng-template #optionItem let-item let-position="idx">+ {{item.name}}+ </ng-template>+ </app-typeahead>+ </div>+ </div>+ <div class="row g-0">+ <div class="mb-3">+ <label for="letterer" class="form-label">Letterer</label>+ <app-typeahead (selectedData)="updatePerson($event, PersonRole.Letterer)" [settings]="getPersonsSettings(PersonRole.Letterer)"+ [(locked)]="metadata.letterersLocked" (onUnlock)="metadata.letterersLocked = false"+ (newItemAdded)="metadata.letterersLocked = true" (selectedData)="metadata.letterersLocked = true">+ <ng-template #badgeItem let-item let-position="idx">+ {{item.name}}+ </ng-template>+ <ng-template #optionItem let-item let-position="idx">+ {{item.name}}+ </ng-template>+ </app-typeahead>+ </div>+ </div>+ <div class="row g-0">+ <div class="mb-3">+ <label for="inker" class="form-label">Inker</label>+ <app-typeahead (selectedData)="updatePerson($event, PersonRole.Inker)" [settings]="getPersonsSettings(PersonRole.Inker)"+ [(locked)]="metadata.inkersLocked" (onUnlock)="metadata.inkersLocked = false"+ (newItemAdded)="metadata.inkersLocked = true" (selectedData)="metadata.inkersLocked = true">+ <ng-template #badgeItem let-item let-position="idx">+ {{item.name}}+ </ng-template>+ <ng-template #optionItem let-item let-position="idx">+ {{item.name}}+ </ng-template>+ </app-typeahead>+ </div>+ </div>- <div class="row g-0">- <div class="mb-3">- <label for="editor" class="form-label">Editor</label>- <app-typeahead (selectedData)="updatePerson($event, PersonRole.Editor)" [settings]="getPersonsSettings(PersonRole.Editor)"- [(locked)]="metadata.editorsLocked" (onUnlock)="metadata.editorsLocked = false"- (newItemAdded)="metadata.editorsLocked = true" (selectedData)="metadata.editorsLocked = true">- <ng-template #badgeItem let-item let-position="idx">- {{item.name}}- </ng-template>- <ng-template #optionItem let-item let-position="idx">- {{item.name}}- </ng-template>- </app-typeahead>- </div>+++ <div class="row g-0">+ <div class="mb-3">+ <label for="editor" class="form-label">Editor</label>+ <app-typeahead (selectedData)="updatePerson($event, PersonRole.Editor)" [settings]="getPersonsSettings(PersonRole.Editor)"+ [(locked)]="metadata.editorsLocked" (onUnlock)="metadata.editorsLocked = false"+ (newItemAdded)="metadata.editorsLocked = true" (selectedData)="metadata.editorsLocked = true">+ <ng-template #badgeItem let-item let-position="idx">+ {{item.name}}+ </ng-template>+ <ng-template #optionItem let-item let-position="idx">+ {{item.name}}+ </ng-template>+ </app-typeahead></div>- <div class="row g-0">- <div class="mb-3">- <label for="colorist" class="form-label">Colorist</label>- <app-typeahead (selectedData)="updatePerson($event, PersonRole.Colorist)" [settings]="getPersonsSettings(PersonRole.Colorist)"- [(locked)]="metadata.coloristsLocked" (onUnlock)="metadata.coloristsLocked = false"- (newItemAdded)="metadata.coloristsLocked = true" (selectedData)="metadata.coloristsLocked = true">- <ng-template #badgeItem let-item let-position="idx">- {{item.name}}- </ng-template>- <ng-template #optionItem let-item let-position="idx">- {{item.name}}- </ng-template>- </app-typeahead>- </div>+ </div>+ <div class="row g-0">+ <div class="mb-3">+ <label for="colorist" class="form-label">Colorist</label>+ <app-typeahead (selectedData)="updatePerson($event, PersonRole.Colorist)" [settings]="getPersonsSettings(PersonRole.Colorist)"+ [(locked)]="metadata.coloristsLocked" (onUnlock)="metadata.coloristsLocked = false"+ (newItemAdded)="metadata.coloristsLocked = true" (selectedData)="metadata.coloristsLocked = true">+ <ng-template #badgeItem let-item let-position="idx">+ {{item.name}}+ </ng-template>+ <ng-template #optionItem let-item let-position="idx">+ {{item.name}}+ </ng-template>+ </app-typeahead></div>+ </div>-+- <div class="row g-0">- <div class="mb-3">- <label for="character" class="form-label">Character</label>- <app-typeahead (selectedData)="updatePerson($event, PersonRole.Character)" [settings]="getPersonsSettings(PersonRole.Character)"- [(locked)]="metadata.charactersLocked" (onUnlock)="metadata.charactersLocked = false"- (newItemAdded)="metadata.charactersLocked = true" (selectedData)="metadata.charactersLocked = true">- <ng-template #badgeItem let-item let-position="idx">- {{item.name}}- </ng-template>- <ng-template #optionItem let-item let-position="idx">- {{item.name}}- </ng-template>- </app-typeahead>- </div>+ <div class="row g-0">+ <div class="mb-3">+ <label for="character" class="form-label">Character</label>+ <app-typeahead (selectedData)="updatePerson($event, PersonRole.Character)" [settings]="getPersonsSettings(PersonRole.Character)"+ [(locked)]="metadata.charactersLocked" (onUnlock)="metadata.charactersLocked = false"+ (newItemAdded)="metadata.charactersLocked = true" (selectedData)="metadata.charactersLocked = true">+ <ng-template #badgeItem let-item let-position="idx">+ {{item.name}}+ </ng-template>+ <ng-template #optionItem let-item let-position="idx">+ {{item.name}}+ </ng-template>+ </app-typeahead></div>- <div class="row g-0">- <div class="mb-3">- <label for="translator" class="form-label">Translators</label>- <app-typeahead (selectedData)="updatePerson($event, PersonRole.Translator)" [settings]="getPersonsSettings(PersonRole.Translator)"- [(locked)]="metadata.translatorsLocked" (onUnlock)="metadata.translatorsLocked = false"- (newItemAdded)="metadata.translatorsLocked = true" (selectedData)="metadata.translatorsLocked = true">- <ng-template #badgeItem let-item let-position="idx">- {{item.name}}- </ng-template>- <ng-template #optionItem let-item let-position="idx">- {{item.name}}- </ng-template>- </app-typeahead>- </div>+ </div>+ <div class="row g-0">+ <div class="mb-3">+ <label for="translator" class="form-label">Translators</label>+ <app-typeahead (selectedData)="updatePerson($event, PersonRole.Translator)" [settings]="getPersonsSettings(PersonRole.Translator)"+ [(locked)]="metadata.translatorsLocked" (onUnlock)="metadata.translatorsLocked = false"+ (newItemAdded)="metadata.translatorsLocked = true" (selectedData)="metadata.translatorsLocked = true">+ <ng-template #badgeItem let-item let-position="idx">+ {{item.name}}+ </ng-template>+ <ng-template #optionItem let-item let-position="idx">+ {{item.name}}+ </ng-template>+ </app-typeahead></div>+ </div>- </ng-template>- </li>+ </ng-template>+ </li>- <li [ngbNavItem]="tabs[3]">- <a ngbNavLink>{{tabs[3]}}</a>+ <li [ngbNavItem]="tabs[TabID.CoverImage]">+ <a ngbNavLink>{{tabs[TabID.CoverImage]}}</a><ng-template ngbNavContent><p class="alert alert-primary" role="alert">Upload and choose a new cover image. Press Save to upload and override the cover.@@ -329,65 +329,83 @@<app-cover-image-chooser [(imageUrls)]="imageUrls" (imageSelected)="updateSelectedIndex($event)" (selectedBase64Url)="updateSelectedImage($event)" [showReset]="series.coverImageLocked" (resetClicked)="handleReset()"></app-cover-image-chooser></ng-template></li>- <li [ngbNavItem]="tabs[4]">- <a ngbNavLink>{{tabs[4]}}</a>+ <li [ngbNavItem]="tabs[TabID.Related]">+ <a ngbNavLink>{{tabs[TabID.Related]}}</a>+ <ng-template ngbNavContent>+ <app-edit-series-relation [series]="series" [save]="saveNestedComponents"></app-edit-series-relation>+ </ng-template>+ </li>+ <li [ngbNavItem]="tabs[TabID.Info]">+ <a ngbNavLink>{{tabs[TabID.Info]}}</a><ng-template ngbNavContent><h4>Information</h4><div class="row g-0 mb-2"><div class="col-md-6" *ngIf="libraryName">Library: {{libraryName | sentenceCase}}</div><div class="col-md-6">Format: <app-tag-badge>{{utilityService.mangaFormat(series.format)}}</app-tag-badge></div></div>- <h4>Volumes</h4>- <div class="spinner-border text-secondary" role="status" *ngIf="isLoadingVolumes">- <span class="invisible">Loading...</span>- </div>- <ul class="list-unstyled" *ngIf="!isLoadingVolumes">- <li class="d-flex my-4" *ngFor="let volume of seriesVolumes">- <app-image class="me-3" style="width: 74px;" width="74px" [imageUrl]="imageService.getVolumeCoverImage(volume.id)"></app-image>- <div class="flex-grow-1">- <h5 class="mt-0 mb-1">Volume {{volume.name}}</h5>- <div>- <div class="row g-0">- <div class="col">- Added: {{volume.created | date: 'short'}}- </div>- <div class="col">- Last Modified: {{volume.lastModified | date: 'short'}}- </div>- </div>- <div class="row g-0">- <div class="col">- <button type="button" class="btn btn-outline-primary" (click)="collapse.toggle()" [attr.aria-expanded]="!volumeCollapsed[volume.name]">- View Files- </button>- </div>- <div class="col">- Pages: {{volume.pages}}- </div>- </div>-- <div #collapse="ngbCollapse" [(ngbCollapse)]="volumeCollapsed[volume.name]">- <ul class="list-group mt-2">- <li *ngFor="let file of volume.volumeFiles.sort()" class="list-group-item">- <span>{{file.filePath}}</span>- <div class="row g-0">- <div class="col">- Chapter: {{file.chapter}}- </div>- <div class="col">- Pages: {{file.pages}}- </div>- <div class="col">- Format: <span class="badge badge-secondary">{{utilityService.mangaFormatToText(file.format)}}</span>- </div>- </div>- </li>- </ul>- </div>- </div>- </div>- </li>- </ul>+ <div class="row g-0 mb-2">+ <div class="col-md-6" >Created: {{series.created | date:'shortDate'}}</div>+ <div class="col-md-6">Last Read: {{series.latestReadDate | date:'shortDate'}}</div>+ <div class="col-md-6">Last Added To: {{series.lastChapterAdded | date:'shortDate'}}</div>+ </div>+ <div class="row g-0 mb-2" *ngIf="metadata">+ <div class="col-md-6">Max Items: {{metadata.maxCount}}</div>+ <div class="col-md-6">Total Items: {{metadata.totalCount}}</div>+ <div class="col-md-6">Publication Status: {{metadata.publicationStatus | publicationStatus}}</div>+ <div class="col-md-6">Total Pages: {{series.pages}}</div>++ </div>+ <h4>Volumes</h4>+ <div class="spinner-border text-secondary" role="status" *ngIf="isLoadingVolumes">+ <span class="invisible">Loading...</span>+ </div>+ <ul class="list-unstyled" *ngIf="!isLoadingVolumes">+ <li class="d-flex my-4" *ngFor="let volume of seriesVolumes">+ <app-image class="me-3" style="width: 74px;" width="74px" [imageUrl]="imageService.getVolumeCoverImage(volume.id)"></app-image>+ <div class="flex-grow-1">+ <h5 class="mt-0 mb-1">Volume {{volume.name}}</h5>+ <div>+ <div class="row g-0">+ <div class="col">+ Added: {{volume.created | date: 'short'}}+ </div>+ <div class="col">+ Last Modified: {{volume.lastModified | date: 'short'}}+ </div>+ </div>+ <div class="row g-0">+ <div class="col">+ <button type="button" class="btn btn-outline-primary" (click)="collapse.toggle()" [attr.aria-expanded]="!volumeCollapsed[volume.name]">+ View Files+ </button>+ </div>+ <div class="col">+ Pages: {{volume.pages}}+ </div>+ </div>++ <div #collapse="ngbCollapse" [(ngbCollapse)]="volumeCollapsed[volume.name]">+ <ul class="list-group mt-2">+ <li *ngFor="let file of volume.volumeFiles.sort()" class="list-group-item">+ <span>{{file.filePath}}</span>+ <div class="row g-0">+ <div class="col">+ Chapter: {{file.chapter}}+ </div>+ <div class="col">+ Pages: {{file.pages}}+ </div>+ <div class="col">+ Format: <span class="badge badge-secondary">{{utilityService.mangaFormatToText(file.format)}}</span>+ </div>+ </div>+ </li>+ </ul>+ </div>+ </div>+ </div>+ </li>+ </ul></ng-template></li></ul>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.tsindex dc06a525f..dcd48a0a0 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@@ -1,4 +1,4 @@-import { Component, Input, OnDestroy, OnInit } from '@angular/core';+import { Component, EventEmitter, Input, OnDestroy, OnInit } from '@angular/core';import { FormBuilder, FormControl, FormGroup } from '@angular/forms';import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';import { forkJoin, Observable, of, Subject } from 'rxjs';@@ -22,6 +22,15 @@ import { MetadataService } from 'src/app/_services/metadata.service';import { SeriesService } from 'src/app/_services/series.service';import { UploadService } from 'src/app/_services/upload.service';+enum TabID {+ General = 0,+ Metadata = 1,+ People = 2,+ CoverImage = 3,+ Related = 4,+ Info = 5,+}+@Component({selector: 'app-edit-series-modal',templateUrl: './edit-series-modal.component.html',@@ -39,8 +48,9 @@ export class EditSeriesModalComponent implements OnInit, OnDestroy {isCollapsed = true;volumeCollapsed: any = {};- tabs = ['General', 'Metadata', 'People', 'Cover Image', 'Info'];+ tabs = ['General', 'Metadata', 'People', 'Cover Image', 'Related', 'Info'];active = this.tabs[0];+ activeTabId = TabID.General;editSeriesForm!: FormGroup;libraryName: string | undefined = undefined;private readonly onDestroy = new Subject<void>();@@ -73,6 +83,8 @@ export class EditSeriesModalComponent implements OnInit, OnDestroy {coverImageReset = false;+ saveNestedComponents: EventEmitter<void> = new EventEmitter();+get Breakpoint(): typeof Breakpoint {return Breakpoint;}@@ -81,6 +93,10 @@ export class EditSeriesModalComponent implements OnInit, OnDestroy {return PersonRole;}+ get TabID(): typeof TabID {+ return TabID;+ }+getPersonsSettings(role: PersonRole) {return this.peopleSettings[role];}@@ -219,10 +235,6 @@ export class EditSeriesModalComponent implements OnInit, OnDestroy {return {id: 0, title: title, promoted: false, coverImage: '', summary: '', coverImageLocked: false };});this.collectionTagSettings.compareFn = (options: CollectionTag[], filter: string) => {- // console.log('compareFN:')- // console.log('options: ', options);- // console.log('filter: ', filter);- // console.log('results: ', options.filter(m => this.utilityService.filter(m.title, filter)));return options.filter(m => this.utilityService.filter(m.title, filter));}this.collectionTagSettings.selectionCompareFn = (a: CollectionTag, b: CollectionTag) => {@@ -424,6 +436,9 @@ export class EditSeriesModalComponent implements OnInit, OnDestroy {apis.push(this.uploadService.updateSeriesCoverImage(model.id, this.selectedCover));}+ this.saveNestedComponents.emit();++forkJoin(apis).subscribe(results => {this.modal.close({success: true, series: model, coverImageUpdate: selectedIndex > 0});diff --git a/UI/Web/src/app/cards/bulk-operations/bulk-operations.component.scss b/UI/Web/src/app/cards/bulk-operations/bulk-operations.component.scssindex 629afb960..edbf58368 100644--- a/UI/Web/src/app/cards/bulk-operations/bulk-operations.component.scss+++ b/UI/Web/src/app/cards/bulk-operations/bulk-operations.component.scss@@ -1,9 +1,13 @@.bulk-select {background-color: var(--navbar-bg-color);border-bottom: 2px solid var(--primary-color);- color: var(--navbar-text-color);+ color: var(--bulk-selection-text-color) !important;++ .btn-icon {+ color: var(--bulk-selection-text-color);+ }}.highlight {- color: var(--primary-color) !important;+ color: var(--bulk-selection-highlight-text-color) !important;}\ No newline at end of filediff --git a/UI/Web/src/app/cards/bulk-selection.service.ts b/UI/Web/src/app/cards/bulk-selection.service.tsindex a7f6eba70..81f972481 100644--- a/UI/Web/src/app/cards/bulk-selection.service.ts+++ b/UI/Web/src/app/cards/bulk-selection.service.ts@@ -3,7 +3,7 @@ import { NavigationStart, Router } from '@angular/router';import { filter } from 'rxjs/operators';import { Action, ActionFactoryService } from '../_services/action-factory.service';-type DataSource = 'volume' | 'chapter' | 'special' | 'series';+type DataSource = 'volume' | 'chapter' | 'special' | 'series' | 'bookmark';/*** Responsible for handling selections on cards. Can handle multiple card sources next to each other in different loops.@@ -132,6 +132,10 @@ export class BulkSelectionService {return this.actionFactory.getSeriesActions(callback).filter(item => allowedActions.includes(item.action));}+ if (Object.keys(this.selectedCards).filter(item => item === 'bookmark').length > 0) {+ return this.actionFactory.getBookmarkActions(callback);+ }+return this.actionFactory.getVolumeActions(callback).filter(item => allowedActions.includes(item.action));}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.htmlindex 7487d71fa..8e7ae79f1 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@@ -1,75 +1,96 @@<div class="row mt-2 g-0 pb-2" *ngIf="header !== undefined && header.length > 0">- <div class="col me-auto">- <h2 style="display: inline-block">- <span *ngIf="actions.length > 0" class="">- <app-card-actionables (actionHandler)="performAction($event)" [actions]="actions" [labelBy]="header"></app-card-actionables> - </span>- <span *ngIf="header !== undefined && header.length > 0">- {{header}} - <span class="badge bg-primary rounded-pill" attr.aria-label="{{pagination.totalItems}} total items" *ngIf="pagination != undefined">{{pagination.totalItems}}</span>- </span>- </h2>- </div>+ <div class="col me-auto">+ <h2 style="display: inline-block">+ <span *ngIf="actions.length > 0" class="">+ <app-card-actionables (actionHandler)="performAction($event)" [actions]="actions" [labelBy]="header"></app-card-actionables> + </span>+ <span *ngIf="header !== undefined && header.length > 0">+ {{header}} + <span class="badge bg-primary rounded-pill" attr.aria-label="{{pagination.totalItems}} total items" *ngIf="pagination != undefined">{{pagination.totalItems}}</span>+ </span>+ </h2></div>+</div>- <app-metadata-filter [filterSettings]="filterSettings" [filterOpen]="filterOpen" (applyFilter)="applyMetadataFilter($event)"></app-metadata-filter>-- <ng-container [ngTemplateOutlet]="paginationTemplate" [ngTemplateOutletContext]="{ id: 'top' }"></ng-container>+<app-metadata-filter [filterSettings]="filterSettings" [filterOpen]="filterOpen" (applyFilter)="applyMetadataFilter($event)"></app-metadata-filter>+<ng-container [ngTemplateOutlet]="paginationTemplate" [ngTemplateOutletContext]="{ id: 'top' }"></ng-container>- <div class="row g-0 mt-2 mb-2">+<!-- <ng-container *ngIf="utilityService.getActiveBreakpoint() <= Breakpoint.Mobile; else cardTemplate">+ <div class="d-flex justify-content-center row g-0 mt-2 mb-2"><div class="col-auto ps-1 pe-1 mt-2 mb-2" *ngFor="let item of items; trackBy:trackByIdentity; index as i"><ng-container [ngTemplateOutlet]="itemTemplate" [ngTemplateOutletContext]="{ $implicit: item, idx: i }"></ng-container></div>+<p *ngIf="items.length === 0 && !isLoading">- There is no data+ <ng-container [ngTemplateOutlet]="noDataTemplate"></ng-container></p></div>+</ng-container> -->++<ng-container [ngTemplateOutlet]="cardTemplate"></ng-container>- <ng-container [ngTemplateOutlet]="paginationTemplate" [ngTemplateOutletContext]="{ id: 'bottom' }"></ng-container>+<ng-container [ngTemplateOutlet]="paginationTemplate" [ngTemplateOutletContext]="{ id: 'bottom' }"></ng-container>++<ng-template #cardTemplate>+<div class="card-container row g-0 mt-3 mb-3">+ <div class="card col-auto mt-2 mb-2" *ngFor="let item of items; trackBy:trackByIdentity; index as i">+ <ng-container [ngTemplateOutlet]="itemTemplate" [ngTemplateOutletContext]="{ $implicit: item, idx: i }"></ng-container>+ </div>++ <p *ngIf="items.length === 0 && !isLoading">+ <ng-container [ngTemplateOutlet]="noDataTemplate"></ng-container>+ </p>+</div>+</ng-template><ng-template #paginationTemplate let-id="id">- <div class="d-flex justify-content-center mb-0" *ngIf="pagination && items.length > 0">- <ngb-pagination- *ngIf="pagination.totalPages > 1"- [maxSize]="8"- [rotate]="true"- [ellipses]="false"- [(page)]="pagination.currentPage"- [pageSize]="pagination.itemsPerPage"- (pageChange)="onPageChange($event)"- [collectionSize]="pagination.totalItems">+<div class="d-flex justify-content-center mb-0" *ngIf="pagination && items.length > 0">+ <ngb-pagination+ *ngIf="pagination.totalPages > 1"+ [maxSize]="8"+ [rotate]="true"+ [ellipses]="false"+ [(page)]="pagination.currentPage"+ [pageSize]="pagination.itemsPerPage"+ (pageChange)="onPageChange($event)"+ [collectionSize]="pagination.totalItems">- <ng-template ngbPaginationPages let-page let-pages="pages" *ngIf="pagination.totalItems / pagination.itemsPerPage > 20">- <li class="ngb-custom-pages-item" *ngIf="pagination.totalPages > 1">- <div class="d-flex flex-nowrap px-2">- <label- id="paginationInputLabel-{{id}}"- for="paginationInput-{{id}}"- class="col-form-label me-2 ms-1 form-label"- >Page</label>- <input #i- type="text"- inputmode="numeric"- pattern="[0-9]*"- class="form-control custom-pages-input"- id="paginationInput-{{id}}"- [value]="page"- (keyup.enter)="selectPageStr(i.value)"- (blur)="selectPageStr(i.value)"- (input)="formatInput($any($event).target)"- attr.aria-labelledby="paginationInputLabel-{{id}} paginationDescription-{{id}}"- [ngStyle]="{width: (0.5 + pagination.currentPage + '').length + 'rem'} "- />- <span id="paginationDescription-{{id}}" class="col-form-label text-nowrap px-2">- of {{pagination.totalPages}}</span>- </div>- </li>- </ng-template>+ <ng-template ngbPaginationPages let-page let-pages="pages" *ngIf="pagination.totalItems / pagination.itemsPerPage > 20">+ <li class="ngb-custom-pages-item" *ngIf="pagination.totalPages > 1">+ <div class="d-flex flex-nowrap px-2">+ <label+ id="paginationInputLabel-{{id}}"+ for="paginationInput-{{id}}"+ class="col-form-label me-2 ms-1 form-label"+ >Page</label>+ <input #i+ type="text"+ inputmode="numeric"+ pattern="[0-9]*"+ class="form-control custom-pages-input"+ id="paginationInput-{{id}}"+ [value]="page"+ (keyup.enter)="selectPageStr(i.value)"+ (blur)="selectPageStr(i.value)"+ (input)="formatInput($any($event).target)"+ attr.aria-labelledby="paginationInputLabel-{{id}} paginationDescription-{{id}}"+ [ngStyle]="{width: (0.5 + pagination.currentPage + '').length + 'rem'} "+ />+ <span id="paginationDescription-{{id}}" class="col-form-label text-nowrap px-2">+ of {{pagination.totalPages}}</span>+ </div>+ </li>+ </ng-template>- </ngb-pagination>- </div>+ </ngb-pagination>+</div></ng-template>+<div class="mx-auto" *ngIf="isLoading" style="width: 200px;">+ <div class="spinner-border text-secondary loading" role="status">+ <span class="invisible">Loading...</span>+ </div>+</div>\ No newline at end of filediff --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.scssindex e69de29bb..0ddbed57f 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@@ -0,0 +1,6 @@+.card-container {+ display: grid;+ grid-template-columns: repeat(auto-fill, 158px);+ grid-gap: 0.5rem;+ justify-content: space-around;+}\ No newline at end of filediff --git a/UI/Web/src/app/cards/card-detail-layout/card-detail-layout.component.ts b/UI/Web/src/app/cards/card-detail-layout/card-detail-layout.component.tsindex 9165d215d..caea2f0dc 100644--- a/UI/Web/src/app/cards/card-detail-layout/card-detail-layout.component.ts+++ b/UI/Web/src/app/cards/card-detail-layout/card-detail-layout.component.ts@@ -1,17 +1,15 @@import { Component, ContentChild, EventEmitter, Input, OnDestroy, OnInit, Output, TemplateRef } from '@angular/core';import { Subject } from 'rxjs';import { FilterSettings } from 'src/app/metadata-filter/filter-settings';+import { Breakpoint, UtilityService } from 'src/app/shared/_services/utility.service';import { Library } from 'src/app/_models/library';import { Pagination } from 'src/app/_models/pagination';-import { FilterEvent, FilterItem, SeriesFilter, SortField } from 'src/app/_models/series-filter';+import { FilterEvent, FilterItem, SeriesFilter } from 'src/app/_models/series-filter';import { ActionItem } from 'src/app/_services/action-factory.service';import { SeriesService } from 'src/app/_services/series.service';const FILTER_PAG_REGEX = /[^0-9]/g;-const ANIMATION_SPEED = 300;--@Component({selector: 'app-card-detail-layout',templateUrl: './card-detail-layout.component.html',@@ -38,6 +36,7 @@ export class CardDetailLayoutComponent implements OnInit, OnDestroy {@Output() applyFilter: EventEmitter<FilterEvent> = new EventEmitter();@ContentChild('cardItem') itemTemplate!: TemplateRef<any>;+ @ContentChild('noData') noDataTemplate!: TemplateRef<any>;// Filter Code@@ -52,7 +51,11 @@ export class CardDetailLayoutComponent implements OnInit, OnDestroy {private onDestory: Subject<void> = new Subject();- constructor(private seriesService: SeriesService) {+ get Breakpoint() {+ return Breakpoint;+ }++ constructor(private seriesService: SeriesService, public utilityService: UtilityService) {this.filter = this.seriesService.createSeriesFilter();}@@ -63,6 +66,10 @@ export class CardDetailLayoutComponent implements OnInit, OnDestroy {if (this.filterSettings === undefined) {this.filterSettings = new FilterSettings();}++ if (this.pagination === undefined) {+ this.pagination = {currentPage: 1, itemsPerPage: this.items.length, totalItems: this.items.length, totalPages: 1}+ }}ngOnDestroy() {diff --git a/UI/Web/src/app/cards/card-item/card-item.component.html b/UI/Web/src/app/cards/card-item/card-item.component.htmlindex c197783bb..5c2ed5164 100644--- a/UI/Web/src/app/cards/card-item/card-item.component.html+++ b/UI/Web/src/app/cards/card-item/card-item.component.html@@ -7,7 +7,7 @@<app-image borderRadius=".25rem .25rem 0 0" height="230px" width="158px" [imageUrl]="imageService.errorImage"></app-image></ng-container>- <div class="progress-banner" *ngIf="read < total && total > 0 && read !== (total -1)">+ <div class="progress-banner" *ngIf="read < total && total > 0 && read !== total"><p><ngb-progressbar type="primary" height="5px" [value]="read" [max]="total"></ngb-progressbar></p><span class="download" *ngIf="download$ | async as download">@@ -30,6 +30,11 @@<span class="badge bg-primary">{{count}}</span></div><div class="card-overlay"></div>+ <div class="overlay-information" *ngIf="overlayInformation !== '' || overlayInformation !== undefined">+ <div class="position-relative">+ <span class="card-title library mx-auto" style="width: auto;" [ngbTooltip]="overlayInformation" placement="top">{{overlayInformation}}</span>+ </div>+ </div></div><div class="card-body" *ngIf="title.length > 0 || actions.length > 0">@@ -47,6 +52,6 @@</span></div><span class="card-title library" [ngbTooltip]="subtitle" placement="top" *ngIf="subtitle.length > 0">{{subtitle}}</span>- <a class="card-title library" [routerLink]="['/library', libraryId]" routerLinkActive="router-link-active" *ngIf="!supressLibraryLink && libraryName">{{libraryName | sentenceCase}}</a>+ <a class="card-title library" [routerLink]="['/library', libraryId]" routerLinkActive="router-link-active" *ngIf="!suppressLibraryLink && libraryName">{{libraryName | sentenceCase}}</a></div></div>\ No newline at end of filediff --git a/UI/Web/src/app/cards/card-item/card-item.component.scss b/UI/Web/src/app/cards/card-item/card-item.component.scssindex f436a0fa8..acaf835c4 100644--- a/UI/Web/src/app/cards/card-item/card-item.component.scss+++ b/UI/Web/src/app/cards/card-item/card-item.component.scss@@ -5,7 +5,7 @@ $image-height: 230px;$image-width: 160px;.error-banner {- width: 160px;+ width: $image-width;height: 18px;background-color: var(--toast-error-bg-color);font-size: 12px;@@ -25,9 +25,8 @@ $image-width: 160px;padding-right: 0px;box-sizing: border-box;position: relative;- background-color: var(--card-bg-color);color: var(--card-text-color);- border-color: var(--card-border-color);+ border: 1px var(--card-border-color);}@@ -52,7 +51,7 @@ $image-width: 160px;}.progress-banner {- width: 160px;+ width: $image-width;height: 5px;.progress {@@ -100,6 +99,14 @@ $image-width: 160px;}}+.overlay-information {+ position: absolute;+ top: 5px;+ left: 5px;+ border-radius: 15px;+ padding: 0 10px;+ background-color: var(--card-bg-color);+}.overlay {height: $image-height;@@ -142,6 +149,11 @@ $image-width: 160px;.card-body {padding: 5px !important;+ background-color: var(--card-bg-color);+ border-width: var(--card-border-width);+ border-style: var(--card-border-style);+ border-color: var(--card-border-color);+ border-radius: 0.25em;}.library {@@ -155,7 +167,7 @@ $image-width: 160px;top: 0;left: 0;width: 100%;- height: 230px;+ height: $image-height;z-index: 10;transition: all 0.2s;}diff --git a/UI/Web/src/app/cards/card-item/card-item.component.ts b/UI/Web/src/app/cards/card-item/card-item.component.tsindex fc98739c7..bef21e716 100644--- a/UI/Web/src/app/cards/card-item/card-item.component.ts+++ b/UI/Web/src/app/cards/card-item/card-item.component.ts@@ -1,20 +1,24 @@import { Component, EventEmitter, HostListener, Input, OnDestroy, OnInit, Output } from '@angular/core';import { ToastrService } from 'ngx-toastr';import { Observable, Subject } from 'rxjs';-import { finalize, take, takeUntil, takeWhile } from 'rxjs/operators';+import { filter, finalize, map, take, takeUntil, takeWhile } from 'rxjs/operators';import { Download } from 'src/app/shared/_models/download';import { DownloadService } from 'src/app/shared/_services/download.service';import { UtilityService } from 'src/app/shared/_services/utility.service';import { Chapter } from 'src/app/_models/chapter';import { CollectionTag } from 'src/app/_models/collection-tag';+import { UserProgressUpdateEvent } from 'src/app/_models/events/user-progress-update-event';import { MangaFormat } from 'src/app/_models/manga-format';import { PageBookmark } from 'src/app/_models/page-bookmark';import { RecentlyAddedItem } from 'src/app/_models/recently-added-item';import { Series } from 'src/app/_models/series';+import { User } from 'src/app/_models/user';import { Volume } from 'src/app/_models/volume';+import { AccountService } from 'src/app/_services/account.service';import { Action, ActionItem } from 'src/app/_services/action-factory.service';import { ImageService } from 'src/app/_services/image.service';import { LibraryService } from 'src/app/_services/library.service';+import { EVENTS, MessageHubService } from 'src/app/_services/message-hub.service';import { BulkSelectionService } from '../bulk-selection.service';@Component({@@ -51,7 +55,7 @@ export class CardItemComponent implements OnInit, OnDestroy {/*** Supress library link*/- @Input() supressLibraryLink = false;+ @Input() suppressLibraryLink = false;/*** This is the entity we are representing. It will be returned if an action is executed.*/@@ -67,11 +71,15 @@ export class CardItemComponent implements OnInit, OnDestroy {/*** This will supress the cannot read archive warning when total pages is 0*/- @Input() supressArchiveWarning: boolean = false;+ @Input() supressArchiveWarning: boolean = false;/*** The number of updates/items within the card. If less than 2, will not be shown.*/- @Input() count: number = 0;+ @Input() count: number = 0;+ /**+ * Additional information to show on the overlay area. Will always render.+ */+ @Input() overlayInformation: string = '';/*** Event emitted when item is clicked*/@@ -95,7 +103,16 @@ export class CardItemComponent implements OnInit, OnDestroy {download$: Observable<Download> | null = null;downloadInProgress: boolean = false;- isShiftDown: boolean = false;+ /**+ * Handles touch events for selection on mobile devices+ */+ prevTouchTime: number = 0;+ /**+ * Handles touch events for selection on mobile devices to ensure you aren't touch scrolling+ */+ prevOffset: number = 0;++ private user: User | undefined;get tooltipTitle() {if (this.chapterTitle === '' || this.chapterTitle === null) return this.title;@@ -111,14 +128,15 @@ export class CardItemComponent implements OnInit, OnDestroy {constructor(public imageService: ImageService, private libraryService: LibraryService,public utilityService: UtilityService, private downloadService: DownloadService,- private toastr: ToastrService, public bulkSelectionService: BulkSelectionService) {}+ private toastr: ToastrService, public bulkSelectionService: BulkSelectionService,+ private messageHub: MessageHubService, private accountService: AccountService) {}ngOnInit(): void {if (this.entity.hasOwnProperty('promoted') && this.entity.hasOwnProperty('title')) {this.supressArchiveWarning = true;}- if (this.supressLibraryLink === false) {+ if (this.suppressLibraryLink === false) {if (this.entity !== undefined && this.entity.hasOwnProperty('libraryId')) {this.libraryId = (this.entity as Series).libraryId;}@@ -139,6 +157,20 @@ export class CardItemComponent implements OnInit, OnDestroy {this.chapterTitle = vol.chapters[0].titleName;}}++ this.accountService.currentUser$.pipe(takeUntil(this.onDestroy)).subscribe(user => {+ this.user = user;+ });++ this.messageHub.messages$.pipe(filter(event => event.event === EVENTS.UserProgressUpdate),+ map(evt => evt.payload as UserProgressUpdateEvent), takeUntil(this.onDestroy)).subscribe(updateEvent => {+ if (this.user === undefined || this.user.username !== updateEvent.username) return;+ if (this.utilityService.isChapter(this.entity) && updateEvent.chapterId !== this.entity.id) return;+ if (this.utilityService.isVolume(this.entity) && updateEvent.volumeId !== this.entity.id) return;+ if (this.utilityService.isSeries(this.entity) && updateEvent.seriesId !== this.entity.id) return;++ this.read = updateEvent.pagesRead;+ });}ngOnDestroy() {@@ -147,8 +179,6 @@ export class CardItemComponent implements OnInit, OnDestroy {}- prevTouchTime: number = 0;- prevOffset: number = 0;@HostListener('touchstart', ['$event'])onTouchStart(event: TouchEvent) {if (!this.allowSelection) return;@@ -170,7 +200,6 @@ export class CardItemComponent implements OnInit, OnDestroy {if (verticalOffset != this.prevOffset) {this.prevTouchTime = 0;-return;}diff --git a/UI/Web/src/app/cards/cards.module.ts b/UI/Web/src/app/cards/cards.module.tsindex cf9027fb0..f18f3a967 100644--- a/UI/Web/src/app/cards/cards.module.ts+++ b/UI/Web/src/app/cards/cards.module.ts@@ -5,7 +5,6 @@ import { LibraryCardComponent } from './library-card/library-card.component';import { CoverImageChooserComponent } from './cover-image-chooser/cover-image-chooser.component';import { EditSeriesModalComponent } from './_modals/edit-series-modal/edit-series-modal.component';import { EditCollectionTagsComponent } from './_modals/edit-collection-tags/edit-collection-tags.component';-import { BookmarksModalComponent } from './_modals/bookmarks-modal/bookmarks-modal.component';import { NgbTooltipModule, NgbCollapseModule, NgbPaginationModule, NgbDropdownModule, NgbProgressbarModule, NgbNavModule, NgbRatingModule } from '@ng-bootstrap/ng-bootstrap';import { CardActionablesComponent } from './card-item/card-actionables/card-actionables.component';import { FormsModule, ReactiveFormsModule } from '@angular/forms';@@ -21,8 +20,8 @@ import { BulkAddToCollectionComponent } from './_modals/bulk-add-to-collection/bimport { PipeModule } from '../pipe/pipe.module';import { ChapterMetadataDetailComponent } from './chapter-metadata-detail/chapter-metadata-detail.component';import { FileInfoComponent } from './file-info/file-info.component';-import { BookmarkComponent } from './bookmark/bookmark.component';import { MetadataFilterModule } from '../metadata-filter/metadata-filter.module';+import { EditSeriesRelationComponent } from './edit-series-relation/edit-series-relation.component';@@ -34,7 +33,6 @@ import { MetadataFilterModule } from '../metadata-filter/metadata-filter.module'CoverImageChooserComponent,EditSeriesModalComponent,EditCollectionTagsComponent,- BookmarksModalComponent,CardActionablesComponent,CardDetailLayoutComponent,CardDetailsModalComponent,@@ -42,21 +40,20 @@ import { MetadataFilterModule } from '../metadata-filter/metadata-filter.module'BulkAddToCollectionComponent,ChapterMetadataDetailComponent,FileInfoComponent,- BookmarkComponent,+ EditSeriesRelationComponent,],imports: [CommonModule,RouterModule,ReactiveFormsModule,FormsModule, // EditCollectionsModal-+PipeModule,SharedModule,TypeaheadModule, // edit series modalMetadataFilterModule,-- NgbNavModule,+NgbTooltipModule, // Card itemNgbCollapseModule,NgbRatingModule,@@ -79,12 +76,12 @@ import { MetadataFilterModule } from '../metadata-filter/metadata-filter.module'CoverImageChooserComponent,EditSeriesModalComponent,EditCollectionTagsComponent,- BookmarksModalComponent,CardActionablesComponent,CardDetailLayoutComponent,CardDetailsModalComponent,BulkOperationsComponent,- ChapterMetadataDetailComponent+ ChapterMetadataDetailComponent,+ EditSeriesRelationComponent]})export class CardsModule { }diff --git a/UI/Web/src/app/cards/cover-image-chooser/cover-image-chooser.component.html b/UI/Web/src/app/cards/cover-image-chooser/cover-image-chooser.component.htmlindex ca87d201d..caca55bd2 100644--- a/UI/Web/src/app/cards/cover-image-chooser/cover-image-chooser.component.html+++ b/UI/Web/src/app/cards/cover-image-chooser/cover-image-chooser.component.html@@ -8,14 +8,14 @@<div class="row g-0 mb-3"><i class="fa fa-file-upload mx-auto" style="font-size: 24px; width: 20px;" aria-hidden="true"></i></div>-- <div class="row g-0">- <div class="mx-auto" style="width: 350px;">- <a class="col" style="padding-right:0px" href="javascript:void(0)" (click)="changeMode('url')"><span class="phone-hidden">Enter a </span>Url</a>- <span class="col ps-1 pe-1">•</span>- <span class="col" style="padding-right:0px" href="javascript:void(0)">Drag and drop</span>- <span class="col ps-1 pe-1" style="padding-right:0px">•</span>- <a class="col" style="padding-right:0px" href="javascript:void(0)" (click)="openFileSelector()">Upload<span class="phone-hidden"> an image</span></a>++ <div class="d-flex justify-content-center">+ <div class="d-flex justify-content-evenly">+ <a style="padding-right:0px" href="javascript:void(0)" (click)="changeMode('url')"><span class="phone-hidden">Enter a </span>Url</a>+ <span class="ps-1 pe-1">•</span>+ <span style="padding-right:0px" href="javascript:void(0)">Drag and drop</span>+ <span class="ps-1 pe-1" style="padding-right:0px">•</span>+ <a style="padding-right:0px" href="javascript:void(0)" (click)="openFileSelector()">Upload<span class="phone-hidden"> an image</span></a></div></div></div>diff --git a/UI/Web/src/app/cards/edit-series-relation/edit-series-relation.component.html b/UI/Web/src/app/cards/edit-series-relation/edit-series-relation.component.htmlnew file mode 100644index 000000000..57b7be59f--- /dev/null+++ b/UI/Web/src/app/cards/edit-series-relation/edit-series-relation.component.html@@ -0,0 +1,36 @@+<div class="container-fluid">++ <p>+ Not sure what relationship to add? See our <a href="https://wiki.kavitareader.com/en/guides/get-started-using-your-library/series-relationships" target="_blank" referrerpolicy="no-refer">wiki for hints</a>.+ </p>++ <div class="row g-0" *ngIf="relations.length > 0">+ <label class="form-label col-md-7">Target Series</label>+ <label class="form-label col-md-5">Relationship</label>+ </div>++ <form>+ <div class="row g-0 mb-3" *ngFor="let relation of relations; let idx = index; let isLast = last;">+ <div class="col-sm-12 col-md-7">+ <app-typeahead (selectedData)="updateSeries($event, relation)" [settings]="relation.typeaheadSettings">+ <ng-template #badgeItem let-item let-position="idx">+ {{item.name}} ({{libraryNames[item.libraryId]}})+ </ng-template>+ <ng-template #optionItem let-item let-position="idx">+ {{item.name}} ({{libraryNames[item.libraryId]}})+ </ng-template>+ </app-typeahead>+ </div>+ <div class="col-sm-auto col-md-3">+ <select class="form-select" [formControl]="relation.formControl">+ <option *ngFor="let opt of relationOptions" [value]="opt.value">{{opt.text}}</option>+ </select>+ </div>+ <button class="col-sm-auto col-md-2 btn btn-outline-secondary" (click)="removeRelation(idx)">Remove</button>+ </div>+ </form>++ <div class="row g-0 mt-3 mb-3">+ <button class="btn btn-outline-secondary col-md-12" (click)="addNewRelation()">Add Relationship</button>+ </div>+</div>\ No newline at end of filediff --git a/UI/Web/src/app/_modals/review-series-modal/review-series-modal.component.scss b/UI/Web/src/app/cards/edit-series-relation/edit-series-relation.component.scsssimilarity index 100%rename from UI/Web/src/app/_modals/review-series-modal/review-series-modal.component.scssrename to UI/Web/src/app/cards/edit-series-relation/edit-series-relation.component.scssdiff --git a/UI/Web/src/app/cards/edit-series-relation/edit-series-relation.component.ts b/UI/Web/src/app/cards/edit-series-relation/edit-series-relation.component.tsnew file mode 100644index 000000000..59b25a142--- /dev/null+++ b/UI/Web/src/app/cards/edit-series-relation/edit-series-relation.component.ts@@ -0,0 +1,152 @@+import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core';+import { FormControl } from '@angular/forms';+import { map, Subject, Observable, of, firstValueFrom, takeUntil, ReplaySubject } from 'rxjs';+import { UtilityService } from 'src/app/shared/_services/utility.service';+import { TypeaheadSettings } from 'src/app/typeahead/typeahead-settings';+import { SearchResult } from 'src/app/_models/search-result';+import { Series } from 'src/app/_models/series';+import { RelationKind, RelationKinds } from 'src/app/_models/series-detail/relation-kind';+import { ImageService } from 'src/app/_services/image.service';+import { LibraryService } from 'src/app/_services/library.service';+import { SeriesService } from 'src/app/_services/series.service';++interface RelationControl {+ series: {id: number, name: string} | undefined; // Will add type as well+ typeaheadSettings: TypeaheadSettings<SearchResult>;+ formControl: FormControl;+}++@Component({+ selector: 'app-edit-series-relation',+ templateUrl: './edit-series-relation.component.html',+ styleUrls: ['./edit-series-relation.component.scss']+})+export class EditSeriesRelationComponent implements OnInit, OnDestroy {++ @Input() series!: Series;+ /**+ * This will tell the component to save based on it's internal state+ */+ @Input() save: EventEmitter<void> = new EventEmitter();++ @Output() saveApi = new ReplaySubject(1);+ relationOptions = RelationKinds;++ relations: Array<RelationControl> = [];+ seriesSettings: TypeaheadSettings<SearchResult> = new TypeaheadSettings();+ libraryNames: {[key:number]: string} = {};++++ private onDestroy: Subject<void> = new Subject<void>();++ constructor(private seriesService: SeriesService, private utilityService: UtilityService,+ public imageService: ImageService, private libraryService: LibraryService) { }++ ngOnInit(): void {+ this.seriesService.getRelatedForSeries(this.series.id).subscribe(async relations => {+ this.setupRelationRows(relations.prequels, RelationKind.Prequel);+ this.setupRelationRows(relations.sequels, RelationKind.Sequel);+ this.setupRelationRows(relations.sideStories, RelationKind.SideStory);+ this.setupRelationRows(relations.spinOffs, RelationKind.SpinOff);+ this.setupRelationRows(relations.adaptations, RelationKind.Adaptation);+ this.setupRelationRows(relations.others, RelationKind.Other);+ this.setupRelationRows(relations.characters, RelationKind.Character);+ this.setupRelationRows(relations.alternativeSettings, RelationKind.AlternativeSetting);+ this.setupRelationRows(relations.alternativeVersions, RelationKind.AlternativeVersion);+ this.setupRelationRows(relations.doujinshis, RelationKind.Doujinshi);+ this.setupRelationRows(relations.contains, RelationKind.Contains);+ this.setupRelationRows(relations.parent, RelationKind.Parent);+ });++ this.libraryService.getLibraryNames().subscribe(names => {+ this.libraryNames = names;+ });++ this.save.pipe(takeUntil(this.onDestroy)).subscribe(() => this.saveState());+ }++ ngOnDestroy(): void {+ this.onDestroy.next();+ this.onDestroy.complete();+ }++ setupRelationRows(relations: Array<Series>, kind: RelationKind) {+ relations.map(async item => {+ const settings = await firstValueFrom(this.createSeriesTypeahead(item, kind));+ return {series: item, typeaheadSettings: settings, formControl: new FormControl(kind, [])}+ }).forEach(async p => {+ this.relations.push(await p);+ });+ }++ async addNewRelation() {+ this.relations.push({series: undefined, formControl: new FormControl(RelationKind.Adaptation, []), typeaheadSettings: await firstValueFrom(this.createSeriesTypeahead(undefined, RelationKind.Adaptation))});+ }++ removeRelation(index: number) {+ this.relations.splice(index, 1);+ }+++ updateSeries(event: Array<SearchResult | undefined>, relation: RelationControl) {+ if (event[0] === undefined) {+ relation.series = undefined;+ return;+ }+ relation.series = {id: event[0].seriesId, name: event[0].name};+ }++ createSeriesTypeahead(series: Series | undefined, relationship: RelationKind): Observable<TypeaheadSettings<SearchResult>> {+ const seriesSettings = new TypeaheadSettings<SearchResult>();+ seriesSettings.minCharacters = 0;+ seriesSettings.multiple = false;+ seriesSettings.id = 'format';+ seriesSettings.unique = true;+ seriesSettings.addIfNonExisting = false;+ seriesSettings.fetchFn = (searchFilter: string) => this.libraryService.search(searchFilter).pipe(+ map(group => group.series),+ map(items => seriesSettings.compareFn(items, searchFilter)),+ map(series => series.filter(s => s.seriesId !== this.series.id)),+ );++ seriesSettings.compareFn = (options: SearchResult[], filter: string) => {+ return options.filter(m => this.utilityService.filter(m.name, filter));+ }++ seriesSettings.selectionCompareFn = (a: SearchResult, b: SearchResult) => {+ return a.seriesId == b.seriesId;+ }++ if (series !== undefined) {+ return this.libraryService.search(series.name).pipe(+ map(group => group.series), map(results => {+ seriesSettings.savedData = results.filter(s => s.seriesId === series.id);+ return seriesSettings;+ }));+ }++ return of(seriesSettings);+ }++ saveState() {+ const adaptations = this.relations.filter(item => (parseInt(item.formControl.value, 10) as RelationKind) === RelationKind.Adaptation && item.series !== undefined).map(item => item.series!.id);+ const characters = this.relations.filter(item => (parseInt(item.formControl.value, 10) as RelationKind) === RelationKind.Character && item.series !== undefined).map(item => item.series!.id);+ const contains = this.relations.filter(item => (parseInt(item.formControl.value, 10) as RelationKind) === RelationKind.Contains && item.series !== undefined).map(item => item.series!.id);+ const others = this.relations.filter(item => (parseInt(item.formControl.value, 10) as RelationKind) === RelationKind.Other && item.series !== undefined).map(item => item.series!.id);+ const prequels = this.relations.filter(item => (parseInt(item.formControl.value, 10) as RelationKind) === RelationKind.Prequel && item.series !== undefined).map(item => item.series!.id);+ const sequels = this.relations.filter(item => (parseInt(item.formControl.value, 10) as RelationKind) === RelationKind.Sequel && item.series !== undefined).map(item => item.series!.id);+ const sideStories = this.relations.filter(item => (parseInt(item.formControl.value, 10) as RelationKind) === RelationKind.SideStory && item.series !== undefined).map(item => item.series!.id);+ const spinOffs = this.relations.filter(item => (parseInt(item.formControl.value, 10) as RelationKind) === RelationKind.SpinOff && item.series !== undefined).map(item => item.series!.id);+ const alternativeSettings = this.relations.filter(item => (parseInt(item.formControl.value, 10) as RelationKind) === RelationKind.AlternativeSetting && item.series !== undefined).map(item => item.series!.id);+ const alternativeVersions = this.relations.filter(item => (parseInt(item.formControl.value, 10) as RelationKind) === RelationKind.AlternativeVersion && item.series !== undefined).map(item => item.series!.id);+ const doujinshis = this.relations.filter(item => (parseInt(item.formControl.value, 10) as RelationKind) === RelationKind.Doujinshi && item.series !== undefined).map(item => item.series!.id);++ // TODO: We can actually emit this onto an observable and in main parent, use mergeMap into the forkJoin++ //this.saveApi.next(this.seriesService.updateRelationships(this.series.id, adaptations, characters, contains, others, prequels, sequels, sideStories, spinOffs, alternativeSettings, alternativeVersions, doujinshis));+ this.seriesService.updateRelationships(this.series.id, adaptations, characters, contains, others, prequels, sequels, sideStories, spinOffs, alternativeSettings, alternativeVersions, doujinshis).subscribe(() => {});++ }++}diff --git a/UI/Web/src/app/cards/series-card/series-card.component.html b/UI/Web/src/app/cards/series-card/series-card.component.htmlindex 846e0af3f..385e46b27 100644--- a/UI/Web/src/app/cards/series-card/series-card.component.html+++ b/UI/Web/src/app/cards/series-card/series-card.component.html@@ -1,6 +1,7 @@<ng-container *ngIf="data !== undefined">- <app-card-item [title]="data.name" [actions]="actions" [supressLibraryLink]="suppressLibraryLink" [imageUrl]="imageUrl"+ <app-card-item [title]="data.name" [actions]="actions" [suppressLibraryLink]="suppressLibraryLink" [imageUrl]="imageUrl"[entity]="data" [total]="data.pages" [read]="data.pagesRead" (clicked)="handleClick()"[allowSelection]="allowSelection" (selection)="selection.emit(selected)" [selected]="selected"+ [overlayInformation]="(relation | relationship)"></app-card-item></ng-container>\ No newline at end of filediff --git a/UI/Web/src/app/cards/series-card/series-card.component.ts b/UI/Web/src/app/cards/series-card/series-card.component.tsindex a460a16f5..b202b89b7 100644--- a/UI/Web/src/app/cards/series-card/series-card.component.ts+++ b/UI/Web/src/app/cards/series-card/series-card.component.ts@@ -13,6 +13,7 @@ import { ActionService } from 'src/app/_services/action.service';import { EditSeriesModalComponent } from '../_modals/edit-series-modal/edit-series-modal.component';import { MessageHubService } from 'src/app/_services/message-hub.service';import { Subject } from 'rxjs';+import { RelationKind } from 'src/app/_models/series-detail/relation-kind';@Component({selector: 'app-series-card',@@ -26,11 +27,15 @@ export class SeriesCardComponent implements OnInit, OnChanges, OnDestroy {/*** If the entity is selected or not.*/- @Input() selected: boolean = false;- /**- * If the entity should show selection code- */- @Input() allowSelection: boolean = false;+ @Input() selected: boolean = false;+ /**+ * If the entity should show selection code+ */+ @Input() allowSelection: boolean = false;+ /**+ * If the Series has a relationship to display+ */+ @Input() relation: RelationKind | undefined = undefined;@Output() clicked = new EventEmitter<Series>();@Output() reload = new EventEmitter<boolean>();@@ -96,9 +101,6 @@ export class SeriesCardComponent implements OnInit, OnChanges, OnDestroy {case(Action.Edit):this.openEditModal(series);break;- case(Action.Bookmarks):- this.actionService.openBookmarkModal(series, (series) => {/* No Operation */ });- break;case(Action.AddToReadingList):this.actionService.addSeriesToReadingList(series, (series) => {/* No Operation */ });break;diff --git a/UI/Web/src/app/carousel/carousel-reel/carousel-reel.component.html b/UI/Web/src/app/carousel/carousel-reel/carousel-reel.component.htmlindex 0857e8eff..e7c869d4b 100644--- a/UI/Web/src/app/carousel/carousel-reel/carousel-reel.component.html+++ b/UI/Web/src/app/carousel/carousel-reel/carousel-reel.component.html@@ -1,9 +1,11 @@-<div class="carousel-container" *ngIf="items.length > 0">+<div class="carousel-container" *ngIf="items.length > 0 "><div>- <h3 style="display: inline-block;"><a href="javascript:void(0)" (click)="sectionClicked($event)" class="section-title" [ngClass]="{'non-selectable': !clickableTitle}">{{title}}</a></h3>- <div class="float-end">- <button class="btn btn-icon" [disabled]="isBeginning" (click)="prevPage()"><i class="fa fa-angle-left" aria-hidden="true"></i><span class="visually-hidden">Previous Items</span></button>- <button class="btn btn-icon" [disabled]="isEnd" (click)="nextPage()"><i class="fa fa-angle-right" aria-hidden="true"></i><span class="visually-hidden">Next Items</span></button>+ <h3 style="display: inline-block;">+ <a href="javascript:void(0)" (click)="sectionClicked($event)" class="section-title" [ngClass]="{'non-selectable': !clickableTitle}">{{title}}</a>+ </h3>+ <div class="float-end" *ngIf="swiper">+ <button class="btn btn-icon" [disabled]="swiper.isBeginning" (click)="prevPage()"><i class="fa fa-angle-left" aria-hidden="true"></i><span class="visually-hidden">Previous Items</span></button>+ <button class="btn btn-icon" [disabled]="swiper.isEnd" (click)="nextPage()"><i class="fa fa-angle-right" aria-hidden="true"></i><span class="visually-hidden">Next Items</span></button></div></div><div>diff --git a/UI/Web/src/app/carousel/carousel-reel/carousel-reel.component.ts b/UI/Web/src/app/carousel/carousel-reel/carousel-reel.component.tsindex 0b00a1e07..a2b786665 100644--- a/UI/Web/src/app/carousel/carousel-reel/carousel-reel.component.ts+++ b/UI/Web/src/app/carousel/carousel-reel/carousel-reel.component.ts@@ -1,5 +1,4 @@-import { Component, ContentChild, EventEmitter, Input, OnInit, Output, TemplateRef, ViewChild } from '@angular/core';-import { SwiperComponent } from 'swiper/angular';+import { Component, ContentChild, EventEmitter, Input, Output, TemplateRef } from '@angular/core';import { Swiper, SwiperEvents } from 'swiper/types';@Component({@@ -7,7 +6,7 @@ import { Swiper, SwiperEvents } from 'swiper/types';templateUrl: './carousel-reel.component.html',styleUrls: ['./carousel-reel.component.scss']})-export class CarouselReelComponent implements OnInit {+export class CarouselReelComponent {@ContentChild('carouselItem') carouselItemTemplate!: TemplateRef<any>;@Input() items: any[] = [];@@ -19,30 +18,20 @@ export class CarouselReelComponent implements OnInit {trackByIdentity: (index: number, item: any) => string;- get isEnd() {- return this.swiper?.isEnd;- }-- get isBeginning() {- return this.swiper?.isBeginning;- }-constructor() {this.trackByIdentity = (index: number, item: any) => `${this.title}_${item.id}_${item?.name}_${item?.pagesRead}_${index}`;}- ngOnInit(): void {}-nextPage() {- if (this.isEnd) return;if (this.swiper) {+ if (this.swiper.isEnd) return;this.swiper.setProgress(this.swiper.progress + 0.25, 600);}}prevPage() {- if (this.isBeginning) return;if (this.swiper) {+ if (this.swiper.isBeginning) return;this.swiper.setProgress(this.swiper.progress - 0.25, 600);}}diff --git a/UI/Web/src/app/collections/all-collections/all-collections.component.html b/UI/Web/src/app/collections/all-collections/all-collections.component.htmlindex 085225ca6..f5586d687 100644--- a/UI/Web/src/app/collections/all-collections/all-collections.component.html+++ b/UI/Web/src/app/collections/all-collections/all-collections.component.html@@ -1,9 +1,8 @@<app-side-nav-companion-bar [hasFilter]="false" (filterOpen)="filterOpen.emit($event)"><h2 title>- <app-card-actionables [actions]="collectionTagActions"></app-card-actionables>Collections</h2>- <h6 subtitle style="margin-left:40px;">{{collections.length}} Items</h6>+ <h6 subtitle>{{collections.length}} Items</h6></app-side-nav-companion-bar><app-card-detail-layout[isLoading]="isLoading"diff --git a/UI/Web/src/app/collections/collection-detail/collection-detail.component.html b/UI/Web/src/app/collections/collection-detail/collection-detail.component.htmlindex ad90f0c00..9e119a0ac 100644--- a/UI/Web/src/app/collections/collection-detail/collection-detail.component.html+++ b/UI/Web/src/app/collections/collection-detail/collection-detail.component.html@@ -1,4 +1,4 @@-<app-side-nav-companion-bar *ngIf="series !== undefined" [hasFilter]="false" (filterOpen)="filterOpen.emit($event)">+<app-side-nav-companion-bar *ngIf="series !== undefined" [hasFilter]="true" (filterOpen)="filterOpen.emit($event)" [filterActive]="filterActive"><ng-container title><h2 style="margin-bottom: 0px" *ngIf="collectionTag !== undefined"><app-card-actionables [disabled]="actionInProgress" (actionHandler)="performAction($event)" [actions]="collectionTagActions" [labelBy]="collectionTag.title" iconClass="fa-ellipsis-v"></app-card-actionables>diff --git a/UI/Web/src/app/collections/collection-detail/collection-detail.component.scss b/UI/Web/src/app/collections/collection-detail/collection-detail.component.scssindex a3f113c59..c0ca48164 100644--- a/UI/Web/src/app/collections/collection-detail/collection-detail.component.scss+++ b/UI/Web/src/app/collections/collection-detail/collection-detail.component.scss@@ -13,4 +13,4 @@.read-btn--text {display: none;}-}+}\ No newline at end of filediff --git a/UI/Web/src/app/collections/collection-detail/collection-detail.component.ts b/UI/Web/src/app/collections/collection-detail/collection-detail.component.tsindex 0a8e768d2..b2f779d2a 100644--- a/UI/Web/src/app/collections/collection-detail/collection-detail.component.ts+++ b/UI/Web/src/app/collections/collection-detail/collection-detail.component.ts@@ -4,17 +4,17 @@ import { Router, ActivatedRoute } from '@angular/router';import { NgbModal } from '@ng-bootstrap/ng-bootstrap';import { ToastrService } from 'ngx-toastr';import { Subject } from 'rxjs';-import { debounceTime, take, takeUntil, takeWhile } from 'rxjs/operators';+import { debounceTime, take, takeUntil } from 'rxjs/operators';import { BulkSelectionService } from 'src/app/cards/bulk-selection.service';import { EditCollectionTagsComponent } from 'src/app/cards/_modals/edit-collection-tags/edit-collection-tags.component';import { FilterSettings } from 'src/app/metadata-filter/filter-settings';+import { FilterUtilitiesService } from 'src/app/shared/_services/filter-utilities.service';import { KEY_CODES, UtilityService } from 'src/app/shared/_services/utility.service';import { CollectionTag } from 'src/app/_models/collection-tag';import { SeriesAddedToCollectionEvent } from 'src/app/_models/events/series-added-to-collection-event';import { Pagination } from 'src/app/_models/pagination';import { Series } from 'src/app/_models/series';import { FilterEvent, SeriesFilter } from 'src/app/_models/series-filter';-import { AccountService } from 'src/app/_services/account.service';import { Action, ActionFactoryService, ActionItem } from 'src/app/_services/action-factory.service';import { ActionService } from 'src/app/_services/action.service';import { CollectionTagService } from 'src/app/_services/collection-tag.service';@@ -32,17 +32,16 @@ export class CollectionDetailComponent implements OnInit, OnDestroy {collectionTag!: CollectionTag;tagImage: string = '';isLoading: boolean = true;- collections: CollectionTag[] = [];- collectionTagName: string = '';series: Array<Series> = [];seriesPagination!: Pagination;collectionTagActions: ActionItem<CollectionTag>[] = [];- isAdmin: boolean = false;filter: SeriesFilter | undefined = undefined;filterSettings: FilterSettings = new FilterSettings();summary: string = '';actionInProgress: boolean = false;+ filterActiveCheck!: SeriesFilter;+ filterActive: boolean = false;filterOpen: EventEmitter<boolean> = new EventEmitter();@@ -87,27 +86,23 @@ export class CollectionDetailComponent implements OnInit, OnDestroy {constructor(public imageService: ImageService, private collectionService: CollectionTagService, private router: Router, private route: ActivatedRoute,private seriesService: SeriesService, private toastr: ToastrService, private actionFactoryService: ActionFactoryService,- private modalService: NgbModal, private titleService: Title, private accountService: AccountService,+ private modalService: NgbModal, private titleService: Title,public bulkSelectionService: BulkSelectionService, private actionService: ActionService, private messageHub: MessageHubService,- private utilityService: UtilityService) {+ private filterUtilityService: FilterUtilitiesService, private utilityService: UtilityService) {this.router.routeReuseStrategy.shouldReuseRoute = () => false;- this.accountService.currentUser$.pipe(take(1)).subscribe(user => {- if (user) {- this.isAdmin = this.accountService.hasAdminRole(user);- }- });-const routeId = this.route.snapshot.paramMap.get('id');if (routeId === null) {this.router.navigate(['collections']);return;}const tagId = parseInt(routeId, 10);- this.seriesPagination = {currentPage: 0, itemsPerPage: 30, totalItems: 0, totalPages: 1};- [this.filterSettings.presets, this.filterSettings.openByDefault] = this.utilityService.filterPresetsFromUrl(this.route.snapshot, this.seriesService.createSeriesFilter());+ this.seriesPagination = this.filterUtilityService.pagination(this.route.snapshot);+ [this.filterSettings.presets, this.filterSettings.openByDefault] = this.filterUtilityService.filterPresetsFromUrl(this.route.snapshot);this.filterSettings.presets.collectionTags = [tagId];+ this.filterActiveCheck = this.seriesService.createSeriesFilter();+ this.filterActiveCheck.collectionTags = [tagId];this.updateTag(tagId);}@@ -148,13 +143,13 @@ export class CollectionDetailComponent implements OnInit, OnDestroy {updateTag(tagId: number) {this.collectionService.allTags().subscribe(tags => {- this.collections = tags;- const matchingTags = this.collections.filter(t => t.id === tagId);+ const matchingTags = tags.filter(t => t.id === tagId);if (matchingTags.length === 0) {this.toastr.error('You don\'t have access to any libraries this tag belongs to or this tag is invalid');-+ this.router.navigateByUrl('/');return;}+this.collectionTag = matchingTags[0];this.summary = (this.collectionTag.summary === null ? '' : this.collectionTag.summary).replace(/\n/g, '<br>');this.tagImage = this.imageService.randomize(this.imageService.getCollectionCoverImage(this.collectionTag.id));@@ -163,46 +158,25 @@ export class CollectionDetailComponent implements OnInit, OnDestroy {}onPageChange(pagination: Pagination) {- this.router.navigate(['collections', this.collectionTag.id], {replaceUrl: true, queryParamsHandling: 'merge', queryParams: {page: this.seriesPagination.currentPage} });+ this.filterUtilityService.updateUrlFromFilter(this.seriesPagination, undefined);this.loadPage();}loadPage() {- const page = this.getPage();- if (page != null) {- this.seriesPagination.currentPage = parseInt(page, 10);- }-- // The filter is out of sync with the presets from typeaheads on first load but syncs afterwards- if (this.filter == undefined) {- this.filter = this.seriesService.createSeriesFilter();- this.filter.collectionTags.push(this.collectionTag.id);- }-- // TODO: Add ability to filter series for a collection- // Reload page after a series is updated or first load- this.seriesService.getSeriesForTag(this.collectionTag.id, this.seriesPagination?.currentPage, this.seriesPagination?.itemsPerPage).subscribe(tags => {- this.series = tags.result;- this.seriesPagination = tags.pagination;+ this.filterActive = !this.utilityService.deepEqual(this.filter, this.filterActiveCheck);+ this.seriesService.getAllSeries(this.seriesPagination?.currentPage, this.seriesPagination?.itemsPerPage, this.filter).pipe(take(1)).subscribe(series => {+ this.series = series.result;+ this.seriesPagination = series.pagination;this.isLoading = false;window.scrollTo(0, 0);});}- updateFilter(event: FilterEvent) {- this.filter = event.filter;- const page = this.getPage();- if (page === undefined || page === null || !event.isFirst) {- this.seriesPagination.currentPage = 1;- this.onPageChange(this.seriesPagination);- } else {- this.loadPage();- }- }-- getPage() {- const urlParams = new URLSearchParams(window.location.search);- return urlParams.get('page');+ updateFilter(data: FilterEvent) {+ this.filter = data.filter;++ if (!data.isFirst) this.filterUtilityService.updateUrlFromFilter(this.seriesPagination, this.filter);+ this.loadPage();}handleCollectionActionCallback(action: Action, collectionTag: CollectionTag) {diff --git a/UI/Web/src/app/collections/collections.module.ts b/UI/Web/src/app/collections/collections.module.tsindex fb21685e4..54ef17d32 100644--- a/UI/Web/src/app/collections/collections.module.ts+++ b/UI/Web/src/app/collections/collections.module.ts@@ -2,10 +2,9 @@ import { NgModule } from '@angular/core';import { CommonModule } from '@angular/common';import { CollectionDetailComponent } from './collection-detail/collection-detail.component';import { SharedModule } from '../shared/shared.module';-import { CollectionsRoutingModule } from './collections-routing.module';-import { CardsModule } from '../cards/cards.module';import { AllCollectionsComponent } from './all-collections/all-collections.component';-import { SidenavModule } from '../sidenav/sidenav.module';+import { CollectionsRoutingModule } from './collections-routing.module';+import { SharedSideNavCardsModule } from '../shared-side-nav-cards/shared-side-nav-cards.module';@@ -17,9 +16,10 @@ import { SidenavModule } from '../sidenav/sidenav.module';imports: [CommonModule,SharedModule,- CardsModule,++ SharedSideNavCardsModule,+CollectionsRoutingModule,- SidenavModule],exports: [AllCollectionsComponentdiff --git a/UI/Web/src/app/dashboard/dashboard-routing.module.ts b/UI/Web/src/app/dashboard/dashboard-routing.module.tsnew file mode 100644index 000000000..adf41b73b--- /dev/null+++ b/UI/Web/src/app/dashboard/dashboard-routing.module.ts@@ -0,0 +1,21 @@+import { NgModule } from '@angular/core';+import { Routes, RouterModule } from '@angular/router';+import { AuthGuard } from '../_guards/auth.guard';+import { DashboardComponent } from './dashboard.component';+++const routes: Routes = [+ {+ path: '',+ runGuardsAndResolvers: 'always',+ canActivate: [AuthGuard],+ component: DashboardComponent,+ }+];+++@NgModule({+ imports: [RouterModule.forChild(routes), ],+ exports: [RouterModule]+})+export class DashboardRoutingModule { }diff --git a/UI/Web/src/app/dashboard/dashboard.component.html b/UI/Web/src/app/dashboard/dashboard.component.htmlindex f4c84f091..e34bf4adf 100644--- a/UI/Web/src/app/dashboard/dashboard.component.html+++ b/UI/Web/src/app/dashboard/dashboard.component.html@@ -1,3 +1,31 @@<app-side-nav-companion-bar></app-side-nav-companion-bar>-<app-library></app-library>\ No newline at end of file+<ng-container *ngIf="libraries.length === 0 && !isLoading">+ <div class="mt-3">+ <div *ngIf="isAdmin" class="d-flex justify-content-center">+ <p>There are no libraries setup yet. Configure some in <a routerLink="/admin/dashboard" fragment="libraries">Server settings</a>.</p>+ </div>+ <div *ngIf="!isAdmin" class="d-flex justify-content-center">+ <p>You haven't been granted access to any libraries.</p>+ </div>+ </div>+</ng-container>++<app-carousel-reel [items]="inProgress" title="On Deck" (sectionClick)="handleSectionClick($event)">+ <ng-template #carouselItem let-item let-position="idx">+ <app-series-card [data]="item" [libraryId]="item.libraryId" [suppressLibraryLink]="libraryId !== 0" (reload)="reloadInProgress($event)" (dataChanged)="reloadInProgress($event)"></app-series-card>+ </ng-template>+</app-carousel-reel>++<app-carousel-reel [items]="recentlyUpdatedSeries" title="Recently Updated Series" (sectionClick)="handleSectionClick($event)">+ <ng-template #carouselItem let-item let-position="idx">+ <app-card-item [entity]="item" [title]="item.seriesName" [suppressLibraryLink]="libraryId !== 0" [imageUrl]="imageService.getSeriesCoverImage(item.seriesId)"+ [supressArchiveWarning]="true" (clicked)="handleRecentlyAddedChapterClick(item)" [count]="item.count"></app-card-item>+ </ng-template>+</app-carousel-reel>++<app-carousel-reel [items]="recentlyAddedSeries" title="Newly Added Series" (sectionClick)="handleSectionClick($event)">+ <ng-template #carouselItem let-item let-position="idx">+ <app-series-card [data]="item" [libraryId]="item.libraryId" [suppressLibraryLink]="libraryId !== 0" (dataChanged)="loadRecentlyAddedSeries()"></app-series-card>+ </ng-template>+</app-carousel-reel>\ No newline at end of filediff --git a/UI/Web/src/app/dashboard/dashboard.component.ts b/UI/Web/src/app/dashboard/dashboard.component.tsindex c25c86d9a..b772de46d 100644--- a/UI/Web/src/app/dashboard/dashboard.component.ts+++ b/UI/Web/src/app/dashboard/dashboard.component.ts@@ -1,20 +1,180 @@-import { Component, OnInit } from '@angular/core';+import { Component, Input, OnDestroy, OnInit } from '@angular/core';import { Title } from '@angular/platform-browser';-import { ActivatedRoute } from '@angular/router';+import { Router } from '@angular/router';+import { ReplaySubject, Subject } from 'rxjs';+import { debounceTime, take, takeUntil } from 'rxjs/operators';+import { FilterQueryParam } from '../shared/_services/filter-utilities.service';+import { SeriesAddedEvent } from '../_models/events/series-added-event';+import { SeriesRemovedEvent } from '../_models/events/series-removed-event';+import { Library } from '../_models/library';+import { RecentlyAddedItem } from '../_models/recently-added-item';+import { Series } from '../_models/series';+import { SortField } from '../_models/series-filter';+import { SeriesGroup } from '../_models/series-group';+import { User } from '../_models/user';+import { AccountService } from '../_services/account.service';+import { ImageService } from '../_services/image.service';+import { LibraryService } from '../_services/library.service';+import { MessageHubService, EVENTS } from '../_services/message-hub.service';+import { SeriesService } from '../_services/series.service';@Component({selector: 'app-dashboard',templateUrl: './dashboard.component.html',styleUrls: ['./dashboard.component.scss']})-export class DashboardComponent implements OnInit {+export class DashboardComponent implements OnInit, OnDestroy {+ /**+ * By default, 0, but if non-zero, will limit all API calls to library id+ */+ @Input() libraryId: number = 0;- constructor(public route: ActivatedRoute, private titleService: Title) {- this.titleService.setTitle('Kavita - Dashboard');+ user: User | undefined;+ libraries: Library[] = [];+ isLoading = false;+ isAdmin = false;++ recentlyUpdatedSeries: SeriesGroup[] = [];+ inProgress: Series[] = [];+ recentlyAddedSeries: Series[] = [];++ private readonly onDestroy = new Subject<void>();++ /**+ * We use this Replay subject to slow the amount of times we reload the UI+ */+ private loadRecentlyAdded$: ReplaySubject<void> = new ReplaySubject<void>();++ constructor(public accountService: AccountService, private libraryService: LibraryService,+ private seriesService: SeriesService, private router: Router,+ private titleService: Title, public imageService: ImageService,+ private messageHub: MessageHubService) {+ this.messageHub.messages$.pipe(takeUntil(this.onDestroy)).subscribe(res => {+ if (res.event === EVENTS.SeriesAdded) {+ const seriesAddedEvent = res.payload as SeriesAddedEvent;++ this.seriesService.getSeries(seriesAddedEvent.seriesId).subscribe(series => {+ this.recentlyAddedSeries.unshift(series);+ });+ } else if (res.event === EVENTS.SeriesRemoved) {+ const seriesRemovedEvent = res.payload as SeriesRemovedEvent;++ this.inProgress = this.inProgress.filter(item => item.id != seriesRemovedEvent.seriesId);+ this.recentlyAddedSeries = this.recentlyAddedSeries.filter(item => item.id != seriesRemovedEvent.seriesId);+ this.recentlyUpdatedSeries = this.recentlyUpdatedSeries.filter(item => item.seriesId != seriesRemovedEvent.seriesId);+ } else if (res.event === EVENTS.ScanSeries) {+ // We don't have events for when series are updated, but we do get events when a scan update occurs. Refresh recentlyAdded at that time.+ this.loadRecentlyAdded$.next();+ }+ });++ this.loadRecentlyAdded$.pipe(debounceTime(1000), takeUntil(this.onDestroy)).subscribe(() => this.loadRecentlyAdded());}ngOnInit(): void {+ this.titleService.setTitle('Kavita - Dashboard');+ this.isLoading = true;+ this.accountService.currentUser$.pipe(take(1)).subscribe(user => {+ this.user = user;+ if (this.user) {+ this.isAdmin = this.accountService.hasAdminRole(this.user);+ this.libraryService.getLibrariesForMember().pipe(take(1)).subscribe(libraries => {+ this.libraries = libraries;+ this.isLoading = false;+ });+ }+ });++ this.reloadSeries();+ }++ ngOnDestroy() {+ this.onDestroy.next();+ this.onDestroy.complete();+ }++ reloadSeries() {+ this.loadOnDeck();+ this.loadRecentlyAdded();+ this.loadRecentlyAddedSeries();+ }++ reloadInProgress(series: Series | boolean) {+ if (series === true || series === false) {+ if (!series) {return;}+ }+ // If the update to Series doesn't affect the requirement to be in this stream, then ignore update request+ const seriesObj = (series as Series);+ if (seriesObj.pagesRead !== seriesObj.pages && seriesObj.pagesRead !== 0) {+ return;+ }++ this.loadOnDeck();+ }++ loadOnDeck() {+ let api = this.seriesService.getOnDeck();+ if (this.libraryId > 0) {+ api = this.seriesService.getOnDeck(this.libraryId);+ }+ api.pipe(takeUntil(this.onDestroy)).subscribe((updatedSeries) => {+ this.inProgress = updatedSeries.result;+ });+ }++ loadRecentlyAddedSeries() {+ let api = this.seriesService.getRecentlyAdded();+ if (this.libraryId > 0) {+ api = this.seriesService.getRecentlyAdded(this.libraryId);+ }+ api.pipe(takeUntil(this.onDestroy)).subscribe((updatedSeries) => {+ this.recentlyAddedSeries = updatedSeries.result;+ });+ }+++ loadRecentlyAdded() {+ let api = this.seriesService.getRecentlyUpdatedSeries();+ if (this.libraryId > 0) {+ api = this.seriesService.getRecentlyUpdatedSeries();+ }+ api.pipe(takeUntil(this.onDestroy)).subscribe(updatedSeries => {+ this.recentlyUpdatedSeries = updatedSeries.filter(group => {+ if (this.libraryId === 0) return true;+ return group.libraryId === this.libraryId;+ });+ });+ }++ handleRecentlyAddedChapterClick(item: RecentlyAddedItem) {+ this.router.navigate(['library', item.libraryId, 'series', item.seriesId]);}+ handleSectionClick(sectionTitle: string) {+ if (sectionTitle.toLowerCase() === 'recently updated series') {+ const params: any = {};+ params[FilterQueryParam.SortBy] = SortField.LastChapterAdded + ',false'; // sort by last chapter added, desc+ params[FilterQueryParam.Page] = 1;+ this.router.navigate(['all-series'], {queryParams: params});+ } else if (sectionTitle.toLowerCase() === 'on deck') {+ const params: any = {};+ params[FilterQueryParam.ReadStatus] = 'true,false,false';+ params[FilterQueryParam.SortBy] = SortField.LastChapterAdded + ',false'; // sort by last chapter added, desc+ params[FilterQueryParam.Page] = 1;+ this.router.navigate(['all-series'], {queryParams: params});+ }else if (sectionTitle.toLowerCase() === 'newly added series') {+ const params: any = {};+ params[FilterQueryParam.SortBy] = SortField.Created + ',false'; // sort by created, desc+ params[FilterQueryParam.Page] = 1;+ this.router.navigate(['all-series'], {queryParams: params});+ }+ }++ removeFromArray(arr: Array<any>, element: any) {+ const index = arr.indexOf(element);+ if (index >= 0) {+ arr.splice(index);+ }+ }}diff --git a/UI/Web/src/app/dashboard/dashboard.module.ts b/UI/Web/src/app/dashboard/dashboard.module.tsnew file mode 100644index 000000000..55b9a5329--- /dev/null+++ b/UI/Web/src/app/dashboard/dashboard.module.ts@@ -0,0 +1,23 @@+import { NgModule } from '@angular/core';+import { CommonModule } from '@angular/common';+import { DashboardRoutingModule } from './dashboard-routing.module';++import { CarouselModule } from '../carousel/carousel.module';+import { DashboardComponent } from './dashboard.component';+import { SharedSideNavCardsModule } from '../shared-side-nav-cards/shared-side-nav-cards.module';++++@NgModule({+ declarations: [DashboardComponent],+ imports: [+ CommonModule,++ CarouselModule,++ SharedSideNavCardsModule,++ DashboardRoutingModule+ ]+})+export class DashboardModule { }diff --git a/UI/Web/src/app/dev-only/dev-only-routing.module.ts b/UI/Web/src/app/dev-only/dev-only-routing.module.tsnew file mode 100644index 000000000..759989c57--- /dev/null+++ b/UI/Web/src/app/dev-only/dev-only-routing.module.ts@@ -0,0 +1,18 @@+import { NgModule } from '@angular/core';+import { Routes, RouterModule } from '@angular/router';+import { ThemeTestComponent } from './theme-test/theme-test.component';+++const routes: Routes = [+ {+ path: '',+ component: ThemeTestComponent,+ }+];+++@NgModule({+ imports: [RouterModule.forChild(routes), ],+ exports: [RouterModule]+})+export class DevOnlyRoutingModule { }diff --git a/UI/Web/src/app/dev-only/dev-only.module.ts b/UI/Web/src/app/dev-only/dev-only.module.tsnew file mode 100644index 000000000..4ecdc6133--- /dev/null+++ b/UI/Web/src/app/dev-only/dev-only.module.ts@@ -0,0 +1,37 @@+import { NgModule } from '@angular/core';+import { CommonModule } from '@angular/common';+import { NgbAccordionModule, NgbNavModule } from '@ng-bootstrap/ng-bootstrap';+import { CardsModule } from '../cards/cards.module';+import { TypeaheadModule } from '../typeahead/typeahead.module';+import { ThemeTestComponent } from './theme-test/theme-test.component';+import { SharedModule } from '../shared/shared.module';+import { PipeModule } from '../pipe/pipe.module';+import { DevOnlyRoutingModule } from './dev-only-routing.module';+import { FormsModule } from '@angular/forms';++/**+ * This module contains components that aren't meant to ship with main code. They are there to test things out. This module may be deleted in future updates.+ */++@NgModule({+ declarations: [+ ThemeTestComponent+ ],+ imports: [+ CommonModule,+ FormsModule,+++ TypeaheadModule,+ CardsModule,+ NgbAccordionModule,+ NgbNavModule,+++ SharedModule,+ PipeModule,++ DevOnlyRoutingModule+ ]+})+export class DevOnlyModule { }diff --git a/UI/Web/src/app/theme-test/theme-test.component.html b/UI/Web/src/app/dev-only/theme-test/theme-test.component.htmlsimilarity index 100%rename from UI/Web/src/app/theme-test/theme-test.component.htmlrename to UI/Web/src/app/dev-only/theme-test/theme-test.component.htmldiff --git a/UI/Web/src/app/theme-test/theme-test.component.scss b/UI/Web/src/app/dev-only/theme-test/theme-test.component.scsssimilarity index 100%rename from UI/Web/src/app/theme-test/theme-test.component.scssrename to UI/Web/src/app/dev-only/theme-test/theme-test.component.scssdiff --git a/UI/Web/src/app/theme-test/theme-test.component.ts b/UI/Web/src/app/dev-only/theme-test/theme-test.component.tssimilarity index 73%rename from UI/Web/src/app/theme-test/theme-test.component.tsrename to UI/Web/src/app/dev-only/theme-test/theme-test.component.tsindex a4c422389..be3ab498b 100644--- a/UI/Web/src/app/theme-test/theme-test.component.ts+++ b/UI/Web/src/app/dev-only/theme-test/theme-test.component.ts@@ -1,11 +1,11 @@import { Component, OnInit } from '@angular/core';import { ToastrService } from 'ngx-toastr';-import { TagBadgeCursor } from '../shared/tag-badge/tag-badge.component';-import { ThemeService } from '../theme.service';-import { MangaFormat } from '../_models/manga-format';-import { Person, PersonRole } from '../_models/person';-import { Series } from '../_models/series';-import { NavService } from '../_services/nav.service';+import { TagBadgeCursor } from '../../shared/tag-badge/tag-badge.component';+import { ThemeService } from '../../_services/theme.service';+import { MangaFormat } from '../../_models/manga-format';+import { Person, PersonRole } from '../../_models/person';+import { Series } from '../../_models/series';+import { NavService } from '../../_services/nav.service';@Component({selector: 'app-theme-test',@@ -40,13 +40,14 @@ export class ThemeTestComponent implements OnInit {latestReadDate: '',localizedName: '',originalName: '',- sortName: '',+ sortName: '',userRating: 0,- userReview: '',+ userReview: '',volumes: [],localizedNameLocked: false,- nameLocked: false,- sortNameLocked: false+ nameLocked: false,+ sortNameLocked: false,+ lastChapterAdded: '',}seriesWithProgress: Series = {@@ -61,13 +62,14 @@ export class ThemeTestComponent implements OnInit {latestReadDate: '',localizedName: '',originalName: '',- sortName: '',+ sortName: '',userRating: 0,- userReview: '',+ userReview: '',volumes: [],localizedNameLocked: false,- nameLocked: false,- sortNameLocked: false+ nameLocked: false,+ sortNameLocked: false,+ lastChapterAdded: '',}get TagBadgeCursor(): typeof TagBadgeCursor {diff --git a/UI/Web/src/app/library-detail/library-detail-routing.module.ts b/UI/Web/src/app/library-detail/library-detail-routing.module.tsnew file mode 100644index 000000000..0ac5d2de2--- /dev/null+++ b/UI/Web/src/app/library-detail/library-detail-routing.module.ts@@ -0,0 +1,26 @@+import { NgModule } from '@angular/core';+import { Routes, RouterModule } from '@angular/router';+import { AuthGuard } from '../_guards/auth.guard';+import { LibraryAccessGuard } from '../_guards/library-access.guard';+import { LibraryDetailComponent } from './library-detail.component';+++const routes: Routes = [+ {+ path: ':libraryId',+ runGuardsAndResolvers: 'always',+ canActivate: [AuthGuard, LibraryAccessGuard],+ component: LibraryDetailComponent+ },+ {+ path: '',+ component: LibraryDetailComponent+ }+];+++@NgModule({+ imports: [RouterModule.forChild(routes), ],+ exports: [RouterModule]+})+export class LibraryDetailRoutingModule { }diff --git a/UI/Web/src/app/library-detail/library-detail.component.html b/UI/Web/src/app/library-detail/library-detail.component.htmlindex 6b3771c0d..db9c4d27e 100644--- a/UI/Web/src/app/library-detail/library-detail.component.html+++ b/UI/Web/src/app/library-detail/library-detail.component.html@@ -1,24 +1,43 @@-<app-side-nav-companion-bar [hasFilter]="true" [filterOpenByDefault]="filterSettings.openByDefault" (filterOpen)="filterOpen.emit($event)">+<app-side-nav-companion-bar [hasFilter]="true" [filterOpenByDefault]="filterSettings.openByDefault" (filterOpen)="filterOpen.emit($event)" [filterActive]="filterActive"><h2 title>- <app-card-actionables [actions]="actions"></app-card-actionables>+ <app-card-actionables [actions]="actions" (actionHandler)="performAction($event)"></app-card-actionables>{{libraryName}}</h2>- <h6 subtitle style="margin-left:40px;">{{pagination?.totalItems}} Series</h6>+ <h6 subtitle style="margin-left:40px;" *ngIf="active.fragment === ''">{{pagination?.totalItems}} Series</h6><div main>- <!-- TODO: Implement Tabs here for Recommended and Library view -->+ <ul ngbNav #nav="ngbNav" [(activeId)]="active" class="nav nav-pills" style="flex-wrap: nowrap;">+ <li *ngFor="let tab of tabs" [ngbNavItem]="tab">+ <a ngbNavLink>+ <span class="d-none d-sm-flex align-items-center"><i class="fa {{tab.icon}} me-1" style="padding-right: 5px;" aria-hidden="true"></i> {{tab.title | sentenceCase}}</span>+ <span class="d-flex d-sm-none">+ <i class="fa {{tab.icon}}" aria-hidden="true"></i>+ </span>+ </a>+ <ng-template ngbNavContent>+ <ng-container *ngIf="tab.title === 'Recommended'">+ <app-library-recommended [libraryId]="libraryId"></app-library-recommended>+ </ng-container>+ <ng-container *ngIf="tab.title === 'Library'">+ <app-card-detail-layout+ [isLoading]="loadingSeries"+ [items]="series"+ [pagination]="pagination"+ [filterSettings]="filterSettings"+ [filterOpen]="filterOpen"+ (applyFilter)="updateFilter($event)"+ (pageChange)="onPageChange($event)"+ >+ <ng-template #cardItem let-item let-position="idx">+ <app-series-card [data]="item" [libraryId]="libraryId" [suppressLibraryLink]="true" (reload)="loadPage()" (selection)="bulkSelectionService.handleCardSelection('series', position, series.length, $event)" [selected]="bulkSelectionService.isCardSelected('series', position)" [allowSelection]="true"></app-series-card>+ </ng-template>+ </app-card-detail-layout>+ </ng-container>+ </ng-template>+ </li>+ </ul></div></app-side-nav-companion-bar><app-bulk-operations [actionCallback]="bulkActionCallback"></app-bulk-operations>-<app-card-detail-layout- [isLoading]="loadingSeries"- [items]="series"- [pagination]="pagination"- [filterSettings]="filterSettings"- [filterOpen]="filterOpen"- (applyFilter)="updateFilter($event)"- (pageChange)="onPageChange($event)"- >- <ng-template #cardItem let-item let-position="idx">- <app-series-card [data]="item" [libraryId]="libraryId" [suppressLibraryLink]="true" (reload)="loadPage()" (selection)="bulkSelectionService.handleCardSelection('series', position, series.length, $event)" [selected]="bulkSelectionService.isCardSelected('series', position)" [allowSelection]="true"></app-series-card>- </ng-template>-</app-card-detail-layout>+<div [ngbNavOutlet]="nav" class="mt-3"></div>++diff --git a/UI/Web/src/app/library-detail/library-detail.component.scss b/UI/Web/src/app/library-detail/library-detail.component.scssindex 9863b1284..3343a96e5 100644--- a/UI/Web/src/app/library-detail/library-detail.component.scss+++ b/UI/Web/src/app/library-detail/library-detail.component.scss@@ -3,9 +3,8 @@width: 200;}-.viewport {width: 600px;height: 100%;overflow-y: auto;- }\ No newline at end of file+}diff --git a/UI/Web/src/app/library-detail/library-detail.component.ts b/UI/Web/src/app/library-detail/library-detail.component.tsindex c2101dbdf..83bb5bf5f 100644--- a/UI/Web/src/app/library-detail/library-detail.component.ts+++ b/UI/Web/src/app/library-detail/library-detail.component.ts@@ -2,9 +2,8 @@ import { Component, EventEmitter, HostListener, OnDestroy, OnInit } from '@angulimport { Title } from '@angular/platform-browser';import { ActivatedRoute, Router } from '@angular/router';import { Subject } from 'rxjs';-import { debounceTime, take, takeUntil, takeWhile } from 'rxjs/operators';+import { debounceTime, take, takeUntil } from 'rxjs/operators';import { BulkSelectionService } from '../cards/bulk-selection.service';-import { FilterSettings } from '../metadata-filter/filter-settings';import { KEY_CODES, UtilityService } from '../shared/_services/utility.service';import { SeriesAddedEvent } from '../_models/events/series-added-event';import { Library } from '../_models/library';@@ -17,6 +16,8 @@ import { LibraryService } from '../_services/library.service';import { EVENTS, MessageHubService } from '../_services/message-hub.service';import { SeriesService } from '../_services/series.service';import { NavService } from '../_services/nav.service';+import { FilterUtilitiesService } from '../shared/_services/filter-utilities.service';+import { FilterSettings } from '../metadata-filter/filter-settings';@Component({selector: 'app-library-detail',@@ -35,6 +36,14 @@ export class LibraryDetailComponent implements OnInit, OnDestroy {onDestroy: Subject<void> = new Subject<void>();filterSettings: FilterSettings = new FilterSettings();filterOpen: EventEmitter<boolean> = new EventEmitter();+ filterActive: boolean = false;+ filterActiveCheck!: SeriesFilter;++ tabs: Array<{title: string, fragment: string, icon: string}> = [+ {title: 'Library', fragment: '', icon: 'fa-landmark'},+ {title: 'Recommended', fragment: 'recomended', icon: 'fa-award'},+ ];+ active = this.tabs[0];bulkActionCallback = (action: Action, data: any) => {@@ -77,13 +86,14 @@ export class LibraryDetailComponent implements OnInit, OnDestroy {constructor(private route: ActivatedRoute, private router: Router, private seriesService: SeriesService,private libraryService: LibraryService, private titleService: Title, private actionFactoryService: ActionFactoryService,private actionService: ActionService, public bulkSelectionService: BulkSelectionService, private hubService: MessageHubService,- private utilityService: UtilityService, public navService: NavService) {- const routeId = this.route.snapshot.paramMap.get('id');+ private utilityService: UtilityService, public navService: NavService, private filterUtilityService: FilterUtilitiesService) {+ const routeId = this.route.snapshot.paramMap.get('libraryId');if (routeId === null) {this.router.navigateByUrl('/libraries');return;}+this.router.routeReuseStrategy.shouldReuseRoute = () => false;this.libraryId = parseInt(routeId, 10);this.libraryService.getLibraryNames().pipe(take(1)).subscribe(names => {@@ -91,10 +101,15 @@ export class LibraryDetailComponent implements OnInit, OnDestroy {this.titleService.setTitle('Kavita - ' + this.libraryName);});this.actions = this.actionFactoryService.getLibraryActions(this.handleAction.bind(this));- this.pagination = {currentPage: 0, itemsPerPage: 30, totalItems: 0, totalPages: 1};- [this.filterSettings.presets, this.filterSettings.openByDefault] = this.utilityService.filterPresetsFromUrl(this.route.snapshot, this.seriesService.createSeriesFilter());- this.filterSettings.presets.libraries = [this.libraryId];+ this.pagination = this.filterUtilityService.pagination(this.route.snapshot);+ [this.filterSettings.presets, this.filterSettings.openByDefault] = this.filterUtilityService.filterPresetsFromUrl(this.route.snapshot);+ if (this.filterSettings.presets) this.filterSettings.presets.libraries = [this.libraryId];+ // Setup filterActiveCheck to check filter against+ this.filterActiveCheck = this.seriesService.createSeriesFilter();+ this.filterActiveCheck.libraries = [this.libraryId];++ this.filterSettings.libraryDisabled = true;}ngOnInit(): void {@@ -142,30 +157,28 @@ export class LibraryDetailComponent implements OnInit, OnDestroy {}}- updateFilter(event: FilterEvent) {- this.filter = event.filter;- const page = this.getPage();- if (page === undefined || page === null || !event.isFirst) {- this.pagination.currentPage = 1;- this.onPageChange(this.pagination);- } else {- this.loadPage();+ performAction(action: ActionItem<any>) {+ if (typeof action.callback === 'function') {+ action.callback(action.action, undefined);}}- loadPage() {- const page = this.getPage();- if (page != null) {- this.pagination.currentPage = parseInt(page, 10);- }- this.loadingSeries = true;+ updateFilter(data: FilterEvent) {+ this.filter = data.filter;+ if (!data.isFirst) this.filterUtilityService.updateUrlFromFilter(this.pagination, this.filter);+ this.loadPage();+ }++ loadPage() {// The filter is out of sync with the presets from typeaheads on first load but syncs afterwardsif (this.filter == undefined) {this.filter = this.seriesService.createSeriesFilter();this.filter.libraries.push(this.libraryId);}+ this.loadingSeries = true;+ this.filterActive = !this.utilityService.deepEqual(this.filter, this.filterActiveCheck);this.seriesService.getSeriesForLibrary(0, this.pagination?.currentPage, this.pagination?.itemsPerPage, this.filter).pipe(take(1)).subscribe(series => {this.series = series.result;this.pagination = series.pagination;@@ -175,7 +188,7 @@ export class LibraryDetailComponent implements OnInit, OnDestroy {}onPageChange(pagination: Pagination) {- window.history.replaceState(window.location.href, '', window.location.href.split('?')[0] + '?' + 'page=' + this.pagination.currentPage);+ this.filterUtilityService.updateUrlFromFilter(this.pagination, undefined);this.loadPage();}@@ -184,10 +197,4 @@ export class LibraryDetailComponent implements OnInit, OnDestroy {}trackByIdentity = (index: number, item: Series) => `${item.name}_${item.originalName}_${item.localizedName}_${item.pagesRead}`;-- getPage() {- const urlParams = new URLSearchParams(window.location.search);- return urlParams.get('page');- }-}diff --git a/UI/Web/src/app/library-detail/library-detail.module.ts b/UI/Web/src/app/library-detail/library-detail.module.tsnew file mode 100644index 000000000..4f3096f25--- /dev/null+++ b/UI/Web/src/app/library-detail/library-detail.module.ts@@ -0,0 +1,28 @@+import { NgModule } from '@angular/core';+import { CommonModule } from '@angular/common';+import { LibraryDetailComponent } from './library-detail.component';+import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap';+import { PipeModule } from '../pipe/pipe.module';+import { LibraryDetailRoutingModule } from './library-detail-routing.module';+import { SharedSideNavCardsModule } from '../shared-side-nav-cards/shared-side-nav-cards.module';+import { LibraryRecommendedComponent } from './library-recommended/library-recommended.component';+import { CarouselModule } from '../carousel/carousel.module';++++@NgModule({+ declarations: [LibraryDetailComponent, LibraryRecommendedComponent],+ imports: [+ CommonModule,++ NgbNavModule,++ CarouselModule, // because this is heavy, we might want recommended in a new url++ PipeModule,+ SharedSideNavCardsModule,++ LibraryDetailRoutingModule+ ]+})+export class LibraryDetailModule { }diff --git a/UI/Web/src/app/library-detail/library-recommended/library-recommended.component.html b/UI/Web/src/app/library-detail/library-recommended/library-recommended.component.htmlnew file mode 100644index 000000000..52249c75e--- /dev/null+++ b/UI/Web/src/app/library-detail/library-recommended/library-recommended.component.html@@ -0,0 +1,49 @@+++<ng-container *ngIf="noData">+ <p>Nothing to show here. Add some metadata to your library, read something or rate something.</p>+</ng-container>++<ng-container *ngIf="onDeck$ | async as onDeck">+ <app-carousel-reel [items]="onDeck" title="On Deck">+ <ng-template #carouselItem let-item let-position="idx">+ <app-series-card [data]="item" [libraryId]="item.libraryId" [suppressLibraryLink]="libraryId !== 0" (reload)="reloadInProgress($event)" (dataChanged)="reloadInProgress($event)"></app-series-card>+ </ng-template>+ </app-carousel-reel>+</ng-container>++<ng-container *ngIf="quickReads$ | async as quickReads">+ <app-carousel-reel [items]="quickReads" title="Quick Reads">+ <ng-template #carouselItem let-item let-position="idx">+ <app-series-card [data]="item" [libraryId]="item.libraryId" [suppressLibraryLink]="libraryId !== 0" (reload)="reloadInProgress($event)" (dataChanged)="reloadInProgress($event)"></app-series-card>+ </ng-template>+ </app-carousel-reel>+</ng-container>++<ng-container *ngIf="highlyRated$ | async as highlyRated">+ <app-carousel-reel [items]="highlyRated" title="Highly Rated">+ <ng-template #carouselItem let-item let-position="idx">+ <app-series-card [data]="item" [libraryId]="item.libraryId" [suppressLibraryLink]="libraryId !== 0" (reload)="reloadInProgress($event)" (dataChanged)="reloadInProgress($event)"></app-series-card>+ </ng-template>+ </app-carousel-reel>+</ng-container>++<ng-container *ngIf="rediscover$ | async as rediscover">+ <app-carousel-reel [items]="rediscover" title="Rediscover">+ <ng-template #carouselItem let-item let-position="idx">+ <app-series-card [data]="item" [libraryId]="item.libraryId" [suppressLibraryLink]="libraryId !== 0" (reload)="reloadInProgress($event)" (dataChanged)="reloadInProgress($event)"></app-series-card>+ </ng-template>+ </app-carousel-reel>+</ng-container>++<ng-container *ngIf="genre$ | async as genre">+ <ng-container *ngIf="moreIn$ | async as moreIn">+ <ng-container *ngIf="moreIn.length > 1">+ <app-carousel-reel [items]="moreIn" title="More In {{genre.title}}">+ <ng-template #carouselItem let-item let-position="idx">+ <app-series-card [data]="item" [libraryId]="item.libraryId" [suppressLibraryLink]="libraryId !== 0" (reload)="reloadInProgress($event)" (dataChanged)="reloadInProgress($event)"></app-series-card>+ </ng-template>+ </app-carousel-reel>+ </ng-container>+ </ng-container>+</ng-container>diff --git a/UI/Web/src/app/cards/_modals/bookmarks-modal/bookmarks-modal.component.scss b/UI/Web/src/app/library-detail/library-recommended/library-recommended.component.scsssimilarity index 100%rename from UI/Web/src/app/cards/_modals/bookmarks-modal/bookmarks-modal.component.scssrename to UI/Web/src/app/library-detail/library-recommended/library-recommended.component.scssdiff --git a/UI/Web/src/app/library-detail/library-recommended/library-recommended.component.ts b/UI/Web/src/app/library-detail/library-recommended/library-recommended.component.tsnew file mode 100644index 000000000..d06493b37--- /dev/null+++ b/UI/Web/src/app/library-detail/library-recommended/library-recommended.component.ts@@ -0,0 +1,77 @@+import { Component, Input, OnDestroy, OnInit } from '@angular/core';+import { map, merge, Observable, shareReplay, Subject, takeUntil } from 'rxjs';+import { Genre } from 'src/app/_models/genre';+import { Series } from 'src/app/_models/series';+import { MetadataService } from 'src/app/_services/metadata.service';+import { RecommendationService } from 'src/app/_services/recommendation.service';+import { SeriesService } from 'src/app/_services/series.service';++@Component({+ selector: 'app-library-recommended',+ templateUrl: './library-recommended.component.html',+ styleUrls: ['./library-recommended.component.scss']+})+export class LibraryRecommendedComponent implements OnInit, OnDestroy {++ @Input() libraryId: number = 0;++ quickReads$!: Observable<Series[]>;+ highlyRated$!: Observable<Series[]>;+ onDeck$!: Observable<Series[]>;+ rediscover$!: Observable<Series[]>;++ moreIn$!: Observable<Series[]>;+ genre: string = '';+ genre$!: Observable<Genre>;++ all$!: Observable<any>;+ noData: boolean = true;++ private onDestroy: Subject<void> = new Subject();++ constructor(private recommendationService: RecommendationService, private seriesService: SeriesService, private metadataService: MetadataService) { }++ ngOnInit(): void {++ this.quickReads$ = this.recommendationService.getQuickReads(this.libraryId)+ .pipe(takeUntil(this.onDestroy), map(p => p.result), shareReplay());++ this.highlyRated$ = this.recommendationService.getHighlyRated(this.libraryId)+ .pipe(takeUntil(this.onDestroy), map(p => p.result), shareReplay());++ this.rediscover$ = this.recommendationService.getRediscover(this.libraryId)+ .pipe(takeUntil(this.onDestroy), map(p => p.result), shareReplay());++ this.onDeck$ = this.seriesService.getOnDeck(this.libraryId)+ .pipe(takeUntil(this.onDestroy), map(p => p.result), shareReplay());++ this.genre$ = this.metadataService.getAllGenres([this.libraryId]).pipe(takeUntil(this.onDestroy), map(genres => genres[Math.floor(Math.random() * genres.length)]), shareReplay());+ this.genre$.subscribe(genre => {+ this.moreIn$ = this.recommendationService.getMoreIn(this.libraryId, genre.id).pipe(takeUntil(this.onDestroy), map(p => p.result), shareReplay());+ });++ this.all$ = merge(this.quickReads$, this.highlyRated$, this.rediscover$, this.onDeck$, this.genre$).pipe(takeUntil(this.onDestroy));+ this.all$.subscribe(() => this.noData = false);++ }++ ngOnDestroy(): void {+ this.onDestroy.next();+ this.onDestroy.complete();+ }+++ reloadInProgress(series: Series | boolean) {+ if (series === true || series === false) {+ if (!series) {return;}+ }+ // If the update to Series doesn't affect the requirement to be in this stream, then ignore update request+ const seriesObj = (series as Series);+ if (seriesObj.pagesRead !== seriesObj.pages && seriesObj.pagesRead !== 0) {+ return;+ }++ //this.loadOnDeck();+ }++}diff --git a/UI/Web/src/app/library/library.component.html b/UI/Web/src/app/library/library.component.htmldeleted file mode 100644index e05363698..000000000--- a/UI/Web/src/app/library/library.component.html+++ /dev/null@@ -1,37 +0,0 @@-<ng-container *ngIf="libraries.length === 0 && !isLoading">- <div class="mt-3">- <div *ngIf="isAdmin" class="d-flex justify-content-center">- <p>There are no libraries setup yet. Configure some in <a routerLink="/admin/dashboard" fragment="libraries">Server settings</a>.</p>- </div>- <div *ngIf="!isAdmin" class="d-flex justify-content-center">- <p>You haven't been granted access to any libraries.</p>- </div>- </div>-</ng-container>--<app-carousel-reel [items]="inProgress" title="On Deck" (sectionClick)="handleSectionClick($event)">- <ng-template #carouselItem let-item let-position="idx">- <app-series-card [data]="item" [libraryId]="item.libraryId" (reload)="reloadInProgress($event)" (dataChanged)="reloadInProgress($event)"></app-series-card>- </ng-template>-</app-carousel-reel>--<!-- TODO: Refactor this so we can use series actions here -->-<app-carousel-reel [items]="recentlyUpdatedSeries" title="Recently Updated Series" (sectionClick)="handleSectionClick($event)">- <ng-template #carouselItem let-item let-position="idx">- <app-card-item [entity]="item" [title]="item.seriesName" [imageUrl]="imageService.getSeriesCoverImage(item.seriesId)"- [supressArchiveWarning]="true" (clicked)="handleRecentlyAddedChapterClick(item)" [count]="item.count"></app-card-item>- </ng-template>-</app-carousel-reel>--<app-carousel-reel [items]="recentlyAddedSeries" title="Newly Added Series" [clickableTitle]="false">- <ng-template #carouselItem let-item let-position="idx">- <app-series-card [data]="item" [libraryId]="item.libraryId" (dataChanged)="loadRecentlyAddedSeries()"></app-series-card>- </ng-template>-</app-carousel-reel>--<!-- <app-carousel-reel [items]="recentlyAddedChapters" title="Recently Added" (sectionClick)="handleSectionClick($event)">- <ng-template #carouselItem let-item let-position="idx">- <app-card-item [entity]="item" [title]="item.title" [subtitle]="item.seriesName" [imageUrl]="imageService.getRecentlyAddedItem(item)"- [supressArchiveWarning]="true" (clicked)="handleRecentlyAddedChapterClick(item)"></app-card-item>- </ng-template>-</app-carousel-reel> -->diff --git a/UI/Web/src/app/library/library.component.ts b/UI/Web/src/app/library/library.component.tsdeleted file mode 100644index 226f56faa..000000000--- a/UI/Web/src/app/library/library.component.ts+++ /dev/null@@ -1,159 +0,0 @@-import { Component, OnDestroy, OnInit } from '@angular/core';-import { Title } from '@angular/platform-browser';-import { Router } from '@angular/router';-import { ReplaySubject, Subject } from 'rxjs';-import { debounceTime, take, takeUntil } from 'rxjs/operators';-import { SeriesAddedEvent } from '../_models/events/series-added-event';-import { SeriesRemovedEvent } from '../_models/events/series-removed-event';-import { Library } from '../_models/library';-import { RecentlyAddedItem } from '../_models/recently-added-item';-import { Series } from '../_models/series';-import { SeriesGroup } from '../_models/series-group';-import { User } from '../_models/user';-import { AccountService } from '../_services/account.service';-import { ImageService } from '../_services/image.service';-import { LibraryService } from '../_services/library.service';-import { EVENTS, MessageHubService } from '../_services/message-hub.service';-import { SeriesService } from '../_services/series.service';--@Component({- selector: 'app-library',- templateUrl: './library.component.html',- styleUrls: ['./library.component.scss']-})-export class LibraryComponent implements OnInit, OnDestroy {-- user: User | undefined;- libraries: Library[] = [];- isLoading = false;- isAdmin = false;-- recentlyUpdatedSeries: SeriesGroup[] = [];- recentlyAddedChapters: RecentlyAddedItem[] = [];- inProgress: Series[] = [];- recentlyAddedSeries: Series[] = [];-- private readonly onDestroy = new Subject<void>();-- /**- * We use this Replay subject to slow the amount of times we reload the UI- */- private loadRecentlyAdded$: ReplaySubject<void> = new ReplaySubject<void>();-- constructor(public accountService: AccountService, private libraryService: LibraryService,- private seriesService: SeriesService, private router: Router,- private titleService: Title, public imageService: ImageService,- private messageHub: MessageHubService) {- this.messageHub.messages$.pipe(takeUntil(this.onDestroy)).subscribe(res => {- if (res.event === EVENTS.SeriesAdded) {- const seriesAddedEvent = res.payload as SeriesAddedEvent;-- this.seriesService.getSeries(seriesAddedEvent.seriesId).subscribe(series => {- this.recentlyAddedSeries.unshift(series);- });- } else if (res.event === EVENTS.SeriesRemoved) {- const seriesRemovedEvent = res.payload as SeriesRemovedEvent;-- this.inProgress = this.inProgress.filter(item => item.id != seriesRemovedEvent.seriesId);- this.recentlyAddedSeries = this.recentlyAddedSeries.filter(item => item.id != seriesRemovedEvent.seriesId);- this.recentlyUpdatedSeries = this.recentlyUpdatedSeries.filter(item => item.seriesId != seriesRemovedEvent.seriesId);- this.recentlyAddedChapters = this.recentlyAddedChapters.filter(item => item.seriesId != seriesRemovedEvent.seriesId);- } else if (res.event === EVENTS.ScanSeries) {- // We don't have events for when series are updated, but we do get events when a scan update occurs. Refresh recentlyAdded at that time.- this.loadRecentlyAdded$.next();- }- });-- this.loadRecentlyAdded$.pipe(debounceTime(1000), takeUntil(this.onDestroy)).subscribe(() => this.loadRecentlyAdded());- }-- ngOnInit(): void {- this.titleService.setTitle('Kavita - Dashboard');- this.isLoading = true;- this.accountService.currentUser$.pipe(take(1)).subscribe(user => {- this.user = user;- if (this.user) {- this.isAdmin = this.accountService.hasAdminRole(this.user);- this.libraryService.getLibrariesForMember().pipe(take(1)).subscribe(libraries => {- this.libraries = libraries;- this.isLoading = false;- });- }- });-- this.reloadSeries();- }-- ngOnDestroy() {- this.onDestroy.next();- this.onDestroy.complete();- }-- reloadSeries() {- this.loadOnDeck();- this.loadRecentlyAdded();- this.loadRecentlyAddedSeries();- }-- reloadInProgress(series: Series | boolean) {- if (series === true || series === false) {- if (!series) {return;}- }- // If the update to Series doesn't affect the requirement to be in this stream, then ignore update request- const seriesObj = (series as Series);- if (seriesObj.pagesRead !== seriesObj.pages && seriesObj.pagesRead !== 0) {- return;- }-- this.loadOnDeck();- }-- loadOnDeck() {- this.seriesService.getOnDeck().pipe(takeUntil(this.onDestroy)).subscribe((updatedSeries) => {- this.inProgress = updatedSeries.result;- });- }-- loadRecentlyAddedSeries() {- this.seriesService.getRecentlyAdded().pipe(takeUntil(this.onDestroy)).subscribe((updatedSeries) => {- this.recentlyAddedSeries = updatedSeries.result;- });- }--- loadRecentlyAdded() {- this.seriesService.getRecentlyUpdatedSeries().pipe(takeUntil(this.onDestroy)).subscribe(updatedSeries => {- this.recentlyUpdatedSeries = updatedSeries;- });-- this.seriesService.getRecentlyAddedChapters().pipe(takeUntil(this.onDestroy)).subscribe(updatedSeries => {- this.recentlyAddedChapters = updatedSeries;- });- }-- handleRecentlyAddedChapterClick(item: RecentlyAddedItem) {- this.router.navigate(['library', item.libraryId, 'series', item.seriesId]);- }-- handleSectionClick(sectionTitle: string) {- if (sectionTitle.toLowerCase() === 'collections') {- this.router.navigate(['collections']);- } else if (sectionTitle.toLowerCase() === 'recently updated series') {- this.router.navigate(['recently-added']);- } else if (sectionTitle.toLowerCase() === 'on deck') {- const params: any = {};- params['readStatus'] = 'true,false,false';- params['page'] = 1;- this.router.navigate(['all-series'], {queryParams: params});- } else if (sectionTitle.toLowerCase() === 'libraries') {- this.router.navigate(['all-series']);- }- }-- removeFromArray(arr: Array<any>, element: any) {- const index = arr.indexOf(element);- if (index >= 0) {- arr.splice(index);- }- }-}diff --git a/UI/Web/src/app/manga-reader/infinite-scroller/infinite-scroller.component.scss b/UI/Web/src/app/manga-reader/infinite-scroller/infinite-scroller.component.scssindex 1d1fe8769..f56c62ced 100644--- a/UI/Web/src/app/manga-reader/infinite-scroller/infinite-scroller.component.scss+++ b/UI/Web/src/app/manga-reader/infinite-scroller/infinite-scroller.component.scss@@ -27,13 +27,10 @@img, .full-width {- width: 100% !important;+ max-width: 100% !important;height: auto;}-// .img-container {-// overflow: auto;-// }@keyframes move-up-down {diff --git a/UI/Web/src/app/manga-reader/infinite-scroller/infinite-scroller.component.ts b/UI/Web/src/app/manga-reader/infinite-scroller/infinite-scroller.component.tsindex b179f4253..69afaa279 100644--- a/UI/Web/src/app/manga-reader/infinite-scroller/infinite-scroller.component.ts+++ b/UI/Web/src/app/manga-reader/infinite-scroller/infinite-scroller.component.ts@@ -1,8 +1,8 @@import { DOCUMENT } from '@angular/common';import { Component, ElementRef, EventEmitter, Inject, Input, OnChanges, OnDestroy, OnInit, Output, Renderer2, SimpleChanges } from '@angular/core';-import { BehaviorSubject, fromEvent, merge, ReplaySubject, Subject } from 'rxjs';-import { debounceTime, take, takeUntil } from 'rxjs/operators';-import { ScrollService } from 'src/app/scroll.service';+import { BehaviorSubject, fromEvent, ReplaySubject, Subject } from 'rxjs';+import { debounceTime, takeUntil } from 'rxjs/operators';+import { ScrollService } from 'src/app/_services/scroll.service';import { ReaderService } from '../../_services/reader.service';import { PAGING_DIRECTION } from '../_models/reader-enums';import { WebtoonImage } from '../_models/webtoon-image';diff --git a/UI/Web/src/app/manga-reader/manga-reader.component.html b/UI/Web/src/app/manga-reader/manga-reader.component.htmlindex 6434fc681..655d2f9a7 100644--- a/UI/Web/src/app/manga-reader/manga-reader.component.html+++ b/UI/Web/src/app/manga-reader/manga-reader.component.html@@ -21,7 +21,7 @@<!-- {{this.pageNum}} --><!-- {{readerService.imageUrlToPageNum(canvasImage.src)}}<ng-container *ngIf="ShouldRenderDoublePage && (this.pageNum + 1 <= maxPages - 1 && this.pageNum > 0)"> - {{PageNumber + 1}}</ng-container> -->- <button class="btn btn-icon btn-small" role="checkbox" [attr.aria-checked]="isCurrentPageBookmarked" title="{{isCurrentPageBookmarked ? 'Unbookmark Page' : 'Bookmark Page'}}" (click)="bookmarkPage()"><i class="{{isCurrentPageBookmarked ? 'fa' : 'far'}} fa-bookmark" aria-hidden="true"></i><span class="visually-hidden">{{isCurrentPageBookmarked ? 'Unbookmark Page' : 'Bookmark Page'}}</span></button>+ <button *ngIf="!bookmarkMode" class="btn btn-icon btn-small" role="checkbox" [attr.aria-checked]="isCurrentPageBookmarked" title="{{isCurrentPageBookmarked ? 'Unbookmark Page' : 'Bookmark Page'}}" (click)="bookmarkPage()"><i class="{{isCurrentPageBookmarked ? 'fa' : 'far'}} fa-bookmark" aria-hidden="true"></i><span class="visually-hidden">{{isCurrentPageBookmarked ? 'Unbookmark Page' : 'Bookmark Page'}}</span></button></div></div></div>@@ -31,42 +31,43 @@</div></ng-container>- <div (click)="toggleMenu()" class="reading-area" [ngStyle]="{'background-color': backgroundColor}">+ <div (click)="toggleMenu()" class="reading-area" [ngStyle]="{'background-color': backgroundColor, 'height': readerMode === ReaderMode.Webtoon ? 'inherit' : 'calc(var(--vh)*100)'}" #readingArea><ng-container *ngIf="readerMode !== ReaderMode.Webtoon; else webtoon">- <div [ngClass]="{'d-none': !renderWithCanvas }">+ <div class="image-container" [ngClass]="{'d-none': !renderWithCanvas }"><canvas #content class="{{getFittingOptionClass()}}"ondragstart="return false;" onselectstart="return false;"></canvas></div>- <div class="image-container" [ngClass]="{'d-none': renderWithCanvas, 'center-double': ShouldRenderDoublePage,++ <div class="pagination-area">+ <!-- Pagination controls and screen hints-->+ <div class="{{readerMode === ReaderMode.LeftRight ? 'left' : 'top'}} {{clickOverlayClass('left')}}" (click)="handlePageChange($event, 'left')" [ngStyle]="{'height': (readerMode === ReaderMode.LeftRight ? ImageHeight: 25 + '%')}">+ <div *ngIf="showClickOverlay">+ <i class="fa fa-angle-{{readingDirection === ReadingDirection.RightToLeft ? 'double-' : ''}}{{readerMode === ReaderMode.LeftRight ? 'left' : 'up'}}"+ title="Previous Page" aria-hidden="true"></i>+ </div>+ </div>+ <div class="{{readerMode === ReaderMode.LeftRight ? 'right' : 'bottom'}} {{clickOverlayClass('right')}}" (click)="handlePageChange($event, 'right')" [ngStyle]="{'height': (readerMode === ReaderMode.LeftRight ? ImageHeight: 25 + '%'), 'left': (readerMode === ReaderMode.LeftRight && (this.generalSettingsForm.get('fittingOption')?.value === FITTING_OPTION.ORIGINAL) ? ImageWidth: 'inherit')}">+ <div *ngIf="showClickOverlay">+ <i class="fa fa-angle-{{readingDirection === ReadingDirection.LeftToRight ? 'double-' : ''}}{{readerMode === ReaderMode.LeftRight ? 'right' : 'down'}}"+ title="Next Page" aria-hidden="true"></i>+ </div>+ </div>+ </div>++ <div class="image-container {{getFittingOptionClass()}}" [ngClass]="{'d-none': renderWithCanvas, 'center-double': ShouldRenderDoublePage,'fit-to-width-double-offset' : this.generalSettingsForm.get('fittingOption')?.value === FITTING_OPTION.WIDTH && ShouldRenderDoublePage,'fit-to-height-double-offset': this.generalSettingsForm.get('fittingOption')?.value === FITTING_OPTION.HEIGHT && ShouldRenderDoublePage,'original-double-offset' : this.generalSettingsForm.get('fittingOption')?.value === FITTING_OPTION.ORIGINAL && ShouldRenderDoublePage,'reverse': ShouldRenderReverseDouble}">- <img [src]="canvasImage.src" id="image-1"+ <img #image [src]="canvasImage.src" id="image-1"class="{{getFittingOptionClass()}} {{readerMode === ReaderMode.LeftRight || readerMode === ReaderMode.UpDown ? '' : 'd-none'}} {{showClickOverlay ? 'blur' : ''}}"><ng-container *ngIf="ShouldRenderDoublePage && (this.pageNum + 1 <= maxPages - 1 && this.pageNum > 0)">- <img [src]="readerService.getPageUrl(this.chapterId, PageNumber + 1)" id="image-2" class="image-2 {{getFittingOptionClass()}} {{readerMode === ReaderMode.LeftRight || readerMode === ReaderMode.UpDown ? '' : 'd-none'}} {{showClickOverlay ? 'blur' : ''}} {{ShouldRenderReverseDouble ? 'reverse' : ''}}">+ <img [src]="getPageUrl(PageNumber + 1)" id="image-2" class="image-2 {{getFittingOptionClass()}} {{readerMode === ReaderMode.LeftRight || readerMode === ReaderMode.UpDown ? '' : 'd-none'}} {{showClickOverlay ? 'blur' : ''}} {{ShouldRenderReverseDouble ? 'reverse' : ''}}"></ng-container></div>- <ng-container>- <!-- Pagination controls and screen hints-->- <div class="pagination-area {{readerMode === ReaderMode.LeftRight ? 'right' : 'bottom'}} {{clickOverlayClass('right')}}" (click)="handlePageChange($event, 'right')">- <div *ngIf="showClickOverlay">- <i class="fa fa-angle-{{readingDirection === ReadingDirection.LeftToRight ? 'double-' : ''}}{{readerMode === ReaderMode.LeftRight ? 'right' : 'down'}}"- title="Next Page" aria-hidden="true"></i>- </div>- </div>- <div class="pagination-area {{readerMode === ReaderMode.LeftRight ? 'left' : 'top'}} {{clickOverlayClass('left')}}" (click)="handlePageChange($event, 'left')">- <div *ngIf="showClickOverlay">- <i class="fa fa-angle-{{readingDirection === ReadingDirection.RightToLeft ? 'double-' : ''}}{{readerMode === ReaderMode.LeftRight ? 'left' : 'up'}}"- title="Previous Page" aria-hidden="true"></i>- </div>- </div>- </ng-container>-</ng-container><ng-template #webtoon>diff --git a/UI/Web/src/app/manga-reader/manga-reader.component.scss b/UI/Web/src/app/manga-reader/manga-reader.component.scssindex 0bc038212..681425de2 100644--- a/UI/Web/src/app/manga-reader/manga-reader.component.scss+++ b/UI/Web/src/app/manga-reader/manga-reader.component.scss@@ -18,15 +18,36 @@ img {}.reading-area {- display: flex;- justify-content: center;position: relative;+ overflow: auto;+ //height: calc(var(--vh)*100); // this needs to be applied on the DOM because it breaks infinite scroller}.image-container {text-align: center;- display: block;- height: 100vh;++ // Original+ //display: block;++ // New (for centering in both axis)+ //display: flex; // Leave this off as it can cutoff the image+ align-items: center;++ &.full-width {+ width: 100vw;+ height: calc(var(--vh)*100);+ display: grid;+ }++ &.full-height {+ height: 100vh;+ display: grid;+ }++ &.original {+ height: 100vh;+ display: grid;+ }#image-1 {&.double {@@ -47,10 +68,6 @@ img {}}-// canvas {-// //position: absolute; // JOE: Not sure why we have this, but it breaks the renderer-// }-.reader {background-color: var(--manga-reader-bg-color);overflow: auto;@@ -92,25 +109,30 @@ img {.full-height {width: auto;margin: 0 auto;- height: 100%;+ max-height: calc(var(--vh)*100);vertical-align: top;}.original {- align-self: center;+ align-self: center;+ width: auto;+ margin: 0 auto;+ vertical-align: top;}.full-width {- width: 100%;- align-self: center;+ width: 100%;+ margin: 0 auto;+ vertical-align: top;+ max-width: fit-content;- &.double {- width: 50%;+ &.double {+ width: 50%;- &.cover {- width: 100%;- }+ &.cover {+ width: 100%;}+ }}.center-double {@@ -119,11 +141,11 @@ img {}.fit-to-width-double-offset {- width: 100%;+ max-width: 100%; // max-width fixes center alignment issue}.original-double-offset {- width: 100%;+ max-width: 100%;}.fit-to-height-double-offset {@@ -137,52 +159,6 @@ img {}--.right {- position: fixed;- right: 0px;- top: 0px;- width: $side-width;- height: 100vh;- background: rgba(0, 0, 0, 0);- z-index: 2;- cursor: pointer;-}--.top {- position: fixed;- right: 0px;- top: 0px;- width: 100%;- height: $side-width;- background: rgba(0, 0, 0, 0);- z-index: 2;- cursor: pointer;-}--.left {- position: fixed;- left: 0px;- top: 0px;- width: $side-width;- height: 100vh;- background: rgba(0, 0, 0, 0);- z-index: 2;- cursor: pointer;-}--.bottom {- position: fixed;- left: 0px;- bottom: 0px;- width: 100%;- height: $side-width;- background: rgba(0, 0, 0, 0);- z-index: 2;- cursor: pointer;-}--// Splitting Icon.split {height: 20px;@@ -272,15 +248,49 @@ img {width: 100%;}+ $pagination-bg: rgba(0, 0, 0, 0);+ //$pagination-bg: rgba(0, 0, 255, 0.4);+.pagination-area {- display: flex;- align-items: center;- justify-content: center;+ cursor: pointer;+ z-index: 2;i {color: white;font-size: 42px;}++ .right {+ position: absolute;+ right: 0px;+ top: 0px;+ width: $side-width;+ background: $pagination-bg;+ }++ .top {+ position: absolute;+ right: 0px;+ top: 0px;+ width: 100%;+ background: $pagination-bg;+ }++ .left {+ position: absolute;+ left: 0px;+ top: 0px;+ width: $side-width;+ background: $pagination-bg;+ }++ .bottom {+ position: fixed; // I couldn't figure out how to do this with abs, so only the bottom bar will not be scrollable+ left: 0px;+ bottom: 0px;+ width: 100%;+ background: $pagination-bg;+ }}.highlight {diff --git a/UI/Web/src/app/manga-reader/manga-reader.component.ts b/UI/Web/src/app/manga-reader/manga-reader.component.tsindex d56f47b6f..b128b2331 100644--- a/UI/Web/src/app/manga-reader/manga-reader.component.ts+++ b/UI/Web/src/app/manga-reader/manga-reader.component.ts@@ -23,11 +23,11 @@ import { FITTING_OPTION, PAGING_DIRECTION, SPLIT_PAGE_PART } from './_models/reaimport { layoutModes, pageSplitOptions, scalingOptions } from '../_models/preferences/preferences';import { ReaderMode } from '../_models/preferences/reader-mode';import { MangaFormat } from '../_models/manga-format';-import { LibraryService } from '../_services/library.service';import { LibraryType } from '../_models/library';import { ShorcutsModalComponent } from '../reader-shared/_modals/shorcuts-modal/shorcuts-modal.component';import { NgbModal } from '@ng-bootstrap/ng-bootstrap';import { LayoutMode } from './_models/layout-mode';+import { SeriesService } from '../_services/series.service';const PREFETCH_PAGES = 8;@@ -80,6 +80,10 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {* If this is true, no progress will be saved.*/incognitoMode: boolean = false;+ /**+ * If this is true, we are reading a bookmark. ChapterId will be 0. There is no continuous reading. Progress is not saved. Bookmark control is removed.+ */+ bookmarkMode: boolean = false;/*** If this is true, chapters will be fetched in the order of a reading list, rather than natural series order.@@ -112,7 +116,9 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {isLoading = true;@ViewChild('reader') reader!: ElementRef;+ @ViewChild('readingArea') readingArea!: ElementRef;@ViewChild('content') canvas: ElementRef | undefined;+ @ViewChild('image') image!: ElementRef;private ctx!: CanvasRenderingContext2D;/*** Used to render a page on the canvas or in the image tag. This Image element is prefetched by the cachedImages buffer@@ -254,12 +260,13 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {*/backgroundColor: string = '#FFFFFF';+ getPageUrl = (pageNum: number) => {+ if (this.bookmarkMode) return this.readerService.getBookmarkPageUrl(this.seriesId, this.user.apiKey, pageNum);+ return this.readerService.getPageUrl(this.chapterId, pageNum);+ }private readonly onDestroy = new Subject<void>();-- getPageUrl = (pageNum: number) => this.readerService.getPageUrl(this.chapterId, pageNum);-get PageNumber() {return Math.max(Math.min(this.pageNum, this.maxPages - 1), 0);}@@ -276,6 +283,25 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {return this.bookmarks.hasOwnProperty(this.pageNum);}+ get WindowWidth() {+ return this.readingArea?.nativeElement.scrollWidth + 'px';+ }++ get WindowHeight() {+ return this.readingArea?.nativeElement.scrollHeight + 'px';+ }++ get ImageWidth() {+ return this.image?.nativeElement.width + 'px';+ }++ get ImageHeight() {+ // If we are a cover image and implied fit to screen, then we need to take screen height rather than image height+ if (this.isCoverImage() || this.generalSettingsForm.get('fittingOption')?.value === FITTING_OPTION.WIDTH) {+ return this.WindowHeight;+ }+ return this.image?.nativeElement.height + 'px';+ }get splitIconClass() {if (this.isSplitLeftToRight()) {@@ -326,8 +352,9 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {public readerService: ReaderService, private location: Location,private formBuilder: FormBuilder, private navService: NavService,private toastr: ToastrService, private memberService: MemberService,- private libraryService: LibraryService, public utilityService: UtilityService,- private renderer: Renderer2, @Inject(DOCUMENT) private document: Document, private modalService: NgbModal) {+ public utilityService: UtilityService, private renderer: Renderer2,+ @Inject(DOCUMENT) private document: Document, private modalService: NgbModal,+ private seriesService: SeriesService) {this.navService.hideNavBar();this.navService.hideSideNav();}@@ -348,6 +375,7 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {this.seriesId = parseInt(seriesId, 10);this.chapterId = parseInt(chapterId, 10);this.incognitoMode = this.route.snapshot.queryParamMap.get('incognitoMode') === 'true';+ this.bookmarkMode = this.route.snapshot.queryParamMap.get('bookmarkMode') === 'true';const readingListId = this.route.snapshot.queryParamMap.get('readingListId');if (readingListId != null) {@@ -426,6 +454,7 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {}this.ctx = this.canvas.nativeElement.getContext('2d', { alpha: false });this.canvasImage.onload = () => this.renderPage();+ this.getWindowDimensions();}ngOnDestroy() {@@ -507,12 +536,42 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {this.goToPageEvent.complete();}+ if (this.bookmarkMode) {+ this.readerService.getBookmarkInfo(this.seriesId).subscribe(bookmarkInfo => {+ this.setPageNum(0);+ this.title = bookmarkInfo.seriesName + ' Bookmarks';+ this.libraryType = bookmarkInfo.libraryType;+ this.maxPages = bookmarkInfo.pages;++ // 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);+ newOptions.ceil = this.maxPages - 1; // We -1 so that the slider UI shows us hitting the end, since visually we +1 everything.+ this.pageOptions = newOptions;+ this.inSetup = false;+ this.prevChapterDisabled = true;+ this.nextChapterDisabled = true;++ const images = [];+ for (let i = 0; i < PREFETCH_PAGES + 2; i++) {+ images.push(new Image());+ }++ this.cachedImages = new CircularArray<HTMLImageElement>(images, 0);++ this.render();+ });++ return;++ }+forkJoin({progress: this.readerService.getProgress(this.chapterId),chapterInfo: this.readerService.getChapterInfo(this.chapterId),bookmarks: this.readerService.getBookmarks(this.chapterId),}).pipe(take(1)).subscribe(results => {+if (this.readingListMode && results.chapterInfo.seriesFormat === MangaFormat.EPUB) {// Redirect to the book reader.const params = this.readerService.getQueryParamsObject(this.incognitoMode, this.readingListMode, this.readingListId);@@ -852,11 +911,11 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {const notInSplit = this.currentImageSplitPart !== (this.isSplitLeftToRight() ? SPLIT_PAGE_PART.RIGHT_PART : SPLIT_PAGE_PART.LEFT_PART);// If the prev page before we change current page is a cover image, we actually are skipping a page- console.log('Page ', this.PageNumber, ' is cover image: ', this.isCoverImage(this.cachedImages.prev()))- console.log('Page ', this.pageNum, ' is cover image: ', this.isCoverImage())+ //console.log('Page ', this.PageNumber, ' is cover image: ', this.isCoverImage(this.cachedImages.prev()))+ //console.log('Page ', this.pageNum, ' is cover image: ', this.isCoverImage())const pageAmount = (this.layoutMode !== LayoutMode.Single && !this.isCoverImage(this.cachedImages.prev())) ? 2: 1;// BUG: isCoverImage works on canvasImage, where we need to know if the previous image is a cover image or not.- console.log('pageAmt: ', pageAmount);+ //console.log('pageAmt: ', pageAmount);if ((this.pageNum - 1 < 0 && notInSplit) || this.isLoading) {if (this.isLoading) { return; }@@ -992,7 +1051,7 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {// Reset scroll on non HEIGHT Fitsif (this.getFit() !== FITTING_OPTION.HEIGHT) {- window.scrollTo(0, 0);+ this.document.body.scroll(0, 0)}@@ -1050,7 +1109,9 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {return;}if (offsetIndex < this.maxPages - 1) {- item.src = this.readerService.getPageUrl(this.chapterId, offsetIndex);+ // if (this.bookmarkMode) item.src = this.readerService.getBookmarkPageUrl(this.seriesId, offsetIndex);+ // else item.src = this.readerService.getPageUrl(this.chapterId, offsetIndex);+ item.src = this.getPageUrl(offsetIndex);index += 1;}}, this.cachedImages.size() - 3);@@ -1058,20 +1119,22 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {//console.log('cachedImages: ', this.cachedImages.arr.map(img => this.readerService.imageUrlToPageNum(img.src) + ': ' + img.complete));}- loadPage() {- if (!this.canvas || !this.ctx) { return; }++ loadPage() {this.isLoading = true;this.canvasImage = this.cachedImages.current();-if (this.readerService.imageUrlToPageNum(this.canvasImage.src) !== this.pageNum || this.canvasImage.src === '' || !this.canvasImage.complete) {if (this.layoutMode === LayoutMode.Single) {- this.canvasImage.src = this.readerService.getPageUrl(this.chapterId, this.pageNum);+ //this.canvasImage.src = this.readerService.getPageUrl(this.chapterId, this.pageNum);+ this.canvasImage.src = this.getPageUrl(this.pageNum);} else {- this.canvasImage.src = this.readerService.getPageUrl(this.chapterId, this.pageNum);- this.canvasImage2.src = this.readerService.getPageUrl(this.chapterId, this.pageNum + 1); // TODO: I need to handle last page correctly+ // this.canvasImage.src = this.readerService.getPageUrl(this.chapterId, this.pageNum);+ // this.canvasImage2.src = this.readerService.getPageUrl(this.chapterId, this.pageNum + 1); // TODO: I need to handle last page correctly+ this.canvasImage.src = this.getPageUrl(this.pageNum);+ this.canvasImage2.src = this.getPageUrl(this.pageNum + 1); // TODO: I need to handle last page correctly}this.canvasImage.onload = () => this.renderPage();@@ -1079,6 +1142,7 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {this.renderPage();}this.prefetch();+ this.isLoading = false;}setReadingDirection() {@@ -1144,7 +1208,7 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {tempPageNum = this.pageNum + 1;}- if (!this.incognitoMode) {+ if (!this.incognitoMode && !this.bookmarkMode) {this.readerService.saveProgress(this.seriesId, this.volumeId, this.chapterId, tempPageNum).pipe(take(1)).subscribe(() => {/* No operation */});}}@@ -1215,6 +1279,12 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {break;}+ // We must set this here because loadPage from render doesn't call if we aren't page splitting+ if (this.readerMode !== ReaderMode.Webtoon) {+ this.canvasImage = this.cachedImages.current();+ this.isLoading = true;+ }+this.updateForm();this.render();@@ -1298,14 +1368,16 @@ export class MangaReaderComponent implements OnInit, AfterViewInit, OnDestroy {const newRoute = this.readerService.getNextChapterUrl(this.router.url, this.chapterId, this.incognitoMode, this.readingListMode, this.readingListId);window.history.replaceState({}, '', newRoute);this.toastr.info('Incognito mode is off. Progress will now start being tracked.');- this.readerService.saveProgress(this.seriesId, this.volumeId, this.chapterId, this.pageNum).pipe(take(1)).subscribe(() => {/* No operation */});+ if (!this.bookmarkMode) {+ this.readerService.saveProgress(this.seriesId, this.volumeId, this.chapterId, this.pageNum).pipe(take(1)).subscribe(() => {/* No operation */});+ }}getWindowDimensions() {const windowWidth = window.innerWidth|| document.documentElement.clientWidth|| document.body.clientWidth;- const windowHeight = window.innerHeight+ const windowHeight = window.innerHeight|| document.documentElement.clientHeight|| document.body.clientHeight;return [windowWidth, windowHeight];diff --git a/UI/Web/src/app/metadata-filter/filter-settings.ts b/UI/Web/src/app/metadata-filter/filter-settings.tsindex 219e0eab5..28f7340e1 100644--- a/UI/Web/src/app/metadata-filter/filter-settings.ts+++ b/UI/Web/src/app/metadata-filter/filter-settings.ts@@ -13,9 +13,11 @@ export class FilterSettings {tagsDisabled = false;languageDisabled = false;publicationStatusDisabled = false;+ searchNameDisabled = false;presets: SeriesFilter | undefined;/*** Should the filter section be open by default+ * @deprecated This is deprecated UX pattern. New style is to show highlight on filter button.*/openByDefault = false;}\ No newline at end of filediff --git a/UI/Web/src/app/metadata-filter/metadata-filter.component.html b/UI/Web/src/app/metadata-filter/metadata-filter.component.htmlindex d13b87494..340524a60 100644--- a/UI/Web/src/app/metadata-filter/metadata-filter.component.html+++ b/UI/Web/src/app/metadata-filter/metadata-filter.component.html@@ -1,31 +1,31 @@-<div class="phone-hidden">- <div #collapse="ngbCollapse" [(ngbCollapse)]="filteringCollapsed">- <ng-container [ngTemplateOutlet]="filterSection"></ng-container>+<ng-container *ngIf="toggleService.toggleState$ | async as isOpen">+ <div class="phone-hidden">+ <div #collapse="ngbCollapse" [ngbCollapse]="!isOpen" (ngbCollapseChange)="setToggle($event)">+ <ng-container [ngTemplateOutlet]="filterSection"></ng-container>+ </div></div>-</div>-<div class="not-phone-hidden">- <app-drawer #commentDrawer="drawer" [isOpen]="!filteringCollapsed" [style.--drawer-width]="'300px'" [options]="{topOffset: 56}" (drawerClosed)="filteringCollapsed = !filteringCollapsed">- <div header>- <h2 style="margin-top: 0.5rem">Book Settings- <button type="button" class="btn-close" aria-label="Close" (click)="commentDrawer.close()"></button>- </h2>- </div>- <div body class="drawer-body">- <ng-container [ngTemplateOutlet]="filterSection"></ng-container>- </div>- </app-drawer>-</div>+ <div class="not-phone-hidden">+ <app-drawer #commentDrawer="drawer" [isOpen]="isOpen" [options]="{topOffset: 56}" (drawerClosed)="toggleService.set(false)">+ <h5 header>+ Filter+ </h5>+ <div body class="drawer-body">+ <ng-container [ngTemplateOutlet]="filterSection"></ng-container>+ </div>+ </app-drawer>+ </div>+</ng-container><ng-template #filterSection><ng-template #globalFilterTooltip>This is library agnostic</ng-template>- <div class="filter-section mx-auto pb-3">+ <div class="filter-section mx-auto pb-3" *ngIf="fullyLoaded"><div class="row justify-content-center g-0">- <div class="col-md-2 me-3" *ngIf="!filterSettings.formatDisabled">+ <div class="col-md-2 me-3"><div class="mb-3"><label for="format" class="form-label">Format</label> <i class="fa fa-info-circle" aria-hidden="true" placement="right" [ngbTooltip]="globalFilterTooltip" role="button" tabindex="0"></i><span class="visually-hidden" id="filter-global-format-help"><ng-container [ngTemplateOutlet]="globalFilterTooltip"></ng-container></span>- <app-typeahead (selectedData)="updateFormatFilters($event)" [settings]="formatSettings" [reset]="resetTypeaheads">+ <app-typeahead (selectedData)="updateFormatFilters($event)" [settings]="formatSettings" [reset]="resetTypeaheads" [disabled]="filterSettings.formatDisabled"><ng-template #badgeItem let-item let-position="idx">{{item.title}}</ng-template>@@ -36,10 +36,10 @@</div></div>- <div class="col-md-2 me-3"*ngIf="!filterSettings.libraryDisabled">+ <div class="col-md-2 me-3"><div class="mb-3"><label for="libraries" class="form-label">Libraries</label>- <app-typeahead (selectedData)="updateLibraryFilters($event)" [settings]="librarySettings" [reset]="resetTypeaheads">+ <app-typeahead (selectedData)="updateLibraryFilters($event)" [settings]="librarySettings" [reset]="resetTypeaheads" [disabled]="filterSettings.libraryDisabled"><ng-template #badgeItem let-item let-position="idx">{{item.name}}</ng-template>@@ -50,11 +50,11 @@</div></div>- <div class="col-md-2 me-3" *ngIf="!filterSettings.collectionDisabled">+ <div class="col-md-2 me-3"><div class="mb-3"><label for="collections" class="form-label">Collections</label> <i class="fa fa-info-circle" aria-hidden="true" placement="right" [ngbTooltip]="globalFilterTooltip" role="button" tabindex="0"></i><span class="visually-hidden" id="filter-global-collections-help"><ng-container [ngTemplateOutlet]="globalFilterTooltip"></ng-container></span>- <app-typeahead (selectedData)="updateCollectionFilters($event)" [settings]="collectionSettings" [reset]="resetTypeaheads">+ <app-typeahead (selectedData)="updateCollectionFilters($event)" [settings]="collectionSettings" [reset]="resetTypeaheads" [disabled]="filterSettings.collectionDisabled"><ng-template #badgeItem let-item let-position="idx">{{item.title}}</ng-template>@@ -65,10 +65,10 @@</div></div>- <div class="col-md-2 me-3" *ngIf="!filterSettings.genresDisabled">+ <div class="col-md-2 me-3"><div class="mb-3"><label for="genres" class="form-label">Genres</label>- <app-typeahead (selectedData)="updateGenreFilters($event)" [settings]="genreSettings" [reset]="resetTypeaheads">+ <app-typeahead (selectedData)="updateGenreFilters($event)" [settings]="genreSettings" [reset]="resetTypeaheads" [disabled]="filterSettings.genresDisabled"><ng-template #badgeItem let-item let-position="idx">{{item.title}}</ng-template>@@ -79,10 +79,10 @@</div></div>- <div class="col-md-2 me-3" *ngIf="!filterSettings.tagsDisabled">+ <div class="col-md-2 me-3"><div class="mb-3"><label for="tags" class="form-label">Tags</label>- <app-typeahead (selectedData)="updateTagFilters($event)" [settings]="tagsSettings" [reset]="resetTypeaheads">+ <app-typeahead (selectedData)="updateTagFilters($event)" [settings]="tagsSettings" [reset]="resetTypeaheads" [disabled]="filterSettings.tagsDisabled"><ng-template #badgeItem let-item let-position="idx">{{item.title}}</ng-template>@@ -95,10 +95,11 @@</div><div class="row justify-content-center g-0"><!-- The People row -->- <div class="col-md-2 me-3" *ngIf="peopleSettings.hasOwnProperty(PersonRole.CoverArtist)">+ <div class="col-md-2 me-3"><div class="mb-3"><label for="cover-artist" class="form-label">Cover Artists</label>- <app-typeahead (selectedData)="updatePersonFilters($event, PersonRole.CoverArtist)" [settings]="getPersonsSettings(PersonRole.CoverArtist)" [reset]="resetTypeaheads">+ <app-typeahead (selectedData)="updatePersonFilters($event, PersonRole.CoverArtist)" [settings]="getPersonsSettings(PersonRole.CoverArtist)"+ [reset]="resetTypeaheads" [disabled]="!peopleSettings.hasOwnProperty(PersonRole.CoverArtist)"><ng-template #badgeItem let-item let-position="idx">{{item.name}}</ng-template>@@ -109,10 +110,11 @@</div></div>- <div class="col-md-2 me-3" *ngIf="peopleSettings.hasOwnProperty(PersonRole.Writer)">+ <div class="col-md-2 me-3"><div class="mb-3"><label for="writers" class="form-label">Writers</label>- <app-typeahead (selectedData)="updatePersonFilters($event, PersonRole.Writer)" [settings]="getPersonsSettings(PersonRole.Writer)" [reset]="resetTypeaheads">+ <app-typeahead (selectedData)="updatePersonFilters($event, PersonRole.Writer)" [settings]="getPersonsSettings(PersonRole.Writer)"+ [reset]="resetTypeaheads" [disabled]="!peopleSettings.hasOwnProperty(PersonRole.Writer)"><ng-template #badgeItem let-item let-position="idx">{{item.name}}</ng-template>@@ -123,10 +125,11 @@</div></div>- <div class="col-md-2 me-3" *ngIf="peopleSettings.hasOwnProperty(PersonRole.Publisher)">+ <div class="col-md-2 me-3"><div class="mb-3"><label for="publisher" class="form-label">Publisher</label>- <app-typeahead (selectedData)="updatePersonFilters($event, PersonRole.Publisher)" [settings]="getPersonsSettings(PersonRole.Publisher)" [reset]="resetTypeaheads">+ <app-typeahead (selectedData)="updatePersonFilters($event, PersonRole.Publisher)" [settings]="getPersonsSettings(PersonRole.Publisher)"+ [reset]="resetTypeaheads" [disabled]="!peopleSettings.hasOwnProperty(PersonRole.Publisher)"><ng-template #badgeItem let-item let-position="idx">{{item.name}}</ng-template>@@ -137,10 +140,11 @@</div></div>- <div class="col-md-2 me-3" *ngIf="peopleSettings.hasOwnProperty(PersonRole.Penciller)">+ <div class="col-md-2 me-3"><div class="mb-3"><label for="penciller" class="form-label">Penciller</label>- <app-typeahead (selectedData)="updatePersonFilters($event, PersonRole.Penciller)" [settings]="getPersonsSettings(PersonRole.Penciller)" [reset]="resetTypeaheads">+ <app-typeahead (selectedData)="updatePersonFilters($event, PersonRole.Penciller)" [settings]="getPersonsSettings(PersonRole.Penciller)"+ [reset]="resetTypeaheads" [disabled]="!peopleSettings.hasOwnProperty(PersonRole.Penciller)"><ng-template #badgeItem let-item let-position="idx">{{item.name}}</ng-template>@@ -151,10 +155,11 @@</div></div>- <div class="col-md-2 me-3" *ngIf="peopleSettings.hasOwnProperty(PersonRole.Letterer)">+ <div class="col-md-2 me-3"><div class="mb-3"><label for="letterer" class="form-label">Letterer</label>- <app-typeahead (selectedData)="updatePersonFilters($event, PersonRole.Letterer)" [settings]="getPersonsSettings(PersonRole.Letterer)" [reset]="resetTypeaheads">+ <app-typeahead (selectedData)="updatePersonFilters($event, PersonRole.Letterer)" [settings]="getPersonsSettings(PersonRole.Letterer)"+ [reset]="resetTypeaheads" [disabled]="!peopleSettings.hasOwnProperty(PersonRole.Letterer)"><ng-template #badgeItem let-item let-position="idx">{{item.name}}</ng-template>@@ -165,10 +170,11 @@</div></div>- <div class="col-md-2 me-3" *ngIf="peopleSettings.hasOwnProperty(PersonRole.Inker)">+ <div class="col-md-2 me-3"><div class="mb-3"><label for="inker" class="form-label">Inker</label>- <app-typeahead (selectedData)="updatePersonFilters($event, PersonRole.Inker)" [settings]="getPersonsSettings(PersonRole.Inker)" [reset]="resetTypeaheads">+ <app-typeahead (selectedData)="updatePersonFilters($event, PersonRole.Inker)" [settings]="getPersonsSettings(PersonRole.Inker)"+ [reset]="resetTypeaheads" [disabled]="!peopleSettings.hasOwnProperty(PersonRole.Inker)"><ng-template #badgeItem let-item let-position="idx">{{item.name}}</ng-template>@@ -179,10 +185,11 @@</div></div>- <div class="col-md-2 me-3" *ngIf="peopleSettings.hasOwnProperty(PersonRole.Editor)">+ <div class="col-md-2 me-3"><div class="mb-3"><label for="editor" class="form-label">Editor</label>- <app-typeahead (selectedData)="updatePersonFilters($event, PersonRole.Editor)" [settings]="getPersonsSettings(PersonRole.Editor)" [reset]="resetTypeaheads">+ <app-typeahead (selectedData)="updatePersonFilters($event, PersonRole.Editor)" [settings]="getPersonsSettings(PersonRole.Editor)"+ [reset]="resetTypeaheads" [disabled]="!peopleSettings.hasOwnProperty(PersonRole.Editor)"><ng-template #badgeItem let-item let-position="idx">{{item.name}}</ng-template>@@ -193,10 +200,11 @@</div></div>- <div class="col-md-2 me-3" *ngIf="peopleSettings.hasOwnProperty(PersonRole.Colorist)">+ <div class="col-md-2 me-3"><div class="mb-3"><label for="colorist" class="form-label">Colorist</label>- <app-typeahead (selectedData)="updatePersonFilters($event, PersonRole.Colorist)" [settings]="getPersonsSettings(PersonRole.Colorist)" [reset]="resetTypeaheads">+ <app-typeahead (selectedData)="updatePersonFilters($event, PersonRole.Colorist)" [settings]="getPersonsSettings(PersonRole.Colorist)"+ [reset]="resetTypeaheads" [disabled]="!peopleSettings.hasOwnProperty(PersonRole.Colorist)"><ng-template #badgeItem let-item let-position="idx">{{item.name}}</ng-template>@@ -207,10 +215,11 @@</div></div>- <div class="col-md-2 me-3" *ngIf="peopleSettings.hasOwnProperty(PersonRole.Character)">+ <div class="col-md-2 me-3"><div class="mb-3"><label for="character" class="form-label">Character</label>- <app-typeahead (selectedData)="updatePersonFilters($event, PersonRole.Character)" [settings]="getPersonsSettings(PersonRole.Character)" [reset]="resetTypeaheads">+ <app-typeahead (selectedData)="updatePersonFilters($event, PersonRole.Character)" [settings]="getPersonsSettings(PersonRole.Character)"+ [reset]="resetTypeaheads" [disabled]="!peopleSettings.hasOwnProperty(PersonRole.Character)"><ng-template #badgeItem let-item let-position="idx">{{item.name}}</ng-template>@@ -221,10 +230,11 @@</div></div>- <div class="col-md-2 me-3" *ngIf="peopleSettings.hasOwnProperty(PersonRole.Translator)">+ <div class="col-md-2 me-3"><div class="mb-3"><label for="translators" class="form-label">Translators</label>- <app-typeahead (selectedData)="updatePersonFilters($event, PersonRole.Translator)" [settings]="getPersonsSettings(PersonRole.Translator)" [reset]="resetTypeaheads">+ <app-typeahead (selectedData)="updatePersonFilters($event, PersonRole.Translator)" [settings]="getPersonsSettings(PersonRole.Translator)"+ [reset]="resetTypeaheads" [disabled]="!peopleSettings.hasOwnProperty(PersonRole.Translator)"><ng-template #badgeItem let-item let-position="idx">{{item.name}}</ng-template>@@ -236,7 +246,7 @@</div></div><div class="row justify-content-center g-0">- <div class="col-md-2 me-3" *ngIf="!filterSettings.readProgressDisabled">+ <div class="col-md-2 me-3"><label class="form-label">Read Progress</label><form [formGroup]="readProgressGroup"><div class="form-check form-check-inline">@@ -254,7 +264,7 @@</form></div>- <div class="col-md-2 me-3" *ngIf="!filterSettings.ratingDisabled">+ <div class="col-md-2 me-3"><label for="ratings" class="form-label">Rating</label><form class="form-inline"><ngb-rating class="rating-star" [(rate)]="filter.rating" (rateChange)="updateRating($event)" [resettable]="true">@@ -265,9 +275,9 @@</form></div>- <div class="col-md-2 me-3" *ngIf="!filterSettings.ageRatingDisabled">+ <div class="col-md-2 me-3"><label for="age-rating" class="form-label">Age Rating</label>- <app-typeahead (selectedData)="updateAgeRating($event)" [settings]="ageRatingSettings" [reset]="resetTypeaheads">+ <app-typeahead (selectedData)="updateAgeRating($event)" [settings]="ageRatingSettings" [reset]="resetTypeaheads" [disabled]="filterSettings.ageRatingDisabled"><ng-template #badgeItem let-item let-position="idx">{{item.title}}</ng-template>@@ -277,9 +287,10 @@</app-typeahead></div>- <div class="col-md-2 me-3" *ngIf="!filterSettings.languageDisabled">+ <div class="col-md-2 me-3"><label for="languages" class="form-label">Language</label>- <app-typeahead (selectedData)="updateLanguageRating($event)" [settings]="languageSettings" [reset]="resetTypeaheads">+ <app-typeahead (selectedData)="updateLanguages($event)" [settings]="languageSettings"+ [reset]="resetTypeaheads" [disabled]="filterSettings.languageDisabled"><ng-template #badgeItem let-item let-position="idx">{{item.title}}</ng-template>@@ -289,9 +300,10 @@</app-typeahead></div>- <div class="col-md-2 me-3" *ngIf="!filterSettings.publicationStatusDisabled">+ <div class="col-md-2 me-3"><label for="publication-status" class="form-label">Publication Status</label>- <app-typeahead (selectedData)="updatePublicationStatus($event)" [settings]="publicationStatusSettings" [reset]="resetTypeaheads">+ <app-typeahead (selectedData)="updatePublicationStatus($event)" [settings]="publicationStatusSettings"+ [reset]="resetTypeaheads" [disabled]="filterSettings.publicationStatusDisabled"><ng-template #badgeItem let-item let-position="idx">{{item.title}}</ng-template>@@ -313,11 +325,11 @@</div></form></div>- <div class="col-md-2 me-3" *ngIf="!filterSettings.sortDisabled">+ <div class="col-md-2 me-3"><form [formGroup]="sortGroup"><div class="mb-3"><label for="sort-options" class="form-label">Sort By</label>- <button class="btn btn-sm btn-secondary-outline" (click)="updateSortOrder()" style="height: 25px; padding-bottom: 0px;">+ <button class="btn btn-sm btn-secondary-outline" (click)="updateSortOrder()" style="height: 25px; padding-bottom: 0px;" [disabled]="filterSettings.sortDisabled"><i class="fa fa-arrow-up" title="Ascending" *ngIf="isAscendingSort; else descSort"></i><ng-template #descSort><i class="fa fa-arrow-down" title="Descending"></i>@@ -327,11 +339,11 @@<option [value]="SortField.SortName">Sort Name</option><option [value]="SortField.Created">Created</option><option [value]="SortField.LastModified">Last Modified</option>+ <option [value]="SortField.LastChapterAdded">Item Added</option></select></div></form></div>- <div class="col-md-2 me-3" *ngIf="filterSettings.sortDisabled"></div><div class="col-md-2 me-3"></div><div class="col-md-2 me-3 mt-4"><button class="btn btn-secondary col-12" (click)="clear()">Clear</button>diff --git a/UI/Web/src/app/metadata-filter/metadata-filter.component.ts b/UI/Web/src/app/metadata-filter/metadata-filter.component.tsindex 478da4789..c52d5ea99 100644--- a/UI/Web/src/app/metadata-filter/metadata-filter.component.ts+++ b/UI/Web/src/app/metadata-filter/metadata-filter.component.ts@@ -2,7 +2,7 @@ import { Component, ContentChild, EventEmitter, Input, OnDestroy, OnInit, Outputimport { FormControl, FormGroup } from '@angular/forms';import { NgbCollapse } from '@ng-bootstrap/ng-bootstrap';import { distinctUntilChanged, forkJoin, map, Observable, of, ReplaySubject, Subject, takeUntil } from 'rxjs';-import { Breakpoint, UtilityService } from '../shared/_services/utility.service';+import { UtilityService } from '../shared/_services/utility.service';import { TypeaheadSettings } from '../typeahead/typeahead-settings';import { CollectionTag } from '../_models/collection-tag';import { Genre } from '../_models/genre';@@ -18,6 +18,7 @@ import { CollectionTagService } from '../_services/collection-tag.service';import { LibraryService } from '../_services/library.service';import { MetadataService } from '../_services/metadata.service';import { SeriesService } from '../_services/series.service';+import { ToggleService } from '../_services/toggle.service';import { FilterSettings } from './filter-settings';@Component({@@ -53,7 +54,7 @@ export class MetadataFilterComponent implements OnInit, OnDestroy {tagsSettings: TypeaheadSettings<Tag> = new TypeaheadSettings();languageSettings: TypeaheadSettings<Language> = new TypeaheadSettings();peopleSettings: {[PersonRole: string]: TypeaheadSettings<Person>} = {};- resetTypeaheads: Subject<boolean> = new ReplaySubject(1);+ resetTypeaheads: ReplaySubject<boolean> = new ReplaySubject(1);/*** Controls the visiblity of extended controls that sit below the main header.@@ -71,8 +72,10 @@ export class MetadataFilterComponent implements OnInit, OnDestroy {updateApplied: number = 0;+ fullyLoaded: boolean = false;- private onDestory: Subject<void> = new Subject();++ private onDestroy: Subject<void> = new Subject();get PersonRole(): typeof PersonRole {return PersonRole;@@ -83,24 +86,37 @@ export class MetadataFilterComponent implements OnInit, OnDestroy {}constructor(private libraryService: LibraryService, private metadataService: MetadataService, private seriesService: SeriesService,- private utilityService: UtilityService, private collectionTagService: CollectionTagService) {-+ private utilityService: UtilityService, private collectionTagService: CollectionTagService, public toggleService: ToggleService) {+ }++ ngOnInit(): void {+ if (this.filterSettings === undefined) {+ this.filterSettings = new FilterSettings();+ }++ if (this.filterOpen) {+ this.filterOpen.pipe(takeUntil(this.onDestroy)).subscribe(openState => {+ this.filteringCollapsed = !openState;+ this.toggleService.set(!this.filteringCollapsed);+ });+ }+this.filter = this.seriesService.createSeriesFilter();this.readProgressGroup = new FormGroup({- read: new FormControl(this.filter.readStatus.read, []),- notRead: new FormControl(this.filter.readStatus.notRead, []),- inProgress: new FormControl(this.filter.readStatus.inProgress, []),+ read: new FormControl({value: this.filter.readStatus.read, disabled: this.filterSettings.readProgressDisabled}, []),+ notRead: new FormControl({value: this.filter.readStatus.notRead, disabled: this.filterSettings.readProgressDisabled}, []),+ inProgress: new FormControl({value: this.filter.readStatus.inProgress, disabled: this.filterSettings.readProgressDisabled}, []),});this.sortGroup = new FormGroup({- sortField: new FormControl(this.filter.sortOptions?.sortField || SortField.SortName, []),+ sortField: new FormControl({value: this.filter.sortOptions?.sortField || SortField.SortName, disabled: this.filterSettings.sortDisabled}, []),});this.seriesNameGroup = new FormGroup({- seriesNameQuery: new FormControl(this.filter.seriesNameQuery || '', [])+ seriesNameQuery: new FormControl({value: this.filter.seriesNameQuery || '', disabled: this.filterSettings.searchNameDisabled}, [])});- this.readProgressGroup.valueChanges.pipe(takeUntil(this.onDestory)).subscribe(changes => {+ this.readProgressGroup.valueChanges.pipe(takeUntil(this.onDestroy)).subscribe(changes => {this.filter.readStatus.read = this.readProgressGroup.get('read')?.value;this.filter.readStatus.inProgress = this.readProgressGroup.get('inProgress')?.value;this.filter.readStatus.notRead = this.readProgressGroup.get('notRead')?.value;@@ -121,7 +137,7 @@ export class MetadataFilterComponent implements OnInit, OnDestroy {}});- this.sortGroup.valueChanges.pipe(takeUntil(this.onDestory)).subscribe(changes => {+ this.sortGroup.valueChanges.pipe(takeUntil(this.onDestroy)).subscribe(changes => {if (this.filter.sortOptions == null) {this.filter.sortOptions = {isAscending: this.isAscendingSort,@@ -134,41 +150,53 @@ export class MetadataFilterComponent implements OnInit, OnDestroy {this.seriesNameGroup.get('seriesNameQuery')?.valueChanges.pipe(map(val => (val || '').trim()),distinctUntilChanged(),- takeUntil(this.onDestory)).subscribe(changes => {+ takeUntil(this.onDestroy))+ .subscribe(changes => {this.filter.seriesNameQuery = changes;});- }- ngOnInit(): void {- if (this.filterSettings === undefined) {- this.filterSettings = new FilterSettings();- }-- if (this.filterOpen) {- this.filterOpen.pipe(takeUntil(this.onDestory)).subscribe(openState => {- this.filteringCollapsed = !openState;- });- }-- if (this.filterSettings.presets) {- this.readProgressGroup.get('read')?.patchValue(this.filterSettings.presets?.readStatus.read);- this.readProgressGroup.get('notRead')?.patchValue(this.filterSettings.presets?.readStatus.notRead);- this.readProgressGroup.get('inProgress')?.patchValue(this.filterSettings.presets?.readStatus.inProgress);- }+ this.loadFromPresetsAndSetup();+ }- this.setupTypeaheads();+ close() {+ this.filterOpen.emit(false);+ this.filteringCollapsed = true;+ this.toggleService.set(!this.filteringCollapsed);}ngOnDestroy() {- this.onDestory.next();- this.onDestory.complete();+ this.onDestroy.next();+ this.onDestroy.complete();}getPersonsSettings(role: PersonRole) {return this.peopleSettings[role];}- setupTypeaheads() {+ loadFromPresetsAndSetup() {+ this.fullyLoaded = false;+ if (this.filterSettings.presets) {+ this.readProgressGroup.get('read')?.patchValue(this.filterSettings.presets.readStatus.read);+ this.readProgressGroup.get('notRead')?.patchValue(this.filterSettings.presets.readStatus.notRead);+ this.readProgressGroup.get('inProgress')?.patchValue(this.filterSettings.presets.readStatus.inProgress);++ if (this.filterSettings.presets.sortOptions) {+ this.sortGroup.get('sortField')?.setValue(this.filterSettings.presets.sortOptions.sortField);+ this.isAscendingSort = this.filterSettings.presets.sortOptions.isAscending;+ if (this.filter.sortOptions) {+ this.filter.sortOptions.isAscending = this.isAscendingSort;+ this.filter.sortOptions.sortField = this.filterSettings.presets.sortOptions.sortField;+ }+ }++ if (this.filterSettings.presets.rating > 0) {+ this.updateRating(this.filterSettings.presets.rating);+ }++ if (this.filterSettings.presets.seriesNameQuery !== '') {+ this.seriesNameGroup.get('searchNameQuery')?.setValue(this.filterSettings.presets.seriesNameQuery);+ }+ }this.setupFormatTypeahead();@@ -182,9 +210,11 @@ export class MetadataFilterComponent implements OnInit, OnDestroy {this.setupGenreTypeahead(),this.setupPersonTypeahead(),]).subscribe(results => {- this.resetTypeaheads.next(true);+ this.fullyLoaded = true;+ this.resetTypeaheads.next(false); // Pass false to ensure we reset to the preset and not to an empty typeaheadif (this.filterSettings.openByDefault) {this.filteringCollapsed = false;+ this.toggleService.set(!this.filteringCollapsed);}this.apply();});@@ -207,8 +237,7 @@ export class MetadataFilterComponent implements OnInit, OnDestroy {if (this.filterSettings.presets?.formats && this.filterSettings.presets?.formats.length > 0) {this.formatSettings.savedData = mangaFormatFilters.filter(item => this.filterSettings.presets?.formats.includes(item.value));- this.filter.formats = this.formatSettings.savedData.map(item => item.value);- this.resetTypeaheads.next(true);+ this.updateFormatFilters(this.formatSettings.savedData);}}@@ -232,7 +261,7 @@ export class MetadataFilterComponent implements OnInit, OnDestroy {if (this.filterSettings.presets?.libraries && this.filterSettings.presets?.libraries.length > 0) {return this.librarySettings.fetchFn('').pipe(map(libraries => {this.librarySettings.savedData = libraries.filter(item => this.filterSettings.presets?.libraries.includes(item.id));- this.filter.libraries = this.librarySettings.savedData.map(item => item.id);+ this.updateLibraryFilters(this.librarySettings.savedData);return of(true);}));}@@ -259,7 +288,7 @@ export class MetadataFilterComponent implements OnInit, OnDestroy {if (this.filterSettings.presets?.genres && this.filterSettings.presets?.genres.length > 0) {return this.genreSettings.fetchFn('').pipe(map(genres => {this.genreSettings.savedData = genres.filter(item => this.filterSettings.presets?.genres.includes(item.id));- this.filter.genres = this.genreSettings.savedData.map(item => item.id);+ this.updateGenreFilters(this.genreSettings.savedData);return of(true);}));}@@ -286,7 +315,7 @@ export class MetadataFilterComponent implements OnInit, OnDestroy {if (this.filterSettings.presets?.ageRating && this.filterSettings.presets?.ageRating.length > 0) {return this.ageRatingSettings.fetchFn('').pipe(map(rating => {this.ageRatingSettings.savedData = rating.filter(item => this.filterSettings.presets?.ageRating.includes(item.value));- this.filter.ageRating = this.ageRatingSettings.savedData.map(item => item.value);+ this.updateAgeRating(this.ageRatingSettings.savedData);return of(true);}));}@@ -313,7 +342,7 @@ export class MetadataFilterComponent implements OnInit, OnDestroy {if (this.filterSettings.presets?.publicationStatus && this.filterSettings.presets?.publicationStatus.length > 0) {return this.publicationStatusSettings.fetchFn('').pipe(map(statuses => {this.publicationStatusSettings.savedData = statuses.filter(item => this.filterSettings.presets?.publicationStatus.includes(item.value));- this.filter.publicationStatus = this.publicationStatusSettings.savedData.map(item => item.value);+ this.updatePublicationStatus(this.publicationStatusSettings.savedData);return of(true);}));}@@ -339,7 +368,7 @@ export class MetadataFilterComponent implements OnInit, OnDestroy {if (this.filterSettings.presets?.tags && this.filterSettings.presets?.tags.length > 0) {return this.tagsSettings.fetchFn('').pipe(map(tags => {this.tagsSettings.savedData = tags.filter(item => this.filterSettings.presets?.tags.includes(item.id));- this.filter.tags = this.tagsSettings.savedData.map(item => item.id);+ this.updateTagFilters(this.tagsSettings.savedData);return of(true);}));}@@ -365,7 +394,7 @@ export class MetadataFilterComponent implements OnInit, OnDestroy {if (this.filterSettings.presets?.languages && this.filterSettings.presets?.languages.length > 0) {return this.languageSettings.fetchFn('').pipe(map(languages => {this.languageSettings.savedData = languages.filter(item => this.filterSettings.presets?.languages.includes(item.isoCode));- this.filter.languages = this.languageSettings.savedData.map(item => item.isoCode);+ this.updateLanguages(this.languageSettings.savedData);return of(true);}));}@@ -391,7 +420,7 @@ export class MetadataFilterComponent implements OnInit, OnDestroy {if (this.filterSettings.presets?.collectionTags && this.filterSettings.presets?.collectionTags.length > 0) {return this.collectionSettings.fetchFn('').pipe(map(tags => {this.collectionSettings.savedData = tags.filter(item => this.filterSettings.presets?.collectionTags.includes(item.id));- this.filter.collectionTags = this.collectionSettings.savedData.map(item => item.id);+ this.updateCollectionFilters(this.collectionSettings.savedData);return of(true);}));}@@ -404,16 +433,15 @@ export class MetadataFilterComponent implements OnInit, OnDestroy {const fetch = personSettings.fetchFn as ((filter: string) => Observable<Person[]>);return fetch('').pipe(map(people => {personSettings.savedData = people.filter(item => presetField.includes(item.id));- peopleFilterField = personSettings.savedData.map(item => item.id);- this.resetTypeaheads.next(true);this.peopleSettings[role] = personSettings;- this.updatePersonFilters(personSettings.savedData as Person[], role);+ this.updatePersonFilters(personSettings.savedData, role);return true;}));- } else {- this.peopleSettings[role] = personSettings;- return of(true);}++ this.peopleSettings[role] = personSettings;+ return of(true);+}setupPersonTypeahead() {@@ -430,8 +458,7 @@ export class MetadataFilterComponent implements OnInit, OnDestroy {this.updateFromPreset('penciller', this.filter.penciller, this.filterSettings.presets?.penciller, PersonRole.Penciller),this.updateFromPreset('publisher', this.filter.publisher, this.filterSettings.presets?.publisher, PersonRole.Publisher),this.updateFromPreset('translators', this.filter.translators, this.filterSettings.presets?.translators, PersonRole.Translator)- ]).pipe(map(results => {- this.resetTypeaheads.next(true);+ ]).pipe(map(_ => {return of(true);}));}@@ -518,6 +545,7 @@ export class MetadataFilterComponent implements OnInit, OnDestroy {}updateRating(rating: any) {+ if (this.filterSettings.ratingDisabled) return;this.filter.rating = rating;}@@ -529,7 +557,7 @@ export class MetadataFilterComponent implements OnInit, OnDestroy {this.filter.publicationStatus = dtos.map(item => item.value) || [];}- updateLanguageRating(languages: Language[]) {+ updateLanguages(languages: Language[]) {this.filter.languages = languages.map(item => item.isoCode) || [];}@@ -544,6 +572,7 @@ export class MetadataFilterComponent implements OnInit, OnDestroy {}updateSortOrder() {+ if (this.filterSettings.sortDisabled) return;this.isAscendingSort = !this.isAscendingSort;if (this.filter.sortOptions === null) {this.filter.sortOptions = {@@ -563,7 +592,7 @@ export class MetadataFilterComponent implements OnInit, OnDestroy {this.sortGroup.get('sortField')?.setValue(SortField.SortName);this.isAscendingSort = true;// Apply any presets which will trigger the apply- this.setupTypeaheads();+ this.loadFromPresetsAndSetup();}apply() {@@ -571,4 +600,12 @@ export class MetadataFilterComponent implements OnInit, OnDestroy {this.updateApplied++;}+ toggleSelected() {+ this.toggleService.toggle();+ }++ setToggle(event: any) {+ this.toggleService.set(!this.filteringCollapsed);+ }+}diff --git a/UI/Web/src/app/nav-header/nav-header.component.html b/UI/Web/src/app/nav-header/nav-header.component.htmldeleted file mode 100644index d61e6bc60..000000000--- a/UI/Web/src/app/nav-header/nav-header.component.html+++ /dev/null@@ -1,145 +0,0 @@-<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="/library" routerLinkActive="active"><img class="logo" src="../../assets/images/logo.png" alt="kavita icon" aria-hidden="true"/><span class="d-none d-md-inline"> 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)">- <div class="ms-1">- <span>{{item.name}}</span>- </div>- </div>- </ng-template>-- <ng-template #seriesTemplate let-item>- <div style="display: flex;padding: 5px;" (click)="clickSeriesSearchResult(item)">- <div style="width: 24px" class="me-1">- <app-image class="me-3 search-result" width="24px" [imageUrl]="imageService.getSeriesCoverImage(item.seriesId)"></app-image>- </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>- <div class="form-text" style="font-size: 0.8rem;">in {{item.libraryName}}</div>- </div>- </div>- </ng-template>-- <ng-template #collectionTemplate let-item>- <div style="display: flex;padding: 5px;" (click)="clickCollectionSearchResult(item)">- <div style="width: 24px" class="me-1">- <app-image class="me-3 search-result" width="24px" [imageUrl]="imageService.getCollectionCoverImage(item.id)"></app-image>- </div>- <div class="ms-1">- <span>{{item.title}}</span>- <span *ngIf="item.promoted">- <i class="fa fa-angle-double-up" aria-hidden="true" title="Promoted"></i>- <span class="visually-hidden">(promoted)</span>- </span>- </div>- </div>- </ng-template>-- <ng-template #readingListTemplate let-item>- <div style="display: flex;padding: 5px;" (click)="clickReadingListSearchResult(item)">- <div class="ms-1">- <span>{{item.title}}</span>- <span *ngIf="item.promoted">- <i class="fa fa-angle-double-up" aria-hidden="true" title="Promoted"></i>- <span class="visually-hidden">(promoted)</span>- </span>- </div>- </div>- </ng-template>-- <ng-template #tagTemplate let-item>- <div style="display: flex;padding: 5px;" (click)="goTo('tags', item.id)">- <div class="ms-1">- <span>{{item.title}}</span>- </div>- </div>- </ng-template>-- <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>{{item.role | personRole}}</div>- </div>- </div>- </ng-template>-- <ng-template #genreTemplate let-item>- <div style="display: flex;padding: 5px;" class="clickable" (click)="goTo('genres', item.id)">- <div class="ms-1">- <div [innerHTML]="item.title"></div>- </div>- </div>- </ng-template>-- <ng-template #noResultsTemplate let-notFound>- No results found- </ng-template>-- </app-grouped-typeahead>- </div>- </div>- </ul>-- <ng-container *ngIf="!searchFocused">- <div class="back-to-top">- <button class="btn btn-icon scroll-to-top" (click)="scrollToTop()" *ngIf="backToTopNeeded">- <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>--- <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="noreferrer" target="_blank">Help</a>- <a ngbDropdownItem routerLink="/announcements/" *ngIf="accountService.hasAdminRole(user)">Annoucements</a>- <a ngbDropdownItem (click)="logout()">Logout</a>- </div>- </div>- </ng-container>- </ng-container>- </div>-</nav>-\ No newline at end of filediff --git a/UI/Web/src/app/events-widget/events-widget.component.html b/UI/Web/src/app/nav/events-widget/events-widget.component.htmlsimilarity index 98%rename from UI/Web/src/app/events-widget/events-widget.component.htmlrename to UI/Web/src/app/nav/events-widget/events-widget.component.htmlindex 119b5c32f..447b9a3e9 100644--- a/UI/Web/src/app/events-widget/events-widget.component.html+++ b/UI/Web/src/app/nav/events-widget/events-widget.component.html@@ -48,7 +48,7 @@<ng-container *ngFor="let message of progressUpdates"><li class="list-group-item dark-menu-item" *ngIf="message.progress === 'indeterminate' || message.progress === 'none'; else progressEvent"><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="progress" style="height: 5px;" *ngIf="message.progress === 'indeterminate'"><div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" style="width: 100%" [attr.aria-valuenow]="100" aria-valuemin="0" aria-valuemax="100"></div>diff --git a/UI/Web/src/app/events-widget/events-widget.component.scss b/UI/Web/src/app/nav/events-widget/events-widget.component.scsssimilarity index 96%rename from UI/Web/src/app/events-widget/events-widget.component.scssrename to UI/Web/src/app/nav/events-widget/events-widget.component.scssindex 6a2070e78..7f9534400 100644--- a/UI/Web/src/app/events-widget/events-widget.component.scss+++ b/UI/Web/src/app/nav/events-widget/events-widget.component.scss@@ -21,6 +21,8 @@max-width: 250px;padding: 0px;box-shadow: 0px 0px 12px rgb(0 0 0 / 75%);+ max-height: calc(100vh - 60px);+ overflow-y: auto;}.popover {diff --git a/UI/Web/src/app/events-widget/events-widget.component.ts b/UI/Web/src/app/nav/events-widget/events-widget.component.tssimilarity index 76%rename from UI/Web/src/app/events-widget/events-widget.component.tsrename to UI/Web/src/app/nav/events-widget/events-widget.component.tsindex e93418ffd..7261e397b 100644--- a/UI/Web/src/app/events-widget/events-widget.component.ts+++ b/UI/Web/src/app/nav/events-widget/events-widget.component.ts@@ -2,16 +2,15 @@ import { Component, Input, OnDestroy, OnInit } from '@angular/core';import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';import { BehaviorSubject, Subject } from 'rxjs';import { takeUntil } from 'rxjs/operators';-import { UpdateNotificationModalComponent } from '../shared/update-notification/update-notification-modal.component';-import { NotificationProgressEvent } from '../_models/events/notification-progress-event';-import { UpdateVersionEvent } from '../_models/events/update-version-event';-import { User } from '../_models/user';-import { AccountService } from '../_services/account.service';-import { EVENTS, Message, MessageHubService } from '../_services/message-hub.service';-import { ErrorEvent } from '../_models/events/error-event';-import { ConfirmService } from '../shared/confirm.service';-import { ConfirmConfig } from '../shared/confirm-dialog/_models/confirm-config';-import { ServerService } from '../_services/server.service';+import { ConfirmConfig } from 'src/app/shared/confirm-dialog/_models/confirm-config';+import { ConfirmService } from 'src/app/shared/confirm.service';+import { UpdateNotificationModalComponent } from 'src/app/shared/update-notification/update-notification-modal.component';+import { ErrorEvent } from 'src/app/_models/events/error-event';+import { NotificationProgressEvent } from 'src/app/_models/events/notification-progress-event';+import { UpdateVersionEvent } from 'src/app/_models/events/update-version-event';+import { User } from 'src/app/_models/user';+import { AccountService } from 'src/app/_services/account.service';+import { EVENTS, Message, MessageHubService } from 'src/app/_services/message-hub.service';@Component({selector: 'app-nav-events-toggle',@@ -83,7 +82,7 @@ export class EventsWidgetComponent implements OnInit, OnDestroy {processNotificationProgressEvent(event: Message<NotificationProgressEvent>) {const message = event.payload as NotificationProgressEvent;let data;-+ let index = -1;switch (event.payload.eventType) {case 'single':const values = this.singleUpdateSource.getValue();@@ -92,20 +91,12 @@ export class EventsWidgetComponent implements OnInit, OnDestroy {this.activeEvents += 1;break;case 'started':- data = this.progressEventsSource.getValue();- data.push(message);+ // Sometimes we can receive 2 started on long running scans, so better to just treat as a merge then.+ data = this.mergeOrUpdate(this.progressEventsSource.getValue(), message);this.progressEventsSource.next(data);- this.activeEvents += 1;break;case 'updated':- data = this.progressEventsSource.getValue();- const index = data.findIndex(m => m.name === message.name);- if (index < 0) {- data.push(message);- this.activeEvents += 1;- } else {- data[index] = message;- }+ data = this.mergeOrUpdate(this.progressEventsSource.getValue(), message);this.progressEventsSource.next(data);break;case 'ended':@@ -119,6 +110,18 @@ export class EventsWidgetComponent implements OnInit, OnDestroy {}}+ private mergeOrUpdate(data: NotificationProgressEvent[], message: NotificationProgressEvent) {+ const index = data.findIndex(m => m.name === message.name);+ // Sometimes we can receive 2 started on long running scans, so better to just treat as a merge then.+ if (index < 0) {+ data.push(message);+ this.activeEvents += 1;+ } else {+ data[index] = message;+ }+ return data;+ }+handleUpdateAvailableClick(message: NotificationProgressEvent) {if (this.updateNotificationModalRef != null) { return; }diff --git a/UI/Web/src/app/grouped-typeahead/grouped-typeahead.component.html b/UI/Web/src/app/nav/grouped-typeahead/grouped-typeahead.component.htmlsimilarity index 81%rename from UI/Web/src/app/grouped-typeahead/grouped-typeahead.component.htmlrename to UI/Web/src/app/nav/grouped-typeahead/grouped-typeahead.component.htmlindex 30ec66ce2..5944a5ced 100644--- a/UI/Web/src/app/grouped-typeahead/grouped-typeahead.component.html+++ b/UI/Web/src/app/nav/grouped-typeahead/grouped-typeahead.component.html@@ -85,8 +85,27 @@</ul></ng-container>- <ng-container *ngIf="noResultsTemplate != undefined && searchTerm.length > 0 && !grouppedData.persons.length && !grouppedData.collections.length- && !grouppedData.series.length && !grouppedData.persons.length && !grouppedData.tags.length && !grouppedData.genres.length && !grouppedData.libraries.length">+ <ng-container *ngIf="chapterTemplate !== undefined && grouppedData.chapters.length > 0">+ <li class="list-group-item section-header"><h5>Chapters</h5></li>+ <ul class="list-group results">+ <li *ngFor="let option of grouppedData.chapters; let index = index;" (click)="handleResultlick(option)" tabindex="0"+ class="list-group-item" role="option">+ <ng-container [ngTemplateOutlet]="chapterTemplate" [ngTemplateOutletContext]="{ $implicit: option, idx: index }"></ng-container>+ </li>+ </ul>+ </ng-container>++ <ng-container *ngIf="fileTemplate !== undefined && grouppedData.files.length > 0">+ <li class="list-group-item section-header"><h5>Files</h5></li>+ <ul class="list-group results">+ <li *ngFor="let option of grouppedData.files; let index = index;" (click)="handleResultlick(option)" tabindex="0"+ class="list-group-item" role="option">+ <ng-container [ngTemplateOutlet]="fileTemplate" [ngTemplateOutletContext]="{ $implicit: option, idx: index }"></ng-container>+ </li>+ </ul>+ </ng-container>++ <ng-container *ngIf="!hasData && searchTerm.length > 0"><ul class="list-group results"><li class="list-group-item"><ng-container [ngTemplateOutlet]="noResultsTemplate"></ng-container>diff --git a/UI/Web/src/app/grouped-typeahead/grouped-typeahead.component.scss b/UI/Web/src/app/nav/grouped-typeahead/grouped-typeahead.component.scsssimilarity index 99%rename from UI/Web/src/app/grouped-typeahead/grouped-typeahead.component.scssrename to UI/Web/src/app/nav/grouped-typeahead/grouped-typeahead.component.scssindex fbbf72206..684f24954 100644--- a/UI/Web/src/app/grouped-typeahead/grouped-typeahead.component.scss+++ b/UI/Web/src/app/nav/grouped-typeahead/grouped-typeahead.component.scss@@ -68,7 +68,7 @@ form {}&.focused {- width: 100%;+ width: 99%;border-color: var(--input-focused-border-color);}diff --git a/UI/Web/src/app/grouped-typeahead/grouped-typeahead.component.ts b/UI/Web/src/app/nav/grouped-typeahead/grouped-typeahead.component.tssimilarity index 82%rename from UI/Web/src/app/grouped-typeahead/grouped-typeahead.component.tsrename to UI/Web/src/app/nav/grouped-typeahead/grouped-typeahead.component.tsindex 7110e8d02..90d07f555 100644--- a/UI/Web/src/app/grouped-typeahead/grouped-typeahead.component.ts+++ b/UI/Web/src/app/nav/grouped-typeahead/grouped-typeahead.component.ts@@ -1,10 +1,9 @@-import { DOCUMENT } from '@angular/common';-import { Component, ContentChild, ElementRef, EventEmitter, HostListener, Inject, Input, OnDestroy, OnInit, Output, Renderer2, TemplateRef, ViewChild } from '@angular/core';+import { Component, ContentChild, ElementRef, EventEmitter, HostListener, Input, OnDestroy, OnInit, Output, TemplateRef, ViewChild } from '@angular/core';import { FormControl, FormGroup } from '@angular/forms';-import { BehaviorSubject, Subject } from 'rxjs';+import { Subject } from 'rxjs';import { debounceTime, takeUntil } from 'rxjs/operators';-import { KEY_CODES } from '../shared/_services/utility.service';-import { SearchResultGroup } from '../_models/search/search-result-group';+import { KEY_CODES } from '../../shared/_services/utility.service';+import { SearchResultGroup } from '../../_models/search/search-result-group';@Component({selector: 'app-grouped-typeahead',@@ -60,6 +59,8 @@ export class GroupedTypeaheadComponent implements OnInit, OnDestroy {@ContentChild('noResultsTemplate') noResultsTemplate!: TemplateRef<any>;@ContentChild('libraryTemplate') libraryTemplate!: TemplateRef<any>;@ContentChild('readingListTemplate') readingListTemplate!: TemplateRef<any>;+ @ContentChild('fileTemplate') fileTemplate!: TemplateRef<any>;+ @ContentChild('chapterTemplate') chapterTemplate!: TemplateRef<any>;hasFocus: boolean = false;@@ -75,7 +76,11 @@ export class GroupedTypeaheadComponent implements OnInit, OnDestroy {}get hasData() {- return this.grouppedData.persons.length || this.grouppedData.collections.length || this.grouppedData.series.length || this.grouppedData.persons.length || this.grouppedData.tags.length || this.grouppedData.genres.length;+ return !(this.noResultsTemplate != undefined && !this.grouppedData.persons.length && !this.grouppedData.collections.length+ && !this.grouppedData.series.length && !this.grouppedData.persons.length && !this.grouppedData.tags.length && !this.grouppedData.genres.length && !this.grouppedData.libraries.length+ && !this.grouppedData.files.length && !this.grouppedData.chapters.length);++ //return this.grouppedData.persons.length || this.grouppedData.collections.length || this.grouppedData.series.length || this.grouppedData.persons.length || this.grouppedData.tags.length || this.grouppedData.genres.length;}diff --git a/UI/Web/src/app/nav/nav-header/nav-header.component.html b/UI/Web/src/app/nav/nav-header/nav-header.component.htmlnew file mode 100644index 000000000..8ecae4267--- /dev/null+++ b/UI/Web/src/app/nav/nav-header/nav-header.component.html@@ -0,0 +1,167 @@+<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"><img class="logo" src="../../assets/images/logo.png" alt="kavita icon" aria-hidden="true"/><span class="d-none d-md-inline"> 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)">+ <div class="ms-1">+ <span>{{item.name}}</span>+ </div>+ </div>+ </ng-template>++ <ng-template #seriesTemplate let-item>+ <div style="display: flex;padding: 5px;" (click)="clickSeriesSearchResult(item)">+ <div style="width: 24px" class="me-1">+ <app-image class="me-3 search-result" width="24px" [imageUrl]="imageService.getSeriesCoverImage(item.seriesId)"></app-image>+ </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>+ <div class="text-light fst-italic" style="font-size: 0.8rem;">in {{item.libraryName}}</div>+ </div>+ </div>+ </ng-template>++ <ng-template #collectionTemplate let-item>+ <div style="display: flex;padding: 5px;" (click)="clickCollectionSearchResult(item)">+ <div style="width: 24px" class="me-1">+ <app-image class="me-3 search-result" width="24px" [imageUrl]="imageService.getCollectionCoverImage(item.id)"></app-image>+ </div>+ <div class="ms-1">+ <span>{{item.title}}</span>+ <span *ngIf="item.promoted">+ <i class="fa fa-angle-double-up" aria-hidden="true" title="Promoted"></i>+ <span class="visually-hidden">(promoted)</span>+ </span>+ </div>+ </div>+ </ng-template>++ <ng-template #readingListTemplate let-item>+ <div style="display: flex;padding: 5px;" (click)="clickReadingListSearchResult(item)">+ <div class="ms-1">+ <span>{{item.title}}</span>+ <span *ngIf="item.promoted">+ <i class="fa fa-angle-double-up" aria-hidden="true" title="Promoted"></i>+ <span class="visually-hidden">(promoted)</span>+ </span>+ </div>+ </div>+ </ng-template>++ <ng-template #tagTemplate let-item>+ <div style="display: flex;padding: 5px;" (click)="goTo('tags', item.id)">+ <div class="ms-1">+ <span>{{item.title}}</span>+ </div>+ </div>+ </ng-template>++ <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>+ </div>+ </ng-template>++ <ng-template #genreTemplate let-item>+ <div style="display: flex;padding: 5px;" class="clickable" (click)="goTo('genres', item.id)">+ <div class="ms-1">+ <div [innerHTML]="item.title"></div>+ </div>+ </div>+ </ng-template>++++ <ng-template #chapterTemplate let-item>+ <div style="display: flex;padding: 5px;" class="clickable" (click)="clickChapterSearchResult(item)">+ <div class="ms-1">+ <ng-container *ngIf="item.files.length > 0">+ <app-series-format [format]="item.files[0].format"></app-series-format>+ </ng-container>+ <span>{{item.titleName}}</span>+ </div>+ </div>+ </ng-template>++ <ng-template #fileTemplate let-item>+ <div style="display: flex;padding: 5px;" (click)="clickFileSearchResult(item)">+ <div class="ms-1">+ <app-series-format [format]="item.format"></app-series-format>+ <span>{{item.filePath}}</span>+ </div>+ </div>+ </ng-template>++ <ng-template #noResultsTemplate let-notFound>+ No results found+ </ng-template>++ </app-grouped-typeahead>+ </div>+ </div>+ </ul>++ <ng-container *ngIf="!searchFocused">+ <div class="back-to-top">+ <button class="btn btn-icon scroll-to-top" (click)="scrollToTop()" *ngIf="backToTopNeeded">+ <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>+++ <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)">Annoucements</a>+ <a ngbDropdownItem (click)="logout()">Logout</a>+ </div>+ </div>+ </ng-container>+ </ng-container>+ </div>+</nav>+\ No newline at end of filediff --git a/UI/Web/src/app/nav-header/nav-header.component.scss b/UI/Web/src/app/nav/nav-header/nav-header.component.scsssimilarity index 95%rename from UI/Web/src/app/nav-header/nav-header.component.scssrename to UI/Web/src/app/nav/nav-header/nav-header.component.scssindex 1dc707375..e2d8bd38c 100644--- a/UI/Web/src/app/nav-header/nav-header.component.scss+++ b/UI/Web/src/app/nav/nav-header/nav-header.component.scss@@ -85,3 +85,7 @@.scroll-to-top:hover {animation: MoveUpDown 1s linear infinite;}++.text-light {+ color: var(--search-result-text-lite-color) !important;+}diff --git a/UI/Web/src/app/nav-header/nav-header.component.ts b/UI/Web/src/app/nav/nav-header/nav-header.component.tssimilarity index 63%rename from UI/Web/src/app/nav-header/nav-header.component.tsrename to UI/Web/src/app/nav/nav-header/nav-header.component.tsindex 983b393e0..6d8f35b7e 100644--- a/UI/Web/src/app/nav-header/nav-header.component.ts+++ b/UI/Web/src/app/nav/nav-header/nav-header.component.ts@@ -3,17 +3,21 @@ import { Component, HostListener, Inject, OnDestroy, OnInit, ViewChild } from '@import { Router } from '@angular/router';import { Subject } from 'rxjs';import { takeUntil } from 'rxjs/operators';-import { ScrollService } from '../scroll.service';-import { CollectionTag } from '../_models/collection-tag';-import { Library } from '../_models/library';-import { PersonRole } from '../_models/person';-import { ReadingList } from '../_models/reading-list';-import { SearchResult } from '../_models/search-result';-import { SearchResultGroup } from '../_models/search/search-result-group';-import { AccountService } from '../_services/account.service';-import { ImageService } from '../_services/image.service';-import { LibraryService } from '../_services/library.service';-import { NavService } from '../_services/nav.service';+import { Chapter } from 'src/app/_models/chapter';+import { MangaFile } from 'src/app/_models/manga-file';+import { ScrollService } from 'src/app/_services/scroll.service';+import { SeriesService } from 'src/app/_services/series.service';+import { FilterQueryParam } from '../../shared/_services/filter-utilities.service';+import { CollectionTag } from '../../_models/collection-tag';+import { Library } from '../../_models/library';+import { PersonRole } from '../../_models/person';+import { ReadingList } from '../../_models/reading-list';+import { SearchResult } from '../../_models/search-result';+import { SearchResultGroup } from '../../_models/search/search-result-group';+import { AccountService } from '../../_services/account.service';+import { ImageService } from '../../_services/image.service';+import { LibraryService } from '../../_services/library.service';+import { NavService } from '../../_services/nav.service';@Component({selector: 'app-nav-header',@@ -45,23 +49,13 @@ export class NavHeaderComponent implements OnInit, OnDestroy {searchFocused: boolean = false;private readonly onDestroy = new Subject<void>();- constructor(public accountService: AccountService, private router: Router, public navService: NavService,- private libraryService: LibraryService, public imageService: ImageService, @Inject(DOCUMENT) private document: Document,- private scrollService: ScrollService) { }+ constructor(public accountService: AccountService, private router: Router, public navService: NavService,+ private libraryService: LibraryService, public imageService: ImageService, @Inject(DOCUMENT) private document: Document,+ private scrollService: ScrollService, private seriesService: SeriesService) { }- ngOnInit(): void {- // this.navService.darkMode$.pipe(takeUntil(this.onDestroy)).subscribe(res => {- // if (res) {- // this.document.body.classList.remove('bg-light');- // this.document.body.classList.add('bg-dark');- // } else {- // this.document.body.classList.remove('bg-dark');- // this.document.body.classList.add('bg-light');- // }- // });- }+ ngOnInit(): void {}- @HostListener("window:scroll", [])+ @HostListener('body:scroll', [])checkBackToTopNeeded() {const offset = this.scrollService.scrollPosition;if (offset > 100) {@@ -87,7 +81,7 @@ export class NavHeaderComponent implements OnInit, OnDestroy {this.document.getElementById('content')?.focus();}-+onChangeSearch(val: string) {this.isLoading = true;@@ -106,50 +100,46 @@ export class NavHeaderComponent implements OnInit, OnDestroy {goTo(queryParamName: string, filter: any) {let params: any = {};params[queryParamName] = filter;- params['page'] = 1;+ params[FilterQueryParam.Page] = 1;this.clearSearch();this.router.navigate(['all-series'], {queryParams: params});}goToPerson(role: PersonRole, filter: any) {- // TODO: Move this to utility servicethis.clearSearch();switch(role) {case PersonRole.Writer:- this.goTo('writers', filter);+ this.goTo(FilterQueryParam.Writers, filter);break;case PersonRole.Artist:- this.goTo('artists', filter);+ this.goTo(FilterQueryParam.Artists, filter);break;case PersonRole.Character:- this.goTo('character', filter);+ this.goTo(FilterQueryParam.Character, filter);break;case PersonRole.Colorist:- this.goTo('colorist', filter);+ this.goTo(FilterQueryParam.Colorist, filter);break;case PersonRole.Editor:- this.goTo('editor', filter);+ this.goTo(FilterQueryParam.Editor, filter);break;case PersonRole.Inker:- this.goTo('inker', filter);+ this.goTo(FilterQueryParam.Inker, filter);break;case PersonRole.CoverArtist:- this.goTo('coverArtists', filter);- break;- case PersonRole.Inker:- this.goTo('inker', filter);+ this.goTo(FilterQueryParam.CoverArtists, filter);break;case PersonRole.Letterer:- this.goTo('letterer', filter);+ this.goTo(FilterQueryParam.Letterer, filter);break;case PersonRole.Penciller:- this.goTo('penciller', filter);+ this.goTo(FilterQueryParam.Penciller, filter);break;case PersonRole.Publisher:- this.goTo('publisher', filter);+ this.goTo(FilterQueryParam.Publisher, filter);break;case PersonRole.Translator:- this.goTo('translator', filter);+ this.goTo(FilterQueryParam.Translator, filter);break;}}@@ -167,6 +157,24 @@ export class NavHeaderComponent implements OnInit, OnDestroy {this.router.navigate(['library', libraryId, 'series', seriesId]);}+ clickFileSearchResult(item: MangaFile) {+ this.clearSearch();+ this.seriesService.getSeriesForMangaFile(item.id).subscribe(series => {+ if (series !== undefined && series !== null) {+ this.router.navigate(['library', series.libraryId, 'series', series.id]);+ }+ })+ }++ clickChapterSearchResult(item: Chapter) {+ this.clearSearch();+ this.seriesService.getSeriesForChapter(item.id).subscribe(series => {+ if (series !== undefined && series !== null) {+ this.router.navigate(['library', series.libraryId, 'series', series.id]);+ }+ })+ }+clickLibraryResult(item: Library) {this.router.navigate(['library', item.id]);}@@ -183,10 +191,7 @@ export class NavHeaderComponent implements OnInit, OnDestroy {scrollToTop() {- window.scroll({- top: 0,- behavior: 'smooth'- });+ this.scrollService.scrollTo(0, this.document.body);}focusUpdate(searchFocused: boolean) {diff --git a/UI/Web/src/app/nav/nav.module.ts b/UI/Web/src/app/nav/nav.module.tsnew file mode 100644index 000000000..97e77b9f3--- /dev/null+++ b/UI/Web/src/app/nav/nav.module.ts@@ -0,0 +1,39 @@+import { NgModule } from '@angular/core';+import { CommonModule } from '@angular/common';+import { EventsWidgetComponent } from './events-widget/events-widget.component';+import { GroupedTypeaheadComponent } from './grouped-typeahead/grouped-typeahead.component';+import { NavHeaderComponent } from './nav-header/nav-header.component';+import { NgbDropdownModule, NgbPopoverModule, NgbNavModule } from '@ng-bootstrap/ng-bootstrap';+import { SharedModule } from '../shared/shared.module';+import { PipeModule } from '../pipe/pipe.module';+import { TypeaheadModule } from '../typeahead/typeahead.module';+import { ReactiveFormsModule } from '@angular/forms';+import { RouterModule } from '@angular/router';++++@NgModule({+ declarations: [+ NavHeaderComponent,+ EventsWidgetComponent,+ GroupedTypeaheadComponent,+ ],+ imports: [+ CommonModule,+ ReactiveFormsModule,+ RouterModule,++ NgbDropdownModule,+ NgbPopoverModule,+ NgbNavModule,++ SharedModule, // app image, series-format+ PipeModule,+ TypeaheadModule,+ ],+ exports: [+ NavHeaderComponent,+ SharedModule+ ]+})+export class NavModule { }diff --git a/UI/Web/src/app/pipe/pipe.module.ts b/UI/Web/src/app/pipe/pipe.module.tsindex a010428f6..7e2a29659 100644--- a/UI/Web/src/app/pipe/pipe.module.ts+++ b/UI/Web/src/app/pipe/pipe.module.ts@@ -5,6 +5,7 @@ import { PublicationStatusPipe } from './publication-status.pipe';import { SentenceCasePipe } from './sentence-case.pipe';import { PersonRolePipe } from './person-role.pipe';import { SafeHtmlPipe } from './safe-html.pipe';+import { RelationshipPipe } from './relationship.pipe';@@ -14,7 +15,8 @@ import { SafeHtmlPipe } from './safe-html.pipe';PersonRolePipe,PublicationStatusPipe,SentenceCasePipe,- SafeHtmlPipe+ SafeHtmlPipe,+ RelationshipPipe],imports: [CommonModule,@@ -24,7 +26,8 @@ import { SafeHtmlPipe } from './safe-html.pipe';PersonRolePipe,PublicationStatusPipe,SentenceCasePipe,- SafeHtmlPipe+ SafeHtmlPipe,+ RelationshipPipe]})export class PipeModule { }diff --git a/UI/Web/src/app/pipe/publication-status.pipe.ts b/UI/Web/src/app/pipe/publication-status.pipe.tsindex d5a9cea06..a36bebe17 100644--- a/UI/Web/src/app/pipe/publication-status.pipe.ts+++ b/UI/Web/src/app/pipe/publication-status.pipe.ts@@ -11,6 +11,8 @@ export class PublicationStatusPipe implements PipeTransform {case PublicationStatus.OnGoing: return 'Ongoing';case PublicationStatus.Hiatus: return 'Hiatus';case PublicationStatus.Completed: return 'Completed';+ case PublicationStatus.Cancelled: return 'Cancelled';+ case PublicationStatus.Ended: return 'Ended';default: return '';}diff --git a/UI/Web/src/app/pipe/relationship.pipe.spec.ts b/UI/Web/src/app/pipe/relationship.pipe.spec.tsnew file mode 100644index 000000000..4a527479d--- /dev/null+++ b/UI/Web/src/app/pipe/relationship.pipe.spec.ts@@ -0,0 +1,8 @@+import { RelationshipPipe } from './relationship.pipe';++describe('RelationshipPipe', () => {+ it('create an instance', () => {+ const pipe = new RelationshipPipe();+ expect(pipe).toBeTruthy();+ });+});diff --git a/UI/Web/src/app/pipe/relationship.pipe.ts b/UI/Web/src/app/pipe/relationship.pipe.tsnew file mode 100644index 000000000..f1778a5a6--- /dev/null+++ b/UI/Web/src/app/pipe/relationship.pipe.ts@@ -0,0 +1,41 @@+import { Pipe, PipeTransform } from '@angular/core';+import { RelationKind } from '../_models/series-detail/relation-kind';++@Pipe({+ name: 'relationship'+})+export class RelationshipPipe implements PipeTransform {++ transform(relationship: RelationKind | undefined): string {+ if (relationship === undefined) return '';+ switch (relationship) {+ case RelationKind.Adaptation:+ return 'Adaptation';+ case RelationKind.AlternativeSetting:+ return 'Alternative Setting';+ case RelationKind.AlternativeVersion:+ return 'Alternative Version';+ case RelationKind.Character:+ return 'Character';+ case RelationKind.Contains:+ return 'Contains';+ case RelationKind.Doujinshi:+ return 'Doujinshi';+ case RelationKind.Other:+ return 'Other';+ case RelationKind.Prequel:+ return 'Prequel';+ case RelationKind.Sequel:+ return 'Sequel';+ case RelationKind.SideStory:+ return 'Side Story';+ case RelationKind.SpinOff:+ return 'Spin Off';+ case RelationKind.Parent:+ return 'Parent';+ default:+ return '';+ }+ }++}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.htmlindex 1c52b09dc..c7ce73c24 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,26 +1,41 @@<div class="modal-header"><h4 class="modal-title" id="modal-basic-title">Edit {{readingList.title}} Reading List</h4>- <button type="button" class="btn-close" aria-label="Close" (click)="close()">-- </button>+ <button type="button" class="btn-close" aria-label="Close" (click)="close()"></button></div>-<div class="modal-body">- <p>- This list is currently {{readingList?.promoted ? 'promoted' : 'not promoted'}} (<i class="fa fa-angle-double-up" aria-hidden="true"></i>).- Promotion means that the list can be seen server-wide, not just for admin users. All series that are within this list will still have user-access restrictions placed on them.- </p>- <form [formGroup]="reviewGroup">- <div class="mb-3">- <label for="title" class="form-label">Name</label>- <input id="title" class="form-control" formControlName="title" type="text">- </div>-- <div class="mb-3">- <label for="summary" class="form-label">Summary</label>- <textarea id="summary" class="form-control" formControlName="summary" rows="3"></textarea>- </div>- </form>+<div class="modal-body {{utilityService.getActiveBreakpoint() === Breakpoint.Mobile ? '' : 'd-flex'}}">+ <ul ngbNav #nav="ngbNav" [(activeId)]="active" class="nav-pills" orientation="{{utilityService.getActiveBreakpoint() === Breakpoint.Mobile ? 'horizontal' : 'vertical'}}" style="min-width: 135px;">+ <li [ngbNavItem]="tabs[0]">+ <a ngbNavLink>{{tabs[0].title}}</a>+ <ng-template ngbNavContent>+ <p>+ This list is currently {{readingList?.promoted ? 'promoted' : 'not promoted'}} (<i class="fa fa-angle-double-up" aria-hidden="true"></i>).+ Promotion means that the list can be seen server-wide, not just for admin users. All series that are within this list will still have user-access restrictions placed on them.+ </p>+ <form [formGroup]="reviewGroup">+ <div class="mb-3">+ <label for="title" class="form-label">Name</label>+ <input id="title" class="form-control" formControlName="title" type="text">+ </div>++ <div class="mb-3">+ <label for="summary" class="form-label">Summary</label>+ <textarea id="summary" class="form-control" formControlName="summary" rows="3"></textarea>+ </div>+ </form>+ </ng-template>+ </li>+ <li [ngbNavItem]="tabs[1]">+ <a ngbNavLink>{{tabs[1].title}}</a>+ <ng-template ngbNavContent>+ <p class="alert alert-primary" role="alert">+ Upload and choose a new cover image. Press Save to upload and override the cover.+ </p>+ <app-cover-image-chooser [(imageUrls)]="imageUrls" (imageSelected)="updateSelectedIndex($event)" (selectedBase64Url)="updateSelectedImage($event)" [showReset]="readingList.coverImageLocked" (resetClicked)="handleReset()"></app-cover-image-chooser>+ </ng-template>+ </li>+ </ul>+ <div [ngbNavOutlet]="nav" class="ms-2 mt-3"></div></div><div class="modal-footer"><button type="button" class="btn btn-secondary" (click)="close()">Close</button>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.tsindex 58bd80b9b..13d6960a4 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@@ -1,8 +1,14 @@import { Component, Input, OnInit } from '@angular/core';import { FormGroup, FormControl, Validators } from '@angular/forms';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 { ReadingList } from 'src/app/_models/reading-list';+import { ImageService } from 'src/app/_services/image.service';import { ReadingListService } from 'src/app/_services/reading-list.service';+import { UploadService } from 'src/app/_services/upload.service';+@Component({selector: 'app-edit-reading-list-modal',@@ -14,13 +20,33 @@ export class EditReadingListModalComponent implements OnInit {@Input() readingList!: ReadingList;reviewGroup!: FormGroup;- constructor(private ngModal: NgbActiveModal, private readingListService: ReadingListService) { }+ coverImageIndex: number = 0;+ /**+ * Url of the selected cover+ */+ selectedCover: string = '';+ coverImageLocked: boolean = false;++ imageUrls: Array<string> = [];++ tabs = [{title: 'General', disabled: false}, {title: 'Cover', disabled: false}];+ active = this.tabs[0];++ get Breakpoint() {+ return Breakpoint;+ }++ constructor(private ngModal: NgbActiveModal, private readingListService: ReadingListService,+ public utilityService: UtilityService, private uploadService: UploadService, private toastr: ToastrService,+ private imageService: ImageService) { }ngOnInit(): void {this.reviewGroup = new FormGroup({title: new FormControl(this.readingList.title, [Validators.required]),summary: new FormControl(this.readingList.summary, [])});++ this.imageUrls.push(this.imageService.randomize(this.imageService.getReadingListCoverImage(this.readingList.id)));}close() {@@ -29,12 +55,22 @@ export class EditReadingListModalComponent implements OnInit {save() {if (this.reviewGroup.value.title.trim() === '') return;- const model = {...this.reviewGroup.value, readingListId: this.readingList.id, promoted: this.readingList.promoted};- this.readingListService.update(model).subscribe(() => {++ const model = {...this.reviewGroup.value, readingListId: this.readingList.id, promoted: this.readingList.promoted, coverImageLocked: this.coverImageLocked};++ const apis = [this.readingListService.update(model)];++ if (this.selectedCover !== '') {+ apis.push(this.uploadService.updateReadingListCoverImage(this.readingList.id, this.selectedCover))+ }++ forkJoin(apis).subscribe(results => {this.readingList.title = model.title;this.readingList.summary = model.summary;+ this.readingList.coverImageLocked = this.coverImageLocked;this.ngModal.close(this.readingList);+ this.toastr.success('Reading List updated');});}@@ -49,4 +85,16 @@ export class EditReadingListModalComponent implements OnInit {});}+ updateSelectedIndex(index: number) {+ this.coverImageIndex = index;+ }++ updateSelectedImage(url: string) {+ this.selectedCover = url;+ }++ handleReset() {+ this.coverImageLocked = false;+ }+}diff --git a/UI/Web/src/app/reading-list/reading-list-detail/reading-list-detail.component.html b/UI/Web/src/app/reading-list/reading-list-detail/reading-list-detail.component.htmlindex 682dfe6d4..c961560c9 100644--- a/UI/Web/src/app/reading-list/reading-list-detail/reading-list-detail.component.html+++ b/UI/Web/src/app/reading-list/reading-list-detail/reading-list-detail.component.html@@ -3,45 +3,51 @@<span *ngIf="actions.length > 0"><app-card-actionables (actionHandler)="performAction($event)" [actions]="actions" [labelBy]="readingList.title"></app-card-actionables></span>- {{readingList.title}} <span *ngIf="readingList?.promoted">(<i class="fa fa-angle-double-up" aria-hidden="true"></i>)</span> - <span class="badge bg-primary rounded-pill" attr.aria-label="{{items.length}} total items">{{items.length}}</span>+ {{readingList?.title}} <span *ngIf="readingList?.promoted">(<i class="fa fa-angle-double-up" aria-hidden="true"></i>)</span></h2>+ <h6 subtitle style="margin-left: 40px">{{items.length}} Items</h6></app-side-nav-companion-bar><div class="container-fluid mt-2" *ngIf="readingList">- <div class="mb-3">- <!-- Action row-->- <div class="row g-0">- <div class="col-auto me-2">- <button class="btn btn-primary" title="Read" (click)="read()">- <span>- <i class="fa fa-book-open" aria-hidden="true"></i>- <span class="read-btn--text"> Read</span>- </span>- </button>- </div>- <div class="col-auto">- <button class="btn btn-secondary" (click)="removeRead()" [disabled]="readingList?.promoted && !this.isAdmin">++ <div class="row mb-3">+ <div class="col-md-2 col-xs-4 col-sm-6 d-none d-sm-block">+ <app-image maxWidth="300px" [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" (click)="read()"><span>- <i class="fa fa-check"></i>+ <i class="fa fa-book-open" aria-hidden="true"></i>+ <span class="read-btn--text"> Read</span></span>- <span class="read-btn--text"> Remove Read</span></button>- </div>- <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>+ </div>+ <div class="col-auto">+ <button class="btn btn-secondary" (click)="removeRead()" [disabled]="readingList?.promoted && !this.isAdmin">+ <span>+ <i class="fa fa-check"></i>+ </span>+ <span class="read-btn--text"> Remove Read</span>+ </button>+ </div>+ <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>+ </div></div></div>+ <!-- Summary row-->+ <div class="row g-0 mt-2">+ <app-read-more [text]="readingListSummary" [maxLength]="250"></app-read-more>+ </div></div>- <!-- Summary row-->- <div class="row g-0 mt-2">- <app-read-more [text]="readingListSummary" [maxLength]="250"></app-read-more>- </div>- </div>+<div *ngIf="items.length === 0">- No chapters added+ Nothing added</div><app-dragable-ordered-list [items]="items" (orderUpdated)="orderUpdated($event)" (itemRemove)="itemRemoved($event)" [accessibilityMode]="accessibilityMode">@@ -63,6 +69,8 @@<span *ngIf="item.promoted"><i class="fa fa-angle-double-up" aria-hidden="true"></i></span>+ <br/>+ <a href="javascript:void(0);" (click)="readChapter(item)">Read</a></div></div></ng-template>diff --git a/UI/Web/src/app/reading-list/reading-list-detail/reading-list-detail.component.ts b/UI/Web/src/app/reading-list/reading-list-detail/reading-list-detail.component.tsindex 5a8621c2a..28652a4a9 100644--- a/UI/Web/src/app/reading-list/reading-list-detail/reading-list-detail.component.ts+++ b/UI/Web/src/app/reading-list/reading-list-detail/reading-list-detail.component.ts@@ -15,6 +15,7 @@ import { ReadingListService } from 'src/app/_services/reading-list.service';import { IndexUpdateEvent, ItemRemoveEvent } from '../dragable-ordered-list/dragable-ordered-list.component';import { LibraryService } from '../../_services/library.service';import { forkJoin } from 'rxjs';+import { ReaderService } from 'src/app/_services/reader.service';@Component({selector: 'app-reading-list-detail',@@ -38,6 +39,8 @@ export class ReadingListDetailComponent implements OnInit {libraryTypes: {[key: number]: LibraryType} = {};+ readingListImage: string = '';+get MangaFormat(): typeof MangaFormat {return MangaFormat;}@@ -45,7 +48,7 @@ export class ReadingListDetailComponent implements OnInit {constructor(private route: ActivatedRoute, private router: Router, private readingListService: ReadingListService,private actionService: ActionService, private actionFactoryService: ActionFactoryService, public utilityService: UtilityService,public imageService: ImageService, private accountService: AccountService, private toastr: ToastrService,- private confirmService: ConfirmService, private libraryService: LibraryService) {}+ private confirmService: ConfirmService, private libraryService: LibraryService, private readerService: ReaderService) {}ngOnInit(): void {const listId = this.route.snapshot.paramMap.get('id');@@ -57,6 +60,8 @@ export class ReadingListDetailComponent implements OnInit {this.listId = parseInt(listId, 10);+ this.readingListImage = this.imageService.randomize(this.imageService.getReadingListCoverImage(this.listId));+this.libraryService.getLibraries().subscribe(libs => {});@@ -107,6 +112,15 @@ export class ReadingListDetailComponent implements OnInit {}}+ readChapter(item: ReadingListItem) {+ let reader = 'manga';+ if (item.seriesFormat === MangaFormat.EPUB) {+ reader = 'book;'+ }+ const params = this.readerService.getQueryParamsObject(false, true, this.readingList.id);+ this.router.navigate(['library', item.libraryId, 'series', item.seriesId, 'book', item.chapterId], {queryParams: params});+ }+handleReadingListActionCallback(action: Action, readingList: ReadingList) {switch(action) {case Action.Delete:diff --git a/UI/Web/src/app/reading-list/reading-list.router.module.ts b/UI/Web/src/app/reading-list/reading-list-routing.module.tssimilarity index 100%rename from UI/Web/src/app/reading-list/reading-list.router.module.tsrename to UI/Web/src/app/reading-list/reading-list-routing.module.tsdiff --git a/UI/Web/src/app/reading-list/reading-list.module.ts b/UI/Web/src/app/reading-list/reading-list.module.tsindex ec5df6e0e..4abf1379f 100644--- a/UI/Web/src/app/reading-list/reading-list.module.ts+++ b/UI/Web/src/app/reading-list/reading-list.module.ts@@ -2,16 +2,16 @@ import { NgModule } from '@angular/core';import { CommonModule } from '@angular/common';import { DragableOrderedListComponent } from './dragable-ordered-list/dragable-ordered-list.component';import { ReadingListDetailComponent } from './reading-list-detail/reading-list-detail.component';-import { ReadingListRoutingModule } from './reading-list.router.module';+import { ReadingListRoutingModule } from './reading-list-routing.module';import {DragDropModule} from '@angular/cdk/drag-drop';import { AddToListModalComponent } from './_modals/add-to-list-modal/add-to-list-modal.component';import { ReactiveFormsModule } from '@angular/forms';-import { CardsModule } from '../cards/cards.module';import { ReadingListsComponent } from './reading-lists/reading-lists.component';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 { SidenavModule } from '../sidenav/sidenav.module';+import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap';+import { SharedSideNavCardsModule } from '../shared-side-nav-cards/shared-side-nav-cards.module';@@ -25,13 +25,15 @@ import { SidenavModule } from '../sidenav/sidenav.module';],imports: [CommonModule,- ReadingListRoutingModule,ReactiveFormsModule,DragDropModule,- CardsModule,+ NgbNavModule,+PipeModule,SharedModule,- SidenavModule+ SharedSideNavCardsModule,++ ReadingListRoutingModule,],exports: [AddToListModalComponent,diff --git a/UI/Web/src/app/reading-list/reading-lists/reading-lists.component.html b/UI/Web/src/app/reading-list/reading-lists/reading-lists.component.htmlindex b3c62228f..0cfe9e3d0 100644--- a/UI/Web/src/app/reading-list/reading-lists/reading-lists.component.html+++ b/UI/Web/src/app/reading-list/reading-lists/reading-lists.component.html@@ -1,6 +1,5 @@<app-side-nav-companion-bar pageHeader="Home"><h2 title>- <app-card-actionables [actions]="actions"></app-card-actionables>Reading Lists</h2><h6 subtitle>{{pagination?.totalItems}} Items</h6>@@ -15,6 +14,6 @@(pageChange)="onPageChange($event)"><ng-template #cardItem let-item let-position="idx">- <app-card-item [title]="item.title" [entity]="item" [actions]="getActions(item)" [supressLibraryLink]="true" [imageUrl]="imageService.placeholderImage" (clicked)="handleClick(item)"></app-card-item>+ <app-card-item [title]="item.title" [entity]="item" [actions]="getActions(item)" [suppressLibraryLink]="true" [imageUrl]="imageService.getReadingListCoverImage(item.id)" (clicked)="handleClick(item)"></app-card-item></ng-template></app-card-detail-layout>diff --git a/UI/Web/src/app/reading-list/reading-lists/reading-lists.component.ts b/UI/Web/src/app/reading-list/reading-lists/reading-lists.component.tsindex 9c6cc149c..7771b7a9c 100644--- a/UI/Web/src/app/reading-list/reading-lists/reading-lists.component.ts+++ b/UI/Web/src/app/reading-list/reading-lists/reading-lists.component.ts@@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core';import { Router } from '@angular/router';import { ToastrService } from 'ngx-toastr';import { take } from 'rxjs/operators';+import { FilterUtilitiesService } from 'src/app/shared/_services/filter-utilities.service';import { PaginatedResult, Pagination } from 'src/app/_models/pagination';import { ReadingList } from 'src/app/_models/reading-list';import { AccountService } from 'src/app/_services/account.service';@@ -24,7 +25,8 @@ export class ReadingListsComponent implements OnInit {isAdmin: boolean = false;constructor(private readingListService: ReadingListService, public imageService: ImageService, private actionFactoryService: ActionFactoryService,- private accountService: AccountService, private toastr: ToastrService, private router: Router, private actionService: ActionService) { }+ private accountService: AccountService, private toastr: ToastrService, private router: Router, private actionService: ActionService,+ private filterUtilityService: FilterUtilitiesService) { }ngOnInit(): void {this.loadPage();@@ -84,7 +86,7 @@ export class ReadingListsComponent implements OnInit {}onPageChange(pagination: Pagination) {- window.history.replaceState(window.location.href, '', window.location.href.split('?')[0] + '?page=' + this.pagination.currentPage);+ this.filterUtilityService.updateUrlFromFilter(this.pagination, undefined);;this.loadPage();}diff --git a/UI/Web/src/app/recently-added/recently-added.component.html b/UI/Web/src/app/recently-added/recently-added.component.htmldeleted file mode 100644index 06b744c22..000000000--- a/UI/Web/src/app/recently-added/recently-added.component.html+++ /dev/null@@ -1,19 +0,0 @@-<app-side-nav-companion-bar [hasFilter]="true" [filterOpenByDefault]="filterSettings.openByDefault" (filterOpen)="filterOpen.emit($event)">- <h2 title>- Recently Added- </h2>-</app-side-nav-companion-bar>-<app-bulk-operations [actionCallback]="bulkActionCallback"></app-bulk-operations>-<app-card-detail-layout-[isLoading]="isLoading"-[items]="series"-[pagination]="pagination"-[filterSettings]="filterSettings"-[filterOpen]="filterOpen"-(applyFilter)="applyFilter($event)"-(pageChange)="onPageChange($event)"->- <ng-template #cardItem let-item let-position="idx">- <app-series-card [data]="item" [libraryId]="item.libraryId" (reload)="loadPage()" (selection)="bulkSelectionService.handleCardSelection('series', position, series.length, $event)" [selected]="bulkSelectionService.isCardSelected('series', position)" [allowSelection]="true"></app-series-card>- </ng-template>-</app-card-detail-layout>\ No newline at end of filediff --git a/UI/Web/src/app/recently-added/recently-added.component.scss b/UI/Web/src/app/recently-added/recently-added.component.scssdeleted file mode 100644index e69de29bb..000000000diff --git a/UI/Web/src/app/recently-added/recently-added.component.ts b/UI/Web/src/app/recently-added/recently-added.component.tsdeleted file mode 100644index 8138a3868..000000000--- a/UI/Web/src/app/recently-added/recently-added.component.ts+++ /dev/null@@ -1,155 +0,0 @@-import { Component, EventEmitter, HostListener, OnDestroy, OnInit } from '@angular/core';-import { Title } from '@angular/platform-browser';-import { ActivatedRoute, Router } from '@angular/router';-import { Subject } from 'rxjs';-import { debounceTime, take, takeUntil } from 'rxjs/operators';-import { BulkSelectionService } from '../cards/bulk-selection.service';-import { FilterSettings } from '../metadata-filter/filter-settings';-import { KEY_CODES } from '../shared/_services/utility.service';-import { SeriesAddedEvent } from '../_models/events/series-added-event';-import { Pagination } from '../_models/pagination';-import { Series } from '../_models/series';-import { FilterEvent, SeriesFilter } from '../_models/series-filter';-import { Action } from '../_services/action-factory.service';-import { ActionService } from '../_services/action.service';-import { EVENTS, Message, MessageHubService } from '../_services/message-hub.service';-import { SeriesService } from '../_services/series.service';--/**- * This component is used as a standard layout for any card detail. ie) series, on-deck, collections, etc.- */-@Component({- selector: 'app-recently-added',- templateUrl: './recently-added.component.html',- styleUrls: ['./recently-added.component.scss']-})--export class RecentlyAddedComponent implements OnInit, OnDestroy {-- isLoading: boolean = true;- series: Series[] = [];- pagination!: Pagination;- libraryId!: number;-- filter: SeriesFilter | undefined = undefined;- filterSettings: FilterSettings = new FilterSettings();- filterOpen: EventEmitter<boolean> = new EventEmitter();-- onDestroy: Subject<void> = new Subject();-- constructor(private router: Router, private route: ActivatedRoute, private seriesService: SeriesService, private titleService: Title,- private actionService: ActionService, public bulkSelectionService: BulkSelectionService, private hubService: MessageHubService) {- this.router.routeReuseStrategy.shouldReuseRoute = () => false;- this.titleService.setTitle('Kavita - Recently Added');- if (this.pagination === undefined || this.pagination === null) {- this.pagination = {currentPage: 0, itemsPerPage: 30, totalItems: 0, totalPages: 1};- }- this.filterSettings.sortDisabled = true;-- this.loadPage();- }-- @HostListener('document:keydown.shift', ['$event'])- handleKeypress(event: KeyboardEvent) {- if (event.key === KEY_CODES.SHIFT) {- this.bulkSelectionService.isShiftDown = true;- }- }-- @HostListener('document:keyup.shift', ['$event'])- handleKeyUp(event: KeyboardEvent) {- if (event.key === KEY_CODES.SHIFT) {- this.bulkSelectionService.isShiftDown = false;- }- }-- ngOnInit() {- this.hubService.messages$.pipe(debounceTime(6000), takeUntil(this.onDestroy)).subscribe((event) => {- if (event.event !== EVENTS.SeriesAdded) return;- const seriesAdded = event.payload as SeriesAddedEvent;- if (seriesAdded.libraryId !== this.libraryId) return;- this.loadPage();- });- }-- ngOnDestroy() {- this.onDestroy.next();- this.onDestroy.complete();- }-- seriesClicked(series: Series) {- this.router.navigate(['library', this.libraryId, 'series', series.id]);- }-- onPageChange(pagination: Pagination) {- window.history.replaceState(window.location.href, '', window.location.href.split('?')[0] + '?page=' + this.pagination.currentPage);- this.loadPage();- }-- applyFilter(event: FilterEvent) {- this.filter = event.filter;- const page = this.getPage();- if (page === undefined || page === null || !event.isFirst) {- this.pagination.currentPage = 1;- this.onPageChange(this.pagination);- } else {- this.loadPage();- }- }-- loadPage() {- const page = this.getPage();- if (page != null) {- this.pagination.currentPage = parseInt(page, 10);- }- this.isLoading = true;- this.seriesService.getRecentlyAdded(this.libraryId, this.pagination?.currentPage, this.pagination?.itemsPerPage, this.filter).pipe(take(1)).subscribe(series => {- this.series = series.result;- this.pagination = series.pagination;- this.isLoading = false;- window.scrollTo(0, 0);- });- }-- getPage() {- const urlParams = new URLSearchParams(window.location.search);- return urlParams.get('page');- }-- bulkActionCallback = (action: Action, data: any) => {- const selectedSeriesIndexies = this.bulkSelectionService.getSelectedCardsForSource('series');- const selectedSeries = this.series.filter((series, index: number) => selectedSeriesIndexies.includes(index + ''));-- switch (action) {- case Action.AddToReadingList:- this.actionService.addMultipleSeriesToReadingList(selectedSeries, () => {- this.bulkSelectionService.deselectAll();- });- break;- case Action.AddToCollection:- this.actionService.addMultipleSeriesToCollectionTag(selectedSeries, () => {- this.bulkSelectionService.deselectAll();- });- break;- case Action.MarkAsRead:- this.actionService.markMultipleSeriesAsRead(selectedSeries, () => {- this.loadPage();- this.bulkSelectionService.deselectAll();- });-- break;- case Action.MarkAsUnread:- this.actionService.markMultipleSeriesAsUnread(selectedSeries, () => {- this.loadPage();- this.bulkSelectionService.deselectAll();- });- break;- case Action.Delete:- this.actionService.deleteMultipleSeries(selectedSeries, () => {- this.loadPage();- this.bulkSelectionService.deselectAll();- });- break;- }- }-}diff --git a/UI/Web/src/app/registration/confirm-email/confirm-email.component.ts b/UI/Web/src/app/registration/confirm-email/confirm-email.component.tsindex 6340b4e5c..bf95a3fab 100644--- a/UI/Web/src/app/registration/confirm-email/confirm-email.component.ts+++ b/UI/Web/src/app/registration/confirm-email/confirm-email.component.ts@@ -1,8 +1,8 @@-import { Component, Input, OnInit } from '@angular/core';+import { Component, OnInit } from '@angular/core';import { FormControl, FormGroup, Validators } from '@angular/forms';import { ActivatedRoute, Router } from '@angular/router';import { ToastrService } from 'ngx-toastr';-import { ThemeService } from 'src/app/theme.service';+import { ThemeService } from 'src/app/_services/theme.service';import { AccountService } from 'src/app/_services/account.service';import { NavService } from 'src/app/_services/nav.service';diff --git a/UI/Web/src/app/registration/confirm-migration-email/confirm-migration-email.component.ts b/UI/Web/src/app/registration/confirm-migration-email/confirm-migration-email.component.tsindex dcc83fe09..ed3724a89 100644--- a/UI/Web/src/app/registration/confirm-migration-email/confirm-migration-email.component.ts+++ b/UI/Web/src/app/registration/confirm-migration-email/confirm-migration-email.component.ts@@ -1,7 +1,7 @@import { Component, OnInit } from '@angular/core';import { ActivatedRoute, Router } from '@angular/router';import { ToastrService } from 'ngx-toastr';-import { ThemeService } from 'src/app/theme.service';+import { ThemeService } from 'src/app/_services/theme.service';import { AccountService } from 'src/app/_services/account.service';@Component({diff --git a/UI/Web/src/app/registration/confirm-reset-password/confirm-reset-password.component.ts b/UI/Web/src/app/registration/confirm-reset-password/confirm-reset-password.component.tsindex 2fdcbc910..6fa36164e 100644--- a/UI/Web/src/app/registration/confirm-reset-password/confirm-reset-password.component.ts+++ b/UI/Web/src/app/registration/confirm-reset-password/confirm-reset-password.component.ts@@ -42,7 +42,7 @@ export class ConfirmResetPasswordComponent implements OnInit {this.toastr.success("Password reset");this.router.navigateByUrl('login');}, err => {- console.log(err);+ console.error(err, 'There was an error trying to confirm reset password');});}diff --git a/UI/Web/src/app/registration/register/register.component.html b/UI/Web/src/app/registration/register/register.component.htmlindex 3370032d2..2e1817df6 100644--- a/UI/Web/src/app/registration/register/register.component.html+++ b/UI/Web/src/app/registration/register/register.component.html@@ -14,8 +14,12 @@</div><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>+ <label for="email" class="form-label">Email</label> <i class="fa fa-info-circle" placement="right" [ngbTooltip]="emailTooltip" role="button" tabindex="0"></i>+ <ng-template #emailTooltip>Email does not have to be valid, it is used for forgot password flow. It is not sent outside the server unless forgot password is used without a custom email service host.</ng-template>+ <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"><div id="inviteForm-validations" class="invalid-feedback" *ngIf="registerForm.dirty || registerForm.touched"><div *ngIf="registerForm.get('email')?.errors?.required">This field is requireddiff --git a/UI/Web/src/app/registration/registration.module.ts b/UI/Web/src/app/registration/registration.module.tsindex 873c512f7..d0556ccd3 100644--- a/UI/Web/src/app/registration/registration.module.ts+++ b/UI/Web/src/app/registration/registration.module.ts@@ -2,7 +2,7 @@ import { NgModule } from '@angular/core';import { CommonModule } from '@angular/common';import { ConfirmEmailComponent } from './confirm-email/confirm-email.component';import { RegistrationRoutingModule } from './registration.router.module';-import { NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap';+import { NgbCollapseModule, NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap';import { ReactiveFormsModule } from '@angular/forms';import { SplashContainerComponent } from './splash-container/splash-container.component';import { RegisterComponent } from './register/register.component';@@ -10,6 +10,7 @@ import { AddEmailToAccountMigrationModalComponent } from './add-email-to-accountimport { ConfirmMigrationEmailComponent } from './confirm-migration-email/confirm-migration-email.component';import { ResetPasswordComponent } from './reset-password/reset-password.component';import { ConfirmResetPasswordComponent } from './confirm-reset-password/confirm-reset-password.component';+import { UserLoginComponent } from './user-login/user-login.component';@@ -21,7 +22,8 @@ import { ConfirmResetPasswordComponent } from './confirm-reset-password/confirm-AddEmailToAccountMigrationModalComponent,ConfirmMigrationEmailComponent,ResetPasswordComponent,- ConfirmResetPasswordComponent+ ConfirmResetPasswordComponent,+ UserLoginComponent],imports: [CommonModule,diff --git a/UI/Web/src/app/registration/registration.router.module.ts b/UI/Web/src/app/registration/registration.router.module.tsindex f87951c25..a4c16665b 100644--- a/UI/Web/src/app/registration/registration.router.module.ts+++ b/UI/Web/src/app/registration/registration.router.module.ts@@ -5,8 +5,17 @@ import { ConfirmMigrationEmailComponent } from './confirm-migration-email/confirimport { ConfirmResetPasswordComponent } from './confirm-reset-password/confirm-reset-password.component';import { RegisterComponent } from './register/register.component';import { ResetPasswordComponent } from './reset-password/reset-password.component';+import { UserLoginComponent } from './user-login/user-login.component';const routes: Routes = [+ {+ path: '',+ component: UserLoginComponent+ },+ {+ path: 'login',+ component: UserLoginComponent+ },{path: 'confirm-email',component: ConfirmEmailComponent,diff --git a/UI/Web/src/app/registration/reset-password/reset-password.component.scss b/UI/Web/src/app/registration/reset-password/reset-password.component.scssindex 9aedb3438..736856043 100644--- a/UI/Web/src/app/registration/reset-password/reset-password.component.scss+++ b/UI/Web/src/app/registration/reset-password/reset-password.component.scss@@ -4,5 +4,5 @@.custom-input {background-color: #fff !important;- color: black;+ color: black !important;}\ No newline at end of filediff --git a/UI/Web/src/app/registration/splash-container/splash-container.component.scss b/UI/Web/src/app/registration/splash-container/splash-container.component.scssindex caba64f6c..e710a7c34 100644--- a/UI/Web/src/app/registration/splash-container/splash-container.component.scss+++ b/UI/Web/src/app/registration/splash-container/splash-container.component.scss@@ -45,7 +45,7 @@font-weight: bold;display: inline-block;vertical-align: middle;- width: 280px;+ width: 100%;}.card-text {diff --git a/UI/Web/src/app/user-login/user-login.component.html b/UI/Web/src/app/registration/user-login/user-login.component.htmlsimilarity index 100%rename from UI/Web/src/app/user-login/user-login.component.htmlrename to UI/Web/src/app/registration/user-login/user-login.component.htmldiff --git a/UI/Web/src/app/user-login/user-login.component.scss b/UI/Web/src/app/registration/user-login/user-login.component.scsssimilarity index 87%rename from UI/Web/src/app/user-login/user-login.component.scssrename to UI/Web/src/app/registration/user-login/user-login.component.scssindex fb13d8579..e37d91cff 100644--- a/UI/Web/src/app/user-login/user-login.component.scss+++ b/UI/Web/src/app/registration/user-login/user-login.component.scss@@ -12,7 +12,7 @@ a {.custom-input {background-color: #fff !important;- color: black;+ color: black !important;}.invalid-feedback {diff --git a/UI/Web/src/app/user-login/user-login.component.spec.ts b/UI/Web/src/app/registration/user-login/user-login.component.spec.tssimilarity index 97%rename from UI/Web/src/app/user-login/user-login.component.spec.tsrename to UI/Web/src/app/registration/user-login/user-login.component.spec.tsindex 938c7decb..7701748ea 100644--- a/UI/Web/src/app/user-login/user-login.component.spec.ts+++ b/UI/Web/src/app/registration/user-login/user-login.component.spec.ts@@ -1,5 +1,5 @@import { of } from 'rxjs';-import { MemberService } from '../_services/member.service';+import { MemberService } from '../../_services/member.service';import { UserLoginComponent } from './user-login.component';xdescribe('UserLoginComponent', () => {diff --git a/UI/Web/src/app/user-login/user-login.component.ts b/UI/Web/src/app/registration/user-login/user-login.component.tssimilarity index 86%rename from UI/Web/src/app/user-login/user-login.component.tsrename to UI/Web/src/app/registration/user-login/user-login.component.tsindex e2cefed3b..c759c1316 100644--- a/UI/Web/src/app/user-login/user-login.component.ts+++ b/UI/Web/src/app/registration/user-login/user-login.component.ts@@ -4,14 +4,14 @@ import { Router } from '@angular/router';import { NgbModal } from '@ng-bootstrap/ng-bootstrap';import { ToastrService } from 'ngx-toastr';import { take } from 'rxjs/operators';-import { SettingsService } from '../admin/settings.service';-import { AddEmailToAccountMigrationModalComponent } from '../registration/add-email-to-account-migration-modal/add-email-to-account-migration-modal.component';-import { User } from '../_models/user';-import { AccountService } from '../_services/account.service';-import { MemberService } from '../_services/member.service';-import { NavService } from '../_services/nav.service';+import { SettingsService } from '../../admin/settings.service';+import { AddEmailToAccountMigrationModalComponent } from '../add-email-to-account-migration-modal/add-email-to-account-migration-modal.component';+import { User } from '../../_models/user';+import { AccountService } from '../../_services/account.service';+import { MemberService } from '../../_services/member.service';+import { NavService } from '../../_services/nav.service';+-// TODO: Move this into registration module@Component({selector: 'app-user-login',templateUrl: './user-login.component.html',@@ -48,7 +48,7 @@ export class UserLoginComponent implements OnInit {this.accountService.currentUser$.pipe(take(1)).subscribe(user => {if (user) {this.navService.showSideNav();- this.router.navigateByUrl('/library');+ this.router.navigateByUrl('/libraries');}});@@ -96,7 +96,7 @@ export class UserLoginComponent implements OnInit {localStorage.setItem('kavita--auth-intersection-url', '');this.router.navigateByUrl(pageResume);} else {- this.router.navigateByUrl('/library');+ this.router.navigateByUrl('/libraries');}}, err => {if (err.error === 'You are missing an email on your account. Please wait while we migrate your account.') {diff --git a/UI/Web/src/app/_modals/review-series-modal/review-series-modal.component.html b/UI/Web/src/app/series-detail/review-series-modal/review-series-modal.component.htmlsimilarity index 100%rename from UI/Web/src/app/_modals/review-series-modal/review-series-modal.component.htmlrename to UI/Web/src/app/series-detail/review-series-modal/review-series-modal.component.htmldiff --git a/UI/Web/src/app/library/library.component.scss b/UI/Web/src/app/series-detail/review-series-modal/review-series-modal.component.scsssimilarity index 100%rename from UI/Web/src/app/library/library.component.scssrename to UI/Web/src/app/series-detail/review-series-modal/review-series-modal.component.scssdiff --git a/UI/Web/src/app/_modals/review-series-modal/review-series-modal.component.ts b/UI/Web/src/app/series-detail/review-series-modal/review-series-modal.component.tssimilarity index 100%rename from UI/Web/src/app/_modals/review-series-modal/review-series-modal.component.tsrename to UI/Web/src/app/series-detail/review-series-modal/review-series-modal.component.tsdiff --git a/UI/Web/src/app/series-detail/series-detail-routing.module.ts b/UI/Web/src/app/series-detail/series-detail-routing.module.tsnew file mode 100644index 000000000..3e7917797--- /dev/null+++ b/UI/Web/src/app/series-detail/series-detail-routing.module.ts@@ -0,0 +1,17 @@+import { NgModule } from '@angular/core';+import { Routes, RouterModule } from '@angular/router';+import { SeriesDetailComponent } from './series-detail.component';++const routes: Routes = [+ {+ path: '',+ component: SeriesDetailComponent+ }+];+++@NgModule({+ imports: [RouterModule.forChild(routes), ],+ exports: [RouterModule]+})+export class SeriesDetailRoutingModule { }diff --git a/UI/Web/src/app/series-detail/series-detail.component.html b/UI/Web/src/app/series-detail/series-detail.component.htmlindex 8fee5c5c8..22574502f 100644--- a/UI/Web/src/app/series-detail/series-detail.component.html+++ b/UI/Web/src/app/series-detail/series-detail.component.html@@ -2,7 +2,7 @@<ng-container title><h2 style="margin-bottom: 0px"><app-card-actionables [disabled]="actionInProgress" (actionHandler)="performAction($event)" [actions]="seriesActions" [labelBy]="series.name" iconClass="fa-ellipsis-v"></app-card-actionables>- {{series?.name}}+ <span>{{series?.name}}</span></h2></ng-container><ng-container subtitle *ngIf="series?.localizedName !== series?.name">@@ -13,15 +13,16 @@<div class="row mb-3"><div class="col-md-2 col-xs-4 col-sm-6 d-none d-sm-block"><app-image maxWidth="300px" [imageUrl]="seriesImage"></app-image>+ <!-- NOTE: We can put continue point here as Vol X Ch Y or just Ch Y or Book Z ?--></div><div class="col-md-10 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'}}"></i>+ <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>+ <span class="d-none d-sm-inline-block">{{(hasReadingProgress) ? 'Continue' : 'Read'}}</span></button></div><div class="col-auto ms-2" *ngIf="isAdmin">@@ -68,55 +69,72 @@<ng-container><app-bulk-operations [actionCallback]="bulkActionCallback"></app-bulk-operations><ul ngbNav #nav="ngbNav" [(activeId)]="activeTabId" class="nav nav-tabs mb-2" [destroyOnHide]="false" (navChange)="onNavChange($event)">- <li [ngbNavItem]="TabID.Specials" *ngIf="hasSpecials">- <a ngbNavLink>Specials</a>- <ng-template ngbNavContent>- <div class="row g-0">- <ng-container *ngFor="let chapter of specials; let idx = index; trackBy: trackByChapterIdentity">- <app-card-item class="col-auto p-2" [entity]="chapter" [title]="chapter.title || chapter.range" (click)="openChapter(chapter)"- [imageUrl]="imageService.getChapterCoverImage(chapter.id)"- [read]="chapter.pagesRead" [total]="chapter.pages" [actions]="chapterActions" (selection)="bulkSelectionService.handleCardSelection('special', idx, chapters.length, $event)" [selected]="bulkSelectionService.isCardSelected('special', idx)" [allowSelection]="true"></app-card-item>- </ng-container>- </div>- </ng-template>- </li><li [ngbNavItem]="TabID.Storyline" *ngIf="libraryType !== LibraryType.Book && (volumes.length > 0 || chapters.length > 0)"><a ngbNavLink>Storyline</a><ng-template ngbNavContent>- <div class="row g-0">+ <div class="card-container row g-0"><ng-container *ngFor="let volume of volumes; let idx = index; trackBy: trackByVolumeIdentity">- <app-card-item class="col-auto p-2" *ngIf="volume.number != 0" [entity]="volume" [title]="volume.name" (click)="openVolume(volume)"+ <app-card-item class="col-auto mt-2 mb-2" *ngIf="volume.number != 0" [entity]="volume" [title]="volume.name" (click)="openVolume(volume)"[imageUrl]="imageService.getVolumeCoverImage(volume.id) + '&offset=' + coverImageOffset"[read]="volume.pagesRead" [total]="volume.pages" [actions]="volumeActions" (selection)="bulkSelectionService.handleCardSelection('volume', idx, volumes.length, $event)" [selected]="bulkSelectionService.isCardSelected('volume', idx)" [allowSelection]="true"></app-card-item></ng-container>- <ng-container *ngFor="let chapter of storyChapters; let idx = index; trackBy: trackByChapterIdentity">- <app-card-item class="col-auto p-2" *ngIf="!chapter.isSpecial" [entity]="chapter" [title]="chapter.title" (click)="openChapter(chapter)"- [imageUrl]="imageService.getChapterCoverImage(chapter.id) + '&offset=' + coverImageOffset"- [read]="chapter.pagesRead" [total]="chapter.pages" [actions]="chapterActions" (selection)="bulkSelectionService.handleCardSelection('chapter', idx, storyChapters.length, $event)" [selected]="bulkSelectionService.isCardSelected('chapter', idx)" [allowSelection]="true"></app-card-item>- </ng-container>+ <ng-container *ngFor="let chapter of storyChapters; let idx = index; trackBy: trackByChapterIdentity">+ <app-card-item class="col-auto mt-2 mb-2" *ngIf="!chapter.isSpecial" [entity]="chapter" [title]="chapter.title" (click)="openChapter(chapter)"+ [imageUrl]="imageService.getChapterCoverImage(chapter.id) + '&offset=' + coverImageOffset"+ [read]="chapter.pagesRead" [total]="chapter.pages" [actions]="chapterActions" (selection)="bulkSelectionService.handleCardSelection('chapter', idx, storyChapters.length, $event)" [selected]="bulkSelectionService.isCardSelected('chapter', idx)" [allowSelection]="true"></app-card-item>+ </ng-container></div></ng-template></li><li [ngbNavItem]="TabID.Volumes" *ngIf="volumes.length > 0"><a ngbNavLink>{{libraryType === LibraryType.Book ? 'Books': 'Volumes'}}</a><ng-template ngbNavContent>- <div class="row g-0">- <ng-container *ngFor="let volume of volumes; let idx = index; trackBy: trackByVolumeIdentity">- <app-card-item class="col-auto p-2" [entity]="volume" [title]="volume.name" (click)="openVolume(volume)"- [imageUrl]="imageService.getVolumeCoverImage(volume.id) + '&offset=' + coverImageOffset"- [read]="volume.pagesRead" [total]="volume.pages" [actions]="volumeActions" (selection)="bulkSelectionService.handleCardSelection('volume', idx, volumes.length, $event)" [selected]="bulkSelectionService.isCardSelected('volume', idx)" [allowSelection]="true"></app-card-item>- </ng-container>+ <div class="card-container row g-0">+ <ng-container *ngFor="let item of volumes; let idx = index; trackBy: trackByVolumeIdentity">+ <app-card-item class="col-auto mt-2 mb-2" [entity]="item" [title]="item.name" (click)="openVolume(item)"+ [imageUrl]="imageService.getVolumeCoverImage(item.id) + '&offset=' + coverImageOffset"+ [read]="item.pagesRead" [total]="item.pages" [actions]="volumeActions"+ (selection)="bulkSelectionService.handleCardSelection('volume', idx, volumes.length, $event)"+ [selected]="bulkSelectionService.isCardSelected('volume', idx)" [allowSelection]="true">+ </app-card-item>+ </ng-container></div></ng-template></li><li [ngbNavItem]="TabID.Chapters" *ngIf="chapters.length > 0"><a ngbNavLink>{{utilityService.formatChapterName(libraryType) + 's'}}</a><ng-template ngbNavContent>- <div class="row g-0">- <ng-container *ngFor="let chapter of chapters; let idx = index; trackBy: trackByChapterIdentity">- <app-card-item class="col-auto p-2" *ngIf="!chapter.isSpecial" [entity]="chapter" [title]="chapter.title" (click)="openChapter(chapter)"- [imageUrl]="imageService.getChapterCoverImage(chapter.id) + '&offset=' + coverImageOffset"- [read]="chapter.pagesRead" [total]="chapter.pages" [actions]="chapterActions" (selection)="bulkSelectionService.handleCardSelection('chapter', idx, chapters.length, $event)" [selected]="bulkSelectionService.isCardSelected('chapter', idx)" [allowSelection]="true"></app-card-item>+ <div class="card-container row g-0">+ <ng-container *ngFor="let item of chapters; let idx = index; trackBy: trackByChapterIdentity">+ <app-card-item class="col-auto mt-2 mb-2" *ngIf="!item.isSpecial" [entity]="item" [title]="item.title" (click)="openChapter(item)"+ [imageUrl]="imageService.getChapterCoverImage(item.id) + '&offset=' + coverImageOffset"+ [read]="item.pagesRead" [total]="item.pages" [actions]="chapterActions"+ (selection)="bulkSelectionService.handleCardSelection('chapter', idx, chapters.length, $event)"+ [selected]="bulkSelectionService.isCardSelected('chapter', idx)" [allowSelection]="true"></app-card-item>+ </ng-container>+ </div>+ </ng-template>+ </li>+ <li [ngbNavItem]="TabID.Specials" *ngIf="hasSpecials">+ <a ngbNavLink>Specials</a>+ <ng-template ngbNavContent>+ <div class="card-container row g-0">+ <ng-container *ngFor="let item of specials; let idx = index; trackBy: trackByChapterIdentity">+ <app-card-item class="col-auto mt-2 mb-2" [entity]="item" [title]="item.title || item.range" (click)="openChapter(item)"+ [imageUrl]="imageService.getChapterCoverImage(item.id)"+ [read]="item.pagesRead" [total]="item.pages" [actions]="chapterActions"+ (selection)="bulkSelectionService.handleCardSelection('special', idx, chapters.length, $event)"+ [selected]="bulkSelectionService.isCardSelected('special', idx)" [allowSelection]="true"></app-card-item>+ </ng-container>+ </div>+ </ng-template>+ </li>+ <li [ngbNavItem]="TabID.Related" *ngIf="hasRelations">+ <a ngbNavLink>Related</a>+ <ng-template ngbNavContent>+ <div class="card-container row g-0">+ <ng-container *ngFor="let item of relations; let idx = index; trackBy: trackByRelatedSeriesIdentiy">+ <app-series-card class="col-auto mt-2 mb-2" [data]="item.series" [libraryId]="item.series.libraryId" [relation]="item.relation"></app-series-card></ng-container></div></ng-template>diff --git a/UI/Web/src/app/series-detail/series-detail.component.scss b/UI/Web/src/app/series-detail/series-detail.component.scssindex 472579f96..627e77e7b 100644--- a/UI/Web/src/app/series-detail/series-detail.component.scss+++ b/UI/Web/src/app/series-detail/series-detail.component.scss@@ -5,4 +5,11 @@.rating-star {margin-top: 2px;font-size: 1.5rem;-}\ No newline at end of file+}++.card-container{+ display: grid;+ grid-template-columns: repeat(auto-fill, 158px);+ grid-gap: 0.5rem;+ justify-content: space-around;+}diff --git a/UI/Web/src/app/series-detail/series-detail.component.ts b/UI/Web/src/app/series-detail/series-detail.component.tsindex 5471b9573..2e1a1db29 100644--- a/UI/Web/src/app/series-detail/series-detail.component.ts+++ b/UI/Web/src/app/series-detail/series-detail.component.ts@@ -1,10 +1,10 @@import { Component, HostListener, OnDestroy, OnInit } from '@angular/core';import { Title } from '@angular/platform-browser';import { ActivatedRoute, Router } from '@angular/router';-import { NgbModal, NgbNavChangeEvent, NgbRatingConfig } from '@ng-bootstrap/ng-bootstrap';+import { NgbModal, NgbNavChangeEvent } from '@ng-bootstrap/ng-bootstrap';import { ToastrService } from 'ngx-toastr';import { forkJoin, Subject } from 'rxjs';-import { finalize, map, take, takeUntil, takeWhile } from 'rxjs/operators';+import { finalize, take, takeUntil, takeWhile } from 'rxjs/operators';import { BulkSelectionService } from '../cards/bulk-selection.service';import { CardDetailsModalComponent } from '../cards/_modals/card-details-modal/card-details-modal.component';import { EditSeriesModalComponent } from '../cards/_modals/edit-series-modal/edit-series-modal.component';@@ -13,7 +13,7 @@ import { ConfirmService } from '../shared/confirm.service';import { TagBadgeCursor } from '../shared/tag-badge/tag-badge.component';import { DownloadService } from '../shared/_services/download.service';import { KEY_CODES, UtilityService } from '../shared/_services/utility.service';-import { ReviewSeriesModalComponent } from '../_modals/review-series-modal/review-series-modal.component';+import { ReviewSeriesModalComponent } from './review-series-modal/review-series-modal.component';import { Chapter } from '../_models/chapter';import { ScanSeriesEvent } from '../_models/events/scan-series-event';import { SeriesRemovedEvent } from '../_models/events/series-removed-event';@@ -33,9 +33,16 @@ import { ReaderService } from '../_services/reader.service';import { ReadingListService } from '../_services/reading-list.service';import { SeriesService } from '../_services/series.service';import { NavService } from '../_services/nav.service';+import { RelatedSeries } from '../_models/series-detail/related-series';+import { RelationKind } from '../_models/series-detail/relation-kind';+interface RelatedSeris {+ series: Series;+ relation: RelationKind;+}enum TabID {+ Related = 0,Specials = 1,Storyline = 2,Volumes = 3,@@ -106,6 +113,16 @@ export class SeriesDetailComponent implements OnInit, OnDestroy {* Track by function for Chapter to tell when to refresh card data*/trackByChapterIdentity = (index: number, item: Chapter) => `${item.title}_${item.number}_${item.pagesRead}`;+ trackByRelatedSeriesIdentiy = (index: number, item: RelatedSeris) => `${item.series.name}_${item.series.libraryId}_${item.series.pagesRead}_${item.relation}`;++ /**+ * Are there any related series+ */+ hasRelations: boolean = false;+ /**+ * Related Series. Sorted by backend+ */+ relations: Array<RelatedSeris> = [];bulkActionCallback = (action: Action, data: any) => {if (this.series === undefined) {@@ -117,7 +134,11 @@ export class SeriesDetailComponent implements OnInit, OnDestroy {const selectedChapterIndexes = this.bulkSelectionService.getSelectedCardsForSource('chapter');const selectedSpecialIndexes = this.bulkSelectionService.getSelectedCardsForSource('special');- const selectedChapterIds = this.chapters.filter((_chapter, index: number) => selectedChapterIndexes.includes(index + ''));+ // NOTE: This needs to check current tab as chapter array will be different+ let chapterArray = this.storyChapters;+ if (this.activeTabId === TabID.Chapters) chapterArray = this.chapters;++ const selectedChapterIds = chapterArray.filter((_chapter, index: number) => selectedChapterIndexes.includes(index + ''));const selectedVolumeIds = this.volumes.filter((_volume, index: number) => selectedVolumeIndexes.includes(index + ''));const selectedSpecials = this.specials.filter((_chapter, index: number) => selectedSpecialIndexes.includes(index + ''));const chapters = [...selectedChapterIds, ...selectedSpecials];@@ -263,9 +284,6 @@ export class SeriesDetailComponent implements OnInit, OnDestroy {case(Action.Delete):this.deleteSeries(series);break;- case(Action.Bookmarks):- this.actionService.openBookmarkModal(series, () => this.actionInProgress = false);- break;case(Action.AddToReadingList):this.actionService.addSeriesToReadingList(series, () => this.actionInProgress = false);break;@@ -359,6 +377,27 @@ export class SeriesDetailComponent implements OnInit, OnDestroy {this.volumeActions = this.actionFactoryService.getVolumeActions(this.handleVolumeActionCallback.bind(this));this.chapterActions = this.actionFactoryService.getChapterActions(this.handleChapterActionCallback.bind(this));+ // TODO: Move this to a forkJoin?+ this.seriesService.getRelatedForSeries(this.seriesId).subscribe((relations: RelatedSeries) => {+ this.relations = [+ ...relations.prequels.map(item => this.createRelatedSeries(item, RelationKind.Prequel)),+ ...relations.sequels.map(item => this.createRelatedSeries(item, RelationKind.Sequel)),+ ...relations.sideStories.map(item => this.createRelatedSeries(item, RelationKind.SideStory)),+ ...relations.spinOffs.map(item => this.createRelatedSeries(item, RelationKind.SpinOff)),+ ...relations.adaptations.map(item => this.createRelatedSeries(item, RelationKind.Adaptation)),+ ...relations.contains.map(item => this.createRelatedSeries(item, RelationKind.Contains)),+ ...relations.characters.map(item => this.createRelatedSeries(item, RelationKind.Character)),+ ...relations.others.map(item => this.createRelatedSeries(item, RelationKind.Other)),+ ...relations.alternativeSettings.map(item => this.createRelatedSeries(item, RelationKind.AlternativeSetting)),+ ...relations.alternativeVersions.map(item => this.createRelatedSeries(item, RelationKind.AlternativeVersion)),+ ...relations.doujinshis.map(item => this.createRelatedSeries(item, RelationKind.Doujinshi)),+ ...relations.parent.map(item => this.createRelatedSeries(item, RelationKind.Parent)),+ ];+ if (this.relations.length > 0) {+ this.hasRelations = true;+ }+ });+this.seriesService.getSeriesDetail(this.seriesId).subscribe(detail => {this.hasSpecials = detail.specials.length > 0;this.specials = detail.specials;@@ -375,6 +414,10 @@ export class SeriesDetailComponent implements OnInit, OnDestroy {});}+ createRelatedSeries(series: Series, relation: RelationKind) {+ return {series, relation} as RelatedSeris;+ }+/*** This will update the selected tab*diff --git a/UI/Web/src/app/series-detail/series-detail.module.ts b/UI/Web/src/app/series-detail/series-detail.module.tsnew file mode 100644index 000000000..8d881c346--- /dev/null+++ b/UI/Web/src/app/series-detail/series-detail.module.ts@@ -0,0 +1,38 @@+import { NgModule } from '@angular/core';+import { CommonModule } from '@angular/common';+import { SeriesDetailRoutingModule } from './series-detail-routing.module';+import { NgbCollapseModule, NgbNavModule, NgbRatingModule } from '@ng-bootstrap/ng-bootstrap';+import { SeriesDetailComponent } from './series-detail.component';+import { SeriesMetadataDetailComponent } from './series-metadata-detail/series-metadata-detail.component';+import { ReviewSeriesModalComponent } from './review-series-modal/review-series-modal.component';+import { SharedModule } from '../shared/shared.module';+import { TypeaheadModule } from '../typeahead/typeahead.module';+import { PipeModule } from '../pipe/pipe.module';+import { ReactiveFormsModule } from '@angular/forms';+import { SharedSideNavCardsModule } from '../shared-side-nav-cards/shared-side-nav-cards.module';++++@NgModule({+ declarations: [+ SeriesDetailComponent,+ ReviewSeriesModalComponent,+ SeriesMetadataDetailComponent+ ],+ imports: [+ CommonModule,+ ReactiveFormsModule, // Review Series Modal++ NgbCollapseModule, // Series Metadata+ NgbNavModule,+ NgbRatingModule,++ TypeaheadModule,+ PipeModule,+ SharedModule, // person badge, badge expander (these 2 can be their own module)+ SharedSideNavCardsModule,++ SeriesDetailRoutingModule+ ]+})+export class SeriesDetailModule { }diff --git a/UI/Web/src/app/series-metadata-detail/series-metadata-detail.component.html b/UI/Web/src/app/series-detail/series-metadata-detail/series-metadata-detail.component.htmlsimilarity index 76%rename from UI/Web/src/app/series-metadata-detail/series-metadata-detail.component.htmlrename to UI/Web/src/app/series-detail/series-metadata-detail/series-metadata-detail.component.htmlindex 02a554d44..07bf0c48e 100644--- a/UI/Web/src/app/series-metadata-detail/series-metadata-detail.component.html+++ b/UI/Web/src/app/series-detail/series-metadata-detail/series-metadata-detail.component.html@@ -4,12 +4,16 @@<!-- This first row will have random information about the series--><div class="row g-0 mb-2">- <app-tag-badge title="Age Rating" *ngIf="seriesMetadata.ageRating" a11y-click="13,32" class="clickable col-auto" (click)="goTo('ageRating', seriesMetadata.ageRating)" [selectionMode]="TagBadgeCursor.Clickable">{{metadataService.getAgeRating(this.seriesMetadata.ageRating) | async}}</app-tag-badge>+ <app-tag-badge title="Age Rating" *ngIf="seriesMetadata.ageRating" a11y-click="13,32" class="clickable col-auto" (click)="goTo(FilterQueryParam.AgeRating, seriesMetadata.ageRating)" [selectionMode]="TagBadgeCursor.Clickable">{{metadataService.getAgeRating(this.seriesMetadata.ageRating) | async}}</app-tag-badge><ng-container *ngIf="series"><app-tag-badge *ngIf="seriesMetadata.releaseYear > 0" title="Release date" class="col-auto">{{seriesMetadata.releaseYear}}</app-tag-badge>- <app-tag-badge *ngIf="seriesMetadata.language !== null && seriesMetadata.language !== ''" title="Language" a11y-click="13,32" class="col-auto" (click)="goTo('languages', seriesMetadata.language)" [selectionMode]="TagBadgeCursor.Clickable">{{seriesMetadata.language}}</app-tag-badge>- <app-tag-badge title="Publication Status" a11y-click="13,32" class="col-auto" (click)="goTo('publicationStatus', seriesMetadata.publicationStatus)" [selectionMode]="TagBadgeCursor.Clickable">{{seriesMetadata.publicationStatus | publicationStatus}}</app-tag-badge>- <app-tag-badge a11y-click="13,32" class="col-auto" (click)="goTo('format', series.format)" [selectionMode]="TagBadgeCursor.Clickable">+ <app-tag-badge *ngIf="seriesMetadata.language !== null && seriesMetadata.language !== ''" title="Language" a11y-click="13,32" class="col-auto" (click)="goTo(FilterQueryParam.Languages, seriesMetadata.language)" [selectionMode]="TagBadgeCursor.Clickable">{{seriesMetadata.language}}</app-tag-badge>++ <app-tag-badge title="Publication Status ({{seriesMetadata.maxCount}} / {{seriesMetadata.totalCount}})" [fillStyle]="seriesMetadata.maxCount != 0 && seriesMetadata.totalCount != 0 && seriesMetadata.maxCount >= seriesMetadata.totalCount ? 'filled' : 'outline'" a11y-click="13,32" class="col-auto"+ (click)="goTo(FilterQueryParam.PublicationStatus, seriesMetadata.publicationStatus)"+ [selectionMode]="TagBadgeCursor.Clickable">{{seriesMetadata.publicationStatus | publicationStatus}}</app-tag-badge>++ <app-tag-badge a11y-click="13,32" class="col-auto" (click)="goTo(FilterQueryParam.Format, series.format)" [selectionMode]="TagBadgeCursor.Clickable"><app-series-format [format]="series.format">{{utilityService.mangaFormat(series.format)}}</app-series-format></app-tag-badge><app-tag-badge title="Last Read" class="col-auto" *ngIf="series.latestReadDate && series.latestReadDate !== '' && (series.latestReadDate | date: 'shortDate') !== '1/1/01'" [selectionMode]="TagBadgeCursor.Selectable">@@ -25,7 +29,19 @@<div class="col-md-8"><app-badge-expander [items]="seriesMetadata.genres"><ng-template #badgeExpanderItem let-item let-position="idx">- <app-tag-badge a11y-click="13,32" class="col-auto" (click)="goTo('genres', item.id)" [selectionMode]="TagBadgeCursor.Clickable">{{item.title}}</app-tag-badge>+ <app-tag-badge a11y-click="13,32" class="col-auto" (click)="goTo(FilterQueryParam.Genres, item.id)" [selectionMode]="TagBadgeCursor.Clickable">{{item.title}}</app-tag-badge>+ </ng-template>+ </app-badge-expander>+ </div>+</div>+<div class="row g-0" *ngIf="seriesMetadata.tags && seriesMetadata.tags.length > 0">+ <div class="col-md-4">+ <h5>Tags</h5>+ </div>+ <div class="col-md-8">+ <app-badge-expander [items]="seriesMetadata.tags">+ <ng-template #badgeExpanderItem let-item let-position="idx">+ <app-tag-badge a11y-click="13,32" class="col-auto" (click)="goTo(FilterQueryParam.Tags, item.id)" [selectionMode]="TagBadgeCursor.Clickable">{{item.title}}</app-tag-badge></ng-template></app-badge-expander></div>@@ -70,7 +86,7 @@<div class="col-md-8"><app-badge-expander [items]="seriesMetadata.writers"><ng-template #badgeExpanderItem let-item let-position="idx">- <app-person-badge a11y-click="13,32" class="col-auto" (click)="goTo('writers', item.id)" [person]="item"></app-person-badge>+ <app-person-badge a11y-click="13,32" class="col-auto" (click)="goTo(FilterQueryParam.Writers, item.id)" [person]="item"></app-person-badge></ng-template></app-badge-expander></div>@@ -89,7 +105,7 @@<div class="col-md-8"><app-badge-expander [items]="seriesMetadata.coverArtists"><ng-template #badgeExpanderItem let-item let-position="idx">- <app-person-badge a11y-click="13,32" class="col-auto" (click)="goTo('coverArtists', item.id)" [person]="item"></app-person-badge>+ <app-person-badge a11y-click="13,32" class="col-auto" (click)="goTo(FilterQueryParam.CoverArtists, item.id)" [person]="item"></app-person-badge></ng-template></app-badge-expander></div>@@ -102,7 +118,7 @@<div class="col-md-8"><app-badge-expander [items]="seriesMetadata.characters"><ng-template #badgeExpanderItem let-item let-position="idx">- <app-person-badge a11y-click="13,32" class="col-auto" (click)="goTo('character', item.id)" [person]="item"></app-person-badge>+ <app-person-badge a11y-click="13,32" class="col-auto" (click)="goTo(FilterQueryParam.Character, item.id)" [person]="item"></app-person-badge></ng-template></app-badge-expander></div>@@ -115,7 +131,7 @@<div class="col-md-8"><app-badge-expander [items]="seriesMetadata.colorists"><ng-template #badgeExpanderItem let-item let-position="idx">- <app-person-badge a11y-click="13,32" class="col-auto" (click)="goTo('colorist', item.id)" [person]="item"></app-person-badge>+ <app-person-badge a11y-click="13,32" class="col-auto" (click)="goTo(FilterQueryParam.Colorist, item.id)" [person]="item"></app-person-badge></ng-template></app-badge-expander></div>@@ -128,7 +144,7 @@<div class="col-md-8"><app-badge-expander [items]="seriesMetadata.editors"><ng-template #badgeExpanderItem let-item let-position="idx">- <app-person-badge a11y-click="13,32" class="col-auto" (click)="goTo('editor', item.id)" [person]="item"></app-person-badge>+ <app-person-badge a11y-click="13,32" class="col-auto" (click)="goTo(FilterQueryParam.Editor, item.id)" [person]="item"></app-person-badge></ng-template></app-badge-expander></div>@@ -141,7 +157,7 @@<div class="col-md-8"><app-badge-expander [items]="seriesMetadata.inkers"><ng-template #badgeExpanderItem let-item let-position="idx">- <app-person-badge a11y-click="13,32" class="col-auto" (click)="goTo('inker', item.id)" [person]="item"></app-person-badge>+ <app-person-badge a11y-click="13,32" class="col-auto" (click)="goTo(FilterQueryParam.Inker, item.id)" [person]="item"></app-person-badge></ng-template></app-badge-expander></div>@@ -154,19 +170,7 @@<div class="col-md-8"><app-badge-expander [items]="seriesMetadata.letterers"><ng-template #badgeExpanderItem let-item let-position="idx">- <app-person-badge a11y-click="13,32" class="col-auto" (click)="goTo('letterer', item.id)" [person]="item"></app-person-badge>- </ng-template>- </app-badge-expander>- </div>- </div>- <div class="row g-0" *ngIf="seriesMetadata.tags && seriesMetadata.tags.length > 0">- <div class="col-md-4">- <h5>Tags</h5>- </div>- <div class="col-md-8">- <app-badge-expander [items]="seriesMetadata.tags">- <ng-template #badgeExpanderItem let-item let-position="idx">- <app-tag-badge a11y-click="13,32" class="col-auto" (click)="goTo('tags', item.id)" [selectionMode]="TagBadgeCursor.Clickable">{{item.title}}</app-tag-badge>+ <app-person-badge a11y-click="13,32" class="col-auto" (click)="goTo(FilterQueryParam.Letterer, item.id)" [person]="item"></app-person-badge></ng-template></app-badge-expander></div>@@ -178,7 +182,7 @@<div class="col-md-8"><app-badge-expander [items]="seriesMetadata.translators"><ng-template #badgeExpanderItem let-item let-position="idx">- <app-person-badge a11y-click="13,32" class="col-auto" (click)="goTo('translators', item.id)" [person]="item"></app-person-badge>+ <app-person-badge a11y-click="13,32" class="col-auto" (click)="goTo(FilterQueryParam.Translator, item.id)" [person]="item"></app-person-badge></ng-template></app-badge-expander></div>@@ -191,7 +195,7 @@<div class="col-md-8"><app-badge-expander [items]="seriesMetadata.pencillers"><ng-template #badgeExpanderItem let-item let-position="idx">- <app-person-badge a11y-click="13,32" class="col-auto" (click)="goTo('penciller', item.id)" [person]="item"></app-person-badge>+ <app-person-badge a11y-click="13,32" class="col-auto" (click)="goTo(FilterQueryParam.Penciller, item.id)" [person]="item"></app-person-badge></ng-template></app-badge-expander></div>@@ -204,7 +208,7 @@<div class="col-md-8"><app-badge-expander [items]="seriesMetadata.publishers"><ng-template #badgeExpanderItem let-item let-position="idx">- <app-person-badge a11y-click="13,32" class="col-auto" (click)="goTo('publisher', item.id)" [person]="item"></app-person-badge>+ <app-person-badge a11y-click="13,32" class="col-auto" (click)="goTo(FilterQueryParam.Publisher, item.id)" [person]="item"></app-person-badge></ng-template></app-badge-expander></div>diff --git a/UI/Web/src/app/series-metadata-detail/series-metadata-detail.component.scss b/UI/Web/src/app/series-detail/series-metadata-detail/series-metadata-detail.component.scsssimilarity index 100%rename from UI/Web/src/app/series-metadata-detail/series-metadata-detail.component.scssrename to UI/Web/src/app/series-detail/series-metadata-detail/series-metadata-detail.component.scssdiff --git a/UI/Web/src/app/series-metadata-detail/series-metadata-detail.component.ts b/UI/Web/src/app/series-detail/series-metadata-detail/series-metadata-detail.component.tssimilarity index 76%rename from UI/Web/src/app/series-metadata-detail/series-metadata-detail.component.tsrename to UI/Web/src/app/series-detail/series-metadata-detail/series-metadata-detail.component.tsindex f5a505780..1993be51a 100644--- a/UI/Web/src/app/series-metadata-detail/series-metadata-detail.component.ts+++ b/UI/Web/src/app/series-detail/series-metadata-detail/series-metadata-detail.component.ts@@ -1,12 +1,13 @@import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core';import { Router } from '@angular/router';-import { TagBadgeCursor } from '../shared/tag-badge/tag-badge.component';-import { UtilityService } from '../shared/_services/utility.service';-import { MangaFormat } from '../_models/manga-format';-import { ReadingList } from '../_models/reading-list';-import { Series } from '../_models/series';-import { SeriesMetadata } from '../_models/series-metadata';-import { MetadataService } from '../_services/metadata.service';+import { TagBadgeCursor } from '../../shared/tag-badge/tag-badge.component';+import { FilterQueryParam } from '../../shared/_services/filter-utilities.service';+import { UtilityService } from '../../shared/_services/utility.service';+import { MangaFormat } from '../../_models/manga-format';+import { ReadingList } from '../../_models/reading-list';+import { Series } from '../../_models/series';+import { SeriesMetadata } from '../../_models/series-metadata';+import { MetadataService } from '../../_services/metadata.service';@Component({selector: 'app-series-metadata-detail',@@ -38,6 +39,10 @@ export class SeriesMetadataDetailComponent implements OnInit, OnChanges {return TagBadgeCursor;}+ get FilterQueryParam() {+ return FilterQueryParam;+ }+constructor(public utilityService: UtilityService, public metadataService: MetadataService, private router: Router) { }ngOnChanges(changes: SimpleChanges): void {@@ -64,10 +69,10 @@ export class SeriesMetadataDetailComponent implements OnInit, OnChanges {this.isCollapsed = !this.isCollapsed;}- goTo(queryParamName: string, filter: any) {+ goTo(queryParamName: FilterQueryParam, filter: any) {let params: any = {};params[queryParamName] = filter;- params['page'] = 1;+ params[FilterQueryParam.Page] = 1;this.router.navigate(['library', this.series.libraryId], {queryParams: params});}diff --git a/UI/Web/src/app/shared-side-nav-cards/shared-side-nav-cards.module.ts b/UI/Web/src/app/shared-side-nav-cards/shared-side-nav-cards.module.tsnew file mode 100644index 000000000..226a2a096--- /dev/null+++ b/UI/Web/src/app/shared-side-nav-cards/shared-side-nav-cards.module.ts@@ -0,0 +1,23 @@+import { NgModule } from '@angular/core';+import { CommonModule } from '@angular/common';+import { CardsModule } from '../cards/cards.module';+import { SidenavModule } from '../sidenav/sidenav.module';+++/**+ * Exports SideNavModule and CardsModule+ */+@NgModule({+ declarations: [],+ imports: [+ CommonModule,++ CardsModule,+ SidenavModule,+ ],+ exports: [+ CardsModule,+ SidenavModule+ ]+})+export class SharedSideNavCardsModule { }diff --git a/UI/Web/src/app/shared/_services/filter-utilities.service.ts b/UI/Web/src/app/shared/_services/filter-utilities.service.tsnew file mode 100644index 000000000..5460c7fe0--- /dev/null+++ b/UI/Web/src/app/shared/_services/filter-utilities.service.ts@@ -0,0 +1,307 @@+import { Injectable } from '@angular/core';+import { ActivatedRoute, ActivatedRouteSnapshot } from '@angular/router';+import { Pagination } from 'src/app/_models/pagination';+import { SeriesFilter, SortField } from 'src/app/_models/series-filter';+import { SeriesService } from 'src/app/_services/series.service';++/**+ * Used to pass state between the filter and the url+ */+export enum FilterQueryParam {+ Format = 'format',+ Genres = 'genres',+ AgeRating = 'ageRating',+ PublicationStatus = 'publicationStatus',+ Tags = 'tags',+ Languages = 'languages',+ CollectionTags = 'collectionTags',+ Libraries = 'libraries',+ Writers = 'writers',+ Artists = 'artists',+ Character = 'character',+ Colorist = 'colorist',+ CoverArtists = 'coverArtists',+ Editor = 'editor',+ Inker = 'inker',+ Letterer = 'letterer',+ Penciller = 'penciller',+ Publisher = 'publisher',+ Translator = 'translators',+ ReadStatus = 'readStatus',+ SortBy = 'sortBy',+ Rating = 'rating',+ Name = 'name',+ /**+ * This is a pagination control+ */+ Page = 'page'+}++@Injectable({+ providedIn: 'root'+})+export class FilterUtilitiesService {++ constructor(private route: ActivatedRoute, private seriesService: SeriesService) { }++ /**+ * Updates the window location with a custom url based on filter and pagination objects+ * @param pagination+ * @param filter+ */+ updateUrlFromFilter(pagination: Pagination, filter: SeriesFilter | undefined) {+ const params = '?page=' + pagination.currentPage;++ const url = this.urlFromFilter(window.location.href.split('?')[0] + params, filter);+ window.history.replaceState(window.location.href, '', this.replacePaginationOnUrl(url, pagination));+ }++ /**+ * Patches the page query param in the window location.+ * @param pagination+ */+ updateUrlFromPagination(pagination: Pagination) {+ window.history.replaceState(window.location.href, '', this.replacePaginationOnUrl(window.location.href, pagination));+ }++ private replacePaginationOnUrl(url: string, pagination: Pagination) {+ return url.replace(/page=\d+/i, 'page=' + pagination.currentPage);+ }++ /**+ * Will fetch current page from route if present+ * @param ActivatedRouteSnapshot to fetch page from. Must be from component else may get stale data+ * @returns A default pagination object+ */+ pagination(snapshot: ActivatedRouteSnapshot): Pagination {+ return {currentPage: parseInt(snapshot.queryParamMap.get('page') || '1', 10), itemsPerPage: 30, totalItems: 0, totalPages: 1};+ }+++ /**+ * Returns the current url with query params for the filter+ * @param currentUrl Full url, with ?page=1 as a minimum+ * @param filter Filter to build url off+ * @returns current url with query params added+ */+ urlFromFilter(currentUrl: string, filter: SeriesFilter | undefined) {+ if (filter === undefined) return currentUrl;+ let params = '';++ params += this.joinFilter(filter.formats, FilterQueryParam.Format);+ params += this.joinFilter(filter.genres, FilterQueryParam.Genres);+ params += this.joinFilter(filter.ageRating, FilterQueryParam.AgeRating);+ params += this.joinFilter(filter.publicationStatus, FilterQueryParam.PublicationStatus);+ params += this.joinFilter(filter.tags, FilterQueryParam.Tags);+ params += this.joinFilter(filter.languages, FilterQueryParam.Languages);+ params += this.joinFilter(filter.collectionTags, FilterQueryParam.CollectionTags);+ params += this.joinFilter(filter.libraries, FilterQueryParam.Libraries);++ params += this.joinFilter(filter.writers, FilterQueryParam.Writers);+ params += this.joinFilter(filter.artists, FilterQueryParam.Artists);+ params += this.joinFilter(filter.character, FilterQueryParam.Character);+ params += this.joinFilter(filter.colorist, FilterQueryParam.Colorist);+ params += this.joinFilter(filter.coverArtist, FilterQueryParam.CoverArtists);+ params += this.joinFilter(filter.editor, FilterQueryParam.Editor);+ params += this.joinFilter(filter.inker, FilterQueryParam.Inker);+ params += this.joinFilter(filter.letterer, FilterQueryParam.Letterer);+ params += this.joinFilter(filter.penciller, FilterQueryParam.Penciller);+ params += this.joinFilter(filter.publisher, FilterQueryParam.Publisher);+ params += this.joinFilter(filter.translators, FilterQueryParam.Translator);++ // readStatus (we need to do an additonal check as there is a default case)+ if (filter.readStatus && filter.readStatus.inProgress !== true && filter.readStatus.notRead !== true && filter.readStatus.read !== true) {+ params += `&${FilterQueryParam.ReadStatus}=${filter.readStatus.inProgress},${filter.readStatus.notRead},${filter.readStatus.read}`;+ }++ // sortBy (additional check to not save to url if default case)+ if (filter.sortOptions && !(filter.sortOptions.sortField === SortField.SortName && filter.sortOptions.isAscending === true)) {+ params += `&${FilterQueryParam.SortBy}=${filter.sortOptions.sortField},${filter.sortOptions.isAscending}`;+ }++ if (filter.rating > 0) {+ params += `&${FilterQueryParam.Rating}=${filter.rating}`;+ }++ if (filter.seriesNameQuery !== '') {+ params += `&${FilterQueryParam.Name}=${encodeURIComponent(filter.seriesNameQuery)}`;+ }++ return currentUrl + params;+ }++ private joinFilter(filterProp: Array<any>, key: string) {+ let params = '';+ if (filterProp.length > 0) {+ params += `&${key}=${filterProp.join(',')}`;+ }+ return params;+ }++ /**+ * Returns a new instance of a filterSettings that is populated with filter presets from URL+ * @param ActivatedRouteSnapshot to fetch page from. Must be from component else may get stale data+ * @returns The Preset filter and if something was set within+ */+ filterPresetsFromUrl(snapshot: ActivatedRouteSnapshot): [SeriesFilter, boolean] {+ const filter = this.seriesService.createSeriesFilter();+ let anyChanged = false;++ const format = snapshot.queryParamMap.get(FilterQueryParam.Format);+ if (format !== undefined && format !== null) {+ filter.formats = [...filter.formats, ...format.split(',').map(item => parseInt(item, 10))];+ anyChanged = true;+ }++ const genres = snapshot.queryParamMap.get(FilterQueryParam.Genres);+ if (genres !== undefined && genres !== null) {+ filter.genres = [...filter.genres, ...genres.split(',').map(item => parseInt(item, 10))];+ anyChanged = true;+ }++ const ageRating = snapshot.queryParamMap.get(FilterQueryParam.AgeRating);+ if (ageRating !== undefined && ageRating !== null) {+ filter.ageRating = [...filter.ageRating, ...ageRating.split(',').map(item => parseInt(item, 10))];+ anyChanged = true;+ }++ const publicationStatus = snapshot.queryParamMap.get(FilterQueryParam.PublicationStatus);+ if (publicationStatus !== undefined && publicationStatus !== null) {+ filter.publicationStatus = [...filter.publicationStatus, ...publicationStatus.split(',').map(item => parseInt(item, 10))];+ anyChanged = true;+ }++ const tags = snapshot.queryParamMap.get(FilterQueryParam.Tags);+ if (tags !== undefined && tags !== null) {+ filter.tags = [...filter.tags, ...tags.split(',').map(item => parseInt(item, 10))];+ anyChanged = true;+ }++ const languages = snapshot.queryParamMap.get(FilterQueryParam.Languages);+ if (languages !== undefined && languages !== null) {+ filter.languages = [...filter.languages, ...languages.split(',')];+ anyChanged = true;+ }++ const writers = snapshot.queryParamMap.get(FilterQueryParam.Writers);+ if (writers !== undefined && writers !== null) {+ filter.writers = [...filter.writers, ...writers.split(',').map(item => parseInt(item, 10))];+ anyChanged = true;+ }++ const artists = snapshot.queryParamMap.get(FilterQueryParam.Artists);+ if (artists !== undefined && artists !== null) {+ filter.artists = [...filter.artists, ...artists.split(',').map(item => parseInt(item, 10))];+ anyChanged = true;+ }++ const character = snapshot.queryParamMap.get(FilterQueryParam.Character);+ if (character !== undefined && character !== null) {+ filter.character = [...filter.character, ...character.split(',').map(item => parseInt(item, 10))];+ anyChanged = true;+ }++ const colorist = snapshot.queryParamMap.get(FilterQueryParam.Colorist);+ if (colorist !== undefined && colorist !== null) {+ filter.colorist = [...filter.colorist, ...colorist.split(',').map(item => parseInt(item, 10))];+ anyChanged = true;+ }++ const coverArtists = snapshot.queryParamMap.get(FilterQueryParam.CoverArtists);+ if (coverArtists !== undefined && coverArtists !== null) {+ filter.coverArtist = [...filter.coverArtist, ...coverArtists.split(',').map(item => parseInt(item, 10))];+ anyChanged = true;+ }++ const editor = snapshot.queryParamMap.get(FilterQueryParam.Editor);+ if (editor !== undefined && editor !== null) {+ filter.editor = [...filter.editor, ...editor.split(',').map(item => parseInt(item, 10))];+ anyChanged = true;+ }++ const inker = snapshot.queryParamMap.get(FilterQueryParam.Inker);+ if (inker !== undefined && inker !== null) {+ filter.inker = [...filter.inker, ...inker.split(',').map(item => parseInt(item, 10))];+ anyChanged = true;+ }++ const letterer = snapshot.queryParamMap.get(FilterQueryParam.Letterer);+ if (letterer !== undefined && letterer !== null) {+ filter.letterer = [...filter.letterer, ...letterer.split(',').map(item => parseInt(item, 10))];+ anyChanged = true;+ }++ const penciller = snapshot.queryParamMap.get(FilterQueryParam.Penciller);+ if (penciller !== undefined && penciller !== null) {+ filter.penciller = [...filter.penciller, ...penciller.split(',').map(item => parseInt(item, 10))];+ anyChanged = true;+ }++ const publisher = snapshot.queryParamMap.get(FilterQueryParam.Publisher);+ if (publisher !== undefined && publisher !== null) {+ filter.publisher = [...filter.publisher, ...publisher.split(',').map(item => parseInt(item, 10))];+ anyChanged = true;+ }++ const translators = snapshot.queryParamMap.get(FilterQueryParam.Translator);+ if (translators !== undefined && translators !== null) {+ filter.translators = [...filter.translators, ...translators.split(',').map(item => parseInt(item, 10))];+ anyChanged = true;+ }++ const libraries = snapshot.queryParamMap.get(FilterQueryParam.Libraries);+ if (libraries !== undefined && libraries !== null) {+ filter.libraries = [...filter.libraries, ...libraries.split(',').map(item => parseInt(item, 10))];+ anyChanged = true;+ }++ const collectionTags = snapshot.queryParamMap.get(FilterQueryParam.CollectionTags);+ if (collectionTags !== undefined && collectionTags !== null) {+ filter.collectionTags = [...filter.collectionTags, ...collectionTags.split(',').map(item => parseInt(item, 10))];+ anyChanged = true;+ }++ // Rating, seriesName,+ const rating = snapshot.queryParamMap.get(FilterQueryParam.Rating);+ if (rating !== undefined && rating !== null && parseInt(rating, 10) > 0) {+ filter.rating = parseInt(rating, 10);+ anyChanged = true;+ }++ /// Read status is encoded as true,true,true+ const readStatus = snapshot.queryParamMap.get(FilterQueryParam.ReadStatus);+ if (readStatus !== undefined && readStatus !== null) {+ const values = readStatus.split(',').map(i => i === 'true');+ if (values.length === 3) {+ filter.readStatus.inProgress = values[0];+ filter.readStatus.notRead = values[1];+ filter.readStatus.read = values[2];+ anyChanged = true;+ }+ }++ const sortBy = snapshot.queryParamMap.get(FilterQueryParam.SortBy);+ if (sortBy !== undefined && sortBy !== null) {+ const values = sortBy.split(',');+ if (values.length === 1) {+ values.push('true');+ }+ if (values.length === 2) {+ filter.sortOptions = {+ isAscending: values[1] === 'true',+ sortField: Number(values[0])+ }+ anyChanged = true;+ }+ }++ const searchNameQuery = snapshot.queryParamMap.get(FilterQueryParam.Name);+ if (searchNameQuery !== undefined && searchNameQuery !== null && searchNameQuery !== '') {+ filter.seriesNameQuery = decodeURIComponent(searchNameQuery);+ anyChanged = true;+ }+++ return [filter, false]; // anyChanged. Testing out if having a filter active but keep drawer closed by default works better+ }+}diff --git a/UI/Web/src/app/shared/_services/utility.service.ts b/UI/Web/src/app/shared/_services/utility.service.tsindex 5bb8646f7..8da7814b5 100644--- a/UI/Web/src/app/shared/_services/utility.service.ts+++ b/UI/Web/src/app/shared/_services/utility.service.ts@@ -1,10 +1,12 @@+import { HttpParams } from '@angular/common/http';import { Injectable } from '@angular/core';import { ActivatedRouteSnapshot } from '@angular/router';import { Chapter } from 'src/app/_models/chapter';import { LibraryType } from 'src/app/_models/library';import { MangaFormat } from 'src/app/_models/manga-format';+import { PaginatedResult } from 'src/app/_models/pagination';import { Series } from 'src/app/_models/series';-import { SeriesFilter } from 'src/app/_models/series-filter';+import { SeriesFilter, SortField } from 'src/app/_models/series-filter';import { Volume } from 'src/app/_models/volume';export enum KEY_CODES {@@ -67,7 +69,7 @@ export class UtilityService {* @param includeSpace Add a space at the end of the string. if includeHash and includeSpace are true, only hash will be at the end.* @returns*/- formatChapterName(libraryType: LibraryType, includeHash: boolean = false, includeSpace: boolean = false) {+ formatChapterName(libraryType: LibraryType, includeHash: boolean = false, includeSpace: boolean = false) {switch(libraryType) {case LibraryType.Book:return 'Book' + (includeSpace ? ' ' : '');@@ -96,133 +98,6 @@ export class UtilityService {return input.toUpperCase().replace(reg, '').includes(filter.toUpperCase().replace(reg, ''));}- /**- * Returns a new instance of a filterSettings that is populated with filter presets from URL- * @param snapshot- * @param blankFilter Filter to start with- * @returns The Preset filter and if something was set within- */- filterPresetsFromUrl(snapshot: ActivatedRouteSnapshot, blankFilter: SeriesFilter): [SeriesFilter, boolean] {- const filter = Object.assign({}, blankFilter);- let anyChanged = false;-- const format = snapshot.queryParamMap.get('format');- if (format !== undefined && format !== null) {- filter.formats = [...filter.formats, ...format.split(',').map(item => parseInt(item, 10))];- anyChanged = true;- }-- const genres = snapshot.queryParamMap.get('genres');- if (genres !== undefined && genres !== null) {- filter.genres = [...filter.genres, ...genres.split(',').map(item => parseInt(item, 10))];- anyChanged = true;- }-- const ageRating = snapshot.queryParamMap.get('ageRating');- if (ageRating !== undefined && ageRating !== null) {- filter.ageRating = [...filter.ageRating, ...ageRating.split(',').map(item => parseInt(item, 10))];- anyChanged = true;- }-- const publicationStatus = snapshot.queryParamMap.get('publicationStatus');- if (publicationStatus !== undefined && publicationStatus !== null) {- filter.publicationStatus = [...filter.publicationStatus, ...publicationStatus.split(',').map(item => parseInt(item, 10))];- anyChanged = true;- }-- const tags = snapshot.queryParamMap.get('tags');- if (tags !== undefined && tags !== null) {- filter.tags = [...filter.tags, ...tags.split(',').map(item => parseInt(item, 10))];- anyChanged = true;- }-- const languages = snapshot.queryParamMap.get('languages');- if (languages !== undefined && languages !== null) {- filter.languages = [...filter.languages, ...languages.split(',')];- anyChanged = true;- }-- const writers = snapshot.queryParamMap.get('writers');- if (writers !== undefined && writers !== null) {- filter.writers = [...filter.writers, ...writers.split(',').map(item => parseInt(item, 10))];- anyChanged = true;- }-- const artists = snapshot.queryParamMap.get('artists');- if (artists !== undefined && artists !== null) {- filter.artists = [...filter.artists, ...artists.split(',').map(item => parseInt(item, 10))];- anyChanged = true;- }-- const character = snapshot.queryParamMap.get('character');- if (character !== undefined && character !== null) {- filter.character = [...filter.character, ...character.split(',').map(item => parseInt(item, 10))];- anyChanged = true;- }-- const colorist = snapshot.queryParamMap.get('colorist');- if (colorist !== undefined && colorist !== null) {- filter.colorist = [...filter.colorist, ...colorist.split(',').map(item => parseInt(item, 10))];- anyChanged = true;- }-- const coverArtists = snapshot.queryParamMap.get('coverArtists');- if (coverArtists !== undefined && coverArtists !== null) {- filter.coverArtist = [...filter.coverArtist, ...coverArtists.split(',').map(item => parseInt(item, 10))];- anyChanged = true;- }-- const editor = snapshot.queryParamMap.get('editor');- if (editor !== undefined && editor !== null) {- filter.editor = [...filter.editor, ...editor.split(',').map(item => parseInt(item, 10))];- anyChanged = true;- }-- const inker = snapshot.queryParamMap.get('inker');- if (inker !== undefined && inker !== null) {- filter.inker = [...filter.inker, ...inker.split(',').map(item => parseInt(item, 10))];- anyChanged = true;- }-- const letterer = snapshot.queryParamMap.get('letterer');- if (letterer !== undefined && letterer !== null) {- filter.letterer = [...filter.letterer, ...letterer.split(',').map(item => parseInt(item, 10))];- anyChanged = true;- }-- const penciller = snapshot.queryParamMap.get('penciller');- if (penciller !== undefined && penciller !== null) {- filter.penciller = [...filter.penciller, ...penciller.split(',').map(item => parseInt(item, 10))];- anyChanged = true;- }-- const publisher = snapshot.queryParamMap.get('publisher');- if (publisher !== undefined && publisher !== null) {- filter.publisher = [...filter.publisher, ...publisher.split(',').map(item => parseInt(item, 10))];- anyChanged = true;- }-- const translators = snapshot.queryParamMap.get('translators');- if (translators !== undefined && translators !== null) {- filter.translators = [...filter.translators, ...translators.split(',').map(item => parseInt(item, 10))];- anyChanged = true;- }-- /// Read status is encoded as true,true,true- const readStatus = snapshot.queryParamMap.get('readStatus');- if (readStatus !== undefined && readStatus !== null) {- const values = readStatus.split(',').map(i => i === "true");- if (values.length === 3) {- filter.readStatus.inProgress = values[0];- filter.readStatus.notRead = values[1];- filter.readStatus.read = values[2];- anyChanged = true;- }- }--- return [filter, anyChanged];- }mangaFormat(format: MangaFormat): string {switch (format) {@@ -305,4 +180,53 @@ export class UtilityService {rect.right <= (window.innerWidth || document.documentElement.clientWidth));}++ deepEqual(object1: any, object2: any) {+ const keys1 = Object.keys(object1);+ const keys2 = Object.keys(object2);+ if (keys1.length !== keys2.length) {+ return false;+ }+ for (const key of keys1) {+ const val1 = object1[key];+ const val2 = object2[key];+ const areObjects = this.isObject(val1) && this.isObject(val2);+ if (+ areObjects && !this.deepEqual(val1, val2) ||+ !areObjects && val1 !== val2+ ) {+ return false;+ }+ }+ return true;+ }+ private isObject(object: any) {+ return object != null && typeof object === 'object';+ }++ addPaginationIfExists(params: HttpParams, pageNum?: number, itemsPerPage?: number) {+ if (pageNum !== null && pageNum !== undefined && itemsPerPage !== null && itemsPerPage !== undefined) {+ params = params.append('pageNumber', pageNum + '');+ params = params.append('pageSize', itemsPerPage + '');+ }+ return params;+ }++ createPaginatedResult(response: any, paginatedVariable: PaginatedResult<any[]> | undefined = undefined) {+ if (paginatedVariable === undefined) {+ paginatedVariable = new PaginatedResult();+ }+ if (response.body === null) {+ paginatedVariable.result = [];+ } else {+ paginatedVariable.result = response.body;+ }++ const pageHeader = response.headers?.get('Pagination');+ if (pageHeader !== null) {+ paginatedVariable.pagination = JSON.parse(pageHeader);+ }++ return paginatedVariable;+ }}diff --git a/UI/Web/src/app/shared/drawer/drawer.component.html b/UI/Web/src/app/shared/drawer/drawer.component.htmlindex 8cecdd919..4d7c21972 100644--- a/UI/Web/src/app/shared/drawer/drawer.component.html+++ b/UI/Web/src/app/shared/drawer/drawer.component.html@@ -1,15 +1,18 @@-<div- class="drawer-container"- [ngStyle]="{'top': options.topOffset + 'px', 'padding-bottom': options.topOffset + 'px'}"- [class.is-open]="isOpen"- [class.position-right]="position === 'right'"- [class.position-left]="position === 'left'"- [class.position-bottom]="position === 'bottom'"->- <div class="header">- <ng-content select="[header]"></ng-content>+<div class="offcanvas offcanvas-{{position}}" [class.show]="isOpen" tabindex="-1" id="offcanvas" aria-labelledby="offcanvasLabel"+[ngStyle]="{'top': options.topOffset + 'px', 'visibility': isOpen ? 'visible' : 'hidden'}" role="dialog">+ <div class="offcanvas-header">+ <div class="offcanvas-title" id="offcanvasLabel">+ <ng-content select="[header]"></ng-content>+ </div>+ <button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close" (click)="close()"></button></div>- <div class="body">+ <div class="offcanvas-header row hide-if-empty">+ <ng-content select="[subheader]"></ng-content>+ </div>++ <div class="offcanvas-body"><ng-content select="[body]"></ng-content></div>-</div>\ No newline at end of file+</div>+<!-- TODO: Replace this with official component when released. This is some hacky solution to mimic Bootstrap 5 Javascript code -->+<div class="offcanvas-backdrop fade show" *ngIf="isOpen" (click)="close()"></div>diff --git a/UI/Web/src/app/shared/drawer/drawer.component.scss b/UI/Web/src/app/shared/drawer/drawer.component.scssindex b8b909772..809ff86d1 100644--- a/UI/Web/src/app/shared/drawer/drawer.component.scss+++ b/UI/Web/src/app/shared/drawer/drawer.component.scss@@ -1,56 +1,8 @@-:host {- --drawer-height: 100vh;- --drawer-width: 400px;- --drawer-top-offset: 0px;- //--drawer-background-color: #fff;- }-- .drawer-container {- position: absolute;- top: var(--drawer-top-offset);- right: 0;- width: var(--drawer-width);- height: 100vh;- background: var(--drawer-background-color, #fff);- transition: all 300ms;- box-shadow: 0 6px 4px 2px rgb(0 0 0 / 70%);- padding: 10px 10px;- z-index: 1021;- overflow: auto;- -webkit-overflow-scrolling: touch;+.offcanvas {+ color: var(--drawer-text-color);+ background-color: var(--drawer-bg-color);+}- &.position-right {- right: calc(-1 * var(--drawer-width));- &.is-open {- right: 0;- }- }- &.position-left {- left: calc(-1 * var(--drawer-width));- &.is-open {- left: 0;- }- }-- &.position-bottom {- //top: calc(-1 * var(--drawer-height));- top: 100vh;- height: 0px;- &.is-open {- //bottom: 0;- top: 100vh;- height: var(--drawer-height);- }- }-- &.position-top {- //bottom: calc(-1 * var(--drawer-height));- top: 0px;- height: 0px;- &.is-open {- //bottom: 0;- top: 0px;- height: var(--drawer-height);- }- }- }+.hide-if-empty:empty {+ display: none !important;+}\ No newline at end of filediff --git a/UI/Web/src/app/shared/drawer/drawer.component.ts b/UI/Web/src/app/shared/drawer/drawer.component.tsindex f83e95383..3af6a5db0 100644--- a/UI/Web/src/app/shared/drawer/drawer.component.ts+++ b/UI/Web/src/app/shared/drawer/drawer.component.ts@@ -14,18 +14,20 @@ export class DrawerOptions {exportAs: "drawer"})export class DrawerComponent {-@Input() isOpen = false;@Input() width: number = 400;/*** Side of the screen the drawer should animate from*/- @Input() position: 'left' | 'right' | 'bottom' = 'left';+ @Input() position: 'start' | 'end' | 'bottom' | 'top' = 'start';@Input() options: Partial<DrawerOptions> = new DrawerOptions();@Output() drawerClosed = new EventEmitter();+ @Output() isOpenChange: EventEmitter<boolean> = new EventEmitter();close() {- this.drawerClosed.emit();+ this.isOpen = false;+ this.isOpenChange.emit(false);+ this.drawerClosed.emit(false);}}diff --git a/UI/Web/src/app/shared/image/image.component.html b/UI/Web/src/app/shared/image/image.component.htmlindex 10248a9fc..5e89b6466 100644--- a/UI/Web/src/app/shared/image/image.component.html+++ b/UI/Web/src/app/shared/image/image.component.html@@ -1,7 +1,3 @@<img #img class="lazyload" [src]="imageService.placeholderImage" [attr.data-src]="imageUrl"(error)="imageService.updateErroredImage($event)"- aria-hidden="true">--<!-- <img #img [defaultImage]="imageService.placeholderImage" [lazyload]="imageUrl"- (error)="imageService.updateErroredImage($event)"- aria-hidden="true"> -->+ aria-hidden="true">\ No newline at end of filediff --git a/UI/Web/src/app/shared/image/image.component.ts b/UI/Web/src/app/shared/image/image.component.tsindex 4d4e50204..d19d661da 100644--- a/UI/Web/src/app/shared/image/image.component.ts+++ b/UI/Web/src/app/shared/image/image.component.ts@@ -51,10 +51,13 @@ export class ImageComponent implements OnChanges, OnDestroy {if (this.imageUrl === undefined || this.imageUrl === null || this.imageUrl === '') return;const enityType = this.imageService.getEntityTypeFromUrl(this.imageUrl);if (enityType === updateEvent.entityType) {- const tokens = this.imageUrl.split('?')[1].split('&random=');+ const tokens = this.imageUrl.split('?')[1].split('&');//...seriesId=123&random=- const id = tokens[0].replace(enityType + 'Id=', '');+ let id = tokens[0].replace(enityType + 'Id=', '');+ if (id.includes('&')) {+ id = id.split('&')[0];+ }if (id === (updateEvent.id + '')) {this.imageUrl = this.imageService.randomize(this.imageUrl);}diff --git a/UI/Web/src/app/shared/shared.module.ts b/UI/Web/src/app/shared/shared.module.tsindex 268d757a4..70d4283b6 100644--- a/UI/Web/src/app/shared/shared.module.ts+++ b/UI/Web/src/app/shared/shared.module.ts@@ -38,21 +38,24 @@ import { PipeModule } from '../pipe/pipe.module';RouterModule,ReactiveFormsModule,NgbCollapseModule,- NgbTooltipModule, // RegisterMemberComponent+ NgbTooltipModule, // TODO: Validate if we still need thisPipeModule,NgCircleProgressModule.forRoot(),],exports: [ReadMoreComponent, // Used globably- DrawerComponent, // Can be replaced with boostrap offscreen canvas (v5)- ShowIfScrollbarDirective, // Used book reader only?+ DrawerComponent, // Can be replaced with boostrap offscreen canvas (v5) (also used in book reader and series metadata filter)A11yClickDirective, // Used globallySeriesFormatComponent, // Used globallyTagBadgeComponent, // Used globallyCircularLoaderComponent, // Used in Cards only+ ImageComponent, // Used globally++ ShowIfScrollbarDirective, // Used book reader only?+PersonBadgeComponent, // Used Series Detail- BadgeExpanderComponent, // Used globally- ImageComponent // Used globally+ BadgeExpanderComponent, // Used Series Detail/Metadata+],})export class SharedModule { }diff --git a/UI/Web/src/app/shared/tag-badge/tag-badge.component.html b/UI/Web/src/app/shared/tag-badge/tag-badge.component.htmlindex b1e1b9a27..25b612aca 100644--- a/UI/Web/src/app/shared/tag-badge/tag-badge.component.html+++ b/UI/Web/src/app/shared/tag-badge/tag-badge.component.html@@ -1,3 +1,3 @@-<div class="tagbadge {{cursor}}">+<div class="tagbadge {{cursor}} {{fillStyle}}"><ng-content></ng-content></div>\ No newline at end of filediff --git a/UI/Web/src/app/shared/tag-badge/tag-badge.component.scss b/UI/Web/src/app/shared/tag-badge/tag-badge.component.scssindex af0b97a7b..6e6099e89 100644--- a/UI/Web/src/app/shared/tag-badge/tag-badge.component.scss+++ b/UI/Web/src/app/shared/tag-badge/tag-badge.component.scss@@ -39,3 +39,15 @@cursor: pointer !important;}}++.filled {+ border: 1px solid var(--tagbadge-filled-border-color);+ color: var(--tagbadge-filled-text-color);+ background-color: var(--tagbadge-filled-bg-color);+}++.outline {+ border: 1px solid var(--tagbadge-border-color);+ color: var(--tagbadge-text-color);+ background-color: var(--tagbadge-bg-color);+}\ No newline at end of filediff --git a/UI/Web/src/app/shared/tag-badge/tag-badge.component.ts b/UI/Web/src/app/shared/tag-badge/tag-badge.component.tsindex 58e9e93e5..d5f00d01d 100644--- a/UI/Web/src/app/shared/tag-badge/tag-badge.component.ts+++ b/UI/Web/src/app/shared/tag-badge/tag-badge.component.ts@@ -29,6 +29,7 @@ export enum TagBadgeCursor {export class TagBadgeComponent implements OnInit {@Input() selectionMode: TagBadgeCursor = TagBadgeCursor.Selectable;+ @Input() fillStyle: 'filled' | 'outline' = 'outline';cursor: string = 'default';diff --git a/UI/Web/src/app/sidenav/side-nav-companion-bar/side-nav-companion-bar.component.html b/UI/Web/src/app/sidenav/side-nav-companion-bar/side-nav-companion-bar.component.htmlindex b0c968c0a..f1d36226f 100644--- a/UI/Web/src/app/sidenav/side-nav-companion-bar/side-nav-companion-bar.component.html+++ b/UI/Web/src/app/sidenav/side-nav-companion-bar/side-nav-companion-bar.component.html@@ -1,21 +1,17 @@-<div class="mt-0">- <div class="row g-0">- <div class="col mr-auto">- <ng-content select="[title]"></ng-content>- <ng-content select="[subtitle]"></ng-content>- </div>- <div class="col mr-auto hide-if-empty">- <ng-content select="[main]"></ng-content>- </div>- <div class="col" *ngIf="hasFilter">- <div class="row justify-content-end">- <div class="col-auto align-self-end">- <button *ngIf="hasFilter" class="btn btn-secondary btn-small" (click)="toggleFilter()" [attr.aria-expanded]="filterOpen" placement="left" ngbTooltip="{{filterOpen ? 'Open' : 'Close'}} Filtering and Sorting" attr.aria-label="{{filterOpen ? 'Open' : 'Close'}} Filtering and Sorting">- <i class="fa fa-filter" aria-hidden="true"></i>- <span class="visually-hidden">Sort / Filter</span>- </button>- </div>- </div>- </div>+<div class="mt-0 d-flex justify-content-between align-items-center">+ <div>+ <ng-content select="[title]"></ng-content>+ <ng-content select="[subtitle]"></ng-content></div>+ <div>+ <ng-content select="[main]"></ng-content>+ </div>+ <div>+ <!-- This can get out of sync with offcanvas component. We might need a service to handle communication and service resets to collapsed on route changes -->+ <button *ngIf="hasFilter" class="btn btn-{{filterActive ? 'primary' : 'secondary'}} btn-small" (click)="toggleService.toggle()" [attr.aria-expanded]="filterOpen" placement="left" ngbTooltip="{{filterOpen ? 'Open' : 'Close'}} Filtering and Sorting" attr.aria-label="{{filterOpen ? 'Open' : 'Close'}} Filtering and Sorting">+ <i class="fa fa-filter" aria-hidden="true"></i>+ <span class="visually-hidden">Sort / Filter</span>+ </button>+ </div>+</div>\ No newline at end of filediff --git a/UI/Web/src/app/sidenav/side-nav-companion-bar/side-nav-companion-bar.component.scss b/UI/Web/src/app/sidenav/side-nav-companion-bar/side-nav-companion-bar.component.scssindex 6e7f6dbda..6b20aa117 100644--- a/UI/Web/src/app/sidenav/side-nav-companion-bar/side-nav-companion-bar.component.scss+++ b/UI/Web/src/app/sidenav/side-nav-companion-bar/side-nav-companion-bar.component.scss@@ -1,5 +1,5 @@.hide-if-empty:empty {- display: none;+ display: none !important;}::ng-deep .companion-bar {diff --git a/UI/Web/src/app/sidenav/side-nav-companion-bar/side-nav-companion-bar.component.ts b/UI/Web/src/app/sidenav/side-nav-companion-bar/side-nav-companion-bar.component.tsindex bdd7a411e..9d7fa8825 100644--- a/UI/Web/src/app/sidenav/side-nav-companion-bar/side-nav-companion-bar.component.ts+++ b/UI/Web/src/app/sidenav/side-nav-companion-bar/side-nav-companion-bar.component.ts@@ -1,4 +1,8 @@-import { Component, ContentChild, EventEmitter, Input, OnInit, Output, TemplateRef } from '@angular/core';+import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core';+import { Subject, takeUntil } from 'rxjs';+import { Breakpoint, UtilityService } from 'src/app/shared/_services/utility.service';+import { NavService } from 'src/app/_services/nav.service';+import { ToggleService } from 'src/app/_services/toggle.service';/*** This should go on all pages which have the side nav present and is not Settings related.@@ -9,7 +13,7 @@ import { Component, ContentChild, EventEmitter, Input, OnInit, Output, TemplateRtemplateUrl: './side-nav-companion-bar.component.html',styleUrls: ['./side-nav-companion-bar.component.scss']})-export class SideNavCompanionBarComponent implements OnInit {+export class SideNavCompanionBarComponent implements OnInit, OnDestroy {/*** If the page should show a filter*/@@ -20,6 +24,11 @@ export class SideNavCompanionBarComponent implements OnInit {*/@Input() filterOpenByDefault: boolean = false;+ /**+ * This implies there is a filter in effect on the underlying page. Will show UI styles to imply this to the user.+ */+ @Input() filterActive: boolean = false;+/*** Should be passed through from Filter component.*/@@ -29,10 +38,26 @@ export class SideNavCompanionBarComponent implements OnInit {isFilterOpen = false;- constructor() { }+ private onDestroy: Subject<void> = new Subject();++ constructor(private navService: NavService, private utilityService: UtilityService, public toggleService: ToggleService) {+ }ngOnInit(): void {this.isFilterOpen = this.filterOpenByDefault;++ // If user opens side nav while filter is open on mobile, then collapse filter (as it doesn't render well) TODO: Change this when we have new drawer+ this.navService.sideNavCollapsed$.pipe(takeUntil(this.onDestroy)).subscribe(sideNavCollapsed => {+ if (this.isFilterOpen && sideNavCollapsed && this.utilityService.getActiveBreakpoint() < Breakpoint.Tablet) {+ this.isFilterOpen = false;+ this.filterOpen.emit(this.isFilterOpen);+ }+ });+ }++ ngOnDestroy(): void {+ this.onDestroy.next();+ this.onDestroy.complete();}toggleFilter() {diff --git a/UI/Web/src/app/sidenav/side-nav-item/side-nav-item.component.html b/UI/Web/src/app/sidenav/side-nav-item/side-nav-item.component.htmlindex 596fe9c5e..9a456d44f 100644--- a/UI/Web/src/app/sidenav/side-nav-item/side-nav-item.component.html+++ b/UI/Web/src/app/sidenav/side-nav-item/side-nav-item.component.html@@ -1,11 +1,11 @@<ng-container *ngIf="link === undefined || link.length === 0; else useLink">- <div class="side-nav-item" [ngClass]="{'closed': !(navService?.sideNavCollapsed$ | async), 'active': highlighted}">+ <div class="side-nav-item" [ngClass]="{'closed': (navService?.sideNavCollapsed$ | async), 'active': highlighted}"><ng-container [ngTemplateOutlet]="inner"></ng-container></div></ng-container><ng-template #useLink>- <a class="side-nav-item" href="javascript:void(0);" [ngClass]="{'closed': !(navService?.sideNavCollapsed$ | async), 'active': highlighted}" [routerLink]="link">+ <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>@@ -15,7 +15,7 @@<div class="active-highlight"></div><span class="phone-hidden" title="{{title}}"><div>- <i class="fa {{icon}}" aria-hidden="true"></i> + <i class="fa {{icon}}" aria-hidden="true"></i></div></span><span class="side-nav-text">diff --git a/UI/Web/src/app/sidenav/side-nav-item/side-nav-item.component.scss b/UI/Web/src/app/sidenav/side-nav-item/side-nav-item.component.scssindex 621f64623..95de8b9eb 100644--- a/UI/Web/src/app/sidenav/side-nav-item/side-nav-item.component.scss+++ b/UI/Web/src/app/sidenav/side-nav-item/side-nav-item.component.scss@@ -107,46 +107,46 @@ a {@media (max-width: 576px) {.side-nav-item {align-items: center;- display: flex;- justify-content: space-between;+ //display: flex;+ //justify-content: space-between;padding: 15px 10px;- width: 100%;+ //width: 100%;height: 70px;- min-height: 40px;- overflow: hidden;+ //min-height: 40px;+ // overflow: hidden;font-size: 1rem;- cursor: pointer;+ //cursor: pointer;.side-nav-text {- padding-left: 10px;- opacity: 1;- min-width: 100px;+ // padding-left: 10px;+ // opacity: 1;+ // min-width: 100px;width: 100%;- div {- min-width: 102px;- width: 100%- }+ // div {+ // min-width: 102px;+ // width: 100%+ // }}&.closed {- .side-nav-text {- opacity: 0;- }+ // .side-nav-text {+ // opacity: 0;+ // }.card-actions {- opacity: 0;- font-size: inherit+ //opacity: 0;+ font-size: inherit;}}- span {- &:last-child {- flex-grow: 1;- justify-content: end;- }- }+ // span {+ // &:last-child {+ // flex-grow: 1;+ // justify-content: end;+ // }+ // }}}\ No newline at end of filediff --git a/UI/Web/src/app/sidenav/side-nav/side-nav.component.html b/UI/Web/src/app/sidenav/side-nav/side-nav.component.htmlindex 91f4b99b6..e0f66775c 100644--- a/UI/Web/src/app/sidenav/side-nav/side-nav.component.html+++ b/UI/Web/src/app/sidenav/side-nav/side-nav.component.html@@ -1,5 +1,5 @@<ng-container>- <div class="side-nav" [ngClass]="{'closed' : !(navService?.sideNavCollapsed$ | async), 'hidden' :!(navService?.sideNavVisibility$ | async)}" *ngIf="accountService.currentUser$ | async as user">+ <div class="side-nav" [ngClass]="{'closed' : (navService?.sideNavCollapsed$ | async), 'hidden' :!(navService?.sideNavVisibility$ | async)}" *ngIf="accountService.currentUser$ | async as user"><!-- <app-side-nav-item icon="fa-user-circle align-self-center phone-hidden" [title]="user.username | sentenceCase" link="/preferences/"><ng-container actions>Todo: This will be customize dashboard/side nav controls@@ -7,23 +7,24 @@</ng-container></app-side-nav-item> -->- <app-side-nav-item icon="fa-home" title="Home" link="/library/"></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-regular fa-rectangle-list" title="All Series" link="/all-series/"></app-side-nav-item>- <div class="mb-2 mt-3 ms-2 me-2" *ngIf="libraries.length > 10">- <label for="filter" class="form-label visually-hidden">Filter</label>- <div class="input-group">- <input id="filter" autocomplete="off" class="form-control" [(ngModel)]="filterQuery" type="text" aria-describedby="reset-input">- <button class="btn btn-outline-secondary" type="button" id="reset-input" (click)="filterQuery = '';">Clear</button>- </div>+ <app-side-nav-item icon="fa-home" title="Home" link="/libraries/"></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-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/"></app-side-nav-item>+ <div class="mb-2 mt-3 ms-2 me-2" *ngIf="libraries.length > 10">+ <label for="filter" class="form-label visually-hidden">Filter</label>+ <div class="input-group">+ <input id="filter" autocomplete="off" class="form-control" [(ngModel)]="filterQuery" type="text" aria-describedby="reset-input">+ <button class="btn btn-outline-secondary" type="button" id="reset-input" (click)="filterQuery = '';">Clear</button></div>- <app-side-nav-item *ngFor="let library of libraries | filter: filterLibrary" [link]="'/library/' + library.id + '/'"- [icon]="utilityService.getLibraryTypeIcon(library.type)" [title]="library.name" [comparisonMethod]="'startsWith'">- <ng-container actions>- <app-card-actionables [actions]="actions" [labelBy]="library.name" iconClass="fa-ellipsis-v" (actionHandler)="performAction($event, library)"></app-card-actionables>- </ng-container>+ </div>+ <app-side-nav-item *ngFor="let library of libraries | filter: filterLibrary" [link]="'/library/' + library.id + '/'"+ [icon]="utilityService.getLibraryTypeIcon(library.type)" [title]="library.name" [comparisonMethod]="'startsWith'">+ <ng-container actions>+ <app-card-actionables [actions]="actions" [labelBy]="library.name" iconClass="fa-ellipsis-v" (actionHandler)="performAction($event, library)"></app-card-actionables>+ </ng-container></app-side-nav-item></div>- <div class="side-nav-overlay" (click)="navService?.toggleSideNav()" [ngClass]="{'closed' : !(navService?.sideNavCollapsed$ | async)}"></div>+ <div class="side-nav-overlay" (click)="navService?.toggleSideNav()" [ngClass]="{'closed' : (navService?.sideNavCollapsed$ | async)}"></div></ng-container>\ No newline at end of filediff --git a/UI/Web/src/app/sidenav/side-nav/side-nav.component.scss b/UI/Web/src/app/sidenav/side-nav/side-nav.component.scssindex 7bcee8f08..0d3cedc34 100644--- a/UI/Web/src/app/sidenav/side-nav/side-nav.component.scss+++ b/UI/Web/src/app/sidenav/side-nav/side-nav.component.scss@@ -25,7 +25,7 @@border: var(--side-nav-border-closed);}- .side-nav-item:first() {+ .side-nav-item:first {border-top-left-radius: var(--side-nav-border-radius);border-top-right-radius: var(--side-nav-border-radius);}@@ -52,7 +52,7 @@box-shadow: none;}- .side-nav-item:first() {+ .side-nav-item:first {border-top-left-radius: var(--side-nav-border-radius);border-top-right-radius: var(--side-nav-border-radius);}diff --git a/UI/Web/src/app/sidenav/side-nav/side-nav.component.ts b/UI/Web/src/app/sidenav/side-nav/side-nav.component.tsindex f4a2e15a1..7a5a33fe0 100644--- a/UI/Web/src/app/sidenav/side-nav/side-nav.component.ts+++ b/UI/Web/src/app/sidenav/side-nav/side-nav.component.ts@@ -1,9 +1,9 @@import { Component, OnDestroy, OnInit } from '@angular/core';-import { Router } from '@angular/router';+import { NavigationEnd, Router } from '@angular/router';import { Observable, Subject } from 'rxjs';-import { filter, take, takeUntil, takeWhile } from 'rxjs/operators';+import { filter, map, take, takeUntil, takeWhile } from 'rxjs/operators';import { EVENTS, MessageHubService } from 'src/app/_services/message-hub.service';-import { UtilityService } from '../../shared/_services/utility.service';+import { Breakpoint, UtilityService } from '../../shared/_services/utility.service';import { Library } from '../../_models/library';import { User } from '../../_models/user';import { AccountService } from '../../_services/account.service';@@ -29,12 +29,12 @@ export class SideNavComponent implements OnInit, OnDestroy {return library.name.toLowerCase().indexOf((this.filterQuery || '').toLowerCase()) >= 0;}- private onDestory: Subject<void> = new Subject();+ private onDestroy: Subject<void> = new Subject();constructor(public accountService: AccountService, private libraryService: LibraryService,public utilityService: UtilityService, private messageHub: MessageHubService,- private actionFactoryService: ActionFactoryService, private actionService: ActionService, public navService: NavService) { }+ private actionFactoryService: ActionFactoryService, private actionService: ActionService, public navService: NavService, private router: Router) { }ngOnInit(): void {this.accountService.currentUser$.pipe(take(1)).subscribe(user => {@@ -49,17 +49,31 @@ export class SideNavComponent implements OnInit, OnDestroy {this.actions = this.actionFactoryService.getLibraryActions(this.handleAction.bind(this));});- this.messageHub.messages$.pipe(takeUntil(this.onDestory), filter(event => event.event === EVENTS.LibraryModified)).subscribe(event => {- console.log('Received library modfied event');+ this.messageHub.messages$.pipe(takeUntil(this.onDestroy), filter(event => event.event === EVENTS.LibraryModified)).subscribe(event => {this.libraryService.getLibrariesForMember().pipe(take(1)).subscribe((libraries: Library[]) => {this.libraries = libraries;});});++ this.router.events+ .pipe(filter(event => event instanceof NavigationEnd),+ takeUntil(this.onDestroy),+ map(evt => evt as NavigationEnd))+ .subscribe((evt: NavigationEnd) => {+ if (this.utilityService.getActiveBreakpoint() < Breakpoint.Tablet) {+ // collapse side nav+ this.navService.sideNavCollapsed$.pipe(take(1)).subscribe(collapsed => {+ if (!collapsed) {+ this.navService.toggleSideNav();+ }+ });+ }+ });}ngOnDestroy(): void {- this.onDestory.next();- this.onDestory.complete();+ this.onDestroy.next();+ this.onDestroy.complete();}handleAction(action: Action, library: Library) {diff --git a/UI/Web/src/app/typeahead/typeahead.component.html b/UI/Web/src/app/typeahead/typeahead.component.htmlindex 3a6164e99..3a7f69382 100644--- a/UI/Web/src/app/typeahead/typeahead.component.html+++ b/UI/Web/src/app/typeahead/typeahead.component.html@@ -1,22 +1,22 @@<form [formGroup]="typeaheadForm"><div class="input-group {{hasFocus ? 'open': ''}} {{locked ? 'lock-active' : ''}}"><ng-container *ngIf="settings.showLocked">- <span class="input-group-text clickable" (click)="unlock($event)"><i class="fa fa-lock" aria-hidden="true"></i>+ <span class="input-group-text clickable" (click)="toggleLock($event)"><i class="fa fa-lock" aria-hidden="true"></i><span class="visually-hidden">Field is locked</span></span></ng-container>- <div class="typeahead-input" (click)="onInputFocus($event)">- <app-tag-badge *ngFor="let option of optionSelection.selected(); let i = index">+ <div class="typeahead-input" [ngClass]="{'disabled': disabled}" (click)="onInputFocus($event)">+ <app-tag-badge *ngFor="let option of optionSelection.selected(); let i = index" fillStyle="filled"><ng-container [ngTemplateOutlet]="badgeTemplate" [ngTemplateOutletContext]="{ $implicit: option, idx: i }"></ng-container>- <i class="fa fa-times" (click)="toggleSelection(option)" tabindex="0" aria-label="close"></i>+ <i class="fa fa-times" *ngIf="!disabled" (click)="toggleSelection(option)" tabindex="0" aria-label="close"></i></app-tag-badge>- <input #input [id]="settings.id" type="text" autocomplete="off" formControlName="typeahead">+ <input #input [id]="settings.id" type="text" autocomplete="off" formControlName="typeahead" *ngIf="!disabled"><div class="spinner-border spinner-border-sm {{settings.multiple ? 'close-offset' : ''}}" role="status" *ngIf="isLoadingOptions"><span class="visually-hidden">Loading...</span></div>- <ng-container *ngIf="settings.multiple && (selectedData | async) as selected">- <button class="btn btn-close float-end mt-2" *ngIf="selected.length > 0" style="font-size: 0.8rem;" (click)="clearSelections($event)"></button>+ <ng-container *ngIf="!disabled && settings.multiple && (selectedData | async) as selected">+ <button class="btn btn-close float-end mt-2" *ngIf="selected.length > 0" style="font-size: 0.8rem;" (click)="clearSelections()"></button></ng-container></div></div>@@ -28,7 +28,7 @@Add {{typeaheadControl.value}}...</li><li *ngFor="let option of filteredOptions | async; let index = index;" (click)="handleOptionClick(option)"- class="list-group-item" role="option"+ class="list-group-item" role="option" [attr.data-index]="index"(mouseenter)="focusedIndex = index + (showAddItem ? 1 : 0); updateHighlight();"><ng-container [ngTemplateOutlet]="optionTemplate" [ngTemplateOutletContext]="{ $implicit: option, idx: index }"></ng-container></li>diff --git a/UI/Web/src/app/typeahead/typeahead.component.scss b/UI/Web/src/app/typeahead/typeahead.component.scssindex dbd61f1f2..d473c6e15 100644--- a/UI/Web/src/app/typeahead/typeahead.component.scss+++ b/UI/Web/src/app/typeahead/typeahead.component.scss@@ -43,6 +43,10 @@ input {border: 1px solid var(--input-border-color);color: var(--body-text-color);+ &.disabled {+ cursor: not-allowed !important;+ }+input {outline: 0 !important;border-radius: .28571429rem;diff --git a/UI/Web/src/app/typeahead/typeahead.component.ts b/UI/Web/src/app/typeahead/typeahead.component.tsindex 43c8ab681..7190864ef 100644--- a/UI/Web/src/app/typeahead/typeahead.component.ts+++ b/UI/Web/src/app/typeahead/typeahead.component.ts@@ -2,12 +2,12 @@ import { DOCUMENT } from '@angular/common';import { Component, ContentChild, ElementRef, EventEmitter, HostListener, Inject, Input, OnDestroy, OnInit, Output, Renderer2, RendererStyleFlags2, TemplateRef, ViewChild } from '@angular/core';import { FormControl, FormGroup } from '@angular/forms';import { Observable, of, ReplaySubject, Subject } from 'rxjs';-import { debounceTime, filter, map, shareReplay, switchMap, take, takeUntil, tap } from 'rxjs/operators';+import { auditTime, distinctUntilChanged, filter, map, shareReplay, switchMap, take, takeUntil, tap } from 'rxjs/operators';import { KEY_CODES } from '../shared/_services/utility.service';import { SelectionCompareFn, TypeaheadSettings } from './typeahead-settings';/**- * SelectionModel<T> is used for keeping track of multiple selections. Simple interface with ability to toggle.+ * SelectionModel<T> is used for keeping track of multiple selections. Simple interface with ability to toggle.* @param selectedState Optional state to set selectedOptions to. If not passed, defaults to false.* @param selectedOptions Optional data elements to inform the SelectionModel of. If not passed, as toggle() occur, items are tracked.* @param propAccessor Optional string that points to a unique field within the T type. Used for quickly looking up.@@ -39,7 +39,7 @@ export class SelectionModel<T> {if (compareFn != undefined || compareFn != null) {lookupMethod = compareFn;}-+const dataItem = this._data.filter(d => lookupMethod(d.value, data));if (dataItem.length > 0) {if (selectedState != undefined) {@@ -66,9 +66,9 @@ export class SelectionModel<T> {if (compareFn != undefined || compareFn != null) {lookupMethod = compareFn;}-+dataItem = this._data.filter(d => lookupMethod(d.value, data));-+if (dataItem.length > 0) {return dataItem[0].selected;}@@ -76,7 +76,7 @@ export class SelectionModel<T> {}/**- *+ ** @returns If some of the items are selected, but not all*/hasSomeSelected(): boolean {@@ -85,7 +85,7 @@ export class SelectionModel<T> {}/**- *+ ** @returns All Selected items*/selected(): Array<T> {@@ -93,7 +93,7 @@ export class SelectionModel<T> {}/**- *+ ** @returns All Non-Selected items*/unselected(): Array<T> {@@ -101,7 +101,7 @@ export class SelectionModel<T> {}/**- *+ ** @returns Last element added/tracked or undefined if nothing is tracked*/peek(): T | undefined {@@ -115,17 +115,17 @@ export class SelectionModel<T> {shallowEqual(object1: T, object2: T) {const keys1 = Object.keys(object1);const keys2 = Object.keys(object2);-+if (keys1.length !== keys2.length) {return false;}-+for (let key of keys1) {if ((object1 as any)[key] !== (object2 as any)[key]) {return false;}}-+return true;}}@@ -141,18 +141,23 @@ export class TypeaheadComponent implements OnInit, OnDestroy {*/@Input() settings!: TypeaheadSettings<any>;/**- * When true, component will re-init and set back to false.+ * When true, will reset field to no selections. When false, will reset to saved data*/- @Input() reset: Subject<boolean> = new ReplaySubject(1);+ @Input() reset: ReplaySubject<boolean> = new ReplaySubject(1);/*** When a field is locked, we render custom css to indicate to the user. Does not affect functionality.*/@Input() locked: boolean = false;+ /**+ * If disabled, a user will not be able to interact with the typeahead+ */+ @Input() disabled: boolean = false;@Output() selectedData = new EventEmitter<any[] | any>();@Output() newItemAdded = new EventEmitter<any[] | any>();@Output() onUnlock = new EventEmitter<void>();@Output() lockedChange = new EventEmitter<boolean>();+@ViewChild('input') inputElem!: ElementRef<HTMLInputElement>;@ContentChild('optionItem') optionTemplate!: TemplateRef<any>;@ContentChild('badgeItem') badgeTemplate!: TemplateRef<any>;@@ -166,7 +171,7 @@ export class TypeaheadComponent implements OnInit, OnDestroy {isLoadingOptions: boolean = false;typeaheadControl!: FormControl;typeaheadForm!: FormGroup;-+private readonly onDestroy = new Subject<void>();constructor(private renderer2: Renderer2, @Inject(DOCUMENT) private document: Document) { }@@ -178,7 +183,8 @@ export class TypeaheadComponent implements OnInit, OnDestroy {ngOnInit() {- this.reset.pipe(takeUntil(this.onDestroy)).subscribe((reset: boolean) => {+ this.reset.pipe(takeUntil(this.onDestroy)).subscribe((resetToEmpty: boolean) => {+ this.clearSelections(resetToEmpty);this.init();});@@ -205,21 +211,24 @@ export class TypeaheadComponent implements OnInit, OnDestroy {// Adjust input box to growtap(val => {if (this.inputElem != null && this.inputElem.nativeElement != null) {- this.renderer2.setStyle(this.inputElem.nativeElement, 'width', 15 * ((this.typeaheadControl.value + '').length + 1) + 'px');+ this.renderer2.setStyle(this.inputElem.nativeElement, 'width', 15 * (val.trim().length + 1) + 'px');this.focusedIndex = 0;}}),- debounceTime(this.settings.debounce),+ map(val => val.trim()),+ auditTime(this.settings.debounce),+ //distinctUntilChanged(), // ?!: BUG Doesn't trigger the search to run when filtered array changesfilter(val => {// If minimum filter characters not met, do not filterif (this.settings.minCharacters === 0) return true;- if (!val || val.trim().length < this.settings.minCharacters) {+ if (!val || val.length < this.settings.minCharacters) {return false;}return true;}),+switchMap(val => {this.isLoadingOptions = true;let results: Observable<any[]>;@@ -233,14 +242,14 @@ export class TypeaheadComponent implements OnInit, OnDestroy {return results;}),tap((filteredOptions) => {- this.isLoadingOptions = false;- this.focusedIndex = 0;- //this.updateShowAddItem(filteredOptions);+ this.isLoadingOptions = false;+ this.focusedIndex = 0;setTimeout(() => {this.updateShowAddItem(filteredOptions);this.updateHighlight();}, 10);setTimeout(() => this.updateHighlight(), 20);+}),shareReplay(),takeUntil(this.onDestroy)@@ -249,7 +258,7 @@ export class TypeaheadComponent implements OnInit, OnDestroy {if (this.settings.savedData) {if (this.settings.multiple) {- this.optionSelection = new SelectionModel<any>(true, this.settings.savedData);+ this.optionSelection = new SelectionModel<any>(true, this.settings.savedData);}else {const isArray = this.settings.savedData.hasOwnProperty('length');@@ -258,9 +267,6 @@ export class TypeaheadComponent implements OnInit, OnDestroy {} else {this.optionSelection = new SelectionModel<any>(true, [this.settings.savedData]);}--- //this.typeaheadControl.setValue(this.settings.displayFn(this.settings.savedData))}} else {this.optionSelection = new SelectionModel<any>();@@ -274,8 +280,9 @@ export class TypeaheadComponent implements OnInit, OnDestroy {}@HostListener('window:keydown', ['$event'])- handleKeyPress(event: KeyboardEvent) {+ handleKeyPress(event: KeyboardEvent) {if (!this.hasFocus) { return; }+ if (this.disabled) return;switch(event.key) {case KEY_CODES.DOWN_ARROW:@@ -296,29 +303,13 @@ export class TypeaheadComponent implements OnInit, OnDestroy {{this.document.querySelectorAll('.list-group-item').forEach((item, index) => {if (item.classList.contains('active')) {- this.filteredOptions.pipe(take(1)).subscribe((opts: any[]) => {+ this.filteredOptions.pipe(take(1)).subscribe((opts: any[]) => {// This isn't giving back the filtered array, but everything-- if (this.settings.addIfNonExisting && item.classList.contains('add-item')) {- this.addNewItem(this.typeaheadControl.value);- this.resetField();- this.focusedIndex = 0;- event.preventDefault();- event.stopPropagation();- return;- }--- const filteredResults = opts.filter(item => this.filterSelected(item));-- if (filteredResults.length < this.focusedIndex) return;- const option = filteredResults[this.focusedIndex];-- this.toggleSelection(option);- this.resetField();- this.focusedIndex = 0;event.preventDefault();event.stopPropagation();++ (item as HTMLElement).click();+ this.focusedIndex = 0;});}});@@ -356,13 +347,26 @@ export class TypeaheadComponent implements OnInit, OnDestroy {this.resetField();}- clearSelections(event: any) {- this.optionSelection.selected().forEach(item => this.optionSelection.toggle(item, false));- this.selectedData.emit(this.optionSelection.selected());- this.resetField();+ clearSelections(untoggleAll: boolean = false) {+ if (this.optionSelection) {+ if (!untoggleAll && this.settings.savedData) {+ const isArray = this.settings.savedData.hasOwnProperty('length');+ if (isArray) {+ this.optionSelection = new SelectionModel<any>(true, this.settings.savedData);+ } else {+ this.optionSelection = new SelectionModel<any>(true, [this.settings.savedData]);+ }+ } else {+ this.optionSelection.selected().forEach(item => this.optionSelection.toggle(item, false));+ }++ this.selectedData.emit(this.optionSelection.selected());+ this.resetField();+ }}handleOptionClick(opt: any) {+ if (this.disabled) return;if (!this.settings.multiple && this.optionSelection.selected().length > 0) {return;}@@ -374,7 +378,7 @@ export class TypeaheadComponent implements OnInit, OnDestroy {}addNewItem(title: string) {- if (this.settings.addTransformFn == undefined) {+ if (this.settings.addTransformFn == undefined || !this.settings.addIfNonExisting) {return;}const newItem = this.settings.addTransformFn(title);@@ -386,8 +390,8 @@ export class TypeaheadComponent implements OnInit, OnDestroy {}/**- *- * @param item+ *+ * @param item* @returns True if the item is NOT selected already*/filterSelected(item: any) {@@ -401,6 +405,7 @@ export class TypeaheadComponent implements OnInit, OnDestroy {openDropdown() {setTimeout(() => {this.typeaheadControl.setValue(this.typeaheadControl.value);+ this.hasFocus = true;});}@@ -409,6 +414,7 @@ export class TypeaheadComponent implements OnInit, OnDestroy {event.stopPropagation();event.preventDefault();}+ if (this.disabled) return;if (!this.settings.multiple && this.optionSelection.selected().length > 0) {return;@@ -417,18 +423,19 @@ export class TypeaheadComponent implements OnInit, OnDestroy {if (this.inputElem) {// hack: To prevent multiple typeaheads from being open at once, click document then trigger the focusthis.document.body.click();+this.inputElem.nativeElement.focus();this.hasFocus = true;}-+this.openDropdown();}resetField() {if (this.inputElem && this.inputElem.nativeElement) {- this.renderer2.setStyle(this.inputElem.nativeElement, 'width', 4, RendererStyleFlags2.Important);+ this.renderer2.setStyle(this.inputElem.nativeElement, 'width', 4, RendererStyleFlags2.Important);}this.typeaheadControl.setValue('');this.focusedIndex = 0;@@ -448,20 +455,25 @@ export class TypeaheadComponent implements OnInit, OnDestroy {}updateShowAddItem(options: any[]) {- this.showAddItem = this.settings.addIfNonExisting && this.typeaheadControl.value.trim()- && this.typeaheadControl.value.trim().length >= Math.max(this.settings.minCharacters, 1)+ // ?! 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);-+if (this.showAddItem) {this.hasFocus = true;}}- unlock(event: any) {+ toggleLock(event: any) {+ if (this.disabled) return;this.locked = !this.locked;- this.onUnlock.emit();this.lockedChange.emit(this.locked);++ if (!this.locked) {+ this.onUnlock.emit();+ }}}diff --git a/UI/Web/src/app/user-settings/series-bookmarks/series-bookmarks.component.html b/UI/Web/src/app/user-settings/series-bookmarks/series-bookmarks.component.htmldeleted file mode 100644index 53bc85356..000000000--- a/UI/Web/src/app/user-settings/series-bookmarks/series-bookmarks.component.html+++ /dev/null@@ -1,42 +0,0 @@-<p *ngIf="series.length === 0 && !loadingBookmarks">- There are no bookmarks. Try creating <a href="https://wiki.kavitareader.com/en/guides/get-started-using-your-library/bookmarks" target="_blank">one <i class="fa fa-external-link-alt" aria-hidden="true"></i></a>.-</p>-<ul class="list-group">- <li *ngFor="let series of series" class="list-group-item">- <div>- <h4>- <a id="series--{{series.name}}" href="javascript:void(0);" (click)="viewBookmarks(series)">{{series.name | titlecase}}</a>- <span class="badge bg-secondary rounded-pill">{{getBookmarkPages(series.id)}}</span>- <div class="float-end">- <button attr.aria-labelledby="series--{{series.name}}" class="btn btn-danger me-2 btn-sm" (click)="clearBookmarks(series)" [disabled]="clearingSeries[series.id]" placement="top" ngbTooltip="Clear Bookmarks" attr.aria-label="Clear Bookmarks">- <ng-container *ngIf="clearingSeries[series.id]; else notClearing">- <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>- <span class="visually-hidden">Loading...</span>- </ng-container>- <ng-template #notClearing>- <i class="fa fa-trash-alt" aria-hidden="true"></i>- </ng-template>- </button>- <button attr.aria-labelledby="series--{{series.name}}" class="btn btn-secondary me-2 btn-sm" (click)="downloadBookmarks(series)" [disabled]="downloadingSeries[series.id]" placement="top" ngbTooltip="Download Bookmarks" attr.aria-label="Download Bookmarks">- <ng-container *ngIf="downloadingSeries[series.id]; else notDownloading">- <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>- <span class="visually-hidden">Downloading...</span>- </ng-container>- <ng-template #notDownloading>- <i class="fa fa-arrow-alt-circle-down" aria-hidden="true"></i>- </ng-template>- </button>- <button attr.aria-labelledby="series--{{series.name}}" class="btn btn-primary me-2 btn-sm" routerLink="/library/{{series.libraryId}}/series/{{series.id}}" placement="top" ngbTooltip="Open Series" attr.aria-label="Open Series">- <i class="fa fa-eye" title="Open Series"></i>- </button>- </div>- </h4>- </div>- </li>- <li *ngIf="loadingBookmarks" class="list-group-item">- <div class="spinner-border text-secondary" role="status">- <span class="invisible">Loading...</span>- </div>- </li>-</ul>-diff --git a/UI/Web/src/app/user-settings/series-bookmarks/series-bookmarks.component.scss b/UI/Web/src/app/user-settings/series-bookmarks/series-bookmarks.component.scssdeleted file mode 100644index e69de29bb..000000000diff --git a/UI/Web/src/app/user-settings/series-bookmarks/series-bookmarks.component.ts b/UI/Web/src/app/user-settings/series-bookmarks/series-bookmarks.component.tsdeleted file mode 100644index 4f67fdabe..000000000--- a/UI/Web/src/app/user-settings/series-bookmarks/series-bookmarks.component.ts+++ /dev/null@@ -1,96 +0,0 @@-import { Component, OnInit } from '@angular/core';-import { NgbModal } from '@ng-bootstrap/ng-bootstrap';-import { ToastrService } from 'ngx-toastr';-import { take, takeWhile, finalize } from 'rxjs/operators';-import { BookmarksModalComponent } from 'src/app/cards/_modals/bookmarks-modal/bookmarks-modal.component';-import { ConfirmService } from 'src/app/shared/confirm.service';-import { DownloadService } from 'src/app/shared/_services/download.service';-import { PageBookmark } from 'src/app/_models/page-bookmark';-import { Series } from 'src/app/_models/series';-import { ReaderService } from 'src/app/_services/reader.service';-import { SeriesService } from 'src/app/_services/series.service';--@Component({- selector: 'app-series-bookmarks',- templateUrl: './series-bookmarks.component.html',- styleUrls: ['./series-bookmarks.component.scss']-})-export class SeriesBookmarksComponent implements OnInit {-- bookmarks: Array<PageBookmark> = [];- series: Array<Series> = [];- loadingBookmarks: boolean = false;- seriesIds: {[id: number]: number} = {};- downloadingSeries: {[id: number]: boolean} = {};- clearingSeries: {[id: number]: boolean} = {};-- constructor(private readerService: ReaderService, private seriesService: SeriesService,- private modalService: NgbModal, private downloadService: DownloadService, private toastr: ToastrService,- private confirmService: ConfirmService) { }-- ngOnInit(): void {- this.loadBookmarks();- }-- loadBookmarks() {- this.loadingBookmarks = true;- this.readerService.getAllBookmarks().pipe(take(1)).subscribe(bookmarks => {- this.bookmarks = bookmarks;- this.seriesIds = {};- this.bookmarks.forEach(bmk => {- if (!this.seriesIds.hasOwnProperty(bmk.seriesId)) {- this.seriesIds[bmk.seriesId] = 1;- } else {- this.seriesIds[bmk.seriesId] += 1;- }- this.downloadingSeries[bmk.seriesId] = false;- this.clearingSeries[bmk.seriesId] = false;- });-- const ids = Object.keys(this.seriesIds).map(k => parseInt(k, 10));- this.seriesService.getAllSeriesByIds(ids).subscribe(series => {- this.series = series;- this.loadingBookmarks = false;- });- });- }-- viewBookmarks(series: Series) {- const bookmarkModalRef = this.modalService.open(BookmarksModalComponent, { scrollable: true, size: 'lg' });- bookmarkModalRef.componentInstance.series = series;- bookmarkModalRef.closed.pipe(take(1)).subscribe(() => {- this.loadBookmarks();- });- }-- async clearBookmarks(series: Series) {- if (!await this.confirmService.confirm('Are you sure you want to clear all bookmarks for ' + series.name + '? This cannot be undone.')) {- return;- }-- this.clearingSeries[series.id] = true;- this.readerService.clearBookmarks(series.id).subscribe(() => {- const index = this.series.indexOf(series);- if (index > -1) {- this.series.splice(index, 1);- }- this.clearingSeries[series.id] = false;- this.toastr.success(series.name + '\'s bookmarks have been removed');- });- }-- getBookmarkPages(seriesId: number) {- return this.seriesIds[seriesId];- }-- downloadBookmarks(series: Series) {- this.downloadingSeries[series.id] = true;- this.downloadService.downloadBookmarks(this.bookmarks.filter(bmk => bmk.seriesId === series.id)).pipe(- takeWhile(val => {- return val.state != 'DONE';- }),- finalize(() => {- this.downloadingSeries[series.id] = false;- })).subscribe(() => {/* No Operation */});- }-}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.htmlindex 3f5e23059..62cfde1ca 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@@ -8,7 +8,12 @@</div></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>.+ </p>+<div class="row g-0">+ <h4>Site Themes</h4><ng-container *ngFor="let theme of (themeService.themes$ | async)"><div class="card col-auto me-3 mb-3" style="width: 18rem;"><div class="card-body">@@ -20,6 +25,5 @@</div></ng-container></div>-</div>diff --git a/UI/Web/src/app/user-settings/theme-manager/theme-manager.component.ts b/UI/Web/src/app/user-settings/theme-manager/theme-manager.component.tsindex a6d5b2f2c..9a2381e89 100644--- a/UI/Web/src/app/user-settings/theme-manager/theme-manager.component.ts+++ b/UI/Web/src/app/user-settings/theme-manager/theme-manager.component.ts@@ -1,7 +1,8 @@import { Component, OnDestroy, OnInit } from '@angular/core';import { ToastrService } from 'ngx-toastr';import { distinctUntilChanged, Subject, take, takeUntil } from 'rxjs';-import { ThemeService } from 'src/app/theme.service';+import { ThemeService } from 'src/app/_services/theme.service';+import { BookTheme } from 'src/app/_models/preferences/book-theme';import { SiteTheme, ThemeProvider } from 'src/app/_models/preferences/site-theme';import { User } from 'src/app/_models/user';import { AccountService } from 'src/app/_services/account.service';@@ -45,7 +46,7 @@ export class ThemeManagerComponent implements OnInit, OnDestroy {}applyTheme(theme: SiteTheme) {-+if (this.user) {const pref = Object.assign({}, this.user.preferences);pref.theme = theme;@@ -56,7 +57,7 @@ export class ThemeManagerComponent implements OnInit, OnDestroy {this.themeService.setTheme(theme.name);});}-+}updateDefault(theme: SiteTheme) {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.htmlindex 8c8e9f8fa..40ba2c9ad 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@@ -13,126 +13,131 @@These are global settings that are bound to your account.</p>- <ngb-accordion [closeOthers]="true" activeIds="reading-panel" #acc="ngbAccordion">- <ngb-panel id="reading-panel" title="Reading">- <ng-template ngbPanelHeader>- <!-- <div class="d-flex align-items-center justify-content-between">- <button ngbPanelToggle class="btn container-fluid text-start ps-0 accordion-header">Reading</button>- <span class="pull-right"><i class="fa fa-angle-{{acc.isExpanded('reading-panel') ? 'down' : 'up'}}" aria-hidden="true"></i></span>- </div> -->- <h2 class="accordion-header">- <button class="accordion-button" ngbPanelToggle type="button" [attr.aria-expanded]="acc.isExpanded('reading-panel')" aria-controls="collapseOne">- Reading- </button>- </h2>- </ng-template>- <ng-template ngbPanelContent>- <form [formGroup]="settingsForm" *ngIf="user !== undefined">- <h3 id="manga-header">Image Reader</h3>+ <form [formGroup]="settingsForm" *ngIf="user !== undefined">- <div class="row g-0">- <div class="col-md-6 col-sm-12 pe-2 mb-2">- <label for="settings-reading-direction" class="form-label">Reading Direction</label> <i class="fa fa-info-circle" aria-hidden="true" placement="right" [ngbTooltip]="readingDirectionTooltip" role="button" tabindex="0"></i>- <ng-template #readingDirectionTooltip>Direction to click to move to next page. Right to Left means you click on left side of screen to move to next page.</ng-template>- <span class="visually-hidden" id="settings-reading-direction-help">Direction to click to move to next page. Right to Left means you click on left side of screen to move to next page.</span>- <select class="form-select" aria-describedby="manga-header" formControlName="readingDirection" id="settings-reading-direction">- <option *ngFor="let opt of readingDirections" [value]="opt.value">{{opt.text | titlecase}}</option>- </select>- </div>+ <ngb-accordion [closeOthers]="true" [activeIds]="AccordionPanelID.ImageReader" #acc="ngbAccordion">+ <ngb-panel [id]="AccordionPanelID.ImageReader" title="Image Reader">+ <ng-template ngbPanelHeader>+ <h2 class="accordion-header">+ <button class="accordion-button" ngbPanelToggle type="button" [attr.aria-expanded]="acc.isExpanded(AccordionPanelID.ImageReader)" aria-controls="collapseOne">+ Image Reader+ </button>+ </h2>+ </ng-template>+ <ng-template ngbPanelContent>+ <div class="row g-0">+ <div class="col-md-6 col-sm-12 pe-2 mb-2">+ <label for="settings-reading-direction" class="form-label">Reading Direction</label> <i class="fa fa-info-circle" aria-hidden="true" placement="right" [ngbTooltip]="readingDirectionTooltip" role="button" tabindex="0"></i>+ <ng-template #readingDirectionTooltip>Direction to click to move to next page. Right to Left means you click on left side of screen to move to next page.</ng-template>+ <span class="visually-hidden" id="settings-reading-direction-help">Direction to click to move to next page. Right to Left means you click on left side of screen to move to next page.</span>+ <select class="form-select" aria-describedby="manga-header" formControlName="readingDirection" id="settings-reading-direction">+ <option *ngFor="let opt of readingDirections" [value]="opt.value">{{opt.text | titlecase}}</option>+ </select>+ </div>- <div class="col-md-6 col-sm-12 pe-2 mb-2">- <label for="settings-scaling-option" class="form-label">Scaling Options</label> <i class="fa fa-info-circle" aria-hidden="true" placement="right" [ngbTooltip]="taskBackupTooltip" role="button" tabindex="0"></i>- <ng-template #taskBackupTooltip>How to scale the image to your screen.</ng-template>- <span class="visually-hidden" id="settings-scaling-option-help">How to scale the image to your screen.</span>- <select class="form-select" aria-describedby="manga-header" formControlName="scalingOption" id="settings-scaling-option">- <option *ngFor="let opt of scalingOptions" [value]="opt.value">{{opt.text | titlecase}}</option>- </select>+ <div class="col-md-6 col-sm-12 pe-2 mb-2">+ <label for="settings-scaling-option" class="form-label">Scaling Options</label> <i class="fa fa-info-circle" aria-hidden="true" placement="right" [ngbTooltip]="taskBackupTooltip" role="button" tabindex="0"></i>+ <ng-template #taskBackupTooltip>How to scale the image to your screen.</ng-template>+ <span class="visually-hidden" id="settings-scaling-option-help">How to scale the image to your screen.</span>+ <select class="form-select" aria-describedby="manga-header" formControlName="scalingOption" id="settings-scaling-option">+ <option *ngFor="let opt of scalingOptions" [value]="opt.value">{{opt.text | titlecase}}</option>+ </select>+ </div></div>- </div>- <div class="row g-0">- <div class="col-md-6 col-sm-12 pe-2 mb-2">- <label for="settings-pagesplit-option" class="form-label">Page Splitting</label> <i class="fa fa-info-circle" aria-hidden="true" placement="right" [ngbTooltip]="pageSplitOptionTooltip" role="button" tabindex="0"></i>- <ng-template #pageSplitOptionTooltip>How to split a full width image (ie both left and right images are combined)</ng-template>- <span class="visually-hidden" id="settings-pagesplit-option-help">How to split a full width image (ie both left and right images are combined)</span>- <select class="form-select" aria-describedby="manga-header" formControlName="pageSplitOption" id="settings-pagesplit-option">- <option *ngFor="let opt of pageSplitOptions" [value]="opt.value">{{opt.text | titlecase}}</option>- </select>- </div>- <div class="col-md-6 col-sm-12 pe-2 mb-2">- <label for="settings-readingmode-option" class="form-label">Reading Mode</label>- <select class="form-select" aria-describedby="manga-header" formControlName="readerMode" id="settings-readingmode-option">- <option *ngFor="let opt of readingModes" [value]="opt.value">{{opt.text | titlecase}}</option>- </select>+ <div class="row g-0">+ <div class="col-md-6 col-sm-12 pe-2 mb-2">+ <label for="settings-pagesplit-option" class="form-label">Page Splitting</label> <i class="fa fa-info-circle" aria-hidden="true" placement="right" [ngbTooltip]="pageSplitOptionTooltip" role="button" tabindex="0"></i>+ <ng-template #pageSplitOptionTooltip>How to split a full width image (ie both left and right images are combined)</ng-template>+ <span class="visually-hidden" id="settings-pagesplit-option-help">How to split a full width image (ie both left and right images are combined)</span>+ <select class="form-select" aria-describedby="manga-header" formControlName="pageSplitOption" id="settings-pagesplit-option">+ <option *ngFor="let opt of pageSplitOptions" [value]="opt.value">{{opt.text | titlecase}}</option>+ </select>+ </div>+ <div class="col-md-6 col-sm-12 pe-2 mb-2">+ <label for="settings-readingmode-option" class="form-label">Reading Mode</label>+ <select class="form-select" aria-describedby="manga-header" formControlName="readerMode" id="settings-readingmode-option">+ <option *ngFor="let opt of readingModes" [value]="opt.value">{{opt.text | titlecase}}</option>+ </select>+ </div></div>- </div>- <div class="row g-0">- <div class="col-md-6 col-sm-12 pe-2 mb-2" *ngIf="false">- <label for="settings-layoutmode-option" class="form-label">Layout Mode</label> <i class="fa fa-info-circle" aria-hidden="true" placement="right" [ngbTooltip]="layoutModeTooltip" role="button" tabindex="0"></i>- <ng-template #layoutModeTooltip>Render a single image to the screen to two side-by-side images</ng-template>- <span class="visually-hidden" id="settings-layoutmode-option-help"><ng-container [ngTemplateOutlet]="layoutModeTooltip"></ng-container></span>- <select class="form-select" aria-describedby="manga-header" formControlName="layoutMode" id="settings-layoutmode-option">- <option *ngFor="let opt of layoutModes" [value]="opt.value">{{opt.text | titlecase}}</option>- </select>- </div>- <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)="settingsForm.markAsTouched()"- [style.background]="user.preferences.backgroundColor"- [cpAlphaChannel]="'disabled'"- [(colorPicker)]="user.preferences.backgroundColor"/>+ <div class="row g-0">+ <div class="col-md-6 col-sm-12 pe-2 mb-2" *ngIf="false">+ <label for="settings-layoutmode-option" class="form-label">Layout Mode</label> <i class="fa fa-info-circle" aria-hidden="true" placement="right" [ngbTooltip]="layoutModeTooltip" role="button" tabindex="0"></i>+ <ng-template #layoutModeTooltip>Render a single image to the screen to two side-by-side images</ng-template>+ <span class="visually-hidden" id="settings-layoutmode-option-help"><ng-container [ngTemplateOutlet]="layoutModeTooltip"></ng-container></span>+ <select class="form-select" aria-describedby="manga-header" formControlName="layoutMode" id="settings-layoutmode-option">+ <option *ngFor="let opt of layoutModes" [value]="opt.value">{{opt.text | titlecase}}</option>+ </select>+ </div>+ <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)="settingsForm.markAsTouched()"+ [style.background]="user.preferences.backgroundColor"+ [cpAlphaChannel]="'disabled'"+ [(colorPicker)]="user.preferences.backgroundColor"/>+ </div></div>- </div>- <div class="row g-0">- <div class="col-md-6 col-sm-12 pe-2 mb-2">- <div class="mb-3">- <label id="auto-close-label" class="form-label"></label>- <div class="mb-3">+ <div class="row g-0">+ <div class="col-md-6 col-sm-12 pe-2 mb-2">+ <div class="mb-3 mt-1"><div class="form-check form-switch">- <input type="checkbox" id="auto-close" formControlName="autoCloseMenu" class="form-check-input" [value]="true" aria-labelledby="auto-close-label">+ <input type="checkbox" id="auto-close" role="switch" formControlName="autoCloseMenu" class="form-check-input" [value]="true" aria-labelledby="auto-close-label"><label class="form-check-label" for="auto-close">Auto Close Menu</label></div></div></div>- </div>- <div class="col-md-6 col-sm-12 pe-2 mb-2">- <div class="mb-3">- <label id="show-screen-hints-label" class="form-label"></label>- <div class="mb-3">+ <div class="col-md-6 col-sm-12 pe-2 mb-2">+ <div class="mb-3 mt-1"><div class="form-check form-switch">- <input type="checkbox" id="show-screen-hints" formControlName="showScreenHints" class="form-check-input" [value]="true" aria-labelledby="auto-close-label">+ <input type="checkbox" id="show-screen-hints" role="switch" formControlName="showScreenHints" class="form-check-input" [value]="true" aria-labelledby="auto-close-label"><label class="form-check-label" for="show-screen-hints">Show Screen Hints</label></div></div></div></div>- </div>- <hr>- <h3>Book Reader</h3>++ <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.touched && !settingsForm.dirty">Save</button>+ </div>+ </ng-template>+ </ngb-panel>++ <ngb-panel id="AccordionPanelID.BookReader" title="Book Reader">+ <ng-template ngbPanelHeader>+ <h2 class="accordion-header">+ <button class="accordion-button" ngbPanelToggle type="button" [attr.aria-expanded]="acc.isExpanded(AccordionPanelID.BookReader)" aria-controls="collapseOne">+ Book Reader+ </button>+ </h2>+ </ng-template>+ <ng-template ngbPanelContent><div class="row g-0">- <div class="col-md-6 col-sm-12 pe-2 mb-3">- <label id="dark-mode-label" class="form-label"></label>+ <div class="col-md-4 col-sm-12 pe-2 mb-3">+ <label id="taptopaginate-label" class="form-label"></label><div class="mb-3"><div class="form-check form-switch">- <input type="checkbox" id="dark-mode" formControlName="bookReaderDarkMode" class="form-check-input" [value]="true" aria-labelledby="dark-mode-label">- <label class="form-check-label" for="dark-mode">Dark Mode</label>+ <input type="checkbox" role="switch" id="taptopaginate" formControlName="bookReaderTapToPaginate" class="form-check-input" [value]="true" aria-labelledby="taptopaginate-label">+ <label id="taptopaginate" class="form-check-label">Tap to Paginate</label> <i class="fa fa-info-circle" aria-hidden="true" placement="right" [ngbTooltip]="tapToPaginateOptionTooltip" role="button" tabindex="0"></i>+ <ng-template #tapToPaginateOptionTooltip>Should the sides of the book reader screen allow tapping on it to move to prev/next page</ng-template>+ <span class="visually-hidden" id="settings-taptopaginate-option-help">Should the sides of the book reader screen allow tapping on it to move to prev/next page</span></div></div></div>-- <div class="col-md-6 col-sm-12 pe-2 mb-3">- <label id="taptopaginate-label" class="form-label"></label>+ <div class="col-md-4 col-sm-12 pe-2 mb-3">+ <label id="immersivemode-label" class="form-label"></label><div class="mb-3"><div class="form-check form-switch">- <input type="checkbox" id="taptopaginate" formControlName="bookReaderTapToPaginate" class="form-check-input" [value]="true" aria-labelledby="taptopaginate-label">- <label id="taptopaginate" class="form-check-label">Tap to Paginate</label> <i class="fa fa-info-circle" aria-hidden="true" placement="right" [ngbTooltip]="tapToPaginateOptionTooltip" role="button" tabindex="0"></i>- <ng-template #tapToPaginateOptionTooltip>Should the sides of the book reader screen allow tapping on it to move to prev/next page</ng-template>- <span class="visually-hidden" id="settings-taptopaginate-option-help">Should the sides of the book reader screen allow tapping on it to move to prev/next page</span>+ <input type="checkbox" role="switch" id="immersivemode" formControlName="bookReaderImmersiveMode" class="form-check-input" [value]="true" aria-labelledby="immersivemode-label">+ <label id="immersivemode" class="form-check-label">Immersive Mode</label> <i class="fa fa-info-circle" aria-hidden="true" placement="right" [ngbTooltip]="immersivemodeOptionTooltip" role="button" tabindex="0"></i>+ <ng-template #immersivemodeOptionTooltip>This will hide the menu behind a click on the reader document and turn tap to paginate on</ng-template>+ <span class="visually-hidden" id="settings-immersivemode-option-help">This will hide the menu behind a click on the reader document and turn tap to paginate on</span></div></div></div>@@ -140,7 +145,7 @@<div class="row g-0"><div class="col-md-6 col-sm-12 pe-2 mb-3">- <label for="settings-book-reading-direction" class="form-label">Book Reading Direction</label> <i class="fa fa-info-circle" aria-hidden="true" placement="right" [ngbTooltip]="bookReadingDirectionTooltip" role="button" tabindex="0"></i>+ <label for="settings-book-reading-direction" class="form-label">Reading Direction</label> <i class="fa fa-info-circle" aria-hidden="true" placement="right" [ngbTooltip]="bookReadingDirectionTooltip" role="button" tabindex="0"></i><ng-template #bookReadingDirectionTooltip>Direction to click to move to next page. Right to Left means you click on left side of screen to move to next page.</ng-template><span class="visually-hidden" id="settings-reading-direction-help">Direction to click to move to next page. Right to Left means you click on left side of screen to move to next page.</span><select class="form-select" aria-describedby="settings-reading-direction-help" formControlName="bookReaderReadingDirection">@@ -159,41 +164,67 @@</div></div>+ <div class="row g-0">+ <div class="col-md-6 col-sm-12 pe-2 mb-3">+ <label for="settings-book-layout-mode" class="form-label">Layout Mode</label> <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. Default 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>+ <span class="visually-hidden" id="settings-book-layout-mode-help"><ng-container [ngTemplateOutlet]="bookLayoutModeTooltip"></ng-container></span>+ <select class="form-select" aria-describedby="settings-book-layout-mode-help" formControlName="bookReaderLayoutMode" id="settings-book-layout-mode">+ <option *ngFor="let opt of bookLayoutModes" [value]="opt.value">{{opt.text | titlecase}}</option>+ </select>+ </div>+ <div class="col-md-6 col-sm-12 pe-2 mb-3">+ <label for="settings-color-theme-option" class="form-label">Color Theme</label> <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 id="font-size" class="form-label">Font Size</label>- <div class="custom-slider"><ngx-slider [options]="bookReaderFontSizeOptions" formControlName="bookReaderFontSize" aria-labelledby="font-size"></ngx-slider></div>+ <label for="fontsize" class="form-label range-label">Font Size</label>+ <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">- <label class="form-label">Line Height</label> <i class="fa fa-info-circle" aria-hidden="true" placement="right" [ngbTooltip]="bookLineHeightOptionTooltip" role="button" tabindex="0"></i>- <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 class="custom-slider"><ngx-slider [options]="bookReaderLineSpacingOptions" formControlName="bookReaderLineSpacing" aria-describedby="settings-booklineheight-option-help"></ngx-slider></div>+ <div class="range-label">+ <label class="form-label" for="linespacing">Line Height</label> <i class="fa fa-info-circle" aria-hidden="true" placement="right" [ngbTooltip]="bookLineHeightOptionTooltip" role="button" tabindex="0"></i>+ <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"+ formControlName="bookReaderLineSpacing" aria-describedby="settings-booklineheight-option-help">+ <span class="range-text">{{settingsForm.get('bookReaderLineSpacing')?.value + '%'}}</span></div><div class="col-md-4 col-sm-12 pe-2 mb-3">- <label class="form-label">Margin</label> <i class="fa fa-info-circle" aria-hidden="true" placement="right" [ngbTooltip]="bookReaderMarginOptionTooltip" role="button" tabindex="0"></i>- <ng-template #bookReaderMarginOptionTooltip>How much spacing on each side of the screen. This will override to 0 on mobile devices regardless of this setting.</ng-template>- <span class="visually-hidden" id="settings-bookmargin-option-help">How much spacing on each side of the screen. This will override to 0 on mobile devices regardless of this setting.</span>- <div class="custom-slider"><ngx-slider [options]="bookReaderMarginOptions" formControlName="bookReaderMargin" aria-describedby="bookmargin"></ngx-slider></div>+ <div class="range-label">+ <label class="form-label">Margin</label> <i class="fa fa-info-circle" aria-hidden="true" placement="right" [ngbTooltip]="bookReaderMarginOptionTooltip" role="button" tabindex="0"></i>+ <ng-template #bookReaderMarginOptionTooltip>How much spacing on each side of the screen. This will override to 0 on mobile devices regardless of this setting.</ng-template>+ <span class="visually-hidden" id="settings-bookmargin-option-help">How much spacing on each side of the screen. This will override to 0 on mobile devices regardless of this setting.</span>+ </div>++ <input type="range" class="form-range" id="margin" min="0" max="30" step="5" formControlName="bookReaderMargin" aria-describedby="bookmargin">+ <span class="range-text">{{settingsForm.get('bookReaderMargin')?.value + '%'}}</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.touched && !settingsForm.dirty">Save</button></div>- </form>- </ng-template>- </ngb-panel>- </ngb-accordion>- </ng-container>- <ng-container *ngIf="tab.fragment === 'bookmarks'">- <app-series-bookmarks></app-series-bookmarks>+ </ng-template>+ </ngb-panel>+ </ngb-accordion>+ </form></ng-container><ng-container *ngIf="tab.fragment === 'password'"><ng-container *ngIf="(isAdmin || hasChangePasswordRole); else noPermission">diff --git a/UI/Web/src/app/user-settings/user-preferences/user-preferences.component.scss b/UI/Web/src/app/user-settings/user-preferences/user-preferences.component.scssindex e86d1bd19..84f37233b 100644--- a/UI/Web/src/app/user-settings/user-preferences/user-preferences.component.scss+++ b/UI/Web/src/app/user-settings/user-preferences/user-preferences.component.scss@@ -4,4 +4,15 @@.container {padding-top: 10px;+}++.form-range {+ width: 90%;+}+.range-label {+ width: 100%;+}+.range-text {+ vertical-align: top;+ margin-left: 5px;}\ No newline at end of filediff --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.tsindex d5a0cbfd9..2180d783d 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@@ -1,17 +1,22 @@import { Component, OnDestroy, OnInit } from '@angular/core';import { FormControl, FormGroup, Validators } from '@angular/forms';import { ToastrService } from 'ngx-toastr';-import { take } from 'rxjs/operators';-import { Options } from '@angular-slider/ngx-slider';+import { take, takeUntil } from 'rxjs/operators';import { Title } from '@angular/platform-browser';import { BookService } from 'src/app/book-reader/book.service';-import { readingDirections, scalingOptions, pageSplitOptions, readingModes, Preferences, layoutModes } from 'src/app/_models/preferences/preferences';+import { readingDirections, scalingOptions, pageSplitOptions, readingModes, Preferences, bookLayoutModes, layoutModes } from 'src/app/_models/preferences/preferences';import { User } from 'src/app/_models/user';import { AccountService } from 'src/app/_services/account.service';-import { NavService } from 'src/app/_services/nav.service';import { ActivatedRoute, Router } from '@angular/router';import { SettingsService } from 'src/app/admin/settings.service';-import { forkJoin } from 'rxjs';+import { bookColorThemes } from 'src/app/book-reader/reader-settings/reader-settings.component';+import { BookPageLayoutMode } from 'src/app/_models/book-page-layout-mode';+import { forkJoin, Subject } from 'rxjs';++enum AccordionPanelID {+ ImageReader = 'image-reader',+ BookReader = 'book-reader'+}@Component({selector: 'app-user-preferences',@@ -25,6 +30,8 @@ export class UserPreferencesComponent implements OnInit, OnDestroy {pageSplitOptions = pageSplitOptions;readingModes = readingModes;layoutModes = layoutModes;+ bookLayoutModes = bookLayoutModes;+ bookColorThemes = bookColorThemes;settingsForm: FormGroup = new FormGroup({});passwordChangeForm: FormGroup = new FormGroup({});@@ -36,27 +43,10 @@ export class UserPreferencesComponent implements OnInit, OnDestroy {resetPasswordErrors: string[] = [];obserableHandles: Array<any> = [];-- bookReaderLineSpacingOptions: Options = {- floor: 100,- ceil: 250,- step: 10,- };- bookReaderMarginOptions: Options = {- floor: 0,- ceil: 30,- step: 5,- };- bookReaderFontSizeOptions: Options = {- floor: 50,- ceil: 300,- step: 10,- };fontFamilies: Array<string> = [];tabs: Array<{title: string, fragment: string}> = [{title: 'Preferences', fragment: ''},- {title: 'Bookmarks', fragment: 'bookmarks'},{title: 'Password', fragment: 'password'},{title: '3rd Party Clients', fragment: 'clients'},{title: 'Theme', fragment: 'theme'},@@ -65,12 +55,16 @@ export class UserPreferencesComponent implements OnInit, OnDestroy {opdsEnabled: boolean = false;makeUrl: (val: string) => string = (val: string) => {return this.transformKeyToOpdsUrl(val)};- backgroundColor: any; // TODO: Hook into user pref+ private onDestroy = new Subject<void>();++ get AccordionPanelID() {+ return AccordionPanelID;+ }- constructor(private accountService: AccountService, private toastr: ToastrService, private bookService: BookService,- private navService: NavService, private titleService: Title, private route: ActivatedRoute, private settingsService: SettingsService,+ constructor(private accountService: AccountService, private toastr: ToastrService, private bookService: BookService,+ private titleService: Title, private route: ActivatedRoute, private settingsService: SettingsService,private router: Router) {- this.fontFamilies = this.bookService.getFontFamilies();+ this.fontFamilies = this.bookService.getFontFamilies().map(f => f.title);this.route.fragment.subscribe(frag => {const tab = this.tabs.filter(item => item.fragment === frag);@@ -106,7 +100,7 @@ export class UserPreferencesComponent implements OnInit, OnDestroy {if (this.fontFamilies.indexOf(this.user.preferences.bookReaderFontFamily) < 0) {this.user.preferences.bookReaderFontFamily = 'default';}-+this.settingsForm.addControl('readingDirection', new FormControl(this.user.preferences.readingDirection, []));this.settingsForm.addControl('scalingOption', new FormControl(this.user.preferences.scalingOption, []));this.settingsForm.addControl('pageSplitOption', new FormControl(this.user.preferences.pageSplitOption, []));@@ -114,13 +108,15 @@ export class UserPreferencesComponent implements OnInit, OnDestroy {this.settingsForm.addControl('showScreenHints', new FormControl(this.user.preferences.showScreenHints, []));this.settingsForm.addControl('readerMode', new FormControl(this.user.preferences.readerMode, []));this.settingsForm.addControl('layoutMode', new FormControl(this.user.preferences.layoutMode, []));- this.settingsForm.addControl('bookReaderDarkMode', new FormControl(this.user.preferences.bookReaderDarkMode, []));this.settingsForm.addControl('bookReaderFontFamily', new FormControl(this.user.preferences.bookReaderFontFamily, []));this.settingsForm.addControl('bookReaderFontSize', new FormControl(this.user.preferences.bookReaderFontSize, []));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('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, []));+ this.settingsForm.addControl('bookReaderImmersiveMode', new FormControl(this.user?.preferences.bookReaderImmersiveMode, []));this.settingsForm.addControl('theme', new FormControl(this.user.preferences.theme, []));});@@ -132,10 +128,18 @@ export class UserPreferencesComponent implements OnInit, OnDestroy {const values = this.passwordChangeForm.value;this.passwordsMatch = values.password === values.confirmPassword;}));++ this.settingsForm.get('bookReaderImmersiveMode')?.valueChanges.pipe(takeUntil(this.onDestroy)).subscribe(mode => {+ if (mode) {+ this.settingsForm.get('bookReaderTapToPaginate')?.setValue(true);+ }+ });}ngOnDestroy() {this.obserableHandles.forEach(o => o.unsubscribe());+ this.onDestroy.next();+ this.onDestroy.complete();}public get password() { return this.passwordChangeForm.get('password'); }@@ -150,14 +154,16 @@ export class UserPreferencesComponent implements OnInit, OnDestroy {this.settingsForm.get('readerMode')?.setValue(this.user.preferences.readerMode);this.settingsForm.get('layoutMode')?.setValue(this.user.preferences.layoutMode);this.settingsForm.get('pageSplitOption')?.setValue(this.user.preferences.pageSplitOption);- this.settingsForm.get('bookReaderDarkMode')?.setValue(this.user.preferences.bookReaderDarkMode);this.settingsForm.get('bookReaderFontFamily')?.setValue(this.user.preferences.bookReaderFontFamily);this.settingsForm.get('bookReaderFontSize')?.setValue(this.user.preferences.bookReaderFontSize);this.settingsForm.get('bookReaderLineSpacing')?.setValue(this.user.preferences.bookReaderLineSpacing);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('bookReaderLayoutMode')?.setValue(this.user.preferences.bookReaderLayoutMode);+ this.settingsForm.get('bookReaderThemeName')?.setValue(this.user.preferences.bookReaderThemeName);this.settingsForm.get('theme')?.setValue(this.user.preferences.theme);+ this.settingsForm.get('bookReaderImmersiveMode')?.setValue(this.user.preferences.bookReaderImmersiveMode);}resetPasswordForm() {@@ -170,23 +176,26 @@ export class UserPreferencesComponent implements OnInit, OnDestroy {if (this.user === undefined) return;const modelSettings = this.settingsForm.value;const data: Preferences = {- readingDirection: parseInt(modelSettings.readingDirection, 10),- scalingOption: parseInt(modelSettings.scalingOption, 10),- pageSplitOption: parseInt(modelSettings.pageSplitOption, 10),- autoCloseMenu: modelSettings.autoCloseMenu,- readerMode: parseInt(modelSettings.readerMode, 10),+ readingDirection: parseInt(modelSettings.readingDirection, 10),+ scalingOption: parseInt(modelSettings.scalingOption, 10),+ pageSplitOption: parseInt(modelSettings.pageSplitOption, 10),+ autoCloseMenu: modelSettings.autoCloseMenu,+ readerMode: parseInt(modelSettings.readerMode, 10),layoutMode: parseInt(modelSettings.layoutMode, 10),showScreenHints: modelSettings.showScreenHints,- backgroundColor: this.user.preferences.backgroundColor,- bookReaderDarkMode: modelSettings.bookReaderDarkMode,+ backgroundColor: modelSettings.backgroundColor, // this.user.preferences.backgroundColor,bookReaderFontFamily: modelSettings.bookReaderFontFamily,bookReaderLineSpacing: modelSettings.bookReaderLineSpacing,bookReaderFontSize: modelSettings.bookReaderFontSize,bookReaderMargin: modelSettings.bookReaderMargin,bookReaderTapToPaginate: modelSettings.bookReaderTapToPaginate,bookReaderReadingDirection: parseInt(modelSettings.bookReaderReadingDirection, 10),- theme: modelSettings.theme+ bookReaderLayoutMode: parseInt(modelSettings.bookReaderLayoutMode, 10),+ bookReaderThemeName: modelSettings.bookReaderThemeName,+ theme: modelSettings.theme,+ bookReaderImmersiveMode: modelSettings.bookReaderImmersiveMode};+this.obserableHandles.push(this.accountService.updatePreferences(data).subscribe((updatedPrefs) => {this.toastr.success('Server settings updated');if (this.user) {diff --git a/UI/Web/src/app/user-settings/user-settings.module.ts b/UI/Web/src/app/user-settings/user-settings.module.tsindex c2e9c940b..856924289 100644--- a/UI/Web/src/app/user-settings/user-settings.module.ts+++ b/UI/Web/src/app/user-settings/user-settings.module.ts@@ -1,23 +1,20 @@import { NgModule } from '@angular/core';import { CommonModule } from '@angular/common';-import { SeriesBookmarksComponent } from './series-bookmarks/series-bookmarks.component';import { UserPreferencesComponent } from './user-preferences/user-preferences.component';import { NgbAccordionModule, NgbNavModule, NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap';import { ReactiveFormsModule } from '@angular/forms';-import { NgxSliderModule } from '@angular-slider/ngx-slider';import { UserSettingsRoutingModule } from './user-settings-routing.module';import { ApiKeyComponent } from './api-key/api-key.component';import { PipeModule } from '../pipe/pipe.module';import { SiteThemeProviderPipe } from './_pipes/site-theme-provider.pipe';import { ThemeManagerComponent } from './theme-manager/theme-manager.component';-import { SidenavModule } from '../sidenav/sidenav.module';import { ColorPickerModule } from 'ngx-color-picker';+import { SidenavModule } from '../sidenav/sidenav.module';@NgModule({declarations: [- SeriesBookmarksComponent,UserPreferencesComponent,ApiKeyComponent,ThemeManagerComponent,@@ -26,14 +23,17 @@ import { ColorPickerModule } from 'ngx-color-picker';imports: [CommonModule,ReactiveFormsModule,+NgbAccordionModule,NgbNavModule,NgbTooltipModule,- NgxSliderModule,- UserSettingsRoutingModule,++ ColorPickerModule, // User prefernces background color+PipeModule,SidenavModule,- ColorPickerModule, // User prefernces background color++ UserSettingsRoutingModule,],exports: [SiteThemeProviderPipe,diff --git a/UI/Web/src/assets/fonts/OpenDyslexic2/OpenDyslexic-Bold.otf b/UI/Web/src/assets/fonts/OpenDyslexic2/OpenDyslexic-Bold.otfnew file mode 100644index 000000000..4c492e2fcBinary files /dev/null and b/UI/Web/src/assets/fonts/OpenDyslexic2/OpenDyslexic-Bold.otf differdiff --git a/UI/Web/src/assets/fonts/OpenDyslexic2/OpenDyslexic-BoldItalic.otf b/UI/Web/src/assets/fonts/OpenDyslexic2/OpenDyslexic-BoldItalic.otfnew file mode 100644index 000000000..f71b4303fBinary files /dev/null and b/UI/Web/src/assets/fonts/OpenDyslexic2/OpenDyslexic-BoldItalic.otf differdiff --git a/UI/Web/src/assets/fonts/OpenDyslexic2/OpenDyslexic-Italic.otf b/UI/Web/src/assets/fonts/OpenDyslexic2/OpenDyslexic-Italic.otfnew file mode 100644index 000000000..fdead4d54Binary files /dev/null and b/UI/Web/src/assets/fonts/OpenDyslexic2/OpenDyslexic-Italic.otf differdiff --git a/UI/Web/src/assets/fonts/OpenDyslexic2/OpenDyslexic-Regular.otf b/UI/Web/src/assets/fonts/OpenDyslexic2/OpenDyslexic-Regular.otfnew file mode 100644index 000000000..1226d2ab2Binary files /dev/null and b/UI/Web/src/assets/fonts/OpenDyslexic2/OpenDyslexic-Regular.otf differdiff --git a/UI/Web/src/styles.scss b/UI/Web/src/styles.scssindex 4238fa834..1af759d4a 100644--- a/UI/Web/src/styles.scss+++ b/UI/Web/src/styles.scss@@ -20,7 +20,6 @@@import './theme/components/buttons';@import './theme/components/toast';@import './theme/components/checkbox';-@import './theme/components/tagbadge';@import './theme/components/list';@import './theme/components/navbar';@import './theme/components/popover';@@ -37,7 +36,6 @@@import './theme/components/progress';@import './theme/components/sidenav';@import './theme/components/carousel';-@import './theme/components/progress';@import './theme/utilities/utilities';@@ -64,8 +62,6 @@ label, select, .clickable {cursor: default;}--// Needed for fullscreenapp-root {background-color: inherit;diff --git a/UI/Web/src/theme/components/_accordion.scss b/UI/Web/src/theme/components/_accordion.scssindex fd415d641..8a9226ba7 100644--- a/UI/Web/src/theme/components/_accordion.scss+++ b/UI/Web/src/theme/components/_accordion.scss@@ -4,12 +4,16 @@}.accordion-item {- background-color: var(--accordion-body-bg-color); //$dark-card-color;+ background-color: var(--accordion-body-bg-color);color: var(--accordion-body-text-color);border-color: var(--accordion-body-border-color);div[role="tabpanel"] {background-color: var(--accordion-header-bg-color);++ .accordion-body {+ background-color: var(--accordion-active-body-bg-color);+ }}}diff --git a/UI/Web/src/theme/components/_card.scss b/UI/Web/src/theme/components/_card.scssindex 5f8d544ba..bbc0266d1 100644--- a/UI/Web/src/theme/components/_card.scss+++ b/UI/Web/src/theme/components/_card.scss@@ -3,6 +3,7 @@color: var(--card-text-color);border-color: var(--card-border-color);position: relative;+ border: var(--card-border);.card-overlay {background-color: var(--card-overlay-bg-color);diff --git a/UI/Web/src/theme/components/_input.scss b/UI/Web/src/theme/components/_input.scssindex 7c6f07e58..231be419a 100644--- a/UI/Web/src/theme/components/_input.scss+++ b/UI/Web/src/theme/components/_input.scss@@ -1,4 +1,4 @@-input, .form-control {+input:not([type="range"]), .form-control {background-color: var(--input-bg-color);color: var(--input-text-color);border-color: var(--input-border-color);@@ -23,3 +23,11 @@ input, .form-control {color: var(--input-placeholder-color);}}++.form-range::-webkit-slider-thumb:active {+ background-color: var(--input-range-active-color);+}++.form-range::-webkit-slider-thumb {+ background-color: var(--input-range-color);+}diff --git a/UI/Web/src/theme/components/progress.scss b/UI/Web/src/theme/components/_progress.scsssimilarity index 100%rename from UI/Web/src/theme/components/progress.scssrename to UI/Web/src/theme/components/_progress.scssdiff --git a/UI/Web/src/theme/components/_tagbadge.scss b/UI/Web/src/theme/components/_tagbadge.scssdeleted file mode 100644index 7f4e979d1..000000000--- a/UI/Web/src/theme/components/_tagbadge.scss+++ /dev/null@@ -1,11 +0,0 @@-.tagbadge {- border: 1px solid var(--tagbadge-border-color);- color: var(--tagbadge-text-color);- background-color: var(--tagbadge-bg-color);-}--.typeahead-input .tagbadge {- border: 1px solid var(--tagbadge-typeahead-border-color);- color: var(--tagbadge-typeahead-text-color);- background-color: var(--tagbadge-typeahead-bg-color);-}diff --git a/UI/Web/src/theme/themes/dark.scss b/UI/Web/src/theme/themes/dark.scssindex 82e41590b..91219d354 100644--- a/UI/Web/src/theme/themes/dark.scss+++ b/UI/Web/src/theme/themes/dark.scss@@ -74,7 +74,7 @@--toast-info-bg-color: #2F96B4;--toast-warning-bg-color: #F89406;- /* Checkboxes */+ /* Checkboxes/Switch */--checkbox-checked-bg-color: var(--primary-color);--checkbox-border-color: var(--input-focused-border-color);--checkbox-focus-border-color: var(--primary-color);@@ -84,9 +84,9 @@--tagbadge-border-color: rgba(239, 239, 239, 0.125);--tagbadge-text-color: var(--body-text-color);--tagbadge-bg-color: var(--nav-tab-hover-bg-color);- --tagbadge-typeahead-border-color: rgba(239, 239, 239, 0.125);- --tagbadge-typeahead-text-color: var(--body-text-color);- --tagbadge-typeahead-bg-color: var(--primary-color);+ --tagbadge-filled-border-color: rgba(239, 239, 239, 0.125);+ --tagbadge-filled-text-color: var(--body-text-color);+ --tagbadge-filled-bg-color: var(--primary-color);/* Side Nav */--side-nav-bg-color: rgba(0,0,0,0.2);@@ -150,14 +150,15 @@/* Accordion */--accordion-header-text-color: rgba(74, 198, 148, 0.9);- --accordion-header-bg-color: rgba(52, 60, 70, 0.5); /* This is a good accent color */- --accordion-body-bg-color: rgba(22,27,34,0.5);+ --accordion-header-bg-color: rgba(52, 60, 70, 0.5);+ --accordion-body-bg-color: #292929;--accordion-body-border-color: rgba(239, 239, 239, 0.125);--accordion-body-text-color: var(--body-text-color);--accordion-header-collapsed-text-color: rgba(74, 198, 148, 0.9);- --accordion-header-collapsed-bg-color: rgba(22,27,34,0.5);+ --accordion-header-collapsed-bg-color: #292929;--accordion-button-focus-border-color: unset;--accordion-button-focus-box-shadow: unset;+ --accordion-active-body-bg-color: #292929;/* Breadcrumb */--breadcrumb-bg-color: #292d32;@@ -183,13 +184,17 @@/* Card */--card-bg-color: rgba(22,27,34,0.5);--card-text-color: var(--body-text-color);- --card-border-color: rgba(239, 239, 239, 0.125);+ --card-border-width: 0 1px 1px 1px;+ --card-border-style: solid;+ --card-border-color: transparent;--card-progress-bar-color: var(--primary-color);--card-overlay-bg-color: rgba(0, 0, 0, 0);--card-overlay-hover-bg-color: rgba(0, 0, 0, 0.2);/* Slider */--slider-text-color: white;+ --input-range-color: var(--primary-color);+ --input-range-active-color: var(--primary-color-darker-shade);/* Manga Reader */--manga-reader-overlay-filter: blur(10px);@@ -210,7 +215,9 @@--carousel-hover-header-text-decoration: none;/** Drawer */- --drawer-background-color: black;+ --drawer-background-color: black; // TODO: Remove this for bg+ --drawer-bg-color: #292929;+ --drawer-text-color: white;/** Event Widget */--event-widget-bg-color: rgb(1, 4, 9);@@ -218,4 +225,12 @@--event-widget-text-color: var(--body-text-color);--event-widget-item-border-color: rgba(53, 53, 53, 0.5);--event-widget-border-color: rgba(1, 4, 9, 0.5);++ /* Search */+ --search-result-text-lite-color: initial;++ /* Bulk Selection */+ --bulk-selection-text-color: var(--navbar-text-color);+ --bulk-selection-highlight-text-color: var(--primary-color);+}diff --git a/UI/Web/src/theme/themes/e-ink.scss b/UI/Web/src/theme/themes/e-ink.scssindex 51080dc29..2e1c4b3c9 100644--- a/UI/Web/src/theme/themes/e-ink.scss+++ b/UI/Web/src/theme/themes/e-ink.scss@@ -2,12 +2,14 @@--color-scheme: light;--primary-color: black;--primary-color-dark-shade: #3B9E76;+ --primary-color-darker-shade: #338A67;+ --primary-color-darkest-shade: #25624A;--error-color: #ff4136;- --bs-body-bg: #fff;+ --bs-body-bg: #fff;--body-text-color: black;--btn-icon-filter: invert(1) grayscale(100%) brightness(200%);-+/* Navbar */--navbar-bg-color: black;--navbar-text-color: white;@@ -17,9 +19,11 @@/* Inputs */--input-bg-color: #fff;--input-focused-border-color: #ccc;- --input-bg-readonly-color: unset;+ --input-bg-readonly-color: rgba(0,0,0,0.2);--input-placeholder-color: #aeaeae;--input-border-color: #ccc;+ --input-range-color: var(--primary-color);+ --input-range-active-color: var(--primary-color-darker-shade);/* Buttons */--btn-primary-text-color: black;@@ -50,7 +54,7 @@--nav-tab-text-color: var(--body-text-color);--nav-tab-bg-color: black;--nav-tab-hover-border-color: black;-+/* Checkboxes */--checkbox-checked-bg-color: var(--primary-color);--checkbox-bg-color: white;@@ -109,6 +113,8 @@/* Card */--card-text-color: #000;+ --card-border-width: 0 1px 1px 1px;+ --card-border-style: solid;--card-border-color: #ccc;--card-progress-bar-color: var(--primary-color);--card-overlay-hover-bg-color: rgba(0, 0, 0, 0.2);@@ -126,7 +132,7 @@--dropdown-item-hover-bg-color: var(--primary-color);--dropdown-overlay-color: rgba(0,0,0,0.5);--dropdown-item-bg-color: white;-+/* Manga Reader */--manga-reader-overlay-filter: none;--manga-reader-overlay-bg-color: rgba(0,0,0,0.5);@@ -134,7 +140,7 @@--manga-reader-bg-color: black;--manga-reader-next-highlight-bg-color: transparent;--manga-reader-prev-highlight-bg-color: transparent;-+/* Radios */--radio-accent-color: var(--primary-color);--radio-hover-accent-color: var(--primary-color-dark-shade);@@ -145,7 +151,9 @@--carousel-hover-header-text-decoration: none;/** Drawer */- --drawer-background-color: white;+ --drawer-background-color: white; // TODO: Remove this for bg+ --drawer-bg-color: white;+ --drawer-text-color: black;/* Pagination */--pagination-active-link-border-color: var(--primary-color);@@ -163,7 +171,7 @@--event-widget-text-color: black;--event-widget-item-border-color: lightgrey;--event-widget-border-color: lightgrey;-+/* Popover */--popover-body-bg-color: var(--navbar-bg-color);--popover-body-text-color: var(--navbar-text-color);@@ -172,4 +180,10 @@--popover-bg-color: lightgrey;--popover-border-color: lightgrey;-}\ No newline at end of file+ /* Search */+ --search-result-text-lite-color: rgba(0,0,0,1);++ /* Bulk Selection */+ --bulk-selection-text-color: white;+ --bulk-selection-highlight-text-color: white;+}diff --git a/UI/Web/src/theme/themes/light.scss b/UI/Web/src/theme/themes/light.scssindex d8b040e16..6d91d80cf 100644--- a/UI/Web/src/theme/themes/light.scss+++ b/UI/Web/src/theme/themes/light.scss@@ -3,24 +3,28 @@--color-scheme: light;--primary-color: #4ac694;--primary-color-dark-shade: #3B9E76;+ --primary-color-darker-shade: #338A67;+ --primary-color-darkest-shade: #25624A;--error-color: #ff4136;- --bs-body-bg: #fff;+ --bs-body-bg: #fff;--body-text-color: #333;- --btn-icon-filter: invert(1) grayscale(100%) brightness(200%);-+ --btn-icon-filter: none;+/* Navbar */--navbar-bg-color: black;--navbar-text-color: white;--navbar-fa-icon-color: white;--navbar-btn-hover-outline-color: rgba(255, 255, 255, 1);-+/* Inputs */--input-bg-color: #fff;--input-focused-border-color: #ccc;- --input-bg-readonly-color: unset;+ --input-bg-readonly-color: rgba(0,0,0,0.2);--input-placeholder-color: #aeaeae;--input-border-color: #ccc;-+ --input-range-color: var(--primary-color);+ --input-range-active-color: var(--primary-color-darker-shade);+/* Buttons */--btn-primary-text-color: black;--btn-primary-bg-color: white;@@ -69,30 +73,31 @@--side-nav-active-bg-color: rgba(0,0,0,0.5);--side-nav-item-active-text-color: white;--side-nav-overlay-color: rgba(0,0,0,0.5);--++/* Checkboxes */--checkbox-checked-bg-color: var(--primary-color);--checkbox-bg-color: white;--checkbox-border-color: var(--primary-color);--checkbox-focus-border-color: var(--input-border-color);-+/* Tagbadge */--tagbadge-bg-color: #c9c9c9;-+/* Toasts */--toast-success-bg-color: rgba(74, 198, 148, 0.9);--toast-error-bg-color: #BD362F;--toast-info-bg-color: #2F96B4;--toast-warning-bg-color: #F89406;-+/* Rating star */--ratingstar-star-empty: #b0c4de;--ratingstar-star-filled: var(--primary-color);-+/* Global */- --accent-bg-color: rgba(206, 206, 206, 0.5);- --accent-text-color: black;+ --accent-bg-color: rgba(206, 206, 206, 0.5); // Drawer had: var(--bs-body-bg)+ --accent-text-color: grey;+ --accent-text-size: 0.8rem;--hr-color: rgba(239, 239, 239, 0.125);--grid-breakpoints-xs: $grid-breakpoint-xs;--grid-breakpoints-sm: $grid-breakpoint-sm;@@ -102,32 +107,34 @@--body-font-family: "EBGaramond", "Helvetica Neue", sans-serif;--brand-font-family: "Spartan", sans-serif;--text-muted-color: #aaa;-+/* Breadcrumb */--breadcrumb-bg-color: #eaeaea;--breadcrumb-item-text-color: var(--body-text-color);/* Card */--card-text-color: #000;+ --card-border-width: 0 1px 1px 1px;+ --card-border-style: solid;--card-border-color: #ccc;--card-progress-bar-color: var(--primary-color);--card-overlay-bg-color: rgba(0, 0, 0, 0);--card-overlay-hover-bg-color: rgba(0, 0, 0, 0.2);-+/* List items */--list-group-item-text-color: var(--body-text-color);--list-group-item-bg-color: white;- --list-group-hover-text-color: inherit;+ --list-group-hover-text-color: var(--body-text-color);--list-group-hover-bg-color: #eaeaea;--list-group-item-border-color: rgba(239, 239, 239, 0.125);--list-group-active-border-color: none;-+/* Dropdown */--dropdown-item-hover-text-color: white;--dropdown-item-hover-bg-color: var(--primary-color);--dropdown-overlay-color: rgba(0,0,0,0.5);--dropdown-item-bg-color: white;-+/* Manga Reader */--manga-reader-overlay-filter: blur(10px);--manga-reader-overlay-bg-color: rgba(0,0,0,0.5);@@ -135,7 +142,7 @@--manga-reader-bg-color: black;--manga-reader-next-highlight-bg-color: rgba(65, 225, 100, 0.5);--manga-reader-prev-highlight-bg-color: rgba(65, 105, 225, 0.5);-+/* Radios */--radio-accent-color: var(--primary-color);--radio-hover-accent-color: var(--primary-color-dark-shade);@@ -146,7 +153,9 @@--carousel-hover-header-text-decoration: underline;/** Drawer */- --drawer-background-color: white;+ --drawer-background-color: white; // TODO: Use bg+ --drawer-bg-color: white;+ --drawer-text-color: black;/* Pagination */--pagination-active-link-border-color: var(--primary-color);@@ -172,4 +181,23 @@--popover-arrow-color: lightgrey;--popover-bg-color: lightgrey;--popover-border-color: lightgrey;-}\ No newline at end of file++ /* Accordion */+ --accordion-header-text-color: rgba(74, 198, 148, 0.9);+ --accordion-header-bg-color: var(--bs-body-bg);+ --accordion-body-bg-color: var(--bs-body-bg);+ --accordion-active-body-bg-color: var(--bs-body-bg);+ --accordion-body-border-color: rgba(239, 239, 239, 0.125);+ --accordion-body-text-color: var(--body-text-color);+ --accordion-header-collapsed-text-color: var(--body-text-color);+ --accordion-header-collapsed-bg-color: var(--bs-body-bg);+ --accordion-button-focus-border-color: rgba(74, 198, 148, 0.9);+ --accordion-button-focus-box-shadow: unset;++ /* Search */+ --search-result-text-lite-color: rgba(0,0,0,1);++ /* Bulk Selection */+ --bulk-selection-text-color: var(--navbar-text-color);+ --bulk-selection-highlight-text-color: var(--primary-color);+ }diff --git a/UI/Web/src/theme/utilities/_global.scss b/UI/Web/src/theme/utilities/_global.scssindex 908b97dc6..1121ad658 100644--- a/UI/Web/src/theme/utilities/_global.scss+++ b/UI/Web/src/theme/utilities/_global.scss@@ -8,7 +8,6 @@ body {color-scheme: var(--color-scheme);max-height: 100%;overflow-y: auto;- //margin-top: 56px; // Set by nav service}@@ -20,6 +19,7 @@ hr {background-color: var(--accent-bg-color) !important;color: var(--accent-text-color) !important;box-shadow: inset 0px 0px 8px 1px var(--accent-bg-color) !important;+ font-size: var(--accent-text-size) !important;}.text-muted {diff --git a/UI/Web/storage/admin.json b/UI/Web/storage/admin.jsonnew file mode 100644index 000000000..f4ec35503--- /dev/null+++ b/UI/Web/storage/admin.json@@ -0,0 +1,4 @@+{+ "cookies": [],+ "origins": []+}\ No newline at end of filediff --git a/UI/Web/storage/user.json b/UI/Web/storage/user.jsonnew file mode 100644index 000000000..f4ec35503--- /dev/null+++ b/UI/Web/storage/user.json@@ -0,0 +1,4 @@+{+ "cookies": [],+ "origins": []+}\ No newline at end of file