ykxmz 1.5.0:修复手表端 TLS 证书校验 + MTU 修复网络稳定性

被控端
- 修复 MTU 问题:夹 MSS + 路径 MTU 探测(公网可用率 48% -> 100%)
- 复用 HTTP 连接(免掉每次新建 TLS 的 30% 握手失败)
- 每分钟回头找局域网,自动切回快 400 倍的路径
- 画面心跳帧:静止时省流量,客户端仍知道流是活的
- 锁屏时给出可操作的提示

手表端
- 内置 GTS Root R4 / GlobalSign Root CA,修 SSLHandshakeException
- 连接错误翻译成人话(证书/时间/解析/超时分别提示)
- 经中转连上后用服务器报的地址刷新已配对记录
- 新增局域网连接页面、服务器延迟检测

服务器端
- 支持 chunked 请求体(修每 16 秒一次的连接错乱与大面积 502)
- 网络调优脚本 net-tune.sh(开机自动应用)
- 管理页:批量删除、网络体检、下载区
- 隧道改 HTTP/2 + 双连接

文档
- 许可协议 / 安装前必读 / 安装后须知(作者:小麦子)
This commit is contained in:
xmz7891
2026-10-06 19:01:05 +08:00
commit b62ac865ea
3195 changed files with 203292 additions and 0 deletions
+163
View File
@@ -0,0 +1,163 @@
# -*- coding: utf-8 -*-
"""界面重做之后的测试收尾。
* test_image_modes.py 改用 HeadlessUI(AgentUI 已删)
* test_indicator_visible.py 启动前先置 setup_done(否则会弹设置窗口)
* verify_all.ps1 去掉已删的测试阶段
"""
from __future__ import annotations
import sys
from pathlib import Path
ROOT = Path(r"C:\Users\shu\Desktop\deepseekagent\LanRemote")
TESTS = ROOT / "_tests"
# ---------------- 1. test_image_modes.py ----------------
IMAGE = TESTS / "test_image_modes.py"
IMAGE_FIXES = [
("from lanremote.ui import AgentUI # noqa: E402",
"from lanremote.headless import HeadlessUI # noqa: E402",
"改导入"),
(" agent = AgentUI(store)", " agent = HeadlessUI(store)", "改构造"),
(" try:\n agent.root.destroy()\n except tk.TclError:\n pass",
" try:\n agent.stop()\n except Exception:\n pass",
"改收尾"),
]
# ---------------- 2. test_indicator_visible.py ----------------
IND = TESTS / "test_indicator_visible.py"
IND_SEED = '''
def _seed_setup_done(data_dir):
"""这些测试测的是提示条,不是首次设置窗口。
界面重做之后,没设置过配对码就会弹设置窗口,会干扰测试,
所以先往数据目录里写一份 setup_done。
"""
import json as _json
data_dir = Path(data_dir)
data_dir.mkdir(parents=True, exist_ok=True)
settings = data_dir / "settings.json"
payload = {}
if settings.is_file():
try:
payload = _json.loads(settings.read_text(encoding="utf-8"))
except Exception:
payload = {}
payload["setup_done"] = True
settings.write_text(_json.dumps(payload, ensure_ascii=False, indent=2),
encoding="utf-8")
'''
def patch_file(path: Path, pairs) -> int:
if not path.is_file():
print(f" [跳过] {path.name} 不存在")
return 0
text = path.read_text(encoding="utf-8")
hits = 0
for old, new, tag in pairs:
if old not in text:
print(f" [跳过] {path.name} / {tag} —— 锚点没找到")
continue
text = text.replace(old, new, 1)
hits += 1
print(f" {path.name} / {tag}: OK")
if hits:
path.write_text(text, encoding="utf-8")
return hits
def main() -> int:
print("一、test_image_modes.py → HeadlessUI")
patch_file(IMAGE, IMAGE_FIXES)
print()
print("二、test_indicator_visible.py 预置 setup_done")
if IND.is_file():
text = IND.read_text(encoding="utf-8")
if "_seed_setup_done" in text:
print(" 已经加过")
else:
text = text.replace("def main() -> int:",
IND_SEED + "def main() -> int:", 1)
print(" 已插入辅助函数")
# 在启动子进程之前调用(找 Popen 前一行)
marker = " agent = subprocess.Popen("
if marker in text:
text = text.replace(
marker,
" _seed_setup_done(DATA_DIR)\n\n" + marker, 1)
print(" 已在启动前调用(用 DATA_DIR 变量名)")
IND.write_text(text, encoding="utf-8")
else:
print(" 文件不存在")
print()
print("三、verify_all.ps1 去掉已删的阶段")
va = TESTS / "verify_all.ps1"
raw = va.read_bytes()
bom = raw[:3] == b"\xef\xbb\xbf"
text = raw.decode("utf-8-sig")
# 删掉引用已删测试的整段
import re
for name in ("test_pc_gui.py", "test_simple_ui.py", "test_quit.py"):
pattern = re.compile(
r'\n# -+\s*\nBanner "[^"]*"\n(?:.*?\n)*?Record "[^"]*"[^\n]*\n',
re.M)
# 简单做法:把包含该文件名的 Banner 段整段删掉
lines = text.splitlines(keepends=True)
out = []
i = 0
removed = 0
while i < len(lines):
line = lines[i]
if name in line:
# 往上回溯,删掉这段的 Banner / Stop-Strays / 注释
while out and (out[-1].strip().startswith("#")
or out[-1].strip().startswith("Banner")
or out[-1].strip() == "Stop-Strays"
or out[-1].strip() == ""):
out.pop()
# 往下删到 Record 那一行
j = i
while j < len(lines) and 'Record "' not in lines[j]:
j += 1
i = j + 1 if j < len(lines) else len(lines)
removed += 1
continue
out.append(line)
i += 1
if removed:
text = "".join(out)
print(f" 已移除 {name} 相关阶段({removed} 处)")
data = text.encode("utf-8")
if bom:
data = b"\xef\xbb\xbf" + data
va.write_bytes(data)
print(" verify_all.ps1 已更新")
print()
print("四、语法检查")
import ast
ok = True
for path in (IMAGE, IND):
if not path.is_file():
continue
try:
ast.parse(path.read_text(encoding="utf-8"))
print(f" {path.name}: OK")
except SyntaxError as exc:
print(f" {path.name}: 语法错误 {exc}")
ok = False
return 0 if ok else 1
if __name__ == "__main__":
sys.exit(main())