]> git.mxchange.org Git - friendica.git/commitdiff
Selective probing for AP
authorMichael <heluecht@pirati.ca>
Mon, 27 Jul 2020 19:36:11 +0000 (19:36 +0000)
committerMichael <heluecht@pirati.ca>
Mon, 27 Jul 2020 19:36:11 +0000 (19:36 +0000)
src/Model/ContactRelation.php

index 06c25059fa0c459799f1de0365597137852104d1..bc4a38b744eaf3aa613937ea3ff9030159d37026 100644 (file)
@@ -22,6 +22,7 @@
 namespace Friendica\Model;
 
 use Friendica\Core\Logger;
+use Friendica\Core\Protocol;
 use Friendica\Database\DBA;
 use Friendica\DI;
 use Friendica\Protocol\ActivityPub;
@@ -100,7 +101,13 @@ class ContactRelation
                        return;
                }
 
-               $apcontact = APContact::getByURL($url);
+               if (in_array($contact['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN])) {
+                       // The contact is (most likely) speaking AP, so updating is allowed
+                       $apcontact = APContact::getByURL($url);
+               } else {
+                       // The contact isn't obviously speaking AP, so we don't allow updating
+                       $apcontact = APContact::getByURL($url, false);
+               }
 
                if (!empty($apcontact['followers']) && is_string($apcontact['followers'])) {
                        $followers = ActivityPub::fetchItems($apcontact['followers']);