mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-12 17:44:31 +00:00
Update PublicApiController, consume InstanceService blocked domains for account and statuses endpoints
This commit is contained in:
parent
1e3acadefb
commit
01b33fb37e
1 changed files with 10 additions and 0 deletions
|
@ -42,6 +42,7 @@ use App\Services\{
|
||||||
use App\Jobs\StatusPipeline\NewStatusPipeline;
|
use App\Jobs\StatusPipeline\NewStatusPipeline;
|
||||||
use League\Fractal\Serializer\ArraySerializer;
|
use League\Fractal\Serializer\ArraySerializer;
|
||||||
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
|
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
|
||||||
|
use App\Services\InstanceService;
|
||||||
|
|
||||||
class PublicApiController extends Controller
|
class PublicApiController extends Controller
|
||||||
{
|
{
|
||||||
|
@ -661,6 +662,10 @@ class PublicApiController extends Controller
|
||||||
public function account(Request $request, $id)
|
public function account(Request $request, $id)
|
||||||
{
|
{
|
||||||
$res = AccountService::get($id);
|
$res = AccountService::get($id);
|
||||||
|
if($res && isset($res['local'], $res['url']) && !$res['local']) {
|
||||||
|
$domain = parse_url($res['url'], PHP_URL_HOST);
|
||||||
|
abort_if(in_array($domain, InstanceService::getBannedDomains()), 404);
|
||||||
|
}
|
||||||
return response()->json($res);
|
return response()->json($res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -680,6 +685,11 @@ class PublicApiController extends Controller
|
||||||
$profile = AccountService::get($id);
|
$profile = AccountService::get($id);
|
||||||
abort_if(!$profile, 404);
|
abort_if(!$profile, 404);
|
||||||
|
|
||||||
|
if($profile && isset($profile['local'], $profile['url']) && !$profile['local']) {
|
||||||
|
$domain = parse_url($profile['url'], PHP_URL_HOST);
|
||||||
|
abort_if(in_array($domain, InstanceService::getBannedDomains()), 404);
|
||||||
|
}
|
||||||
|
|
||||||
$limit = $request->limit ?? 9;
|
$limit = $request->limit ?? 9;
|
||||||
$max_id = $request->max_id;
|
$max_id = $request->max_id;
|
||||||
$min_id = $request->min_id;
|
$min_id = $request->min_id;
|
||||||
|
|
Loading…
Reference in a new issue