Manga Redesign (#321)
* Code cleanup, refactored FileRepository into Unit of Work. * Added AutoCloseMenu and ReaderMode user perferences to match UI * Added extra information to ChapterInfo * Build changes * Updated the readme to have open collective information and thanks to sponsors * Fixed an issue with UnitOfWork refactor and how stats was bootsrapped. Replaced stats.kavitareader with a temp url to test out redirection bug.
This commit is contained in:
parent
b958342394
commit
be2b78fa5a
40 changed files with 1608 additions and 87 deletions
|
|
@ -5,6 +5,7 @@ using System.Linq;
|
|||
using System.Threading.Tasks;
|
||||
using API.Comparators;
|
||||
using API.DTOs;
|
||||
using API.DTOs.Reader;
|
||||
using API.Entities;
|
||||
using API.Extensions;
|
||||
using API.Interfaces;
|
||||
|
|
@ -49,15 +50,27 @@ namespace API.Controllers
|
|||
|
||||
return File(content, "image/" + format);
|
||||
}
|
||||
|
||||
[HttpGet("chapter-path")]
|
||||
public async Task<ActionResult<string>> GetImagePath(int chapterId)
|
||||
|
||||
[HttpGet("chapter-info")]
|
||||
public async Task<ActionResult<ChapterInfoDto>> GetChapterInfo(int chapterId)
|
||||
{
|
||||
var chapter = await _cacheService.Ensure(chapterId);
|
||||
if (chapter == null) return BadRequest("There was an issue finding image file for reading");
|
||||
|
||||
if (chapter == null) return BadRequest("Could not find Chapter");
|
||||
var volume = await _unitOfWork.SeriesRepository.GetVolumeAsync(chapter.VolumeId);
|
||||
if (volume == null) return BadRequest("Could not find Volume");
|
||||
var (_, mangaFile) = await _cacheService.GetCachedPagePath(chapter, 0);
|
||||
return Ok(mangaFile.FilePath);
|
||||
var series = await _unitOfWork.SeriesRepository.GetSeriesByIdAsync(volume.SeriesId);
|
||||
|
||||
return Ok(new ChapterInfoDto()
|
||||
{
|
||||
ChapterNumber = chapter.Range,
|
||||
VolumeNumber = volume.Number + string.Empty,
|
||||
VolumeId = volume.Id,
|
||||
FileName = Path.GetFileName(mangaFile.FilePath),
|
||||
SeriesName = series?.Name,
|
||||
IsSpecial = chapter.IsSpecial,
|
||||
Pages = chapter.Pages,
|
||||
});
|
||||
}
|
||||
|
||||
[HttpGet("get-bookmark")]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue