“$instanswered” got set to true if nodeinfo responded; now it gets set to true only if api/v2/instance or api/v1/instance responded

This commit is contained in:
pezcurrel 2023-01-04 13:39:10 +01:00
parent b114deba61
commit 3f86fc689b

View file

@ -270,7 +270,6 @@ if ($buf['cont']!==false) {
$buf=@json_decode($buf['cont'],true); $buf=@json_decode($buf['cont'],true);
if (is_array($buf)) { if (is_array($buf)) {
eecho(1,'«'.$opts['hostname'].'»: got nodeinfo data :-)'.N); eecho(1,'«'.$opts['hostname'].'»: got nodeinfo data :-)'.N);
$instanswered=true;
if (isset($buf['software']['name']) && is_string($buf['software']['name']) && !isempty($buf['software']['name'])) { if (isset($buf['software']['name']) && is_string($buf['software']['name']) && !isempty($buf['software']['name'])) {
$idata['Software']=trim($buf['software']['name']); $idata['Software']=trim($buf['software']['name']);
(preg_match('/^'.$mastodons.'/',$idata['Software'])===1) ? $idata['IsMastodon']=true : $idata['IsMastodon']=false; (preg_match('/^'.$mastodons.'/',$idata['Software'])===1) ? $idata['IsMastodon']=true : $idata['IsMastodon']=false;
@ -317,6 +316,7 @@ if ($idata['IsMastodon'] && $idata['Version']>='4.0.0') {
if (is_array($buf)) { if (is_array($buf)) {
if (make(['domain', 'title', 'version', 'source_url', 'description', 'usage', 'thumbnail', 'languages', 'configuration', 'registrations', 'contact', 'rules'],$buf)) { if (make(['domain', 'title', 'version', 'source_url', 'description', 'usage', 'thumbnail', 'languages', 'configuration', 'registrations', 'contact', 'rules'],$buf)) {
eecho(1,'«'.$opts['hostname'].'»: got good instance info from API v2 :-)'.N); eecho(1,'«'.$opts['hostname'].'»: got good instance info from API v2 :-)'.N);
$instanswered=true;
if (isset($buf['title']) && is_string($buf['title']) && !isempty($buf['title'])) if (isset($buf['title']) && is_string($buf['title']) && !isempty($buf['title']))
$idata['Title']=trim($buf['title']); $idata['Title']=trim($buf['title']);
if (isset($buf['description']) && is_string($buf['description']) && !isempty($buf['description'])) if (isset($buf['description']) && is_string($buf['description']) && !isempty($buf['description']))