From 9cccbba3bd5ae0b4b66f7bc2d33ce3d6458359a6 Mon Sep 17 00:00:00 2001 From: dsh Date: Mon, 17 Aug 2026 23:13:54 -0400 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=89=93=E5=BC=80=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E7=AB=8B=E5=8D=B3=E6=98=BE=E7=A4=BA=E5=85=AC=E7=BD=91=20IP=20?= =?UTF-8?q?=E4=B8=8E=E5=9C=B0=E5=8C=BA=EF=BC=88=E6=97=A0=E9=9C=80=E7=AD=89?= =?UTF-8?q?=E6=B5=8B=E9=80=9F=E5=AE=8C=E6=88=90=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/web/templates/index.html | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/internal/web/templates/index.html b/internal/web/templates/index.html index 5d2e227..9cc7951 100644 --- a/internal/web/templates/index.html +++ b/internal/web/templates/index.html @@ -557,14 +557,7 @@ async function runTest() { updateGaugeSpeed(upload); markDone(document.getElementById('cardUpload')); - // 4. 展示 IP 与地区(页面上方徽标;排行榜不展示 IP) - try { - const pr = await fetch('/api/ping?t=' + Date.now(), { cache: 'no-store' }); - const pi = await pr.json(); - showMyIP(pi.client_ip || '', pi.location || ''); - } catch (e) { /* ignore */ } - - // 5. 提交(记录我的成绩 ID,用于排行榜高亮) + // 4. 提交(记录我的成绩 ID,用于排行榜高亮) setPhase('正在提交结果…'); const res = await submitResult({ latency, jitter, download, upload }); if (res && res.id) { @@ -589,6 +582,12 @@ startBtn.addEventListener('click', runTest); drawGauge(0); updateSortHeaders(); loadRankings(); + +// 打开页面立即显示 IP 与地区(无需等待测速) +fetch('/api/ping?t=' + Date.now(), { cache: 'no-store' }) + .then(r => r.json()) + .then(d => showMyIP(d.client_ip || '', d.location || '')) + .catch(() => { /* 网络异常时静默,徽标保持隐藏 */ });