- 左侧导航轨 + 主视图 + 常驻详情检查器,替换原左右两栏平铺卡片结构 - 拆分为 TaskView / TaskRow / SearchView / SettingsView / DetailPanel / NavRail / AuthScreen,删除 DashBoard、Side、HentaiSearch - 在线看改为全屏阅读器:适应高度/宽度、常驻翻页栏、缩略图与标题信息, 翻页改为状态驱动,不再点击内部 DOM;补键盘快捷键与大图查看 - 提交弹层默认选中原图(无原图时选体积最大的一个) - 管理员可见「下载人」筛选与详情里的下载人昵称,判定改用后端 isAdmin - store.deleteGallery 返回 promise,便于删除后清理选中态 - 新增 thumbnail 工具与 4 项单测
28 lines
1.1 KiB
JavaScript
28 lines
1.1 KiB
JavaScript
const BaseUrl = "https://downloader.lionwebsite.xyz/";
|
|
|
|
// Remote galleries carry a raw thumbnail path; it only resolves through the
|
|
// backend proxy once the active auth code is attached.
|
|
export function ehThumbnailUrl(path, AuthCode) {
|
|
if (!path) return "";
|
|
return BaseUrl + "GalleryManage/ehThumbnail?" + new URLSearchParams({path, AuthCode}).toString();
|
|
}
|
|
|
|
const UNIT_SCALE = {b: 1, k: 1024, m: 1024 ** 2, g: 1024 ** 3, t: 1024 ** 4};
|
|
|
|
function sizeInBytes(text) {
|
|
const match = String(text).match(/([\d.]+)\s*([kmgt]?)(?:i?b)/i);
|
|
if (!match) return 0;
|
|
const scale = UNIT_SCALE[match[2].toLowerCase()] ?? 1;
|
|
return Number(match[1]) * scale;
|
|
}
|
|
|
|
// Prefer the original file; otherwise take whichever entry reports the most bytes.
|
|
export function pickDefaultResolution(availableResolution) {
|
|
const entries = Object.entries(availableResolution || {});
|
|
if (entries.length === 0) return "";
|
|
const original = entries.find(([resolution]) => /original/i.test(resolution));
|
|
if (original) return original[0];
|
|
return entries.reduce((best, current) =>
|
|
sizeInBytes(current[1]) > sizeInBytes(best[1]) ? current : best)[0];
|
|
}
|