]> git.mxchange.org Git - friendica.git/commitdiff
Mastodon is now detected as OStatus network
authorMichael Vogel <ike@pirati.ca>
Wed, 5 Oct 2016 20:54:26 +0000 (20:54 +0000)
committerMichael Vogel <ike@pirati.ca>
Wed, 5 Oct 2016 20:54:26 +0000 (20:54 +0000)
include/Probe.php
include/salmon.php

index 44824103b452042dfd93c1bdc7fc414a4d39ec44..d8814036d91a5a357d2d5cf743d0876a2ca479af 100644 (file)
@@ -180,6 +180,11 @@ class Probe {
 
                        $path = str_replace('{uri}', urlencode($uri), $link);
                        $webfinger = self::webfinger($path);
+
+                       if (!$webfinger AND (strstr($uri, "@"))) {
+                               $path = str_replace('{uri}', urlencode("acct:".$uri), $link);
+                               $webfinger = self::webfinger($path);
+                       }
                }
 
                if (!is_array($webfinger["links"]))
@@ -310,6 +315,7 @@ class Probe {
                                return array("network" => NETWORK_TWITTER);
 
                        $lrdd = self::xrd($host);
+
                        if (!$lrdd)
                                return self::mail($uri, $uid);
 
@@ -356,6 +362,12 @@ class Probe {
                        $path = str_replace('{uri}', urlencode($addr), $link);
                        $webfinger = self::webfinger($path);
 
+                       // Mastodon needs to have it with "acct:"
+                       if (!$webfinger) {
+                               $path = str_replace('{uri}', urlencode("acct:".$addr), $link);
+                               $webfinger = self::webfinger($path);
+                       }
+
                        // If webfinger wasn't successful then try it with the URL - possibly in the format https://...
                        if (!$webfinger AND ($uri != $addr)) {
                                $path = str_replace('{uri}', urlencode($uri), $link);
@@ -815,6 +827,9 @@ class Probe {
                                if (strstr($alias, "@"))
                                        $data["addr"] = str_replace('acct:', '', $alias);
 
+               if (is_string($webfinger["subject"]) AND strstr($webfinger["subject"], "@"))
+                       $data["addr"] = str_replace('acct:', '', $webfinger["subject"]);
+
                $pubkey = "";
                foreach ($webfinger["links"] AS $link) {
                        if (($link["rel"] == "http://webfinger.net/rel/profile-page") AND
@@ -832,7 +847,7 @@ class Probe {
                                                $pubkey = substr($pubkey, strpos($pubkey, ',') + 1);
                                        else
                                                $pubkey = substr($pubkey, 5);
-                               } else
+                               } elseif (normalise_link($pubkey) == 'http://')
                                        $pubkey = fetch_url($pubkey);
 
                                $key = explode(".", $pubkey);
index 8341b902a7a874b3db3e140d32478bda9b564962..5e9c4fa616dc1df20eec3c8d16ac372add35155e 100644 (file)
@@ -31,8 +31,7 @@ function get_salmon_key($uri,$keyhash) {
                                        $ret[$x] = substr($ret[$x],strpos($ret[$x],',')+1);
                                else
                                        $ret[$x] = substr($ret[$x],5);
-                       }
-                       else
+                       } elseif (normalise_link($ret[$x]) == 'http://')
                                $ret[$x] = fetch_url($ret[$x]);
                }
        }