|
|
@ -28,13 +28,17 @@ class WebfingerService
|
|
|
|
return [];
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$res = Http::retry(3, 100)
|
|
|
|
try {
|
|
|
|
->acceptJson()
|
|
|
|
$res = Http::retry(3, 100)
|
|
|
|
->withHeaders([
|
|
|
|
->acceptJson()
|
|
|
|
'User-Agent' => '(Pixelfed/' . config('pixelfed.version') . '; +' . config('app.url') . ')'
|
|
|
|
->withHeaders([
|
|
|
|
])
|
|
|
|
'User-Agent' => '(Pixelfed/' . config('pixelfed.version') . '; +' . config('app.url') . ')'
|
|
|
|
->timeout(20)
|
|
|
|
])
|
|
|
|
->get($url);
|
|
|
|
->timeout(20)
|
|
|
|
|
|
|
|
->get($url);
|
|
|
|
|
|
|
|
} catch (\Illuminate\Http\Client\ConnectionException $e) {
|
|
|
|
|
|
|
|
return [];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(!$res->successful()) {
|
|
|
|
if(!$res->successful()) {
|
|
|
|
return [];
|
|
|
|
return [];
|
|
|
@ -48,11 +52,9 @@ class WebfingerService
|
|
|
|
$link = collect($webfinger['links'])
|
|
|
|
$link = collect($webfinger['links'])
|
|
|
|
->filter(function($link) {
|
|
|
|
->filter(function($link) {
|
|
|
|
return $link &&
|
|
|
|
return $link &&
|
|
|
|
isset($link['rel']) &&
|
|
|
|
isset($link['rel'], $link['type'], $link['href']) &&
|
|
|
|
isset($link['type']) &&
|
|
|
|
$link['rel'] === 'self' &&
|
|
|
|
isset($link['href']) &&
|
|
|
|
in_array($link['type'], ['application/activity+json','application/ld+json; profile="https://www.w3.org/ns/activitystreams"']);
|
|
|
|
$link['rel'] == 'self' &&
|
|
|
|
|
|
|
|
$link['type'] == 'application/activity+json' || $link['type'] == 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"';
|
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
->pluck('href')
|
|
|
|
->pluck('href')
|
|
|
|
->first();
|
|
|
|
->first();
|
|
|
|