diff --git a/src/Model/Contact.php b/src/Model/Contact.php index 1c90d0c815..6d435c81c0 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -1285,10 +1285,15 @@ class Contact extends BaseObject return false; } - $blocked = DBA::selectFirst('contact', ['blocked'], ['id' => $cid]); + $blocked = DBA::selectFirst('contact', ['blocked', 'url'], ['id' => $cid]); if (!DBA::isResult($blocked)) { return false; } + + if (Network::isUrlBlocked($blocked['url'])) { + return true; + } + return (bool) $blocked['blocked']; } diff --git a/src/Protocol/ActivityPub/Transmitter.php b/src/Protocol/ActivityPub/Transmitter.php index 64b98e17e7..22c8a3518e 100644 --- a/src/Protocol/ActivityPub/Transmitter.php +++ b/src/Protocol/ActivityPub/Transmitter.php @@ -27,6 +27,7 @@ use Friendica\Protocol\ActivityPub; use Friendica\Protocol\Diaspora; use Friendica\Core\Cache; use Friendica\Util\Map; +use Friendica\Util\Network; require_once 'include/api.php'; @@ -446,6 +447,10 @@ class Transmitter $contacts = DBA::select('contact', ['url'], $condition); while ($contact = DBA::fetch($contacts)) { + if (Network::isUrlBlocked($contact['url'])) { + continue; + } + $profile = APContact::getByURL($contact['url'], false); if (!empty($profile)) { if (empty($profile['sharedinbox']) || $personal) { @@ -493,6 +498,10 @@ class Transmitter $blindcopy = in_array($element, ['bto', 'bcc']); foreach ($permissions[$element] as $receiver) { + if (Network::isUrlBlocked($receiver)) { + continue; + } + if ($receiver == $item_profile['followers']) { $inboxes = array_merge($inboxes, self::fetchTargetInboxesforUser($uid, $personal)); } else { diff --git a/src/Worker/Delivery.php b/src/Worker/Delivery.php index 3ae0be140d..0d56bfa5d1 100644 --- a/src/Worker/Delivery.php +++ b/src/Worker/Delivery.php @@ -19,6 +19,7 @@ use Friendica\Protocol\DFRN; use Friendica\Protocol\Diaspora; use Friendica\Protocol\Email; use Friendica\Util\Strings; +use Friendica\Util\Network; require_once 'include/items.php'; @@ -158,6 +159,10 @@ class Delivery extends BaseObject return; } + if (Network::isUrlBlocked($contact['url'])) { + return; + } + // Transmit via Diaspora if the thread had started as Diaspora post // This is done since the uri wouldn't match (Diaspora doesn't transmit it) if (isset($parent) && ($parent['network'] == Protocol::DIASPORA) && ($contact['network'] == Protocol::DFRN)) {