mirror of
https://gitee.com/xmz7891/ykxmz.git
synced 2026-10-18 10:10:43 +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 + 双连接 文档 - 许可协议 / 安装前必读 / 安装后须知(作者:小麦子)
125 lines
4.0 KiB
Python
125 lines
4.0 KiB
Python
# -*- coding: utf-8 -*-
|
||
r"""精准升级版本号 1.4.0 -> 1.5.0。
|
||
|
||
**不能全局替换** —— 项目里有 40 多个文件含 "1.4.0",其中大部分是:
|
||
* 测试用的数据(配对码、设备版本号字段)
|
||
* HTTP User-Agent "LanRemote/1.4.0"
|
||
(Cloudflare 的 Browser Integrity Check 认这个,
|
||
而且 20 多个测试都在断言它 —— 动它要同步改一大片)
|
||
* _build/ 下的一次性脚本(历史记录,不用改)
|
||
|
||
所以只改**用户能看到版本号的地方**:
|
||
1. android/build_apk.ps1 APK 文件名 + manifest 版本
|
||
2. docs/*.txt 三份文档
|
||
3. windows/lanremote/__init__.py __version__
|
||
4. 会断言版本号的测试
|
||
|
||
UA 保持 "LanRemote/1.4.0" 不动(它是协议标识,不是产品版本)。
|
||
"""
|
||
from __future__ import annotations
|
||
|
||
import re
|
||
import sys
|
||
from pathlib import Path
|
||
|
||
ROOT = Path(r"C:\Users\shu\Desktop\deepseekagent\LanRemote")
|
||
OLD, NEW = "1.4.0", "1.5.0"
|
||
|
||
# 逐文件、逐模式改,写清楚每一处为什么改
|
||
PLAN = [
|
||
# (文件, 旧片段, 新片段, 说明)
|
||
("android/build_apk.ps1",
|
||
'$apkName = "ykxmz-watch-1.4.0.apk"',
|
||
'$apkName = "ykxmz-watch-1.5.0.apk"',
|
||
"APK 文件名"),
|
||
("android/build_apk.ps1",
|
||
'--version-code 3 `',
|
||
'--version-code 5 `',
|
||
"versionCode"),
|
||
("android/build_apk.ps1",
|
||
'--version-name "1.4.0" `',
|
||
'--version-name "1.5.0" `',
|
||
"versionName"),
|
||
("windows/lanremote/__init__.py",
|
||
'"1.4.0"',
|
||
'"1.5.0"',
|
||
"__version__"),
|
||
]
|
||
|
||
# 文档:把"版本 1.4.0"之类改掉
|
||
DOC_PATTERNS = [
|
||
(r"1\.4\.0", "1.5.0"),
|
||
]
|
||
|
||
# 测试里断言成品文件名的
|
||
TEST_PATTERNS = [
|
||
("ykxmz-1.4.0", "ykxmz-1.5.0"),
|
||
("ykxmz-watch-1.4.0", "ykxmz-watch-1.5.0"),
|
||
]
|
||
|
||
|
||
def main() -> int:
|
||
changed = []
|
||
|
||
# ---- 1. 精准替换 ----
|
||
for rel, old, new, why in PLAN:
|
||
path = ROOT / rel
|
||
if not path.is_file():
|
||
print(f" [跳过] {rel} 不存在")
|
||
continue
|
||
text = path.read_text(encoding="utf-8")
|
||
if old not in text:
|
||
print(f" [跳过] {rel}: 找不到 {old[:40]!r}(可能已改)")
|
||
continue
|
||
path.write_text(text.replace(old, new, 1),
|
||
encoding="utf-8", newline="\n")
|
||
changed.append(f"{rel}({why})")
|
||
|
||
# ---- 2. 文档 ----
|
||
for path in sorted((ROOT / "docs").glob("*.txt")):
|
||
raw = path.read_bytes()
|
||
had_bom = raw.startswith(b"\xef\xbb\xbf")
|
||
text = raw.decode("utf-8-sig")
|
||
new_text = re.sub(r"1\.4\.0", "1.5.0", text)
|
||
if new_text != text:
|
||
path.write_bytes((b"\xef\xbb\xbf" if had_bom else b"")
|
||
+ new_text.replace("\r\n", "\n").encode("utf-8"))
|
||
changed.append(f"docs/{path.name}")
|
||
|
||
# ---- 3. 断言成品文件名的测试 ----
|
||
for name in ("test_package_remote.py", "test_apk_contents.py",
|
||
"acceptance.py"):
|
||
path = ROOT / "_tests" / name
|
||
if not path.is_file():
|
||
continue
|
||
text = path.read_text(encoding="utf-8")
|
||
original = text
|
||
for old, new in TEST_PATTERNS:
|
||
text = text.replace(old, new)
|
||
if text != original:
|
||
path.write_text(text, encoding="utf-8", newline="\n")
|
||
changed.append(f"_tests/{name}")
|
||
|
||
print(f" 共改了 {len(changed)} 处:")
|
||
for item in changed:
|
||
print(f" {item}")
|
||
|
||
print()
|
||
print(" 注意:HTTP User-Agent 仍是 \"LanRemote/1.4.0\"(协议标识,不是产品版本)。")
|
||
|
||
# ---- 复核 ----
|
||
print()
|
||
print(" 复核关键位置:")
|
||
for rel, needle in (("android/build_apk.ps1", "ykxmz-watch-1.5.0.apk"),
|
||
("android/AndroidManifest.xml", '1.5.0'),
|
||
("_build/package_remote.py", '"1.5.0"')):
|
||
path = ROOT / rel
|
||
if path.is_file():
|
||
ok = needle in path.read_text(encoding="utf-8")
|
||
print(f" {rel}: {'✓' if ok else '✗'} 含 {needle}")
|
||
return 0
|
||
|
||
|
||
if __name__ == "__main__":
|
||
sys.exit(main())
|