1
0
Fork 0
pixelfed/app/Transformer/ActivityPub/ProfileTransformer.php

53 lines
2.0 KiB
PHP
Raw Normal View History

2018-05-20 03:18:06 +00:00
<?php
namespace App\Transformer\ActivityPub;
use App\Profile;
use League\Fractal;
class ProfileTransformer extends Fractal\TransformerAbstract
{
2018-08-28 03:07:36 +00:00
public function transform(Profile $profile)
{
return [
2018-08-14 00:18:20 +00:00
'@context' => [
'https://www.w3.org/ns/activitystreams',
'https://w3id.org/security/v1',
[
2018-08-28 03:07:36 +00:00
'manuallyApprovesFollowers' => 'as:manuallyApprovesFollowers',
2019-08-02 04:36:54 +00:00
'PropertyValue' => 'schema:PropertyValue',
'schema' => 'http://schema.org#',
'value' => 'schema:value'
2018-08-28 03:07:36 +00:00
],
2018-08-14 00:18:20 +00:00
],
2018-08-28 03:07:36 +00:00
'id' => $profile->permalink(),
'type' => 'Person',
'following' => $profile->permalink('/following'),
'followers' => $profile->permalink('/followers'),
'inbox' => $profile->permalink('/inbox'),
'outbox' => $profile->permalink('/outbox'),
2018-12-12 20:56:46 +00:00
//'featured' => $profile->permalink('/collections/featured'),
2018-08-28 03:07:36 +00:00
'preferredUsername' => $profile->username,
'name' => $profile->name,
'summary' => $profile->bio,
'url' => $profile->url(),
2018-08-14 00:18:20 +00:00
'manuallyApprovesFollowers' => (bool) $profile->is_private,
// 'follower_count' => $profile->followers()->count(),
// 'following_count' => $profile->following()->count(),
2018-05-20 03:18:06 +00:00
'publicKey' => [
2018-08-28 03:07:36 +00:00
'id' => $profile->permalink().'#main-key',
'owner' => $profile->permalink(),
'publicKeyPem' => $profile->public_key,
2018-05-20 03:18:06 +00:00
],
2018-08-14 01:31:18 +00:00
'icon' => [
2018-08-28 03:07:36 +00:00
'type' => 'Image',
2018-08-14 01:31:18 +00:00
'mediaType' => 'image/jpeg',
2018-08-28 03:07:36 +00:00
'url' => $profile->avatarUrl(),
],
2020-11-26 07:39:01 +00:00
'endpoints' => [
'sharedInbox' => config('app.url') . '/f/inbox'
]
2018-05-20 03:18:06 +00:00
];
2018-08-28 03:07:36 +00:00
}
}