mirror of
https://gitee.com/xmz7891/ykxmz.git
synced 2026-10-18 19:30:42 +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 + 双连接 文档 - 许可协议 / 安装前必读 / 安装后须知(作者:小麦子)
84 lines
3.0 KiB
Python
84 lines
3.0 KiB
Python
# -*- coding: utf-8 -*-
|
||
"""补齐被误删的字段 + import + 删掉局域网自检的调用点。
|
||
|
||
前面那个补丁的正则太贪,挖掉了这些字段声明:
|
||
busy boolean (if (busy) / busy = true/false)
|
||
mirrorStreaming boolean (mirrorStreaming = false / ok)
|
||
incoming ByteArrayOutputStream
|
||
incomingName String (.isEmpty())
|
||
|
||
还差一个 import:DialogInterface(promptPairingCode 里用了)。
|
||
以及 requestPcSelfCheck() 被删了,但 942 行还在调它。
|
||
"""
|
||
from __future__ import annotations
|
||
|
||
import sys
|
||
from pathlib import Path
|
||
|
||
MAIN = Path(r"C:\Users\shu\Desktop\deepseekagent\LanRemote\android\src"
|
||
r"\com\lanremote\watch\MainActivity.java")
|
||
|
||
# 1. import
|
||
IMPORT_OLD = "import android.content.Intent;"
|
||
IMPORT_NEW = ("import android.content.DialogInterface;\n"
|
||
"import android.content.Intent;")
|
||
|
||
# 2. 字段(挂在 deviceBox 那一组后面)
|
||
FIELD_ANCHOR = ''' // 待排版的按钮队列,flushGrid() 里按列数切成行
|
||
private final java.util.List<View> cellQueue =
|
||
new java.util.ArrayList<View>();'''
|
||
|
||
FIELD_NEW = FIELD_ANCHOR + '''
|
||
// 正在连接中(避免重复点)
|
||
private volatile boolean busy;
|
||
// 屏幕镜像是否在推流
|
||
private volatile boolean mirrorStreaming;
|
||
// 正在接收的文件缓冲 + 文件名
|
||
private ByteArrayOutputStream incoming;
|
||
private String incomingName = "";'''
|
||
|
||
# 3. 自检调用点
|
||
CALL_OLD = " public void run() { requestPcSelfCheck(); }"
|
||
|
||
|
||
def main() -> int:
|
||
text = MAIN.read_text(encoding="utf-8")
|
||
ok = True
|
||
|
||
if "import android.content.DialogInterface;" in text:
|
||
print(" import DialogInterface 已在")
|
||
elif IMPORT_OLD in text:
|
||
text = text.replace(IMPORT_OLD, IMPORT_NEW, 1)
|
||
print(" 加了 import DialogInterface")
|
||
else:
|
||
print(" [失败] 找不到 import 锚点")
|
||
ok = False
|
||
|
||
if "private volatile boolean busy;" in text or "private boolean busy;" in text:
|
||
print(" busy 字段已在")
|
||
elif FIELD_ANCHOR in text:
|
||
text = text.replace(FIELD_ANCHOR, FIELD_NEW, 1)
|
||
print(" 补回 busy / mirrorStreaming / incoming / incomingName")
|
||
else:
|
||
print(" [失败] 找不到字段锚点")
|
||
ok = False
|
||
|
||
# 删掉自检调用
|
||
if CALL_OLD in text:
|
||
text = text.replace(CALL_OLD,
|
||
" public void run() {\n"
|
||
" // 局域网自检已随局域网功能一起移除\n"
|
||
" statusView.setText(\"该功能已移除\");\n"
|
||
" }", 1)
|
||
print(" 修掉 requestPcSelfCheck() 的调用点(改成提示已移除)")
|
||
else:
|
||
count = text.count("requestPcSelfCheck")
|
||
print(f" requestPcSelfCheck 剩余引用 {count} 处")
|
||
|
||
MAIN.write_text(text, encoding="utf-8", newline="\n")
|
||
return 0 if ok else 1
|
||
|
||
|
||
if __name__ == "__main__":
|
||
sys.exit(main())
|