From f40ee254c95aadb1ddc503870d66852033f8e2ae Mon Sep 17 00:00:00 2001 From: "Timothy J. Warren" Date: Mon, 10 Jan 2022 17:19:28 -0500 Subject: [PATCH] Fix more cover image stuff --- app/templates/anime-cover.php | 2 +- src/AnimeClient/API/Kitsu/Transformer/AnimeTransformer.php | 4 +++- src/AnimeClient/Controller.php | 2 +- src/AnimeClient/Controller/Manga.php | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/templates/anime-cover.php b/app/templates/anime-cover.php index c7f76fb0..4d604bd7 100644 --- a/app/templates/anime-cover.php +++ b/app/templates/anime-cover.php @@ -6,7 +6,7 @@ isAuthenticated()): ?> - picture($item['anime']['cover_image'], '.jpg') ?> + picture($item['anime']['cover_image'], '.jpg', ['width' => 220], ['width' => 220]) ?>
diff --git a/src/AnimeClient/API/Kitsu/Transformer/AnimeTransformer.php b/src/AnimeClient/API/Kitsu/Transformer/AnimeTransformer.php index 5c6bd1e2..34b2404b 100644 --- a/src/AnimeClient/API/Kitsu/Transformer/AnimeTransformer.php +++ b/src/AnimeClient/API/Kitsu/Transformer/AnimeTransformer.php @@ -125,7 +125,9 @@ final class AnimeTransformer extends AbstractTransformer { 'age_rating' => $base['ageRating'], 'age_rating_guide' => $base['ageRatingGuide'], 'characters' => $characters, - 'cover_image' => $base['posterImage']['original']['url'] ?? '/public/images/placeholder.png', + 'cover_image' => $base['posterImage']['views'][1]['url'] + ?? $base['posterImage']['original']['url'] + ?? '/public/images/placeholder.png', 'episode_count' => $base['episodeCount'], 'episode_length' => $base['episodeLength'], 'genres' => $genres, diff --git a/src/AnimeClient/Controller.php b/src/AnimeClient/Controller.php index c722dda9..fcf1351a 100644 --- a/src/AnimeClient/Controller.php +++ b/src/AnimeClient/Controller.php @@ -239,7 +239,7 @@ class Controller { protected function renderFullPage(HtmlView $view, string $template, array $data): HtmlView { $csp = [ - "default-src 'self' media.kitsu.io", + "default-src 'self' media.kitsu.io kitsu-production-media.s3.us-west-002.backblazeb2.com", "object-src 'none'", "child-src 'self' *.youtube.com polyfill.io", ]; diff --git a/src/AnimeClient/Controller/Manga.php b/src/AnimeClient/Controller/Manga.php index 56a37864..1509a278 100644 --- a/src/AnimeClient/Controller/Manga.php +++ b/src/AnimeClient/Controller/Manga.php @@ -67,7 +67,7 @@ final class Manga extends Controller { * @return void *@throws InvalidArgumentException */ - public function index(string $status = 'all', string $view = ''): void + public function index(string $status = 'all', ?string $view = ''): void { if ( ! in_array($status, [ 'all',