From 66226658db9773d7a0fc1e48cda5f52bc7131c86 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 12 Dec 2022 23:46:51 -0700 Subject: [PATCH 1/4] Update MediaStorageService, improve support for pleroma .blob avatars --- app/Services/MediaStorageService.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/Services/MediaStorageService.php b/app/Services/MediaStorageService.php index 016700d0..055afe64 100644 --- a/app/Services/MediaStorageService.php +++ b/app/Services/MediaStorageService.php @@ -203,6 +203,7 @@ class MediaStorageService { } $mimes = [ + 'application/octet-stream', 'image/jpeg', 'image/png', ]; @@ -239,6 +240,15 @@ class MediaStorageService { } file_put_contents($tmpName, $data); + $mimeCheck = Storage::mimeType('remcache/' . $tmpPath); + + if(!$mimeCheck || !in_array($mimeCheck, ['image/png', 'image/jpeg'])) { + $avatar->last_fetched_at = now(); + $avatar->save(); + unlink($tmpName); + return; + } + $disk = Storage::disk($driver); $file = $disk->putFileAs($base, new File($tmpName), $path, 'public'); $permalink = $disk->url($file); From 2b0db8121aa1aa2f4c63ed7bd2e66721ed650522 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 12 Dec 2022 23:56:05 -0700 Subject: [PATCH 2/4] Update ApiV1Controller, remove min avatar size limit, fixes #3715 --- app/Http/Controllers/Api/ApiV1Controller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/Api/ApiV1Controller.php b/app/Http/Controllers/Api/ApiV1Controller.php index 4af3b7b1..7a0d6376 100644 --- a/app/Http/Controllers/Api/ApiV1Controller.php +++ b/app/Http/Controllers/Api/ApiV1Controller.php @@ -221,7 +221,7 @@ class ApiV1Controller extends Controller abort_if(!$request->user(), 403); $this->validate($request, [ - 'avatar' => 'sometimes|mimetypes:image/jpeg,image/png|min:10|max:' . config('pixelfed.max_avatar_size'), + 'avatar' => 'sometimes|mimetypes:image/jpeg,image/png|max:' . config('pixelfed.max_avatar_size'), 'display_name' => 'nullable|string|max:30', 'note' => 'nullable|string|max:200', 'locked' => 'nullable', From 1fa74f141b1f22b48295ad08c149f21ef201242f Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 12 Dec 2022 23:56:28 -0700 Subject: [PATCH 3/4] Update changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b6d24f61..a93b52ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,9 @@ - Update InboxPipeline, increase timeout from 60s to 300s ([d1b888b5](https://github.com/pixelfed/pixelfed/commit/d1b888b5)) - Update backup config, fixes #3793, #3920, #3931 ([b0c4cc30](https://github.com/pixelfed/pixelfed/commit/b0c4cc30)) - Update FederationController, add two new queues (follow, shared) to prioritize follow request handling ([8ba33864](https://github.com/pixelfed/pixelfed/commit/8ba33864)) +- Dispatch follow accept/reject pipeline jobs to follow queue ([aaed2bf6](https://github.com/pixelfed/pixelfed/commit/aaed2bf6)) +- Update MediaStorageService, improve support for pleroma .blob avatars ([66226658](https://github.com/pixelfed/pixelfed/commit/66226658)) +- Update ApiV1Controller, remove min avatar size limit, fixes #3715 ([2b0db812](https://github.com/pixelfed/pixelfed/commit/2b0db812)) - ([](https://github.com/pixelfed/pixelfed/commit/)) ## [v0.11.4 (2022-10-04)](https://github.com/pixelfed/pixelfed/compare/v0.11.3...v0.11.4) From a3b67a88dc51a4d77f3fdb56a3ca0b48c1e9f7b0 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 13 Dec 2022 00:00:25 -0700 Subject: [PATCH 4/4] Update jobs timeout --- app/Jobs/AvatarPipeline/RemoteAvatarFetch.php | 2 ++ app/Jobs/InboxPipeline/DeleteWorker.php | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Jobs/AvatarPipeline/RemoteAvatarFetch.php b/app/Jobs/AvatarPipeline/RemoteAvatarFetch.php index 7ffeb8a4..bc90f9cf 100644 --- a/app/Jobs/AvatarPipeline/RemoteAvatarFetch.php +++ b/app/Jobs/AvatarPipeline/RemoteAvatarFetch.php @@ -38,6 +38,8 @@ class RemoteAvatarFetch implements ShouldQueue * @var int */ public $tries = 1; + public $timeout = 300; + public $maxExceptions = 1; /** * Create a new job instance. diff --git a/app/Jobs/InboxPipeline/DeleteWorker.php b/app/Jobs/InboxPipeline/DeleteWorker.php index 8b9cc256..43783064 100644 --- a/app/Jobs/InboxPipeline/DeleteWorker.php +++ b/app/Jobs/InboxPipeline/DeleteWorker.php @@ -25,8 +25,8 @@ class DeleteWorker implements ShouldQueue protected $headers; protected $payload; - public $timeout = 120; - public $tries = 3; + public $timeout = 300; + public $tries = 1; public $maxExceptions = 1; /**