From 861a2d36dfd475509cf6733caba7940b76173246 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Wed, 5 Jan 2022 19:31:49 -0700 Subject: [PATCH 1/2] Update PublicApiController, enforce only_media on accountStatuses method. Fixes #3105 --- app/Http/Controllers/PublicApiController.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/PublicApiController.php b/app/Http/Controllers/PublicApiController.php index b678694b4..f31aca727 100644 --- a/app/Http/Controllers/PublicApiController.php +++ b/app/Http/Controllers/PublicApiController.php @@ -737,6 +737,7 @@ class PublicApiController extends Controller $max_id = $request->max_id; $min_id = $request->min_id; $scope = ['photo', 'photo:album', 'video', 'video:album']; + $onlyMedia = $request->input('only_media', true); if(!$min_id && !$max_id) { $min_id = 1; @@ -787,7 +788,16 @@ class PublicApiController extends Controller } return $status; }) - ->filter(function($s) { + ->filter(function($s) use($onlyMedia) { + if($onlyMedia) { + if( + !isset($s['media_attachments']) || + !is_array($s['media_attachments']) || + empty($s['media_attachments']) + ) { + return false; + } + } return $s; }) ->values(); From 04c5b7902981d370fdec154cf4cfd7a9c8e08812 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Wed, 5 Jan 2022 19:47:00 -0700 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d8dbec9fc..57551cd5c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -85,6 +85,7 @@ - Updated ApiV1Controller, fix illegal operator bug by setting default min_id. ([415826f2](https://github.com/pixelfed/pixelfed/commit/415826f2)) - Updated StatusService, add getMastodon method for mastoapi compatibility. ([36a129fe](https://github.com/pixelfed/pixelfed/commit/36a129fe)) - Updated PublicApiController, fix accountStatuses pagination operator. ([85fc9dd0](https://github.com/pixelfed/pixelfed/commit/85fc9dd0)) +- Updated PublicApiController, enforce only_media on accountStatuses method. Fixes #3105. ([861a2d36](https://github.com/pixelfed/pixelfed/commit/861a2d36)) - ([](https://github.com/pixelfed/pixelfed/commit/)) ## [v0.11.1 (2021-09-07)](https://github.com/pixelfed/pixelfed/compare/v0.11.0...v0.11.1)