Files
ykxmz/_build/add_tls_to_compiles2.py
xmz7891 8111fb6d97 ykxmz 1.5.0:手表端 TLS 证书兼容 + 三端分开打包 + 下载区
手表端
- 内置 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    控制端
2026-10-06 23:08:05 +08:00

72 lines
2.7 KiB
Python

# -*- coding: utf-8 -*-
r"""精确补上 TlsCompat.java(上一版正则没匹配上)。
两处的实际写法:
test_package_remote.py:
for n in ("Json.java", "B64.java", "Transport.java",
"RelayTransport.java", "RemoteClient.java",
"DiscoveryCore.java")]
verify_all.ps1:
(Join-Path $root "android\src\com\lanremote\watch\RelayTransport.java") `
"""
from __future__ import annotations
import sys
from pathlib import Path
ROOT = Path(r"C:\Users\shu\Desktop\deepseekagent\LanRemote")
PY_OLD = ''' sources = [ROOT / "android" / "src" / "com" / "lanremote" / "watch" / n
for n in ("Json.java", "B64.java", "Transport.java",
"RelayTransport.java", "RemoteClient.java",
"DiscoveryCore.java")]'''
PY_NEW = ''' sources = [ROOT / "android" / "src" / "com" / "lanremote" / "watch" / n
for n in ("Json.java", "B64.java", "Transport.java",
"RelayTransport.java", "TlsCompat.java",
"RemoteClient.java",
"DiscoveryCore.java")]'''
PS1_OLD = ''' (Join-Path $root "android\\src\\com\\lanremote\\watch\\RelayTransport.java") `'''
PS1_NEW = ''' (Join-Path $root "android\\src\\com\\lanremote\\watch\\RelayTransport.java") `
# TlsCompat:内置根证书,修老手表 SSLHandshakeException
(Join-Path $root "android\\src\\com\\lanremote\\watch\\TlsCompat.java") `'''
def main() -> int:
ok = True
path = ROOT / "_tests" / "test_package_remote.py"
text = path.read_text(encoding="utf-8")
if "TlsCompat.java" in text:
print(" test_package_remote.py: 已经有了")
elif PY_OLD in text:
path.write_text(text.replace(PY_OLD, PY_NEW, 1),
encoding="utf-8", newline="\n")
print(" test_package_remote.py: 补上 TlsCompat.java")
else:
print(" [失败] test_package_remote.py 锚点没找到")
ok = False
path = ROOT / "_tests" / "verify_all.ps1"
raw = path.read_bytes()
had_bom = raw.startswith(b"\xef\xbb\xbf")
text = raw.decode("utf-8-sig")
if "TlsCompat.java" in text:
print(" verify_all.ps1: 已经有了")
elif PS1_OLD in text:
text = text.replace(PS1_OLD, PS1_NEW, 1)
path.write_bytes((b"\xef\xbb\xbf" if had_bom else b"")
+ text.replace("\r\n", "\n").encode("utf-8"))
print(" verify_all.ps1: 补上 TlsCompat.java")
else:
print(" [失败] verify_all.ps1 锚点没找到")
ok = False
return 0 if ok else 1
if __name__ == "__main__":
sys.exit(main())