diff --git a/web/clitools/getinstinfo.php b/web/clitools/getinstinfo.php index 63d2a45..77eaee5 100755 --- a/web/clitools/getinstinfo.php +++ b/web/clitools/getinstinfo.php @@ -419,17 +419,14 @@ if ($idata['IsMastodon'] && !is_null($idata['Version']) && $idata['Version']>='4 } else { eecho(2,'«'.$opts['hostname'].'»: could not fetch instance info from API v2: '.$buf['emsg'].'.'.N); } - // "domain count" is only listed by /api/v1/instance (extended description is retrievable also from /api/v1/instance/extended_description) - eecho(0,'«'.$opts['hostname'].'»: trying to fetch domain count and instance extended description from API v1...'.N); + // "domain count" is only listed by /api/v1/instance + eecho(0,'«'.$opts['hostname'].'»: trying to fetch domain count from API v1...'.N); $buf=@gurl('https://'.$opts['hostname'].'/api/v1/instance',$opts['conntimeout'],$opts['functimeout'],['Accept: application/json'],$opts['proxy']); if ($buf['cont']!==false) { ckratelimit($buf['headers'],"«{$opts['hostname']}»"); $buf=@json_decode($buf['cont'],true); if (is_array($buf)) { eecho(1,'«'.$opts['hostname'].'»: got instance info from API v1 :-)'.N); - //print_r($buf); - if (isset($buf['description']) && is_string($buf['description']) && !isempty($buf['description'])) - $idata['LongDesc']=trim($buf['description']); if (isset($buf['stats']['domain_count']) && is_int($buf['stats']['domain_count'])) $idata['DomainCount']=$buf['stats']['domain_count']; } else { @@ -438,6 +435,21 @@ if ($idata['IsMastodon'] && !is_null($idata['Version']) && $idata['Version']>='4 } else { eecho(2,'«'.$opts['hostname'].'»: could not fetch instance info from API v1: '.$buf['emsg'].'.'.N); } + eecho(0,'«'.$opts['hostname'].'»: trying to fetch extended description from API v1...'.N); + $buf=@gurl('https://'.$opts['hostname'].'/api/v1/instance/extended_description',$opts['conntimeout'],$opts['functimeout'],['Accept: application/json'],$opts['proxy']); + if ($buf['cont']!==false) { + ckratelimit($buf['headers'],"«{$opts['hostname']}»"); + $buf=@json_decode($buf['cont'],true); + if (is_array($buf)) { + eecho(1,'«'.$opts['hostname'].'»: got extended description from API v1 :-)'.N); + if (isset($buf['content']) && is_string($buf['content']) && !isempty($buf['content'])) + $idata['LongDesc']=trim($buf['content']); + } else { + eecho(2,'«'.$opts['hostname'].'»: instance extended description fetched from API v1 was not good JSON.'.N); + } + } else { + eecho(2,'«'.$opts['hostname'].'»: could not fetch instance extended description from API v1: '.$buf['emsg'].'.'.N); + } eecho(0,'«'.$opts['hostname'].'»: trying to fetch instance domain blocks from API v1...'.N); $buf=@gurl('https://'.$opts['hostname'].'/api/v1/instance/domain_blocks',$opts['conntimeout'],$opts['functimeout'],['Accept: application/json'],$opts['proxy']); if ($buf['cont']!==false) {