Selective probing for AP

This commit is contained in:
Michael 2020-07-27 19:36:11 +00:00
parent fd1da74980
commit 477e9bd67a

View file

@ -22,6 +22,7 @@
namespace Friendica\Model; namespace Friendica\Model;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Protocol;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Protocol\ActivityPub; use Friendica\Protocol\ActivityPub;
@ -100,7 +101,13 @@ class ContactRelation
return; return;
} }
if (in_array($contact['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN])) {
// The contact is (most likely) speaking AP, so updating is allowed
$apcontact = APContact::getByURL($url); $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'])) { if (!empty($apcontact['followers']) && is_string($apcontact['followers'])) {
$followers = ActivityPub::fetchItems($apcontact['followers']); $followers = ActivityPub::fetchItems($apcontact['followers']);