From 7043cefdd4e075600b3852e2c97c0940b0fe461b Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sun, 5 Mar 2023 00:27:59 -0700 Subject: [PATCH] Remove deprecated api routes --- app/Http/Controllers/PublicApiController.php | 65 -------------------- routes/web.php | 4 -- 2 files changed, 69 deletions(-) diff --git a/app/Http/Controllers/PublicApiController.php b/app/Http/Controllers/PublicApiController.php index 5ead0ad0f..ff7edd5ae 100644 --- a/app/Http/Controllers/PublicApiController.php +++ b/app/Http/Controllers/PublicApiController.php @@ -62,36 +62,6 @@ class PublicApiController extends Controller } } - protected function getLikes($status) - { - if(false == Auth::check()) { - return []; - } else { - $profile = Auth::user()->profile; - if($profile->status) { - return []; - } - $likes = $status->likedBy()->orderBy('created_at','desc')->paginate(10); - $collection = new Fractal\Resource\Collection($likes, new AccountTransformer()); - return $this->fractal->createData($collection)->toArray(); - } - } - - protected function getShares($status) - { - if(false == Auth::check()) { - return []; - } else { - $profile = Auth::user()->profile; - if($profile->status) { - return []; - } - $shares = $status->sharedBy()->orderBy('created_at','desc')->paginate(10); - $collection = new Fractal\Resource\Collection($shares, new AccountTransformer()); - return $this->fractal->createData($collection)->toArray(); - } - } - public function getStatus(Request $request, $id) { abort_if(!$request->user(), 403); @@ -216,41 +186,6 @@ class PublicApiController extends Controller return response()->json($res, 200, [], JSON_PRETTY_PRINT); } - public function statusLikes(Request $request, $username, $id) - { - abort_if(!$request->user(), 404); - $status = Status::findOrFail($id); - $this->scopeCheck($status->profile, $status); - $page = $request->input('page'); - if($page && $page >= 3 && $request->user()->profile_id != $status->profile_id) { - return response()->json([ - 'data' => [] - ]); - } - $likes = $this->getLikes($status); - return response()->json([ - 'data' => $likes - ]); - } - - public function statusShares(Request $request, $username, $id) - { - abort_if(!$request->user(), 404); - $profile = Profile::whereUsername($username)->whereNull('status')->firstOrFail(); - $status = Status::whereProfileId($profile->id)->findOrFail($id); - $this->scopeCheck($profile, $status); - $page = $request->input('page'); - if($page && $page >= 3 && $request->user()->profile_id != $status->profile_id) { - return response()->json([ - 'data' => [] - ]); - } - $shares = $this->getShares($status); - return response()->json([ - 'data' => $shares - ]); - } - protected function scopeCheck(Profile $profile, Status $status) { if($profile->is_private == true && Auth::check() == false) { diff --git a/routes/web.php b/routes/web.php index df0adc1ff..309380af8 100644 --- a/routes/web.php +++ b/routes/web.php @@ -189,8 +189,6 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact Route::get('profile/{username}/status/{postid}', 'PublicApiController@status'); Route::get('profile/{username}/status/{postid}/state', 'PublicApiController@statusState'); Route::get('comments/{username}/status/{postId}', 'PublicApiController@statusComments'); - Route::get('likes/profile/{username}/status/{id}', 'PublicApiController@statusLikes'); - Route::get('shares/profile/{username}/status/{id}', 'PublicApiController@statusShares'); Route::get('status/{id}/replies', 'InternalApiController@statusReplies'); Route::post('moderator/action', 'InternalApiController@modAction'); Route::get('discover/categories', 'InternalApiController@discoverCategories'); @@ -234,8 +232,6 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact Route::get('discover/profiles', 'DiscoverController@profilesDirectoryApi'); Route::get('profile/{username}/status/{postid}', 'PublicApiController@status'); Route::get('comments/{username}/status/{postId}', 'PublicApiController@statusComments'); - Route::get('likes/profile/{username}/status/{id}', 'PublicApiController@statusLikes'); - Route::get('shares/profile/{username}/status/{id}', 'PublicApiController@statusShares'); Route::post('moderator/action', 'InternalApiController@modAction'); Route::get('discover/categories', 'InternalApiController@discoverCategories'); Route::get('loops', 'DiscoverController@loopsApi');