mirror of
https://gitee.com/xmz7891/ykxmz.git
synced 2026-10-18 21:50: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,174 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""手表端:音色选择 + 播放电脑音乐(用真实的 client.call / sendCommand)。"""
|
||||
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")
|
||||
|
||||
OLD_ROW = ''' addRow(grid,
|
||||
action("语音播报", new Runnable() {
|
||||
public void run() { promptSay(); }
|
||||
}),
|
||||
action("弹通知", new Runnable() {
|
||||
public void run() { promptNotify(); }
|
||||
}));
|
||||
'''
|
||||
|
||||
NEW_ROW = ''' addRow(grid,
|
||||
action("语音播报", new Runnable() {
|
||||
public void run() { promptSay(); }
|
||||
}),
|
||||
action("音色", new Runnable() {
|
||||
public void run() { pickVoice(); }
|
||||
}));
|
||||
|
||||
addRow(grid,
|
||||
action("电脑音乐", new Runnable() {
|
||||
public void run() { pickLocalAudio(); }
|
||||
}),
|
||||
action("弹通知", new Runnable() {
|
||||
public void run() { promptNotify(); }
|
||||
}));
|
||||
'''
|
||||
|
||||
ANCHOR = ''' private void promptSay() {'''
|
||||
|
||||
NEW_METHODS = ''' /** 选择电脑上的 TTS 音色。 */
|
||||
private void pickVoice() {
|
||||
appendLog("正在获取电脑音色…");
|
||||
io.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
final Map<String, Object> reply =
|
||||
client.call(Json.obj("cmd", "voice_list"), 12000);
|
||||
final List<String> voices = stringList(reply, "voices");
|
||||
ui.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (voices.isEmpty()) {
|
||||
toast("电脑上没读到音色,或没连上");
|
||||
return;
|
||||
}
|
||||
List<String> labels = new ArrayList<String>();
|
||||
labels.add("系统默认");
|
||||
labels.addAll(voices);
|
||||
showChooser("选择播报音色", labels, new Chooser() {
|
||||
@Override
|
||||
public void onPick(int index) {
|
||||
String chosen = index == 0 ? "" : voices.get(index - 1);
|
||||
sendCommand(Json.obj("cmd", "set_voice",
|
||||
"voice", chosen), "设置音色");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
} catch (final IOException e) {
|
||||
postError("获取音色", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** 选一个电脑上的音频文件直接播放。 */
|
||||
private void pickLocalAudio() {
|
||||
appendLog("正在获取电脑音乐…");
|
||||
io.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
final Map<String, Object> reply =
|
||||
client.call(Json.obj("cmd", "audio_list"), 15000);
|
||||
final List<String> names = stringList(reply, "names");
|
||||
final List<String> paths = stringList(reply, "paths");
|
||||
ui.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (names.isEmpty() || names.size() != paths.size()) {
|
||||
toast("电脑音乐目录里没有音频文件");
|
||||
return;
|
||||
}
|
||||
showChooser("选择要播放的音乐", names, new Chooser() {
|
||||
@Override
|
||||
public void onPick(int index) {
|
||||
sendCommand(Json.obj("cmd", "play_local",
|
||||
"path", paths.get(index)),
|
||||
"播放 " + names.get(index));
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
} catch (final IOException e) {
|
||||
postError("获取音乐列表", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** 把回复里的字符串数组取出来。 */
|
||||
@SuppressWarnings("unchecked")
|
||||
private static List<String> stringList(Map<String, Object> reply, String key) {
|
||||
List<String> out = new ArrayList<String>();
|
||||
try {
|
||||
Object raw = reply == null ? null : reply.get(key);
|
||||
if (raw instanceof List) {
|
||||
for (Object item : (List<Object>) raw) {
|
||||
if (item != null) {
|
||||
out.add(String.valueOf(item));
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
// 结构不对就返回空
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
private void promptSay() {'''
|
||||
|
||||
DIALOG_ANCHOR = ''' private Button bigButton(String text, int color, float sizeSp) {'''
|
||||
|
||||
DIALOG = ''' /** 简单的列表选择框。 */
|
||||
private interface Chooser {
|
||||
void onPick(int index);
|
||||
}
|
||||
|
||||
private void showChooser(String title, List<String> items, final Chooser chooser) {
|
||||
final String[] array = items.toArray(new String[0]);
|
||||
new AlertDialog.Builder(this)
|
||||
.setTitle(title)
|
||||
.setItems(array, new android.content.DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(android.content.DialogInterface dialog, int which) {
|
||||
chooser.onPick(which);
|
||||
}
|
||||
})
|
||||
.setNegativeButton("取消", null)
|
||||
.show();
|
||||
}
|
||||
|
||||
private Button bigButton(String text, int color, float sizeSp) {'''
|
||||
|
||||
|
||||
def main() -> int:
|
||||
text = MAIN.read_text(encoding="utf-8")
|
||||
ok = True
|
||||
for old, new, tag in ((OLD_ROW, NEW_ROW, "按钮"),
|
||||
(ANCHOR, NEW_METHODS, "处理方法"),
|
||||
(DIALOG_ANCHOR, DIALOG, "选择框")):
|
||||
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