diff options
Diffstat (limited to 'Zotlabs')
-rw-r--r-- | Zotlabs/Daemon/Cron.php | 3 | ||||
-rw-r--r-- | Zotlabs/Lib/Activity.php | 27 | ||||
-rw-r--r-- | Zotlabs/Module/Zotfeed.php | 49 |
3 files changed, 49 insertions, 30 deletions
diff --git a/Zotlabs/Daemon/Cron.php b/Zotlabs/Daemon/Cron.php index 2c0422ddd..4732dfa75 100644 --- a/Zotlabs/Daemon/Cron.php +++ b/Zotlabs/Daemon/Cron.php @@ -215,9 +215,10 @@ class Cron { // pull in some public posts - $disable_discover_tab = get_config('system', 'disable_discover_tab') || get_config('system', 'disable_discover_tab') === false; +/* $disable_discover_tab = get_config('system', 'disable_discover_tab') || get_config('system', 'disable_discover_tab') === false; if (!$disable_discover_tab) Master::Summon(array('Externals')); +*/ $restart = false; diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index 197409a19..46ce075fd 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -2598,9 +2598,10 @@ class Activity { $allowed = true; } - // TODO: not implemented - /*if (intval($channel['channel_system'])) { + if ($is_sys_channel) { + + /* TODO: not implemented if (! check_pubstream_channelallowed($observer_hash)) { $allowed = false; } @@ -2618,7 +2619,12 @@ class Activity { } } } - }*/ + */ + + if (intval($item['item_private'])) { + $allowed = false; + } + } // TODO: not implemented /*$blocked = LibBlock::fetch($channel['channel_id'],BLOCKTYPE_SERVER); @@ -2945,9 +2951,20 @@ class Activity { if ($item) { $item['item_fetched'] = 1; - array_unshift($p, [$a, $item]); - if ($item['parent_mid'] === $item['mid'] || count($p) > 100) { + if (intval($channel['channel_system']) && intval($item['item_private'])) { + $p = []; + break; + } + + if (count($p) > 100) { + $p = []; + break; + } + + array_unshift($p,[ $a, $item ]); + + if ($item['parent_mid'] === $item['mid']) { break; } } diff --git a/Zotlabs/Module/Zotfeed.php b/Zotlabs/Module/Zotfeed.php index 17b0e3057..2566924aa 100644 --- a/Zotlabs/Module/Zotfeed.php +++ b/Zotlabs/Module/Zotfeed.php @@ -6,13 +6,13 @@ use App; use Zotlabs\Lib\Activity; use Zotlabs\Lib\ActivityStreams; use Zotlabs\Lib\Config; +use Zotlabs\Lib\ThreadListener; use Zotlabs\Web\Controller; use Zotlabs\Web\HTTPSig; class Zotfeed extends Controller { function init() { - if (ActivityStreams::is_as_request()) { if (observer_prohibited(true)) { @@ -24,6 +24,10 @@ class Zotfeed extends Controller { killme(); } + if (intval($channel['channel_system'])) { + killme(); + } + $sigdata = HTTPSig::verify(($_SERVER['REQUEST_METHOD'] === 'POST') ? file_get_contents('php://input') : EMPTY_STR); if ($sigdata['portable_id'] && $sigdata['header_valid']) { $portable_id = $sigdata['portable_id']; @@ -52,28 +56,6 @@ class Zotfeed extends Controller { $params['cat'] = ((x($_REQUEST, 'cat')) ? escape_tags($_REQUEST['cat']) : ''); $params['compat'] = 1; - if (intval($channel['channel_system'])) { - $total = zot_feed($channel['channel_id'], $observer_hash, ['total' => true]); - - if ($total) { - App::set_pager_total($total); - App::set_pager_itemspage(30); - } - - if (App::$pager['unset'] && $total > 30) { - $ret = Activity::paged_collection_init($total, App::$query_string); - - } - else { - $items = zot_feed($channel['channel_id'], $observer_hash, []); - $ret = Activity::encode_item_collection($items, App::$query_string, 'OrderedCollection', $total); - } - - as_return_and_die($ret, $channel); - - return; - } - $total = items_fetch( [ 'total' => true, @@ -114,7 +96,26 @@ class Zotfeed extends Controller { 'compat' => $params['compat'] ], $channel, $observer_hash, CLIENT_MODE_NORMAL, App::$module ); - $ret = Activity::encode_item_collection($items, App::$query_string, 'OrderedCollection', $total); + + if ($items && $observer_hash) { + + // check to see if this observer is a connection. If not, register any items + // belonging to this channel for notification of deletion/expiration + + $x = q("select abook_id from abook where abook_channel = %d and abook_xchan = '%s'", + intval($channel['channel_id']), + dbesc($observer_hash) + ); + if (!$x) { + foreach ($items as $item) { + if (strpos($item['mid'], z_root()) === 0) { + ThreadListener::store($item['mid'], $observer_hash); + } + } + } + } + + $ret = Activity::encode_item_collection($items, App::$query_string, 'OrderedCollection', $total); } as_return_and_die($ret, $channel); |