mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-09 16:24:51 +00:00
Update DiscoverActor, fix formatting
This commit is contained in:
parent
002dfefbdd
commit
312386bf98
1 changed files with 5 additions and 4 deletions
|
@ -7,6 +7,7 @@ use Zttp\Zttp;
|
||||||
class DiscoverActor
|
class DiscoverActor
|
||||||
{
|
{
|
||||||
protected $url;
|
protected $url;
|
||||||
|
|
||||||
protected $response;
|
protected $response;
|
||||||
|
|
||||||
public function __construct($url)
|
public function __construct($url)
|
||||||
|
@ -17,9 +18,9 @@ class DiscoverActor
|
||||||
public function fetch()
|
public function fetch()
|
||||||
{
|
{
|
||||||
$res = Zttp::withHeaders([
|
$res = Zttp::withHeaders([
|
||||||
'Accept' => 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"',
|
'Accept' => 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"',
|
||||||
'User-Agent' => 'PixelfedBot - https://pixelfed.org',
|
'User-Agent' => 'PixelfedBot - https://pixelfed.org',
|
||||||
])->get($this->url);
|
])->get($this->url);
|
||||||
$this->response = $res->body();
|
$this->response = $res->body();
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -40,7 +41,7 @@ class DiscoverActor
|
||||||
$this->fetch();
|
$this->fetch();
|
||||||
$res = $this->getResponse();
|
$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');
|
throw new \Exception('Invalid Actor Object');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue