From 09f137233b0cc2aa50d3fbc9d5b6763deac2cf82 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 9 Oct 2018 22:32:20 -0700 Subject: [PATCH] missed a fix --- Zotlabs/Lib/Activity.php | 6 ++++-- Zotlabs/Module/Magic.php | 1 + Zotlabs/Zot/Finger.php | 8 ++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index e75deba22..d2095fd98 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -1509,12 +1509,14 @@ class Activity { $s['created'] = datetime_convert('UTC','UTC',$act->data['published']); } + $obj_actor = ((isset($act->obj['actor'])) ? $act->obj['actor'] : $act->get_actor('attributedTo', $act->obj)); + // This needs better formatting with proper names if($act->type === 'Like') { - $content['content'] = sprintf('%1$s Likes %2$s\'s %3$s',$act->actor['id'],$act->obj['actor']['id'],$act->obj['type']) . "\n\n" . $content['content']; + $content['content'] = sprintf('@{%1$s} Likes @{%2$s}\'s %3$s',$act->actor['id'],$obj_actor['id'],$act->obj['type']) . "\n\n" . $content['content']; } if($act->type === 'Dislike') { - $content['content'] = sprintf('%1$s Doesn\'t like %2$s\'s %3$s',$act->actor['id'],$act->obj['actor']['id'],$act->obj['type']) . "\n\n" . $content['content']; + $content['content'] = sprintf('@{%1$s} Doesn\'t like @{%2$s}\'s %3$s',$act->actor['id'],$obj_actor['id'],$act->obj['type']) . "\n\n" . $content['content']; } } diff --git a/Zotlabs/Module/Magic.php b/Zotlabs/Module/Magic.php index 91819248a..c4e6088e3 100644 --- a/Zotlabs/Module/Magic.php +++ b/Zotlabs/Module/Magic.php @@ -98,6 +98,7 @@ class Magic extends \Zotlabs\Web\Controller { $headers = []; $headers['Accept'] = 'application/x-zot+json' ; + $headers['Content-Type'] = 'application/x-zot+json' ; $headers['X-Open-Web-Auth'] = random_string(); $headers['Digest'] = HTTPSig::generate_digest_header($data); $headers['Host'] = $parsed['host']; diff --git a/Zotlabs/Zot/Finger.php b/Zotlabs/Zot/Finger.php index 559f9657a..86a535144 100644 --- a/Zotlabs/Zot/Finger.php +++ b/Zotlabs/Zot/Finger.php @@ -71,6 +71,12 @@ class Finger { $url = 'https://' . $host; } + $m = parse_url($url); + + if($m) { + $parsed_host = $m['host']; + } + $rhs = '/.well-known/zot-info'; $https = ((strpos($url,'https://') === 0) ? true : false); @@ -88,6 +94,8 @@ class Finger { $headers = []; $headers['X-Zot-Channel'] = $channel['channel_address'] . '@' . \App::get_hostname(); $headers['X-Zot-Nonce'] = random_string(); + $headers['Host'] = $parsed_host; + $xhead = \Zotlabs\Web\HTTPSig::create_sig('',$headers,$channel['channel_prvkey'], 'acct:' . $channel['channel_address'] . '@' . \App::get_hostname(),false);