mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 22:41:27 +00:00
46 lines
890 B
PHP
46 lines
890 B
PHP
<?php
|
|
|
|
namespace App\Util\Webfinger;
|
|
|
|
class Webfinger
|
|
{
|
|
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,
|
|
];
|
|
}
|
|
}
|