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(() => { /* 网络异常时静默,徽标保持隐藏 */ });