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

171 lines
6.6 KiB
Python

# -*- coding: utf-8 -*-
"""手表端加两个入口:
1. 「回退」按钮(系统页最上面)—— 对应电脑端的 undo_last
2. 「中转地址」设置 —— 跨网络用,填了就走中转,留空走局域网
中转地址存 SharedPreferences,连不上时界面能提示是没配中转。
"""
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. 系统页加回退按钮 ----------------
SYSTEM_OLD = ''' new TabDef("系统", new Act[]{
act("锁屏", new Runnable() {'''
SYSTEM_NEW = ''' new TabDef("系统", new Act[]{
act("回退上一步", new Runnable() {
public void run() {
runFeature("undo_last", Json.obj(), "回退上一步");
}
}),
act("回退全部", new Runnable() {
public void run() {
runFeature("undo_all", Json.obj(), "回退全部");
}
}),
act("看能回退什么", new Runnable() {
public void run() {
runFeature("undo_list", Json.obj(), "可回退的操作");
}
}),
act("锁屏", new Runnable() {'''
# ---------------- 2. 中转地址设置项 ----------------
RELAY_FIELD_ANCHOR = " private static final String PREF_TARGET = "
RELAY_HELPERS = ''' /** 中转服务器地址(跨网络用)。空 = 只走局域网。 */
private String relayUrl() {
return getSharedPreferences("lanremote", MODE_PRIVATE)
.getString("relay_url", "");
}
private void setRelayUrl(String url) {
getSharedPreferences("lanremote", MODE_PRIVATE).edit()
.putString("relay_url", url == null ? "" : url.trim())
.apply();
}
/** 让用户填中转地址。填了就能跨网络控制。 */
private void promptRelayUrl() {
final EditText input = new EditText(this);
input.setHint("https://relay.你的域名");
input.setText(relayUrl());
input.setTextColor(C_FG);
input.setHintTextColor(C_DIM);
input.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13);
input.setSingleLine(true);
input.setBackground(rounded(C_CARD, 7));
input.setPadding(dp(10), dp(10), dp(10), dp(10));
LinearLayout box = new LinearLayout(this);
box.setOrientation(LinearLayout.VERTICAL);
box.setPadding(dp(14), dp(8), dp(14), dp(4));
TextView hint = new TextView(this);
hint.setText("填了就走中转服务器,能在任意网络下控制电脑。\\n"
+ "留空则只在同一个局域网内可用。");
hint.setTextColor(C_DIM);
hint.setTextSize(TypedValue.COMPLEX_UNIT_SP, 11);
hint.setPadding(0, 0, 0, dp(8));
box.addView(hint);
box.addView(input, new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT));
new AlertDialog.Builder(this)
.setTitle("中转服务器地址")
.setView(box)
.setPositiveButton("保存", new android.content.DialogInterface.OnClickListener() {
@Override
public void onClick(android.content.DialogInterface dialog, int which) {
String url = input.getText().toString().trim();
setRelayUrl(url);
if (url.isEmpty()) {
toast("已清空:以后只走局域网");
} else {
toast("已保存中转地址");
appendLog("中转地址:" + url);
}
}
})
.setNeutralButton("清空", new android.content.DialogInterface.OnClickListener() {
@Override
public void onClick(android.content.DialogInterface dialog, int which) {
setRelayUrl("");
toast("已清空");
}
})
.setNegativeButton("取消", null)
.show();
}
'''
# 首页加一个"中转设置"按钮
HOME_OLD = ''' Button selfCheck = bigButton("连不上?点这里诊断", C_WARN, 15);'''
HOME_NEW = ''' // 中转地址:跨网络用。放首页是因为这是"连不上"的常见原因之一。
Button relayButton = bigButton(
"中转设置(跨网络用)", C_ACCENT, 14);
relayButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
promptRelayUrl();
}
});
panel.addView(relayButton, bigParams());
Button selfCheck = bigButton("连不上?点这里诊断", C_WARN, 15);'''
def main() -> int:
text = MAIN.read_text(encoding="utf-8")
ok = True
if "回退上一步" in text:
print(" 系统页已经加过回退按钮")
elif SYSTEM_OLD in text:
text = text.replace(SYSTEM_OLD, SYSTEM_NEW, 1)
print(" 系统页加了 3 个回退按钮")
else:
print(" [失败] 系统页锚点没找到")
ok = False
if "promptRelayUrl" in text:
print(" 已经加过中转设置")
else:
if RELAY_FIELD_ANCHOR in text:
text = text.replace(RELAY_FIELD_ANCHOR,
RELAY_HELPERS + RELAY_FIELD_ANCHOR, 1)
print(" 中转地址读写 + 设置对话框已加")
else:
# 退而求其次:放在类里第一个方法之前
anchor = " private static final int REQ_"
if anchor in text:
text = text.replace(anchor, RELAY_HELPERS + anchor, 1)
print(" 中转地址读写 + 设置对话框已加(备用锚点)")
else:
print(" [失败] 找不到插入位置")
ok = False
if HOME_OLD in text:
text = text.replace(HOME_OLD, HOME_NEW, 1)
print(" 首页加了「中转设置」按钮")
else:
print(" [跳过] 首页锚点没找到")
MAIN.write_text(text, encoding="utf-8")
return 0 if ok else 1
if __name__ == "__main__":
sys.exit(main())