aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module
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/Module
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/Module')
-rw-r--r--Zotlabs/Module/Channel.php40
1 files changed, 37 insertions, 3 deletions
diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php
index 11f4d3a52..5cfcb623b 100644
--- a/Zotlabs/Module/Channel.php
+++ b/Zotlabs/Module/Channel.php
@@ -4,10 +4,12 @@ namespace Zotlabs\Module;
use App;
-use Zotlabs\Web\Controller;
+use Zotlabs\Lib\Activity;
+use Zotlabs\Lib\ActivityStreams;
+use Zotlabs\Lib\Libzot;
use Zotlabs\Lib\PermissionDescription;
+use Zotlabs\Web\Controller;
use Zotlabs\Web\HTTPSig;
-use Zotlabs\Lib\Libzot;
require_once('include/items.php');
require_once('include/security.php');
@@ -25,7 +27,7 @@ class Channel extends Controller {
function init() {
- if(in_array(substr($_GET['search'],0,1),[ '@', '!', '?']))
+ if(in_array(substr($_GET['search'],0,1),[ '@', '!', '?']) || strpos($_GET['search'], 'https://') === 0)
goaway('search' . '?f=&search=' . $_GET['search']);
$which = null;
@@ -87,6 +89,38 @@ class Channel extends Controller {
killme();
}
+ if (ActivityStreams::is_as_request($channel)) {
+
+ // Somebody may attempt an ActivityStreams fetch on one of our message permalinks
+ // Make it do the right thing.
+
+ $mid = ((x($_REQUEST,'mid')) ? $_REQUEST['mid'] : '');
+ if ($mid && strpos($mid,'b64.') === 0) {
+ $decoded = @base64url_decode(substr($mid,4));
+ if ($decoded) {
+ $mid = $decoded;
+ }
+ }
+ if ($mid) {
+ $obj = null;
+ if (strpos($mid, z_root() . '/item/') === 0) {
+ App::$argc = 2;
+ App::$argv = [ 'item', basename($mid) ];
+ $obj = new Item();
+ }
+ if (strpos($mid, z_root() . '/activity/') === 0) {
+ App::$argc = 2;
+ App::$argv = [ 'activity', basename($mid) ];
+ $obj = new Activity();
+ }
+ if ($obj) {
+ $obj->init();
+ }
+ }
+
+ as_return_and_die(Activity::encode_person($channel,true),$channel);
+ }
+
if((local_channel()) && (argc() > 2) && (argv(2) === 'view')) {
$which = $channel['channel_address'];
$profile = argv(1);