From: James Walker Date: Sat, 13 Mar 2010 23:35:00 +0000 (-0500) Subject: Performing & allowing host-meta discovery by http url (in addition to webfinger acct) X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=85cf90cf0fb613bab38ce8e0142544a044fe0d1d;p=quix0rs-gnu-social.git Performing & allowing host-meta discovery by http url (in addition to webfinger acct) --- diff --git a/plugins/OStatus/actions/userxrd.php b/plugins/OStatus/actions/userxrd.php index 414de9364b..eb80a5ad46 100644 --- a/plugins/OStatus/actions/userxrd.php +++ b/plugins/OStatus/actions/userxrd.php @@ -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; diff --git a/plugins/OStatus/lib/discovery.php b/plugins/OStatus/lib/discovery.php index f8449b309e..df2fea64f6 100644 --- a/plugins/OStatus/lib/discovery.php +++ b/plugins/OStatus/lib/discovery.php @@ -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);