diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index c99984bdd..d6f4e1aae 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -76,7 +76,10 @@ class Activity { $token = substr($p,2); } } + // re-parse the URL because it changed and we need the host in the next section + $m = parse_url($url); } + } $headers = [ @@ -2970,6 +2973,18 @@ class Activity { } + static function bear_from_request() { + + foreach ( [ 'REDIRECT_REMOTE_USER', 'HTTP_AUTHORIZATION' ] as $s ) { + $auth = ((array_key_exists($s,$_SERVER) && strpos($_SERVER[$s],'Bearer ') === 0) + ? str_replace('Bearer ', EMPTY_STR, $_SERVER[$s]) + : EMPTY_STR + ); + break; + } + + return (($auth) ? 'bear:?u=' . z_root() . $_SERVER['REQUEST_URI'] . '&t=' . $auth : EMPTY_STR); + } } diff --git a/Zotlabs/Module/Activity.php b/Zotlabs/Module/Activity.php index 08776e7e2..ece8b84ef 100644 --- a/Zotlabs/Module/Activity.php +++ b/Zotlabs/Module/Activity.php @@ -9,7 +9,7 @@ use Zotlabs\Lib\Activity as ZlibActivity; class Activity extends Controller { function init() { - + if (ActivityStreams::is_as_request()) { $item_id = argv(1); @@ -17,6 +17,11 @@ class Activity extends Controller { return; } + $bear = ZlibActivity::bear_from_request(); + if ($bear) { + logger('bear: ' . $bear, LOGGER_DEBUG); + } + $item_normal = " and item.item_hidden = 0 and item.item_type = 0 and item.item_unpublished = 0 and item.item_delayed = 0 and item.item_blocked = 0 ";