- foreach ($lrdd as $type => $template) {
- if ($webfinger) {
- continue;
- }
-
- $path = str_replace('{uri}', urlencode($uri), $template);
- $webfinger = self::webfinger($path, $type);
-
- if (!$webfinger && (strstr($uri, "@"))) {
- $path = str_replace('{uri}', urlencode("acct:".$uri), $template);
- $webfinger = self::webfinger($path, $type);
- }
-
- // Special treatment for Mastodon
- // Problem is that Mastodon uses an URL format like http://domain.tld/@nick
- // But the webfinger for this format fails.
- if (!$webfinger && !empty($nick)) {
- // Mastodon uses a "@" as prefix for usernames in their url format
- $nick = ltrim($nick, '@');
-
- $addr = $nick."@".$host;
-
- $path = str_replace('{uri}', urlencode("acct:".$addr), $template);
- $webfinger = self::webfinger($path, $type);
- }
- }
-
- if (!is_array($webfinger["links"])) {
- Logger::log("No webfinger links found for ".$uri, Logger::DEBUG);
- return false;
- }
-