mirror of
https://gitee.com/xmz7891/ykxmz.git
synced 2026-10-18 17:10:43 +00:00
手表端
- 内置 GTS Root R4 / GlobalSign Root CA
修 SSLHandshakeException: Chain validation failed
- 连接错误翻译成人话:证书 / 时间 / 解析 / 超时分别给提示
- 经中转连上后用服务器报的地址刷新已配对记录
- 版本号 1.3.0 -> 1.5.0(AndroidManifest 之前漏改了)
服务器端
- 支持 chunked 请求体,修每 16 秒一次的连接错乱与大面积 502
- 网络调优 net-tune.sh(开机自动应用)
- 新增下载区,管理页加下载卡片
- 隧道改 HTTP/2 + 双连接
打包方式变更
- 从一个合并 zip 改成三个独立产物:
ykxmz-agent-*.zip 被控端
ykxmz-server-*.zip 服务器端
ykxmz-watch-*.apk 控制端
78 lines
2.2 KiB
Python
78 lines
2.2 KiB
Python
# -*- coding: utf-8 -*-
|
|
r"""把 TlsCompat.java 加进各处的 Java 编译清单。
|
|
|
|
背景:
|
|
RelayTransport 改成用 TlsCompat.open() 之后,
|
|
那些"只编译一部分 java"的地方就编译不过了 ——
|
|
它们没有把 TlsCompat.java 列进去。
|
|
|
|
需要补的三处:
|
|
_tests/test_package_remote.py
|
|
_tests/test_watch_lan_switch.py
|
|
_tests/verify_all.ps1
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import re
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(r"C:\Users\shu\Desktop\deepseekagent\LanRemote")
|
|
|
|
TARGETS = [
|
|
ROOT / "_tests" / "test_package_remote.py",
|
|
ROOT / "_tests" / "test_watch_lan_switch.py",
|
|
ROOT / "_tests" / "verify_all.ps1",
|
|
]
|
|
|
|
|
|
def patch(path: Path) -> bool:
|
|
raw = path.read_bytes()
|
|
had_bom = raw.startswith(b"\xef\xbb\xbf")
|
|
text = raw.decode("utf-8-sig")
|
|
|
|
if "TlsCompat.java" in text:
|
|
print(f" {path.name}: 已经有了")
|
|
return True
|
|
|
|
# 在 RelayTransport.java 那一行后面插一行同格式的 TlsCompat.java
|
|
pattern = re.compile(
|
|
r"([ \t]*(?:\(Join-Path \$root )?[\"']?[^\n\"']*RelayTransport\.java[\"']?\)?\,?[ \t]*\r?\n)")
|
|
match = pattern.search(text)
|
|
if not match:
|
|
print(f" [失败] {path.name}: 找不到 RelayTransport.java 那一行")
|
|
return False
|
|
|
|
line = match.group(1)
|
|
indent = re.match(r"[ \t]*", line).group(0)
|
|
# 保留原来的包裹形式
|
|
if "Join-Path" in line:
|
|
new_line = f'{indent}(Join-Path $root "android\\src\\com\\lanremote\\watch\\TlsCompat.java")`\n'
|
|
elif '"' in line:
|
|
new_line = f'{indent}"TlsCompat.java",\n' if line.rstrip().endswith(",") \
|
|
else f'{indent}"TlsCompat.java"\n'
|
|
else:
|
|
new_line = f'{indent}TlsCompat.java\n'
|
|
|
|
text = text[:match.end(1)] + new_line + text[match.end(1):]
|
|
|
|
body = text.replace("\r\n", "\n").encode("utf-8")
|
|
path.write_bytes((b"\xef\xbb\xbf" if had_bom else b"") + body)
|
|
print(f" {path.name}: 补上了 TlsCompat.java")
|
|
return True
|
|
|
|
|
|
def main() -> int:
|
|
ok = True
|
|
for path in TARGETS:
|
|
if not path.is_file():
|
|
print(f" [跳过] {path.name} 不存在")
|
|
continue
|
|
if not patch(path):
|
|
ok = False
|
|
return 0 if ok else 1
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|