[PLUGIN][ActivityPub] Introduce ActivitypubObject. Beware, inside the plugin, an Object can never be an Activity.

Many bug fixes and other major changes (interface changed, see EVENTS.md)
This commit is contained in:
2021-12-08 22:24:52 +00:00
parent b1227d36f1
commit 480a42cca5
10 changed files with 400 additions and 121 deletions

View File

@@ -84,11 +84,17 @@ class Inbox extends Controller
}
try {
$ap_actor = ActivitypubActor::fromUri($type->get('actor'));
$actor = Actor::getById($ap_actor->getActorId());
DB::flush();
$resource_parts = parse_url($type->get('actor'));
if ($resource_parts['host'] !== $_ENV['SOCIAL_DOMAIN']) { // XXX: Common::config('site', 'server')) {
$ap_actor = ActivitypubActor::fromUri($type->get('actor'));
$actor = Actor::getById($ap_actor->getActorId());
DB::flush();
} else {
throw new Exception('Only remote actors can use this endpoint.');
}
unset($resource_parts);
} catch (Exception $e) {
return $error('Invalid actor.');
return $error('Invalid actor: ' . $e->getMessage());
}
$activitypub_rsa = ActivitypubRsa::getByActor($actor);