aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Lib/Activity.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2019-08-15 21:30:47 -0700
committerzotlabs <mike@macgirvin.com>2019-08-15 21:30:47 -0700
commitac05a2ede7023495618b316635b93274416b69d8 (patch)
tree32350070ec5601282afe4411486c629ce14e1a2e /Zotlabs/Lib/Activity.php
parent808baf203d8c7aa57d89a3d5412742a4c84934b6 (diff)
downloadvolse-hubzilla-ac05a2ede7023495618b316635b93274416b69d8.tar.gz
volse-hubzilla-ac05a2ede7023495618b316635b93274416b69d8.tar.bz2
volse-hubzilla-ac05a2ede7023495618b316635b93274416b69d8.zip
support "bearcaps" in Activity library
Diffstat (limited to 'Zotlabs/Lib/Activity.php')
-rw-r--r--Zotlabs/Lib/Activity.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php
index 5f5f74ca9..0757eec37 100644
--- a/Zotlabs/Lib/Activity.php
+++ b/Zotlabs/Lib/Activity.php
@@ -63,12 +63,31 @@ class Activity {
}
else {
$m = parse_url($url);
+
+ // handle bearcaps
+ if ($m['scheme'] === 'bear') {
+ $params = explode('&',$m['query']);
+ if ($params) {
+ foreach ($params as $p) {
+ if (substr($p,0,2) === 'u=') {
+ $url = substr($p,2);
+ }
+ if (substr($p,0,2) === 't=') {
+ $token = substr($p,2);
+ }
+ }
+ }
+ }
+
$headers = [
'Accept' => 'application/activity+json, application/ld+json; profile="https://www.w3.org/ns/activitystreams"',
'Host' => $m['host'],
'(request-target)' => 'get ' . get_request_string($url),
'Date' => datetime_convert('UTC','UTC','now','D, d M Y H:i:s') . ' UTC'
];
+ 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 ] );
}