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
Fixed an issue where docker installs were trying to update wwwroot, when docker doesn't do reverse proxy stuff. (#1880)
Joe Milazzo0617d71d6b75
diff --git a/API.Tests/Services/ReadingListServiceTests.cs b/API.Tests/Services/ReadingListServiceTests.csindex d9f582719..b76aee059 100644--- a/API.Tests/Services/ReadingListServiceTests.cs+++ b/API.Tests/Services/ReadingListServiceTests.cs@@ -631,6 +631,128 @@ public class ReadingListServiceTests#endregion+ #region CalculateStartAndEndDates++ [Fact]+ public async Task CalculateStartAndEndDates_ShouldBeNothing_IfNothing()+ {+ await ResetDb();+ var s = new SeriesBuilder("Test")+ .WithMetadata(DbFactory.SeriesMetadata(new List<CollectionTag>()))+ .WithVolumes(new List<Volume>()+ {+ new VolumeBuilder("0")+ .WithChapter(new ChapterBuilder("1")+ .Build()+ )+ .WithChapter(new ChapterBuilder("2")+ .Build()+ )+ .Build()+ })+ .Build();+ _context.AppUser.Add(new AppUser()+ {+ UserName = "majora2007",+ ReadingLists = new List<ReadingList>(),+ Libraries = new List<Library>()+ {+ new Library()+ {+ Name = "Test LIb",+ Type = LibraryType.Book,+ Series = new List<Series>()+ {+ s+ }+ },+ }+ });++ await _context.SaveChangesAsync();++ var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync("majora2007", AppUserIncludes.ReadingLists);+ var readingList = DbFactory.ReadingList("Test");+ user.ReadingLists = new List<ReadingList>()+ {+ readingList+ };++ await _readingListService.AddChaptersToReadingList(1, new List<int>() {1, 2}, readingList);+++ _unitOfWork.UserRepository.Update(user);+ await _unitOfWork.CommitAsync();++ await _readingListService.CalculateStartAndEndDates(readingList);+ Assert.Equal(0, readingList.StartingMonth);+ Assert.Equal(0, readingList.StartingYear);+ Assert.Equal(0, readingList.EndingMonth);+ Assert.Equal(0, readingList.EndingYear);+ }++ [Fact]+ public async Task CalculateStartAndEndDates_ShouldBeSomething_IfChapterHasSet()+ {+ await ResetDb();+ var s = new SeriesBuilder("Test")+ .WithMetadata(DbFactory.SeriesMetadata(new List<CollectionTag>()))+ .WithVolumes(new List<Volume>()+ {+ new VolumeBuilder("0")+ .WithChapter(new ChapterBuilder("1")+ .WithReleaseDate(new DateTime(2005, 03, 01))+ .Build()+ )+ .WithChapter(new ChapterBuilder("2")+ .WithReleaseDate(new DateTime(2002, 03, 01))+ .Build()+ )+ .Build()+ })+ .Build();+ _context.AppUser.Add(new AppUser()+ {+ UserName = "majora2007",+ ReadingLists = new List<ReadingList>(),+ Libraries = new List<Library>()+ {+ new Library()+ {+ Name = "Test LIb",+ Type = LibraryType.Book,+ Series = new List<Series>()+ {+ s+ }+ },+ }+ });++ await _context.SaveChangesAsync();++ var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync("majora2007", AppUserIncludes.ReadingLists);+ var readingList = DbFactory.ReadingList("Test");+ user.ReadingLists = new List<ReadingList>()+ {+ readingList+ };++ await _readingListService.AddChaptersToReadingList(1, new List<int>() {1, 2}, readingList);+++ _unitOfWork.UserRepository.Update(user);+ await _unitOfWork.CommitAsync();++ await _readingListService.CalculateStartAndEndDates(readingList);+ Assert.Equal(3, readingList.StartingMonth);+ Assert.Equal(2002, readingList.StartingYear);+ Assert.Equal(3, readingList.EndingMonth);+ Assert.Equal(2005, readingList.EndingYear);+ }++ #endregion+#region FormatTitle[Fact]diff --git a/API/Helpers/Builders/ChapterBuilder.cs b/API/Helpers/Builders/ChapterBuilder.csindex ae4253a60..19e6aa40c 100644--- a/API/Helpers/Builders/ChapterBuilder.cs+++ b/API/Helpers/Builders/ChapterBuilder.cs@@ -1,4 +1,5 @@-using System.Collections.Generic;+using System;+using System.Collections.Generic;using API.Entities;using API.Entities.Enums;@@ -21,6 +22,12 @@ public class ChapterBuilder : IEntityBuilder<Chapter>};}+ public ChapterBuilder WithReleaseDate(DateTime time)+ {+ _chapter.ReleaseDate = time;+ return this;+ }+public ChapterBuilder WithAgeRating(AgeRating rating){_chapter.AgeRating = rating;diff --git a/API/Services/ReadingListService.cs b/API/Services/ReadingListService.csindex f6f0ffc3b..f2c4f6893 100644--- a/API/Services/ReadingListService.cs+++ b/API/Services/ReadingListService.cs@@ -299,7 +299,7 @@ public class ReadingListService : IReadingListServicereturn;}var maxReleaseDate = items.Max(item => item.Chapter.ReleaseDate);- var minReleaseDate = items.Max(item => item.Chapter.ReleaseDate);+ var minReleaseDate = items.Min(item => item.Chapter.ReleaseDate);if (maxReleaseDate != DateTime.MinValue){readingListWithItems.EndingMonth = maxReleaseDate.Month;diff --git a/API/Startup.cs b/API/Startup.csindex 81e88510c..6f65e3a05 100644--- a/API/Startup.cs+++ b/API/Startup.cs@@ -364,6 +364,7 @@ public class Startupprivate static void UpdateBaseUrlInIndex(string baseUrl){+ if (new OsInfo(Array.Empty<IOsVersionAdapter>()).IsDocker) return;var htmlDoc = new HtmlDocument();var indexHtmlPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "index.html");htmlDoc.Load(indexHtmlPath);diff --git a/openapi.json b/openapi.jsonindex 87b756e25..1b8e479d6 100644--- a/openapi.json+++ b/openapi.json@@ -7,7 +7,7 @@"name": "GPL-3.0","url": "https://github.com/Kareadita/Kavita/blob/develop/LICENSE"},- "version": "0.7.1.19"+ "version": "0.7.1.20"},"servers": [{@@ -15361,4 +15361,4 @@"description": "Responsible for all things Want To Read"}]-}+}\ No newline at end of file