mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-19 16:35:19 +00:00
bearcaps and other stuff
This commit is contained in:
parent
b9f20f4403
commit
532def0244
4 changed files with 35 additions and 4 deletions
|
@ -54,12 +54,31 @@ class Activity {
|
|||
}
|
||||
else {
|
||||
$m = parse_url($url);
|
||||
|
||||
// handle bearcaps
|
||||
if ($m['scheme'] === 'bear' && $m['query']) {
|
||||
$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 ] );
|
||||
}
|
||||
|
|
|
@ -61,11 +61,19 @@ class Libprofile {
|
|||
|
||||
if ($profile) {
|
||||
$p = q("SELECT profile.uid AS profile_uid, profile.*, channel.* FROM profile
|
||||
LEFT JOIN channel ON profile.uid = channel.channel_id
|
||||
WHERE channel.channel_address = '%s' AND profile.profile_guid = '%s' LIMIT 1",
|
||||
dbesc($nickname),
|
||||
dbesc($profile)
|
||||
LEFT JOIN channel ON profile.uid = channel.channel_id
|
||||
WHERE channel.channel_address = '%s' AND profile.profile_guid = '%s' LIMIT 1",
|
||||
dbesc($nickname),
|
||||
dbesc($profile)
|
||||
);
|
||||
if (! $p) {
|
||||
$p = q("SELECT profile.uid AS profile_uid, profile.*, channel.* FROM profile
|
||||
LEFT JOIN channel ON profile.uid = channel.channel_id
|
||||
WHERE channel.channel_address = '%s' AND profile.id = %d LIMIT 1",
|
||||
dbesc($nickname),
|
||||
intval($profile)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (! $p) {
|
||||
|
|
3
boot.php
3
boot.php
|
@ -22,6 +22,9 @@ require_once('vendor/autoload.php');
|
|||
if (file_exists('addon/vendor/autoload.php')) {
|
||||
require_once('addon/vendor/autoload.php');
|
||||
}
|
||||
if (file_exists('addon/version.php')) {
|
||||
require_once('addon/version.php');
|
||||
}
|
||||
|
||||
require_once('include/config.php');
|
||||
require_once('include/network.php');
|
||||
|
|
|
@ -1684,6 +1684,7 @@ function get_site_info() {
|
|||
'site_name' => (($site_name) ? $site_name : ''),
|
||||
'version' => $version,
|
||||
'version_tag' => $tag,
|
||||
'addon_version' => defined('ADDON_VERSION') ? ADDON_VERSION : 'unknown',
|
||||
'server_role' => System::get_server_role(),
|
||||
'commit' => $commit,
|
||||
'plugins' => $visible_plugins,
|
||||
|
|
Loading…
Reference in a new issue