[PLUGINS[WebMonetization] Basic activityPub support

This commit is contained in:
Phablulo Joel 2022-01-16 15:01:50 -03:00 committed by Hugo Sales
parent 148dd6db50
commit 06d11d8337
Signed by: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0
1 changed files with 13 additions and 0 deletions

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;
}
}