forked from mirror/pixelfed
Update upload endpoints with MediaBlocklist checks
This commit is contained in:
parent
5d0a24a779
commit
597378bfb4
2 changed files with 8 additions and 1 deletions
|
@ -48,9 +48,11 @@ use App\Jobs\VideoPipeline\{
|
||||||
use App\Services\{
|
use App\Services\{
|
||||||
NotificationService,
|
NotificationService,
|
||||||
MediaPathService,
|
MediaPathService,
|
||||||
SearchApiV2Service
|
SearchApiV2Service,
|
||||||
|
MediaBlocklistService
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class ApiV1Controller extends Controller
|
class ApiV1Controller extends Controller
|
||||||
{
|
{
|
||||||
protected $fractal;
|
protected $fractal;
|
||||||
|
@ -1046,6 +1048,8 @@ class ApiV1Controller extends Controller
|
||||||
$path = $photo->store($storagePath);
|
$path = $photo->store($storagePath);
|
||||||
$hash = \hash_file('sha256', $photo);
|
$hash = \hash_file('sha256', $photo);
|
||||||
|
|
||||||
|
abort_if(MediaBlocklistService::exists($hash) == true, 451);
|
||||||
|
|
||||||
$media = new Media();
|
$media = new Media();
|
||||||
$media->status_id = null;
|
$media->status_id = null;
|
||||||
$media->profile_id = $profile->id;
|
$media->profile_id = $profile->id;
|
||||||
|
|
|
@ -36,6 +36,7 @@ use App\Jobs\VideoPipeline\{
|
||||||
};
|
};
|
||||||
use App\Services\NotificationService;
|
use App\Services\NotificationService;
|
||||||
use App\Services\MediaPathService;
|
use App\Services\MediaPathService;
|
||||||
|
use App\Services\MediaBlocklistService;
|
||||||
|
|
||||||
class BaseApiController extends Controller
|
class BaseApiController extends Controller
|
||||||
{
|
{
|
||||||
|
@ -247,6 +248,8 @@ class BaseApiController extends Controller
|
||||||
$path = $photo->store($storagePath);
|
$path = $photo->store($storagePath);
|
||||||
$hash = \hash_file('sha256', $photo);
|
$hash = \hash_file('sha256', $photo);
|
||||||
|
|
||||||
|
abort_if(MediaBlocklistService::exists($hash) == true, 451);
|
||||||
|
|
||||||
$media = new Media();
|
$media = new Media();
|
||||||
$media->status_id = null;
|
$media->status_id = null;
|
||||||
$media->profile_id = $profile->id;
|
$media->profile_id = $profile->id;
|
||||||
|
|
Loading…
Reference in a new issue