mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-20 00:55:19 +00:00
bearcap work
This commit is contained in:
parent
4d4af4f1b5
commit
62200601ab
2 changed files with 21 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -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 ";
|
||||
|
||||
|
|
Loading…
Reference in a new issue