AP: Support "discoverable"
This commit is contained in:
parent
4308cace68
commit
e2dc36a691
6 changed files with 44 additions and 32 deletions
|
@ -65,9 +65,11 @@ class ActivityPub
|
|||
'dfrn' => 'http://purl.org/macgirvin/dfrn/1.0/',
|
||||
'diaspora' => 'https://diasporafoundation.org/ns/',
|
||||
'litepub' => 'http://litepub.social/ns#',
|
||||
'toot' => 'http://joinmastodon.org/ns#',
|
||||
'manuallyApprovesFollowers' => 'as:manuallyApprovesFollowers',
|
||||
'sensitive' => 'as:sensitive', 'Hashtag' => 'as:Hashtag',
|
||||
'directMessage' => 'litepub:directMessage']];
|
||||
'directMessage' => 'litepub:directMessage',
|
||||
'discoverable' => 'toot:discoverable']];
|
||||
const ACCOUNT_TYPES = ['Person', 'Organization', 'Service', 'Group', 'Application', 'Tombstone'];
|
||||
/**
|
||||
* Checks if the web request is done for the AP protocol
|
||||
|
@ -166,6 +168,10 @@ class ActivityPub
|
|||
$profile['baseurl'] = $apcontact['baseurl'];
|
||||
$profile['gsid'] = $apcontact['gsid'];
|
||||
|
||||
if (!is_null($apcontact['discoverable'])) {
|
||||
$profile['hide'] = !$apcontact['discoverable'];
|
||||
}
|
||||
|
||||
// Remove all "null" fields
|
||||
foreach ($profile as $field => $content) {
|
||||
if (is_null($content)) {
|
||||
|
|
|
@ -325,7 +325,7 @@ class Transmitter
|
|||
return [];
|
||||
}
|
||||
|
||||
$fields = ['locality', 'region', 'country-name'];
|
||||
$fields = ['locality', 'region', 'country-name', 'net-publish'];
|
||||
$profile = DBA::selectFirst('profile', $fields, ['uid' => $uid]);
|
||||
if (!DBA::isResult($profile)) {
|
||||
return [];
|
||||
|
@ -340,7 +340,7 @@ class Transmitter
|
|||
$contact = User::getSystemAccount();
|
||||
$user = ['guid' => '', 'nickname' => $contact['nick'], 'pubkey' => $contact['pubkey'],
|
||||
'account-type' => $contact['contact-type'], 'page-flags' => User::PAGE_FLAGS_NORMAL];
|
||||
$profile = ['locality' => '', 'region' => '', 'country-name' => ''];
|
||||
$profile = ['locality' => '', 'region' => '', 'country-name' => '', 'net-publish' => false];
|
||||
}
|
||||
|
||||
$data = ['@context' => ActivityPub::CONTEXT];
|
||||
|
@ -375,6 +375,7 @@ class Transmitter
|
|||
|
||||
$data['url'] = $contact['url'];
|
||||
$data['manuallyApprovesFollowers'] = in_array($user['page-flags'], [User::PAGE_FLAGS_NORMAL, User::PAGE_FLAGS_PRVGROUP]);
|
||||
$data['discoverable'] = $profile['net-publish'];
|
||||
$data['publicKey'] = ['id' => $contact['url'] . '#main-key',
|
||||
'owner' => $contact['url'],
|
||||
'publicKeyPem' => $user['pubkey']];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue