WebP Covers + Series Detail Enhancements (#1652)
* Implemented save covers as webp. Reworked screen to provide more information up front about webp and what browsers can support it. * cleaned up pages to use compact numbering and made compact numbering expand into one decimal place (20.5K) * Fixed an issue with adding new device * If a book has an invalid language set, drop the language altogether rather than reading in a corrupted entry. * Ensure genres and tags render alphabetically. Improved support for partial volumes in Comic parser. * Ensure all people, tags, collections, and genres are in alphabetical order. * Moved some code to Extensions to clean up code. * More unit tests * Cleaned up release year filter css * Tweaked some code in all series to make bulk deletes cleaner on the UI. * Trying out want to read and unread count on series detail page * Added Want to Read button for series page to make it easy to see when something is in want to read list and toggle it. Added tooltips instead of title to buttons, but they don't style correctly. Added a continue point under cover image. * Code smells
This commit is contained in:
parent
f907486c74
commit
e75b208d59
43 changed files with 481 additions and 175 deletions
|
@ -100,6 +100,7 @@ public class ComicParserTests
|
|||
[InlineData("Teen Titans v1 001 (1966-02) (digital) (OkC.O.M.P.U.T.O.-Novus)", "1")]
|
||||
[InlineData("Scott Pilgrim 02 - Scott Pilgrim vs. The World (2005)", "0")]
|
||||
[InlineData("Superman v1 024 (09-10 1943)", "1")]
|
||||
[InlineData("Superman v1.5 024 (09-10 1943)", "1.5")]
|
||||
[InlineData("Amazing Man Comics chapter 25", "0")]
|
||||
[InlineData("Invincible 033.5 - Marvel Team-Up 14 (2006) (digital) (Minutemen-Slayer)", "0")]
|
||||
[InlineData("Cyberpunk 2077 - Trauma Team 04.cbz", "0")]
|
||||
|
@ -118,6 +119,7 @@ public class ComicParserTests
|
|||
[InlineData("Cyberpunk 2077 - Trauma Team 04.cbz", "0")]
|
||||
[InlineData("2000 AD 0366 [1984-04-28] (flopbie)", "0")]
|
||||
[InlineData("Daredevil - v6 - 10 - (2019)", "6")]
|
||||
[InlineData("Daredevil - v6.5", "6.5")]
|
||||
// Tome Tests
|
||||
[InlineData("Daredevil - t6 - 10 - (2019)", "6")]
|
||||
[InlineData("Batgirl T2000 #57", "2000")]
|
||||
|
|
|
@ -41,7 +41,7 @@ internal class MockReadingItemServiceForCacheService : IReadingItemService
|
|||
return 1;
|
||||
}
|
||||
|
||||
public string GetCoverImage(string fileFilePath, string fileName, MangaFormat format)
|
||||
public string GetCoverImage(string fileFilePath, string fileName, MangaFormat format, bool saveAsWebP)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
|
|
@ -6,9 +6,11 @@ using System.IO.Abstractions.TestingHelpers;
|
|||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using API.Data;
|
||||
using API.Data.Repositories;
|
||||
using API.DTOs.Settings;
|
||||
using API.Entities;
|
||||
using API.Entities.Enums;
|
||||
using API.Entities.Metadata;
|
||||
using API.Helpers;
|
||||
using API.Helpers.Converters;
|
||||
using API.Services;
|
||||
|
@ -129,7 +131,6 @@ public class CleanupServiceTests
|
|||
|
||||
#endregion
|
||||
|
||||
|
||||
#region DeleteSeriesCoverImages
|
||||
|
||||
[Fact]
|
||||
|
@ -469,6 +470,105 @@ public class CleanupServiceTests
|
|||
|
||||
#endregion
|
||||
|
||||
#region CleanupDbEntries
|
||||
|
||||
[Fact]
|
||||
public async Task CleanupDbEntries_CleanupAbandonedChapters()
|
||||
{
|
||||
var c = EntityFactory.CreateChapter("1", false, new List<MangaFile>(), 1);
|
||||
_context.Series.Add(new Series()
|
||||
{
|
||||
Name = "Test",
|
||||
Library = new Library() {
|
||||
Name = "Test LIb",
|
||||
Type = LibraryType.Manga,
|
||||
},
|
||||
Volumes = new List<Volume>()
|
||||
{
|
||||
EntityFactory.CreateVolume("0", new List<Chapter>()
|
||||
{
|
||||
c,
|
||||
}),
|
||||
}
|
||||
});
|
||||
|
||||
_context.AppUser.Add(new AppUser()
|
||||
{
|
||||
UserName = "majora2007"
|
||||
});
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
var readerService = new ReaderService(_unitOfWork, Substitute.For<ILogger<ReaderService>>(), Substitute.For<IEventHub>());
|
||||
|
||||
var user = await _unitOfWork.UserRepository.GetUserByUsernameAsync("majora2007", AppUserIncludes.Progress);
|
||||
await readerService.MarkChaptersUntilAsRead(user, 1, 5);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
// Validate correct chapters have read status
|
||||
Assert.Equal(1, (await _unitOfWork.AppUserProgressRepository.GetUserProgressAsync(1, 1)).PagesRead);
|
||||
|
||||
var cleanupService = new CleanupService(Substitute.For<ILogger<CleanupService>>(), _unitOfWork,
|
||||
Substitute.For<IEventHub>(),
|
||||
new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), new MockFileSystem()));
|
||||
|
||||
// Delete the Chapter
|
||||
_context.Chapter.Remove(c);
|
||||
await _unitOfWork.CommitAsync();
|
||||
Assert.Single(await _unitOfWork.AppUserProgressRepository.GetUserProgressForSeriesAsync(1, 1));
|
||||
|
||||
await cleanupService.CleanupDbEntries();
|
||||
|
||||
Assert.Empty(await _unitOfWork.AppUserProgressRepository.GetUserProgressForSeriesAsync(1, 1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task CleanupDbEntries_RemoveTagsWithoutSeries()
|
||||
{
|
||||
var c = new CollectionTag()
|
||||
{
|
||||
Title = "Test Tag"
|
||||
};
|
||||
var s = new Series()
|
||||
{
|
||||
Name = "Test",
|
||||
Library = new Library()
|
||||
{
|
||||
Name = "Test LIb",
|
||||
Type = LibraryType.Manga,
|
||||
},
|
||||
Volumes = new List<Volume>(),
|
||||
Metadata = new SeriesMetadata()
|
||||
{
|
||||
CollectionTags = new List<CollectionTag>()
|
||||
{
|
||||
c
|
||||
}
|
||||
}
|
||||
};
|
||||
_context.Series.Add(s);
|
||||
|
||||
_context.AppUser.Add(new AppUser()
|
||||
{
|
||||
UserName = "majora2007"
|
||||
});
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
var cleanupService = new CleanupService(Substitute.For<ILogger<CleanupService>>(), _unitOfWork,
|
||||
Substitute.For<IEventHub>(),
|
||||
new DirectoryService(Substitute.For<ILogger<DirectoryService>>(), new MockFileSystem()));
|
||||
|
||||
// Delete the Chapter
|
||||
_context.Series.Remove(s);
|
||||
await _unitOfWork.CommitAsync();
|
||||
|
||||
await cleanupService.CleanupDbEntries();
|
||||
|
||||
Assert.Empty(await _unitOfWork.CollectionTagRepository.GetAllTagsAsync());
|
||||
}
|
||||
|
||||
#endregion
|
||||
// #region CleanupBookmarks
|
||||
//
|
||||
// [Fact]
|
||||
|
|
|
@ -46,7 +46,7 @@ internal class MockReadingItemService : IReadingItemService
|
|||
return 1;
|
||||
}
|
||||
|
||||
public string GetCoverImage(string fileFilePath, string fileName, MangaFormat format)
|
||||
public string GetCoverImage(string fileFilePath, string fileName, MangaFormat format, bool saveAsWebP)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue