[ActivityPub] Inbox must work without actor, specify source for AS2

This commit is contained in:
Diogo Peralta Cordeiro 2021-09-20 17:03:23 +01:00
parent 958cbffb91
commit 7813723ca1
Signed by: diogo
GPG Key ID: 18D2D35001FBFAB0
1 changed files with 7 additions and 6 deletions

View File

@ -36,11 +36,13 @@ class Inbox extends Controller
/** /**
* Inbox handler * 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($gsactor_id)) {
if (is_null($user)) { $user = DB::find('local_user', ['id' => $gsactor_id]);
throw new ClientException(_m('No such actor.'), 404); if (is_null($user)) {
throw new ClientException(_m('No such actor.'), 404);
}
} }
// Check accept header // Check accept header
@ -58,8 +60,7 @@ class Inbox extends Controller
// Cast as an ActivityStreams type // Cast as an ActivityStreams type
$type = Type::create($payload); $type = Type::create($payload);
dd(AS2ToEntity::translate(activity: $type->toArray()['object'], source: 'ActivityPub'));
dd(AS2ToEntity::translate($type->toArray()['object']));
// $http_signature = new HttpSignature($this->server); // $http_signature = new HttpSignature($this->server);
// if ($http_signature->verify($request)) { // if ($http_signature->verify($request)) {