[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

View File

@ -36,12 +36,14 @@ class Inbox extends Controller
/** /**
* Inbox handler * Inbox handler
*/ */
public function handle(int $gsactor_id) public function handle(?int $gsactor_id = null)
{ {
if (!is_null($gsactor_id)) {
$user = DB::find('local_user', ['id' => $gsactor_id]); $user = DB::find('local_user', ['id' => $gsactor_id]);
if (is_null($user)) { if (is_null($user)) {
throw new ClientException(_m('No such actor.'), 404); throw new ClientException(_m('No such actor.'), 404);
} }
}
// Check accept header // Check accept header
ActivityPub::validateAcceptHeader( ActivityPub::validateAcceptHeader(
@ -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)) {