diff --git a/index.html b/index.html index 79c0685..a554542 100644 --- a/index.html +++ b/index.html @@ -461,10 +461,14 @@ async function fetchData() { const params = new URLSearchParams({ page: 0, limit: 100 }); if (!withTor) params.append("onion", "no"); try { - const response = await fetch(`/data/${chain}?${params}`); + // NOTE: /data/{chain} returns a HashMap, whose JSON key order is not + // guaranteed (it can change on every backend restart). /datalist/{chain} + // returns an ordered array (Vec) that preserves the server-side sort + // (donation DESC, balance DESC, base_fee ASC, wetime_points DESC) — see terms.html §3. + const response = await fetch(`/datalist/${chain}?${params}`); if (!response.ok) throw new Error(`HTTP ${response.status}`); - const obj = await response.json(); - allServers = Object.entries(obj).map(([key, s]) => ({ id: key, ...s })); + const list = await response.json(); + allServers = list; render(); } catch (err) { console.error('Fetch error:', err);