X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModel%2FAPContact.php;h=09a6cb9e78db781f1ccabac557cd5fbc0747b40c;hb=20a2cec0b0fdaf1056cc65fc99570f0bc7dbd91e;hp=3b568f39f1d85c5c7be8880668adfe97d7c94e43;hpb=25992b063ac984d42c8d0f63f45f77eab1ee34be;p=friendica.git diff --git a/src/Model/APContact.php b/src/Model/APContact.php index 3b568f39f1..09a6cb9e78 100644 --- a/src/Model/APContact.php +++ b/src/Model/APContact.php @@ -1,6 +1,6 @@ getAuthority(); + } catch (\Throwable $e) { + Logger::warning('Unable to coerce APContact URL into a UriInterface object', ['url' => $apcontact['url'], 'error' => $e->getMessage()]); $apcontact['addr'] = ''; } } $apcontact['pubkey'] = null; if (!empty($compacted['w3id:publicKey'])) { - $apcontact['pubkey'] = trim(JsonLD::fetchElement($compacted['w3id:publicKey'], 'w3id:publicKeyPem', '@value')); - if (strstr($apcontact['pubkey'], 'RSA ')) { + $apcontact['pubkey'] = trim(JsonLD::fetchElement($compacted['w3id:publicKey'], 'w3id:publicKeyPem', '@value') ?? ''); + if (strpos($apcontact['pubkey'], 'RSA ') !== false) { $apcontact['pubkey'] = Crypto::rsaToPem($apcontact['pubkey']); } } @@ -430,6 +424,12 @@ class APContact $apcontact['gsid'] = null; } + self::unarchiveInbox($apcontact['inbox'], false, $apcontact['gsid']); + + if (!empty($apcontact['sharedinbox'])) { + self::unarchiveInbox($apcontact['sharedinbox'], true, $apcontact['gsid']); + } + if ($apcontact['url'] == $apcontact['alias']) { $apcontact['alias'] = null; } @@ -520,7 +520,7 @@ class APContact { if (!empty($apcontact['inbox'])) { Logger::info('Set inbox status to failure', ['inbox' => $apcontact['inbox']]); - HTTPSignature::setInboxStatus($apcontact['inbox'], false); + HTTPSignature::setInboxStatus($apcontact['inbox'], false, false, $apcontact['gsid']); } if (!empty($apcontact['sharedinbox'])) { @@ -530,7 +530,7 @@ class APContact if (!$available) { // If all known personal inboxes are failing then set their shared inbox to failure as well Logger::info('Set shared inbox status to failure', ['sharedinbox' => $apcontact['sharedinbox']]); - HTTPSignature::setInboxStatus($apcontact['sharedinbox'], false, true); + HTTPSignature::setInboxStatus($apcontact['sharedinbox'], false, true, $apcontact['gsid']); } } } @@ -545,11 +545,11 @@ class APContact { if (!empty($apcontact['inbox'])) { Logger::info('Set inbox status to success', ['inbox' => $apcontact['inbox']]); - HTTPSignature::setInboxStatus($apcontact['inbox'], true); + HTTPSignature::setInboxStatus($apcontact['inbox'], true, false, $apcontact['gsid']); } if (!empty($apcontact['sharedinbox'])) { Logger::info('Set shared inbox status to success', ['sharedinbox' => $apcontact['sharedinbox']]); - HTTPSignature::setInboxStatus($apcontact['sharedinbox'], true, true); + HTTPSignature::setInboxStatus($apcontact['sharedinbox'], true, true, $apcontact['gsid']); } } @@ -558,15 +558,16 @@ class APContact * * @param string $url inbox url * @param boolean $shared Shared Inbox + * @param int $gsid Global server id * @return void */ - private static function unarchiveInbox(string $url, bool $shared) + private static function unarchiveInbox(string $url, bool $shared, int $gsid = null) { if (empty($url)) { return; } - HTTPSignature::setInboxStatus($url, true, $shared); + HTTPSignature::setInboxStatus($url, true, $shared, $gsid); } /**