aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Zfinger.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2017-10-25 13:29:19 +0200
committerMario <mario@mariovavti.com>2017-10-25 13:29:19 +0200
commit344aa13c64f0fa7a246f3284bf9cdb267e6101d3 (patch)
tree943809c01164dda7b6e4a26bc3d6c7e8c48bd6eb /Zotlabs/Module/Zfinger.php
parent61c86212b944efa0d78dcc0364b81bfb8a0d19bc (diff)
parent69b22e3f7916b5ba19b5ed03a55ad72bf5995291 (diff)
downloadvolse-hubzilla-344aa13c64f0fa7a246f3284bf9cdb267e6101d3.tar.gz
volse-hubzilla-344aa13c64f0fa7a246f3284bf9cdb267e6101d3.tar.bz2
volse-hubzilla-344aa13c64f0fa7a246f3284bf9cdb267e6101d3.zip
Merge branch '2.8RC'
Diffstat (limited to 'Zotlabs/Module/Zfinger.php')
-rw-r--r--Zotlabs/Module/Zfinger.php30
1 files changed, 29 insertions, 1 deletions
diff --git a/Zotlabs/Module/Zfinger.php b/Zotlabs/Module/Zfinger.php
index 2ff605fc9..0f7f6a64b 100644
--- a/Zotlabs/Module/Zfinger.php
+++ b/Zotlabs/Module/Zfinger.php
@@ -9,8 +9,36 @@ class Zfinger extends \Zotlabs\Web\Controller {
require_once('include/zot.php');
require_once('include/crypto.php');
-
$x = zotinfo($_REQUEST);
+
+ if($x && $x['guid'] && $x['guid_sig']) {
+ $chan_hash = make_xchan_hash($x['guid'],$x['guid_sig']);
+ if($chan_hash) {
+ $chan = channelx_by_hash($chan_hash);
+ }
+ }
+
+ $headers = [];
+ $headers['Content-Type'] = 'application/json' ;
+ $ret = json_encode($x);
+
+ if($chan) {
+ $hash = \Zotlabs\Web\HTTPSig::generate_digest($ret,false);
+ $headers['Digest'] = 'SHA-256=' . $hash;
+ \Zotlabs\Web\HTTPSig::create_sig('',$headers,$chan['channel_prvkey'],
+ 'acct:' . $chan['channel_address'] . '@' . \App::get_hostname(),true);
+ }
+ else {
+ foreach($headers as $k => $v) {
+ header($k . ': ' . $v);
+ }
+ }
+
+ echo $ret;
+ killme();
+
+
+
json_return_and_die($x);
}