From: Michael Date: Sun, 16 Apr 2017 07:46:04 +0000 (+0000) Subject: Discover Mastodon servers X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=dc0ce4e08c94798a482e9d10f299d7a4ea083aa3;p=friendica.git Discover Mastodon servers --- diff --git a/include/socgraph.php b/include/socgraph.php index 66533e1511..a39eca5e86 100644 --- a/include/socgraph.php +++ b/include/socgraph.php @@ -7,6 +7,8 @@ * @todo Detect if it is a forum */ +use \Friendica\Core\Config; + require_once('include/datetime.php'); require_once("include/Scrape.php"); require_once("include/network.php"); @@ -1656,6 +1658,20 @@ function poco_discover_federation() { } } + // Disvover Mastodon servers + if (!Config::get('system','ostatus_disabled')) { + $serverdata = fetch_url("https://instances.mastodon.xyz/instances.json"); + + if ($serverdata) { + $servers = json_decode($serverdata); + + foreach ($servers AS $server) { + $url = (is_null($server->https_score) ? 'http' : 'https').'://'.$server->name; + proc_run(PRIORITY_LOW, "include/discover_poco.php", "server", base64_encode($url)); + } + } + } + // Currently disabled, since the service isn't available anymore. // It is not removed since I hope that there will be a successor. // Discover GNU Social Servers.