forked from grumpydevelop/federator
better support for split domains
This commit is contained in:
parent
fa11d7d397
commit
1cfbff6d4c
5 changed files with 16 additions and 11 deletions
|
@ -1,6 +1,7 @@
|
|||
[generic]
|
||||
protocol = 'https'
|
||||
externaldomain = 'your.fqdn'
|
||||
externaldomain = 'federator.your.fqdn'
|
||||
sourcedomain = 'your.fqdn'
|
||||
|
||||
[database]
|
||||
host = '127.0.0.1'
|
||||
|
|
|
@ -127,6 +127,7 @@ class FedUsers implements APIInterface
|
|||
}
|
||||
$config = $this->main->getConfig();
|
||||
$domain = $config['generic']['externaldomain'];
|
||||
$sourcedomain = $config['generic']['sourcedomain'];
|
||||
$jsonKey = json_encode($user->publicKey);
|
||||
if (!is_string($jsonKey)) {
|
||||
throw new \Federator\Exceptions\FileNotFound();
|
||||
|
@ -137,6 +138,7 @@ class FedUsers implements APIInterface
|
|||
'imageMediaType' => $user->imageMediaType,
|
||||
'imageURL' => $user->imageURL,
|
||||
'fqdn' => $domain,
|
||||
'sourcedomain' => $sourcedomain,
|
||||
'name' => $user->name,
|
||||
'username' => $user->id,
|
||||
'publickey' => trim($jsonKey, '"'),
|
||||
|
|
|
@ -48,7 +48,8 @@ class WebFinger
|
|||
$matches = [];
|
||||
$config = $this->main->getConfig();
|
||||
$domain = $config['generic']['externaldomain'];
|
||||
if (preg_match("/^acct:([^@]+)@(.*)$/", $_resource, $matches) != 1 || $matches[2] !== $domain) {
|
||||
$sourcedomain = $config['generic']['sourcedomain'];
|
||||
if (preg_match("/^acct:([^@]+)@(.*)$/", $_resource, $matches) != 1 || $matches[2] !== $sourcedomain) {
|
||||
throw new \Federator\Exceptions\InvalidArgument();
|
||||
}
|
||||
$user = \Federator\DIO\User::getUserByName(
|
||||
|
@ -63,6 +64,7 @@ class WebFinger
|
|||
$data = [
|
||||
'username' => $user->id,
|
||||
'domain' => $domain,
|
||||
'sourcedomain' => $sourcedomain,
|
||||
];
|
||||
$response = $this->main->renderTemplate('webfinger_acct.json', $data);
|
||||
$this->wellKnown->setResponse($response);
|
||||
|
|
|
@ -58,24 +58,24 @@
|
|||
{rdelim}
|
||||
{rdelim}
|
||||
],
|
||||
"id":"https://{$fqdn}/{$username}",
|
||||
"id":"https://{$sourcedomain}/{$username}",
|
||||
"type":"{$type}",
|
||||
"following":"https://{$fqdn}/{$username}/following",
|
||||
"followers":"https://{$fqdn}/{$username}/followers",
|
||||
"inbox":"https://{$fqdn}/{$username}/inbox",
|
||||
"outbox":"https://{$fqdn}/{$username}/outbox",
|
||||
"featured":"https://{$fqdn}/{$username}/collections/featured",
|
||||
"featuredTags":"https://{$fqdn}/{$username}/collections/tags",
|
||||
{*"featured":"https://{$fqdn}/{$username}/collections/featured",
|
||||
"featuredTags":"https://{$fqdn}/{$username}/collections/tags",*}
|
||||
"preferredUsername":"{$username}",
|
||||
"name":"{$name}",
|
||||
"summary":"{$summary}",
|
||||
"url":"https://{$fqdn}/@{$username}",
|
||||
"url":"https://{$sourcedomain}/@{$username}",
|
||||
"manuallyApprovesFollowers":false,
|
||||
"discoverable":true,
|
||||
"published":"{$registered}",
|
||||
"publicKey":{ldelim}
|
||||
"id":"https://{$fqdn}/{$username}#main-key",
|
||||
"owner":"https://{$fqdn}/{$username}",
|
||||
"owner":"https://{$sourcedomain}/{$username}",
|
||||
"publicKeyPem":"{$publickey}"
|
||||
{rdelim},
|
||||
"tag":[],
|
||||
|
@ -83,7 +83,7 @@
|
|||
{if $type==='group'}{ldelim}
|
||||
"type":"PropertyValue",
|
||||
"name":"website",
|
||||
"value":"\u003ca href=\"https://{$fqdn}/@{$username}\" target=\"_blank\" rel=\"nofollow noopener noreferrer me\"\u003e\u003cspan class=\"invisible\"\u003ehttps://\u003c/span\u003e\u003cspan class=\"\"\u003e{$fqdn}/@{$username}\u003c/span\u003e\u003cspan class=\"invisible\"\u003e\u003c/span\u003e\u003c/a\u003e"
|
||||
"value":"\u003ca href=\"https://{$sourcedomain}/@{$username}\" target=\"_blank\" rel=\"nofollow noopener noreferrer me\"\u003e\u003cspan class=\"invisible\"\u003ehttps://\u003c/span\u003e\u003cspan class=\"\"\u003e{$fqdn}/@{$username}\u003c/span\u003e\u003cspan class=\"invisible\"\u003e\u003c/span\u003e\u003c/a\u003e"
|
||||
{rdelim}{/if}
|
||||
],
|
||||
"endpoints":{ldelim}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
{ldelim}
|
||||
"subject": "acct:{$username}@{$domain}",
|
||||
"subject": "acct:{$username}@{$sourcedomain}",
|
||||
"aliases": [
|
||||
"https://{$domain}/@{$username}"
|
||||
"https://{$sourcedomain}/@{$username}"
|
||||
],
|
||||
"links": [
|
||||
{ldelim}"rel": "self", "type": "application/activity+json", "href": "https://{$domain}/{$username}"{rdelim},
|
||||
{ldelim}"rel": "self", "type": "application/activity+json", "href": "https://{$domain}/@{$username}"{rdelim},
|
||||
{if $type=='Group'}
|
||||
{ldelim}"rel": "http://webfinger.net/rel/profile-page", "type": "text/html", "href": "https://{$domain}/@{$username}/"{rdelim},
|
||||
{/if}
|
||||
|
|
Loading…
Add table
Reference in a new issue