Add /api/v1/filters endpoint

This commit is contained in:
Daniel Supernault 2019-09-25 21:28:30 -06:00
parent d7170ca4b2
commit b3d82edd0f
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
3 changed files with 15 additions and 7 deletions

View file

@ -732,6 +732,20 @@ class ApiV1Controller extends Controller
return response()->json($res);
}
/**
* GET /api/v1/filters
*
* Return empty response since we filter server side
*
* @return array
*/
public function accountFilters(Request $request)
{
abort_if(!$request->user(), 403);
return response()->json([]);
}
public function statusById(Request $request, $id)
{
$status = Status::whereVisibility('public')->findOrFail($id);
@ -763,12 +777,6 @@ class ApiV1Controller extends Controller
return response()->json($res, 200, [], JSON_PRETTY_PRINT);
}
public function filters(Request $request)
{
// Pixelfed does not yet support keyword filters
return response()->json([]);
}
public function context(Request $request)
{
// todo

View file

@ -9,7 +9,6 @@ Route::group(['prefix' => 'api'], function() {
Route::group(['prefix' => 'v1'], function() {
Route::post('apps', 'Api\ApiV1Controller@apps');
Route::get('instance', 'Api\ApiV1Controller@instance');
Route::get('filters', 'Api\ApiV1Controller@filters');
Route::get('statuses/{id}', 'Api\ApiV1Controller@statusById');
Route::get('statuses/{id}/context', 'Api\ApiV1Controller@context');
});

View file

@ -102,6 +102,7 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact
Route::get('favourites', 'Api\ApiV1Controller@accountFavourites')->middleware('auth:api');
Route::post('statuses/{id}/favourite', 'Api\ApiV1Controller@statusFavouriteById')->middleware('auth:api');
Route::post('statuses/{id}/unfavourite', 'Api\ApiV1Controller@statusUnfavouriteById')->middleware('auth:api');
Route::get('filters', 'Api\ApiV1Controller@accountFilters')->middleware('auth:api');
Route::get('likes', 'ApiController@hydrateLikes');
Route::post('media', 'ApiController@uploadMedia')->middleware('auth:api');