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

87 lines
2.5 KiB
Python
Raw Permalink 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 -*-
"""在真实条件下测 _resolve_received(cwd = EXE 目录)。
用户报「接收文件」不能用,Java 测试也报 file_pull 回传 0 字节。
这里把真实安装目录的工作目录、接收目录都复现出来,看它到底返回什么。
"""
from __future__ import annotations
import os
import sys
import tempfile
from pathlib import Path
ROOT = Path(r"C:\Users\shu\Desktop\deepseekagent\LanRemote")
sys.path.insert(0, str(ROOT / "windows"))
EXE_DIR = ROOT / "dist_exe" / "ykxmz"
RECV = EXE_DIR / "received"
def main() -> int:
RECV.mkdir(parents=True, exist_ok=True)
target = RECV / "java_payload.bin"
target.write_bytes(b"test-payload-123")
os.chdir(EXE_DIR)
from lanremote.actions import Actions
from lanremote.config import Store
from lanremote.features import Features
from lanremote.server import RemoteServer
class U:
def ui_call(self, f, timeout=5.0):
return f()
def log(self, *a, **k):
pass
def notify(self, *a, **k):
pass
def screen_size(self):
return (1920, 1080)
store = Store(Path(tempfile.mkdtemp()))
store.set("download_dir", str(RECV))
actions = Actions(U(), store)
server = RemoteServer(store, actions, ui=U())
server.features = Features(actions)
print(f" cwd = {os.getcwd()}")
print(f" received_dir = {store.received_dir()}")
print(f" 文件存在 = {target.is_file()}")
print()
resolved = server._resolve_received("java_payload.bin")
print(f" _resolve_received('java_payload.bin') = {resolved}")
print()
relative = (Path.cwd() / "java_payload.bin").resolve()
print(f" 相对路径算出来 = {relative}")
print(f" 它是文件吗 = {relative.is_file()}")
print(f" 它算敏感目录吗 = {server._is_sensitive(relative)}")
roots = [store.received_dir()]
if server.features is not None:
roots.extend(server.features.allowed_roots())
print()
print(" 落在哪些允许根内:")
for root in roots:
try:
rel = relative.relative_to(root.resolve())
print(f" {root} (相对 {rel})")
except (ValueError, OSError):
continue
print()
if resolved is None:
print(" >>> 结论:解析失败,这就是 file_pull 拉不到文件的原因")
return 1
print(" >>> 结论:解析正常")
return 0
if __name__ == "__main__":
sys.exit(main())