Merge pull request #3591 from zotlabs/spammy_server_detection
reduce the number of network fetches for server detection of hubzilla…
This commit is contained in:
commit
e854186134
|
@ -1159,6 +1159,29 @@ function poco_check_server($server_url, $network = "", $force = false) {
|
|||
}
|
||||
|
||||
if (!$failure) {
|
||||
// Test for Hubzilla and Red
|
||||
$serverret = z_fetch_url($server_url."/siteinfo.json");
|
||||
if ($serverret["success"]) {
|
||||
$data = json_decode($serverret["body"]);
|
||||
if (isset($data->url)) {
|
||||
$platform = $data->platform;
|
||||
$version = $data->version;
|
||||
$network = NETWORK_DIASPORA;
|
||||
}
|
||||
$site_name = $data->site_name;
|
||||
switch ($data->register_policy) {
|
||||
case "REGISTER_OPEN":
|
||||
$register_policy = REGISTER_OPEN;
|
||||
break;
|
||||
case "REGISTER_APPROVE":
|
||||
$register_policy = REGISTER_APPROVE;
|
||||
break;
|
||||
case "REGISTER_CLOSED":
|
||||
default:
|
||||
$register_policy = REGISTER_CLOSED;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
// Test for Hubzilla, Redmatrix or Friendica
|
||||
$serverret = z_fetch_url($server_url."/api/statusnet/config.json");
|
||||
if ($serverret["success"]) {
|
||||
|
@ -1211,6 +1234,7 @@ function poco_check_server($server_url, $network = "", $force = false) {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Query statistics.json. Optional package for Diaspora, Friendica and Redmatrix
|
||||
if (!$failure) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user