mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-19 21:35:13 +00:00
snakebite cont.
This commit is contained in:
parent
c0a7eaa53d
commit
1c9135721a
4 changed files with 59 additions and 14 deletions
|
@ -819,6 +819,15 @@ class Activity {
|
|||
/* Add mentions only if the targets are individuals */
|
||||
$m = self::map_acl($i,(($i['allow_gid']) ? false : true));
|
||||
$ret['tag'] = (($ret['tag']) ? array_merge($ret['tag'],$m) : $m);
|
||||
$ret['to'] = [ $reply_url ];
|
||||
if (is_array($m) && $m && ! $ret['to']) {
|
||||
$ret['to'] = [];
|
||||
foreach ($m as $ma) {
|
||||
if (is_array($ma) && $ma['type'] === 'Mention') {
|
||||
$ret['to'][] = $ma['href'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -874,10 +883,6 @@ class Activity {
|
|||
if (! $x)
|
||||
return;
|
||||
|
||||
$strict = (($mentions) ? true : get_config('activitypub','compliance'));
|
||||
|
||||
$sql_extra = (($strict) ? " and xchan_network = 'activitypub' " : '');
|
||||
|
||||
$details = q("select xchan_url, xchan_addr, xchan_name from xchan where xchan_hash in (" . implode(',',$x) . ") $sql_extra");
|
||||
|
||||
if ($details) {
|
||||
|
@ -954,6 +959,22 @@ class Activity {
|
|||
'publicKeyPem' => $p['xchan_pubkey']
|
||||
];
|
||||
|
||||
// map other nomadic identities linked with this channel
|
||||
|
||||
$locations = [];
|
||||
$locs = Libzot::encode_locations($c);
|
||||
if ($locs) {
|
||||
foreach ($locs as $loc) {
|
||||
if ($loc['url'] !== z_root()) {
|
||||
$locations[] = $loc['id_url'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($locations) {
|
||||
$ret['alsoKnownAs'] = $locations;
|
||||
}
|
||||
|
||||
$cp = get_cover_photo($c['channel_id'],'array');
|
||||
if ($cp) {
|
||||
$ret['image'] = [
|
||||
|
@ -1286,7 +1307,6 @@ class Activity {
|
|||
AccessList::member_add($channel['channel_id'],'',$ret['xchan_hash'],$g['id']);
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
@ -2238,10 +2258,25 @@ class Activity {
|
|||
}
|
||||
|
||||
$allowed = false;
|
||||
|
||||
$moderated = false;
|
||||
|
||||
if ($is_child_node) {
|
||||
// in ActivityPub, anybody can post comments
|
||||
$allowed = true;
|
||||
$p = q("select id from item where mid = '%s' and uid = %d and item_wall = 1",
|
||||
dbesc($item['parent_mid']),
|
||||
intval($channel['channel_id'])
|
||||
);
|
||||
if ($p) {
|
||||
$allowed = perm_is_allowed($channel['channel_id'],$observer_hash,'post_comments');
|
||||
if (! $allowed) {
|
||||
// @wip at least let the sender know we received their comment
|
||||
// but we don't permit spam here.
|
||||
|
||||
self::send_rejection_activity($channel['channel_id'],$observer_hash,$item);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$allowed = true;
|
||||
}
|
||||
}
|
||||
elseif (perm_is_allowed($channel['channel_id'],$observer_hash,'send_stream') || ($is_sys_channel && $pubstream)) {
|
||||
$allowed = true;
|
||||
|
@ -2918,4 +2953,12 @@ class Activity {
|
|||
return $content;
|
||||
}
|
||||
|
||||
static function send_rejection_activity($channel_id,$observer_hash,$item) {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ class Apschema extends \Zotlabs\Web\Controller {
|
|||
'ostatus' => 'http://ostatus.org#',
|
||||
'conversation' => 'ostatus:conversation',
|
||||
'sensitive' => 'as:sensitive',
|
||||
'alsoKnownAs' => 'as:alsoKnownAs',
|
||||
'inheritPrivacy' => 'as:inheritPrivacy',
|
||||
'commentPolicy' => 'zot:commentPolicy',
|
||||
'topicalCollection' => 'zot:topicalCollection',
|
||||
|
|
|
@ -210,12 +210,12 @@ class Inbox extends Controller {
|
|||
case 'emojiReaction':
|
||||
// These require a resolvable object structure
|
||||
if (is_array($AS->obj)) {
|
||||
// replies must go to the replyTo endpoint if the top level post originated here.
|
||||
$item = Activity::decode_note($AS);
|
||||
if ($item['mid'] !== $item['parent_mid'] && stripos(z_root(), $item['parent_mid']) === 0) {
|
||||
$item = null;
|
||||
break;
|
||||
}
|
||||
// @wip replies must go to the replyTo endpoint if the top level post originated here.
|
||||
//if ($item['mid'] !== $item['parent_mid'] && stripos(z_root(), $item['parent_mid']) === 0) {
|
||||
// $item = null;
|
||||
// break;
|
||||
//}
|
||||
}
|
||||
else {
|
||||
logger('unresolved object: ' . print_r($AS->obj,true));
|
||||
|
|
3
boot.php
3
boot.php
|
@ -470,7 +470,8 @@ define ( 'NAMESPACE_YMEDIA', 'http://search.yahoo.com/mrss/' );
|
|||
|
||||
define ( 'ACTIVITYSTREAMS_JSONLD_REV', 'https://www.w3.org/ns/activitystreams' );
|
||||
|
||||
define ( 'ZOT_APSCHEMA_REV', '/apschema/v1.10' );
|
||||
define ( 'ZOT_APSCHEMA_REV', '/apschema/v1.11' );
|
||||
|
||||
/**
|
||||
* activity stream defines
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue