- $xrd_timeout = DI::config()->get('system', 'xrd_timeout');
-
- $webfinger = 'https://' . $addr_parts[1] . '/.well-known/webfinger?resource=acct:' . urlencode($addr);
-
- $curlResult = Network::curl($webfinger, false, ['timeout' => $xrd_timeout, 'accept_content' => 'application/jrd+json,application/json']);
- if (!$curlResult->isSuccess() || empty($curlResult->getBody())) {
- $webfinger = Strings::normaliseLink($webfinger);
-
- $curlResult = Network::curl($webfinger, false, ['timeout' => $xrd_timeout, 'accept_content' => 'application/jrd+json,application/json']);
-
- if (!$curlResult->isSuccess() || empty($curlResult->getBody())) {
- return false;
+ $data = ['addr' => $addr];
+ $template = 'https://' . $addr_parts[1] . '/.well-known/webfinger?resource=acct:' . urlencode($addr);
+ $webfinger = Probe::webfinger(str_replace('{uri}', urlencode($addr), $template), 'application/jrd+json');
+ if (empty($webfinger['links'])) {
+ $template = 'http://' . $addr_parts[1] . '/.well-known/webfinger?resource=acct:' . urlencode($addr);
+ $webfinger = Probe::webfinger(str_replace('{uri}', urlencode($addr), $template), 'application/jrd+json');
+ if (empty($webfinger['links'])) {
+ return [];