[PLUGINS[WebMonetization] Basic activityPub support

This commit is contained in:
Phablulo 2022-01-16 15:01:50 -03:00 committed by Hugo Sales
parent 148dd6db50
commit 06d11d8337
No known key found for this signature in database
GPG Key ID: 7D0C7EAFC9D835A0

View File

@ -239,4 +239,17 @@ class WebMonetization extends Plugin
}
return Event::next;
}
public function onActivityPubAddActivityStreamsTwoData(string $type_name, &$type): bool
{
if ($type_name === 'Person') {
$actor = \Plugin\ActivityPub\ActivityPub::getActorByUri($type->getId());
$wallet = DB::findOneBy(Wallet::class, ['actor_id' => $actor->getId()], return_null: true);
$address = $wallet?->getAddress();
if ($address) {
$type->set('webmonetizationWallet', $address);
}
}
return Event::next;
}
}