From 8ec2b21a1471f0a3c0afdbe56fb525c1b4b06efc Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 14 Jun 2020 15:47:47 +0000 Subject: [PATCH] Abuse mail received because of "unusual traffic" Fixes friendica/friendica#8663 --- src/Model/GServer.php | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/Model/GServer.php b/src/Model/GServer.php index 133ad14b3..704d091a6 100644 --- a/src/Model/GServer.php +++ b/src/Model/GServer.php @@ -1627,15 +1627,18 @@ class GServer } // Discover federated servers - $curlResult = Network::fetchUrl("http://the-federation.info/pods.json"); - - if (!empty($curlResult)) { - $servers = json_decode($curlResult, true); - - if (!empty($servers['pods'])) { - foreach ($servers['pods'] as $server) { - // Using "only_nodeinfo" since servers that are listed on that page should always have it. - Worker::add(PRIORITY_LOW, 'UpdateGServer', 'https://' . $server['host'], true); + $protocols = ['activitypub', 'diaspora', 'dfrn', 'ostatus']; + foreach ($protocols as $protocol) { + $query = '{nodes(protocol:"' . $protocol . '"){host}}'; + $curlResult = Network::fetchUrl('https://the-federation.info/graphql?query=' . urlencode($query)); + if (!empty($curlResult)) { + $data = json_decode($curlResult, true); + if (!empty($data['data']['nodes'])) { + foreach ($data['data']['nodes'] as $server) { + // Using "only_nodeinfo" since servers that are listed on that page should always have it. + echo $server['host']."\n"; + Worker::add(PRIORITY_LOW, 'UpdateGServer', 'https://' . $server['host'], true); + } } } }