mirror of
https://gitee.com/xmz7891/ykxmz.git
synced 2026-10-19 10:40:44 +00:00
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 + 鍙岃繛鎺? 鏂囨。 - 璁稿彲鍗忚 / 瀹夎鍓嶅繀璇?/ 瀹夎鍚庨』鐭ワ紙浣滆€咃細灏忛害瀛愶級
This commit is contained in:
@@ -0,0 +1,164 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""彻底删掉设备诊断的全部代码。
|
||||
|
||||
用户要求:"安卓端中转设置下面,把那个设备诊断给删了"
|
||||
|
||||
上次只删了入口(openDiagPanel),面板代码还留着:
|
||||
buildDiagPanel() / closeDiagPanel() / runManualDiag()
|
||||
以及 diagPanel / diagText / diagStatusLine / diagIpInput / diagRunning
|
||||
还有 Diagnostics.manualTest 的调用
|
||||
|
||||
这次连它们一起删。删完立刻编译,确认没误伤(上次删坏过字段)。
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(r"C:\Users\shu\Desktop\deepseekagent\LanRemote")
|
||||
MAIN = ROOT / "android" / "src" / "com" / "lanremote" / "watch" / "MainActivity.java"
|
||||
TOOLCHAIN = Path(r"C:\Users\shu\Desktop\deepseekagent\starklink\toolchain")
|
||||
|
||||
|
||||
def method_span(lines, start):
|
||||
"""从一个方法的签名行开始,按花括号配平找结束行(含)。"""
|
||||
depth = 0
|
||||
seen = False
|
||||
for index in range(start, len(lines)):
|
||||
depth += lines[index].count("{")
|
||||
if "{" in lines[index]:
|
||||
seen = True
|
||||
depth -= lines[index].count("}")
|
||||
if seen and depth <= 0:
|
||||
return index
|
||||
return None
|
||||
|
||||
|
||||
def drop_methods_touching(lines, marker: str) -> int:
|
||||
"""删掉所有**方法体里**提到 marker 的方法。返回删了几个。"""
|
||||
removed = 0
|
||||
changed = True
|
||||
while changed:
|
||||
changed = False
|
||||
for index, line in enumerate(lines):
|
||||
stripped = line.strip()
|
||||
# 只看方法签名行
|
||||
if not (stripped.startswith(("private ", "public ", "protected "))
|
||||
and "(" in stripped and stripped.endswith("{")):
|
||||
continue
|
||||
end = method_span(lines, index)
|
||||
if end is None:
|
||||
continue
|
||||
body = "".join(lines[index:end + 1])
|
||||
if marker in body:
|
||||
# 往前的注释和空行一起删
|
||||
start = index
|
||||
while start > 0 and (lines[start - 1].strip().startswith("//")
|
||||
or lines[start - 1].strip() == ""):
|
||||
start -= 1
|
||||
del lines[start:end + 1]
|
||||
removed += 1
|
||||
changed = True
|
||||
break
|
||||
return removed
|
||||
|
||||
|
||||
def main() -> int:
|
||||
text = MAIN.read_text(encoding="utf-8")
|
||||
lines = text.splitlines(keepends=True)
|
||||
|
||||
# ---- 1. 删掉所有碰 diag 的方法 ----
|
||||
total = 0
|
||||
for marker in ("Diagnostics.manualTest", "buildDiagPanel", "diagPanel",
|
||||
"diagText", "diagStatusLine", "diagIpInput", "diagRunning"):
|
||||
n = drop_methods_touching(lines, marker)
|
||||
if n:
|
||||
print(f" 删掉 {n} 个用到 {marker} 的方法")
|
||||
total += n
|
||||
if not total:
|
||||
print(" 没有需要删的方法")
|
||||
|
||||
text = "".join(lines)
|
||||
|
||||
# ---- 2. 删掉字段声明 ----
|
||||
for field in ("private FrameLayout diagPanel;",
|
||||
"private TextView diagText;",
|
||||
"private TextView diagStatusLine;",
|
||||
"private EditText diagIpInput;",
|
||||
"private boolean diagRunning = false;"):
|
||||
if field in text:
|
||||
# 连同上面紧挨的注释一起删
|
||||
text = re.sub(r"[ \t]*//[^\n]*\n(?=[ \t]*"
|
||||
+ re.escape(field) + ")", "", text, count=1)
|
||||
text = text.replace(field + "\n", "", 1)
|
||||
print(f" 删掉字段 {field.split()[-1]}")
|
||||
|
||||
# ---- 3. onBackPressed 里的诊断分支 ----
|
||||
old_back = """ if (diagPanel != null && diagPanel.getVisibility() == View.VISIBLE) {
|
||||
closeDiagPanel();
|
||||
return;
|
||||
}
|
||||
"""
|
||||
if old_back in text:
|
||||
text = text.replace(old_back, "", 1)
|
||||
print(" 删掉 onBackPressed 里的诊断分支")
|
||||
|
||||
# ---- 4. 清掉只剩注释的空注释块 ----
|
||||
text = text.replace(""" // ==================================================================
|
||||
// 设备诊断(原来是一个单独的「遥控诊断」App,现在合并进来)
|
||||
// ==================================================================
|
||||
|
||||
""", "")
|
||||
text = re.sub(r"\n{4,}", "\n\n\n", text)
|
||||
|
||||
MAIN.write_text(text, encoding="utf-8", newline="\n")
|
||||
|
||||
# ---- 5. 编译验证 ----
|
||||
print()
|
||||
print(" 编译验证:")
|
||||
out = ROOT / "_build" / "javacheckD"
|
||||
if out.exists():
|
||||
import shutil
|
||||
shutil.rmtree(out, ignore_errors=True)
|
||||
out.mkdir(parents=True, exist_ok=True)
|
||||
srcs = [str(p) for p in (ROOT / "android" / "src").rglob("*.java")]
|
||||
import os
|
||||
env = dict(os.environ)
|
||||
env["JAVA_TOOL_OPTIONS"] = "-Duser.language=en -Duser.country=US"
|
||||
proc = subprocess.run(
|
||||
[str(TOOLCHAIN / "jdk17" / "bin" / "javac.exe"), "--release", "8",
|
||||
"-encoding", "UTF-8", "-cp",
|
||||
str(TOOLCHAIN / "android-sdk" / "platforms" / "android-34"
|
||||
/ "android.jar"), "-d", str(out)] + srcs,
|
||||
capture_output=True, text=True, encoding="utf-8", errors="replace",
|
||||
env=env)
|
||||
if proc.returncode == 0:
|
||||
print(" ✓ 编译通过")
|
||||
else:
|
||||
print(" ✗ 编译失败:")
|
||||
for line in (proc.stdout + proc.stderr).splitlines():
|
||||
if "error" in line or "symbol" in line:
|
||||
print(f" {line.strip()[:100]}")
|
||||
|
||||
# ---- 6. 残余 ----
|
||||
print()
|
||||
print(" 残余检查:")
|
||||
left = MAIN.read_text(encoding="utf-8")
|
||||
for name in ("diagPanel", "diagText", "diagStatusLine", "diagIpInput",
|
||||
"diagRunning", "buildDiagPanel", "closeDiagPanel",
|
||||
"Diagnostics.", "设备诊断"):
|
||||
count = left.count(name)
|
||||
if count:
|
||||
print(f" [{name}] 还有 {count} 处")
|
||||
if not any(left.count(n) for n in
|
||||
("diagPanel", "diagText", "diagStatusLine", "diagIpInput",
|
||||
"diagRunning", "buildDiagPanel", "closeDiagPanel",
|
||||
"Diagnostics.")):
|
||||
print(" 没有残余 ✓")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
Reference in New Issue
Block a user