mirror of
https://gitee.com/xmz7891/ykxmz.git
synced 2026-10-18 21:50:44 +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 + 双连接 文档 - 许可协议 / 安装前必读 / 安装后须知(作者:小麦子)
113 lines
3.7 KiB
Python
113 lines
3.7 KiB
Python
# -*- coding: utf-8 -*-
|
||
"""把活代码里的 LanRemote-Agent 统一改成 ykxmz。
|
||
|
||
跳过 _build/patch_*.py —— 那些是历史补丁的记录,改了反而对不上账。
|
||
"""
|
||
from __future__ import annotations
|
||
|
||
import re
|
||
import sys
|
||
from pathlib import Path
|
||
|
||
ROOT = Path(r"C:\Users\shu\Desktop\deepseekagent\LanRemote")
|
||
|
||
# 替换规则(注意顺序:长的先来)
|
||
RULES = [
|
||
("LanRemote-Agent.exe", "ykxmz.exe"),
|
||
("LanRemote-Agent-Windows.zip", "ykxmz-Windows.zip"),
|
||
('dist_exe" / "LanRemote-Agent"', 'dist_exe" / "ykxmz"'),
|
||
("dist_exe\\LanRemote-Agent", "dist_exe\\ykxmz"),
|
||
("dist_exe/LanRemote-Agent", "dist_exe/ykxmz"),
|
||
("LanRemote-Agent\\", "ykxmz\\"),
|
||
('"LanRemote-Agent"', '"ykxmz"'),
|
||
("LanRemote-Agent 那个目录", "ykxmz 那个目录"),
|
||
("LanRemote-Agent 目录", "ykxmz 目录"),
|
||
]
|
||
|
||
# 要改的文件(活代码)
|
||
TARGETS = [
|
||
ROOT / "windows" / "run_agent.py",
|
||
ROOT / "windows" / "lanremote" / "ui.py",
|
||
ROOT / "windows" / "lanremote" / "netcheck.py",
|
||
ROOT / "windows" / "lanremote" / "features.py",
|
||
ROOT / "windows" / "lanremote" / "firewall.py",
|
||
ROOT / "_build" / "package_remote.py",
|
||
ROOT / "_build" / "package.py",
|
||
ROOT / "_build" / "make_fix_bat.py",
|
||
ROOT / "_build" / "make_toolbox.py",
|
||
ROOT / "_build" / "rename_tools.py",
|
||
ROOT / "_build" / "make_exe_fix.py",
|
||
ROOT / "_build" / "test_resolve.py",
|
||
ROOT / "_build" / "test_resolve2.py",
|
||
ROOT / "_build" / "test_file_pull.py",
|
||
ROOT / "_tests" / "test_e2e_features.py",
|
||
ROOT / "_tests" / "test_package_remote.py",
|
||
ROOT / "_tests" / "test_clip_push_safe.py",
|
||
ROOT / "_tests" / "diag_all_commands.py",
|
||
ROOT / "_tests" / "acceptance.py",
|
||
ROOT / "_tests" / "test_firewall.py",
|
||
]
|
||
|
||
|
||
def main() -> int:
|
||
total = 0
|
||
touched = []
|
||
for path in TARGETS:
|
||
if not path.is_file():
|
||
continue
|
||
text = path.read_text(encoding="utf-8")
|
||
original = text
|
||
for old, new in RULES:
|
||
if old in text:
|
||
text = text.replace(old, new)
|
||
if text != original:
|
||
path.write_text(text, encoding="utf-8", newline="\n")
|
||
count = sum(original.count(o) for o, _ in RULES
|
||
if o in original)
|
||
touched.append((path.name, count))
|
||
total += count
|
||
|
||
for name, count in touched:
|
||
print(f" {name}: {count} 处")
|
||
print(f" 合计 {total} 处,{len(touched)} 个文件")
|
||
|
||
# 语法检查(只查 Python)
|
||
import ast
|
||
bad = []
|
||
for path in TARGETS:
|
||
if path.suffix != ".py" or not path.is_file():
|
||
continue
|
||
try:
|
||
ast.parse(path.read_text(encoding="utf-8"))
|
||
except SyntaxError as exc:
|
||
bad.append((path, exc))
|
||
if bad:
|
||
for path, exc in bad:
|
||
print(f" [坏] {path.name}: 行 {exc.lineno}: {exc.msg}")
|
||
return 1
|
||
print(" 所有 Python 文件语法正常")
|
||
|
||
# 确认活代码里没有残留(排除历史补丁)
|
||
left = []
|
||
for path in ROOT.rglob("*.py"):
|
||
rel = str(path.relative_to(ROOT))
|
||
if rel.startswith("_build") and path.name.startswith("patch_"):
|
||
continue
|
||
if rel.startswith("_build") and path.name.startswith(
|
||
("add_", "fix_", "rename_to_", "rename_tools")):
|
||
continue
|
||
text = path.read_text(encoding="utf-8", errors="replace")
|
||
if "LanRemote-Agent.exe" in text:
|
||
left.append(rel)
|
||
if left:
|
||
print(f" 还有 {len(left)} 个文件残留 LanRemote-Agent.exe:")
|
||
for item in left[:10]:
|
||
print(f" {item}")
|
||
else:
|
||
print(" 没有残留 ✓")
|
||
return 0
|
||
|
||
|
||
if __name__ == "__main__":
|
||
sys.exit(main())
|