Files
ykxmz/_build/fix_admin_width.py
T
xmz7891 b705216e4a ykxmz 1.5.0锛氫慨澶嶆墜琛ㄧ TLS 璇佷功鏍¢獙 + MTU 淇缃戠粶绋冲畾鎬?
琚帶绔?- 淇 MTU 闂锛氬す MSS + 璺緞 MTU 鎺㈡祴锛堝叕缃戝彲鐢ㄧ巼 48% -> 100%锛?- 澶嶇敤 HTTP 杩炴帴锛堝厤鎺夋瘡娆℃柊寤?TLS 鐨?30% 鎻℃墜澶辫触锛?- 姣忓垎閽熷洖澶存壘灞€鍩熺綉锛岃嚜鍔ㄥ垏鍥炲揩 400 鍊嶇殑璺緞
- 鐢婚潰蹇冭烦甯э細闈欐鏃剁渷娴侀噺锛屽鎴风浠嶇煡閬撴祦鏄椿鐨?- 閿佸睆鏃剁粰鍑哄彲鎿嶄綔鐨勬彁绀?
鎵嬭〃绔?- 鍐呯疆 GTS Root R4 / GlobalSign Root CA锛屼慨 SSLHandshakeException
- 杩炴帴閿欒缈昏瘧鎴愪汉璇濓紙璇佷功/鏃堕棿/瑙f瀽/瓒呮椂鍒嗗埆鎻愮ず锛?- 缁忎腑杞繛涓婂悗鐢ㄦ湇鍔″櫒鎶ョ殑鍦板潃鍒锋柊宸查厤瀵硅褰?- 鏂板灞€鍩熺綉杩炴帴椤甸潰銆佹湇鍔″櫒寤惰繜妫€娴?
鏈嶅姟鍣ㄧ
- 鏀寔 chunked 璇锋眰浣擄紙淇瘡 16 绉掍竴娆$殑杩炴帴閿欎贡涓庡ぇ闈㈢Н 502锛?- 缃戠粶璋冧紭鑴氭湰 net-tune.sh锛堝紑鏈鸿嚜鍔ㄥ簲鐢級
- 绠$悊椤碉細鎵归噺鍒犻櫎銆佺綉缁滀綋妫€銆佷笅杞藉尯
- 闅ч亾鏀?HTTP/2 + 鍙岃繛鎺?
鏂囨。
- 璁稿彲鍗忚 / 瀹夎鍓嶅繀璇?/ 瀹夎鍚庨』鐭ワ紙浣滆€咃細灏忛害瀛愶級
2026-10-06 19:01:05 +08:00

91 lines
3.7 KiB
Python
Raw 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 -*-
"""窄屏还是被撑宽,直接上防御性 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())