delivery issue

This commit is contained in:
nobody 2022-05-05 06:04:30 -07:00
parent 7f131b9266
commit c7eee4fdad
5 changed files with 91 additions and 69 deletions

View file

@ -506,7 +506,9 @@ class Libsync
$abconfig = null;
if (array_key_exists('abconfig', $abook) && is_array($abook['abconfig']) && count($abook['abconfig'])) {
$abconfig = $abook['abconfig'];
}
$clean = [];
@ -647,7 +649,16 @@ class Libsync
if ($abconfig) {
/// @fixme does not handle sync of del_abconfig
foreach ($abconfig as $abc) {
set_abconfig($channel['channel_id'], $abc['xchan'], $abc['cat'], $abc['k'], $abc['v']);
if ($abc['cat'] === 'system' && $abc['k'] === 'my_perms') {
$x = explode(',', $abc['v']);
if (in_array('view_stream',$x) && ! in_array('deliver_stream',$x)) {
$x[] = 'deliver_stream'';
}
set_abconfig($channel['channel_id'], $abc['xchan'], $abc['cat'], $abc['k'], implode(',', $x);
}
else {
set_abconfig($channel['channel_id'], $abc['xchan'], $abc['cat'], $abc['k'], $abc['v']);
}
}
}
if ($reconnect) {

View file

@ -2741,7 +2741,7 @@ class Libzot
public static function import_site($arr)
{
if ((!is_array($arr)) || (!$arr['url']) || (!$arr['site_sig'])) {
if (!(is_array($arr) && isset($arr['url']) && isset($arr['site_sig']))) {
return false;
}
@ -3303,79 +3303,59 @@ class Libzot
$ret['site']['authRedirect'] = z_root() . '/magic';
$ret['site']['sitekey'] = get_config('system', 'pubkey');
$dirmode = get_config('system', 'directory_mode');
if (($dirmode === false) || ($dirmode == DIRECTORY_MODE_NORMAL)) {
$ret['site']['directory_mode'] = 'normal';
}
if ($dirmode == DIRECTORY_MODE_PRIMARY) {
$ret['site']['directory_mode'] = 'primary';
} elseif ($dirmode == DIRECTORY_MODE_SECONDARY) {
$ret['site']['directory_mode'] = 'secondary';
} elseif ($dirmode == DIRECTORY_MODE_STANDALONE) {
$ret['site']['directory_mode'] = 'standalone';
}
if ($dirmode != DIRECTORY_MODE_NORMAL) {
$ret['site']['directory_url'] = z_root() . '/dirsearch';
}
$ret['site']['encryption'] = Crypto::methods();
$ret['signature_algorithm'] = $sig_method;
$ret['site']['zot'] = System::get_zot_revision();
// hide detailed site information if you're off the grid
if ($dirmode != DIRECTORY_MODE_STANDALONE || $force) {
$register_policy = intval(get_config('system', 'register_policy'));
if ($register_policy == REGISTER_CLOSED) {
$ret['site']['register_policy'] = 'closed';
}
if ($register_policy == REGISTER_APPROVE) {
$ret['site']['register_policy'] = 'approve';
}
if ($register_policy == REGISTER_OPEN) {
$ret['site']['register_policy'] = 'open';
}
$access_policy = intval(get_config('system', 'access_policy'));
if ($access_policy == ACCESS_PRIVATE) {
$ret['site']['access_policy'] = 'private';
}
if ($access_policy == ACCESS_PAID) {
$ret['site']['access_policy'] = 'paid';
}
if ($access_policy == ACCESS_FREE) {
$ret['site']['access_policy'] = 'free';
}
if ($access_policy == ACCESS_TIERED) {
$ret['site']['access_policy'] = 'tiered';
}
$ret['site']['admin'] = get_config('system', 'admin_email');
$visible_plugins = [];
$r = q("select * from addon where hidden = 0");
if ($r) {
foreach ($r as $rr) {
$visible_plugins[] = $rr['aname'];
}
}
$ret['site']['about'] = bbcode(get_config('system', 'siteinfo'), ['export' => true]);
$ret['site']['plugins'] = $visible_plugins;
$ret['site']['sitehash'] = get_config('system', 'location_hash');
$ret['site']['sellpage'] = get_config('system', 'sellpage');
$ret['site']['location'] = get_config('system', 'site_location');
$ret['site']['sitename'] = System::get_site_name();
$ret['site']['logo'] = System::get_site_icon();
$ret['site']['project'] = System::get_project_name();
$ret['site']['version'] = System::get_project_version();
$register_policy = intval(get_config('system', 'register_policy'));
if ($register_policy == REGISTER_CLOSED) {
$ret['site']['register_policy'] = 'closed';
}
if ($register_policy == REGISTER_APPROVE) {
$ret['site']['register_policy'] = 'approve';
}
if ($register_policy == REGISTER_OPEN) {
$ret['site']['register_policy'] = 'open';
}
$access_policy = intval(get_config('system', 'access_policy'));
if ($access_policy == ACCESS_PRIVATE) {
$ret['site']['access_policy'] = 'private';
}
if ($access_policy == ACCESS_PAID) {
$ret['site']['access_policy'] = 'paid';
}
if ($access_policy == ACCESS_FREE) {
$ret['site']['access_policy'] = 'free';
}
if ($access_policy == ACCESS_TIERED) {
$ret['site']['access_policy'] = 'tiered';
}
$ret['site']['admin'] = get_config('system', 'admin_email');
$visible_plugins = [];
$r = q("select * from addon where hidden = 0");
if ($r) {
foreach ($r as $rr) {
$visible_plugins[] = $rr['aname'];
}
}
$ret['site']['about'] = bbcode(get_config('system', 'siteinfo'), ['export' => true]);
$ret['site']['plugins'] = $visible_plugins;
$ret['site']['sitehash'] = get_config('system', 'location_hash');
$ret['site']['sellpage'] = get_config('system', 'sellpage');
$ret['site']['location'] = get_config('system', 'site_location');
$ret['site']['sitename'] = System::get_site_name();
$ret['site']['logo'] = System::get_site_icon();
$ret['site']['project'] = System::get_project_name();
$ret['site']['version'] = System::get_project_version();
return $ret['site'];
}

30
Code/Update/_1257.php Normal file
View file

@ -0,0 +1,30 @@
<?php
namespace Code\Update;
use Code\Lib\AbConfig;
class _1257
{
public function run()
{
$r = q("SELECT * from abook where abook_self = 0");
if ($r) {
foreach ($r as $rv) {
$perms = AbConfig::Get($rv['abook_channel'], $rv['abook_xchan'], 'system', 'my_perms', [] );
$s = explode(',', $perms);
if (in_array('view_stream', $s) && (! in_array('deliver_stream', $s))) {
$s[] = 'deliver_stream';
}
AbConfig::Set($rv['abook_channel'], $rv['abook_xchan'], 'system', 'my_perms', implode(',', $s));
}
}
return UPDATE_SUCCESS;
}
public function verify()
{
return true;
}
}

View file

@ -27,7 +27,7 @@ require_once('version.php');
define ( 'PLATFORM_NAME', 'streams' );
define ( 'DB_UPDATE_VERSION', 1256 );
define ( 'DB_UPDATE_VERSION', 1257 );
define ( 'ZOT_REVISION', '11.0' );
define ( 'PLATFORM_ARCHITECTURE', 'zap' );

View file

@ -164,6 +164,7 @@ function collect_recipients($item, &$private_envelope,$include_groups = true) {
$recipients = check_list_permissions($item['uid'],$recipients,'deliver_stream');
// add ourself just in case we have nomadic clones that need to get a copy.
$recipients[] = $item['author_xchan'];