diff options
Diffstat (limited to 'Zotlabs')
-rw-r--r-- | Zotlabs/Daemon/Externals.php | 4 | ||||
-rw-r--r-- | Zotlabs/Lib/Activity.php | 12 | ||||
-rw-r--r-- | Zotlabs/Lib/ActivityStreams.php | 2 | ||||
-rw-r--r-- | Zotlabs/Lib/Libzot.php | 2 | ||||
-rw-r--r-- | Zotlabs/Web/HTTPSig.php | 16 |
5 files changed, 29 insertions, 7 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/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']); } 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'] ] ); diff --git a/Zotlabs/Web/HTTPSig.php b/Zotlabs/Web/HTTPSig.php index 7da9acabf..a7a59b8cf 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; } @@ -243,7 +244,12 @@ class HTTPSig { } } - $key = self::get_activitystreams_key($id, $force); + $delete = false; + if ($keytype === 'delete') { + $delete = true; + } + + $key = self::get_activitystreams_key($id, $force, $delete); 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, $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); @@ -294,6 +300,12 @@ class HTTPSig { } } + 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; + } + // The record wasn't in cache. Fetch it now. $r = ActivityStreams::fetch($id); |