diff --git a/index.php b/index.php
index 2e4063b..29267a5 100644
--- a/index.php
+++ b/index.php
@@ -17,12 +17,18 @@
// Logorrh, Verbose, Charliero, Tashugo?
+$dodebug=false;
+$debug='';
+
require 'lib/gettlds.php';
-$tlds=gettlds();
-$retlds=implode('|',$tlds);
-$jstlds="const tlds=['".implode("', '",$tlds)."'];\n";
-if (@file_put_contents('js/tlds.js',$jstlds)===false)
- dieyoung('Error: could not save «js/tlds.js»');
+$tlds=gettlds('storage/tlds.txt',false);// we don't get them in "regex format" because we need them for js too, so we'll rsort them later
+if (!is_null($tlds['warnings'])) $debug.="GetTLDs warning: {$tlds['warnings']}.
\n";
+rsort($tlds);
+$retlds=implode('|',$tlds['tlds']);
+$jstlds="const tlds=['".implode("', '",$tlds['tlds'])."'];\n";
+$jstldsfp='storage/tlds.js';
+if (@file_put_contents($jstldsfp,$jstlds)===false)
+ dieyoung("Error: could not save «{$jstldsfp}»");
unset($tlds,$jstlds);
require 'lib/mastodon.php';
require 'lib/ckratelimit.php';
@@ -49,9 +55,6 @@ $now=time();
$timeout=5;
$formact=preg_replace('#[^/]+$#','',$_SERVER['REQUEST_URI']);
-$dodebug=false;
-$debug='';
-
ini_set('max_execution_time',360);// 6 minutes: default mastodon ratelimits: https://docs.joinmastodon.org/api/rate-limits/
$conf=['link'=>"\n\n[This post was split using ".SREPO.']'];
if (file_exists(CONFFN)) {
@@ -492,7 +495,7 @@ echo "
-
+