diff --git a/app/Transformer/ActivityPub/Verb/CreateStory.php b/app/Transformer/ActivityPub/Verb/CreateStory.php new file mode 100644 index 000000000..dfcb66ba6 --- /dev/null +++ b/app/Transformer/ActivityPub/Verb/CreateStory.php @@ -0,0 +1,29 @@ + 'https://www.w3.org/ns/activitystreams', + 'id' => $story->permalink(), + 'type' => 'Add', + 'actor' => $story->profile->permalink(), + 'to' => [ + $story->profile->permalink('/followers') + ], + 'object' => [ + 'id' => $story->url(), + 'type' => 'Story', + 'object' => $story->bearcapUrl(), + ] + ]; + } +} diff --git a/app/Transformer/ActivityPub/Verb/DeleteStory.php b/app/Transformer/ActivityPub/Verb/DeleteStory.php new file mode 100644 index 000000000..77917f077 --- /dev/null +++ b/app/Transformer/ActivityPub/Verb/DeleteStory.php @@ -0,0 +1,25 @@ + 'https://www.w3.org/ns/activitystreams', + 'id' => $story->url() . '#delete', + 'type' => 'Delete', + 'actor' => $story->profile->permalink(), + 'object' => [ + 'id' => $story->url(), + 'type' => 'Story', + ], + ]; + } +} diff --git a/app/Transformer/ActivityPub/Verb/StoryVerb.php b/app/Transformer/ActivityPub/Verb/StoryVerb.php new file mode 100644 index 000000000..9eebb3195 --- /dev/null +++ b/app/Transformer/ActivityPub/Verb/StoryVerb.php @@ -0,0 +1,39 @@ +type == 'photo' ? 'Image' : + ( $story->type == 'video' ? 'Video' : + 'Document' ); + + return [ + '@context' => 'https://www.w3.org/ns/activitystreams', + 'id' => $story->url(), + 'type' => 'Story', + 'to' => [ + $story->profile->permalink('/followers') + ], + 'cc' => [], + 'attributedTo' => $story->profile->permalink(), + 'published' => $story->created_at->toAtomString(), + 'expiresAt' => $story->expires_at->toAtomString(), + 'duration' => $story->duration, + 'can_reply' => (bool) $story->can_reply, + 'can_react' => (bool) $story->can_react, + 'attachment' => [ + 'type' => $type, + 'url' => url(Storage::url($story->path)), + 'mediaType' => $story->mime, + ], + ]; + } +}