From c167af43a4817ac8dc761aa85b2e9414e3ae8394 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Fri, 19 May 2023 03:40:00 -0600 Subject: [PATCH] Update StatusController, disable embeds from spam accounts --- app/Http/Controllers/StatusController.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/app/Http/Controllers/StatusController.php b/app/Http/Controllers/StatusController.php index 4762c3f8..43ac0326 100644 --- a/app/Http/Controllers/StatusController.php +++ b/app/Http/Controllers/StatusController.php @@ -115,10 +115,25 @@ class StatusController extends Controller ->whereIsPrivate(false) ->whereUsername($username) ->first(); + if(!$profile) { $content = view('status.embed-removed'); return response($content)->header('X-Frame-Options', 'ALLOWALL'); } + + $aiCheck = Cache::remember('profile:ai-check:spam-login:' . $profile->id, 86400, function() use($profile) { + $exists = AccountInterstitial::whereUserId($profile->user_id)->where('is_spam', 1)->count(); + if($exists) { + return true; + } + + return false; + }); + + if($aiCheck) { + $res = view('status.embed-removed'); + return response($res)->withHeaders(['X-Frame-Options' => 'ALLOWALL']); + } $status = Status::whereProfileId($profile->id) ->whereNull('uri') ->whereScope('public')