mirror of
https://gitee.com/xmz7891/ykxmz.git
synced 2026-10-18 12:30:44 +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 + 双连接 文档 - 许可协议 / 安装前必读 / 安装后须知(作者:小麦子)
96 lines
3.4 KiB
Python
96 lines
3.4 KiB
Python
# -*- coding: utf-8 -*-
|
||
"""系统性核对:手表从回复里读的每个 key,服务端到底发没发。
|
||
|
||
这类"键名对不上"的 bug 不会报错,只会让功能静默失败 ——
|
||
用户看到的就是"这个功能不能用"。
|
||
"""
|
||
from __future__ import annotations
|
||
|
||
import re
|
||
import sys
|
||
from pathlib import Path
|
||
|
||
ROOT = Path(r"C:\Users\shu\Desktop\deepseekagent\LanRemote")
|
||
SERVER = ROOT / "windows" / "lanremote" / "server.py"
|
||
MAIN = ROOT / "android" / "src" / "com" / "lanremote" / "watch" / "MainActivity.java"
|
||
|
||
|
||
def server_reply_keys() -> dict:
|
||
"""从 server.py 里抠出每个 cmd 分支返回的 key。"""
|
||
text = SERVER.read_text(encoding="utf-8")
|
||
out: dict = {}
|
||
# 找 if cmd == P.CMD_XXX: ... 到下一个 if cmd ==
|
||
blocks = re.split(r"\n if cmd == P\.(\w+):", text)
|
||
for i in range(1, len(blocks), 2):
|
||
name = blocks[i]
|
||
body = blocks[i + 1]
|
||
keys = set(re.findall(r'"(\w+)":', body))
|
||
# 只保留这个分支自己的(到下一个 def 或缩进变浅为止)
|
||
body = body.split("\n def ")[0]
|
||
keys = set(re.findall(r'"(\w+)":', body))
|
||
out[name] = keys
|
||
return out
|
||
|
||
|
||
def app_reads() -> dict:
|
||
"""手表从回复里读了哪些 key。"""
|
||
text = MAIN.read_text(encoding="utf-8")
|
||
out: dict = {}
|
||
# Json.list(reply, "key") / Json.str(reply, "key") / Json.bool(reply, "key")
|
||
for match in re.finditer(
|
||
r'Json\.(list|str|bool|integer|mapList)\(\s*(\w+)\s*,\s*"(\w+)"', text):
|
||
out.setdefault(match.group(3), set()).add(match.group(2))
|
||
# stringList(reply, "key")
|
||
for match in re.finditer(r'stringList\(\s*(\w+)\s*,\s*"(\w+)"', text):
|
||
out.setdefault(match.group(2), set()).add(match.group(1))
|
||
return out
|
||
|
||
|
||
def main() -> int:
|
||
server = server_reply_keys()
|
||
reads = app_reads()
|
||
|
||
# 服务端发出去的所有 key
|
||
all_server_keys = set()
|
||
for keys in server.values():
|
||
all_server_keys |= keys
|
||
|
||
print(f" 服务端 {len(server)} 个命令分支")
|
||
print(f" 手表读了 {len(reads)} 个不同的 key")
|
||
print()
|
||
|
||
print("=" * 74)
|
||
print("手表读了、但服务端**任何地方都没发过**的 key(一定是 bug)")
|
||
print("=" * 74)
|
||
missing = []
|
||
# 这些是本地对象或通用字段,不算
|
||
KNOWN_LOCAL = {"cmd", "ok", "error", "event", "note", "type", "seq",
|
||
"last", "data", "name", "text", "title", "path", "size",
|
||
"index", "count", "time", "code", "token", "serverName",
|
||
"deviceId", "deviceName", "needPair", "version", "proto",
|
||
"host", "port", "ips", "wifi", "files", "features",
|
||
"groups", "pong", "os", "screen", "message"}
|
||
for key in sorted(reads):
|
||
if key in all_server_keys or key in KNOWN_LOCAL:
|
||
continue
|
||
missing.append(key)
|
||
print(f" {key:<20} 被这些变量读: {', '.join(sorted(reads[key]))}")
|
||
|
||
if not missing:
|
||
print(" (没有)")
|
||
|
||
print()
|
||
print("=" * 74)
|
||
print("每个命令实际发出的 key —— 重点看那几个已知对不上的")
|
||
print("=" * 74)
|
||
for cmd in ("CMD_VOICE_LIST", "CMD_AUDIO_LIST", "CMD_CLIP_HISTORY",
|
||
"CMD_FILE_LIST", "CMD_PROC_LIST", "CMD_FEATURE_LIST",
|
||
"CMD_INFO", "CMD_PERF", "CMD_DISK", "CMD_BATTERY"):
|
||
if cmd in server:
|
||
print(f" {cmd:<22} -> {sorted(server[cmd])}")
|
||
return 0
|
||
|
||
|
||
if __name__ == "__main__":
|
||
sys.exit(main())
|