Files
ykxmz/_build/repair_test_get.py
T
xmz7891 b62ac865ea 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 + 双连接

文档
- 许可协议 / 安装前必读 / 安装后须知(作者:小麦子)
2026-10-06 19:01:05 +08:00

75 lines
2.3 KiB
Python

# -*- coding: utf-8 -*-
"""修上一个补丁弄坏的 get()。
坏成了这样(缩进错 + 多了一个 as resp):
try:
_req = urllib.request.Request(URL + path, headers=_UA)
with urllib.request.urlopen(_req, timeout=timeout) as resp: as resp:
return resp.status, resp.read(), 0.0
应该是:
try:
_req = urllib.request.Request(URL + path, headers=_UA)
with urllib.request.urlopen(_req, timeout=timeout) as resp:
return resp.status, resp.read(), 0.0
"""
from __future__ import annotations
import ast
import re
import sys
from pathlib import Path
TESTS = Path(r"C:\Users\shu\Desktop\deepseekagent\LanRemote\_tests")
FILES = ["test_relay_e2e.py", "test_relay_local.py", "test_relay_admin_login.py"]
# 坏掉的那两块
BROKEN = re.compile(
r" try:\n"
r"(?P<build> _req = urllib\.request\.Request\([^\n]*\n)"
r" with urllib\.request\.urlopen\(_req, (?P<timeout>timeout=[^)]*)\) "
r"as resp: as resp:\n"
r" return resp\.status, resp\.read\(\), 0\.0\n")
def main() -> int:
ok = True
for name in FILES:
path = TESTS / name
if not path.is_file():
continue
text = path.read_text(encoding="utf-8")
def rebuild(match):
return (" try:\n"
+ match.group("build")
+ f" with urllib.request.urlopen(_req, "
f"{match.group('timeout')}) as resp:\n"
" return resp.status, resp.read(), 0.0\n")
new_text, count = BROKEN.subn(rebuild, text)
if count == 0:
# 也许已经是对的,检查一下语法就行
try:
ast.parse(text)
print(f" {name}: 没有坏块,语法 OK")
except SyntaxError as exc:
print(f" {name}: 语法仍错 -> {exc}")
ok = False
continue
path.write_text(new_text, encoding="utf-8", newline="\n")
try:
ast.parse(new_text)
print(f" {name}: 修好 {count} 处,语法 OK")
except SyntaxError as exc:
print(f" {name}: 修完还是错 -> {exc}")
ok = False
return 0 if ok else 1
if __name__ == "__main__":
sys.exit(main())