mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-26 16:23:16 +00:00
Update ApiV1Controller, add preferences endpoint
This commit is contained in:
parent
df22f2e4b0
commit
c3e56b8722
2 changed files with 24 additions and 0 deletions
|
@ -2695,4 +2695,26 @@ class ApiV1Controller extends Controller
|
||||||
|
|
||||||
return $this->json($ids);
|
return $this->json($ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GET /api/v1/preferences
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getPreferences(Request $request)
|
||||||
|
{
|
||||||
|
abort_if(!$request->user(), 403);
|
||||||
|
$pid = $request->user()->profile_id;
|
||||||
|
$account = AccountService::get($pid);
|
||||||
|
|
||||||
|
return $this->json([
|
||||||
|
'posting:default:visibility' => $account['locked'] ? 'private' : 'public',
|
||||||
|
'posting:default:sensitive' => false,
|
||||||
|
'posting:default:language' => null,
|
||||||
|
'reading:expand:media' => 'default',
|
||||||
|
'reading:expand:spoilers' => false
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,6 +83,8 @@ Route::group(['prefix' => 'api'], function() use($middleware) {
|
||||||
Route::get('timelines/public', 'Api\ApiV1Controller@timelinePublic')->middleware($middleware);
|
Route::get('timelines/public', 'Api\ApiV1Controller@timelinePublic')->middleware($middleware);
|
||||||
Route::get('timelines/tag/{hashtag}', 'Api\ApiV1Controller@timelineHashtag');
|
Route::get('timelines/tag/{hashtag}', 'Api\ApiV1Controller@timelineHashtag');
|
||||||
Route::get('discover/posts', 'Api\ApiV1Controller@discoverPosts')->middleware($middleware);
|
Route::get('discover/posts', 'Api\ApiV1Controller@discoverPosts')->middleware($middleware);
|
||||||
|
|
||||||
|
Route::get('preferences', 'Api\ApiV1Controller@getPreferences')->middleware($middleware);
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::group(['prefix' => 'v2'], function() use($middleware) {
|
Route::group(['prefix' => 'v2'], function() use($middleware) {
|
||||||
|
|
Loading…
Reference in a new issue