mirror of
https://gitee.com/xmz7891/ykxmz.git
synced 2026-10-18 19:30:42 +00:00
琚帶绔?- 淇 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 + 鍙岃繛鎺? 鏂囨。 - 璁稿彲鍗忚 / 瀹夎鍓嶅繀璇?/ 瀹夎鍚庨』鐭ワ紙浣滆€咃細灏忛害瀛愶級
97 lines
4.0 KiB
Python
97 lines
4.0 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""重做管理页之后的收尾:
|
|
|
|
1. 补回「退出登录」链接
|
|
我重写页面时把它弄丢了,但 /admin/logout 接口一直都在 ——
|
|
测试里"页面上有退出登录"这条抓住了。
|
|
|
|
2. 更新两条过时的断言
|
|
删除按钮的 class 从 `del` 变成了 `btn del`(配合新样式)。
|
|
测试查的是 `class=del` / `class="del"`,匹配不上。
|
|
改成查 `data-device`(删除按钮必有这个属性)更稳,
|
|
也不会因为以后改 class 名又误报。
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import ast
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(r"C:\Users\shu\Desktop\deepseekagent\LanRemote")
|
|
RELAY = ROOT / "relay" / "relay.py"
|
|
BTN_TEST = ROOT / "_tests" / "test_admin_button.py"
|
|
DEL_TEST = ROOT / "_tests" / "test_admin_delete.py"
|
|
|
|
# ---------------- 1. 退出登录 ----------------
|
|
|
|
META_OLD = ''' <div class=meta>
|
|
<div>版本 <b>{_esc(snap['version'])}</b> · 已运行 <b>{_uptime(snap['uptimeSeconds'])}</b></div>
|
|
<div>本进程内存 <b>{snap['memoryKB'] // 1024} MB</b> · 累计请求 <b>{snap['totalRequests']}</b></div>
|
|
</div>'''
|
|
|
|
META_NEW = ''' <div class=meta>
|
|
<div>版本 <b>{_esc(snap['version'])}</b> · 已运行 <b>{_uptime(snap['uptimeSeconds'])}</b></div>
|
|
<div>本进程内存 <b>{snap['memoryKB'] // 1024} MB</b> · 累计请求 <b>{snap['totalRequests']}</b>
|
|
· <a href="/admin/logout" class=logout>退出登录</a></div>
|
|
</div>'''
|
|
|
|
LOGOUT_CSS_ANCHOR = ''' .meta b{{color:var(--dim);font-weight:500}}'''
|
|
LOGOUT_CSS_NEW = LOGOUT_CSS_ANCHOR + '''
|
|
.meta a.logout{{color:var(--dim);text-decoration:none;
|
|
border-bottom:1px dashed #484f58;transition:.12s}}
|
|
.meta a.logout:hover{{color:var(--accent);border-bottom-color:var(--accent)}}'''
|
|
|
|
# ---------------- 2. 测试断言 ----------------
|
|
|
|
BTN_OLD = ' check("有删除按钮", "button class=del" in html or \'class="del"\' in html)'
|
|
BTN_NEW = (' # 删除按钮的 class 改过(del -> "btn del"),\n'
|
|
' # 用 data-device 判定更稳 —— 删除按钮一定带它。\n'
|
|
' check("有删除按钮", "data-device" in html and "删除" in html)')
|
|
|
|
DEL_OLD = " check(\"有「删除」按钮\", 'class=del' in html or 'class=\"del\"' in html)"
|
|
DEL_NEW = (' # class 名改了(del -> "btn del"),改成按行为判定:\n'
|
|
' # 有带 data-device 的按钮、且文字是"删除"。\n'
|
|
' check("有「删除」按钮",\n'
|
|
' "data-device" in html and "删除" in html,\n'
|
|
' "找不到删除按钮")')
|
|
|
|
|
|
def main() -> int:
|
|
ok = True
|
|
|
|
text = RELAY.read_text(encoding="utf-8")
|
|
if "admin/logout" in text and "a.logout" in text:
|
|
print(" 退出登录链接已在")
|
|
else:
|
|
for old, new, label in ((META_OLD, META_NEW, "退出登录链接"),
|
|
(LOGOUT_CSS_ANCHOR, LOGOUT_CSS_NEW,
|
|
"退出登录样式")):
|
|
if old in text:
|
|
text = text.replace(old, new, 1)
|
|
print(f" 补回 {label}")
|
|
else:
|
|
print(f" [失败] {label} 锚点没找到")
|
|
ok = False
|
|
RELAY.write_text(text, encoding="utf-8", newline="\n")
|
|
|
|
for path, old, new, label in ((BTN_TEST, BTN_OLD, BTN_NEW, "test_admin_button"),
|
|
(DEL_TEST, DEL_OLD, DEL_NEW, "test_admin_delete")):
|
|
content = path.read_text(encoding="utf-8")
|
|
if old in content:
|
|
content = content.replace(old, new, 1)
|
|
path.write_text(content, encoding="utf-8", newline="\n")
|
|
print(f" 更新 {label} 的断言")
|
|
elif "data-device" in content:
|
|
print(f" {label} 已经改过")
|
|
else:
|
|
print(f" [失败] {label} 锚点没找到")
|
|
ok = False
|
|
|
|
ast.parse(RELAY.read_text(encoding="utf-8"))
|
|
print(" relay.py 语法 OK")
|
|
return 0 if ok else 1
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|