]> git.mxchange.org Git - friendica.git/commitdiff
We now use the regular probing function
authorMichael <heluecht@pirati.ca>
Thu, 13 Sep 2018 21:57:41 +0000 (21:57 +0000)
committerMichael <heluecht@pirati.ca>
Thu, 13 Sep 2018 21:57:41 +0000 (21:57 +0000)
src/Network/Probe.php
src/Protocol/ActivityPub.php

index af2d1c9a16ef6d8254dbc8ca7b803e338097d324..99ecb668c86798c9509877739530ae1b37c93dbe 100644 (file)
@@ -19,6 +19,7 @@ use Friendica\Model\Contact;
 use Friendica\Model\Profile;
 use Friendica\Protocol\Email;
 use Friendica\Protocol\Feed;
+use Friendica\Protocol\ActivityPub;
 use Friendica\Util\Crypto;
 use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Network;
@@ -328,7 +329,16 @@ class Probe
                        $uid = local_user();
                }
 
-               $data = self::detect($uri, $network, $uid);
+               if ($network != Protocol::ACTIVITYPUB) {
+                       $data = self::detect($uri, $network, $uid);
+               }
+
+               if (empty($data) || ($data['network'] == Protocol::PHANTOM)) {
+                       $ap_profile = ActivityPub::fetchProfile($uri);
+                       if (!empty($ap_profile) && ($ap_profile['network'] == Protocol::ACTIVITYPUB)) {
+                               $data = $ap_profile;
+                       }
+               }
 
                if (!isset($data["url"])) {
                        $data["url"] = $uri;
index 83aae72aa52c599d5cca7f54e690d992d49c1bd5..12c849d5b4c64d5ebccd5d33a1155c9ff91b836c 100644 (file)
@@ -15,6 +15,7 @@ use Friendica\Model\User;
 use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Crypto;
 use Friendica\Content\Text\BBCode;
+use Friendica\Network\Probe;
 
 /**
  * @brief ActivityPub Protocol class
@@ -322,11 +323,11 @@ class ActivityPub
        {
                $url = (strpos($id, '#') ? substr($id, 0, strpos($id, '#')) : $id);
 
-               $profile = self::fetchProfile($url);
+               $profile = Probe::uri($url, Protocol::ACTIVITYPUB);
                if (!empty($profile)) {
                        return $profile['pubkey'];
                } elseif ($url != $actor) {
-                       $profile = self::fetchProfile($actor);
+                       $profile = Probe::uri($actor, Protocol::ACTIVITYPUB);
                        if (!empty($profile)) {
                                return $profile['pubkey'];
                        }
@@ -395,19 +396,21 @@ class ActivityPub
                $profile['name'] = defaults($data, 'name', $profile['nick']);
                $profile['guid'] = defaults($data, 'uuid', null);
                $profile['url'] = $data['id'];
-               $profile['alias'] = self::processElement($data, 'url', 'href');
 
                $parts = parse_url($profile['url']);
                unset($parts['scheme']);
                unset($parts['path']);
                $profile['addr'] = $profile['nick'] . '@' . str_replace('//', '', Network::unparseURL($parts));
-
+               $profile['alias'] = self::processElement($data, 'url', 'href');
                $profile['photo'] = self::processElement($data, 'icon', 'url');
+               // $profile['community']
+               // $profile['keywords']
+               // $profile['location']
                $profile['about'] = defaults($data, 'summary', '');
                $profile['batch'] = self::processElement($data, 'endpoints', 'sharedInbox');
-               $profile['pubkey'] = self::processElement($data, 'publicKey', 'publicKeyPem');
                $profile['notify'] = $data['inbox'];
                $profile['poll'] = $data['outbox'];
+               $profile['pubkey'] = self::processElement($data, 'publicKey', 'publicKeyPem');
 
                // Check if the address is resolvable
                if (self::addrToUrl($profile['addr']) == $profile['url']) {