Merge pull request #5017 from annando/dfrn-relay

Adopt the relay definition according to the suggestions from @jaywink
This commit is contained in:
Hypolite Petovan 2018-05-10 08:18:53 -04:00 committed by GitHub
commit 09a2c1d76b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 4 deletions

View file

@ -73,8 +73,8 @@ function wk_social_relay()
'subscribe' => $subscribe,
'scope' => $scope,
'tags' => $taglist,
'protocols' => ['diaspora' => System::baseUrl() . '/receive/public',
'dfrn' => System::baseUrl() . '/dfrn_notify']
'protocols' => ['diaspora' => ['receive' => System::baseUrl() . '/receive/public'],
'dfrn' => ['receive' => System::baseUrl() . '/dfrn_notify']]
];
header('Content-type: application/json; charset=utf-8');

View file

@ -1436,11 +1436,19 @@ class PortableContact
if (isset($data->protocols)) {
if (isset($data->protocols->diaspora)) {
$fields['network'] = NETWORK_DIASPORA;
$fields['batch'] = $data->protocols->diaspora;
if (isset($data->protocols->diaspora->receive)) {
$fields['batch'] = $data->protocols->diaspora->receive;
} elseif (is_string($data->protocols->diaspora)) {
$fields['batch'] = $data->protocols->diaspora;
}
}
if (isset($data->protocols->dfrn)) {
$fields['network'] = NETWORK_DFRN;
$fields['batch'] = $data->protocols->dfrn;
if (isset($data->protocols->dfrn->receive)) {
$fields['batch'] = $data->protocols->dfrn->receive;
} elseif (is_string($data->protocols->dfrn)) {
$fields['batch'] = $data->protocols->dfrn;
}
}
}
Diaspora::setRelayContact($server_url, $fields);