Merge pull request #10503 from annando/no-legacy-dfrn

Legacy DFRN transport layer is removed
This commit is contained in:
Hypolite Petovan 2021-07-15 16:24:07 -04:00 committed by GitHub
commit 4dc6b29046
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 200 additions and 3214 deletions

View file

@ -38,7 +38,6 @@ use Friendica\Network\HTTPException;
use Friendica\Network\Probe;
use Friendica\Protocol\Activity;
use Friendica\Protocol\ActivityPub;
use Friendica\Protocol\DFRN;
use Friendica\Protocol\Diaspora;
use Friendica\Protocol\OStatus;
use Friendica\Protocol\Salmon;
@ -811,13 +810,11 @@ class Contact
}
$protocol = $contact['network'];
if (($protocol == Protocol::DFRN) && !self::isLegacyDFRNContact($contact)) {
$protocol = Protocol::ACTIVITYPUB;
if (($protocol == Protocol::DFRN) && !empty($contact['protocol'])) {
$protocol = $contact['protocol'];
}
if (($protocol == Protocol::DFRN) && $dissolve) {
DFRN::deliver($user, $contact, 'placeholder', true);
} elseif (in_array($protocol, [Protocol::OSTATUS, Protocol::DFRN])) {
if (in_array($protocol, [Protocol::OSTATUS, Protocol::DFRN])) {
// create an unfollow slap
$item = [];
$item['verb'] = Activity::O_UNFOLLOW;
@ -2273,18 +2270,6 @@ class Contact
return $id;
}
/**
* Detects if a given contact array belongs to a legacy DFRN connection
*
* @param array $contact
* @return boolean
*/
public static function isLegacyDFRNContact($contact)
{
// Newer Friendica contacts are connected via AP, then these fields aren't set
return !empty($contact['dfrn-id']) || !empty($contact['issued-id']);
}
/**
* Detects the communication protocol for a given contact url.
* This is used to detect Friendica contacts that we can communicate via AP.
@ -2387,24 +2372,6 @@ class Contact
$protocol = self::getProtocol($ret['url'], $ret['network']);
if (($protocol === Protocol::DFRN) && !DBA::isResult($contact)) {
if ($interactive) {
if (strlen(DI::baseUrl()->getUrlPath())) {
$myaddr = bin2hex(DI::baseUrl() . '/profile/' . $user['nickname']);
} else {
$myaddr = bin2hex($user['nickname'] . '@' . DI::baseUrl()->getHostname());
}
DI::baseUrl()->redirect($ret['request'] . "&addr=$myaddr");
// NOTREACHED
}
} elseif (DI::config()->get('system', 'dfrn_only') && ($ret['network'] != Protocol::DFRN)) {
$result['message'] = DI::l10n()->t('This site is not configured to allow communications with other networks.') . EOL;
$result['message'] .= DI::l10n()->t('No compatible communication protocols or feeds were discovered.') . EOL;
return $result;
}
// This extra param just confuses things, remove it
if ($protocol === Protocol::DIASPORA) {
$ret['url'] = str_replace('?absolute=true', '', $ret['url']);

View file

@ -38,7 +38,7 @@ class Conversation
const PARCEL_SALMON = 3;
const PARCEL_FEED = 4; // Deprecated
const PARCEL_SPLIT_CONVERSATION = 6;
const PARCEL_LEGACY_DFRN = 7;
const PARCEL_LEGACY_DFRN = 7; // @deprecated since version 2021.09
const PARCEL_DIASPORA_DFRN = 8;
const PARCEL_LOCAL_DFRN = 9;
const PARCEL_DIRECT = 10;

View file

@ -41,7 +41,7 @@ class DeliveryData
const ACTIVITYPUB = 1;
const DFRN = 2;
const LEGACY_DFRN = 3;
const LEGACY_DFRN = 3; // @deprecated since version 2021.09
const DIASPORA = 4;
const OSTATUS = 5;
const MAIL = 6;