1
0
Fork 0
forked from mirror/pixelfed

Add InstanceActor model

This commit is contained in:
Daniel Supernault 2021-01-17 01:36:59 -07:00
parent fa6ecd8df1
commit aafd023c5a
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -0,0 +1,41 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class InstanceActor extends Model
{
use HasFactory;
const PROFILE_BASE = '/i/actor';
const KEY_ID = '/i/actor#main-key';
const PROFILE_KEY = 'federation:_v2:instance:actor:profile';
const PKI_PUBLIC = 'federation:_v1:instance:actor:profile:pki_public';
const PKI_PRIVATE = 'federation:_v1:instance:actor:profile:pki_private';
public function permalink($suffix = '')
{
return url(self::PROFILE_BASE . $suffix);
}
public function getActor()
{
return [
'@context' => 'https://www.w3.org/ns/activitystreams',
'id' => $this->permalink(),
'type' => 'Application',
'inbox' => $this->permalink('/inbox'),
'outbox' => $this->permalink('/outbox'),
'preferredUsername' => config('pixelfed.domain.app'),
'publicKey' => [
'id' => $this->permalink('#main-key'),
'owner' => $this->permalink(),
'publicKeyPem' => $this->public_key
],
'manuallyApprovesFollowers' => true,
'url' => route('help.instance-actor')
];
}
}