]> git.mxchange.org Git - friendica.git/commitdiff
Mastodon now does return a version number
authorMichael <heluecht@pirati.ca>
Fri, 5 May 2017 05:36:43 +0000 (05:36 +0000)
committerMichael <heluecht@pirati.ca>
Fri, 5 May 2017 05:36:43 +0000 (05:36 +0000)
include/socgraph.php

index a39eca5e86fe9ec39628a60b04cccb255ccec7b4..71257c51b717724f8346212d3b137d5c10c3b9bf 100644 (file)
@@ -1136,6 +1136,20 @@ function poco_check_server($server_url, $network = "", $force = false) {
                        $network = NETWORK_OSTATUS;
                        $last_contact = datetime_convert();
                }
+
+               // Test for Mastodon
+               $serverret = z_fetch_url($server_url."/api/v1/instance");
+               if ($serverret["success"] AND ($serverret["body"] != '')) {
+                       $data = json_decode($serverret["body"]);
+                       if (isset($data->version)) {
+                               $platform = "Mastodon";
+                               $version = $data->version;
+                               $site_name = $data->title;
+                               $info = $data->description;
+                               $network = NETWORK_OSTATUS;
+                               $last_contact = datetime_convert();
+                       }
+               }
        }
 
        if (!$failure) {