From 5da6b86ee9c10b96bdd92683a5592974798b6171 Mon Sep 17 00:00:00 2001 From: nobody Date: Sat, 13 Feb 2021 14:38:31 -0800 Subject: [PATCH] some patches from upstream, plus zot fetch conversation was only checking for zot authors and missing AP authors resulting in 'author not found' even though the record existed. --- Zotlabs/Daemon/Onepoll.php | 1 + Zotlabs/Lib/Activity.php | 22 +++++++++++++++++----- Zotlabs/Lib/Libzot.php | 13 ++++++++++--- 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/Zotlabs/Daemon/Onepoll.php b/Zotlabs/Daemon/Onepoll.php index a5beafb74..4dd25adf1 100644 --- a/Zotlabs/Daemon/Onepoll.php +++ b/Zotlabs/Daemon/Onepoll.php @@ -131,6 +131,7 @@ class Onepoll { $url = ((array_key_exists('outbox',$cl)) ? $cl['outbox'] : ''); if ($url) { logger('fetching outbox'); + $url = $url . '?date_begin=' . urlencode($last_update); $obj = new ASCollection($url, $importer, 0, $max); $messages = $obj->get(); if ($messages) { diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index 0426c4ccc..6963b9911 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -240,16 +240,28 @@ class Activity { $numpages = $total / App::$pager['itemspage']; $lastpage = (($numpages > intval($numpages)) ? intval($numpages) + 1 : $numpages); - $stripped = preg_replace('/([&|\?]page=[0-9]*)/','',$id); - $stripped = rtrim($stripped,'/'); + $url_parts = parse_url($id); - $ret['partOf'] = z_root() . '/' . $stripped; + $ret['partOf'] = z_root() . '/' . $url_parts['path']; + + $extra_query_args = ''; + $query_args = null; + if (isset($url_parts['query'])) { + parse_str($url_parts['query'], $query_args); + } + + if (is_array($query_args)) { + unset($query_args['page']); + foreach ($query_args as $k => $v) { + $extra_query_args .= '&' . urlencode($k) . '=' . urlencode($v); + } + } if (App::$pager['page'] < $lastpage) { - $ret['next'] = z_root() . '/' . $stripped . '?page=' . (intval(App::$pager['page']) + 1); + $ret['next'] = z_root() . '/' . $url_parts['path'] . '?page=' . (intval(App::$pager['page']) + 1) . $extra_query_args; } if (App::$pager['page'] > 1) { - $ret['prev'] = z_root() . '/' . $stripped . '?page=' . (intval(App::$pager['page']) - 1); + $ret['prev'] = z_root() . '/' . $url_parts['path'] . '?page=' . (intval(App::$pager['page']) - 1) . $extra_query_args; } } else { diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php index e1a9dd113..aaadbae3d 100644 --- a/Zotlabs/Lib/Libzot.php +++ b/Zotlabs/Lib/Libzot.php @@ -2192,14 +2192,16 @@ class Libzot { // logger($AS->debug()); - $r = q("select hubloc_hash from hubloc where hubloc_id_url = '%s' limit 1", - dbesc($AS->actor['id']) + $r = q("select hubloc_hash from hubloc where hubloc_id_url = '%s' or hubloc_hash = '%s' limit 1", + dbesc($AS->actor['id']), + dbesc($AS->actor['id']) ); if (! $r) { $y = import_author_xchan([ 'url' => $AS->actor['id'] ]); if ($y) { - $r = q("select hubloc_hash from hubloc where hubloc_id_url = '%s' limit 1", + $r = q("select hubloc_hash from hubloc where hubloc_id_url = '%s' or hubloc_hash = '%s' limit 1", + dbesc($AS->actor['id']), dbesc($AS->actor['id']) ); } @@ -3354,6 +3356,11 @@ class Libzot { ); } + // this site obviously isn't dead because they are trying to communicate with us. + q("update site set site_dead = 0 where site_dead = 1 and site_url = '%s' ", + dbesc($hub['hubloc_url']) + ); + return $hub['hubloc_url']; }