mirror of
https://gitee.com/xmz7891/ykxmz.git
synced 2026-10-18 19:30:42 +00:00
被控端 - 修复 MTU 问题:夹 MSS + 路径 MTU 探测(公网可用率 48% -> 100%) - 复用 HTTP 连接(免掉每次新建 TLS 的 30% 握手失败) - 每分钟回头找局域网,自动切回快 400 倍的路径 - 画面心跳帧:静止时省流量,客户端仍知道流是活的 - 锁屏时给出可操作的提示 手表端 - 内置 GTS Root R4 / GlobalSign Root CA,修 SSLHandshakeException - 连接错误翻译成人话(证书/时间/解析/超时分别提示) - 经中转连上后用服务器报的地址刷新已配对记录 - 新增局域网连接页面、服务器延迟检测 服务器端 - 支持 chunked 请求体(修每 16 秒一次的连接错乱与大面积 502) - 网络调优脚本 net-tune.sh(开机自动应用) - 管理页:批量删除、网络体检、下载区 - 隧道改 HTTP/2 + 双连接 文档 - 许可协议 / 安装前必读 / 安装后须知(作者:小麦子)
78 lines
2.8 KiB
Python
78 lines
2.8 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""修 test_boot_silent.py 里被我改坏的那一段。
|
|
|
|
背景:
|
|
开机静默运行时,如果配对码被别的设备占了,被控端会弹通知
|
|
(这是新功能,用户要求的)。但旧断言要求"开机后一个窗口都没有",
|
|
于是新功能一工作测试就失败。
|
|
|
|
正确的断言是:**允许临时通知窗口,但不许有常驻的控制窗口**。
|
|
|
|
上一次修改时缩进没处理好,还叠了三引号,用 PowerShell 传就炸了。
|
|
这次老老实实写文件。
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import ast
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
TARGET = Path(r"C:\Users\shu\Desktop\deepseekagent\LanRemote\_tests"
|
|
r"\test_boot_silent.py")
|
|
|
|
# 好的一段(缩进 8 空格,和周围对齐)
|
|
GOOD = [
|
|
" # 通知窗口是**应该**出现的:比如配对码被别的设备占了,\n",
|
|
" # 必须让用户看到「该配对码已被使用,请换一个配对码」,\n",
|
|
" # 否则用户永远不知道为什么连不上。\n",
|
|
" # 要保证的是:除了这种临时通知,没有常驻的控制窗口。\n",
|
|
' notices = [w for w in visible if "通知" in (w.get("title") or "")]\n',
|
|
" others = [w for w in visible if w not in notices]\n",
|
|
" if notices:\n",
|
|
' print(f" (有 {len(notices)} 个通知窗口,这是对的"\n',
|
|
' f" —— 说明它在提示用户什么事)")\n',
|
|
' check("★ 开机后没有常驻的控制窗口", not others, str(others[:3]))\n',
|
|
]
|
|
|
|
|
|
def main() -> int:
|
|
lines = TARGET.read_text(encoding="utf-8").splitlines(keepends=True)
|
|
|
|
# 找出要被替换的区间:从"通知窗口是"那行开始,到 check("★ ... 那行结束
|
|
start = end = None
|
|
for index, line in enumerate(lines):
|
|
if "通知窗口是" in line and start is None:
|
|
start = index
|
|
if start is not None and "开机后没有常驻的控制窗口" in line:
|
|
end = index
|
|
break
|
|
|
|
if start is None or end is None:
|
|
print(" [失败] 找不到要替换的区间")
|
|
return 1
|
|
|
|
print(f" 替换第 {start + 1} 到 {end + 1} 行({end - start + 1} 行)")
|
|
lines[start:end + 1] = GOOD
|
|
text = "".join(lines)
|
|
|
|
try:
|
|
ast.parse(text)
|
|
except SyntaxError as exc:
|
|
print(f" 语法错误: 行 {exc.lineno}: {exc.msg}")
|
|
if exc.text:
|
|
print(f" {exc.text.rstrip()}")
|
|
return 1
|
|
|
|
TARGET.write_text(text, encoding="utf-8", newline="\n")
|
|
print(" 语法 OK,已写入")
|
|
|
|
# 复核
|
|
for index, line in enumerate(text.splitlines(), 1):
|
|
if "常驻的控制窗口" in line or "notices = " in line:
|
|
print(f" {index}: {line}")
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|