桌面端下载器重构为工作台布局,并重做在线看阅读器
- 左侧导航轨 + 主视图 + 常驻详情检查器,替换原左右两栏平铺卡片结构 - 拆分为 TaskView / TaskRow / SearchView / SettingsView / DetailPanel / NavRail / AuthScreen,删除 DashBoard、Side、HentaiSearch - 在线看改为全屏阅读器:适应高度/宽度、常驻翻页栏、缩略图与标题信息, 翻页改为状态驱动,不再点击内部 DOM;补键盘快捷键与大图查看 - 提交弹层默认选中原图(无原图时选体积最大的一个) - 管理员可见「下载人」筛选与详情里的下载人昵称,判定改用后端 isAdmin - store.deleteGallery 返回 promise,便于删除后清理选中态 - 新增 thumbnail 工具与 4 项单测
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import test from 'node:test'
|
||||
import assert from 'node:assert/strict'
|
||||
import {pickDefaultResolution, ehThumbnailUrl} from '../src/utils/thumbnail.js'
|
||||
|
||||
test('original resolution wins whenever it is offered', () => {
|
||||
assert.equal(pickDefaultResolution({
|
||||
'800x': '37.53MiB',
|
||||
'1280x': '66.57MiB',
|
||||
'2560x': '84.01MiB',
|
||||
'Original': '498.2MiB'
|
||||
}), 'Original')
|
||||
})
|
||||
|
||||
test('without an original entry the largest file is chosen', () => {
|
||||
// 1920x is bigger than 2560x here, so byte size decides, not the label.
|
||||
assert.equal(pickDefaultResolution({
|
||||
'800x': '37.53MiB',
|
||||
'1920x': '811.1MiB',
|
||||
'2560x': '84.01MiB'
|
||||
}), '1920x')
|
||||
})
|
||||
|
||||
test('an empty or missing resolution map yields an empty choice', () => {
|
||||
assert.equal(pickDefaultResolution({}), '')
|
||||
assert.equal(pickDefaultResolution(undefined), '')
|
||||
})
|
||||
|
||||
test('thumbnail urls carry the path and the active auth code', () => {
|
||||
const url = new URL(ehThumbnailUrl('https://example.org/t?a=1&b=2', 'code with spaces'))
|
||||
assert.equal(url.searchParams.get('path'), 'https://example.org/t?a=1&b=2')
|
||||
assert.equal(url.searchParams.get('AuthCode'), 'code with spaces')
|
||||
assert.equal(ehThumbnailUrl('', 'x'), '')
|
||||
})
|
||||
Reference in New Issue
Block a user