mirror of
https://gitee.com/xmz7891/ykxmz.git
synced 2026-10-18 11:20:43 +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 + 双连接 文档 - 许可协议 / 安装前必读 / 安装后须知(作者:小麦子)
91 lines
3.7 KiB
Python
91 lines
3.7 KiB
Python
# -*- coding: utf-8 -*-
|
||
"""窄屏还是被撑宽,直接上防御性 CSS。
|
||
|
||
现象:420px 视口下,右边的内容(配对码、流量、第 4 张统计卡)
|
||
被截掉,说明页面实际比视口宽。
|
||
|
||
可能的元凶:
|
||
* .stats 的 grid(minmax(110px,1fr) 在 396px 里排 4 列)
|
||
* 某些内容没有可收缩的余地
|
||
|
||
不管到底是哪个,这几条都是标准做法:
|
||
1. html/body 限宽 + overflow-x:hidden(兜底,别出现横向滚动)
|
||
2. .wrap 宽度 100%
|
||
3. 窄屏统计卡固定两列(不靠 auto-fit 猜)
|
||
4. 表格容器和单元格都允许收缩换行
|
||
"""
|
||
from __future__ import annotations
|
||
|
||
import ast
|
||
import sys
|
||
from pathlib import Path
|
||
|
||
RELAY = Path(r"C:\Users\shu\Desktop\deepseekagent\LanRemote\relay" r"\relay.py")
|
||
|
||
BODY_OLD = ''' body{{margin:0;padding:0;background:var(--bg);color:var(--fg);
|
||
font:14px/1.6 -apple-system,BlinkMacSystemFont,'Segoe UI',
|
||
'Microsoft YaHei',sans-serif;-webkit-font-smoothing:antialiased}}
|
||
.wrap{{max-width:1120px;margin:0 auto;padding:22px 20px 40px}}'''
|
||
|
||
BODY_NEW = ''' html,body{{max-width:100%;overflow-x:hidden}}
|
||
body{{margin:0;padding:0;background:var(--bg);color:var(--fg);
|
||
font:14px/1.6 -apple-system,BlinkMacSystemFont,'Segoe UI',
|
||
'Microsoft YaHei',sans-serif;-webkit-font-smoothing:antialiased}}
|
||
.wrap{{width:100%;max-width:1120px;margin:0 auto;padding:22px 20px 40px}}'''
|
||
|
||
TABLE_OLD = ''' .tablewrap{{background:var(--panel);border:1px solid var(--border);
|
||
border-radius:12px;overflow:hidden}}
|
||
table{{width:100%;border-collapse:collapse}}'''
|
||
|
||
TABLE_NEW = ''' .tablewrap{{background:var(--panel);border:1px solid var(--border);
|
||
border-radius:12px;overflow:hidden;max-width:100%}}
|
||
table{{width:100%;max-width:100%;border-collapse:collapse;
|
||
table-layout:fixed}}'''
|
||
|
||
CELL_OLD = ''' th,td{{padding:11px 14px;text-align:left;font-size:13px;
|
||
border-bottom:1px solid #21262d;vertical-align:middle}}'''
|
||
|
||
CELL_NEW = ''' th,td{{padding:11px 14px;text-align:left;font-size:13px;
|
||
border-bottom:1px solid #21262d;vertical-align:middle;
|
||
overflow-wrap:anywhere;min-width:0}}'''
|
||
|
||
STATS_MOBILE_OLD = ''' .stats{{grid-template-columns:repeat(auto-fit,minmax(110px,1fr));gap:8px}}'''
|
||
STATS_MOBILE_NEW = ''' .stats{{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}}'''
|
||
|
||
# 窄屏下表格行是 block,table-layout 不适用;补一条更硬的约束
|
||
TD_MOBILE_OLD = ''' tbody td{{display:flex;justify-content:space-between;align-items:baseline;
|
||
gap:14px;border:none;padding:3px 0;text-align:right;
|
||
min-width:0;overflow-wrap:anywhere}}'''
|
||
TD_MOBILE_NEW = ''' tbody td{{display:flex;justify-content:space-between;align-items:baseline;
|
||
gap:14px;border:none;padding:3px 0;text-align:right;
|
||
min-width:0;max-width:100%;overflow-wrap:anywhere;word-break:break-word}}'''
|
||
|
||
|
||
def main() -> int:
|
||
text = RELAY.read_text(encoding="utf-8")
|
||
ok = True
|
||
|
||
for old, new, label in (
|
||
(BODY_OLD, BODY_NEW, "html/body 限宽 + .wrap 100%"),
|
||
(TABLE_OLD, TABLE_NEW, "表格容器/表格限宽"),
|
||
(CELL_OLD, CELL_NEW, "单元格允许收缩换行"),
|
||
(STATS_MOBILE_OLD, STATS_MOBILE_NEW, "窄屏统计卡固定两列"),
|
||
(TD_MOBILE_OLD, TD_MOBILE_NEW, "窄屏单元格强制收缩")):
|
||
if old in text:
|
||
text = text.replace(old, new, 1)
|
||
print(f" {label}")
|
||
elif new.split("\n")[0] in text:
|
||
print(f" {label}:已经改过")
|
||
else:
|
||
print(f" [失败] {label} —— 锚点没找到")
|
||
ok = False
|
||
|
||
RELAY.write_text(text, encoding="utf-8", newline="\n")
|
||
ast.parse(text)
|
||
print(" relay.py 语法 OK")
|
||
return 0 if ok else 1
|
||
|
||
|
||
if __name__ == "__main__":
|
||
sys.exit(main())
|