mirror of
https://gitee.com/xmz7891/ykxmz.git
synced 2026-10-18 13:40:45 +00:00
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 + 双连接 文档 - 许可协议 / 安装前必读 / 安装后须知(作者:小麦子)
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""验证 Edge 无头模式是不是把窗口宽度夹住了。
|
||||
|
||||
怀疑:--window-size=420 实际渲染宽度比 420 大(Edge 有最小窗口宽度),
|
||||
截图再裁到 420 —— 于是看起来像"右边被截断",
|
||||
其实页面本身没问题。
|
||||
|
||||
做法:造一个宽度=100% 的蓝色条,看截图里蓝条有多宽。
|
||||
如果蓝条比截图宽,就说明渲染宽度 > 截图宽度(被裁了)。
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
|
||||
EDGE = next((p for p in (
|
||||
Path(r"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"),
|
||||
Path(r"C:\Program Files\Microsoft\Edge\Application\msedge.exe"))
|
||||
if p.is_file()), None)
|
||||
|
||||
|
||||
def main() -> int:
|
||||
if not EDGE:
|
||||
print(" 没找到 Edge")
|
||||
return 1
|
||||
|
||||
from PIL import Image
|
||||
|
||||
work = Path(tempfile.mkdtemp(prefix="edge_probe_"))
|
||||
page = work / "probe.html"
|
||||
page.write_text(
|
||||
'<html><body style="margin:0">'
|
||||
'<div style="width:100%;height:40px;background:#2f81f7"></div>'
|
||||
"</body></html>",
|
||||
encoding="utf-8")
|
||||
|
||||
print(f" {'请求宽度':>8} {'截图宽度':>8} {'蓝条宽度':>8} {'判断':>14}")
|
||||
for width in (400, 420, 480, 500, 560, 600, 700, 800):
|
||||
shot = work / f"s{width}.png"
|
||||
subprocess.run(
|
||||
[str(EDGE), "--headless=new", "--disable-gpu", "--hide-scrollbars",
|
||||
f"--window-size={width},300", f"--screenshot={shot}",
|
||||
page.as_uri()],
|
||||
capture_output=True, timeout=60)
|
||||
if not shot.is_file():
|
||||
print(f" {width:>8} 截图失败")
|
||||
continue
|
||||
img = Image.open(shot).convert("RGB")
|
||||
row = [img.getpixel((x, 20)) for x in range(img.width)]
|
||||
blue = sum(1 for c in row if c[2] > 180 and c[0] < 100)
|
||||
verdict = "正常" if abs(blue - img.width) <= 2 else "被裁了!"
|
||||
print(f" {width:>8} {img.width:>8} {blue:>8} {verdict:>14}")
|
||||
|
||||
print()
|
||||
print(" 结论:如果某些宽度显示[被裁了],说明 Edge 无头版有最小窗口宽度,")
|
||||
print(" 截图比实际渲染窄 —— 那么窄屏截图看起来的截断是假象。")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
Reference in New Issue
Block a user