From 7813723ca185ca90641851177bfc4fff618c8fd2 Mon Sep 17 00:00:00 2001 From: Diogo Peralta Cordeiro Date: Mon, 20 Sep 2021 17:03:23 +0100 Subject: [PATCH] [ActivityPub] Inbox must work without actor, specify source for AS2 --- plugins/ActivityPub/Controller/Inbox.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/plugins/ActivityPub/Controller/Inbox.php b/plugins/ActivityPub/Controller/Inbox.php index 17e783cf30..77f0472a86 100644 --- a/plugins/ActivityPub/Controller/Inbox.php +++ b/plugins/ActivityPub/Controller/Inbox.php @@ -36,11 +36,13 @@ class Inbox extends Controller /** * Inbox handler */ - public function handle(int $gsactor_id) + public function handle(?int $gsactor_id = null) { - $user = DB::find('local_user', ['id' => $gsactor_id]); - if (is_null($user)) { - throw new ClientException(_m('No such actor.'), 404); + if (!is_null($gsactor_id)) { + $user = DB::find('local_user', ['id' => $gsactor_id]); + if (is_null($user)) { + throw new ClientException(_m('No such actor.'), 404); + } } // Check accept header @@ -58,8 +60,7 @@ class Inbox extends Controller // Cast as an ActivityStreams type $type = Type::create($payload); - - dd(AS2ToEntity::translate($type->toArray()['object'])); + dd(AS2ToEntity::translate(activity: $type->toArray()['object'], source: 'ActivityPub')); // $http_signature = new HttpSignature($this->server); // if ($http_signature->verify($request)) {