|
|
|
@ -7,6 +7,7 @@ use Zttp\Zttp;
|
|
|
|
|
class DiscoverActor
|
|
|
|
|
{
|
|
|
|
|
protected $url;
|
|
|
|
|
|
|
|
|
|
protected $response;
|
|
|
|
|
|
|
|
|
|
public function __construct($url)
|
|
|
|
@ -17,9 +18,9 @@ class DiscoverActor
|
|
|
|
|
public function fetch()
|
|
|
|
|
{
|
|
|
|
|
$res = Zttp::withHeaders([
|
|
|
|
|
'Accept' => 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"',
|
|
|
|
|
'User-Agent' => 'PixelfedBot - https://pixelfed.org',
|
|
|
|
|
])->get($this->url);
|
|
|
|
|
'Accept' => 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"',
|
|
|
|
|
'User-Agent' => 'PixelfedBot - https://pixelfed.org',
|
|
|
|
|
])->get($this->url);
|
|
|
|
|
$this->response = $res->body();
|
|
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
@ -40,7 +41,7 @@ class DiscoverActor
|
|
|
|
|
$this->fetch();
|
|
|
|
|
$res = $this->getResponse();
|
|
|
|
|
|
|
|
|
|
if (empty($res) || !in_array('type', $res) || $res['type'] !== 'Person') {
|
|
|
|
|
if (empty($res) || ! in_array('type', $res) || $res['type'] !== 'Person') {
|
|
|
|
|
throw new \Exception('Invalid Actor Object');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|