From 3e6961ca67b326665f404126af4ddc45b7e383a1 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 31 Dec 2018 23:27:07 -0700 Subject: [PATCH] Add remote follow job --- .../FollowActivityPubDeliver.php | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 app/Jobs/FollowPipeline/FollowActivityPubDeliver.php diff --git a/app/Jobs/FollowPipeline/FollowActivityPubDeliver.php b/app/Jobs/FollowPipeline/FollowActivityPubDeliver.php new file mode 100644 index 00000000..863b2881 --- /dev/null +++ b/app/Jobs/FollowPipeline/FollowActivityPubDeliver.php @@ -0,0 +1,57 @@ +followRequest = $followRequest; + } + + /** + * Execute the job. + * + * @return void + */ + public function handle() + { + $follow = $this->followRequest; + $actor = $follow->actor; + $target = $follow->target; + + if($target->domain == null || $target->inbox_url == null) { + return; + } + + $fractal = new Fractal\Manager(); + $fractal->setSerializer(new ArraySerializer()); + $resource = new Fractal\Resource\Item($follow, new Follow()); + $activity = $fractal->createData($resource)->toArray(); + $url = $target->sharedInbox ?? $target->inbox_url; + + Helpers::sendSignedObject($actor, $url, $activity); + } +}