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

161 lines
5.9 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -*- coding: utf-8 -*-
"""补上:Actions 的初始化字段、剪贴板历史、服务端 13 个新命令的处理。"""
from __future__ import annotations
import sys
from pathlib import Path
ROOT = Path(r"C:\Users\shu\Desktop\deepseekagent\LanRemote\windows\lanremote")
ACTIONS = ROOT / "actions.py"
SERVER = ROOT / "server.py"
# ---- Actions 初始化 ----
INIT_OLD = ''' self._audio_alias: str | None = None
self._image_window = None
self._lock = threading.RLock()'''
INIT_NEW = ''' self._audio_alias: str | None = None
self._image_window = None
self._lock = threading.RLock()
# 剪贴板历史(最近 20 条)
self._clip_history: list[dict] = []
# CPU 占用要两次采样才算得出来
self._last_cpu_total = 0
self._last_cpu_idle = 0'''
# ---- clip_set 记历史 ----
CLIP_OLD = ''' self.ui.ui_call(do)
return f"剪贴板已更新({len(text)} 字符)"'''
CLIP_NEW = ''' self.ui.ui_call(do)
self.store.set("last_clip", text)
self._remember_clip(text)
return f"剪贴板已更新({len(text)} 字符)"'''
# ---- 服务端命令处理 ----
SERVER_ANCHOR = ''' if cmd == P.CMD_SET_VOICE:'''
SERVER_NEW = ''' if cmd == P.CMD_SHUTDOWN_TIMER:
cancel = bool(msg.get("cancel"))
try:
minutes = int(msg.get("minutes") or 0)
except (TypeError, ValueError):
minutes = 0
note = self.actions.shutdown_timer(minutes, cancel)
self._log(f"[电源] {note}")
return {"ok": True, "note": note}
if cmd == P.CMD_MONITOR:
note = self.actions.monitor_power(bool(msg.get("on")))
self._log(f"[显示] {note}")
return {"ok": True, "note": note}
if cmd == P.CMD_OPEN_URL:
note = self.actions.open_url(str(msg.get("url") or ""))
self._log(f"[网址] {note}")
return {"ok": True, "note": note}
if cmd == P.CMD_QUICK:
note = self.actions.quick_launch(str(msg.get("app") or ""))
self._log(f"[快捷] {note}")
return {"ok": True, "note": note}
if cmd == P.CMD_OPEN_FOLDER:
note = self.actions.open_folder(str(msg.get("folder") or ""))
self._log(f"[文件夹] {note}")
return {"ok": True, "note": note}
if cmd == P.CMD_PROC_LIST:
procs = self.actions.list_processes()
return {"ok": True,
"names": [f"{p['name']} ({p['mem_kb'] // 1024} MB)" for p in procs],
"pids": [p["pid"] for p in procs]}
if cmd == P.CMD_PROC_KILL:
try:
pid = int(msg.get("pid") or 0)
except (TypeError, ValueError):
pid = 0
note = self.actions.kill_process(pid, str(msg.get("name") or ""))
self._log(f"[进程] {note}")
return {"ok": True, "note": note}
if cmd == P.CMD_BATTERY:
info = self.actions.battery()
if not info.get("present"):
return {"ok": True, "note": info.get("note") or "没有电池(台式机)"}
detail = f"{info['percent']}%"
if info.get("charging"):
detail += "(充电中)"
return {"ok": True, "note": detail, **info}
if cmd == P.CMD_DISK:
drives = self.actions.disk()
lines = [f"{d['drive']} {d['free_gb']}/{d['total_gb']} GB 可用"
f"(已用 {d['used_percent']}%)" for d in drives]
return {"ok": True, "note": " | ".join(lines) or "读不到磁盘",
"drives": drives}
if cmd == P.CMD_PERF:
info = self.actions.perf()
note = (f"CPU {info.get('cpu_percent')}% "
f"内存 {info.get('mem_percent')}%"
f"({info.get('mem_used_gb')}/{info.get('mem_total_gb')} GB)")
return {"ok": True, "note": note, **info}
if cmd == P.CMD_CLIP_HISTORY:
items = self.actions.clip_history()
return {"ok": True, "note": f"共 {len(items)} 条",
"texts": [i.get("text", "") for i in items],
"times": [i.get("at", "") for i in items]}
if cmd == P.CMD_SET_WALLPAPER:
note = self.actions.set_wallpaper(str(msg.get("path") or ""))
self._log(f"[壁纸] {note}")
return {"ok": True, "note": note}
if cmd == P.CMD_SAY_CLIP:
note = self.actions.say_clipboard()
self._log(f"[朗读] 剪贴板内容")
return {"ok": True, "note": note}
if cmd == P.CMD_SET_VOICE:'''
def main() -> int:
ok = True
text = ACTIONS.read_text(encoding="utf-8")
for old, new, tag in ((INIT_OLD, INIT_NEW, "初始化字段"),
(CLIP_OLD, CLIP_NEW, "剪贴板历史")):
if old not in text:
print(f" [失败] actions.py {tag} 锚点未匹配")
ok = False
else:
text = text.replace(old, new, 1)
print(f" actions.py / {tag}: OK")
if ok:
ACTIONS.write_text(text, encoding="utf-8")
stext = SERVER.read_text(encoding="utf-8")
if SERVER_ANCHOR not in stext:
print(" [失败] server.py 锚点未匹配")
ok = False
else:
stext = stext.replace(SERVER_ANCHOR, SERVER_NEW, 1)
SERVER.write_text(stext, encoding="utf-8")
print(" server.py / 13 个新命令: OK")
print("\n语法检查:")
import ast
for name, path in (("actions.py", ACTIONS), ("server.py", SERVER)):
try:
ast.parse(path.read_text(encoding="utf-8"))
print(f" {name}: OK")
except SyntaxError as exc:
print(f" {name}: 语法错误 {exc}")
ok = False
return 0 if ok else 1
if __name__ == "__main__":
sys.exit(main())