From a25dbf839aebd9065c25761060d80128e03eb9fc Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Thu, 22 Feb 2024 22:57:20 -0500 Subject: [PATCH 1/2] Remove photo user id fallback from 2021 - Remove deprecated /photos/{nickname} fallback routes - The contact id fallback is a lie, there's no replacement feature --- src/Module/Photo.php | 7 ------- static/routes.config.php | 9 --------- 2 files changed, 16 deletions(-) diff --git a/src/Module/Photo.php b/src/Module/Photo.php index 1bac70cdfd..6bf81ac7cb 100644 --- a/src/Module/Photo.php +++ b/src/Module/Photo.php @@ -100,7 +100,6 @@ class Photo extends BaseApi $id = $account['id']; } - // Contact Id Fallback, to remove after version 2021.12 if (isset($this->parameters['contact_id'])) { $id = intval($this->parameters['contact_id']); } @@ -115,12 +114,6 @@ class Photo extends BaseApi $id = $user['uid']; } - // User Id Fallback, to remove after version 2021.12 - if (!empty($this->parameters['uid_ext'])) { - $id = intval(pathinfo($this->parameters['uid_ext'], PATHINFO_FILENAME)); - } - - // Please refactor this for the love of everything that's good if (isset($this->parameters['id'])) { $id = $this->parameters['id']; } diff --git a/static/routes.config.php b/static/routes.config.php index 67ffec8e2b..146255adc6 100644 --- a/static/routes.config.php +++ b/static/routes.config.php @@ -575,22 +575,13 @@ return [ '/{name}' => [Module\Photo::class, [R::GET]], '/{type}/{id:\d+}' => [Module\Photo::class, [R::GET]], '/{type:contact|header}/{guid}' => [Module\Photo::class, [R::GET]], - // User Id Fallback, to remove after version 2021.12 - '/{type}/{uid_ext:\d+\..*}' => [Module\Photo::class, [R::GET]], '/{type}/{nickname_ext}' => [Module\Photo::class, [R::GET]], - // Contact Id Fallback, to remove after version 2021.12 '/{type:contact|header}/{customsize:\d+}/{contact_id:\d+}' => [Module\Photo::class, [R::GET]], '/{type:contact|header}/{customsize:\d+}/{guid}' => [Module\Photo::class, [R::GET]], '/{type}/{customsize:\d+}/{id:\d+}' => [Module\Photo::class, [R::GET]], - // User Id Fallback, to remove after version 2021.12 - '/{type}/{customsize:\d+}/{uid_ext:\d+\..*}' => [Module\Photo::class, [R::GET]], '/{type}/{customsize:\d+}/{nickname_ext}' => [Module\Photo::class, [R::GET]], ], - // Kept for backwards-compatibility - // @TODO remove by version 2023.12 - '/photos/{nickname}' => [Module\Profile\Photos::class, [R::GET]], - '/ping' => [Module\Notifications\Ping::class, [R::GET]], '/post' => [ From 0a73050de1c3423380636af0e12081f20420db96 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Thu, 22 Feb 2024 22:57:57 -0500 Subject: [PATCH 2/2] Increase API photo preview size for Mastodon API to 640 --- src/Factory/Api/Mastodon/Attachment.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Factory/Api/Mastodon/Attachment.php b/src/Factory/Api/Mastodon/Attachment.php index 727b77630a..18207fa1be 100644 --- a/src/Factory/Api/Mastodon/Attachment.php +++ b/src/Factory/Api/Mastodon/Attachment.php @@ -95,12 +95,12 @@ class Attachment extends BaseFactory $remote = $attachment['url']; if ($type == 'image') { $url = Post\Media::getPreviewUrlForId($attachment['id']); - $preview = Post\Media::getPreviewUrlForId($attachment['id'], Proxy::SIZE_SMALL); + $preview = Post\Media::getPreviewUrlForId($attachment['id'], Proxy::SIZE_MEDIUM); } else { $url = $attachment['url']; if (!empty($attachment['preview'])) { - $preview = Post\Media::getPreviewUrlForId($attachment['id'], Proxy::SIZE_SMALL); + $preview = Post\Media::getPreviewUrlForId($attachment['id'], Proxy::SIZE_MEDIUM); } else { $preview = ''; }