Make the system owner ready for Diaspora

This commit is contained in:
Michael 2021-08-05 08:30:44 +00:00
parent c73130aa6b
commit a26a2a0228
2 changed files with 26 additions and 2 deletions

View file

@ -157,8 +157,8 @@ class User
$system['net-publish'] = false; $system['net-publish'] = false;
// Ensure that the user contains data // Ensure that the user contains data
$user = DBA::selectFirst('user', ['prvkey'], ['uid' => 0]); $user = DBA::selectFirst('user', ['prvkey', 'guid'], ['uid' => 0]);
if (empty($user['prvkey'])) { if (empty($user['prvkey']) || empty($user['guid'])) {
$fields = [ $fields = [
'username' => $system['name'], 'username' => $system['name'],
'nickname' => $system['nick'], 'nickname' => $system['nick'],
@ -167,12 +167,17 @@ class User
'prvkey' => $system['prvkey'], 'prvkey' => $system['prvkey'],
'spubkey' => $system['spubkey'], 'spubkey' => $system['spubkey'],
'sprvkey' => $system['sprvkey'], 'sprvkey' => $system['sprvkey'],
'guid' => System::createUUID(),
'verified' => true, 'verified' => true,
'page-flags' => User::PAGE_FLAGS_SOAPBOX, 'page-flags' => User::PAGE_FLAGS_SOAPBOX,
'account-type' => User::ACCOUNT_TYPE_RELAY, 'account-type' => User::ACCOUNT_TYPE_RELAY,
]; ];
DBA::update('user', $fields, ['uid' => 0]); DBA::update('user', $fields, ['uid' => 0]);
$system['guid'] = $fields['guid'];
} else {
$system['guid'] = $user['guid'];
} }
return $system; return $system;

View file

@ -130,6 +130,25 @@ class Xrd extends BaseModule
'rel' => 'http://ostatus.org/schema/1.0/subscribe', 'rel' => 'http://ostatus.org/schema/1.0/subscribe',
'template' => DI::baseUrl()->get() . '/follow?url={uri}', 'template' => DI::baseUrl()->get() . '/follow?url={uri}',
], ],
[
'rel' => ActivityNamespace::FEED,
'type' => 'application/atom+xml',
'href' => $owner['poll'] ?? DI::baseUrl()->get(),
],
[
'rel' => 'salmon',
'href' => DI::baseUrl()->get() . '/salmon/' . $owner['nickname'],
],
[
'rel' => 'http://microformats.org/profile/hcard',
'type' => 'text/html',
'href' => DI::baseUrl()->get() . '/hcard/' . $owner['nickname'],
],
[
'rel' => 'http://joindiaspora.com/seed_location',
'type' => 'text/html',
'href' => DI::baseUrl()->get(),
],
] ]
]; ];
header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Origin: *');