From d619192b22484fa21700b5c6d2ce5d029897ee76 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 30 Jan 2022 15:33:57 +0000 Subject: attach iconfig to the activity and adjust ap raw message retrieval to handle both cases. also add a possibility to manually redeliver single hubs for debuging --- Zotlabs/Lib/Activity.php | 42 +++++++++++++++++++++++++++++++++--------- Zotlabs/Module/Admin/Queue.php | 14 +++++++++++++- view/tpl/admin_queue.tpl | 2 +- 3 files changed, 47 insertions(+), 11 deletions(-) diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index 74a146345..881bd04e2 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -660,11 +660,11 @@ class Activity { return $ret; } - static function encode_attachment($item) { + static function encode_attachment($item, $iconfig = false) { $ret = []; - if (array_key_exists('attach', $item)) { + if (!$iconfig && array_key_exists('attach', $item)) { $atts = ((is_array($item['attach'])) ? $item['attach'] : json_decode($item['attach'], true)); if ($atts) { foreach ($atts as $att) { @@ -677,7 +677,7 @@ class Activity { } } } - if (array_key_exists('iconfig', $item) && is_array($item['iconfig'])) { + if ($iconfig && array_key_exists('iconfig', $item) && is_array($item['iconfig'])) { foreach ($item['iconfig'] as $att) { if ($att['sharing']) { $value = ((is_string($att['v']) && preg_match('|^a:[0-9]+:{.*}$|s', $att['v'])) ? unserialize($att['v']) : $att['v']); @@ -930,6 +930,11 @@ class Activity { $ret['tag'] = $t; } + $a = self::encode_attachment($i, true); + if ($a) { + $ret['attachment'] = $a; + } + // addressing madness $public = (($i['item_private']) ? false : true); @@ -2638,28 +2643,47 @@ class Activity { } } - $zot_rawmsg = ''; + $ap_rawmsg = ''; $raw_arr = []; $raw_arr = json_decode($act->raw, true); // This is a zot6 packet and the raw activitypub message json // is possibly available in the attachement. - if (array_key_exists('signed', $raw_arr) && is_array($act->obj) && is_array($act->obj['attachment'])) { - foreach($act->obj['attachment'] as $a) { + if (array_key_exists('signed', $raw_arr) && is_array($act->data['attachment'])) { + foreach($act->data['attachment'] as $a) { if ( isset($a['type']) && $a['type'] === 'PropertyValue' && isset($a['name']) && $a['name'] === 'zot.activitypub.rawmsg' && isset($a['value']) ) { - $zot_rawmsg = $a['value']; + $ap_rawmsg = $a['value']; break; } } } - if ($zot_rawmsg) { - set_iconfig($s, 'activitypub', 'rawmsg', $zot_rawmsg, 1); + // old style: can be removed after most hubs are on 7.0.2 + if (!$ap_rawmsg && array_key_exists('signed', $raw_arr) && is_array($act->obj) && is_array($act->obj['attachment'])) { + foreach($act->obj['attachment'] as $a) { + if ( + isset($a['type']) && $a['type'] === 'propertyvalue' && + isset($a['name']) && $a['name'] === 'zot.activitypub.rawmsg' && + isset($a['value']) + ) { + $ap_rawmsg = $a['value']; + break; + } + } + } + + if (!$ap_rawmsg && $response_activity) { + $ap_rawmsg = json_encode($act->data, JSON_UNESCAPED_SLASHES); + } + // end old style + + if ($ap_rawmsg) { + set_iconfig($s, 'activitypub', 'rawmsg', $ap_rawmsg, 1); } else { set_iconfig($s, 'activitypub', 'rawmsg', $act->raw, 1); diff --git a/Zotlabs/Module/Admin/Queue.php b/Zotlabs/Module/Admin/Queue.php index baa50591f..8a843083b 100644 --- a/Zotlabs/Module/Admin/Queue.php +++ b/Zotlabs/Module/Admin/Queue.php @@ -23,7 +23,18 @@ class Queue { LibQueue::remove_by_posturl($_REQUEST['emptyhub']); } - $r = q("select count(outq_posturl) as total, max(outq_priority) as priority, outq_posturl from outq + if($_REQUEST['deliverhub']) { + + $hubq = q("SELECT * FROM outq WHERE outq_posturl = '%s'", + dbesc($_REQUEST['deliverhub']) + ); + + foreach ($hubq as $q) { + LibQueue::deliver($q, true); + } + } + + $r = dbq("select count(outq_posturl) as total, max(outq_priority) as priority, outq_posturl from outq where outq_delivered = 0 group by outq_posturl order by total desc"); for($x = 0; $x < count($r); $x ++) { @@ -37,6 +48,7 @@ class Queue { '$priority' => t('Priority'), '$desturl' => t('Destination URL'), '$nukehub' => t('Mark hub permanently offline'), + '$deliverhub' => t('Retry delivery to this hub'), '$empty' => t('Empty queue for this hub'), '$lastconn' => t('Last known contact'), '$hasentries' => ((count($r)) ? true : false), diff --git a/view/tpl/admin_queue.tpl b/view/tpl/admin_queue.tpl index 9d3d848c9..1587bff47 100644 --- a/view/tpl/admin_queue.tpl +++ b/view/tpl/admin_queue.tpl @@ -7,7 +7,7 @@ {{foreach $entries as $e}} -{{$e.total}}{{$e.outq_posturl}}{{$e.priority}}{{if $expert}}{{/if}} +{{$e.total}}{{$e.outq_posturl}}{{$e.priority}}{{if $expert}}{{/if}} {{/foreach}} -- cgit v1.2.3 From c3428acd801756f03b1827c56621b967e165d0de Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 30 Jan 2022 16:29:04 +0000 Subject: make sure we never save a zot6 packet as ap raw message --- Zotlabs/Lib/Activity.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index 881bd04e2..17d14d44a 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -2685,7 +2685,7 @@ class Activity { if ($ap_rawmsg) { set_iconfig($s, 'activitypub', 'rawmsg', $ap_rawmsg, 1); } - else { + elseif (!array_key_exists('signed', $raw_arr)) { set_iconfig($s, 'activitypub', 'rawmsg', $act->raw, 1); } -- cgit v1.2.3 From f1822bdfab8a5b997c32faa9c287a3fba1c0729b Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 31 Jan 2022 08:46:12 +0100 Subject: add the signature --- Zotlabs/Daemon/Notifier.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Zotlabs/Daemon/Notifier.php b/Zotlabs/Daemon/Notifier.php index 7964621c7..8aee08fe6 100644 --- a/Zotlabs/Daemon/Notifier.php +++ b/Zotlabs/Daemon/Notifier.php @@ -5,6 +5,7 @@ namespace Zotlabs\Daemon; use Zotlabs\Lib\Libzot; use Zotlabs\Lib\Activity; use Zotlabs\Lib\Queue; +use Zotlabs\Lib\LDSignatures; require_once('include/html2plain.php'); require_once('include/conversation.php'); @@ -336,12 +337,14 @@ class Notifier { self::$encoded_item = json_decode($m, true); } else { + self::$encoded_item = array_merge(['@context' => [ ACTIVITYSTREAMS_JSONLD_REV, 'https://w3id.org/security/v1', z_root() . ZOT_APSCHEMA_REV ]], Activity::encode_activity($target_item) ); + self::$encoded_item['signature'] = LDSignatures::sign(self::$encoded_item, self::$channel); } logger('target_item: ' . print_r($target_item, true), LOGGER_DEBUG); -- cgit v1.2.3 From 6c808abcfc9a52f8f331f9bfb58a455a90d1970d Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 31 Jan 2022 09:49:00 +0100 Subject: PHP 8.1 band-aid --- Zotlabs/Lib/ActivityStreams.php | 3 +++ Zotlabs/Lib/Apps.php | 2 +- Zotlabs/Lib/Libzot.php | 16 ++++++++-------- Zotlabs/Module/Item.php | 18 +++++++++--------- Zotlabs/Render/Comanche.php | 5 +++-- Zotlabs/Web/SessionHandler.php | 18 +++++++++--------- include/text.php | 4 ++++ 7 files changed, 37 insertions(+), 29 deletions(-) diff --git a/Zotlabs/Lib/ActivityStreams.php b/Zotlabs/Lib/ActivityStreams.php index 323b0e273..52f888b95 100644 --- a/Zotlabs/Lib/ActivityStreams.php +++ b/Zotlabs/Lib/ActivityStreams.php @@ -36,6 +36,9 @@ class ActivityStreams { */ function __construct($string) { + if(!$string) + return; + $this->raw = $string; if (is_array($string)) { diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index a6b5c192c..98ebc546a 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -426,7 +426,7 @@ class Apps { self::translate_system_apps($papp); - if(trim($papp['plugin']) && (! plugin_is_installed(trim($papp['plugin'])))) + if(isset($papp['plugin']) && trim($papp['plugin']) && (! plugin_is_installed(trim($papp['plugin'])))) return ''; $papp['papp'] = self::papp_encode($papp); diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php index f340514f0..dbcc2af52 100644 --- a/Zotlabs/Lib/Libzot.php +++ b/Zotlabs/Lib/Libzot.php @@ -2482,14 +2482,14 @@ class Libzot { $access_policy = ACCESS_PRIVATE; } - $directory_url = htmlspecialchars($arr['directory_url'], ENT_COMPAT, 'UTF-8', false); - $url = htmlspecialchars(strtolower($arr['url']), ENT_COMPAT, 'UTF-8', false); - $sellpage = htmlspecialchars($arr['sellpage'], ENT_COMPAT, 'UTF-8', false); - $site_location = htmlspecialchars($arr['location'], ENT_COMPAT, 'UTF-8', false); - $site_realm = htmlspecialchars($arr['realm'], ENT_COMPAT, 'UTF-8', false); - $site_project = htmlspecialchars($arr['project'], ENT_COMPAT, 'UTF-8', false); - $site_crypto = ((array_key_exists('encryption', $arr) && is_array($arr['encryption'])) ? htmlspecialchars(implode(',', $arr['encryption']), ENT_COMPAT, 'UTF-8', false) : ''); - $site_version = ((array_key_exists('version', $arr)) ? htmlspecialchars($arr['version'], ENT_COMPAT, 'UTF-8', false) : ''); + $directory_url = htmlspecialchars((string)$arr['directory_url'], ENT_COMPAT, 'UTF-8', false); + $url = htmlspecialchars((string)strtolower($arr['url']), ENT_COMPAT, 'UTF-8', false); + $sellpage = htmlspecialchars((string)$arr['sellpage'], ENT_COMPAT, 'UTF-8', false); + $site_location = htmlspecialchars((string)$arr['location'], ENT_COMPAT, 'UTF-8', false); + $site_realm = htmlspecialchars((string)$arr['realm'], ENT_COMPAT, 'UTF-8', false); + $site_project = htmlspecialchars((string)$arr['project'], ENT_COMPAT, 'UTF-8', false); + $site_crypto = ((array_key_exists('encryption', $arr) && is_array($arr['encryption'])) ? htmlspecialchars((string)implode(',', $arr['encryption']), ENT_COMPAT, 'UTF-8', false) : ''); + $site_version = ((array_key_exists('version', $arr)) ? htmlspecialchars((string)$arr['version'], ENT_COMPAT, 'UTF-8', false) : ''); // You can have one and only one primary directory per realm. // Downgrade any others claiming to be primary. As they have diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index 41979006e..41a4e120d 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -358,7 +358,7 @@ class Item extends Controller { $consensus = intval($_REQUEST['consensus']); $nocomment = intval($_REQUEST['nocomment']); - $is_poll = ((trim($_REQUEST['poll_answers'][0]) != '' && trim($_REQUEST['poll_answers'][1]) != '') ? true : false); + $is_poll = ((trim((string)$_REQUEST['poll_answers'][0]) != '' && trim((string)$_REQUEST['poll_answers'][1]) != '') ? true : false); // 'origin' (if non-zero) indicates that this network is where the message originated, // for the purpose of relaying comments to other conversation members. @@ -719,13 +719,13 @@ class Item extends Controller { } - $location = notags(trim($_REQUEST['location'])); - $coord = notags(trim($_REQUEST['coord'])); - $verb = notags(trim($_REQUEST['verb'])); - $title = escape_tags(trim($_REQUEST['title'])); - $summary = trim($_REQUEST['summary']); - $body = trim($_REQUEST['body']); - $body .= trim($_REQUEST['attachment']); + $location = notags(trim((string)$_REQUEST['location'])); + $coord = notags(trim((string)$_REQUEST['coord'])); + $verb = notags(trim((string)$_REQUEST['verb'])); + $title = escape_tags(trim((string)$_REQUEST['title'])); + $summary = trim((string)$_REQUEST['summary']); + $body = trim((string)$_REQUEST['body']); + $body .= trim((string)$_REQUEST['attachment']); $postopts = ''; $allow_empty = ((array_key_exists('allow_empty', $_REQUEST)) ? intval($_REQUEST['allow_empty']) : 0); @@ -764,7 +764,7 @@ class Item extends Controller { } - $mimetype = notags(trim($_REQUEST['mimetype'])); + $mimetype = notags(trim((string)$_REQUEST['mimetype'])); if (!$mimetype) $mimetype = 'text/bbcode'; diff --git a/Zotlabs/Render/Comanche.php b/Zotlabs/Render/Comanche.php index 5ce05243b..230c2455e 100644 --- a/Zotlabs/Render/Comanche.php +++ b/Zotlabs/Render/Comanche.php @@ -572,7 +572,7 @@ class Comanche { require_once('widget/' . trim($name) . '.php'); elseif(file_exists('widget/' . trim($name) . '/' . trim($name) . '.php')) require_once('widget/' . trim($name) . '/' . trim($name) . '.php'); - + if(! function_exists($func)) { $theme_widget = $func . '.php'; if(theme_include($theme_widget)) { @@ -640,7 +640,8 @@ class Comanche { $cnt = preg_match_all("/\[widget=(.*?)\](.*?)\[\/widget\]/ism", $s, $matches, PREG_SET_ORDER); if($cnt) { foreach($matches as $mtch) { - $s = str_replace($mtch[0],$this->widget(trim($mtch[1]),$mtch[2]),$s); + + $s = str_replace((string)$mtch[0], (string)$this->widget(trim((string)$mtch[1]), (string)$mtch[2]), $s); } } diff --git a/Zotlabs/Web/SessionHandler.php b/Zotlabs/Web/SessionHandler.php index 4292fdc28..392cab1ae 100644 --- a/Zotlabs/Web/SessionHandler.php +++ b/Zotlabs/Web/SessionHandler.php @@ -6,7 +6,7 @@ namespace Zotlabs\Web; class SessionHandler implements \SessionHandlerInterface { - function open ($s, $n) { + function open ($s, $n) : bool { return true; } @@ -15,7 +15,7 @@ class SessionHandler implements \SessionHandlerInterface { // some which call read explicitly and some that do not. So we call it explicitly // just after sid regeneration to force a record to exist. - function read ($id) { + function read ($id) : string|false { if($id) { $r = q("SELECT sess_data FROM session WHERE sid= '%s'", dbesc($id)); @@ -36,7 +36,7 @@ class SessionHandler implements \SessionHandlerInterface { } - function write ($id, $data) { + function write ($id, $data) : bool { // Pretend everything is hunky-dory, even though it isn't. // There probably isn't anything we can do about it in any event. @@ -49,9 +49,9 @@ class SessionHandler implements \SessionHandlerInterface { // Unless we authenticate somehow, only keep a session for 5 minutes // The viewer can extend this by performing any web action using the - // original cookie, but this allows us to cleanup the hundreds or + // original cookie, but this allows us to cleanup the hundreds or // thousands of empty sessions left around from web crawlers which are - // assigned cookies on each page that they never use. + // assigned cookies on each page that they never use. $expire = time() + 300; @@ -74,19 +74,19 @@ class SessionHandler implements \SessionHandlerInterface { return true; } - - function close() { + + function close() : bool { return true; } - function destroy ($id) { + function destroy ($id) : bool { q("DELETE FROM session WHERE sid = '%s'", dbesc($id)); return true; } - function gc($expire) { + function gc($expire) : int|false { q("DELETE FROM session WHERE expire < %d", dbesc(time())); return true; } diff --git a/include/text.php b/include/text.php index aea8790fc..b76175a06 100644 --- a/include/text.php +++ b/include/text.php @@ -1492,6 +1492,10 @@ function day_translate($s) { * @return string */ function normalise_link($url) { + if (!$url) { + return EMPTY_STR; + } + $ret = str_replace(array('https:', '//www.'), array('http:', '//'), $url); return(rtrim($ret, '/')); -- cgit v1.2.3 From df87d6feeb8b9235dabb6fe06cb5be9a88f17484 Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 31 Jan 2022 10:18:58 +0000 Subject: more work on relaying zap and diaspora, fix mod hcard --- Zotlabs/Lib/Activity.php | 23 ++++++++++++++++++++++- Zotlabs/Lib/ActivityStreams.php | 1 + Zotlabs/Module/Hcard.php | 38 +++++++++++++++++++------------------- 3 files changed, 42 insertions(+), 20 deletions(-) diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index 17d14d44a..df994cd79 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -529,6 +529,7 @@ class Activity { $top_level = (($i['mid'] === $i['parent_mid']) ? true : false); if ($public) { + $ret['to'] = [ACTIVITY_PUBLIC_INBOX]; $ret['cc'] = [z_root() . '/followers/' . substr($i['author']['xchan_addr'], 0, strpos($i['author']['xchan_addr'], '@'))]; } @@ -2644,6 +2645,7 @@ class Activity { } $ap_rawmsg = ''; + $diaspora_rawmsg = ''; $raw_arr = []; $raw_arr = json_decode($act->raw, true); @@ -2658,7 +2660,13 @@ class Activity { isset($a['value']) ) { $ap_rawmsg = $a['value']; - break; + } + if ( + isset($a['type']) && $a['type'] === 'PropertyValue' && + isset($a['name']) && $a['name'] === 'zot.diaspora.fields' && + isset($a['value']) + ) { + $diaspora_rawmsg = $a['value']; } } } @@ -2682,6 +2690,15 @@ class Activity { } // end old style + if (!$ap_rawmsg && array_key_exists('signed', $raw_arr)) { + //zap + unset($act->data['signer']); + unset($act->data['signed_data']); + unset($act->data['hubloc']); + + $ap_rawmsg = json_encode($act->data, JSON_UNESCAPED_SLASHES); + } + if ($ap_rawmsg) { set_iconfig($s, 'activitypub', 'rawmsg', $ap_rawmsg, 1); } @@ -2689,6 +2706,10 @@ class Activity { set_iconfig($s, 'activitypub', 'rawmsg', $act->raw, 1); } + if ($diaspora_rawmsg) { + set_iconfig($s, 'diaspora', 'fields', $diaspora_rawmsg, 1); + } + set_iconfig($s, 'activitypub', 'recips', $act->raw_recips); $hookinfo = [ diff --git a/Zotlabs/Lib/ActivityStreams.php b/Zotlabs/Lib/ActivityStreams.php index 52f888b95..ffb034bf4 100644 --- a/Zotlabs/Lib/ActivityStreams.php +++ b/Zotlabs/Lib/ActivityStreams.php @@ -56,6 +56,7 @@ class ActivityStreams { if (is_array($this->data) && array_key_exists('signed', $this->data)) { $ret = JSalmon::verify($this->data); $tmp = JSalmon::unpack($this->data['data']); + if ($ret && $ret['success']) { if ($ret['signer']) { $saved = json_encode($this->data, JSON_UNESCAPED_SLASHES); diff --git a/Zotlabs/Module/Hcard.php b/Zotlabs/Module/Hcard.php index 912c84fd2..1cc26c199 100644 --- a/Zotlabs/Module/Hcard.php +++ b/Zotlabs/Module/Hcard.php @@ -5,7 +5,7 @@ namespace Zotlabs\Module; class Hcard extends \Zotlabs\Web\Controller { function init() { - + if(argc() > 1) $which = argv(1); else { @@ -13,12 +13,12 @@ class Hcard extends \Zotlabs\Web\Controller { \App::$error = 404; return; } - + logger('hcard_request: ' . $which, LOGGER_DEBUG); $profile = ''; $channel = \App::get_channel(); - + if((local_channel()) && (argc() > 2) && (argv(2) === 'view')) { $which = $channel['channel_address']; $profile = argv(1); @@ -30,22 +30,22 @@ class Hcard extends \Zotlabs\Web\Controller { $profile = ''; $profile = $r[0]['profile_guid']; } - - head_add_link( [ - 'rel' => 'alternate', + + head_add_link( [ + 'rel' => 'alternate', 'type' => 'application/atom+xml', 'title' => t('Posts and comments'), 'href' => z_root() . '/feed/' . $which ]); - head_add_link( [ - 'rel' => 'alternate', + head_add_link( [ + 'rel' => 'alternate', 'type' => 'application/atom+xml', 'title' => t('Only posts'), 'href' => z_root() . '/feed/' . $which . '?f=&top=1' ]); - + if(! $profile) { $x = q("select channel_id as profile_uid from channel where channel_address = '%s' limit 1", dbesc(argv(1)) @@ -54,20 +54,20 @@ class Hcard extends \Zotlabs\Web\Controller { \App::$profile = $x[0]; } } - + profile_load($which,$profile); - - + + } - - + + function get() { - $x = new \Zotlabs\Widget\Profile(); + $x = new \Zotlabs\Widget\Fullprofile(); return $x->widget(array()); - + } - - - + + + } -- cgit v1.2.3 From c90862217ef29ee4f3d37d37a8fe6063aa68dbdf Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 31 Jan 2022 11:03:49 +0000 Subject: bump version --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boot.php b/boot.php index ff9801461..513e94363 100644 --- a/boot.php +++ b/boot.php @@ -60,7 +60,7 @@ require_once('include/bbcode.php'); require_once('include/items.php'); define('PLATFORM_NAME', 'hubzilla'); -define('STD_VERSION', '7.1'); +define('STD_VERSION', '7.1.1'); define('ZOT_REVISION', '6.0'); define('DB_UPDATE_VERSION', 1252); -- cgit v1.2.3 From eb207898219937435f5735eb96fe32e5b2d489f0 Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 1 Feb 2022 10:01:56 +0000 Subject: allow zotfinger to recurse through all known hublocs if the one we got does not exist (404) or got removed (410). add functions for updating tables from array and deleting hublocs. --- Zotlabs/Lib/Zotfinger.php | 26 +++++++++++++++++++++++++- include/hubloc.php | 11 ++++++++++- include/text.php | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+), 2 deletions(-) diff --git a/Zotlabs/Lib/Zotfinger.php b/Zotlabs/Lib/Zotfinger.php index 840d91403..58050609c 100644 --- a/Zotlabs/Lib/Zotfinger.php +++ b/Zotlabs/Lib/Zotfinger.php @@ -6,7 +6,7 @@ use Zotlabs\Web\HTTPSig; class Zotfinger { - static function exec($resource,$channel = null, $verify = true) { + static function exec($resource, $channel = null, $verify = true, $recurse = true) { if(! $resource) { return false; @@ -39,6 +39,30 @@ class Zotfinger { logger('fetch: ' . print_r($x,true)); + if (in_array(intval($x['return_code']), [ 404, 410 ]) && $recurse) { + + // The resource has been deleted or doesn't exist at this location. + // Try to find another nomadic resource for this channel and return that. + + // First, see if there's a hubloc for this site. Fetch that record to + // obtain the nomadic identity hash. Then use that to find any additional + // nomadic locations. + + $h = Activity::get_actor_hublocs($resource, 'zot6'); + if ($h) { + // mark this location deleted + hubloc_delete($h[0]); + $hubs = Activity::get_actor_hublocs($h[0]['hubloc_hash']); + if ($hubs) { + foreach ($hubs as $hub) { + if ($hub['hubloc_id_url'] !== $resource and !$hub['hubloc_deleted']) { + return $self::exec($hub['hubloc_id_url'],$channel,$verify); + } + } + } + } + } + if($x['success']) { if ($verify) { $result['signature'] = HTTPSig::verify($x, EMPTY_STR, 'zot6'); diff --git a/include/hubloc.php b/include/hubloc.php index 2cce7a725..6401d1f0d 100644 --- a/include/hubloc.php +++ b/include/hubloc.php @@ -16,6 +16,8 @@ use Zotlabs\Daemon\Master; */ function hubloc_store_lowlevel($arr) { + $update = ((array_key_exists('hubloc_id',$arr) && $arr['hubloc_id']) ? 'hubloc_id = ' . intval($arr['hubloc_id']) : false); + $store = [ 'hubloc_guid' => ((array_key_exists('hubloc_guid',$arr)) ? $arr['hubloc_guid'] : ''), 'hubloc_guid_sig' => ((array_key_exists('hubloc_guid_sig',$arr)) ? $arr['hubloc_guid_sig'] : ''), @@ -40,7 +42,7 @@ function hubloc_store_lowlevel($arr) { 'hubloc_deleted' => ((array_key_exists('hubloc_deleted',$arr)) ? $arr['hubloc_deleted'] : 0) ]; - return create_table_from_array('hubloc', $store); + return (($update) ? update_table_from_array('hubloc', $store, $update) : create_table_from_array('hubloc', $store)); } function site_store_lowlevel($arr) { @@ -283,6 +285,13 @@ function hubloc_change_primary($hubloc) { return true; } +function hubloc_delete($hubloc) { + if (is_array($hubloc) && array_key_exists('hubloc_id', $hubloc)) { + q("UPDATE hubloc SET hubloc_deleted = 1 WHERE hubloc_id = %d", + intval($hubloc['hubloc_id']) + ); + } +} /** * @brief Mark a hubloc as down. diff --git a/include/text.php b/include/text.php index b76175a06..3b6039c31 100644 --- a/include/text.php +++ b/include/text.php @@ -3592,6 +3592,45 @@ function create_table_from_array($table, $arr, $binary_fields = []) { return $r; } + +function update_table_from_array($table, $arr, $where, $binary_fields = []) { + + if (! ($arr && $table)) { + return false; + } + + $columns = db_columns($table); + + $clean = []; + foreach ($arr as $k => $v) { + if (! in_array($k, $columns)) { + continue; + } + + $matches = false; + if (preg_match('/([^a-zA-Z0-9\-\_\.])/', $k, $matches)) { + return false; + } + if (in_array($k, $binary_fields)) { + $clean[$k] = dbescbin($v); + } else { + $clean[$k] = dbesc($v); + } + } + + $sql = "UPDATE " . TQUOT . $table . TQUOT . " SET "; + + foreach ($clean as $k => $v) { + $sql .= TQUOT . $k . TQUOT . ' = "' . $v . '",'; + } + + $sql = rtrim($sql,','); + + $r = dbq($sql . " WHERE " . $where); + + return $r; +} + function share_shield($m) { return str_replace($m[1],'!=+=+=!' . base64url_encode($m[1]) . '=+!=+!=',$m[0]); } -- cgit v1.2.3 From c8818cb7b33c94dd9fae2adf0d4fce2aee6a3611 Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 1 Feb 2022 10:30:26 +0000 Subject: formatting --- Zotlabs/Lib/Zotfinger.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Zotlabs/Lib/Zotfinger.php b/Zotlabs/Lib/Zotfinger.php index 58050609c..ab0b84944 100644 --- a/Zotlabs/Lib/Zotfinger.php +++ b/Zotlabs/Lib/Zotfinger.php @@ -55,8 +55,8 @@ class Zotfinger { $hubs = Activity::get_actor_hublocs($h[0]['hubloc_hash']); if ($hubs) { foreach ($hubs as $hub) { - if ($hub['hubloc_id_url'] !== $resource and !$hub['hubloc_deleted']) { - return $self::exec($hub['hubloc_id_url'],$channel,$verify); + if ($hub['hubloc_id_url'] !== $resource && !$hub['hubloc_deleted']) { + return $self::exec($hub['hubloc_id_url'], $channel, $verify); } } } -- cgit v1.2.3 From 31fbdcf6c5b7a92bcdb408df887175b80b4937fb Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 1 Feb 2022 10:32:54 +0000 Subject: typo --- Zotlabs/Lib/Zotfinger.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zotlabs/Lib/Zotfinger.php b/Zotlabs/Lib/Zotfinger.php index ab0b84944..fa57ab56d 100644 --- a/Zotlabs/Lib/Zotfinger.php +++ b/Zotlabs/Lib/Zotfinger.php @@ -56,7 +56,7 @@ class Zotfinger { if ($hubs) { foreach ($hubs as $hub) { if ($hub['hubloc_id_url'] !== $resource && !$hub['hubloc_deleted']) { - return $self::exec($hub['hubloc_id_url'], $channel, $verify); + return self::exec($hub['hubloc_id_url'], $channel, $verify); } } } -- cgit v1.2.3 From bacf19688f8bd795bed5c56197ea1273f8b27535 Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 2 Feb 2022 09:59:36 +0000 Subject: a like could be stored as item or activity so check both --- Zotlabs/Module/Dreport.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Zotlabs/Module/Dreport.php b/Zotlabs/Module/Dreport.php index 42f337b76..d6f4e5979 100644 --- a/Zotlabs/Module/Dreport.php +++ b/Zotlabs/Module/Dreport.php @@ -56,9 +56,10 @@ class Dreport extends \Zotlabs\Web\Controller { return; } - $r = q("select * from dreport where dreport_xchan = '%s' and dreport_mid = '%s'", + $r = q("select * from dreport where dreport_xchan = '%s' and (dreport_mid = '%s' or dreport_mid = '%s')", dbesc($channel['channel_hash']), - dbesc($mid) + dbesc($mid), + dbesc(str_replace('/item/', '/activity/', $mid)) ); if(! $r) { -- cgit v1.2.3 From 2a15d2c42154eabbd6feea946f6e932969473ff1 Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 2 Feb 2022 12:40:09 +0000 Subject: more PHP 8.1 deprecated warnings --- include/items.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/items.php b/include/items.php index 822e2d88b..e198ea54f 100644 --- a/include/items.php +++ b/include/items.php @@ -1625,9 +1625,9 @@ function item_store($arr, $allow_exec = false, $deliver = true) { return $ret; } - $arr['title'] = ((array_key_exists('title',$arr) && strlen($arr['title'])) ? trim($arr['title']) : ''); - $arr['summary'] = ((array_key_exists('summary',$arr) && strlen($arr['summary'])) ? trim($arr['summary']) : ''); - $arr['body'] = ((array_key_exists('body',$arr) && strlen($arr['body'])) ? trim($arr['body']) : ''); + $arr['title'] = ((array_key_exists('title',$arr) && $arr['title']) ? trim($arr['title']) : ''); + $arr['summary'] = ((array_key_exists('summary',$arr) && $arr['summary']) ? trim($arr['summary']) : ''); + $arr['body'] = ((array_key_exists('body',$arr) && $arr['body']) ? trim($arr['body']) : ''); $arr['allow_cid'] = ((x($arr,'allow_cid')) ? trim($arr['allow_cid']) : ''); $arr['allow_gid'] = ((x($arr,'allow_gid')) ? trim($arr['allow_gid']) : ''); -- cgit v1.2.3 From d8372f84339b29ef05f92d452ec196df32087f4a Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 2 Feb 2022 12:44:39 +0000 Subject: more PHP 8.1 deprecated warnings --- include/text.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/text.php b/include/text.php index 3b6039c31..2e5e728a0 100644 --- a/include/text.php +++ b/include/text.php @@ -417,6 +417,9 @@ function xmlify($str) { //$buffer = ''; + if (!$str) + return EMPTY_STR; + if(is_array($str)) { // allow to fall through so we ge a PHP error, as the log statement will @@ -482,6 +485,9 @@ function unxmlify($s) { return $ret; */ + if (!$s) + return EMPTY_STR; + if(is_array($s)) { // allow to fall through so we ge a PHP error, as the log statement will -- cgit v1.2.3 From 1740ae2104ff734edd45f6c0f1273d561cc4a69c Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 2 Feb 2022 17:58:29 +0000 Subject: more PHP 8.1 deprecated warnings --- Zotlabs/Lib/Libzot.php | 1 + include/contact_widgets.php | 4 ++++ include/conversation.php | 4 ++-- include/items.php | 4 ++-- include/text.php | 2 +- include/zid.php | 2 +- 6 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php index dbcc2af52..8f08e42d3 100644 --- a/Zotlabs/Lib/Libzot.php +++ b/Zotlabs/Lib/Libzot.php @@ -1927,6 +1927,7 @@ class Libzot { dbesc($a['signature']['signer']) ); + foreach ($items as $activity) { $AS = new ActivityStreams($activity); diff --git a/include/contact_widgets.php b/include/contact_widgets.php index 875a519a5..1ae8b17c5 100644 --- a/include/contact_widgets.php +++ b/include/contact_widgets.php @@ -100,6 +100,10 @@ function categories_widget($baseurl,$selected = '') { \Zotlabs\Daemon\Master::Summon([ 'Cache_query', $key, base64_encode(json_encode($arr)) ]); } + if (!$content) { + return EMPTY_STR; + } + $r = unserialize($content); $terms = []; diff --git a/include/conversation.php b/include/conversation.php index 17367856c..c0238b8ae 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -558,7 +558,7 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa $page_writeable = ($profile_owner == local_channel()); if (!$update) { - $tab = notags(trim($_GET['tab'])); + $tab = notags(trim((string)$_GET['tab'])); if ($tab === 'posts') { // This is ugly, but we can't pass the profile_uid through the session to the ajax updater, // because browser prefetching might change it on us. We have to deliver it with the page. @@ -974,7 +974,7 @@ function best_link_url($item) { } } if(! $best_url) { - if(strlen($item['author-link'])) + if($item['author-link']) $best_url = $item['author-link']; else $best_url = $item['url']; diff --git a/include/items.php b/include/items.php index e198ea54f..0b33d876d 100644 --- a/include/items.php +++ b/include/items.php @@ -1446,7 +1446,7 @@ function activity_sanitise($arr) { if(is_array($x)) $ret[$k] = activity_sanitise($x); else - $ret[$k] = htmlspecialchars($x, ENT_COMPAT, 'UTF-8', false); + $ret[$k] = htmlspecialchars((string)$x, ENT_COMPAT, 'UTF-8', false); } return $ret; } @@ -4438,7 +4438,7 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C ); } - if(strlen($arr['file'])) { + if($arr['file']) { $sql_extra .= term_query('item',$arr['files'],TERM_FILE); } diff --git a/include/text.php b/include/text.php index 2e5e728a0..29a2ab3b1 100644 --- a/include/text.php +++ b/include/text.php @@ -846,7 +846,7 @@ function activity_match($haystack,$needle) { if($needle) { foreach($needle as $n) { - if(($haystack === $n) || (strtolower(basename($n)) === strtolower(basename($haystack)))) { + if(($haystack === $n) || (strtolower(basename((string)$n)) === strtolower(basename((string)$haystack)))) { return true; } } diff --git a/include/zid.php b/include/zid.php index e462f8357..ae7d9e252 100644 --- a/include/zid.php +++ b/include/zid.php @@ -37,7 +37,7 @@ function is_matrix_url($url) { * @return string */ function zid($s, $address = '') { - if (! strlen($s) || strpos($s,'zid=')) + if (!$s || strpos($s,'zid=')) return $s; $m = parse_url($s); -- cgit v1.2.3 From 99928f1aeae088d1848e1fda870dcf07d91b9683 Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 2 Feb 2022 18:59:14 +0000 Subject: only unset if set --- Zotlabs/Lib/Activity.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index df994cd79..8d3702d10 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -2650,7 +2650,7 @@ class Activity { $raw_arr = json_decode($act->raw, true); - // This is a zot6 packet and the raw activitypub message json + // This is a zot6 packet and the raw activitypub or diaspora message json // is possibly available in the attachement. if (array_key_exists('signed', $raw_arr) && is_array($act->data['attachment'])) { foreach($act->data['attachment'] as $a) { @@ -2692,9 +2692,14 @@ class Activity { if (!$ap_rawmsg && array_key_exists('signed', $raw_arr)) { //zap - unset($act->data['signer']); - unset($act->data['signed_data']); - unset($act->data['hubloc']); + if (isset($act->data['signer'])) + unset($act->data['signer']); + + if (isset($act->data['signed_data'])) + unset($act->data['signed_data']); + + if (isset($act->data['hubloc'])) + unset($act->data['hubloc']); $ap_rawmsg = json_encode($act->data, JSON_UNESCAPED_SLASHES); } -- cgit v1.2.3 From 99dcdee67ab3521bd3e5e58ba4a85182b7a44890 Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 3 Feb 2022 11:57:47 +0000 Subject: move JSalmon stuff from the data to the meta field in Lib ActivityStreams and some more refinement on storing the raw ap and diaspora data in iconfig --- Zotlabs/Lib/Activity.php | 25 ++++++++++++------------- Zotlabs/Lib/ActivityStreams.php | 14 +++++++------- Zotlabs/Lib/Libzot.php | 11 +++++------ 3 files changed, 24 insertions(+), 26 deletions(-) diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index 8d3702d10..159f2a46f 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -2672,35 +2672,34 @@ class Activity { } // old style: can be removed after most hubs are on 7.0.2 - if (!$ap_rawmsg && array_key_exists('signed', $raw_arr) && is_array($act->obj) && is_array($act->obj['attachment'])) { + elseif (array_key_exists('signed', $raw_arr) && is_array($act->obj) && is_array($act->obj['attachment'])) { foreach($act->obj['attachment'] as $a) { if ( - isset($a['type']) && $a['type'] === 'propertyvalue' && + isset($a['type']) && $a['type'] === 'PropertyValue' && isset($a['name']) && $a['name'] === 'zot.activitypub.rawmsg' && isset($a['value']) ) { $ap_rawmsg = $a['value']; - break; + } + + if ( + isset($a['type']) && $a['type'] === 'PropertyValue' && + isset($a['name']) && $a['name'] === 'zot.diaspora.fields' && + isset($a['value']) + ) { + $diaspora_rawmsg = $a['value']; } } } + // catch the likes if (!$ap_rawmsg && $response_activity) { $ap_rawmsg = json_encode($act->data, JSON_UNESCAPED_SLASHES); } // end old style if (!$ap_rawmsg && array_key_exists('signed', $raw_arr)) { - //zap - if (isset($act->data['signer'])) - unset($act->data['signer']); - - if (isset($act->data['signed_data'])) - unset($act->data['signed_data']); - - if (isset($act->data['hubloc'])) - unset($act->data['hubloc']); - + // zap $ap_rawmsg = json_encode($act->data, JSON_UNESCAPED_SLASHES); } diff --git a/Zotlabs/Lib/ActivityStreams.php b/Zotlabs/Lib/ActivityStreams.php index ffb034bf4..b86203a34 100644 --- a/Zotlabs/Lib/ActivityStreams.php +++ b/Zotlabs/Lib/ActivityStreams.php @@ -11,6 +11,7 @@ class ActivityStreams { public $raw = null; public $data = null; + public $meta = null; public $valid = false; public $deleted = false; public $id = ''; @@ -56,15 +57,14 @@ class ActivityStreams { if (is_array($this->data) && array_key_exists('signed', $this->data)) { $ret = JSalmon::verify($this->data); $tmp = JSalmon::unpack($this->data['data']); - if ($ret && $ret['success']) { if ($ret['signer']) { $saved = json_encode($this->data, JSON_UNESCAPED_SLASHES); $this->data = $tmp; - $this->data['signer'] = $ret['signer']; - $this->data['signed_data'] = $saved; + $this->meta['signer'] = $ret['signer']; + $this->meta['signed_data'] = $saved; if ($ret['hubloc']) { - $this->data['hubloc'] = $ret['hubloc']; + $this->meta['hubloc'] = $ret['hubloc']; } } } @@ -348,10 +348,10 @@ class ActivityStreams { if ($ret['signer']) { $saved = json_encode($x, JSON_UNESCAPED_SLASHES); $x = $tmp; - $x['signer'] = $ret['signer']; - $x['signed_data'] = $saved; + $x['meta']['signer'] = $ret['signer']; + $x['meta']['signed_data'] = $saved; if ($ret['hubloc']) { - $x['hubloc'] = $ret['hubloc']; + $x['meta']['hubloc'] = $ret['hubloc']; } } } diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php index 8f08e42d3..e78cb4568 100644 --- a/Zotlabs/Lib/Libzot.php +++ b/Zotlabs/Lib/Libzot.php @@ -1296,9 +1296,8 @@ class Libzot { } } } - - if ($AS->data['signed_data']) { - IConfig::Set($arr, 'activitypub', 'signed_data', $AS->data['signed_data'], false); + if ($AS->meta['signed_data']) { + IConfig::Set($arr, 'activitypub', 'signed_data', $AS->meta['signed_data'], false); } logger('Activity received: ' . print_r($arr, true), LOGGER_DATA, LOG_DEBUG); @@ -1989,9 +1988,9 @@ class Libzot { $arr['item_verified'] = true; } - if ($AS->data['signed_data']) { - IConfig::Set($arr, 'activitypub', 'signed_data', $AS->data['signed_data'], false); - $j = json_decode($AS->data['signed_data'], true); + if ($AS->meta['signed_data']) { + IConfig::Set($arr, 'activitypub', 'signed_data', $AS->meta['signed_data'], false); + $j = json_decode($AS->meta['signed_data'], true); if ($j) { IConfig::Set($arr, 'activitypub', 'rawmsg', json_encode(JSalmon::unpack($j['data'])), true); } -- cgit v1.2.3 From 25424c16e41dc4773a7464129cac7a9acd4667dc Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 3 Feb 2022 19:09:15 +0000 Subject: unpack encoded mid and make sure to goaway to the right message --- Zotlabs/Module/Search.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Zotlabs/Module/Search.php b/Zotlabs/Module/Search.php index 5db0ce423..1df45233c 100644 --- a/Zotlabs/Module/Search.php +++ b/Zotlabs/Module/Search.php @@ -58,10 +58,22 @@ class Search extends Controller { $o .= search($search, 'search-box', '/search', ((local_channel()) ? true : false)); if (local_channel() && strpos($search, 'https://') === 0 && !$update && !$load) { + if (strpos($search, 'b64.') !== false) { + $search = unpack_link_id(basename($search)); + } + $f = Libzot::fetch_conversation(App::get_channel(), punify($search), true); if ($f) { - goaway(z_root() . '/hq/' . gen_link_id($f['message_id'])); + $mid = $f[0]['message_id']; + foreach ($f as $m) { + if (strpos($search, $m['message_id']) === 0) { + $mid = $m['message_id']; + break; + } + } + + goaway(z_root() . '/hq/' . gen_link_id($mid)); } else { // try other fetch providers (e.g. diaspora, pubcrawl) -- cgit v1.2.3 From cb6055c1b83ba7811c452334d64c3981cca1a326 Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 4 Feb 2022 12:48:47 +0000 Subject: clean the url from parameters --- Zotlabs/Module/Search.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Zotlabs/Module/Search.php b/Zotlabs/Module/Search.php index 1df45233c..6f8fbdfbf 100644 --- a/Zotlabs/Module/Search.php +++ b/Zotlabs/Module/Search.php @@ -7,6 +7,7 @@ use Zotlabs\Lib\Libzot; use Zotlabs\Lib\Activity; use Zotlabs\Lib\ActivityStreams; use Zotlabs\Web\Controller; +use Zotlabs\Lib\Zotfinger; class Search extends Controller { @@ -59,6 +60,10 @@ class Search extends Controller { if (local_channel() && strpos($search, 'https://') === 0 && !$update && !$load) { if (strpos($search, 'b64.') !== false) { + if (strpos($search, '?') !== false) { + $search = strtok($search, '?'); + } + $search = unpack_link_id(basename($search)); } -- cgit v1.2.3 From a0e8e40f1c9b60afd901091df792cafcc943a0a4 Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 4 Feb 2022 12:50:25 +0000 Subject: whitespace --- Zotlabs/Module/Search.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Zotlabs/Module/Search.php b/Zotlabs/Module/Search.php index 6f8fbdfbf..fdc251b07 100644 --- a/Zotlabs/Module/Search.php +++ b/Zotlabs/Module/Search.php @@ -60,9 +60,9 @@ class Search extends Controller { if (local_channel() && strpos($search, 'https://') === 0 && !$update && !$load) { if (strpos($search, 'b64.') !== false) { - if (strpos($search, '?') !== false) { + if (strpos($search, '?') !== false) { $search = strtok($search, '?'); - } + } $search = unpack_link_id(basename($search)); } -- cgit v1.2.3 From f50b395da6bdd814ab66c62031d2f60bfdd89dab Mon Sep 17 00:00:00 2001 From: Dan d'Auge Date: Sun, 6 Feb 2022 06:41:23 +0000 Subject: Update register_verify_eml.tpl --- view/fr/register_verify_eml.tpl | 44 +++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/view/fr/register_verify_eml.tpl b/view/fr/register_verify_eml.tpl index 9d2be027c..6510515fe 100644 --- a/view/fr/register_verify_eml.tpl +++ b/view/fr/register_verify_eml.tpl @@ -1,24 +1,20 @@ - -Une demande d'enregistrement pour un nouvel utilisateur a été reçue par {{$sitename}} qui requiert -votre accord. - - -Voici les détails de connexion: - -Emplacement du site:⇥{{$siteurl}} -Utilisateur:⇥{{$email}} -Adresse IP: {{$details}} - -Pour confirmer votre accord, veuillez suivre le lien suivant: - - -{{$siteurl}}/regmod/allow/{{$hash}} - - -Pour supprimer ce compte, veuillez visiter: - - -{{$siteurl}}/regmod/deny/{{$hash}} - - -Merci. +Une demande d'enregistrement pour un nouvel utilisateur a été reçue par {{$sitename}} qui requiert +votre accord. + + +Voici les détails de connexion : + +Emplacement du site: {{$siteurl}} +Utilisateur : {{$email}} +Adresse IP : {{$details}} + +Pour confirmer votre demande, veuillez cliquer sur le lien suivant: + +{{$siteurl}}/regmod/allow/{{$hash}} + +Pour supprimer ce compte, veuillez visiter: + +{{$siteurl}}/regmod/deny/{{$hash}} + + +Merci. -- cgit v1.2.3 From bc13b7eb725e9975944f95237ac15fb6b8373bd1 Mon Sep 17 00:00:00 2001 From: Dan d'Auge Date: Sun, 6 Feb 2022 07:42:00 +0000 Subject: Update register_verify_member.tpl --- view/fr/register_verify_member.tpl | 53 +++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/view/fr/register_verify_member.tpl b/view/fr/register_verify_member.tpl index 3461c56a0..9d18ce204 100644 --- a/view/fr/register_verify_member.tpl +++ b/view/fr/register_verify_member.tpl @@ -1,24 +1,29 @@ - -Merci de vous être enregistré sur {{$sitename}}. - -Voici les détails de connexion: - -Emplacement du site:⇥{{$siteurl}} -Utilisateur:⇥{{$email}} - -Connectez-vous avec le mot de passe que vous avez choisi au moment de l'enregistrement. - -Nous avons besoin de vérifier votre adresse de courriel avant d’autoriser votre accès au réseau. - -Si vous avez enregistré ce compte, suivre ce lien: - -{{$siteurl}}/regver/allow/{{$hash}} - - -Pour supprimer ce compte, veuillez visiter: - - -{{$siteurl}}/regver/deny/{{$hash}} - - -Merci. +Merci de vous être enregistré sur {{$sitename}}. + +Voici les détails de connexion : + +Adresse du site: {{$siteurl}} +Utilisateur: {{$email}} + +Connectez-vous avec le mot de passe que vous avez choisi au moment de l'enregistrement. + +Nous devons vérifier votre adresse électronique afin de vous donner un accès complet au réseau. + +Votre code de vérification est : + +{{$hash}} + +{{if $timeframe}} +Ce code est valable de {{$timeframe.0}} UTC jusqu'à {{$timeframe.1}} + +{{/if}} + +Si vous avez enregistré ce compte, veuillez entrer le code de vérification lorsque cela vous est demandé ou cliquez sur le lien suivant : + + +{{$siteurl}}/regate/{{$mail}} + +Pour refuser la demande et supprimer le compte, merci de vous rendre à cette adresse : +{{$siteurl}}/regate/{{$mail}}{{if $ko}}/{{$ko}}{{/if}} + +Merci. -- cgit v1.2.3 From e113f6cb9dd68c3c80492f0e86e8f0e01532a975 Mon Sep 17 00:00:00 2001 From: Dan d'Auge Date: Sun, 6 Feb 2022 07:52:38 +0000 Subject: Update register_open_eml.tpl --- view/fr/register_open_eml.tpl | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/view/fr/register_open_eml.tpl b/view/fr/register_open_eml.tpl index 46390bc9d..3656ab3bf 100644 --- a/view/fr/register_open_eml.tpl +++ b/view/fr/register_open_eml.tpl @@ -1,18 +1,14 @@ - -Un compte a été créé sur {{$sitename}} avec cette adresse de courriel. -Voici les détails de connexion: - -Emplacement du site:⇥{{$siteurl}} -Utilisateur:⇥{{$email}} -Mot de passe: (le mot de passe qui a été spécifié lors de l'enregistrement) - -Si ce compte a été créé sans votre accord, vous pouvez visiter ce site et réinitialiser le mot de passe. -Ceci vous permettra de supprimer le compte à partir de la page des réglages du profil. -Veuillez accepter nos excuses pour tous les désagréments engendrés. - -Merci et bienvenue sur {{$sitename}}. - -Sincèrement, - L'administrateur {{$sitename}} - - \ No newline at end of file +Un compte a été créé sur {{$sitename}} avec cette adresse de courriel. +Voici les détails de connexion: + +Adresse du site: {{$siteurl}} +Utilisateur: {{$email}} +Mot de passe: (le mot de passe qui a été spécifié lors de l'enregistrement) + +Si ce compte a été créé à votre insu et que vous n'en voulez pas, vous pouvez vous rendre sur ce site et réinitialiser le mot de passe. Cela vous permettra de supprimer le compte à partir des Paramètres / Paramètres du compte. Nous vous prions de nous excuser pour ce désagrément. + +Merci et bienvenue sur {{$sitename}}. + +L'administrateur {{$sitename}} + + -- cgit v1.2.3 From b04aa799e3890ae08590631b22b55c4c9e35bb93 Mon Sep 17 00:00:00 2001 From: Dan d'Auge Date: Sun, 6 Feb 2022 08:54:09 +0000 Subject: Upload New File : cert_bad_eml.tpl fr --- view/fr/cert_bad_eml.tpl | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 view/fr/cert_bad_eml.tpl diff --git a/view/fr/cert_bad_eml.tpl b/view/fr/cert_bad_eml.tpl new file mode 100644 index 000000000..c99c515ac --- /dev/null +++ b/view/fr/cert_bad_eml.tpl @@ -0,0 +1,9 @@ +Il s'agit du serveur web de {{$sitename}} ; + +Une vérification de routine indique que le certificat SSL de ce site web n'est pas valide. + +Votre site web ne peut pas fonctionner correctement avec Hubzilla tant que ce problème n'est pas résolu. Veuillez vérifier votre certificat et avec votre fournisseur de certificat ou votre fournisseur de service pour vous assurer qu'il est "valide pour le navigateur" et installé correctement. Les certificats auto-signés ne sont PAS SUPPORTÉS et NE SONT PAS AUTORISÉS dans Hubzilla. La vérification est effectuée en récupérant une URL de votre site web avec une vérification SSL stricte activée, et si cela échoue, une nouvelle vérification est effectuée avec des vérifications SSL désactivées. Il est possible qu'une erreur transitoire produise ce message, mais si des changements récents de configuration ont été effectués, ou si vous recevez ce message plus d'une fois, veuillez vérifier votre certificat. Le message d'erreur est "{{$error}}". + +Veuillez nous excuser pour ce désagrément, + +Votre serveur web à {{$siteurl}} -- cgit v1.2.3 From d702334604332c02cccdb379f3b2bb00b9bfa921 Mon Sep 17 00:00:00 2001 From: Dan d'Auge Date: Sun, 6 Feb 2022 09:03:40 +0000 Subject: Upload New File --- view/fr/cron_bad_eml.tpl | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 view/fr/cron_bad_eml.tpl diff --git a/view/fr/cron_bad_eml.tpl b/view/fr/cron_bad_eml.tpl new file mode 100644 index 000000000..64b5f9087 --- /dev/null +++ b/view/fr/cron_bad_eml.tpl @@ -0,0 +1,13 @@ +Ceci est le serveur web de {{$sitename}} ; + +Une vérification de routine indique que les tâches de maintenance programmées sur ce site ne sont pas exécutées. + +Veuillez vérifier vos tâches "cron" ou le mécanisme équivalent sur votre serveur et assurez-vous qu'elles sont exécutées. Consultez les instructions d'installation si vous voyez ce message pour la première fois. Si ces tâches de maintenance se sont déroulées normalement jusqu'à présent, vérifiez que rien ne s'est produit pour expliquer leur arrêt. Cette vérification est effectuée tous les trois jours environ. + +Le message d'erreur est "{{$error}}". + +La dernière exécution réussie remonte à "{{$lastdate}}". + +Veuillez nous excuser pour ce désagrément, + +votre serveur web à {{$siteurl}} -- cgit v1.2.3 From 58827e130baf21e8da4777e15cd2a61310ff56fd Mon Sep 17 00:00:00 2001 From: Dan d'Auge Date: Sun, 6 Feb 2022 10:08:07 +0000 Subject: Upload New File : invite.casual.subject.tpl fr --- view/fr/invite.casual.subject.tpl | 1 + 1 file changed, 1 insertion(+) create mode 100644 view/fr/invite.casual.subject.tpl diff --git a/view/fr/invite.casual.subject.tpl b/view/fr/invite.casual.subject.tpl new file mode 100644 index 000000000..b6f05bb7e --- /dev/null +++ b/view/fr/invite.casual.subject.tpl @@ -0,0 +1 @@ +Rejoignez-nous sur {{$projectname}} {{$invite_loc}} -- cgit v1.2.3 From f588d8379bdd37ac839fe5e638da38c9186dec09 Mon Sep 17 00:00:00 2001 From: Dan d'Auge Date: Sun, 6 Feb 2022 10:20:05 +0000 Subject: Upload New File : invite.casual.tpl fr --- view/fr/invite.casual.tpl | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 view/fr/invite.casual.tpl diff --git a/view/fr/invite.casual.tpl b/view/fr/invite.casual.tpl new file mode 100644 index 000000000..5be968514 --- /dev/null +++ b/view/fr/invite.casual.tpl @@ -0,0 +1,18 @@ +{{* tpl FR, pour inviter les personnes qui me connaissant}} + +Rejoingnez moi sur {{$projectname}}. +{{$linktxt}} {{$invite_where}} + +Vous devrez fournir ce code d'invitation : +{{$invite_code}} + +Ou bien : + +1) Enregistrez-vous à n'importe quel endroit de {{$projectname}} (ils sont tous interconnectés). +2) Saisissez mon adresse de réseau {{$projectname}} dans la barre de recherche du site. + +{{$invite_whereami}} + +ou visitez {{$invite_whoami}}. + +3) Cliquez sur [Connecter]. -- cgit v1.2.3 From 47f6b202e500402d09d74e78637f27572ecd6fe6 Mon Sep 17 00:00:00 2001 From: Dan d'Auge Date: Sun, 6 Feb 2022 14:30:26 +0000 Subject: Upload New File : invite.formal.subject.tpl fr --- view/fr/invite.formal.subject.tpl | 1 + 1 file changed, 1 insertion(+) create mode 100644 view/fr/invite.formal.subject.tpl diff --git a/view/fr/invite.formal.subject.tpl b/view/fr/invite.formal.subject.tpl new file mode 100644 index 000000000..0fcab5ee7 --- /dev/null +++ b/view/fr/invite.formal.subject.tpl @@ -0,0 +1 @@ +Invitation pour votre accès au réseau {{$invite_loc}} -- cgit v1.2.3 From 7b084a065ef2cec896b4f30c160fd96a6b19f661 Mon Sep 17 00:00:00 2001 From: Dan d'Auge Date: Sun, 6 Feb 2022 14:46:09 +0000 Subject: Upload New File : invite.formal.tpl fr --- view/fr/invite.formal.tpl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 view/fr/invite.formal.tpl diff --git a/view/fr/invite.formal.tpl b/view/fr/invite.formal.tpl new file mode 100644 index 000000000..404059af6 --- /dev/null +++ b/view/fr/invite.formal.tpl @@ -0,0 +1,19 @@ +{{* tpl FR formel, pour inviter de manière plus polie des personnes comme des membres d'entreprise ou des partenaires professionnels *}}. + +Veuillez rejoindre le réseau social {{$nom du projet}}. Ce message contient les données essentielles pour la première connexion. + +Le site est à rejoindre se trouve ici : +{{$invite_whereami}} + +Votre accès est juste préparé avec un code d'invitation : +{{$invite_code}} + +que vous devrez saisir dans le champ du formulaire d'inscription, qui s'affiche lorsque vous cliquez sur le lien "J'ai un code d'invitation". Veuillez également saisir votre adresse e-mail dans le champ suivant. Nous tenons à vous informer que le code d'invitation est lié à votre adresse électronique et n'est pas transférable. + +Pour des raisons de sécurité, vous devez fournir un mot de passe de compte qui n'est et ne doit rester connu que de vous. Le mot de passe non visible doit être tapé deux fois pour éviter toute erreur de frappe. Le mot de passe est toujours demandé ultérieurement lorsque vous voulez vous connecter au site. + +Selon la configuration du site, vous pouvez recevoir un autre courriel à votre adresse avec un code de validation, à saisir dans le formulaire vers lequel ce courriel vous dirigera. Ce genre de mesure contribue à renforcer la sécurité du site. + +Selon la configuration du site, un administrateur devra valider votre accès. Merci de patienter car cela ne se fera pas instantanément. + +Cordialement. -- cgit v1.2.3 From a8d87af41844c8598a9ef58a8f900831d1f7ea03 Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 8 Feb 2022 14:09:54 +0000 Subject: to reduce overall network fetches cache actors in Activity::fetch() and fetch the ldsig creator with get_actor() instead of get_compound_property() so that it will check the cache before actually fetching --- Zotlabs/Lib/Activity.php | 12 ++++++++++-- Zotlabs/Lib/ActivityStreams.php | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index 159f2a46f..e51922c86 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -116,6 +116,11 @@ class Activity { $y = json_decode($x['body'], true); logger('returned: ' . json_encode($y, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), LOGGER_DEBUG); + + if (ActivityStreams::is_an_actor($y['type'])) { + XConfig::Set($y['id'], 'system', 'actor_record', $y); + } + return json_decode($x['body'], true); } else { @@ -3709,7 +3714,10 @@ class Activity { } static function get_cached_actor($id) { - $actor = XConfig::Get($id, 'system', 'actor_record'); + + // remove any fragments like #main-key since these won't be present in our cached data + $cache_url = ((strpos($id, '#')) ? substr($id, 0, strpos($id, '#')) : $id); + $actor = XConfig::Get($cache_url, 'system', 'actor_record'); if ($actor) { return $actor; @@ -3718,7 +3726,7 @@ class Activity { // try other get_cached_actor providers (e.g. diaspora) $hookdata = [ 'id' => $id, - 'actor' => false + 'actor' => null ]; call_hooks('get_cached_actor_provider', $hookdata); diff --git a/Zotlabs/Lib/ActivityStreams.php b/Zotlabs/Lib/ActivityStreams.php index b86203a34..275f6eff4 100644 --- a/Zotlabs/Lib/ActivityStreams.php +++ b/Zotlabs/Lib/ActivityStreams.php @@ -92,7 +92,7 @@ class ActivityStreams { $this->ldsig = $this->get_compound_property('signature'); if ($this->ldsig) { - $this->signer = $this->get_compound_property('creator', $this->ldsig); + $this->signer = $this->get_actor('creator', $this->ldsig); if ($this->signer && is_array($this->signer) && array_key_exists('publicKey', $this->signer) && is_array($this->signer['publicKey']) && $this->signer['publicKey']['publicKeyPem']) { $this->sigok = LDSignatures::verify($this->data, $this->signer['publicKey']['publicKeyPem']); } -- cgit v1.2.3 From 21c4ec2de0f26341c3dcfda2c03f2db6be2795bf Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Tue, 8 Feb 2022 15:14:16 +0100 Subject: fix php error in externals and streamline actor cache time --- Zotlabs/Daemon/Externals.php | 4 +++- Zotlabs/Lib/Libzot.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Zotlabs/Daemon/Externals.php b/Zotlabs/Daemon/Externals.php index 81414d02d..fb35a65c7 100644 --- a/Zotlabs/Daemon/Externals.php +++ b/Zotlabs/Daemon/Externals.php @@ -133,7 +133,9 @@ class Externals { continue; } - Libzot::fetch_conversation($importer, $message['object']['id']); + $obj_id = isset($message['object']['id']) ?? $message['object']; + + Libzot::fetch_conversation($importer, $obj_id); $total++; continue; } diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php index e78cb4568..e4d8d2275 100644 --- a/Zotlabs/Lib/Libzot.php +++ b/Zotlabs/Lib/Libzot.php @@ -3172,7 +3172,7 @@ class Libzot { } static function update_cached_hubloc($hubloc) { - if ($hubloc['hubloc_updated'] > datetime_convert('UTC','UTC','now - 1 week') || $hubloc['hubloc_url'] === z_root()) { + if ($hubloc['hubloc_updated'] > datetime_convert('UTC','UTC','now - 3 days') || $hubloc['hubloc_url'] === z_root()) { return; } self::refresh( [ 'hubloc_id_url' => $hubloc['hubloc_id_url'] ] ); -- cgit v1.2.3 From ffa5e088325a8ddef0941efee58a8be739ffb538 Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 8 Feb 2022 15:15:03 +0000 Subject: =?UTF-8?q?version=C3=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boot.php b/boot.php index 513e94363..5da93beae 100644 --- a/boot.php +++ b/boot.php @@ -60,7 +60,7 @@ require_once('include/bbcode.php'); require_once('include/items.php'); define('PLATFORM_NAME', 'hubzilla'); -define('STD_VERSION', '7.1.1'); +define('STD_VERSION', '7.1.2'); define('ZOT_REVISION', '6.0'); define('DB_UPDATE_VERSION', 1252); -- cgit v1.2.3 From c0dd4d748db3e07d49ae72e2e37d0cc5c74011c4 Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 8 Feb 2022 19:51:10 +0000 Subject: HTTPSig: introduce the deleted keytype. this will allow us to not fetch an actor we have never seen before if we received a delete activity for this actor for some reason. this is only implemented in the activitypub inbox so far. --- Zotlabs/Web/HTTPSig.php | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/Zotlabs/Web/HTTPSig.php b/Zotlabs/Web/HTTPSig.php index 7da9acabf..e5d73293a 100644 --- a/Zotlabs/Web/HTTPSig.php +++ b/Zotlabs/Web/HTTPSig.php @@ -156,6 +156,7 @@ class HTTPSig { $cached_key = self::get_key($key, $keytype, $result['signer']); + if (!($cached_key && $cached_key['public_key'])) { return $result; } @@ -229,21 +230,26 @@ class HTTPSig { return ['public_key' => $key]; } + $deleted = false; + if ($keytype === 'deleted') { + $deleted = true; + } + if ($keytype === 'zot6') { - $key = self::get_zotfinger_key($id, $force); + $key = self::get_zotfinger_key($id, $force, $deleted); if ($key) { return $key; } } if (strpos($id, '#') === false) { - $key = self::get_webfinger_key($id, $force); + $key = self::get_webfinger_key($id, $force, $deleted); if ($key) { return $key; } } - $key = self::get_activitystreams_key($id, $force); + $key = self::get_activitystreams_key($id, $force, $deleted); return $key; @@ -274,7 +280,7 @@ class HTTPSig { * false if no pub key found, otherwise return an array with the pub key */ - static function get_activitystreams_key($id, $force = false) { + static function get_activitystreams_key($id, $force = false, $deleted = false) { // Check the local cache first, but remove any fragments like #main-key since these won't be present in our cached data $url = ((strpos($id, '#')) ? substr($id, 0, strpos($id, '#')) : $id); @@ -294,6 +300,12 @@ class HTTPSig { } } + if ($deleted) { + // If we received a delete and we do not have the record cached, + // we probably never saw this actor. Do not try to fetch it now. + return false; + } + // The record wasn't in cache. Fetch it now. $r = ActivityStreams::fetch($id); @@ -319,7 +331,7 @@ class HTTPSig { * false if no pub key found, otherwise return an array with the pub key */ - static function get_webfinger_key($id, $force = false) { + static function get_webfinger_key($id, $force = false, $deleted = false) { if (!$force) { $x = q("select * from xchan left join hubloc on xchan_hash = hubloc_hash where hubloc_id_url = '%s' and hubloc_network in ('zot6', 'activitypub') order by hubloc_id desc", @@ -335,6 +347,12 @@ class HTTPSig { } } + if ($deleted) { + // If we received a delete and we do not have the record cached, + // we probably never saw this actor. Do not try to fetch it now. + return false; + } + $wf = Webfinger::exec($id); $key = ['portable_id' => '', 'public_key' => '', 'hubloc' => []]; @@ -366,7 +384,7 @@ class HTTPSig { * false if no pub key found, otherwise return an array with the public key */ - static function get_zotfinger_key($id, $force = false) { + static function get_zotfinger_key($id, $force = false, $deleted = false) { if (!$force) { $x = q("select * from xchan left join hubloc on xchan_hash = hubloc_hash where hubloc_id_url = '%s' and hubloc_network = 'zot6' order by hubloc_id desc", dbesc($id) @@ -381,6 +399,12 @@ class HTTPSig { } } + if ($deleted) { + // If we received a delete and we do not have the record cached, + // we probably never saw this actor. Do not try to fetch it now. + return false; + } + $wf = Webfinger::exec($id); $key = ['portable_id' => '', 'public_key' => '', 'hubloc' => []]; -- cgit v1.2.3 From 4c8b84633a55f06cf3f43866f9f76a330ac9af76 Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 8 Feb 2022 20:12:16 +0000 Subject: revert deleted flag for webfinger and zotfinger key --- Zotlabs/Lib/Activity.php | 2 ++ Zotlabs/Web/HTTPSig.php | 30 +++++++++--------------------- 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index e51922c86..9f08c87b5 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -61,6 +61,8 @@ class Activity { } logger('fetch: ' . $url, LOGGER_DEBUG); + hz_syslog('fetch: ' . $url, LOGGER_DEBUG); + bt_syslog('fetch'); if (strpos($url, 'x-zot:') === 0) { $x = ZotURL::fetch($url, $channel); diff --git a/Zotlabs/Web/HTTPSig.php b/Zotlabs/Web/HTTPSig.php index e5d73293a..ef191b171 100644 --- a/Zotlabs/Web/HTTPSig.php +++ b/Zotlabs/Web/HTTPSig.php @@ -230,25 +230,25 @@ class HTTPSig { return ['public_key' => $key]; } - $deleted = false; - if ($keytype === 'deleted') { - $deleted = true; - } - if ($keytype === 'zot6') { - $key = self::get_zotfinger_key($id, $force, $deleted); + $key = self::get_zotfinger_key($id, $force); if ($key) { return $key; } } if (strpos($id, '#') === false) { - $key = self::get_webfinger_key($id, $force, $deleted); + $key = self::get_webfinger_key($id, $force); if ($key) { return $key; } } + $deleted = false; + if ($keytype === 'deleted') { + $deleted = true; + } + $key = self::get_activitystreams_key($id, $force, $deleted); return $key; @@ -331,7 +331,7 @@ class HTTPSig { * false if no pub key found, otherwise return an array with the pub key */ - static function get_webfinger_key($id, $force = false, $deleted = false) { + static function get_webfinger_key($id, $force = false) { if (!$force) { $x = q("select * from xchan left join hubloc on xchan_hash = hubloc_hash where hubloc_id_url = '%s' and hubloc_network in ('zot6', 'activitypub') order by hubloc_id desc", @@ -347,12 +347,6 @@ class HTTPSig { } } - if ($deleted) { - // If we received a delete and we do not have the record cached, - // we probably never saw this actor. Do not try to fetch it now. - return false; - } - $wf = Webfinger::exec($id); $key = ['portable_id' => '', 'public_key' => '', 'hubloc' => []]; @@ -384,7 +378,7 @@ class HTTPSig { * false if no pub key found, otherwise return an array with the public key */ - static function get_zotfinger_key($id, $force = false, $deleted = false) { + static function get_zotfinger_key($id, $force = false) { if (!$force) { $x = q("select * from xchan left join hubloc on xchan_hash = hubloc_hash where hubloc_id_url = '%s' and hubloc_network = 'zot6' order by hubloc_id desc", dbesc($id) @@ -399,12 +393,6 @@ class HTTPSig { } } - if ($deleted) { - // If we received a delete and we do not have the record cached, - // we probably never saw this actor. Do not try to fetch it now. - return false; - } - $wf = Webfinger::exec($id); $key = ['portable_id' => '', 'public_key' => '', 'hubloc' => []]; -- cgit v1.2.3 From 85ad5355cf3d497287b60a8d902778cdb88ebeef Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 8 Feb 2022 20:13:19 +0000 Subject: revert logging --- Zotlabs/Lib/Activity.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index 9f08c87b5..e51922c86 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -61,8 +61,6 @@ class Activity { } logger('fetch: ' . $url, LOGGER_DEBUG); - hz_syslog('fetch: ' . $url, LOGGER_DEBUG); - bt_syslog('fetch'); if (strpos($url, 'x-zot:') === 0) { $x = ZotURL::fetch($url, $channel); -- cgit v1.2.3 From 5d0346ee30c01cc4508ed05e3cf529a6f79b6d81 Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 8 Feb 2022 20:44:30 +0000 Subject: rename variable --- Zotlabs/Web/HTTPSig.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Zotlabs/Web/HTTPSig.php b/Zotlabs/Web/HTTPSig.php index ef191b171..a7a59b8cf 100644 --- a/Zotlabs/Web/HTTPSig.php +++ b/Zotlabs/Web/HTTPSig.php @@ -244,12 +244,12 @@ class HTTPSig { } } - $deleted = false; - if ($keytype === 'deleted') { - $deleted = true; + $delete = false; + if ($keytype === 'delete') { + $delete = true; } - $key = self::get_activitystreams_key($id, $force, $deleted); + $key = self::get_activitystreams_key($id, $force, $delete); return $key; @@ -280,7 +280,7 @@ class HTTPSig { * false if no pub key found, otherwise return an array with the pub key */ - static function get_activitystreams_key($id, $force = false, $deleted = false) { + static function get_activitystreams_key($id, $force = false, $delete = false) { // Check the local cache first, but remove any fragments like #main-key since these won't be present in our cached data $url = ((strpos($id, '#')) ? substr($id, 0, strpos($id, '#')) : $id); @@ -300,7 +300,7 @@ class HTTPSig { } } - if ($deleted) { + if ($delete) { // If we received a delete and we do not have the record cached, // we probably never saw this actor. Do not try to fetch it now. return false; -- cgit v1.2.3 From daee5b34775ed601e1a06b989ffe929ec8f4c5a9 Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 9 Feb 2022 08:45:19 +0000 Subject: since we do not use feedutils for ostatus anymore, we can now safely use import_author_rss() instead of import_author_unknown() --- include/feedutils.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/feedutils.php b/include/feedutils.php index d31836983..1c653325d 100644 --- a/include/feedutils.php +++ b/include/feedutils.php @@ -1180,7 +1180,7 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) { else { $name = $author['author_name']; } - $x = import_author_unknown(array('name' => $name,'url' => $author['author_link'],'photo' => array('src' => $author['author_photo']))); + $x = import_author_rss(array('name' => $name,'url' => $author['author_link'],'photo' => array('src' => $author['author_photo']))); if($x) $datarray['author_xchan'] = $x; } @@ -1440,7 +1440,7 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) { else { $name = $author['author_name']; } - $x = import_author_unknown(array('name' => $name,'url' => $author['author_link'],'photo' => array('src' => $author['author_photo']))); + $x = import_author_rss(array('name' => $name,'url' => $author['author_link'],'photo' => array('src' => $author['author_photo']))); if($x) $datarray['author_xchan'] = $x; } -- cgit v1.2.3 From c185685f2d7edd63f41d8fc59ca198266be6605c Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 9 Feb 2022 08:57:27 +0000 Subject: pdo: add the charset to the connection string --- include/dba/dba_pdo.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/dba/dba_pdo.php b/include/dba/dba_pdo.php index 49f741601..2137ca0cc 100644 --- a/include/dba/dba_pdo.php +++ b/include/dba/dba_pdo.php @@ -27,6 +27,13 @@ class dba_pdo extends dba_driver { $dsn .= ';dbname=' . $db; + if ($this->driver_dbtype === 'mysql') { + $dsn .= ';charset=utf8mb4'; + } + else { + $dsn .= ";options='--client_encoding=UTF8'"; + } + try { $this->db = new PDO($dsn,$user,$pass); $this->db->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION); -- cgit v1.2.3 From c0b6f2d95f3c08bce373253c8ceb2111982ee7ce Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 9 Feb 2022 09:23:12 +0000 Subject: fix missing asterisk --- view/fr/invite.casual.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/view/fr/invite.casual.tpl b/view/fr/invite.casual.tpl index 5be968514..ff871e945 100644 --- a/view/fr/invite.casual.tpl +++ b/view/fr/invite.casual.tpl @@ -1,4 +1,4 @@ -{{* tpl FR, pour inviter les personnes qui me connaissant}} +{{* tpl FR, pour inviter les personnes qui me connaissant *}} Rejoingnez moi sur {{$projectname}}. {{$linktxt}} {{$invite_where}} -- cgit v1.2.3 From 4a8c3cdc6109c5515824082f57bdb801b13ef9e0 Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 9 Feb 2022 09:49:46 +0000 Subject: changelog --- CHANGELOG | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 0c4b494be..c931b95b7 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,25 @@ +Hubzilla 7.0.2 (2022-02-09) + - Update french templates + - Add charset to the PDO connection strings + - Introduce delete keytype for get_activitystreams_key() + - Fix PHP error in Daemon/Externals + - Improved actor cache handling + - Implement manual fetch of packed local links + - Add JSalmon data to the meta field instead of data in Lib/ActivityStreams + - Fix some PHP8.1 deprecation warnings + - Fix delivery report for likes not found in some cases + - Allow zotfinger to recurse through all known hublocs if the one we got does not exist (404) or got removed (410) + - Diaspora: improve relaying of comments + - Fix regression in mod hcard + - Add the LD signature in Daemon/Notifier in case where there is no signed data available + - Prevent zot6 packet being saved as AP raw message + - Attach iconfig to the activity instead of the activity object + + Addons + - Pubcrawl: make sure the sys channel falls through the app installed check + - Pubcrawl: improve local delivery of shared inbox items + + Hubzilla 7.0.1 (2022-01-28) - Fix removing contacts from privacy groups in the contact edit modal - Fix escape_tags() messing with URLs in actor_store() -- cgit v1.2.3