Files
ykxmz/_build/deploy_final.py
T
xmz7891 b62ac865ea 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 + 双连接

文档
- 许可协议 / 安装前必读 / 安装后须知(作者:小麦子)
2026-10-06 19:01:05 +08:00

74 lines
2.7 KiB
Python

# -*- coding: utf-8 -*-
"""把最新的服务器端文件部署到设备并复核。"""
from __future__ import annotations
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(ROOT / "_build"))
from devssh import upload, run # noqa: E402
FILES = (
(ROOT / "relay" / "relay.py", "/root/lanremote-relay/relay.py"),
(ROOT / "relay" / "watchdog.sh", "/root/lanremote-relay/watchdog.sh"),
(ROOT / "relay" / "tunnel-run.sh",
"/root/lanremote-relay/tunnel-run.sh"),
(ROOT / "relay" / "install.sh", "/root/lanremote-relay/install.sh"),
)
def main() -> int:
print("一、上传")
for local, remote in FILES:
raw = local.read_bytes()
# shell 脚本必须是 LF,否则设备上跑不起来
if raw.count(b"\r\n") and local.suffix == ".sh":
raw = raw.replace(b"\r\n", b"\n")
local.write_bytes(raw)
print(f" {local.name}: 修了 CRLF")
upload(str(local), remote, 0o755)
print(f" {local.name} -> {remote}")
print()
print("二、语法检查")
run("bash -n /root/lanremote-relay/watchdog.sh "
"&& bash -n /root/lanremote-relay/tunnel-run.sh "
"&& bash -n /root/lanremote-relay/install.sh "
"&& echo ' 三个脚本语法 OK'")
print()
print("三、重启并复核")
run("systemctl restart lanremote-relay; sleep 5; "
"printf ' %-32s %-10s %s\\n' 服务 运行 开机自启; "
"for s in lanremote-relay lanremote-tunnel lanremote-watchdog.timer; "
"do printf ' %-32s %-10s %s\\n' \"$s\" "
"\"$(systemctl is-active $s 2>/dev/null)\" "
"\"$(systemctl is-enabled $s 2>/dev/null)\"; done")
print()
print("四、健康检查")
run("curl -s --max-time 8 http://127.0.0.1:8080/v1/health | head -c 200")
print()
run("echo -n ' 公网地址: '; cat /root/lanremote-relay/public_url.txt")
run("echo -n ' 可达性: HTTP '; timeout 20 curl -4 -s -o /dev/null "
"-w '%{http_code}\\n' -H 'User-Agent: LanRemote/1.4.0' "
"https://relay.xxmxxs.top/v1/health")
print()
print("五、清掉测试残留(这次部署后又连上来的测试设备)")
run("KEY=$(cat /root/lanremote-relay/data/admin_key.txt); "
"curl -s --max-time 8 -X POST "
"http://127.0.0.1:8080/v1/admin/delete_all "
"-H \"X-Admin: $KEY\" -H 'Content-Type: application/json' -d '{}'")
print()
run("python3 -c \"import json; "
"d=json.load(open('/root/lanremote-relay/data/relay_state.json')); "
"print(' 剩余配对码绑定:', len(d.get('codes', [])))\"")
return 0
if __name__ == "__main__":
sys.exit(main())