From 8d442e6fc1364ea351a9b781e8173c1b679b7a91 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 4 Mar 2013 20:58:39 -0800 Subject: fix timeago (again), webfinger new spec implemented, some theme work --- mod/wfinger.php | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 mod/wfinger.php (limited to 'mod/wfinger.php') diff --git a/mod/wfinger.php b/mod/wfinger.php new file mode 100644 index 000000000..3fda96181 --- /dev/null +++ b/mod/wfinger.php @@ -0,0 +1,101 @@ +get_hostname(), + z_root() . '/channel/' . $r[0]['channel_address'], + z_root() . '/~' . $r[0]['channel_address'] + ); + + $result['aliases'] = array(); + + foreach($aliases as $alias) + if($alias != $resource) + $result['aliases'][] = $alias; + + + $result['links'] = array( + + array( + 'rel' => 'http://webfinger.example/rel/avatar', + 'type' => $r[0]['xchan_photo_mimetype'], + 'href' => $r[0]['xchan_photo_l'] + ), + + array( + 'rel' => 'http://webfinger.example/rel/profile-page', + 'href' => z_root() . '/profile/' . $r[0]['channel_address'], + ), + + array( + 'rel' => 'http://webfinger.example/rel/blog', + 'href' => z_root() . '/channel/' . $r[0]['channel_address'], + ), + + array( + 'rel' => 'http://purl.org/zot/protocol', + 'href' => z_root() . '/well-known/zot-info' . '?zaddr=' . $r[0]['xchan_addr'], + ) + ); + + } + else { + header($_SERVER["SERVER_PROTOCOL"] . ' ' . 400 . ' ' . 'Bad Request'); + killme(); + } + + $arr = array('channel' => $r[0], 'request' => $_REQUEST, 'result' => $result); + call_hooks('webfinger',$arr); + + echo json_encode($arr['result']); + killme(); + +} \ No newline at end of file -- cgit v1.2.3 From dd22e1b5824b38fa2a1455df22dbee7da2201c76 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 5 Mar 2013 15:48:56 -0800 Subject: just tinkering and trying a few things - don't get upset. It can all be reverted it it sucks. Freedom's just another word for "nothin' left to lose" and I'm not sure it's possible to create a UI that's hated more than Friendica. So that gives us plenty of artististic license to explore some different directions and see if they lead to anything interesting. --- mod/wfinger.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'mod/wfinger.php') diff --git a/mod/wfinger.php b/mod/wfinger.php index 3fda96181..33d2fe478 100644 --- a/mod/wfinger.php +++ b/mod/wfinger.php @@ -24,8 +24,6 @@ function wfinger_init(&$a) { header('Content-type: application/jrd+json'); - $pubkey = get_config('system','site_pubkey'); - $r = null; if($resource) { @@ -82,7 +80,7 @@ function wfinger_init(&$a) { array( 'rel' => 'http://purl.org/zot/protocol', - 'href' => z_root() . '/well-known/zot-info' . '?zaddr=' . $r[0]['xchan_addr'], + 'href' => z_root() . '/.well-known/zot-info' . '?zaddr=' . $r[0]['xchan_addr'], ) ); -- cgit v1.2.3 From af22aeb55748bd0aa76db99a1e8a3fb84a1b85e1 Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 8 Mar 2014 12:40:06 -0800 Subject: incorrect webfinger link per fabrixxm --- mod/wfinger.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod/wfinger.php') diff --git a/mod/wfinger.php b/mod/wfinger.php index 33d2fe478..fb75da193 100644 --- a/mod/wfinger.php +++ b/mod/wfinger.php @@ -80,7 +80,7 @@ function wfinger_init(&$a) { array( 'rel' => 'http://purl.org/zot/protocol', - 'href' => z_root() . '/.well-known/zot-info' . '?zaddr=' . $r[0]['xchan_addr'], + 'href' => z_root() . '/.well-known/zot-info' . '?address=' . $r[0]['xchan_addr'], ) ); -- cgit v1.2.3 From f924d38d8c2b79e4bfe8df438894ff1ad636e411 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 25 Mar 2014 16:44:19 -0700 Subject: webfinger enhancements: per RFC7033 --- mod/wfinger.php | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'mod/wfinger.php') diff --git a/mod/wfinger.php b/mod/wfinger.php index fb75da193..bdec92b54 100644 --- a/mod/wfinger.php +++ b/mod/wfinger.php @@ -1,7 +1,7 @@ get_hostname())) { + goaway('https://' . $host . '/.well-known/webfinger?resource=' . $resource); + } + $channel = substr($channel,0,strpos($channel,'@')); + } } if(strpos($resource,'http') === 0) { $channel = str_replace('~','',basename($resource)); @@ -43,6 +46,13 @@ function wfinger_init(&$a) { } + + header('Access-Control-Allow-Origin: *'); + + header('Content-type: application/jrd+json'); + + + if($resource && $r) { $result['subject'] = $resource; @@ -55,6 +65,8 @@ function wfinger_init(&$a) { $result['aliases'] = array(); + $result['properties'] = array('http://webfinger.example/ns/name' => $r[0]['channel_name']); + foreach($aliases as $alias) if($alias != $resource) $result['aliases'][] = $alias; -- cgit v1.2.3