diff options
author | James Walker <walkah@walkah.net> | 2010-03-13 18:35:00 -0500 |
---|---|---|
committer | James Walker <walkah@walkah.net> | 2010-03-13 18:35:00 -0500 |
commit | 85cf90cf0fb613bab38ce8e0142544a044fe0d1d (patch) | |
tree | 37cf2a7ed118ff261f41b3b0afe1e07e336175c5 /plugins/OStatus | |
parent | 99ca84e68ed8cce97caa605fad04110d420c41b3 (diff) |
Performing & allowing host-meta discovery by http url (in addition to webfinger acct)
Diffstat (limited to 'plugins/OStatus')
-rw-r--r-- | plugins/OStatus/actions/userxrd.php | 15 | ||||
-rw-r--r-- | plugins/OStatus/lib/discovery.php | 11 |
2 files changed, 15 insertions, 11 deletions
diff --git a/plugins/OStatus/actions/userxrd.php b/plugins/OStatus/actions/userxrd.php index 414de9364..eb80a5ad4 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 f8449b309..df2fea64f 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); |