Răsfoiți Sursa

Update StatusController, disable embeds from spam accounts

Daniel Supernault 2 ani în urmă
părinte
comite
c167af43a4
1 a modificat fișierele cu 15 adăugiri și 0 ștergeri
  1. 15 0
      app/Http/Controllers/StatusController.php

+ 15 - 0
app/Http/Controllers/StatusController.php

@@ -115,10 +115,25 @@ class StatusController extends Controller
 			->whereIsPrivate(false)
 			->whereIsPrivate(false)
 			->whereUsername($username)
 			->whereUsername($username)
 			->first();
 			->first();
+
 		if(!$profile) {
 		if(!$profile) {
 			$content = view('status.embed-removed');
 			$content = view('status.embed-removed');
 			return response($content)->header('X-Frame-Options', 'ALLOWALL');
 			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)
 		$status = Status::whereProfileId($profile->id)
 			->whereNull('uri')
 			->whereNull('uri')
 			->whereScope('public')
 			->whereScope('public')