mirror of
https://gitee.com/xmz7891/ykxmz.git
synced 2026-10-18 16:00:43 +00:00
ykxmz 1.5.0:修复手表端 TLS 证书校验 + MTU 修复网络稳定性
被控端 - 修复 MTU 问题:夹 MSS + 路径 MTU 探测(公网可用率 48% -> 100%) - 复用 HTTP 连接(免掉每次新建 TLS 的 30% 握手失败) - 每分钟回头找局域网,自动切回快 400 倍的路径 - 画面心跳帧:静止时省流量,客户端仍知道流是活的 - 锁屏时给出可操作的提示 手表端 - 内置 GTS Root R4 / GlobalSign Root CA,修 SSLHandshakeException - 连接错误翻译成人话(证书/时间/解析/超时分别提示) - 经中转连上后用服务器报的地址刷新已配对记录 - 新增局域网连接页面、服务器延迟检测 服务器端 - 支持 chunked 请求体(修每 16 秒一次的连接错乱与大面积 502) - 网络调优脚本 net-tune.sh(开机自动应用) - 管理页:批量删除、网络体检、下载区 - 隧道改 HTTP/2 + 双连接 文档 - 许可协议 / 安装前必读 / 安装后须知(作者:小麦子)
This commit is contained in:
@@ -0,0 +1,154 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""「功能」分页改成动态:分组由电脑端声明,手表端拉取后渲染。
|
||||
|
||||
原来写死了 6 个分组按钮,现在电脑端有 10 组、80 个功能,
|
||||
写死就不合适了 —— 以后电脑端加一组,手表端自动就有。
|
||||
"""
|
||||
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. 「功能」分页只留一个占位按钮(真正的按钮动态生成)
|
||||
TAB_OLD = ''' new TabDef("功能", new Act[]{
|
||||
act("显示", new Runnable() {
|
||||
public void run() { pickFeatureGroup("显示"); }
|
||||
}),
|
||||
act("音量", new Runnable() {
|
||||
public void run() { pickFeatureGroup("音量"); }
|
||||
}),
|
||||
act("系统", new Runnable() {
|
||||
public void run() { pickFeatureGroup("系统"); }
|
||||
}),
|
||||
act("查看", new Runnable() {
|
||||
public void run() { pickFeatureGroup("查看"); }
|
||||
}),
|
||||
act("效率", new Runnable() {
|
||||
public void run() { pickFeatureGroup("效率"); }
|
||||
}),
|
||||
act("文件", new Runnable() {
|
||||
public void run() { pickFeatureGroup("文件"); }
|
||||
}),
|
||||
}),'''
|
||||
|
||||
TAB_NEW = ''' // 「功能」页的按钮是动态生成的,这里留空
|
||||
new TabDef("功能", new Act[]{}),'''
|
||||
|
||||
# 2. selectTab:功能页走动态构建
|
||||
SELECT_OLD = ''' tabContent.removeAllViews();
|
||||
cellQueue.clear();
|
||||
for (Act item : tabDefs[index].acts) {
|
||||
addRow(tabContent, action(item.label, item.task), null);
|
||||
}
|
||||
flushGrid(tabContent);
|
||||
}'''
|
||||
|
||||
SELECT_NEW = ''' if ("功能".equals(tabDefs[index].name)) {
|
||||
buildFeatureTab();
|
||||
return;
|
||||
}
|
||||
tabContent.removeAllViews();
|
||||
cellQueue.clear();
|
||||
for (Act item : tabDefs[index].acts) {
|
||||
addRow(tabContent, action(item.label, item.task), null);
|
||||
}
|
||||
flushGrid(tabContent);
|
||||
}
|
||||
|
||||
/** 「功能」页:分组由电脑端声明,这里拉取后动态生成按钮。 */
|
||||
private void buildFeatureTab() {
|
||||
tabContent.removeAllViews();
|
||||
cellQueue.clear();
|
||||
|
||||
if (featureGroups == null) {
|
||||
TextView hint = new TextView(this);
|
||||
hint.setText("正在获取电脑端功能列表…");
|
||||
hint.setTextColor(C_DIM);
|
||||
hint.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12);
|
||||
hint.setPadding(dp(4), dp(8), dp(4), dp(8));
|
||||
tabContent.addView(hint);
|
||||
|
||||
io.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Map<String, Object> reply =
|
||||
client.call(Json.obj("cmd", "feature_list"), 20000);
|
||||
final List<Map<String, Object>> items = mapList(reply, "features");
|
||||
final List<String> groups = new ArrayList<String>();
|
||||
for (Map<String, Object> item : items) {
|
||||
String group = Json.str(item, "group", "其他");
|
||||
if (!groups.contains(group)) {
|
||||
groups.add(group);
|
||||
}
|
||||
}
|
||||
featureCache = items;
|
||||
ui.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
featureGroups = groups;
|
||||
selectTab(currentTab);
|
||||
}
|
||||
});
|
||||
} catch (final IOException e) {
|
||||
ui.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
appendLog("获取功能列表失败:" + e.getMessage());
|
||||
toast("没能连上电脑");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (featureGroups.isEmpty()) {
|
||||
TextView hint = new TextView(this);
|
||||
hint.setText("电脑端没有声明任何功能");
|
||||
hint.setTextColor(C_DIM);
|
||||
hint.setPadding(dp(4), dp(8), dp(4), dp(8));
|
||||
tabContent.addView(hint);
|
||||
return;
|
||||
}
|
||||
|
||||
for (final String group : featureGroups) {
|
||||
addRow(tabContent, action(group, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
pickFeatureGroup(group);
|
||||
}
|
||||
}), null);
|
||||
}
|
||||
flushGrid(tabContent);
|
||||
}'''
|
||||
|
||||
# 3. 字段
|
||||
FIELD_OLD = " private List<Map<String, Object>> featureCache = null;"
|
||||
FIELD_NEW = (" private List<Map<String, Object>> featureCache = null;\n"
|
||||
" private List<String> featureGroups = null;")
|
||||
|
||||
|
||||
def main() -> int:
|
||||
text = MAIN.read_text(encoding="utf-8")
|
||||
ok = True
|
||||
for old, new, tag in ((FIELD_OLD, FIELD_NEW, "字段"),
|
||||
(TAB_OLD, TAB_NEW, "功能分页"),
|
||||
(SELECT_OLD, SELECT_NEW, "动态构建")):
|
||||
if old not in text:
|
||||
print(f" [失败] {tag} 锚点未匹配")
|
||||
ok = False
|
||||
else:
|
||||
text = text.replace(old, new, 1)
|
||||
print(f" {tag}: OK")
|
||||
if ok:
|
||||
MAIN.write_text(text, encoding="utf-8")
|
||||
return 0 if ok else 1
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
Reference in New Issue
Block a user