diff --git a/app/Http/Controllers/Api/ApiV1Controller.php b/app/Http/Controllers/Api/ApiV1Controller.php index 7af734ce9..6cc6fccea 100644 --- a/app/Http/Controllers/Api/ApiV1Controller.php +++ b/app/Http/Controllers/Api/ApiV1Controller.php @@ -2695,4 +2695,26 @@ class ApiV1Controller extends Controller 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 + ]); + } } diff --git a/routes/api.php b/routes/api.php index 159d74718..0205df0b2 100644 --- a/routes/api.php +++ b/routes/api.php @@ -83,6 +83,8 @@ Route::group(['prefix' => 'api'], function() use($middleware) { Route::get('timelines/public', 'Api\ApiV1Controller@timelinePublic')->middleware($middleware); Route::get('timelines/tag/{hashtag}', 'Api\ApiV1Controller@timelineHashtag'); Route::get('discover/posts', 'Api\ApiV1Controller@discoverPosts')->middleware($middleware); + + Route::get('preferences', 'Api\ApiV1Controller@getPreferences')->middleware($middleware); }); Route::group(['prefix' => 'v2'], function() use($middleware) {