refactor(reader): serve pages as static files instead of base64

Replace the per-page API call (base64 payload) with static image URLs
served directly by Caddy from public/images/pages/{chapterId}/.

- LocalImageStorage now stores to public/images/ (was MANGA_DATA_PATH)
- LegacyChapterRepository returns /images/pages/{id}/{file} URLs,
  uses getimagesize() instead of loading file content into memory
- Delete GetChapterPage query/handler/response, ChapterPageResource,
  ChapterPageProvider, PageContent model
- Remove getPageContent() from ChapterRepositoryInterface
- Frontend: loadChapter() fetches chapter + all pages in parallel,
  ReaderPage uses URL instead of base64 data URI, InfiniteReader drops
  lazy-load observer side effect, readerStore drops loadedPages/preload
- GetChapterPagesTest: extract fixture images from CBZ at runtime,
  ignore tests/Fixtures/pages/ in .gitignore

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
ext.jeremy.guillot@maxicoffee.domains
2026-03-09 22:05:45 +01:00
parent 6875ad4222
commit 322c396165
19 changed files with 300 additions and 755 deletions

View File

@@ -6,12 +6,9 @@ namespace App\Tests\Domain\Reader\Adapter;
use App\Domain\Reader\Domain\Contract\Repository\ChapterRepositoryInterface;
use App\Domain\Reader\Domain\Exception\ChapterNotFoundException;
use App\Domain\Reader\Domain\Exception\PageNotFoundException;
use App\Domain\Reader\Domain\Model\ChapterContext;
use App\Domain\Reader\Domain\Model\Page;
use App\Domain\Reader\Domain\Model\PageContent;
use App\Domain\Reader\Domain\ValueObject\ChapterId;
use App\Domain\Reader\Domain\ValueObject\PageNumber;
final class InMemoryChapterRepository implements ChapterRepositoryInterface
{
@@ -94,28 +91,4 @@ final class InMemoryChapterRepository implements ChapterRepositoryInterface
return $nextChapter ? new ChapterId($nextChapter) : null;
}
public function getPageContent(ChapterId $chapterId, PageNumber $pageNumber): PageContent
{
if (!isset($this->chapters[$chapterId->getValue()])) {
throw ChapterNotFoundException::forChapter($chapterId);
}
$pages = $this->chapters[$chapterId->getValue()]['pages'];
$index = $pageNumber->getValue() - 1;
if (!isset($pages[$index])) {
throw PageNotFoundException::forPage($chapterId, $pageNumber);
}
$page = $pages[$index];
return new PageContent(
$page->getId(),
$page->getPageNumber(),
base64_encode('fake-image-content'),
'image/jpeg',
800,
600
);
}
}
}