diff --git a/web/clitools/getinstinfo.php b/web/clitools/getinstinfo.php index eca85d3..5d4622a 100755 --- a/web/clitools/getinstinfo.php +++ b/web/clitools/getinstinfo.php @@ -32,7 +32,7 @@ require '../lib/ght.php'; require '../lib/fnum.php'; require '../lib/supplangs.php'; require '../lib/gettlds.php'; -require '../lib/mastodon_postlen.php'; +require '../lib/mastodon-postLength.php'; require '../lib/ckratelimit.php'; require '../lib/vendor/autoload.php'; use LanguageDetection\Language; @@ -826,7 +826,9 @@ if ($instanswered && !$opts['dryrun'] && isset($idata['blocks'])) { if ($opts['_sendtoot'] && $instanswered && $idata['IsMastodon'] && $idata['FirstSeen']==$now) { $lc=['decimal_point'=>'.', 'thousands_sep'=>',']; - gettlds(); + $tldsre=gettlds(__DIR__.'/tlds.txt',true); + if (!is_null($tldsre['warnings'])) + eecho(2,"gettlds: {$tldsre['warnings']}\n"); eecho(0,'«'.$opts['hostname'].'»: this instance is new, trying to send an announcement toot about it...'.N); $endpoint='https://'.$opts['bothost'].'/api/v1/statuses'; $toot='A new Mastodon instance, https://'.$opts['hostname'].', has been found by the crawler at https://mastodon.help'.N.N.'Name: '; @@ -858,8 +860,8 @@ if ($opts['_sendtoot'] && $instanswered && $idata['IsMastodon'] && $idata['First (is_null($idata['ShortDesc'])) ? $toot.='unspecified' : $toot.=$idata['ShortDesc']; $toot.=N.N.'Long description: '; (is_null($idata['LongDesc'])) ? $toot.='unspecified' : $toot.=html2text($idata['LongDesc']); - if (postlen($toot)>$opts['botmaxchars']) { - while (postlen($toot)+13>$opts['botmaxchars']) + if (postLength($toot,$tldsre['tlds'])>$opts['botmaxchars']) { + while (postLength($toot,$tldsre['tlds'])+13>$opts['botmaxchars']) $toot=preg_replace('#\s+(\S|\n)+$#u','',$toot); $toot.=' [continues…]'; }