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/排版排查的一次性脚本。
46 lines
2.2 KiB
PowerShell
46 lines
2.2 KiB
PowerShell
# OCR the user's layout screenshots with bounding boxes (Windows built-in OCR).
|
|
# Output: TSV text<TAB>x,y,w,h -> lets us spot "tall & narrow" text boxes (= vertical text).
|
|
param([string[]]$Paths)
|
|
|
|
Add-Type -AssemblyName System.Runtime.WindowsRuntime | Out-Null
|
|
|
|
$asTaskGeneric = ([System.WindowsRuntimeSystemExtensions].GetMethods() | Where-Object {
|
|
$_.Name -eq 'AsTask' -and $_.GetParameters().Count -eq 1 -and
|
|
$_.GetParameters()[0].ParameterType.Name -eq 'IAsyncOperation`1' })[0]
|
|
|
|
function Await($WinRtTask, $ResultType) {
|
|
$asTask = $asTaskGeneric.MakeGenericMethod($ResultType)
|
|
$netTask = $asTask.Invoke($null, @($WinRtTask))
|
|
$netTask.Wait(-1) | Out-Null
|
|
$netTask.Result
|
|
}
|
|
|
|
[Windows.Storage.StorageFile, Windows.Storage, ContentType = WindowsRuntime] | Out-Null
|
|
[Windows.Graphics.Imaging.BitmapDecoder, Windows.Graphics.Imaging, ContentType = WindowsRuntime] | Out-Null
|
|
[Windows.Media.Ocr.OcrEngine, Windows.Foundation, ContentType = WindowsRuntime] | Out-Null
|
|
|
|
$engine = [Windows.Media.Ocr.OcrEngine]::TryCreateFromUserProfileLanguages()
|
|
if ($null -eq $engine) {
|
|
Write-Output "NO_OCR_ENGINE"
|
|
exit 2
|
|
}
|
|
Write-Output ("ENGINE_LANG=" + $engine.RecognizerLanguage.LanguageTag)
|
|
|
|
foreach ($p in $Paths) {
|
|
if (-not (Test-Path $p)) { Write-Output ("MISSING " + $p); continue }
|
|
$file = Await ([Windows.Storage.StorageFile]::GetFileFromPathAsync($p)) ([Windows.Storage.StorageFile])
|
|
$stream = Await ($file.OpenAsync([Windows.Storage.FileAccessMode]::Read)) ([Windows.Storage.Streams.IRandomAccessStream])
|
|
$decoder = Await ([Windows.Graphics.Imaging.BitmapDecoder]::CreateAsync($stream)) ([Windows.Graphics.Imaging.BitmapDecoder])
|
|
$bitmap = Await ($decoder.GetSoftwareBitmapAsync()) ([Windows.Graphics.Imaging.SoftwareBitmap])
|
|
$res = Await ($engine.RecognizeAsync($bitmap)) ([Windows.Media.Ocr.OcrResult])
|
|
Write-Output ("=== " + (Split-Path $p -Leaf) + " " + $decoder.PixelWidth + "x" + $decoder.PixelHeight)
|
|
foreach ($line in $res.Lines) {
|
|
foreach ($w in $line.Words) {
|
|
$r = $w.BoundingRect
|
|
Write-Output ("{0}`t{1},{2},{3},{4}" -f $w.Text, [int]$r.X, [int]$r.Y, [int]$r.Width, [int]$r.Height)
|
|
}
|
|
}
|
|
$stream.Dispose()
|
|
}
|
|
Write-Output "OCR_DONE"
|