feat: 状态栏显示当前生效地址(远程用户实际使用)

This commit is contained in:
3970260761 committed 2026-11-09 12:01:59 +08:00
1 parent 5d150755dd
commit 3719d57269
2 files changed
+13

No files matched your search

+9
View File
@@ -409,7 +409,16 @@ def run_check():
s.append(f"✗ NPS {nps_server} 不可达")
with lock:
# 当前生效: 每个域名最后被更新到的目标 (即远程用户实际使用的地址)
_active = {}
for c in connected:
if c.get("domain"):
for d in str(c["domain"]).split(", "):
d = d.strip()
if d:
_active[d] = {"target": c.get("target"), "type": c.get("type")}
STATUS["connected"] = connected
STATUS["active"] = [{"domain": d, "target": v["target"], "type": v["type"]} for d, v in _active.items()]
STATUS["last_run"] = time.strftime("%Y-%m-%d %H:%M:%S")
_det_msg = " | ".join(s)
_det_level = "warn" if "✗" in _det_msg else "info"
+4
View File
@@ -280,6 +280,10 @@ async function poll(){
html+=row('EasyTier',s.easytier);
html+=row('NPS',s.nps);
html+=`<div>上次检测: ${s.last_run||'-'}</div>`;
if((s.active||[]).length){
html+=`<div style="margin-top:6px;font-weight:bold">当前生效(远程用户实际使用的地址):</div>`;
(s.active||[]).forEach(a=>{html+=`<div class="status ok">${a.domain} → ${a.target} (${a.type})</div>`;});
}
document.getElementById('st').innerHTML=html;
const tb=document.getElementById('conn');tb.innerHTML='';
(s.connected||[]).forEach(c=>{const tr=document.createElement('tr');tr.innerHTML=`<td>${c.type}</td><td>${c.target||''}</td><td>${c.domain||''}</td>`;tb.appendChild(tr);});