[ActivityPub] Ensuring federation with other software

ActivityPubPlugin:
- Prevent sending a Delete for an Announce

Activitypub_announce:
- Update announce_to_array to add id, to and cc information to the retrieved object

Activitypub_follow:
- Add id to the arguments of follow_to_array, useful for Accept-Follow activities

Activitypub_notice:
- Fix notice validation, url isn't a MUST

Activitypub_inbox_handler:
- Make handle_follow use the received activity id for the later Accept-Follow

Activitypub_postman:
- Fix call to the updated announce_to_array
- Fix successive unnecessary calls to ActivityPubPlugin::actor_uri()
This commit is contained in:
tenma
2019-08-05 23:22:32 +01:00
committed by Diogo Cordeiro
parent 14a45dc546
commit c28cee88b7
6 changed files with 53 additions and 39 deletions

View File

@@ -77,7 +77,7 @@ class Activitypub_notice extends Managed_DataObject
'published' => str_replace(' ', 'T', $notice->getCreated()).'Z',
'url' => self::getUrl($notice),
'attributedTo' => ActivityPubPlugin::actor_uri($profile),
'to' => ['https://www.w3.org/ns/activitystreams#Public'],
'to' => $to,
'cc' => $cc,
'conversation' => $notice->getConversationUrl(),
'content' => $notice->getRendered(),
@@ -235,9 +235,7 @@ class Activitypub_notice extends Managed_DataObject
common_debug('ActivityPub Notice Validator: Rejected because Content was not specified.');
throw new Exception('Object content was not specified.');
}
if (!isset($object['url'])) {
throw new Exception('Object URL was not specified.');
} elseif (!filter_var($object['url'], FILTER_VALIDATE_URL)) {
if (isset($object['url']) && !filter_var($object['url'], FILTER_VALIDATE_URL)) {
common_debug('ActivityPub Notice Validator: Rejected because Object URL is invalid.');
throw new Exception('Invalid Object URL.');
}