From 56f17b9957134293f33d37764a6e53db676218dd Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 4 Jan 2025 04:47:04 -0700 Subject: [PATCH] Update ApiV1Dot1Controller, fix in-app registration --- app/Http/Controllers/Api/ApiV1Dot1Controller.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/Api/ApiV1Dot1Controller.php b/app/Http/Controllers/Api/ApiV1Dot1Controller.php index c84dcae1c..456f22da7 100644 --- a/app/Http/Controllers/Api/ApiV1Dot1Controller.php +++ b/app/Http/Controllers/Api/ApiV1Dot1Controller.php @@ -629,9 +629,6 @@ class ApiV1Dot1Controller extends Controller abort_if(BouncerService::checkIp($request->ip()), 404); } - $rl = RateLimiter::attempt('pf:apiv1.1:iarc:'.$request->ip(), config('pixelfed.app_registration_confirm_rate_limit_attempts', 20), function () {}, config('pixelfed.app_registration_confirm_rate_limit_decay', 1800)); - abort_if(! $rl, 429, 'Too many requests'); - $request->validate([ 'user_token' => 'required', 'random_token' => 'required', @@ -658,7 +655,7 @@ class ApiV1Dot1Controller extends Controller $user->last_active_at = now(); $user->save(); - $token = $user->createToken('Pixelfed', ['read', 'write', 'follow', 'admin:read', 'admin:write', 'push']); + $token = $user->createToken('Pixelfed', ['read', 'write', 'follow', 'push']); return response()->json([ 'access_token' => $token->accessToken, @@ -1292,7 +1289,7 @@ class ApiV1Dot1Controller extends Controller if ($user->last_active_at == null) { return []; } - $defaultCaption = ""; + $defaultCaption = ''; $content = $request->filled('status') ? strip_tags(Purify::clean($request->input('status'))) : $defaultCaption; $cw = $user->profile->cw == true ? true : $request->boolean('sensitive', false); $spoilerText = $cw && $request->filled('spoiler_text') ? $request->input('spoiler_text') : null;