connect issue and pubstream localhost delivery issue

This commit is contained in:
zotlabs 2020-07-14 18:47:23 -07:00
parent 95dd75e813
commit e07a92a4d5
2 changed files with 28 additions and 3 deletions

View file

@ -534,7 +534,31 @@ class Notifier {
where hubloc_hash in (" . protect_sprintf(implode(',',self::$recipients)) . ") where hubloc_hash in (" . protect_sprintf(implode(',',self::$recipients)) . ")
and hubloc_error = 0 and hubloc_deleted = 0 and ( site_dead = 0 OR site_dead is null ) " and hubloc_error = 0 and hubloc_deleted = 0 and ( site_dead = 0 OR site_dead is null ) "
); );
// public posts won't make it to the local public stream unless there's a recipient on this site.
// This code block sees if it's a public post and localhost is missing, and if so adds an entry for the local sys channel to the $hubs list
if (! self::$private) {
$found_localhost = false;
if ($hubs) {
foreach ($hubs as $h) {
if ($h['hubloc_url'] === z_root()) {
$found_localhost = true;
break;
}
}
}
if (! $found_localhost) {
$localhub = q("select hubloc.*, site.site_crypto, site.site_flags from hubloc left join site on site_url = hubloc_url
where hubloc_id_url = '%s' and hubloc_error = 0 and hubloc_deleted = 0 and ( site_dead = 0 OR site_dead is null ) ",
dbesc(z_root() . '/channel/sys')
);
if ($localhub) {
$hubs = array_merge($hubs,$localhub);
}
}
}
if (! $hubs) { if (! $hubs) {
logger('notifier: no hubs', LOGGER_NORMAL, LOG_NOTICE); logger('notifier: no hubs', LOGGER_NORMAL, LOG_NOTICE);
return; return;

View file

@ -34,6 +34,8 @@ class Connect {
$my_perms = false; $my_perms = false;
$protocol = ''; $protocol = '';
$ap_allowed = get_config('system','activitypub',true) && get_pconfig($uid,'system','activitypub',true);
if (substr($url,0,1) === '[') { if (substr($url,0,1) === '[') {
$x = strpos($url,']'); $x = strpos($url,']');
if ($x) { if ($x) {
@ -85,7 +87,7 @@ class Connect {
// Some Hubzilla records were originally stored as activitypub. If we find one, force rediscovery // Some Hubzilla records were originally stored as activitypub. If we find one, force rediscovery
// since Zap cannot connect with them. // since Zap cannot connect with them.
if ($r['xchan_network'] === 'activitypub' && ! get_config('system','activitypub',true)) { if (($r['xchan_network'] === 'activitypub') && (! $ap_allowed)) {
$r = null; $r = null;
} }
} }
@ -145,7 +147,6 @@ class Connect {
} }
$ap_allowed = get_config('system','activitypub',true) && get_pconfig($uid,'system','activitypub',true);
if ($r['xchan_network'] === 'activitypub') { if ($r['xchan_network'] === 'activitypub') {
if (! $ap_allowed) { if (! $ap_allowed) {