Files
liuzhuohua b7ca9c89e8 feat(i18n/layout): 全站中英双语 + 四轮排版修复收官 + 修 boot_id 重启检测
v1.0.10 两件大事:

1. 界面中英双语(英文界面无中文残留)
   - 新增 web/i18n.js(约 4200 条词条),零依赖零构建
   - 后端下发中文数据走 bt4() 查表翻译;独立模块(upstream/netdetail/
     realtime/update)纳入翻译并注册切语言重绘钩子
   - 后端「状态/聚合」接口只回稳定枚举+原始数值,不下发中文文案
   - 顺带修一个真实 XSS:顶层 const 不挂 window,独立脚本 esc 静默退化成零转义

2. 修掉「文字竖着排/错位」(多分辨率反复暴露)
   - 单元格 min-content 只有 1 字宽 → word-break:keep-all + 表头 nowrap
   - 依赖卡片正文被标签/按钮挤成 27px → .dep-body{flex:1 1 200px} + flex-wrap
   - 裸 flex:1(下限为0)给正文 → 一律改 flex:1 1 <px>
   - .dep-item 横向容器直接塞块级子项 → 退回块级
   - 关键陷阱:auto-fill 布局屏越宽列数越多单卡越窄,窄屏反而测不出来,
     真机审计推进到「逐视图点按钮 + 1920/2560 宽视口 + 中英双语」
   - 守卫 t-layout.py 扩到 35 条,12 处反向验证全红

3. 修真缺陷:_link_since() 重启检测被误改成 if False:(注释还写着「已修」),
   uptime 归零后相减得负数 → 恢复比对 boot_id

附带:新增 25 个检查器(t-*.py)、排版审计工具链(shot-*/ocr-*/live-*)、
版本号兜底值同步到 1.0.10、.gitignore 收纳 i18n/排版排查的一次性脚本。
2026-10-10 04:50:32 +08:00

41 lines
1.3 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 -*-
"""跑 _dev/scan-t-shadow.js(扫「t 变量遮蔽」)并转成 run-static 能收的形状。
为什么要这条:2026-10-05 补 i18n 时新增了 800+ 个 t() 调用,
把一批原本无害的遮蔽点激活了 —— `function tmLocalIssues(t)` 的参数
`t`(主题对象)与全局 t() 同名,函数体里 t('…') 一调用就
TypeError: t is not a function,theme/design 页整块崩。
check-render 只抓到「跑到的那 1 处」;这条扫全库。
(判据本体在 .js 里,用 Node 的真词法跟踪字符串/模板/注释,
避免在注释和字符串里误报。)
"""
import io
import os
import subprocess
import sys
HERE = os.path.dirname(os.path.abspath(__file__))
ROOT = os.path.dirname(HERE)
JS = os.path.join(HERE, 'scan-t-shadow.js')
APP = os.path.join(ROOT, 'web', 'app.js')
if not os.path.exists(JS):
print('FAIL: 找不到 %s' % JS)
sys.exit(1)
for p in (JS, APP):
src = io.open(p, encoding='utf-8').read()
if 'INJECT' in src:
print('FAIL: %s 含注入残留,先从备份还原' % p)
sys.exit(1)
if '\r\n' in src:
print('FAIL: %s 含 CRLF' % p)
sys.exit(1)
r = subprocess.run(['node', JS, APP], cwd=ROOT, capture_output=True, text=True)
out = (r.stdout or '') + (r.stderr or '')
for line in out.splitlines():
print(line)
sys.exit(r.returncode)