forked from mirror/pixelfed
Remove deprecated api routes
This commit is contained in:
parent
e346b675d4
commit
7043cefdd4
|
@ -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) {
|
||||
|
|
|
@ -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');
|
||||
|
|
Loading…
Reference in New Issue