Files
ykxmz/_build/rename_apk.py
T
xmz7891 b705216e4a ykxmz 1.5.0锛氫慨澶嶆墜琛ㄧ TLS 璇佷功鏍¢獙 + MTU 淇缃戠粶绋冲畾鎬?
琚帶绔?- 淇 MTU 闂锛氬す MSS + 璺緞 MTU 鎺㈡祴锛堝叕缃戝彲鐢ㄧ巼 48% -> 100%锛?- 澶嶇敤 HTTP 杩炴帴锛堝厤鎺夋瘡娆℃柊寤?TLS 鐨?30% 鎻℃墜澶辫触锛?- 姣忓垎閽熷洖澶存壘灞€鍩熺綉锛岃嚜鍔ㄥ垏鍥炲揩 400 鍊嶇殑璺緞
- 鐢婚潰蹇冭烦甯э細闈欐鏃剁渷娴侀噺锛屽鎴风浠嶇煡閬撴祦鏄椿鐨?- 閿佸睆鏃剁粰鍑哄彲鎿嶄綔鐨勬彁绀?
鎵嬭〃绔?- 鍐呯疆 GTS Root R4 / GlobalSign Root CA锛屼慨 SSLHandshakeException
- 杩炴帴閿欒缈昏瘧鎴愪汉璇濓紙璇佷功/鏃堕棿/瑙f瀽/瓒呮椂鍒嗗埆鎻愮ず锛?- 缁忎腑杞繛涓婂悗鐢ㄦ湇鍔″櫒鎶ョ殑鍦板潃鍒锋柊宸查厤瀵硅褰?- 鏂板灞€鍩熺綉杩炴帴椤甸潰銆佹湇鍔″櫒寤惰繜妫€娴?
鏈嶅姟鍣ㄧ
- 鏀寔 chunked 璇锋眰浣擄紙淇瘡 16 绉掍竴娆$殑杩炴帴閿欎贡涓庡ぇ闈㈢Н 502锛?- 缃戠粶璋冧紭鑴氭湰 net-tune.sh锛堝紑鏈鸿嚜鍔ㄥ簲鐢級
- 绠$悊椤碉細鎵归噺鍒犻櫎銆佺綉缁滀綋妫€銆佷笅杞藉尯
- 闅ч亾鏀?HTTP/2 + 鍙岃繛鎺?
鏂囨。
- 璁稿彲鍗忚 / 瀹夎鍓嶅繀璇?/ 瀹夎鍚庨』鐭ワ紙浣滆€咃細灏忛害瀛愶級
2026-10-06 19:01:05 +08:00

105 lines
3.7 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -*- coding: utf-8 -*-
"""把 APK 名字统一成 ykxmz-watch,并修掉测试里的硬编码旧名。
用户要求:"名字不要带中文,就 ykxmz"
APK 现在叫 LanRemote-Watch-1.4.0.apk —— 是新名之前留下的,
和 ykxmz 不一致。改成 ykxmz-watch-1.4.0.apk。
顺带:
* test_apk_contents.py 里硬编码了 1.3.0,改成跟着版本走
* 两个测试都改成"扫 dist 目录找最新 apk",别再写死版本号
(写死的老是升级一次就坏一次,已经踩过好几回了)
"""
from __future__ import annotations
import sys
from pathlib import Path
ROOT = Path(r"C:\Users\shu\Desktop\deepseekagent\LanRemote")
BUILD = ROOT / "android" / "build_apk.ps1"
PKG = ROOT / "_build" / "package_remote.py"
APK_TEST = ROOT / "_tests" / "test_apk_contents.py"
NEW_NAME = "ykxmz-watch-1.4.0.apk"
def main() -> int:
ok = True
# ---------- 1. build_apk.ps1(保持 BOM)----------
raw = BUILD.read_bytes()
had_bom = raw.startswith(b"\xef\xbb\xbf")
text = raw.decode("utf-8-sig")
old = '$apkName = "LanRemote-Watch-1.4.0.apk"'
new = '$apkName = "ykxmz-watch-1.4.0.apk"'
if old in text:
text = text.replace(old, new, 1)
BUILD.write_bytes((b"\xef\xbb\xbf" if had_bom else b"")
+ text.replace("\r\n", "\n").encode("utf-8"))
print(f" build_apk.ps1: APK 改名(BOM {'保留' if had_bom else '无'})")
elif new in text:
print(" build_apk.ps1: 已经是新名")
else:
print(" [失败] build_apk.ps1 找不到 apkName")
ok = False
# ---------- 2. package_remote.py ----------
text = PKG.read_text(encoding="utf-8")
old = 'APK_SRC = ROOT / "dist" / f"LanRemote-Watch-{VERSION}.apk"'
new = 'APK_SRC = ROOT / "dist" / f"ykxmz-watch-{VERSION}.apk"'
if old in text:
text = text.replace(old, new, 1)
PKG.write_text(text, encoding="utf-8", newline="\n")
print(" package_remote.py: APK 路径已更新")
elif new in text:
print(" package_remote.py: 已经是新名")
else:
print(" [警告] package_remote.py 里没找到 APK_SRC")
# ---------- 3. test_apk_contents.py ----------
text = APK_TEST.read_text(encoding="utf-8")
old = 'APK = ROOT / "dist" / "LanRemote-Watch-1.3.0.apk"'
new = '''# 别写死版本号 —— 一升级就坏(这坑踩过好几回了)。
# 直接扫 dist 里最新的手表 APK。
def _latest_apk() -> Path:
candidates = sorted(
(ROOT / "dist").glob("*watch*.apk"),
key=lambda p: p.stat().st_mtime, reverse=True)
return candidates[0] if candidates else \\
ROOT / "dist" / "ykxmz-watch-1.4.0.apk"
APK = _latest_apk()'''
if old in text:
text = text.replace(old, new, 1)
APK_TEST.write_text(text, encoding="utf-8", newline="\n")
print(" test_apk_contents.py: 改成动态找最新 APK")
else:
print(" [警告] test_apk_contents.py 锚点没找到")
# ---------- 4. 语法 ----------
import ast
for label, path in (("package_remote.py", PKG),
("test_apk_contents.py", APK_TEST)):
try:
ast.parse(path.read_text(encoding="utf-8"))
print(f" {label} 语法 OK")
except SyntaxError as exc:
print(f" {label} 语法错误: {exc}")
ok = False
# ---------- 5. 删掉旧的 1.4.0 apk ----------
for stale in ("LanRemote-Watch-1.4.0.apk",
"LanRemote-Watch-1.4.0.apk.idsig"):
path = ROOT / "dist" / stale
if path.exists():
path.unlink()
print(f" 删掉旧文件 {stale}")
return 0 if ok else 1
if __name__ == "__main__":
sys.exit(main())