Performing & allowing host-meta discovery by http url (in addition to webfinger acct)
This commit is contained in:
parent
99ca84e68e
commit
85cf90cf0f
@ -32,12 +32,15 @@ class UserxrdAction extends XrdAction
|
||||
parent::prepare($args);
|
||||
|
||||
$this->uri = $this->trimmed('uri');
|
||||
$acct = Discovery::normalize($this->uri);
|
||||
|
||||
list($nick, $domain) = explode('@', substr(urldecode($acct), 5));
|
||||
$nick = common_canonical_nickname($nick);
|
||||
|
||||
$this->user = User::staticGet('nickname', $nick);
|
||||
$this->uri = Discovery::normalize($this->uri);
|
||||
|
||||
if (Discovery::isWebfinger($this->uri)) {
|
||||
list($nick, $domain) = explode('@', substr(urldecode($this->uri), 5));
|
||||
$nick = common_canonical_nickname($nick);
|
||||
$this->user = User::staticGet('nickname', $nick);
|
||||
} else {
|
||||
$this->user = User::staticGet('uri', $this->uri);
|
||||
}
|
||||
if (!$this->user) {
|
||||
$this->clientError(_('No such user.'), 404);
|
||||
return false;
|
||||
|
@ -157,12 +157,13 @@ class Discovery_LRDD_Host_Meta implements Discovery_LRDD
|
||||
{
|
||||
public function discover($uri)
|
||||
{
|
||||
if (!Discovery::isWebfinger($uri)) {
|
||||
return false;
|
||||
if (Discovery::isWebfinger($uri)) {
|
||||
// We have a webfinger acct: - start with host-meta
|
||||
list($name, $domain) = explode('@', $uri);
|
||||
} else {
|
||||
$domain = parse_url($uri, PHP_URL_HOST);
|
||||
}
|
||||
|
||||
// We have a webfinger acct: - start with host-meta
|
||||
list($name, $domain) = explode('@', $uri);
|
||||
|
||||
$url = 'http://'. $domain .'/.well-known/host-meta';
|
||||
|
||||
$xrd = Discovery::fetchXrd($url);
|
||||
|
Loading…
Reference in New Issue
Block a user