Merge branch 'dev' of /home/macgirvin/z into dev

This commit is contained in:
nobody 2020-10-13 19:18:49 -07:00
commit 7d928f655c
7 changed files with 159 additions and 32 deletions

View file

@ -556,8 +556,8 @@ class Notifier {
} }
} }
if (! $found_localhost) { if (! $found_localhost) {
$localhub = q("select hubloc.*, site.site_crypto, site.site_flags from hubloc left join site on site_url = hubloc_url $localhub = q("select hubloc.*, site.site_crypto, site.site_flags, site.site_dead from hubloc
where hubloc_id_url = '%s' and hubloc_error = 0 and hubloc_deleted = 0 and ( site_dead = 0 OR site_dead is null ) ", left join site on site_url = hubloc_url where hubloc_id_url = '%s' and hubloc_error = 0 and hubloc_deleted = 0 ",
dbesc(z_root() . '/channel/sys') dbesc(z_root() . '/channel/sys')
); );
if ($localhub) { if ($localhub) {
@ -583,8 +583,13 @@ class Notifier {
$keys = []; // array of keys to check uniquness for zot hubs $keys = []; // array of keys to check uniquness for zot hubs
$urls = []; // array of urls to check uniqueness of hubs from other networks $urls = []; // array of urls to check uniqueness of hubs from other networks
$hub_env = []; // per-hub envelope so we don't broadcast the entire envelope to all $hub_env = []; // per-hub envelope so we don't broadcast the entire envelope to all
$dead = []; // known dead hubs - report them as undeliverable
foreach ($hubs as $hub) { foreach ($hubs as $hub) {
if (intval($hub['site_dead'])) {
$dead[] = $hub;
continue;
}
if (self::$env_recips) { if (self::$env_recips) {
foreach (self::$env_recips as $er) { foreach (self::$env_recips as $er) {
@ -720,9 +725,31 @@ class Notifier {
do_delivery(self::$deliveries); do_delivery(self::$deliveries);
} }
if ($dead) {
foreach ($dead as $deceased) {
if (is_array($target_item) && (! $target_item['item_deleted']) && (! get_config('system','disable_dreport'))) {
q("insert into dreport ( dreport_mid, dreport_site, dreport_recip, dreport_name, dreport_result, dreport_time, dreport_xchan, dreport_queue )
values ( '%s', '%s','%s','%s','%s','%s','%s','%s' ) ",
dbesc($target_item['mid']),
dbesc($deceased['hubloc_host']),
dbesc($deceased['hubloc_host']),
dbesc($deceased['hubloc_host']),
dbesc('undeliverable/unresponsive site'),
dbesc(datetime_convert()),
dbesc(self::$channel['channel_hash']),
dbesc(new_uuid())
);
}
}
}
call_hooks('notifier_end',$target_item); call_hooks('notifier_end',$target_item);
logger('notifer: complete.'); logger('notifer: complete.');
return; return;
} }

View file

@ -221,6 +221,41 @@ class AccessList {
$pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval($records), intval($start)); $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval($records), intval($start));
} }
// process virtual groups
if (strpos($gid,':') === 0) {
$vg = substr($gid,1);
switch ($vg) {
case '1':
$sql_extra = EMPTY_STR;
break;
case '2':
$sql_extra = " and xchan_network = 'zot6' ";
break;
case '3':
$sql_extra = " and xchan_network = 'activitypub' ";
break;
default:
break;
}
if ($total) {
$r = q("SELECT count(*) FROM abook left join xchan on xchan_hash = abook_xchan WHERE abook_channel = %d and xchan_deleted = 0 and abook_self = 0 and abook_blocked = 0 and abook_pending = 0 $sql_extra ORDER BY xchan_name ASC $pager_sql",
intval($uid)
);
return ($r) ? $r[0]['total'] : false;
}
$r = q("SELECT * FROM abook left join xchan on xchan_hash = abook_xchan
WHERE abook_channel = %d and xchan_deleted = 0 and abook_self = 0 and abook_blocked = 0 and abook_pending = 0 $sql_extra ORDER BY xchan_name ASC $pager_sql",
intval($uid)
);
if ($r) {
for($x = 0; $x < count($r); $x ++) {
$r[$x]['xchan'] = $r[$x]['abook_xchan'];
}
}
return $r;
}
if (intval($gid)) { if (intval($gid)) {
if ($total) { if ($total) {
$r = q("SELECT count(xchan) as total FROM pgrp_member $r = q("SELECT count(xchan) as total FROM pgrp_member

View file

@ -139,6 +139,12 @@ class Inbox extends Controller {
dbesc(datetime_convert()), dbesc(datetime_convert()),
dbesc($observer_hash) dbesc($observer_hash)
); );
$m = parse_url($observer_hash);
if ($m['scheme'] && $m['host']) {
$test = q("update site set site_dead = 0 where site_dead = 1 and site_url = '%s' ",
dbesc($m['scheme'] . '://' . $m['host'])
);
}
if ($is_public) { if ($is_public) {

View file

@ -67,7 +67,7 @@ class Stream extends Controller {
$datequery = ((x($_GET,'dend') && is_a_date_arg($_GET['dend'])) ? notags($_GET['dend']) : ''); $datequery = ((x($_GET,'dend') && is_a_date_arg($_GET['dend'])) ? notags($_GET['dend']) : '');
$datequery2 = ((x($_GET,'dbegin') && is_a_date_arg($_GET['dbegin'])) ? notags($_GET['dbegin']) : ''); $datequery2 = ((x($_GET,'dbegin') && is_a_date_arg($_GET['dbegin'])) ? notags($_GET['dbegin']) : '');
$static = ((x($_GET,'static')) ? intval($_GET['static']) : 0); $static = ((x($_GET,'static')) ? intval($_GET['static']) : 0);
$gid = ((x($_GET,'gid')) ? intval($_GET['gid']) : 0); $gid = ((x($_GET,'gid')) ? $_REQUEST['gid'] : 0);
$category = ((x($_REQUEST,'cat')) ? $_REQUEST['cat'] : ''); $category = ((x($_REQUEST,'cat')) ? $_REQUEST['cat'] : '');
$hashtags = ((x($_REQUEST,'tag')) ? $_REQUEST['tag'] : ''); $hashtags = ((x($_REQUEST,'tag')) ? $_REQUEST['tag'] : '');
$verb = ((x($_REQUEST,'verb')) ? $_REQUEST['verb'] : ''); $verb = ((x($_REQUEST,'verb')) ? $_REQUEST['verb'] : '');
@ -110,18 +110,41 @@ class Stream extends Controller {
} }
// filter by collection (e.g. group) // filter by collection (e.g. group)
$vg = false;
if ($gid) { if ($gid) {
$r = q("SELECT * FROM pgrp WHERE id = %d AND uid = %d LIMIT 1", if (strpos($gid,':') === 0) {
intval($gid), $g = substr($gid,1);
intval(local_channel()) switch ($g) {
); case '1':
if (! $r) { $r = [ 'hash' => 'connections:' . $channel['channel_hash'] ];
if ($update) { $vg = t('Connections');
killme(); break;
case '2':
$r = [ 'hash' => 'zot:' . $channel['channel_hash'] ];
$vg = t('Zot');
break;
case '3':
$r = [ 'hash' => 'activitypub:' . $channel['channel_hash'] ];
$vg = t('ActivityPub');
break;
default:
break;
}
}
else {
$r = q("SELECT * FROM pgrp WHERE id = %d AND uid = %d LIMIT 1",
intval($gid),
intval(local_channel())
);
if (! $r) {
if ($update) {
killme();
}
notice( t('Access list not found') . EOL );
goaway(z_root() . '/stream');
} }
notice( t('Access list not found') . EOL );
goaway(z_root() . '/stream');
} }
$group = $gid; $group = $gid;
@ -257,12 +280,15 @@ class Stream extends Controller {
$item_thread_top = ''; $item_thread_top = '';
$sql_extra = " AND item.parent IN ( SELECT DISTINCT parent FROM item WHERE true $sql_options AND (( author_xchan IN ( $contact_str ) OR owner_xchan in ( $contact_str )) or allow_gid like '" . protect_sprintf('%<' . dbesc($group_hash) . '>%') . "' ) and id = parent $item_normal ) "; $sql_extra = " AND item.parent IN ( SELECT DISTINCT parent FROM item WHERE true $sql_options AND (( author_xchan IN ( $contact_str ) OR owner_xchan in ( $contact_str )) or allow_gid like '" . protect_sprintf('%<' . dbesc($group_hash) . '>%') . "' ) and id = parent $item_normal ) ";
if (! $vg) {
$x = AccessList::rec_byhash(local_channel(), $group_hash);
}
$x = AccessList::rec_byhash(local_channel(), $group_hash); if ($x || $vg) {
if ($x) {
$title = replace_macros(get_markup_template("section_title.tpl"),array( $title = replace_macros(get_markup_template("section_title.tpl"),array(
'$title' => sprintf( t('Access list: %s'), $x['gname']) '$title' => sprintf( t('Access list: %s'), (($vg) ? $vg : $x['gname']))
)); ));
} }

View file

@ -3,7 +3,7 @@
namespace Zotlabs\Widget; namespace Zotlabs\Widget;
use App; use App;
use Zotlabs\Lib\Apps;
class Activity_filter { class Activity_filter {
@ -85,19 +85,51 @@ class Activity_filter {
intval(local_channel()) intval(local_channel())
); );
if($groups) { if($groups || Apps::system_app_installed(local_channel(),'Virtual Lists')) {
foreach($groups as $g) { if ($groups) {
if(x($_GET,'gid')) { foreach($groups as $g) {
$group_active = (($_GET['gid'] == $g['id']) ? 'active' : ''); if(x($_GET,'gid')) {
$filter_active = 'group'; $group_active = (($_GET['gid'] == $g['id']) ? 'active' : '');
$filter_active = 'group';
}
$gsub[] = [
'label' => $g['gname'],
'icon' => '',
'url' => z_root() . '/' . $cmd . '/?f=&gid=' . $g['id'],
'sel' => $group_active,
'title' => sprintf(t('Show posts related to the %s access list'), $g['gname'])
];
}
}
if (Apps::system_app_installed(local_channel(),'Virtual Lists')) {
foreach ([ ':1', ':2', ':3' ] as $l) {
switch ($l) {
case ':1':
$gname = t('Connections');
break;
case ':2':
$gname = t('Zot');
break;
case ':3':
$gname = t('ActivityPub');
break;
default:
break;
}
if(x($_GET,'gid')) {
$group_active = (($_GET['gid'] == $l) ? 'active' : '');
$filter_active = 'group';
}
$gsub[] = [
'label' => $gname,
'icon' => '',
'url' => z_root() . '/' . $cmd . '/?f=&gid=' . $l,
'sel' => $group_active,
'title' => sprintf(t('Show posts related to the %s access list'), $gname)
];
} }
$gsub[] = [
'label' => $g['gname'],
'icon' => '',
'url' => z_root() . '/' . $cmd . '/?f=&gid=' . $g['id'],
'sel' => $group_active,
'title' => sprintf(t('Show posts related to the %s access list'), $g['gname'])
];
} }
$tabs[] = [ $tabs[] = [
'id' => 'privacy_groups', 'id' => 'privacy_groups',

View file

@ -16,7 +16,7 @@ use Zotlabs\Daemon\Run;
* @brief This file defines some global constants and includes the central App class. * @brief This file defines some global constants and includes the central App class.
*/ */
define ( 'STD_VERSION', '20.10.06' ); define ( 'STD_VERSION', '20.10.14' );
define ( 'ZOT_REVISION', '6.0' ); define ( 'ZOT_REVISION', '6.0' );
define ( 'DB_UPDATE_VERSION', 1243 ); define ( 'DB_UPDATE_VERSION', 1243 );

View file

@ -4,7 +4,8 @@
var bParam_uid = {{$uid}}; var bParam_uid = {{$uid}};
var bParam_gid = {{$gid}}; // lists can be either type string (virtual lists) or integer (normal accesslists)
var bParam_gid = "{{$gid}}";
var bParam_cid = {{$cid}}; var bParam_cid = {{$cid}};
var bParam_cmin = {{$cmin}}; var bParam_cmin = {{$cmin}};
var bParam_cmax = {{$cmax}}; var bParam_cmax = {{$cmax}};