mirror of
https://gitee.com/xmz7891/ykxmz.git
synced 2026-10-18 21:50:44 +00:00
琚帶绔?- 淇 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 + 鍙岃繛鎺? 鏂囨。 - 璁稿彲鍗忚 / 瀹夎鍓嶅繀璇?/ 瀹夎鍚庨』鐭ワ紙浣滆€咃細灏忛害瀛愶級
127 lines
5.2 KiB
Python
127 lines
5.2 KiB
Python
# -*- coding: utf-8 -*-
|
||
"""断言安卓端这次改造到位了。
|
||
|
||
用户要求:
|
||
1. 中转设置下面,删掉「设备诊断」,换成「输入配对码连接」
|
||
2. 局域网那套东西(搜索/手动填 IP)都删掉
|
||
3. 图标换成作者给的图
|
||
|
||
这个测试是源码级 + 产物级断言。
|
||
配合 verify_all 里的"手表 App 整体编译",
|
||
能挡住"删代码删坏了字段"这类事故。
|
||
"""
|
||
from __future__ import annotations
|
||
|
||
import re
|
||
import sys
|
||
import zipfile
|
||
from pathlib import Path
|
||
|
||
ROOT = Path(__file__).resolve().parent.parent
|
||
WATCH = ROOT / "android" / "src" / "com" / "lanremote" / "watch"
|
||
MAIN = WATCH / "MainActivity.java"
|
||
|
||
passed = 0
|
||
failed = 0
|
||
|
||
|
||
def check(name, ok, detail=""):
|
||
global passed, failed
|
||
if ok:
|
||
passed += 1
|
||
print(" [PASS] " + name)
|
||
else:
|
||
failed += 1
|
||
print(" [FAIL] " + name + " " + str(detail))
|
||
|
||
|
||
def main() -> int:
|
||
src = MAIN.read_text(encoding="utf-8")
|
||
# 去掉注释再查(注释里会提到这些名字)
|
||
code = re.sub(r"//[^\n]*", "", src)
|
||
code = re.sub(r"/\*.*?\*/", "", code, flags=re.S)
|
||
|
||
print("一、设备诊断已移除")
|
||
check("没有 openDiagPanel 的定义", "private void openDiagPanel" not in code)
|
||
check("没有 openDiagPanel 的调用", "openDiagPanel(" not in code)
|
||
check("首页没有「设备诊断」按钮",
|
||
'bigButton("连不上?点这里诊断"' not in code)
|
||
check("没有「点这里诊断」字样", "点这里诊断" not in code)
|
||
|
||
print()
|
||
print("二、局域网入口按新设计存在(但不再是旧交互)")
|
||
# 注意:早期这里断言的是"局域网那套已清掉",
|
||
# 那是用户要求删除时的版本。后来用户又要求把局域网连接加回来
|
||
# (首页 -> 局域网连接页面 -> 搜索/直连),所以这些断言反过来了。
|
||
check("首页有局域网入口",
|
||
'bigButton("局域网连接(同一个 WiFi)"' in code)
|
||
check("有独立的局域网页面", "private void buildLanPanel()" in code)
|
||
check("页面里能广播搜索", "Discovery.search(" in code)
|
||
check("用 DiscoveryCore 的结果类型", "DiscoveryCore.Found" in code)
|
||
# 局域网页面里**本来就该有**搜索按钮,所以不能断言"全代码没有"。
|
||
# (我一开始就是这么写错的。)
|
||
check("局域网页面里有搜索按钮",
|
||
'bigButton("自动搜索电脑"' in code)
|
||
# 旧交互确实不该再有:手动输入地址那一套
|
||
check("没有旧的手动输入地址按钮",
|
||
'bigButton("手动输入地址"' not in code)
|
||
check("没有 toggleManual(旧交互)", "toggleManual" not in code)
|
||
check("首页没有裸的 hostInput", "hostInput" not in code)
|
||
|
||
print()
|
||
print("三、换成了「输入配对码连接」")
|
||
check("有按钮", 'bigButton("输入配对码连接"' in code)
|
||
check("有 promptPairingCode 定义",
|
||
"private void promptPairingCode()" in code)
|
||
check("有 connectByCode 定义", "private void connectByCode(" in code)
|
||
check("点按钮会开输入框", "promptPairingCode();" in code)
|
||
check("校验必须是 6 位数字", "\\\\d{6}" in code or "\\d{6}" in code)
|
||
check("没填中转地址时会引导去设置",
|
||
"请先在「中转设置」里填服务器地址" in code)
|
||
|
||
print()
|
||
print("四、关键字段还在(防删代码时误伤)")
|
||
for field in ("busy", "mirrorStreaming", "incoming", "incomingName",
|
||
"gridColumns", "cellHeightDp", "cellTextSp", "cellQueue",
|
||
"logBuffer", "frameCount", "currentFps", "fpsWindowStart"):
|
||
declared = bool(re.search(
|
||
r"(private|volatile|final)[^;\n]*\b" + field + r"\b\s*(=|;|,)", code))
|
||
check(f"字段 {field} 有声明", declared)
|
||
|
||
print()
|
||
print("五、图标换成了作者给的图")
|
||
ico = ROOT / "windows" / "app.ico"
|
||
check("windows/app.ico 存在", ico.is_file())
|
||
if ico.is_file():
|
||
# 旧图标是 12KB 左右(自己画的),新图标带照片会大很多
|
||
check("图标是新的(不是原来那个自绘的)",
|
||
ico.stat().st_size > 50000, f"{ico.stat().st_size} 字节")
|
||
for folder in ("drawable-mdpi", "drawable-hdpi", "drawable-xhdpi",
|
||
"drawable-xxhdpi", "drawable-xxxhdpi"):
|
||
path = ROOT / "android" / "res" / folder / "ic_launcher.png"
|
||
check(f"安卓图标 {folder} 存在", path.is_file())
|
||
old_xml = ROOT / "android" / "res" / "drawable" / "ic_launcher.xml"
|
||
check("旧的矢量图标已删除", not old_xml.is_file())
|
||
|
||
print()
|
||
print("六、APK 里带上了新图标")
|
||
apks = sorted((ROOT / "dist").glob("*watch*.apk"),
|
||
key=lambda p: p.stat().st_mtime, reverse=True)
|
||
if apks:
|
||
with zipfile.ZipFile(apks[0]) as archive:
|
||
names = archive.namelist()
|
||
icons = [n for n in names if "ic_launcher" in n]
|
||
check(f"APK 里有图标资源({len(icons)} 个)", bool(icons),
|
||
names[:6])
|
||
else:
|
||
check("找到 APK", False, "dist 里没有 watch apk")
|
||
|
||
print()
|
||
print("=" * 62)
|
||
print(f"通过 {passed} 项,失败 {failed} 项")
|
||
return 0 if failed == 0 else 1
|
||
|
||
|
||
if __name__ == "__main__":
|
||
raise SystemExit(main())
|