aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Lib/Activity.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2021-01-28 14:57:37 +0000
committerMario <mario@mariovavti.com>2021-01-28 14:57:37 +0000
commit8c2442eca5889a5ece659bdb456403b28285b26b (patch)
tree83f0ca36be46f2aa775880572a24f1a62110217f /Zotlabs/Lib/Activity.php
parent8b78e18fb8ade1d04dbf2e5152288f6982a462df (diff)
downloadvolse-hubzilla-8c2442eca5889a5ece659bdb456403b28285b26b.tar.gz
volse-hubzilla-8c2442eca5889a5ece659bdb456403b28285b26b.tar.bz2
volse-hubzilla-8c2442eca5889a5ece659bdb456403b28285b26b.zip
AS channel discovery with custom access header
Diffstat (limited to 'Zotlabs/Lib/Activity.php')
-rw-r--r--Zotlabs/Lib/Activity.php10
1 files changed, 6 insertions, 4 deletions
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php
index 388d74d91..3bfdf722a 100644
--- a/Zotlabs/Lib/Activity.php
+++ b/Zotlabs/Lib/Activity.php
@@ -87,14 +87,16 @@ class Activity {
}
$headers = [
- 'Accept' => 'application/activity+json, application/ld+json; profile="https://www.w3.org/ns/activitystreams"',
+ 'Accept' => ActivityStreams::get_accept_header_string($channel),
'Host' => $m['host'],
'Date' => datetime_convert('UTC', 'UTC', 'now', 'D, d M Y H:i:s \\G\\M\\T'),
'(request-target)' => 'get ' . get_request_string($url)
];
+
if (isset($token)) {
$headers['Authorization'] = 'Bearer ' . $token;
}
+
$h = HTTPSig::create_sig($headers, $channel['channel_prvkey'], channel_url($channel), false);
$x = z_fetch_url($url, true, $redirects, ['headers' => $h]);
}
@@ -302,7 +304,7 @@ class Activity {
$m = get_iconfig($i['id'], 'activitypub', 'rawmsg');
if ($m) {
if (is_string($m))
- $t = json_decode($m,true);
+ $t = json_decode($m, true);
else
$t = $m;
}
@@ -2563,7 +2565,7 @@ class Activity {
$allowed = true;
// reject public stream comments that weren't sent by the conversation owner
- if ($is_sys_channel && $pubstream && $item['owner_xchan'] !== $observer_hash && ! $fetch_parents) { // TODO: check why? This would make it impossible to fetch externals via zotfeed where $observer_hash = sys channel
+ if ($is_sys_channel && $pubstream && $item['owner_xchan'] !== $observer_hash && !$fetch_parents) {
$allowed = false;
}
}
@@ -2963,7 +2965,7 @@ class Activity {
break;
}
- array_unshift($p,[ $a, $item ]);
+ array_unshift($p, [$a, $item]);
if ($item['parent_mid'] === $item['mid']) {
break;