mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-12 17:44:31 +00:00
Add /api/v1/filters endpoint
This commit is contained in:
parent
d7170ca4b2
commit
b3d82edd0f
3 changed files with 15 additions and 7 deletions
|
@ -732,6 +732,20 @@ class ApiV1Controller extends Controller
|
||||||
return response()->json($res);
|
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)
|
public function statusById(Request $request, $id)
|
||||||
{
|
{
|
||||||
$status = Status::whereVisibility('public')->findOrFail($id);
|
$status = Status::whereVisibility('public')->findOrFail($id);
|
||||||
|
@ -763,12 +777,6 @@ class ApiV1Controller extends Controller
|
||||||
return response()->json($res, 200, [], JSON_PRETTY_PRINT);
|
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)
|
public function context(Request $request)
|
||||||
{
|
{
|
||||||
// todo
|
// todo
|
||||||
|
|
|
@ -9,7 +9,6 @@ Route::group(['prefix' => 'api'], function() {
|
||||||
Route::group(['prefix' => 'v1'], function() {
|
Route::group(['prefix' => 'v1'], function() {
|
||||||
Route::post('apps', 'Api\ApiV1Controller@apps');
|
Route::post('apps', 'Api\ApiV1Controller@apps');
|
||||||
Route::get('instance', 'Api\ApiV1Controller@instance');
|
Route::get('instance', 'Api\ApiV1Controller@instance');
|
||||||
Route::get('filters', 'Api\ApiV1Controller@filters');
|
|
||||||
Route::get('statuses/{id}', 'Api\ApiV1Controller@statusById');
|
Route::get('statuses/{id}', 'Api\ApiV1Controller@statusById');
|
||||||
Route::get('statuses/{id}/context', 'Api\ApiV1Controller@context');
|
Route::get('statuses/{id}/context', 'Api\ApiV1Controller@context');
|
||||||
});
|
});
|
||||||
|
|
|
@ -102,6 +102,7 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact
|
||||||
Route::get('favourites', 'Api\ApiV1Controller@accountFavourites')->middleware('auth:api');
|
Route::get('favourites', 'Api\ApiV1Controller@accountFavourites')->middleware('auth:api');
|
||||||
Route::post('statuses/{id}/favourite', 'Api\ApiV1Controller@statusFavouriteById')->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::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::get('likes', 'ApiController@hydrateLikes');
|
||||||
Route::post('media', 'ApiController@uploadMedia')->middleware('auth:api');
|
Route::post('media', 'ApiController@uploadMedia')->middleware('auth:api');
|
||||||
|
|
Loading…
Reference in a new issue