diff --git a/app/Config/Fediverse.php b/app/Config/Fediverse.php new file mode 100644 index 0000000000000000000000000000000000000000..56c460f07aad89f2af8be20d9876465d814095c6 --- /dev/null +++ b/app/Config/Fediverse.php @@ -0,0 +1,40 @@ +<?php + +declare(strict_types=1); + +/** + * @copyright 2022 Podlibre + * @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3 + * @link https://castopod.org/ + */ + +namespace Config; + +use Modules\Fediverse\Config\Fediverse as FediverseBaseConfig; + +class Fediverse extends FediverseBaseConfig +{ + public function __construct() + { + parent::__construct(); + + $defaultBanner = config('Images') + ->podcastBannerDefaultPaths[service('settings')->get('App.theme')] ?? config( + 'Images' + )->podcastBannerDefaultPaths['default']; + + ['dirname' => $dirname, 'extension' => $extension, 'filename' => $filename] = pathinfo( + $defaultBanner['path'] + ); + $defaultBannerPath = $filename; + if ($dirname !== '.') { + $defaultBannerPathList = [$dirname, $filename]; + $defaultBannerPath = implode('/', $defaultBannerPathList); + } + + helper('media'); + + $this->defaultCoverImagePath = media_path($defaultBannerPath . '_federation.' . $extension); + $this->defaultCoverImageMimetype = $defaultBanner['mimetype']; + } +} diff --git a/app/Config/Images.php b/app/Config/Images.php index e48805adf64d6bde68ff3d7bcc54f9d7c1acf8b0..449a76d8c8ce004049233b104c4a9bc4159de5cd 100644 --- a/app/Config/Images.php +++ b/app/Config/Images.php @@ -126,11 +126,43 @@ class Images extends BaseConfig ], ]; - public string $avatarDefaultPath = 'castopod-avatar-default.jpg'; + public string $avatarDefaultPath = 'castopod-avatar.jpg'; public string $avatarDefaultMimeType = 'image/jpg'; - public string $podcastBannerDefaultPath = 'castopod-banner-default.jpg'; + /** + * @var array<string, array<string, string>> + */ + public array $podcastBannerDefaultPaths = [ + 'default' => [ + 'path' => 'castopod-banner-pine.jpg', + 'mimetype' => 'image/jpeg', + ], + 'pine' => [ + 'path' => 'castopod-banner-pine.jpg', + 'mimetype' => 'image/jpeg', + ], + 'crimson' => [ + 'path' => 'castopod-banner-crimson.jpg', + 'mimetype' => 'image/jpeg', + ], + 'amber' => [ + 'path' => 'castopod-banner-amber.jpg', + 'mimetype' => 'image/jpeg', + ], + 'lake' => [ + 'path' => 'castopod-banner-lake.jpg', + 'mimetype' => 'image/jpeg', + ], + 'jacaranda' => [ + 'path' => 'castopod-banner-jacaranda.jpg', + 'mimetype' => 'image/jpeg', + ], + 'onyx' => [ + 'path' => 'castopod-banner-onyx.jpg', + 'mimetype' => 'image/jpeg', + ], + ]; public string $podcastBannerDefaultMimeType = 'image/jpeg'; @@ -144,6 +176,10 @@ class Images extends BaseConfig * @var array<string, array<string, int|string>> */ public array $personAvatarSizes = [ + 'federation' => [ + 'width' => 400, + 'height' => 400, + ], 'tiny' => [ 'width' => 40, 'height' => 40, diff --git a/app/Controllers/WebmanifestController.php b/app/Controllers/WebmanifestController.php index 4e98aecc94b2eecc27852cd20ebcc5625cc811c1..c001b12d11f3dcdf7067993a8477eeb13923c41a 100644 --- a/app/Controllers/WebmanifestController.php +++ b/app/Controllers/WebmanifestController.php @@ -42,8 +42,7 @@ class WebmanifestController extends Controller 'background' => '#F9F3F0', ], 'onyx' => [ - 'theme' => - '#040406', + 'theme' => '#040406', 'background' => '#F3F3F7', ], ]; diff --git a/app/Entities/Podcast.php b/app/Entities/Podcast.php index 7d13531df7f5da8a240f096b71ca5da2a1da2a3a..55a2ec3c0cb955199ac3fa4c7d95cf39c2c09f52 100644 --- a/app/Entities/Podcast.php +++ b/app/Entities/Podcast.php @@ -271,11 +271,13 @@ class Podcast extends Entity public function getBanner(): Image { if ($this->banner_id === null) { + $defaultBanner = config('Images') + ->podcastBannerDefaultPaths[service('settings')->get('App.theme')] ?? config( + 'Images' + )->podcastBannerDefaultPaths['default']; return new Image([ - 'file_path' => config('Images') - ->podcastBannerDefaultPath, - 'file_mimetype' => config('Images') - ->podcastBannerDefaultMimeType, + 'file_path' => $defaultBanner['path'], + 'file_mimetype' => $defaultBanner['mimetype'], 'file_size' => 0, 'file_metadata' => [ 'sizes' => config('Images') diff --git a/modules/Admin/Controllers/PodcastController.php b/modules/Admin/Controllers/PodcastController.php index 5f39fe124faa33b9c300f4b5b86b24bf2458bbce..cf56486020f89c8fef7f5850b64abfacd86072cd 100644 --- a/modules/Admin/Controllers/PodcastController.php +++ b/modules/Admin/Controllers/PodcastController.php @@ -12,6 +12,7 @@ namespace Modules\Admin\Controllers; use App\Entities\Location; use App\Entities\Podcast; +use App\Models\ActorModel; use App\Models\CategoryModel; use App\Models\EpisodeModel; use App\Models\LanguageModel; @@ -369,6 +370,10 @@ class PodcastController extends BaseController return redirect()->back(); } + $db = db_connect(); + + $db->transStart(); + $mediaModel = new MediaModel(); if (! $mediaModel->deleteMedia($this->podcast->banner)) { return redirect() @@ -377,6 +382,18 @@ class PodcastController extends BaseController ->with('errors', $mediaModel->errors()); } + // remove banner url from actor + $actor = (new ActorModel())->getActorById($this->podcast->actor_id); + + if ($actor !== null) { + $actor->cover_image_url = null; + $actor->cover_image_mimetype = null; + + (new ActorModel())->update($actor->id, $actor); + } + + $db->transComplete(); + return redirect()->back(); } diff --git a/modules/Fediverse/Config/Fediverse.php b/modules/Fediverse/Config/Fediverse.php index 19dfebb9ec773c05b6231e20bef669e0a3bd1ce8..96a12b5063e64204303d9629614570698bd1133e 100644 --- a/modules/Fediverse/Config/Fediverse.php +++ b/modules/Fediverse/Config/Fediverse.php @@ -30,11 +30,11 @@ class Fediverse extends BaseConfig * Default avatar and cover images * -------------------------------------------------------------------- */ - public string $defaultAvatarImagePath = 'media/castopod-avatar-default_thumbnail.jpg'; + public string $defaultAvatarImagePath = 'media/castopod-avatar_fediveration.jpg'; public string $defaultAvatarImageMimetype = 'image/jpeg'; - public string $defaultCoverImagePath = 'media/castopod-cover-default.jpg'; + public string $defaultCoverImagePath = 'media/castopod-banner-pine_fediveration.jpg'; public string $defaultCoverImageMimetype = 'image/jpeg'; diff --git a/public/media/castopod-avatar-default.jpg b/public/media/castopod-avatar.jpg similarity index 100% rename from public/media/castopod-avatar-default.jpg rename to public/media/castopod-avatar.jpg diff --git a/public/media/castopod-avatar-default_medium.webp b/public/media/castopod-avatar_medium.webp similarity index 100% rename from public/media/castopod-avatar-default_medium.webp rename to public/media/castopod-avatar_medium.webp diff --git a/public/media/castopod-avatar-default_thumbnail.webp b/public/media/castopod-avatar_thumbnail.webp similarity index 100% rename from public/media/castopod-avatar-default_thumbnail.webp rename to public/media/castopod-avatar_thumbnail.webp diff --git a/public/media/castopod-avatar-default_tiny.webp b/public/media/castopod-avatar_tiny.webp similarity index 100% rename from public/media/castopod-avatar-default_tiny.webp rename to public/media/castopod-avatar_tiny.webp diff --git a/public/media/castopod-banner-amber.jpg b/public/media/castopod-banner-amber.jpg new file mode 100644 index 0000000000000000000000000000000000000000..6537335274534451c691ce91453d9560ce250cd6 Binary files /dev/null and b/public/media/castopod-banner-amber.jpg differ diff --git a/public/media/castopod-banner-amber_federation.jpg b/public/media/castopod-banner-amber_federation.jpg new file mode 100644 index 0000000000000000000000000000000000000000..425305f336bbdcf95e3657feb65c4e1702345c1a Binary files /dev/null and b/public/media/castopod-banner-amber_federation.jpg differ diff --git a/public/media/castopod-banner-amber_medium.webp b/public/media/castopod-banner-amber_medium.webp new file mode 100644 index 0000000000000000000000000000000000000000..234ec5321256f258ddb767995b21db1e8ede1dde Binary files /dev/null and b/public/media/castopod-banner-amber_medium.webp differ diff --git a/public/media/castopod-banner-amber_small.webp b/public/media/castopod-banner-amber_small.webp new file mode 100644 index 0000000000000000000000000000000000000000..8c9ec454df409e310a2b65cd091aa3d268f30d10 Binary files /dev/null and b/public/media/castopod-banner-amber_small.webp differ diff --git a/public/media/castopod-banner-crimson.jpg b/public/media/castopod-banner-crimson.jpg new file mode 100644 index 0000000000000000000000000000000000000000..3acd8e17e04a7633907b55b458d39ca14d6b5e10 Binary files /dev/null and b/public/media/castopod-banner-crimson.jpg differ diff --git a/public/media/castopod-banner-crimson_federation.jpg b/public/media/castopod-banner-crimson_federation.jpg new file mode 100644 index 0000000000000000000000000000000000000000..a016c399eb9457e524450d431a2aa2e77e89705d Binary files /dev/null and b/public/media/castopod-banner-crimson_federation.jpg differ diff --git a/public/media/castopod-banner-default_medium.webp b/public/media/castopod-banner-crimson_medium.webp similarity index 63% rename from public/media/castopod-banner-default_medium.webp rename to public/media/castopod-banner-crimson_medium.webp index d0acadd7666269711fccc31a7164c96e038c0a51..4858928320164ed12fc6146d0043008e6d98b3d1 100644 Binary files a/public/media/castopod-banner-default_medium.webp and b/public/media/castopod-banner-crimson_medium.webp differ diff --git a/public/media/castopod-banner-crimson_small.webp b/public/media/castopod-banner-crimson_small.webp new file mode 100644 index 0000000000000000000000000000000000000000..1291f73b30bf3ca227cb8665a89064dee801c99f Binary files /dev/null and b/public/media/castopod-banner-crimson_small.webp differ diff --git a/public/media/castopod-banner-default_small.webp b/public/media/castopod-banner-default_small.webp deleted file mode 100644 index ada9220efcd129b78410afd07bb7c36675f7cfb8..0000000000000000000000000000000000000000 Binary files a/public/media/castopod-banner-default_small.webp and /dev/null differ diff --git a/public/media/castopod-banner-jacaranda.jpg b/public/media/castopod-banner-jacaranda.jpg new file mode 100644 index 0000000000000000000000000000000000000000..d636d0c7805256f7d747835b62dd0c3c08535259 Binary files /dev/null and b/public/media/castopod-banner-jacaranda.jpg differ diff --git a/public/media/castopod-banner-default_federation.jpg b/public/media/castopod-banner-jacaranda_federation.jpg similarity index 69% rename from public/media/castopod-banner-default_federation.jpg rename to public/media/castopod-banner-jacaranda_federation.jpg index 938e3bef51fb1a7eed49f0559a0e4e289093ab3c..33eada3c02a42e0c4c6b52dfd6a8775f0639f217 100644 Binary files a/public/media/castopod-banner-default_federation.jpg and b/public/media/castopod-banner-jacaranda_federation.jpg differ diff --git a/public/media/castopod-banner-jacaranda_medium.webp b/public/media/castopod-banner-jacaranda_medium.webp new file mode 100644 index 0000000000000000000000000000000000000000..ffca50ee8a1371bbddd3d89799c5f2c568c7bd24 Binary files /dev/null and b/public/media/castopod-banner-jacaranda_medium.webp differ diff --git a/public/media/castopod-banner-jacaranda_small.webp b/public/media/castopod-banner-jacaranda_small.webp new file mode 100644 index 0000000000000000000000000000000000000000..b1154d229dad70d162d553fe1e0cca5852176ef8 Binary files /dev/null and b/public/media/castopod-banner-jacaranda_small.webp differ diff --git a/public/media/castopod-banner-lake.jpg b/public/media/castopod-banner-lake.jpg new file mode 100644 index 0000000000000000000000000000000000000000..982a362fc4ce276a6b6ff930c4718db3769fe139 Binary files /dev/null and b/public/media/castopod-banner-lake.jpg differ diff --git a/public/media/castopod-banner-lake_federation.jpg b/public/media/castopod-banner-lake_federation.jpg new file mode 100644 index 0000000000000000000000000000000000000000..f75279481d9c2cbb08f9c33d78d343ecaea2fa5f Binary files /dev/null and b/public/media/castopod-banner-lake_federation.jpg differ diff --git a/public/media/castopod-banner-lake_medium.webp b/public/media/castopod-banner-lake_medium.webp new file mode 100644 index 0000000000000000000000000000000000000000..4dcd70df17f100f0b3ecdca11dca61761f06ba58 Binary files /dev/null and b/public/media/castopod-banner-lake_medium.webp differ diff --git a/public/media/castopod-banner-lake_small.webp b/public/media/castopod-banner-lake_small.webp new file mode 100644 index 0000000000000000000000000000000000000000..b3e5c539456d6d178f69bea99c27b3b9a6c8ed3a Binary files /dev/null and b/public/media/castopod-banner-lake_small.webp differ diff --git a/public/media/castopod-banner-onyx.jpg b/public/media/castopod-banner-onyx.jpg new file mode 100644 index 0000000000000000000000000000000000000000..ef5839d5f8a18bcaa84760f8293462dbeb20d386 Binary files /dev/null and b/public/media/castopod-banner-onyx.jpg differ diff --git a/public/media/castopod-banner-onyx_federation.jpg b/public/media/castopod-banner-onyx_federation.jpg new file mode 100644 index 0000000000000000000000000000000000000000..73e4423a2518e41bd71912fd63cf5d8f86c06efa Binary files /dev/null and b/public/media/castopod-banner-onyx_federation.jpg differ diff --git a/public/media/castopod-banner-onyx_medium.webp b/public/media/castopod-banner-onyx_medium.webp new file mode 100644 index 0000000000000000000000000000000000000000..189f77f596862221062fe22a305577fe11bfa6a2 Binary files /dev/null and b/public/media/castopod-banner-onyx_medium.webp differ diff --git a/public/media/castopod-banner-onyx_small.webp b/public/media/castopod-banner-onyx_small.webp new file mode 100644 index 0000000000000000000000000000000000000000..81bd7fff7efb1060b4d29e5143367b49d436baef Binary files /dev/null and b/public/media/castopod-banner-onyx_small.webp differ diff --git a/public/media/castopod-banner-pine.jpg b/public/media/castopod-banner-pine.jpg new file mode 100644 index 0000000000000000000000000000000000000000..b6ab145f83c4b1ffd85764da8a99022ee253d5f5 Binary files /dev/null and b/public/media/castopod-banner-pine.jpg differ diff --git a/public/media/castopod-banner-pine_federation.jpg b/public/media/castopod-banner-pine_federation.jpg new file mode 100644 index 0000000000000000000000000000000000000000..9e9df5cb0a81f62b6b0e45e487f671bd07c1adf3 Binary files /dev/null and b/public/media/castopod-banner-pine_federation.jpg differ diff --git a/public/media/castopod-banner-pine_medium.webp b/public/media/castopod-banner-pine_medium.webp new file mode 100644 index 0000000000000000000000000000000000000000..6371a5e52294304955eb43ac60fc06829b461702 Binary files /dev/null and b/public/media/castopod-banner-pine_medium.webp differ diff --git a/public/media/castopod-banner-pine_small.webp b/public/media/castopod-banner-pine_small.webp new file mode 100644 index 0000000000000000000000000000000000000000..ac43b616ebd2acfa7b1572316e5e7165396bc863 Binary files /dev/null and b/public/media/castopod-banner-pine_small.webp differ diff --git a/themes/cp_admin/episode/_card.php b/themes/cp_admin/episode/_card.php index 43199d555383c033c879420afbb8662f0242b3e8..87f552f117dfbbb100affeb8de6a1646e5680dfc 100644 --- a/themes/cp_admin/episode/_card.php +++ b/themes/cp_admin/episode/_card.php @@ -1,6 +1,6 @@ <article class="relative flex flex-col flex-1 flex-shrink-0 w-full transition group overflow-hidden bg-elevated border-3 snap-center hover:shadow-lg focus-within:shadow-lg focus-within:ring-accent border-subtle rounded-xl min-w-[12rem] max-w-[17rem]"> <a href="<?= route_to('episode-view', $episode->podcast->id, $episode->id) ?>" class="flex flex-col justify-end w-full h-full text-white group"> - <div class="absolute bottom-0 left-0 z-10 w-full h-full backdrop-gradient"></div> + <div class="absolute bottom-0 left-0 z-10 w-full h-full backdrop-gradient mix-blend-multiply"></div> <div class="w-full h-full overflow-hidden"> <img src="<?= $episode->cover->medium_url ?>" alt="<?= $episode->title ?>" class="object-cover w-full h-full transition duration-200 ease-in-out transform group-focus:scale-105 group-hover:scale-105 aspect-square" /> </div> diff --git a/themes/cp_admin/person/_card.php b/themes/cp_admin/person/_card.php index 174963a4de4bd4cc35c0f8e76abe2a6fc86377b2..8bdba05a0f1b20cd3ad7b88a096b12666518bb02 100644 --- a/themes/cp_admin/person/_card.php +++ b/themes/cp_admin/person/_card.php @@ -1,6 +1,6 @@ <article class="relative h-full overflow-hidden transition shadow bg-elevated border-3 border-subtle rounded-xl group hover:shadow-xl focus-within:shadow-xl focus-within:ring-accent"> <a href="<?= route_to('person-view', $person->id) ?>" class="flex flex-col justify-end w-full h-full text-white group"> - <div class="absolute bottom-0 left-0 z-10 w-full h-full backdrop-gradient"></div> + <div class="absolute bottom-0 left-0 z-10 w-full h-full backdrop-gradient mix-blend-multiply"></div> <div class="w-full h-full overflow-hidden"> <img alt="<?= $person->full_name ?>" src="<?= $person->avatar->medium_url ?>" class="object-cover w-full h-full transition duration-200 ease-in-out transform aspect-square group-focus:scale-105 group-hover:scale-105" /> </div> diff --git a/themes/cp_admin/podcast/_card.php b/themes/cp_admin/podcast/_card.php index 98953a4d4e4321db939e53ab4dbdf95c4e48590b..6d7e979adabb73cb10b15252f222cd9e6cb44df6 100644 --- a/themes/cp_admin/podcast/_card.php +++ b/themes/cp_admin/podcast/_card.php @@ -1,6 +1,6 @@ <article class="relative h-full overflow-hidden transition shadow bg-elevated border-3 border-subtle group rounded-xl hover:shadow-xl focus-within:shadow-xl focus-within:ring-accent"> <a href="<?= route_to('podcast-view', $podcast->id) ?>" class="flex flex-col justify-end w-full h-full text-white group"> - <div class="absolute bottom-0 left-0 z-10 w-full h-full backdrop-gradient"></div> + <div class="absolute bottom-0 left-0 z-10 w-full h-full backdrop-gradient mix-blend-multiply"></div> <div class="w-full h-full overflow-hidden"> <img alt="<?= $podcast->title ?>" diff --git a/themes/cp_app/home.php b/themes/cp_app/home.php index 64f494c39d4da25242b9cec290cdcf934321d677..7eebda46eea2e235429180cd2471e17e88f6d7bf 100644 --- a/themes/cp_app/home.php +++ b/themes/cp_app/home.php @@ -59,7 +59,7 @@ <?php foreach ($podcasts as $podcast): ?> <a href="<?= $podcast->link ?>" class="relative w-full h-full overflow-hidden transition shadow focus:ring-accent rounded-xl border-subtle hover:shadow-xl focus:shadow-xl group border-3"> <article class="text-white"> - <div class="absolute bottom-0 left-0 z-10 w-full h-full backdrop-gradient"></div> + <div class="absolute bottom-0 left-0 z-10 w-full h-full backdrop-gradient mix-blend-multiply"></div> <div class="w-full h-full overflow-hidden"> <img alt="<?= $podcast->title ?>" src="<?= $podcast->cover->medium_url ?>" class="object-cover w-full h-full transition duration-200 ease-in-out transform aspect-square group-focus:scale-105 group-hover:scale-105" /> </div> diff --git a/themes/cp_app/podcast/_layout.php b/themes/cp_app/podcast/_layout.php index f14d3437ee525311bf96da257b9598e965cb4a49..e76bd1990a494c580cccce05b07e566caf66cbff 100644 --- a/themes/cp_app/podcast/_layout.php +++ b/themes/cp_app/podcast/_layout.php @@ -44,7 +44,7 @@ <?php endif; ?> <header class="relative z-50 flex flex-col-reverse justify-between w-full col-start-2 bg-top bg-no-repeat bg-cover sm:flex-row sm:items-end bg-header aspect-[3/1]" style="background-image: url('<?= $podcast->banner->medium_url ?>');"> - <div class="absolute bottom-0 left-0 w-full h-full backdrop-gradient"></div> + <div class="absolute bottom-0 left-0 w-full h-full backdrop-gradient mix-blend-multiply"></div> <div class="z-10 flex items-center pl-4 -mb-6 md:pl-8 md:-mb-8 gap-x-4"> <img src="<?= $podcast->cover->thumbnail_url ?>" alt="<?= $podcast->title ?>" loading="lazy" class="h-24 rounded-full sm:h-28 md:h-36 ring-3 ring-background-elevated aspect-square" /> <div class="relative flex flex-col text-white -top-2 sm:top-0 md:top-2">