Mastodon is now detected as OStatus network
This commit is contained in:
parent
20e10a50c0
commit
a81f5859ad
|
@ -180,6 +180,11 @@ class Probe {
|
||||||
|
|
||||||
$path = str_replace('{uri}', urlencode($uri), $link);
|
$path = str_replace('{uri}', urlencode($uri), $link);
|
||||||
$webfinger = self::webfinger($path);
|
$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"]))
|
if (!is_array($webfinger["links"]))
|
||||||
|
@ -310,6 +315,7 @@ class Probe {
|
||||||
return array("network" => NETWORK_TWITTER);
|
return array("network" => NETWORK_TWITTER);
|
||||||
|
|
||||||
$lrdd = self::xrd($host);
|
$lrdd = self::xrd($host);
|
||||||
|
|
||||||
if (!$lrdd)
|
if (!$lrdd)
|
||||||
return self::mail($uri, $uid);
|
return self::mail($uri, $uid);
|
||||||
|
|
||||||
|
@ -356,6 +362,12 @@ class Probe {
|
||||||
$path = str_replace('{uri}', urlencode($addr), $link);
|
$path = str_replace('{uri}', urlencode($addr), $link);
|
||||||
$webfinger = self::webfinger($path);
|
$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 wasn't successful then try it with the URL - possibly in the format https://...
|
||||||
if (!$webfinger AND ($uri != $addr)) {
|
if (!$webfinger AND ($uri != $addr)) {
|
||||||
$path = str_replace('{uri}', urlencode($uri), $link);
|
$path = str_replace('{uri}', urlencode($uri), $link);
|
||||||
|
@ -815,6 +827,9 @@ class Probe {
|
||||||
if (strstr($alias, "@"))
|
if (strstr($alias, "@"))
|
||||||
$data["addr"] = str_replace('acct:', '', $alias);
|
$data["addr"] = str_replace('acct:', '', $alias);
|
||||||
|
|
||||||
|
if (is_string($webfinger["subject"]) AND strstr($webfinger["subject"], "@"))
|
||||||
|
$data["addr"] = str_replace('acct:', '', $webfinger["subject"]);
|
||||||
|
|
||||||
$pubkey = "";
|
$pubkey = "";
|
||||||
foreach ($webfinger["links"] AS $link) {
|
foreach ($webfinger["links"] AS $link) {
|
||||||
if (($link["rel"] == "http://webfinger.net/rel/profile-page") AND
|
if (($link["rel"] == "http://webfinger.net/rel/profile-page") AND
|
||||||
|
@ -832,7 +847,7 @@ class Probe {
|
||||||
$pubkey = substr($pubkey, strpos($pubkey, ',') + 1);
|
$pubkey = substr($pubkey, strpos($pubkey, ',') + 1);
|
||||||
else
|
else
|
||||||
$pubkey = substr($pubkey, 5);
|
$pubkey = substr($pubkey, 5);
|
||||||
} else
|
} elseif (normalise_link($pubkey) == 'http://')
|
||||||
$pubkey = fetch_url($pubkey);
|
$pubkey = fetch_url($pubkey);
|
||||||
|
|
||||||
$key = explode(".", $pubkey);
|
$key = explode(".", $pubkey);
|
||||||
|
|
|
@ -31,8 +31,7 @@ function get_salmon_key($uri,$keyhash) {
|
||||||
$ret[$x] = substr($ret[$x],strpos($ret[$x],',')+1);
|
$ret[$x] = substr($ret[$x],strpos($ret[$x],',')+1);
|
||||||
else
|
else
|
||||||
$ret[$x] = substr($ret[$x],5);
|
$ret[$x] = substr($ret[$x],5);
|
||||||
}
|
} elseif (normalise_link($ret[$x]) == 'http://')
|
||||||
else
|
|
||||||
$ret[$x] = fetch_url($ret[$x]);
|
$ret[$x] = fetch_url($ret[$x]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user