Forráskód Böngészése

Update upload endpoints with MediaBlocklist checks

Daniel Supernault 5 éve
szülő
commit
597378bfb4

+ 5 - 1
app/Http/Controllers/Api/ApiV1Controller.php

@@ -48,9 +48,11 @@ use App\Jobs\VideoPipeline\{
 use App\Services\{
     NotificationService,
     MediaPathService,
-    SearchApiV2Service
+    SearchApiV2Service,
+    MediaBlocklistService
 };
 
+
 class ApiV1Controller extends Controller 
 {
 	protected $fractal;
@@ -1046,6 +1048,8 @@ class ApiV1Controller extends Controller
         $path = $photo->store($storagePath);
         $hash = \hash_file('sha256', $photo);
 
+        abort_if(MediaBlocklistService::exists($hash) == true, 451);
+
         $media = new Media();
         $media->status_id = null;
         $media->profile_id = $profile->id;

+ 3 - 0
app/Http/Controllers/Api/BaseApiController.php

@@ -36,6 +36,7 @@ use App\Jobs\VideoPipeline\{
 };
 use App\Services\NotificationService;
 use App\Services\MediaPathService;
+use App\Services\MediaBlocklistService;
 
 class BaseApiController extends Controller
 {
@@ -247,6 +248,8 @@ class BaseApiController extends Controller
         $path = $photo->store($storagePath);
         $hash = \hash_file('sha256', $photo);
 
+        abort_if(MediaBlocklistService::exists($hash) == true, 451);
+
         $media = new Media();
         $media->status_id = null;
         $media->profile_id = $profile->id;