fix: MangaDex title fallback + image CDN URL
All checks were successful
Deploy / deploy (push) Successful in 2m31s

- Title: cascade en → fr → ja-ro → ko-ro → zh-ro → first available to avoid silently dropping mangas without English title (e.g. One Piece stored as ja-ro)
- Image: use uploads.mangadex.org CDN with .512.jpg thumbnail suffix instead of mangadex.org/covers which fails in prod
This commit is contained in:
ext.jeremy.guillot@maxicoffee.domains
2026-03-13 18:08:35 +01:00
parent 5eb650df6f
commit 2ffe559832

View File

@@ -58,7 +58,12 @@ readonly class MangadexProvider implements MangaProviderInterface
{ {
try { try {
$attributes = $result['attributes']; $attributes = $result['attributes'];
$title = $attributes['title']['en'] ?? null; $title = $attributes['title']['en']
?? $attributes['title']['fr']
?? $attributes['title']['ja-ro']
?? $attributes['title']['ko-ro']
?? $attributes['title']['zh-ro']
?? (!empty($attributes['title']) ? reset($attributes['title']) : null);
if (!$title) { if (!$title) {
return null; return null;
@@ -77,7 +82,7 @@ readonly class MangadexProvider implements MangaProviderInterface
} }
if ($relationship['type'] === 'cover_art') { if ($relationship['type'] === 'cover_art') {
$imageUrl = sprintf( $imageUrl = sprintf(
'https://mangadex.org/covers/%s/%s', 'https://uploads.mangadex.org/covers/%s/%s.512.jpg',
$result['id'], $result['id'],
$relationship['attributes']['fileName'] $relationship['attributes']['fileName']
); );