From a6ea23ff5fce3c5c70c48322e6922f7e927a47ab Mon Sep 17 00:00:00 2001 From: bitcoinafterlife Date: Fri, 17 Jul 2026 11:05:00 +0000 Subject: [PATCH] Update index.html Fix random server order: use /datalist (ordered) instead of /data (unordered HashMap) --- index.html | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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);