aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorredmatrix <git@macgirvin.com>2016-03-22 19:58:59 -0700
committerredmatrix <git@macgirvin.com>2016-03-22 19:58:59 -0700
commit6f2ba0c6193a229b3f371de2cae7b314927d4cbb (patch)
treed3f0580d276174b8de9279ac067023f0bcf9d366 /mod
parent51a840f46a71800c5ce8111dacc2c4e1bbbe0b1a (diff)
downloadvolse-hubzilla-6f2ba0c6193a229b3f371de2cae7b314927d4cbb.tar.gz
volse-hubzilla-6f2ba0c6193a229b3f371de2cae7b314927d4cbb.tar.bz2
volse-hubzilla-6f2ba0c6193a229b3f371de2cae7b314927d4cbb.zip
rewrite the webfinger discovery logic
Diffstat (limited to 'mod')
-rw-r--r--mod/xrd.php17
1 files changed, 15 insertions, 2 deletions
diff --git a/mod/xrd.php b/mod/xrd.php
index da4ab51a4..ed8e1eabe 100644
--- a/mod/xrd.php
+++ b/mod/xrd.php
@@ -7,8 +7,12 @@ function xrd_init(&$a) {
$uri = urldecode(notags(trim($_GET['uri'])));
logger('xrd: ' . $uri,LOGGER_DEBUG);
- if(substr($uri,0,4) === 'http')
+ $resource = $uri;
+
+ if(substr($uri,0,4) === 'http') {
+ $uri = str_replace('~','',$uri);
$name = basename($uri);
+ }
else {
$local = str_replace('acct:', '', $uri);
if(substr($local,0,2) == '//')
@@ -35,9 +39,18 @@ function xrd_init(&$a) {
header("Content-type: application/xrd+xml");
+ $aliases = array('acct:' . $r[0]['channel_address'] . '@' . $a->get_hostname(), z_root() . '/channel/' . $r[0]['channel_address'], z_root() . '/~' . $r[0]['channel_address']);
+
+ for($x = 0; $x < count($aliases); $x ++) {
+ if($aliases[$x] === $resource)
+ unset($aliases[$x]);
+ }
+
+
$o = replace_macros(get_markup_template('xrd_person.tpl'), array(
'$nick' => $r[0]['channel_address'],
- '$accturi' => $uri,
+ '$accturi' => $resource,
+ '$aliases' => $aliases,
'$profile_url' => $a->get_baseurl() . '/channel/' . $r[0]['channel_address'],
'$hcard_url' => $a->get_baseurl() . '/hcard/' . $r[0]['channel_address'],
'$atom' => $a->get_baseurl() . '/feed/' . $r[0]['channel_address'],