Update index.html
Fix random server order: use /datalist (ordered) instead of /data (unordered HashMap)
This commit is contained in:
10
index.html
10
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);
|
||||
|
||||
Reference in New Issue
Block a user