mirror of https://github.com/pixelfed/pixelfed
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
724 B
PHP
37 lines
724 B
PHP
<?php
|
|
|
|
namespace App\Services;
|
|
|
|
use App\Models\MediaBlocklist;
|
|
|
|
class MediaBlocklistService
|
|
{
|
|
public static function get()
|
|
{
|
|
return MediaBlocklist::whereActive(true)
|
|
->pluck('sha256')
|
|
->toArray();
|
|
}
|
|
|
|
public static function exists($hash)
|
|
{
|
|
return MediaBlocklist::whereSha256($hash)->whereActive(true)->exists();
|
|
}
|
|
|
|
public static function remove($hash)
|
|
{
|
|
MediaBlocklist::whereSha256($hash)->delete();
|
|
}
|
|
|
|
public static function add($hash, $metadata)
|
|
{
|
|
$m = new MediaBlocklist;
|
|
$m->sha256 = $hash;
|
|
$m->active = true;
|
|
$m->metadata = json_encode($metadata);
|
|
$m->save();
|
|
|
|
return $m;
|
|
}
|
|
}
|