From aab4fa0c3121a777bd58c3350a13ebaaf1fd5457 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 13 Oct 2018 20:36:44 +0000 Subject: [PATCH] The instrument is now added, updating AP contacts is now enabled --- mod/crepair.php | 2 +- src/Protocol/ActivityPub/Transmitter.php | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/mod/crepair.php b/mod/crepair.php index 076c611db4..d8c6b35f5a 100644 --- a/mod/crepair.php +++ b/mod/crepair.php @@ -133,7 +133,7 @@ function crepair_content(App $a) $remote_self_options = ['0' => L10n::t('No mirroring'), '2' => L10n::t('Mirror as my own posting')]; } - $update_profile = in_array($contact['network'], [Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS]); + $update_profile = in_array($contact['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS]); $tab_str = contacts_tab($a, $contact, 5); diff --git a/src/Protocol/ActivityPub/Transmitter.php b/src/Protocol/ActivityPub/Transmitter.php index 3c22f8f62b..b261e6060c 100644 --- a/src/Protocol/ActivityPub/Transmitter.php +++ b/src/Protocol/ActivityPub/Transmitter.php @@ -4,6 +4,7 @@ */ namespace Friendica\Protocol\ActivityPub; +use Friendica\BaseObject; use Friendica\Database\DBA; use Friendica\Core\System; use Friendica\Util\HTTPSignature; @@ -552,6 +553,8 @@ class Transmitter $data['published'] = DateTimeFormat::utc($item['created'] . '+00:00', DateTimeFormat::ATOM); + $data['instrument'] = ['type' => 'Service', 'name' => BaseObject::getApp()->getUserAgent()]; + $data = array_merge($data, self::createPermissionBlockForItem($item)); if (in_array($data['type'], ['Create', 'Update', 'Delete'])) { @@ -883,7 +886,7 @@ class Transmitter 'actor' => $owner['url'], 'object' => $suggestion['url'], 'content' => $suggestion['note'], - 'published' => DateTimeFormat::utc($suggestion['created'] . '+00:00', DateTimeFormat::ATOM), + 'instrument' => ['type' => 'Service', 'name' => BaseObject::getApp()->getUserAgent()], 'to' => [ActivityPub::PUBLIC_COLLECTION], 'cc' => []]; @@ -910,6 +913,7 @@ class Transmitter 'actor' => $owner['url'], 'object' => $owner['url'], 'published' => DateTimeFormat::utcNow(DateTimeFormat::ATOM), + 'instrument' => ['type' => 'Service', 'name' => BaseObject::getApp()->getUserAgent()], 'to' => [ActivityPub::PUBLIC_COLLECTION], 'cc' => []]; @@ -936,6 +940,7 @@ class Transmitter 'actor' => $owner['url'], 'object' => self::getProfile($uid), 'published' => DateTimeFormat::utcNow(DateTimeFormat::ATOM), + 'instrument' => ['type' => 'Service', 'name' => BaseObject::getApp()->getUserAgent()], 'to' => [$profile['followers']], 'cc' => []]; @@ -963,6 +968,7 @@ class Transmitter 'type' => $activity, 'actor' => $owner['url'], 'object' => $profile['url'], + 'instrument' => ['type' => 'Service', 'name' => BaseObject::getApp()->getUserAgent()], 'to' => $profile['url']]; logger('Sending activity ' . $activity . ' to ' . $target . ' for user ' . $uid, LOGGER_DEBUG); @@ -990,6 +996,7 @@ class Transmitter 'object' => ['id' => $id, 'type' => 'Follow', 'actor' => $profile['url'], 'object' => $owner['url']], + 'instrument' => ['type' => 'Service', 'name' => BaseObject::getApp()->getUserAgent()], 'to' => $profile['url']]; logger('Sending accept to ' . $target . ' for user ' . $uid . ' with id ' . $id, LOGGER_DEBUG); @@ -1017,6 +1024,7 @@ class Transmitter 'object' => ['id' => $id, 'type' => 'Follow', 'actor' => $profile['url'], 'object' => $owner['url']], + 'instrument' => ['type' => 'Service', 'name' => BaseObject::getApp()->getUserAgent()], 'to' => $profile['url']]; logger('Sending reject to ' . $target . ' for user ' . $uid . ' with id ' . $id, LOGGER_DEBUG); @@ -1045,6 +1053,7 @@ class Transmitter 'object' => ['id' => $id, 'type' => 'Follow', 'actor' => $owner['url'], 'object' => $profile['url']], + 'instrument' => ['type' => 'Service', 'name' => BaseObject::getApp()->getUserAgent()], 'to' => $profile['url']]; logger('Sending undo to ' . $target . ' for user ' . $uid . ' with id ' . $id, LOGGER_DEBUG); -- 2.39.5