aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mod/_well_known.php2
-rw-r--r--mod/wfinger.php22
2 files changed, 19 insertions, 5 deletions
diff --git a/mod/_well_known.php b/mod/_well_known.php
index 6e77336c3..c5a38078a 100644
--- a/mod/_well_known.php
+++ b/mod/_well_known.php
@@ -19,6 +19,8 @@ function _well_known_init(&$a){
require_once('mod/wfinger.php');
wfinger_init($a);
break;
+ default:
+ break;
}
}
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 @@
<?php
function wfinger_init(&$a) {
-
+
$result = array();
$scheme = '';
@@ -20,9 +20,6 @@ function wfinger_init(&$a) {
$resource = $_REQUEST['resource'];
- header('Access-Control-Allow-Origin: *');
-
- header('Content-type: application/jrd+json');
$r = null;
@@ -30,7 +27,13 @@ function wfinger_init(&$a) {
if(strpos($resource,'acct:') === 0) {
$channel = str_replace('acct:','',$resource);
- $channel = substr($channel,0,strpos($channel,'@'));
+ if(strpos($channel,'@') !== false) {
+ $host = substr($channel,strpos($channel,'@')+1);
+ if(strcasecmp($host,get_app()->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;