Files
ykxmz/_build/patch_lan_detect_3.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

100 lines
3.3 KiB
Python

# -*- coding: utf-8 -*-
"""两处收尾:
1. 彻底删掉「自动搜索电脑」那一段
(上次我图省事写了个 if(false) 包起来,结果 search 是 null 还在用,
会编译失败,而且很难看。)
2. Json 加 stringList 方法
RelayTransport 里我用它读 lanIps,但 Json 里没这个方法。
"""
from __future__ import annotations
import sys
from pathlib import Path
ROOT = Path(r"C:\Users\shu\Desktop\deepseekagent\LanRemote")
WATCH = ROOT / "android" / "src" / "com" / "lanremote" / "watch"
MAIN = WATCH / "MainActivity.java"
JSON = WATCH / "Json.java"
# ---------- 1. 删掉搜索按钮那一段 ----------
DEAD_START = " // 老版本的「自动搜索电脑」按钮去掉了:"
DEAD_END = " box.addView(search);\n"
# ---------- 2. Json.stringList ----------
JSON_ANCHOR = ''' public static List<Object> list(Map<String, Object> map, String key) {'''
JSON_NEW = ''' /**
* 取一个字符串数组。元素不是字符串的会被跳过。
*
* 中转会把被控端上报的局域网 IP 列表放在这里(lanIps),
* 手表用它判断能不能走局域网直连。
*/
public static List<String> stringList(Map<String, Object> map, String key) {
List<String> out = new java.util.ArrayList<String>();
List<Object> raw = list(map, key);
if (raw == null) {
return out;
}
for (Object item : raw) {
if (item instanceof String) {
String text = ((String) item).trim();
if (!text.isEmpty()) {
out.add(text);
}
}
}
return out;
}
public static List<Object> list(Map<String, Object> map, String key) {'''
def main() -> int:
ok = True
# ---- 删掉那一段 ----
lines = MAIN.read_text(encoding="utf-8").splitlines(keepends=True)
start = end = None
for index, line in enumerate(lines):
if DEAD_START in line and start is None:
start = index
if start is not None and line.strip() == "box.addView(search);":
end = index
break
if start is None or end is None:
print(" [失败] 找不到要删的那一段")
ok = False
else:
print(f" 删掉第 {start + 1} 到 {end + 1} 行({end - start + 1} 行)")
del lines[start:end + 1]
MAIN.write_text("".join(lines), encoding="utf-8", newline="\n")
# ---- Json.stringList ----
text = JSON.read_text(encoding="utf-8")
if "stringList" in text:
print(" Json 已经有 stringList")
elif JSON_ANCHOR in text:
text = text.replace(JSON_ANCHOR, JSON_NEW, 1)
JSON.write_text(text, encoding="utf-8", newline="\n")
print(" Json 加了 stringList")
else:
print(" [失败] Json 锚点没找到")
ok = False
# 确认 startDiscovery 还有没有被引用
main_text = MAIN.read_text(encoding="utf-8")
uses = [i + 1 for i, line in enumerate(main_text.splitlines())
if "startDiscovery" in line]
print(f" startDiscovery 剩余引用行: {uses if uses else '无'}")
if uses:
print(" (还引用着的话,得看是不是只剩定义本身)")
return 0 if ok else 1
if __name__ == "__main__":
sys.exit(main())