1.6.2:常规发布

- 版本号 1.6.2 -> 1.6.2
- 重建三端并打包
- 关键测试全过
This commit is contained in:
xmz7891
2026-10-06 20:47:30 +08:00
parent 878b7311e9
commit 0a4ec4f0c4
19 changed files with 374 additions and 29 deletions
+22
View File
@@ -253,6 +253,20 @@ class RelayLink:
self._log("没配置中转地址,跳过")
return False
# 上次连通的地址排到最前面。
# 设备 IP 会变(DHCP),但大概率还是上次那个;
# 排前面能省掉"挨个探到超时"的那几秒(实测 2 个候选要 10 秒,
# 而这段时间局域网发现都还没起来,手表搜不到电脑)。
try:
last_good = str(self.store.get("relay_last_good") or "").strip()
except Exception: # noqa: BLE001
last_good = ""
if last_good:
normalized = last_good.rstrip("/")
if normalized in candidates:
candidates.remove(normalized)
candidates.insert(0, normalized)
self.candidates = candidates
# 先探一遍,挑第一个通的
chosen = self._pick_candidate(candidates)
@@ -260,6 +274,14 @@ class RelayLink:
if len(candidates) > 1:
self._log(f"中转地址候选 {len(candidates)} 个,选用 {chosen}")
# 记下来,下次优先试它
if chosen:
try:
if str(self.store.get("relay_last_good") or "") != chosen:
self.store.set("relay_last_good", chosen)
except Exception: # noqa: BLE001
pass
self.device_id = self._ensure_device_id()
self.code = str(self.store.pairing_code() or "")