1
0
Fork 0
pixelfed/app/Util/Webfinger/Webfinger.php

47 lines
890 B
PHP
Raw Normal View History

2018-04-20 01:17:15 +00:00
<?php
namespace App\Util\Webfinger;
2018-08-28 03:07:36 +00:00
class Webfinger
{
2019-06-27 07:01:20 +00:00
protected $user;
protected $subject;
protected $aliases;
protected $links;
public function __construct($user)
{
$this->subject = 'acct:'.$user->username.'@'.parse_url(config('app.url'), PHP_URL_HOST);
$this->aliases = [
$user->url(),
$user->permalink(),
];
$this->links = [
[
'rel' => 'http://webfinger.net/rel/profile-page',
'type' => 'text/html',
'href' => $user->url(),
],
[
'rel' => 'http://schemas.google.com/g/2010#updates-from',
'type' => 'application/atom+xml',
'href' => $user->permalink('.atom'),
],
[
'rel' => 'self',
'type' => 'application/activity+json',
'href' => $user->permalink(),
],
];
}
public function generate()
{
return [
'subject' => $this->subject,
'aliases' => $this->aliases,
'links' => $this->links,
];
}
2018-08-28 03:07:36 +00:00
}