mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-22 07:35:20 +00:00
Merge branch 'dev' of /home/macgirvin/z into dev
This commit is contained in:
commit
97f47ec4f2
2 changed files with 65 additions and 13 deletions
|
@ -106,7 +106,35 @@ class Channel extends Controller {
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ActivityStreams::is_as_request()) {
|
if (ActivityStreams::is_as_request()) {
|
||||||
|
|
||||||
|
// 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$x = array_merge(['@context' => [
|
$x = array_merge(['@context' => [
|
||||||
ACTIVITYSTREAMS_JSONLD_REV,
|
ACTIVITYSTREAMS_JSONLD_REV,
|
||||||
|
|
|
@ -174,18 +174,36 @@ class Linkinfo extends Controller {
|
||||||
|
|
||||||
if ($process_zotobj) {
|
if ($process_zotobj) {
|
||||||
$x = Activity::fetch($url, App::get_channel());
|
$x = Activity::fetch($url, App::get_channel());
|
||||||
|
$y = null;
|
||||||
if (is_array($x)) {
|
if (is_array($x)) {
|
||||||
$y = new ActivityStreams($x);
|
if (ActivityStreams::is_an_actor($x['type']) && $x['id']) {
|
||||||
if ($y->is_valid() && $y->type === 'Announce' && is_array($y->obj)
|
if (check_siteallowed($x['id']) && check_channelallowed($x['id'])) {
|
||||||
&& array_key_exists('object',$y->obj) && array_key_exists('actor',$y->obj)) {
|
$url = $x['url'];
|
||||||
// This is a relayed/forwarded Activity (as opposed to a shared/boosted object)
|
if (is_array($url)) {
|
||||||
// Reparse the encapsulated Activity and use that instead
|
$url = $url[0]['href'];
|
||||||
logger('relayed activity',LOGGER_DEBUG);
|
}
|
||||||
$y = new ActivityStreams($y->obj);
|
$name = (($x['name']) ? $x['name'] . ' (' . $x['preferredUsername'] . ')' : $x['preferredUsername']);
|
||||||
|
|
||||||
|
if (array_path_exists('icon/url',$x)) {
|
||||||
|
$text = $br . $br . '[zrl=' . $url . '][zmg=300x300]' . $x['icon']['url'] . '[/zmg][/zrl]' ;
|
||||||
|
}
|
||||||
|
$text .= $br . $br . '[zrl=' . $url . ']' . $name . '[/zrl]' . $br . $br;
|
||||||
|
echo $text;
|
||||||
|
killme();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$y = new ActivityStreams($x);
|
||||||
|
if ($y->is_valid() && $y->type === 'Announce' && is_array($y->obj)
|
||||||
|
&& array_key_exists('object',$y->obj) && array_key_exists('actor',$y->obj)) {
|
||||||
|
// This is a relayed/forwarded Activity (as opposed to a shared/boosted object)
|
||||||
|
// Reparse the encapsulated Activity and use that instead
|
||||||
|
logger('relayed activity',LOGGER_DEBUG);
|
||||||
|
$y = new ActivityStreams($y->obj);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($y && $y->is_valid()) {
|
||||||
if ($y->is_valid()) {
|
|
||||||
$z = Activity::decode_note($y);
|
$z = Activity::decode_note($y);
|
||||||
$r = q("select hubloc_hash, hubloc_network, hubloc_url from hubloc where hubloc_hash = '%s' OR hubloc_id_url = '%s'",
|
$r = q("select hubloc_hash, hubloc_network, hubloc_url from hubloc where hubloc_hash = '%s' OR hubloc_id_url = '%s'",
|
||||||
dbesc(is_array($y->actor) ? $y->actor['id'] : $y->actor),
|
dbesc(is_array($y->actor) ? $y->actor['id'] : $y->actor),
|
||||||
|
@ -200,9 +218,15 @@ class Linkinfo extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($z) {
|
if ($z) {
|
||||||
$s = new Zlib\Share($z);
|
|
||||||
echo $s->bbcode();
|
// do not allow somebody to embed a post that was blocked by the site admin
|
||||||
killme();
|
// We *will* let them over-rule any blocks they created themselves
|
||||||
|
|
||||||
|
if (check_siteallowed($r['hubloc_id_url']) && check_channelallowed($z['author_xchan'])) {
|
||||||
|
$s = new Zlib\Share($z);
|
||||||
|
echo $s->bbcode();
|
||||||
|
killme();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue