Peach: Local-first video metadata scraper and media manager.
fix(ui): 完善文件检查、确认反馈与 CloudDrive 配置建议
longmeidao8d91c5b2ce57
diff --git a/README.en.md b/README.en.mdindex fbd5f1c9e..5f8a42ec4 100644--- a/README.en.md+++ b/README.en.md@@ -41,9 +41,11 @@ Management → Configuration → Check for updates shows the current version andCloudDrive · 115 and CloudDrive · PikPak connect through mounted local folders. Sign in and mount them in CloudDrive first, then add the folders to Peach. Local disks alone also work.+CloudDrive setup includes suggested cache and read settings for HDD, SATA SSD and NVMe systems. File checks cover configured local and cloud sources and skip offline drives.+Review categories and filters stick below the main navigation after scrolling, with the active group heading below them and its select-all button beside the title. These bars show an edge-to-edge background only while stuck. Card headings and current information stay visible while the evidence scrolls. Selection docks use the same plain text count style.-First-run setup offers an optional browser-history import guide. Completed imports hide the guide; Skip remembers dismissal in the current browser, while collapsing keeps it available. The Taste page retains its read and import buttons. SFW mode blurs, desaturates and dims images and videos and stops hover previews; text remains visible. Cloud reconciliation appears only when a cloud source is configured; empty-folder cleanup also supports local disks.+First-run setup offers an optional browser-history import guide. Completed imports hide the guide; Skip remembers dismissal in the current browser, while collapsing keeps it available. The Taste page retains its read and import buttons. SFW mode blurs, desaturates and dims images and videos and stops hover previews; text remains visible. File reconciliation and empty-folder cleanup support configured local disks and cloud sources.Tray-managed services let you adjust media sources under Manage → Configuration on the host computer, including through its LAN hostname. Setup and configuration provide download links when dependencies are not detected, with mount drivers shown for the host operating system.diff --git a/README.md b/README.mdindex 19aacb4d1..3978cbde3 100644--- a/README.md+++ b/README.md@@ -46,7 +46,7 @@ CloudDrive · 115 与 CloudDrive · PikPak 按本机文件夹接入;先在 Clo复核分类与筛选栏滚动到顶部后吸附在主导航下方,分组标题跟随吸附,全选本组紧邻标题。吸附栏仅在吸附时显示铺满内容区的背景;卡片标题与当前信息在资料滚动时保持可见。多选浮窗的已选数量使用统一文字样式。-首次设置可选择进入浏览器历史记录导入指南;完成导入后指南隐藏,点击「跳过」会在当前浏览器记住选择,折叠仍保留指南。需要补充记录时使用「口味」页的读取或导入按钮。设置中的「SFW 模式」会模糊、降低饱和度并压暗图片和视频,停止悬停预览,文字保持可见。数据管理中的「网盘与本地数据库」仅在配置网盘后显示;空文件夹清理也支持本地磁盘。+首次设置可选择进入浏览器历史记录导入指南;完成导入后指南隐藏,点击「跳过」会在当前浏览器记住选择,折叠仍保留指南。需要补充记录时使用「口味」页的读取或导入按钮。设置中的「SFW 模式」会模糊、降低饱和度并压暗图片和视频,停止悬停预览,文字保持可见。数据管理中的「检查文件与馆藏记录」覆盖已配置的本地磁盘和网盘,离线来源跳过。首启与配置页提供 CloudDrive 的硬盘、内存、读取块及缓存建议。关注来源包括 FANBOX、Patreon、SubscribeStar,以及 Kemono、Pawchive、Coomer、Rule34 系列与 F95zone。来源可用性受站点和使用者权限限制;采集边界与支持情况见 [来源采集](docs/SOURCING.md)。diff --git a/docs/HANDOFF.md b/docs/HANDOFF.mdindex 55eee88ad..6371384f4 100644--- a/docs/HANDOFF.md+++ b/docs/HANDOFF.md@@ -1,6 +1,6 @@# Peach 交接与长期工作约定-本机设置见 `REUSE.md`。+设置见 `OPERATIONS.md`。## 界面、媒体与复核的既定判据@@ -89,7 +89,7 @@ React 渲染的规格页、用户截图这类给不出可重抓字节的实测- 统计与口味层级,Note/Progress/Gauge/Context Card 等控件:`vercel-geist-semantics-measured`、`vercel-geist-note-progress-switch-analytics`、`vercel-geist-fieldset-scroller-empty-state`;配置页截图补证:`vercel-geist-controls-measured`。- 分类切换条属于 Tabs 的 secondary 变体而不是分段器:`vercel-geist-tabs-secondary-measured`。- 表格、排行与面包屑:`vercel-geist-table-ranking`、`vercel-geist-breadcrumbs`;同形可比较数据才用语义 `table` 并保持 tabular numerals,内容标签是固定 Top 排行和直接筛选,不伪装成可排序数据表。-- 设置 Dialog 动效、搜索期 Spinner、后台 Loading Dots 与 busy 按钮:`vercel-geist-command-search-loading`;中性说明 Note:`vercel-notifications-note`;具名动作 Toast:`vercel-geist-toast`;写操作前的确认弹层:`vercel-geist-modal-measured`。+- 设置 Dialog 动效、搜索期 Spinner、后台 Loading Dots 与 busy 按钮:`vercel-geist-command-search-loading`;中性说明 Note:`vercel-notifications-note`;具名动作 Toast:`vercel-geist-toast`;确认弹层(2026-09-06):`vercel-geist-modal-measured`。- 资料页阅读顺序与照片入口:`beeg-profile-layout`;JAV 标题显示语义:`jav-title-user-screenshot`;卡片悬停的快退/快进控件:`hover-seek-controls-user-screenshot`(beeg 现网没有这个控件,只依据用户截图)。- 播放器控制栏、设置浮层、影院与全屏几何:`youtube-player-controls-user-screenshot`;沉浸页版式:`youtube-shorts-immersive-user-screenshot`;播放统计滚动历史:`youtube-stats-buffer-measured`。Peach 不复制没有实际能力的字幕、睡眠定时或自动播放按钮。- 追更与文件站的凭据与解析边界:`f95-masked-gofile-media`、`follow-fanbox-gofile-paheal`、`fanbox-browser-transport`、`rule34-follow-tags-and-collections`;厂牌 Logo 候选发现:`fiu758-studio-logo-discovery`,只作发现来源不作真相源。diff --git a/docs/OPERATIONS.md b/docs/OPERATIONS.mdindex f270e8a33..6eb581390 100644--- a/docs/OPERATIONS.md+++ b/docs/OPERATIONS.md@@ -48,6 +48,31 @@ pikpak = ['A:\']pikpak = ['/Volumes/CloudDrive/PikPak']```+#### 速度与缓存的起步配置++首启与配置页的「CloudDrive 速度与缓存建议」按缓存所在硬盘选择:机械盘或 ≤8 GB 内存为+10–20 GiB,SATA SSD / 8–16 GB 为 20–50 GiB,NVMe / ≥16 GB 为 50–100 GiB。+这些是容量预算建议,不是已测得的速度最优值。优先内置 SSD,系统盘至少保留 40 GiB。+默认/最小读取长度从 256/128 KB 开始;连续高码率播放可比较 512/256 KB,冷启动、拖动、+流量与播放都无改善就恢复。115 从 2 下载线程起步且遵守客户端上限;PikPak/WebDAV 从 2 起步,+只有实测提升才试 4。Peach 同时读取的视频从 1–2 个起步,播放期间暂停批量抽帧。++2026-09-06 核对历史会话与当前本机配置(仅输出性能字段,未读取或复制登录字段):++- 2026-08-13 Claude 会话 `42169be3-c851-4bef-a71c-727bf7b95220` 记录读取长度 256/128 KB、+ `support_direct_link=true`、30 GiB 缓存上限;“PikPak 必须改原生 API”在同一会话已纠正,不能继续用作建议。+- 2026-08-15 Codex 会话 `019ffe93-ba7e-7e43-a1b0-5668d1b513b6` 实测每条 115 下载约 2.02 MB/s,+ 旧播放连接争用带宽;50 GiB 与 LRU 有核验记录。此速度属于当时的 CDN,不能代表今天。+- 历史曾出现上限 0 导致约 911 GB 实占,也曾设置 30 GiB 后仍超限;“所有块最近都读过所以+ LRU 无法淘汰”只是当时的推测,没有实证,不能作为根因。保存后须重开设置并观察实际占盘。+- 当前 `CloudDrive.WinUI` 性能字段为 256/128 KB、直链开启、100 GiB、LRU。+ 本次没有改 CloudDrive、清缓存、重启挂载或进行新的吞吐测试。++[官方帮助](https://www.clouddrive2.com/help.html)、[缓存说明](https://www.clouddrive2.com/features.html)+与[版本记录](https://www.clouddrive2.com/download.html) 核验于 2026-09-06;缓存分为按需读块、+文件夹磁盘缓存及内存,逻辑文件大小不等于实际占盘。直链与线程选项以安装版本和服务端能力为准。+历史建议中“读取块缩小八倍就能减少八倍流量”没有改后冷缓存对照证据,不承诺该收益。+### 初始化与托盘- 配置完成之后,Windows 和有 TLS 的 macOS 托盘由 HTTP 导航进程与 HTTPS 业务进程组成;HTTP 的 `/healthz` 仅证明导航进程存活。业务入口 `/healthz?ready=1` 检查配置、页面、数据库查询和迁移校验和,不就绪返回 503;不带参数仍只探活。还没配置的机器上托盘只起一条引导服务,见下面的首次设置几条。@@ -242,7 +267,7 @@ curl -s --noproxy '*' -o /dev/null -w '%{http_code}\n' https://peach.local/healt## 资源同步与删除边界-- 网盘目录由人在 CloudDrive 外部整理后,必须经「管理 → 资源同步」显式对账,不做后台静默删除:只核对已挂载来源,离线来源整源跳过,单个目录不可读时保留账本行并回报。+- 网盘目录由人在 CloudDrive 外部整理后,必须经「管理 → 资源同步」显式对账,不做后台静默删除:核对已配置的本地与网盘来源,离线来源整源跳过,单个目录不可读时保留账本行并回报。- 真实账本规模下逐文件或同步 HTTP 请求实测 5 分钟仍不返回,所以全库扫描必须使用后台作业并逐来源回报进度,同一目录只枚举一次,目录元数据并发固定为 8;应用不得重跑全库或盲信旧结果。- 资源同步只清理无正常馆藏引用的 snapshots、posters、photo-thumbs、transcodes、stream-segments、按 asset 生成的头像和共享番号封面;候选 CSV、provider evidence、实体头像与 Logo 不在自动清理边界。源文件缺失的 asset 先进回收站,清空回收站才永久删除账本行。- 可重建缓存的删除边界由当前数据库路径拥有:生产库只可清理同一 `peach-data` 下的缓存,临时库只可清理其临时目录子树,边界外一律跳过。一次漏配曾在清空回收站的测试里删掉真实 JAV 封面。diff --git a/docs/REUSE.md b/docs/REUSE.mdindex 7290c864b..3c2046553 100644--- a/docs/REUSE.md+++ b/docs/REUSE.md@@ -280,3 +280,10 @@ Python、npm 与 GitHub Actions 的版本由 `.github/dependabot.yml` 每周检- 复核分类复用 `selectFieldHtml`、`wireSelectField` 和现有 `list-filter` 图标;图标只在筛选入口显示,选项保留文字与选中标记。按当前候选数据提供字段及来源选项,批量决定复用既有协议。字段次级分类采用具名 Listbox 分区,依据见 `reference-snapshots/vercel-review-actions.md`。人工复核与馆藏、关注、标签、垃圾文件和回收站共用 `selectiondock` 浮窗布局,保留各自操作与提交协议;复核卡片内作品样本选择仍属于单条候选,不混入页面级多选。没有新增依赖。Shift 连选使用原生 `mousedown.preventDefault()` 防止文字选区;实际浏览器验证覆盖亮暗主题、宽屏和 390px。反馈控件复用:`noteHtml`、`progressHtml`、`gaugeHtml`、`projectBannerHtml` 与 `wireContextCard` 集中在共享 UI 模块;信息卡片复用原生 Popover 和现有锚定菜单定位,不添加浮层依赖。`BackgroundJob.update(job_id)` 报告浏览记录、口味分析和逐行来源解析的阶段与计数,`followJobProgress` 统一读取文字和总量,查询不重新执行任务。浏览记录解析继续使用 browserexport;本地临时浏览器数据库验证计数及隐私字段。证据见 `reference-snapshots/vercel-geist-note-progress-switch-analytics.md`。++### 文件检查与确认反馈++资源核对复用 `web_resource_sync` 的目录枚举、离线跳过、写前复验与 BackgroundJob,涵盖 local、+115、PikPak。展示复用 Preact 构建链、Fieldset、Note、Toast 与 confirmModal;确认失败留在弹层,+危险动作初始聚焦取消,忙态阻止重入与关闭。无新增依赖,不引入另一套对话框库。+真实截图的 487 项/643 个缓存作为无写入渲染样本;配置历史及性能建议依据在 OPERATIONS。diff --git a/docs/STATUS.md b/docs/STATUS.mdindex bb9f0258d..537f17446 100644--- a/docs/STATUS.md+++ b/docs/STATUS.md@@ -21,7 +21,7 @@- 2026-09-06 部署 `111fed98` 托盘与源码,旧程序备份保留。- 本机经正式域名访问时 `/healthz` 返回 `configurable=true`;配置读取、保存与选文件夹共用本机连接判据。托盘负责配置重载,正式 HTTPS 地址与端口保持托盘管理。- 首启和配置页按系统显示缺失依赖下载:CloudDrive、挂载驱动、FFmpeg/ffprobe、OpenSSL。Windows 已识别 CloudDrive 与 WinFsp;全量及桌面、手机预览通过,生产浏览器取证超时。-- 首次设置提供可跳过的历史导入指南;数据管理首屏共用 Fieldset,网盘专属操作按来源显隐,界面使用「本地数据库」。影响域及深浅色、手机预览通过;未执行真实同步、清理或历史采集。+- 文件检查覆盖本地与网盘,来源等分;确认使用共享弹层。CloudDrive 分档建议共用首启与配置入口,桌面及 390×844 预览通过;来源接口需登录(401),未执行真实清理或更改 CloudDrive 配置。- 可选密码已上线:首启可跳过;配置页可修改、关闭;登录可记住设备。旧安装保留口令。- macOS 是 reader,代码与 `peach-data` 都在内置盘;`peach.local` 经 8900/8443 和 pf 提供 80/443,GET 正常、写入端点返回 409。- 两端各用本机 CA,私钥与凭据不跨机同步;代码走 Git、账本走单写者复制、图片产物走 Syncthing,三条链路互不兜底。本机坐标在 `<数据根>/config.toml`;ADR-0023 第 1~3 阶段已合入并在 Windows 生效。diff --git a/docs/reference-snapshots/vercel-geist-modal-measured.md b/docs/reference-snapshots/vercel-geist-modal-measured.mdindex e4ca324a0..07631fd70 100644--- a/docs/reference-snapshots/vercel-geist-modal-measured.md+++ b/docs/reference-snapshots/vercel-geist-modal-measured.md@@ -1,5 +1,14 @@# Geist Modal 实测记录+## 2026-09-06 使用核对++当前 <https://vercel.com/geist/modal> 文字规范已读取:标题说明动作,按钮使用明确动词与对象;+失败时让用户重试。Chrome 打开参考页返回 `js execution timed out; kernel reset`,当前渲染几何+未取得;使用下方已有实测值及 Peach 共享组件,不声称重新测量整套动效。+数据管理等入口共用确认弹层,危险操作默认聚焦取消,提交期间阻止重复执行,失败留在弹层。+Peach 的手机按钮保持 44px;可还原的记录清理采用中性主按钮,永久删除使用危险样式。+这是人工使用记录,沿用下方不登记上游快照表的理由。+- 取证日期:2026-09-04- URL:<https://vercel.com/geist/modal>- 取证方式:在浏览器里打开 Default 示例的 Modal,对 `[data-geist-modal]` 及其子节点读diff --git a/frontend/src/islands.ts b/frontend/src/islands.tsindex 3afe72757..df06ebb32 100644--- a/frontend/src/islands.ts+++ b/frontend/src/islands.ts@@ -39,6 +39,7 @@ export { entitySkeletonHtml } from './entity-skeleton';export { catalogSuggestions, catalogEmptyHtml, emptyCatalogLayout } from './catalog-onboarding';export { syncSidebarSurface, sidebarTagCounts, sidebarHasCatalogContent } from './sidebar';export { cleanupSkeletonHtml, cloudLocations, cloudPreferenceLocations, tasteHistoryGuideHtml, wireTasteHistoryGuide, TASTE_GUIDE_KEY } from './management';+export { resourceScanHtml } from './resource-sync';export type { StoreName } from './state';/** 首屏取数的结果。`data` 与 `error` 恰有一个成立。 */diff --git a/frontend/src/islands/clouddrive-guide.tsx b/frontend/src/islands/clouddrive-guide.tsxnew file mode 100644index 000000000..6874e1358--- /dev/null+++ b/frontend/src/islands/clouddrive-guide.tsx@@ -0,0 +1,33 @@+import { useLayoutEffect, useRef } from 'preact/hooks';+import { wireCollapse } from '@peach/legacy/ui';++export const CLOUDDRIVE_PROFILES = [+ {name: '机械硬盘或内存不超过 8 GB', cache: '10–20 GiB', read: '256 / 128 KB', task: '同时处理 1 个视频', advice: '缓存优先放内置 SSD。只有机械硬盘时,先用按需读取;反复观看同一批文件才开启文件夹缓存。'},+ {name: 'SATA SSD,8–16 GB 内存', cache: '20–50 GiB', read: '256 / 128 KB', task: '同时处理 1–2 个视频', advice: '扫描、抽帧用小读块。观看高码率视频若仍缓冲,再试 512 / 256 KB。'},+ {name: 'NVMe SSD,16 GB 以上内存', cache: '50–100 GiB', read: '256 / 128 KB', task: '同时处理 2 个视频起步', advice: '以扫描和拖动播放为主时保留小读块。连续看高码率视频可试 512 / 256 KB,速度不升就调回。'},+] as const;++export function CloudDriveGuide() {+ const root = useRef<HTMLDivElement>(null);+ useLayoutEffect(() => { if (root.current) wireCollapse(root.current, 'details', 'clouddrive-guide'); }, []);+ return <div ref={root} class="cloudguide">+ <p class="confighelp">先在 CloudDrive 登录网盘并挂载,开启「启动时自动挂载」。<a href="https://www.clouddrive2.com/help.html" target="_blank" rel="noreferrer">挂载帮助<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-external-link" /></svg></a></p>+ <details>+ <summary>CloudDrive 速度与缓存建议</summary>+ <p class="confighelp">按缓存所在的硬盘选起步配置。优先保证播放流畅,再用同一视频比较冷启动、拖动和流量;参数越大不一定越快。</p>+ <div class="cloudguide-profiles">{CLOUDDRIVE_PROFILES.map(profile => <section aria-label={profile.name} key={profile.name}>+ <h4>{profile.name}</h4>+ <dl><dt>磁盘缓存上限</dt><dd>{profile.cache}</dd><dt>默认 / 最小读取长度</dt><dd>{profile.read}</dd><dt>Peach 并行任务</dt><dd>{profile.task}</dd></dl>+ <p class="confighelp">{profile.advice}</p>+ </section>)}</div>+ <ul class="cloudguide-notes">+ <li>在 CloudDrive「设置」中设置磁盘缓存上限和 LRU(优先清理最久没用的缓存)。系统盘至少留 40 GiB;上限不要填 0。设置后重新打开确认,并观察实际占盘。</li>+ <li>在各网盘的下载设置中调整读取长度和下载线程。115 从 2 线程开始,遵守当前客户端上限;PikPak / WebDAV 从 2 线程开始,带宽充足且速度确实提升时再试 4。开启支持的直链选项,确认播放可用。</li>+ <li>PikPak 按当前 CloudDrive 提供的接入方式配置;使用 WebDAV 时,先确认服务端允许直链。不能直接套用 115 的连接方式。</li>+ <li>看视频时暂停批量抽帧,关闭不用的播放页。下载速度应高于视频码率除以 8,并留出余量:80 Mbps 视频约需 10 MB/s,建议稳定达到 15 MB/s。</li>+ <li>Buffer Cache 的内存占用、磁盘缓存和文件夹缓存是不同设置。磁盘显示的逻辑大小也不等于实际占盘;只改一个上限不能限制所有缓存。</li>+ </ul>+ <p class="confighelp">上表容量和并发是起步建议,按实际占盘与播放结果调整。直链和代理是不同设置;连接慢时分别比较,不能只看开关是否开启。<a href="https://www.clouddrive2.com/features.html" target="_blank" rel="noreferrer">缓存说明<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-external-link" /></svg></a></p>+ </details>+ </div>;+}diff --git a/frontend/src/islands/configuration.tsx b/frontend/src/islands/configuration.tsxindex f1a7bfc02..8f3df8992 100644--- a/frontend/src/islands/configuration.tsx+++ b/frontend/src/islands/configuration.tsx@@ -16,6 +16,7 @@ import { AccessSettings, type AccessState } from './access-settings';import { ReleaseUpdates, type ReleaseState, type UpdateJob } from './release-updates';import { PeachProxy, type PeachProxyState } from './peach-proxy';import { StartupSettings, UninstallSettings, type StartupState, type UninstallState } from './desktop-settings';+import { CloudDriveGuide } from './clouddrive-guide';export interface ConfigurationProps {/** 保存成功后的过去时回执(遗留层的 Toast)。 */@@ -303,7 +304,7 @@ function ConfigurationForm({ data, receipt }: { data: ConfigurationData; receipt))}</div><button type="button" class="geist-button configadd" onClick={add}>添加文件夹</button>- {kinds.some((kind) => kind === '115' || kind === 'pikpak') ? <p class="confighelp">先在 CloudDrive 登录网盘并完成挂载。<a href="https://www.clouddrive2.com/help.html" target="_blank" rel="noreferrer">挂载帮助<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-external-link" /></svg></a></p> : null}+ {kinds.some((kind) => kind === '115' || kind === 'pikpak') ? <CloudDriveGuide /> : null}{kinds.some((kind) => kind === '115' || kind === 'pikpak') ? data.mount_dependencies?.filter((dependency) => !dependency.available).map((dependency) => <p class="confighelp">未检测到 {dependency.name}。<a href={dependency.download_url} target="_blank" rel="noreferrer">下载 {dependency.name}<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-external-link" /></svg></a></p>) : null}{data.windows === false ? <p class="confighelp">本机文件夹是这台电脑读取媒体的位置。Windows 中的对应路径用于匹配馆藏中已有的路径,例如 B:\ 对应本机挂载文件夹。</p> : null}</div>diff --git a/frontend/src/resource-sync.ts b/frontend/src/resource-sync.tsnew file mode 100644index 000000000..4a69530fd--- /dev/null+++ b/frontend/src/resource-sync.ts@@ -0,0 +1,23 @@+import { noteHtml } from '@peach/legacy/ui';++export interface ResourceSource {+ location: string; online: boolean; checked: number; total: number; missing: number; unreadable?: number;+}+export interface ResourceScan {+ sources?: ResourceSource[]; missing?: number; cache?: {files: number; bytes: number}; scan_id?: string;+}+const count = (value = 0) => Number(value).toLocaleString();+const labels: Record<string, string> = {local: '本地磁盘', '115': '115', pikpak: 'PikPak'};+export function resourceScanHtml(scan: ResourceScan, formatSize: (bytes: number) => string): string {+ const cache = scan.cache || {files: 0, bytes: 0};+ const changes = Boolean(scan.missing || cache.files);+ return `<div class="resourcepanel" data-geist-fieldset><div class="resourcesources">${(scan.sources || []).map(source => `<article>+ <div class="resourcesourcetitle"><b>${labels[source.location] || '媒体来源'}</b><span class="${source.online ? 'online' : 'offline'}">${source.online ? '可访问' : '离线,已跳过'}</span></div>+ <strong>${source.online ? `${count(source.missing)} 项` : '—'}</strong>+ <small>${source.online ? `找不到文件 · 已检查 ${count(source.checked)} 项` : `馆藏中有 ${count(source.total)} 项`}</small>+ ${source.unreadable ? `<small>${count(source.unreadable)} 项读取失败,已跳过</small>` : ''}</article>`).join('')}</div>+ <div class="resourcecache"><div><span>可清理的缓存</span><b>${count(cache.files)} 个</b><small>${formatSize(cache.bytes)}</small></div>+ <div><span>待移入回收站</span><b>${count(scan.missing)} 项</b></div></div>+ ${changes ? noteHtml(`将把找不到文件的 ${count(scan.missing)} 项馆藏记录移入回收站,并清理 ${count(cache.files)} 个闲置缓存。`, {label: '清理内容'}) : ''}+ <div class="resourceapplyrow geist-fieldset-footer" data-geist-fieldset-footer>${changes ? '<button class="geist-button primary" type="button" id="resourceApply">清理失效记录与缓存</button>' : '<p class="resourcesyncok">已检查可访问的来源,没有待清理的记录或缓存。</p>'}</div></div>`;+}diff --git a/frontend/test/clouddrive-guide.test.tsx b/frontend/test/clouddrive-guide.test.tsxnew file mode 100644index 000000000..592218487--- /dev/null+++ b/frontend/test/clouddrive-guide.test.tsx@@ -0,0 +1,19 @@+import { render } from 'preact';+import { expect, it, vi } from 'vitest';+import { CloudDriveGuide } from '../src/islands/clouddrive-guide';+import { Configuration } from '../src/islands/configuration';++it('配置与首次设置共用按硬盘分档的建议,并链接官方说明', () => {+ const host=document.createElement('div');document.body.append(host);+ render(<CloudDriveGuide />,host);+ expect(host.querySelectorAll('.cloudguide-profiles section')).toHaveLength(3);+ expect(host.textContent).toContain('256 / 128 KB');+ expect(host.textContent).toContain('上限不要填 0');+ expect(host.querySelector('details')?.open).toBe(false);+ expect([...host.querySelectorAll('a')].every(a=>a.href.startsWith('https://www.clouddrive2.com/'))).toBe(true);+ const data={editable:true,notice:'',revision:'test',media_dirs:['B:\\Media'],media_sources:[{location:'115',root:'B:\\',path:'B:\\Media'}],port:9123,facts:[]};+ render(<Configuration data={data} error="" receipt={vi.fn()} />,host);+ expect(host.querySelector('.cloudguide')).not.toBeNull();+ render(<Configuration key="local" data={{...data,media_sources:[{location:'local',root:'R:\\',path:'R:\\Media'}]}} error="" receipt={vi.fn()} />,host);+ expect(host.querySelector('.cloudguide')).toBeNull();host.remove();+});diff --git a/frontend/test/confirm-modal.test.ts b/frontend/test/confirm-modal.test.tsnew file mode 100644index 000000000..7dc7c80f8--- /dev/null+++ b/frontend/test/confirm-modal.test.ts@@ -0,0 +1,29 @@+import { afterEach, expect, it, vi } from 'vitest';+// @ts-expect-error 遗留模块由浏览器直接加载,此测试调用实际实现。+import { confirmModal } from '../../web/js/ui-components.js';++afterEach(() => document.body.replaceChildren());+it('危险操作聚焦取消,取消不写入,关闭归还焦点', async () => {+ const trigger = document.createElement('button'); document.body.append(trigger); trigger.focus();+ const write = vi.fn();+ const pending = confirmModal({title:'清理记录',body:'清理 2 项',confirmLabel:'清理记录',danger:true,onConfirm:write});+ const cancel = document.querySelector<HTMLButtonElement>('[data-modal-cancel]')!;+ expect(document.activeElement).toBe(cancel);+ cancel.click();+ expect((await pending).confirmed).toBe(false);+ expect(write).not.toHaveBeenCalled(); expect(document.activeElement).toBe(trigger);+});+it('等待写入时阻止重复提交和关闭,失败保留弹层可重试', async () => {+ let reject!: (error: Error) => void;+ const write = vi.fn().mockImplementationOnce(() => new Promise((_, fail) => { reject = fail; })).mockResolvedValueOnce('done');+ const pending = confirmModal({title:'清理记录',body:'清理 2 项',confirmLabel:'清理记录',onConfirm:write});+ const dialog = document.querySelector('dialog')!;+ const accept = dialog.querySelector<HTMLButtonElement>('[data-modal-confirm]')!;+ accept.click(); accept.click();+ dialog.querySelector<HTMLButtonElement>('[data-modal-cancel]')!.click();+ const escape = new Event('cancel', {cancelable: true}); dialog.dispatchEvent(escape);+ expect(escape.defaultPrevented).toBe(true); expect(dialog.open).toBe(true); expect(write).toHaveBeenCalledTimes(1);+ reject(new Error('磁盘离线')); await new Promise(resolve => setTimeout(resolve, 0));+ expect(dialog.textContent).toContain('磁盘离线'); expect(dialog.open).toBe(true);+ accept.click(); expect((await pending).result).toBe('done'); expect(write).toHaveBeenCalledTimes(2);+});diff --git a/frontend/test/resource-sync.test.ts b/frontend/test/resource-sync.test.tsnew file mode 100644index 000000000..b12019cce--- /dev/null+++ b/frontend/test/resource-sync.test.ts@@ -0,0 +1,26 @@+import { describe, expect, it } from 'vitest';+import { resourceScanHtml, type ResourceSource } from '../src/resource-sync';++const source = (location: string, online = true): ResourceSource => ({location, online, checked: 18, total: 20, missing: online ? 2 : 0, unreadable: online ? 2 : 0});+describe('文件检查结果', () => {+ it.each([['local'], ['115', 'pikpak'], ['local', '115', 'pikpak']])('呈现实际来源 %s', (...locations) => {+ document.body.innerHTML = resourceScanHtml({sources: locations.map(location => source(location)), missing: 2}, () => '0 B');+ expect(document.querySelectorAll('.resourcesources article')).toHaveLength(locations.length);+ expect(document.body.textContent).toContain('找不到文件');+ expect(document.body.textContent).toContain('2 项读取失败,已跳过');+ expect(document.querySelector('#resourceApply')?.textContent).toBe('清理失效记录与缓存');+ });+ it('离线来源没有删除判断,零差异没有清理按钮', () => {+ document.body.innerHTML = resourceScanHtml({sources: [source('local', false)]}, () => '0 B');+ expect(document.body.textContent).toContain('离线,已跳过');+ expect(document.body.textContent).not.toContain('已从网盘删除');+ expect(document.querySelector('strong')?.textContent).toBe('—');+ expect(document.querySelector('#resourceApply')).toBeNull();+ });+ it('仅缓存待清理也提供清理入口', () => {+ document.body.innerHTML = resourceScanHtml({cache: {files: 643, bytes: 48 * 1024 ** 2}}, () => '48 MiB');+ expect(document.body.textContent).toContain('643 个');+ expect(document.body.textContent).toContain('48 MiB');+ expect(document.querySelector('#resourceApply')).not.toBeNull();+ });+});diff --git a/src/peach/web_resource_sync.py b/src/peach/web_resource_sync.pyindex 28d883907..5cfea0fc7 100644--- a/src/peach/web_resource_sync.py+++ b/src/peach/web_resource_sync.py@@ -60,10 +60,10 @@ def source_is_online(location: str) -> bool:RESOURCE_SCAN_WORKERS = 8-def configured_cloud_locations() -> tuple[str, ...]:- """资源同步只处理已声明媒体根目录的网盘,离线状态由扫描阶段报告。"""+def configured_resource_locations() -> tuple[str, ...]:+ """核对已声明的媒体来源,离线状态由扫描阶段报告。"""return tuple(location for location, roots in LOCATION_ROOT_DECLARATIONS.items()- if location in ("115", "pikpak") and roots)+ if location in ("local", "115", "pikpak") and roots)def _scan_resource_directory(@@ -131,19 +131,19 @@ def _scan_missing_resources(contract: ResourceSyncContract,progress: Callable[[dict], None] | None = None,) -> dict:- """只读核对已配置网盘中的文件。"""+ """只读核对已配置磁盘与网盘中的文件。"""with contract.read_connection() as connection:rows = connection.execute("SELECT id,location,path FROM asset ""WHERE path IS NOT NULL AND COALESCE(disposal,'')!='trash' "- "AND location IN ('115','pikpak') ORDER BY location,id",+ "AND location IN ('local','115','pikpak') ORDER BY location,id",).fetchall()grouped: dict[str, list] = {}for row in rows:grouped.setdefault(row["location"], []).append(row)missing_ids: list[int] = []sources = []- for location in configured_cloud_locations():+ for location in configured_resource_locations():items = grouped.get(location, [])online = source_is_online(location)missing = []@@ -317,7 +317,7 @@ def _resource_scan_public(state: dict) -> dict:"scan_id": state["scan_id"],"sources": [dict(source) for source in state["sources"]],"completed_sources": len(state["sources"]),- "total_sources": len(configured_cloud_locations()),+ "total_sources": len(configured_resource_locations()),**({"error": state["error"]} if state["status"] == "failed" else {}),}@@ -360,14 +360,14 @@ def w_resource_sync_scan(contract: ResourceSyncContract, body=None):return {"ok": True, "status": "idle", "scan_id": "", "sources": [],"completed_sources": 0,- "total_sources": len(configured_cloud_locations()),+ "total_sources": len(configured_resource_locations()),}return _resource_scan_public(state)- if not configured_cloud_locations():- raise ValueError("请先在配置页添加网盘来源")+ if not configured_resource_locations():+ raise ValueError("请先在配置页添加媒体文件夹")return _background_resource_scan(contract, restart=body.get("restart") is True)- if not configured_cloud_locations():- raise ValueError("请先在配置页添加网盘来源")+ if not configured_resource_locations():+ raise ValueError("请先在配置页添加媒体文件夹")scan = _scan_missing_resources(contract)caches = _resource_orphan_plan(contract, scan["missing_ids"])return {@@ -397,7 +397,7 @@ def _recheck_resource_scan_ids(contract: ResourceSyncContract, asset_ids: Sequengrouped.setdefault(row["location"], []).append(row)missing = []for location, items in grouped.items():- if location not in configured_cloud_locations() or not source_is_online(location):+ if location not in configured_resource_locations() or not source_is_online(location):continuesource_missing, _unreadable = _missing_resource_ids(items)missing.extend(source_missing)@@ -405,8 +405,8 @@ def _recheck_resource_scan_ids(contract: ResourceSyncContract, asset_ids: Sequendef w_resource_sync_apply(contract: ResourceSyncContract, body, *, progress=None):- if not configured_cloud_locations():- raise ValueError("请先在配置页添加网盘来源")+ if not configured_resource_locations():+ raise ValueError("请先在配置页添加媒体文件夹")if body.get("confirm") is not True:raise ValueError("resource sync requires confirmation")if body.get("background"):diff --git a/tests/test_desktop_settings.py b/tests/test_desktop_settings.pyindex b404cdf09..814c0b249 100644--- a/tests/test_desktop_settings.py+++ b/tests/test_desktop_settings.py@@ -32,10 +32,11 @@ class DesktopSettingsTests(unittest.TestCase):links = app[app.index('function linkManagerMarkup'):app.index('function resourceSyncMarkup')]sync = app[app.index('function resourceSyncMarkup'):app.index('async function openTaste')]self.assertIn('data-fieldset-type="error"', links)- self.assertIn('data-fieldset-type="warning"', sync)- self.assertIn("variant:'warning',label:'同步影响'", sync)- self.assertIn('class="resourceaction warning" type="button" id="resourceApply"', sync)- self.assertNotIn('class="resourceaction resourcedanger" type="button" id="resourceApply"', sync)+ renderer = (root / 'frontend/src/resource-sync.ts').read_text(encoding='utf-8')+ self.assertIn('resourceScanHtml(payload,fmtSize)', sync)+ self.assertIn("{label: '清理内容'}", renderer)+ self.assertIn('class="geist-button primary" type="button" id="resourceApply"', renderer)+ self.assertIn("danger:false,onConfirm", sync)self.assertIn('cleanupemptyfolders" data-geist-fieldset data-fieldset-type="error"', app)def setUp(self):diff --git a/tests/test_web_resource_sync.py b/tests/test_web_resource_sync.pyindex 40d425aa1..732462472 100644--- a/tests/test_web_resource_sync.py+++ b/tests/test_web_resource_sync.py@@ -30,7 +30,7 @@ class PurgeMissingTests(unittest.TestCase):def setUp(self):self.tmp = tempfile.TemporaryDirectory()- self.root = Path(self.tmp.name)+ self.root = Path(self.tmp.name).resolve()self.db_path = str(fresh_ledger(self.root))con = sqlite3.connect(self.db_path)sep = chr(92)@@ -177,7 +177,7 @@ class PurgeMissingTests(unittest.TestCase):self.assertEqual(source["checked"], 4)self.assertEqual(source["unreadable"], 0)- def test_cloud_sync_preserves_missing_local_files_in_mixed_library(self):+ def test_sync_checks_local_and_cloud_files_in_mixed_library(self):with self.contract.write_transaction() as connection:connection.execute("INSERT INTO asset(id,location,path,name,medium,size) ""VALUES(5,'local','R:\\missing.mp4','missing.mp4','video',10)")@@ -186,22 +186,31 @@ class PurgeMissingTests(unittest.TestCase):mock.patch.object(rm_sync, 'translate_ledger_path', self._translate), \mock.patch.object(rm_sync, 'source_is_online', return_value=True):preview = rm_sync.w_resource_sync_scan(self.contract)+ self.assertEqual([source['location'] for source in preview['sources']], ['local', '115'])+ self.assertEqual(preview['missing'], 3)+ self.assertIn(5, rm_sync._recheck_resource_scan_ids(self.contract, [5]))result = rm_sync.w_resource_sync_apply(self.contract, {'confirm': True, 'clean_cache': False})- self.assertEqual([source['location'] for source in preview['sources']], ['115'])- self.assertEqual(result['moved_to_trash'], 2)- self.assertNotIn(5, rm_sync._recheck_resource_scan_ids(self.contract, [5]))+ self.assertEqual(result['moved_to_trash'], 3)with self.contract.read_connection() as connection:- self.assertNotEqual(connection.execute('SELECT disposal FROM asset WHERE id=5').fetchone()[0], 'trash')+ self.assertEqual(connection.execute('SELECT disposal FROM asset WHERE id=5').fetchone()[0], 'trash')- def test_local_only_configuration_has_no_cloud_sync_action(self):+ def test_local_only_configuration_has_resource_check(self):with mock.patch.object(rm_sync, 'LOCATION_ROOT_DECLARATIONS', {'local': ('R:\\',)}):- self.assertEqual(rm_sync.configured_cloud_locations(), ())+ self.assertEqual(rm_sync.configured_resource_locations(), ('local',))state = rm_sync.w_resource_sync_scan(self.contract, {'background': True, 'status_only': True})- self.assertEqual(state['total_sources'], 0)+ self.assertEqual(state['total_sources'], 1)+ with mock.patch.object(rm_sync, 'source_is_online', return_value=False):+ preview = rm_sync.w_resource_sync_scan(self.contract)+ self.assertEqual(preview['sources'][0]['location'], 'local')+ self.assertFalse(preview['sources'][0]['online'])+ self.assertEqual(preview['missing'], 0)++ def test_no_configured_source_requires_media_folder(self):+ with mock.patch.object(rm_sync, 'LOCATION_ROOT_DECLARATIONS', {}):for body in ({}, {'background': True}):- with self.assertRaisesRegex(ValueError, '添加网盘来源'):+ with self.assertRaisesRegex(ValueError, '添加媒体文件夹'):rm_sync.w_resource_sync_scan(self.contract, body)- with self.assertRaisesRegex(ValueError, '添加网盘来源'):+ with self.assertRaisesRegex(ValueError, '添加媒体文件夹'):rm_sync.w_resource_sync_apply(self.contract, {'confirm': True})def test_full_sync_skips_an_unreadable_directory_instead_of_trashing_it(self):diff --git a/tests/test_web_ui.py b/tests/test_web_ui.pyindex 5f7ae089c..78641e3a1 100644--- a/tests/test_web_ui.py+++ b/tests/test_web_ui.py@@ -3607,7 +3607,7 @@ class WebUiSourceTests(unittest.TestCase):self.assertPageContains("catch(_error){write(section,'读取失败')}")cleanup = self.page.split("async function openDataCleanup(", 1)[1].split("let dupData=null;", 1)[0]self.assertIn("${linkManagerMarkup()}", cleanup)- self.assertIn("${cloudLocations(sources.sources||[]).length?resourceSyncMarkup():''}", cleanup)+ self.assertIn("${(sources.sources||[]).some(source=>['local','115','pikpak'].includes(source.location)&&source.roots?.length)?resourceSyncMarkup():''}", cleanup)stats = self.page.split("async function openStats(", 1)[1].split("function showHomeSurfaces(", 1)[0]self.assertNotIn("linkManagerMarkup()", stats,"统计页只讲库里现在有多少,不该再挂对齐外部现实的面板")@@ -3793,7 +3793,7 @@ class WebUiSourceTests(unittest.TestCase):self.assertPageContains("const NOTE_VARIANTS=new Set(['secondary','warning','error','success'])")self.assertPageContains("const symbol=kind==='secondary'?'info':kind==='success'?'check':'alert'")self.assertPageContains("const role=kind==='error'?' role=\"alert\"':' role=\"note\"'")- self.assertPageContains("noteHtml(error.message,{variant:'error',label:'同步失败'})")+ self.assertPageContains("failure.innerHTML=noteHtml(error.message||'操作未完成',{variant:'error'})")self.assertPageContains("noteHtml(error.message,{variant:'error',label:'扫描失败'})")self.assertPageContains("noteHtml(error.message||'分析未取得',{variant:'error',label:'分析未取得'})")self.assertPageContains('class="geist-note geist-note-error fcheckreport" role="alert"')@@ -4218,7 +4218,7 @@ class WebUiSourceTests(unittest.TestCase):self.assertPageContains(".count.manage-static{position:relative;top:auto;z-index:1}")self.assertPageContains("if(!response.ok){")self.assertPageContains("throw new Error(requestErrorMessage(detail,response.status))")- self.assertPageContains("catch(error){actionFailure('批量操作',error)}")+ self.assertPageContains("catch(error){setActionBusy(button,false);throw error}")self.assertPageContains("wireJunkCards($('#grid'));paintSelection();return")self.assertPageContains("actionFailure('操作',error)")self.assertPageContains("kind==='dispose'&&r.disposal==='trash'&&state.state==='ads'")@@ -4902,7 +4902,7 @@ class WebUiSourceTests(unittest.TestCase):"dialog.querySelector('.geist-modal-body p').textContent=body;")# 遮罩上的点击落在 <dialog> 自己身上;这个动作可撤销,允许点外面关掉。self.assertCode(- "dialog.addEventListener('click',event=>{if(event.target===dialog)dialog.close()});")+ "dialog.addEventListener('click',event=>{if(event.target===dialog&&!busy&&!danger)dialog.close()});")def test_confirm_modal_keeps_a_failed_write_in_place_with_its_reason(self):# 忙态落在主按钮上,不落在已经收起来的菜单项上。@@ -6110,8 +6110,8 @@ class WebUiSourceTests(unittest.TestCase):def test_data_cleanup_groups_junk_duplicates_and_empty_folders_in_fieldsets(self):self.assertPageContains("async function openDataCleanup(push=true)")self.assertPageContains("route('/data-cleanup')")- self.assertPageContains("${cloudLocations(sources.sources||[]).length?resourceSyncMarkup():''}")- self.assertPageContains("fieldsetTitle('resourceBoxTitle','网盘与本地数据库')")+ self.assertPageContains("${(sources.sources||[]).some(source=>['local','115','pikpak'].includes(source.location)&&source.roots?.length)?resourceSyncMarkup():''}")+ self.assertPageContains("fieldsetTitle('resourceBoxTitle','检查文件与馆藏记录')")self.assertPageLacks("fieldsetTitle('resourceBoxTitle','网盘与账本')")self.assertPageContains("cloudPreferenceLocations(g.files,d.cloudLocations||[])")self.assertPageContains("Boolean(s.history_sources||d.updated_at),localStorage.getItem(TASTE_GUIDE_KEY)==='1')")@@ -6128,7 +6128,7 @@ class WebUiSourceTests(unittest.TestCase):self.assertPageContains('class="cleanupfieldset" data-geist-fieldset aria-labelledby=')self.assertPageContains('class="cleanupfieldset cleanupemptyfolders" data-geist-fieldset')self.assertPageContains("api('/api/data-cleanup/empty-folders',{method:'POST',body:'{}'})")- self.assertPageContains("来源根目录不会删除")+ self.assertPageContains("保留来源根目录")self.assertPageContains(".cleanupfieldset>.geist-fieldset-content{flex:1;min-height:0;padding:20px}")# Geist 的 Fieldset 全框只有一条线,在底部操作条上方;标题底下不划线。self.assertPageContains("--fieldset-bar-h:52px;")@@ -6295,7 +6295,7 @@ class WebUiSourceTests(unittest.TestCase):# 只能进回收站;永久删除仍得从回收站单独执行。self.assertPageContains("operation:'dispose'")self.assertPageLacks("operation:'delete'},{method:'POST'}")- self.assertPageContains("文件仍在回收站里,可以还原")+ self.assertPageContains("记录可从回收站还原")def test_duplicate_batches_respect_the_two_hundred_id_cap(self):self.assertPageContains("for(let i=0;i<ids.length;i+=200)")@@ -7542,12 +7542,12 @@ class WebUiSourceTests(unittest.TestCase):self.assertPageContains("it.location==='online'?'':`<span class=\"srctools detailtitletools\">${sourceToolButtons(it.id)}</span>`")def test_resource_sync_lives_in_data_management_and_keeps_offline_sources_safe(self):- self.assertPageContains("${cloudLocations(sources.sources||[]).length?resourceSyncMarkup():''}")+ self.assertPageContains("${(sources.sources||[]).some(source=>['local','115','pikpak'].includes(source.location)&&source.roots?.length)?resourceSyncMarkup():''}")self.assertRoute('/resource-sync', "openResourceSync(push)")self.assertPageContains("route('/data-cleanup#resource-sync',!push)")self.assertPageContains("api('/api/resource-sync/scan',{method:'POST'")self.assertPageContains("api('/api/resource-sync/apply',{method:'POST'")- self.assertPageContains("source.unreadable")+ self.assertPageContains("resourceScanHtml(payload,fmtSize)")self.assertPageContains("background:true,restart:true")self.assertPageContains("payload.status==='running'")self.assertPageContains("location.pathname==='/data-cleanup'")@@ -7555,12 +7555,12 @@ class WebUiSourceTests(unittest.TestCase):# 上一轮跑完的结果是那一刻的快照。进页面就铺开会被读成现在的账本状态,# 而页面上没有任何东西说它是旧的。self.assertPageContains("if(existing.status==='running')void followScan(existing)")- self.assertPageContains("同步并清理")+ self.assertPageContains("清理失效记录与缓存")self.assertPageContains('class="resourcesyncfooter geist-fieldset-footer"')self.assertPageContains('class="resourcepanel"')self.assertPageContains('class="resourceapplyrow"')self.assertPageContains(".resourceaction{box-sizing:border-box;height:36px")- self.assertPageContains("@media(max-width:640px){.resourcesync .resourcesources{grid-template-columns:1fr}")+ self.assertPageContains("@media(max-width:640px){.resourcesync .resourcesources{grid-auto-flow:row;grid-template-columns:1fr}")self.assertPageContains(".resourcesyncbox,.resourcepanel{overflow:clip;border:1px solid var(--field-ring);border-radius:var(--floating-radius)")self.assertPageContains(".resourcesources article+article{border-left:1px solid var(--line-soft)}")self.assertPageContains(".resourceapplyrow .resourcesyncok{color:var(--success)}")diff --git a/web/app.js b/web/app.jsindex 496d63c35..5d53809bb 100644--- a/web/app.js+++ b/web/app.js@@ -1,3 +1,4 @@+import { resourceScanHtml } from './dist/peach-ui.js';import {$, ENTITY_ROUTES, LOC, ROUTE_ENTITIES, ROUTE_STATES, SITE_FAVICONS, STATE_LABELS, STATE_ROUTES, api, isAbort, mapLimit, brandIcon, entityPath, esc, faviconFallbackUrl, faviconUrl, linkHost, linkMarkUrl, fmtClock, fmtDur, fmtSize, foldName, icon, isCatalogPath, realDuration} from './js/core.js';import { faceFrame } from './js/face-frame.js';import { imageFallbackAttrs, wireImageFallbacks } from './js/image-fallback.js';@@ -1672,11 +1673,12 @@ $('#batchClear').onclick=()=>setSelectMode(false,true);$('#followBatchAll').onclick=()=>{visibleFollowIds().forEach(id=>followSelected.add(id));setSelectMode(true);paintSelection()};$('#batchbar').querySelectorAll('[data-batch]').forEach(button=>button.onclick=async()=>{const labels={like:'喜欢',seen:'标为看过',later:'加入稍后看',dispose:'加入回收站',restore:'还原',delete:'彻底删除'};+ const titles={like:'喜欢所选项目',seen:'标记为已看',later:'加入稍后看',dispose:'移入回收站',restore:'还原所选项目',delete:'永久删除所选项目'};const operation=button.dataset.batch,ids=[...selected];if(!ids.length)return;- if(!confirm(`确认对 ${ids.length} 个资源执行“${labels[operation]}”?\n${operation==='delete'?'此操作会永久删除文件和账本记录,不可恢复。':'回收站中的文件仍保留,可从回收站入口永久清除。'}`))return;- button.disabled=true;+ return confirmModal({title:titles[operation],body:`将处理选中的 ${ids.length} 项。${operation==='delete'?'文件和馆藏记录会永久删除,无法恢复。':operation==='dispose'?'馆藏记录可在回收站还原。':''}`,confirmLabel:titles[operation],danger:operation==='delete',onConfirm:async()=>{+ setActionBusy(button);try{const r=await api('/api/batch',{method:'POST',body:JSON.stringify({ids,operation})});- if(r.blocked&&r.blocked.length)alert(`已永久删除 ${r.purged} 个;${r.blocked.length} 个删不掉,仍留在回收站:\n`+ if(r.blocked&&r.blocked.length)throw new Error(`已永久删除 ${r.purged} 项;${r.blocked.length} 项未能删除,仍在回收站:\n`+r.blocked.slice(0,5).map(x=>`${x.path}(${x.reason})`).join('\n'));setSelectMode(false,true);await reloadCurrentSurface();const inverse=operation==='dispose'?'restore':operation==='restore'?'dispose':null;@@ -1684,27 +1686,31 @@ $('#batchbar').querySelectorAll('[data-batch]').forEach(button=>button.onclick=aawait api('/api/batch',{method:'POST',body:JSON.stringify({ids,operation:inverse})});await reloadCurrentSurface();}:null})}- catch(error){actionFailure('批量操作',error)}- finally{button.disabled=false;paintSelection()}+ catch(error){setActionBusy(button,false);throw error}+ finally{setActionBusy(button,false);paintSelection()}+ }});});$('#batchbar').querySelectorAll('[data-follow-batch]').forEach(button=>button.onclick=async()=>{const action=button.dataset.followBatch,items=[...followSelected];if(!items.length)return;const labels={save:'保存到账本',seen:'标记已看',ignored:'忽略'};- if(!confirm(`确认对 ${items.length} 个关注作品执行“${labels[action]}”?`))return;- button.disabled=true;+ const titles={save:'保存所选作品',seen:'标记为已看',ignored:'忽略所选作品'};+ return confirmModal({title:titles[action],body:`将处理选中的 ${items.length} 项关注作品。`,confirmLabel:titles[action],danger:false,onConfirm:async()=>{+ setActionBusy(button);try{const path=action==='save'?'/api/follow/save':'/api/follow/status';const body=action==='save'?{items}:{items,to:action};await api(path,{method:'POST',body:JSON.stringify(body)});setSelectMode(false,true);await openFollow(false);actionReceipt(`已${labels[action]} ${items.length} 项`);- }catch(error){actionFailure('批量操作',error)}- finally{button.disabled=false;paintSelection()}+ }catch(error){setActionBusy(button,false);throw error}+ finally{setActionBusy(button,false);paintSelection()}+ }});});$('#batchbar').querySelectorAll('[data-junk-batch]').forEach(button=>button.onclick=async()=>{const operation=button.dataset.junkBatch,ids=[...selected];if(!ids.length)return;const labels={'dismiss-junk':'不是垃圾','reconsider-junk':'重新判断',dispose:'移入回收站'};- if(!confirm(`确认把 ${ids.length} 个垃圾文件候选“${labels[operation]}”?`))return;- button.disabled=true;+ const titles={'dismiss-junk':'标记为非垃圾','reconsider-junk':'重新检查文件',dispose:'移入回收站'};+ return confirmModal({title:titles[operation],body:`将处理选中的 ${ids.length} 个文件。`,confirmLabel:titles[operation],danger:false,onConfirm:async()=>{+ setActionBusy(button);try{await api('/api/batch',{method:'POST',body:JSON.stringify({ids,operation})});setSelectMode(false,true);adsBatch=null;await load(true);@@ -1714,8 +1720,9 @@ $('#batchbar').querySelectorAll('[data-junk-batch]').forEach(button=>button.onclawait api('/api/batch',{method:'POST',body:JSON.stringify({ids,operation:inverse})});await load(true);}:null});- }catch(error){actionFailure('批量操作',error)}- finally{button.disabled=false;paintSelection()}+ }catch(error){setActionBusy(button,false);throw error}+ finally{setActionBusy(button,false);paintSelection()}+ }});});/* 密度:大图为主,密集为辅 */@@ -2801,17 +2808,17 @@ function renderCount(){wireCountRow();const emptyTrash=$('#emptyTrash');if(emptyTrash)emptyTrash.onclick=async(e)=>{- if(!confirm('永久删除回收站中的全部文件和账本记录?此操作不可恢复。'))return;- e.currentTarget.disabled=true;+ return confirmModal({title:'清空回收站',body:'回收站中的全部文件和馆藏记录将永久删除,无法恢复。',confirmLabel:'清空回收站',danger:true,onConfirm:async()=>{+try{const r=await api('/api/trash/empty',{method:'POST'});/* 删不掉的文件(占用中、网盘离线)会连同账本行一起留在回收站,必须说出来,否则用户看到条目还在会以为清空又没生效。 */- if(r.blocked&&r.blocked.length)alert(`已永久删除 ${r.purged} 个;${r.blocked.length} 个删不掉,仍留在回收站:\n`+ if(r.blocked&&r.blocked.length)throw new Error(`已永久删除 ${r.purged} 项;${r.blocked.length} 项未能删除,仍在回收站:\n`+r.blocked.slice(0,5).map(x=>`${x.path}(${x.reason})`).join('\n'));actionReceipt(`已永久删除 ${r.purged} 项`);- }catch(error){actionFailure('清空回收站',error);}finally{await load(true)}+ }});};}@@ -3070,14 +3077,15 @@ async function wireLinkManager(){result.innerHTML=`<div class="resourcepanel"${apply?' data-fieldset-type="error"':''}>${progress}${gone}${unclear}${apply}${clean}</div>`;$('#linkPrune')?.addEventListener('click',async event=>{const control=event.currentTarget;- if(!confirm(`删除 ${payload.gone.length} 条已失效链接?删除前会逐条重验,但删除本身不可撤销。`))return;+ return confirmModal({title:'删除失效链接',body:`将删除 ${payload.gone.length} 条失效链接。删除前会再次检查,删除后无法恢复。`,confirmLabel:'删除失效链接',danger:true,onConfirm:async()=>{setActionBusy(control);control.innerHTML=`${spinnerHtml('正在重验')}<span>正在重验并删除…</span>`;try{const out=await api('/api/links/prune',{method:'POST',body:JSON.stringify({confirm:true,check_id:payload.check_id,background:true})});sessionStorage.setItem('peach-link-prune-job',out.job_id);if(active())void wirePruneProgress();- }catch(error){if(active()){result.insertAdjacentHTML('beforeend',noteHtml(error.message,{variant:'error',label:'删除失败'}));void wirePruneProgress()}}+ }catch(error){setActionBusy(control,false);if(active())void wirePruneProgress();throw error}+ }});});};@@ -3106,10 +3114,10 @@ function resourceSyncMarkup(){return `<section class="resourcesync" id="resource-sync" aria-labelledby="resourceSyncTitle"><h2 id="resourceSyncTitle">资源同步</h2><div class="resourcesyncbox" data-geist-fieldset>- <div class="resourcesyncbody geist-fieldset-content">${fieldsetTitle('resourceBoxTitle','网盘与本地数据库')}- <p>网盘上已删除的条目进入回收站;只清理没有在用的预览与播放缓存。</p></div>+ <div class="resourcesyncbody geist-fieldset-content">${fieldsetTitle('resourceBoxTitle','检查文件与馆藏记录')}+ <p>检查本地磁盘和网盘,找出失效的馆藏记录与闲置缓存。</p></div><div class="resourcesyncfooter geist-fieldset-footer" data-geist-fieldset-footer>- <button class="resourceaction" type="button" id="resourceScan">${icon('refresh-cw')}<span>扫描差异</span></button></div></div>+ <button class="resourceaction" type="button" id="resourceScan">${icon('refresh-cw')}<span>检查文件</span></button></div></div><div id="resourceSyncResult" aria-live="polite"></div></section>`;}async function wireResourceSync(){@@ -3118,38 +3126,29 @@ async function wireResourceSync(){const active=()=>location.pathname==='/data-cleanup'&&!$('#stats').hidden&&document.body.contains(result);const setBusy=(busy,done=false)=>{setActionBusy(scan,busy);- scan.innerHTML=`${icon('refresh-cw')}<span>${busy?'扫描中':done?'重新扫描':'扫描差异'}</span>`;+ scan.innerHTML=`${icon('refresh-cw')}<span>${busy?'扫描中':done?'重新扫描':'检查文件'}</span>`;};const render=payload=>{- const sources=payload.sources||[];const cache=payload.cache||{files:0,bytes:0};- const hasChanges=Boolean(payload.missing||cache.files);- result.innerHTML=`<div class="resourcepanel"${hasChanges?' data-fieldset-type="warning"':''}><div class="resourcesources">${sources.map(source=>`<article>- <div class="resourcesourcetitle"><b>${esc(LOC[source.location]||source.location)}</b><span class="${source.online?'online':'offline'}">${source.online?'已挂载':'离线,已跳过'}</span></div>- <strong>${source.online?source.missing.toLocaleString():'—'}</strong>- <small>${source.online?`项已从网盘删除 · 已核对 ${source.checked.toLocaleString()} 项${source.unreadable?` · ${source.unreadable.toLocaleString()} 项暂时无法读取`:''}`:`本地数据库有 ${source.total.toLocaleString()} 项`}</small></article>`).join('')}</div>- <div class="resourcecache"><div><span>孤立缓存</span><b>${cache.files.toLocaleString()}</b><small>${fmtSize(cache.bytes||0)}</small></div>- <div><span>待同步</span><b>${Number(payload.missing||0).toLocaleString()} 项</b></div></div>- ${hasChanges?noteHtml(`将把 ${payload.missing||0} 项移入回收站,并删除 ${cache.files||0} 个可重建缓存。`,{variant:'warning',label:'同步影响'}):''}- <div class="resourceapplyrow">${hasChanges?`<button class="resourceaction warning" type="button" id="resourceApply">同步并清理</button>`:- '<p class="resourcesyncok">本地数据库与已挂载网盘一致,没有孤立缓存。</p>'}</div></div>`;+ result.innerHTML=resourceScanHtml(payload,fmtSize);$('#resourceApply')?.addEventListener('click',async event=>{const button=event.currentTarget;- if(!confirm(`把 ${payload.missing||0} 项移入回收站,并清理 ${cache.files||0} 个可重建缓存?`))return;+ return confirmModal({title:'清理失效记录与缓存',body:`将把找不到文件的 ${payload.missing||0} 项馆藏记录移入回收站,并清理 ${cache.files||0} 个闲置缓存。记录可从回收站还原。`,confirmLabel:'清理失效记录与缓存',danger:false,onConfirm:async()=>{setActionBusy(button);- button.innerHTML=`${spinnerHtml('正在应用')}<span>正在重新核对并应用…</span>`;+ button.innerHTML=`${spinnerHtml('正在清理')}<span>正在检查并清理…</span>`;try{const applied=await api('/api/resource-sync/apply',{method:'POST',body:JSON.stringify({confirm:true,clean_cache:true,scan_id:payload.scan_id||'',background:true})});sessionStorage.setItem('peach-resource-apply-job',applied.job_id);if(active())void wireResourceApplyProgress();}catch(error){setActionBusy(button,false);- button.innerHTML=`${icon('refresh-cw')}<span>重试同步</span>`;- result.insertAdjacentHTML('beforeend',noteHtml(error.message,{variant:'error',label:'同步失败'}));if(active())void wireResourceApplyProgress()}+ button.textContent='清理失效记录与缓存';+ if(active())void wireResourceApplyProgress();throw error}+ }});});};const followScan=async payload=>{- setBusy(true);result.innerHTML=`<p class="resourcescanning">${loadingDotsHtml('正在后台核对网盘元数据,不会读取视频内容。')}</p>`;+ setBusy(true);result.innerHTML=`<p class="resourcescanning">${loadingDotsHtml('正在检查本地磁盘和网盘…')}</p>`;try{if(!payload){try{payload=await api('/api/resource-sync/scan',{method:'POST',body:JSON.stringify({background:true,restart:true})})}catch(error){if(active())result.innerHTML=noteHtml('暂时无法确认启动结果,正在读取任务状态…',{label:'任务状态'})}}@@ -3177,9 +3176,11 @@ async function wireResourceSync(){void wireResourceApplyProgress();}function wireResourceApplyProgress(){- return wireOperationProgress({host:$('#resource-sync'),path:'/api/resource-sync/apply',key:'peach-resource-apply-job',title:'正在核对来源、同步并清理缓存…',- busy:running=>{const button=$('#resourceApply');if(button){setActionBusy(button,running);if(!running)button.textContent='同步并清理'}},- complete:out=>{$('#resourceSyncResult').innerHTML=noteHtml(`已把 ${out.moved_to_trash} 项移入回收站,清理 ${out.cache_removed} 个缓存,释放 ${fmtSize(out.bytes_reclaimed||0)}。`,{variant:'success',label:'完成'})}});+ return wireOperationProgress({host:$('#resource-sync'),path:'/api/resource-sync/apply',key:'peach-resource-apply-job',title:'正在检查文件并清理…',+ busy:running=>{const button=$('#resourceApply');if(button){setActionBusy(button,running);if(!running)button.textContent='清理失效记录与缓存'}},+ complete:out=>{const failed=out.cache_blocked||[];+ $('#resourceSyncResult').innerHTML=noteHtml(`已把 ${out.moved_to_trash} 项记录移入回收站,清理 ${out.cache_removed} 个缓存,释放 ${fmtSize(out.bytes_reclaimed||0)}。${failed.length?`${failed.length} 个缓存未能清理,请重新检查后重试。`:''}`,{label:failed.length?'部分完成':'清理结果',variant:failed.length?'warning':'default'});+ if(!failed.length)actionReceipt('已清理失效记录与缓存')}});}/* 旧直达 URL 仍然可用,落点跟着面板一起搬到数据管理。 */async function openResourceSync(push=true){@@ -3372,11 +3373,12 @@ function renderTaste(d){catch(error){stateEl.textContent=error.message||'导入失败';actionFailure('导入口味数据',error)}};root.querySelectorAll('[data-taste-kind]').forEach(button=>button.onclick=()=>openTasteSignal(button.dataset.tasteKind,button.dataset.tasteName));root.querySelectorAll('[data-taste-remove]').forEach(button=>button.onclick=async()=>{- if(!confirm('从口味分析中移除这个数据源?原始导出文件会保留。'))return;- button.disabled=true;stateEl.textContent='正在移除…';+ return confirmModal({title:'移除口味数据源',body:'这个数据源将不再用于口味分析。原始导出文件保留。',confirmLabel:'移除口味数据源',danger:false,onConfirm:async()=>{+ setActionBusy(button);stateEl.textContent='正在移除…';try{const result=await api('/api/taste/source',{method:'POST',body:JSON.stringify({operation:'remove',source_key:button.dataset.tasteRemove,window:tasteWindow})});tasteCacheSet(tasteWindow,result.dashboard);renderTaste(result.dashboard);actionReceipt('已移除口味数据源')}- catch(error){stateEl.textContent=error.message||'移除失败';button.disabled=false}});+ catch(error){setActionBusy(button,false);throw error}+ }});});}async function openTaste(push=true){releaseHoverPreviews();disposeStage(false);enterManagementSurface();@@ -3446,12 +3448,16 @@ async function movePlaylistItem(queue,index,delta,currentId){await openPlaylist(queue.playlistId,currentId,false);actionReceipt('已调整播放顺序');}async function removePlaylistItem(queue,assetId,currentId){- if(queue?.kind!=='playlist'||!confirm('从播放列表移出这个视频?'))return;- const result=await api('/api/playlist',{method:'POST',body:JSON.stringify({action:'remove',id:queue.playlistId,asset_id:assetId})});- if(!result.playlist.items.length){await openPlaylists(true);return}- const next=result.playlist.items.some(item=>item.id===currentId)?currentId:result.playlist.current_asset_id;- await openPlaylist(queue.playlistId,next,false);actionReceipt('已移出播放列表');+ if(queue?.kind!=='playlist')return;+ return confirmModal({title:'移出播放列表',body:'这个视频将从播放列表移除,视频文件保留。',confirmLabel:'移出播放列表',onConfirm:async()=>{+ const result=await api('/api/playlist',{method:'POST',body:JSON.stringify({action:'remove',id:queue.playlistId,asset_id:assetId})});+ actionReceipt('已移出播放列表');+ if(!result.playlist.items.length){await openPlaylists(true);return}+ const next=result.playlist.items.some(item=>item.id===currentId)?currentId:result.playlist.current_asset_id;+ await openPlaylist(queue.playlistId,next,false);+ }});}+async function openPlaylists(push=true){releaseHoverPreviews();disposeStage(false);enterManagementSurface();if(push)route('/playlists');@@ -3475,9 +3481,10 @@ async function openPlaylists(push=true){$('#stats').querySelectorAll('[data-rename-playlist]').forEach(button=>button.onclick=async()=>{const card=button.closest('[data-playlist-card]'),input=card.querySelector('[data-playlist-name]');try{await api('/api/playlist',{method:'POST',body:JSON.stringify({action:'rename',id:+button.dataset.renamePlaylist,name:input.value})});await openPlaylists(false);actionReceipt('已重命名播放列表')}catch(error){actionFailure('重命名播放列表',error)}});- $('#stats').querySelectorAll('[data-delete-playlist]').forEach(button=>button.onclick=async()=>{if(!confirm('删除这个播放列表?视频本身不会删除。'))return;+ $('#stats').querySelectorAll('[data-delete-playlist]').forEach(button=>button.onclick=async()=>{return confirmModal({title:'删除播放列表',body:'这个播放列表将被删除,视频文件保留。',confirmLabel:'删除播放列表',danger:true,onConfirm:async()=>{try{await api('/api/playlist',{method:'POST',body:JSON.stringify({action:'delete',id:+button.dataset.deletePlaylist})});await openPlaylists(false);actionReceipt('已删除播放列表')}- catch(error){actionFailure('删除播放列表',error)}});+ catch(error){setActionBusy(button,false);throw error}+ }});});window.scrollTo({top:0,behavior:'smooth'});}@@ -3552,7 +3559,7 @@ async function openDataCleanup(push=true){</section>`).join('')}</div>${linkManagerMarkup()}- ${cloudLocations(sources.sources||[]).length?resourceSyncMarkup():''}</div>`;+ ${(sources.sources||[]).some(source=>['local','115','pikpak'].includes(source.location)&&source.roots?.length)?resourceSyncMarkup():''}</div>`;$('#stats').querySelector('[data-cleanup-open="junk"]').onclick=()=>openManage('ads');const processingUi=await import('/dist/peach-ui.js');if(!surfaceCurrent(surface))return;@@ -3565,7 +3572,7 @@ async function openDataCleanup(push=true){paintDataManagementCounts();const emptyButton=$('#stats').querySelector('[data-cleanup-empty]');emptyButton.onclick=async()=>{- if(!confirm('删除所有已挂载资源来源中的空文件夹?来源根目录不会删除。'))return;+ return confirmModal({title:'删除空文件夹',body:'将删除已连接磁盘和网盘中的空文件夹,保留来源根目录。',confirmLabel:'删除空文件夹',danger:true,onConfirm:async()=>{const status=$('#stats').querySelector('.cleanupstate'),original=emptyButton.innerHTML;setActionBusy(emptyButton);emptyButton.innerHTML=`${spinnerHtml('正在删除空文件夹')}<span>正在清理</span>`;status.textContent='正在自底向上检查已挂载来源…';@@ -3574,8 +3581,8 @@ async function openDataCleanup(push=true){status.textContent=`已检查 ${Number(result.scanned||0).toLocaleString()} 个目录,删除 ${Number(result.removed||0).toLocaleString()} 个${result.errors?`,${Number(result.errors).toLocaleString()} 个读取或删除失败`:''}。`;if(result.errors)actionFailure('空文件夹清理',new Error(`${result.errors} 个目录处理失败`));else actionReceipt(`已删除 ${Number(result.removed||0).toLocaleString()} 个空文件夹`);- }catch(error){status.textContent=error.message||'空文件夹清理失败';actionFailure('空文件夹清理',error)}- finally{setActionBusy(emptyButton,false);emptyButton.innerHTML=original}+ }finally{setActionBusy(emptyButton,false);emptyButton.innerHTML=original}+ }});};await wireLinkManager();await wireResourceSync();@@ -3686,9 +3693,8 @@ async function disposeDuplicates(groups,keep,button){const victims=new Set(ids);const bytes=groups.reduce((n,g)=>n+g.files.reduce((m,f)=>m+(victims.has(f.id)?f.size||0:0),0),0);const label={largest:'最大的一个',longest:'最长的一个','115':'115(没有则留最大)',pikpak:'PikPak(没有则留最大)',all:'零个文件'}[keep];- if(!confirm(`把 ${ids.length} 个文件移入回收站,每组保留${label}?\n`- +`预计回收 ${fmtSize(bytes)}。文件仍在回收站里,可以还原。`))return;- button.disabled=true;+ return confirmModal({title:'移入回收站',body:`将把 ${ids.length} 个重复文件的馆藏记录移入回收站,每组保留${label}。文件共 ${fmtSize(bytes)},记录可从回收站还原。`,confirmLabel:'移入回收站',danger:false,onConfirm:async()=>{+ setActionBusy(button);try{// /api/batch 单次上限 200,分批发。for(let i=0;i<ids.length;i+=200){@@ -3696,7 +3702,9 @@ async function disposeDuplicates(groups,keep,button){body:JSON.stringify({ids:ids.slice(i,i+200),operation:'dispose'})});}await openDuplicates(false);- }finally{button.disabled=false}+ actionReceipt(`已把 ${ids.length} 项移入回收站`);+ }finally{setActionBusy(button,false)}+ }});}async function openReview(push=true){releaseHoverPreviews();disposeStage(false);enterManagementSurface();@@ -5219,13 +5227,14 @@ function wireFollowManage(creds=[]){if(prefix)prefix.innerHTML=icon('search')}};root.querySelectorAll('[data-follow-remove]').forEach(button=>button.onclick=async()=>{- if(!confirm('不再追这个来源?已经抓到的条目会一并移除,媒体本身不受影响。'))return;- button.disabled=true;+ return confirmModal({title:'取消关注来源',body:'将移除这个来源及已抓取的条目,媒体文件保留。',confirmLabel:'取消关注来源',danger:true,onConfirm:async()=>{+ setActionBusy(button);try{await api('/api/follow/source',{method:'POST',body:JSON.stringify({action:'remove',id:+button.dataset.followRemove})});await openFollowManage(false);actionReceipt('已取消关注来源');- }catch(error){button.disabled=false;actionFailure('取消关注来源',error)}+ }catch(error){setActionBusy(button,false);throw error}+ }});});root.querySelectorAll('[data-follow-enabled]').forEach(control=>control.onchange=async()=>{const enabled=control.checked;control.disabled=true;@@ -5290,13 +5299,14 @@ function wireFollowManage(creds=[]){};root.querySelectorAll('[data-follow-alias-remove]').forEach(button=>button.onclick=async()=>{const alias=button.dataset.followAliasRemove;- if(!confirm(`移除作者别名「${alias}」?对应来源会恢复成独立作者组。`))return;- button.disabled=true;+ return confirmModal({title:'移除作者别名',body:`将移除别名「${alias}」,对应来源恢复为独立作者组。`,confirmLabel:'移除作者别名',danger:false,onConfirm:async()=>{+ setActionBusy(button);try{await api('/api/follow/author-alias',{method:'POST',body:JSON.stringify({action:'remove',alias})});await openFollowManage(false);actionReceipt('已移除作者别名');- }catch(error){button.disabled=false;actionFailure('移除作者别名',error)}+ }catch(error){setActionBusy(button,false);throw error}+ }});});root.querySelectorAll('[data-follow-guess]').forEach(chip=>chip.onclick=()=>{if(!form)return;@@ -5321,21 +5331,22 @@ function wireFollowManage(creds=[]){}catch(error){state.textContent=error.message||'保存失败';button.disabled=false}});root.querySelectorAll('[data-cred-clear]').forEach(button=>button.onclick=async()=>{- if(!confirm('清除这个来源的凭据?本机和共享副本都会被删除。'))return;- button.disabled=true;+ return confirmModal({title:'清除来源凭据',body:'将清除这个来源在本机和共享副本中的登录凭据。',confirmLabel:'清除来源凭据',danger:true,onConfirm:async()=>{+ setActionBusy(button);try{// 共享盘不在时后端只撤掉了本机那份,必须让用户看见——否则他以为撤干净了,// 等盘回来 key 又被同步回来。const done=await api('/api/follow/credential',{method:'POST',body:JSON.stringify({provider:button.dataset.credClear,values:{}})});- if(done.note)alert(done.note);+ if(done.note)throw new Error(done.note);await openFollowManage(false);actionReceipt('已清除来源凭据');- }catch(error){button.disabled=false;actionFailure('清除来源凭据',error)}+ }catch(error){setActionBusy(button,false);throw error}+ }});});root.querySelectorAll('[data-follow-bulk]').forEach(button=>button.onclick=async()=>{const to=button.dataset.followBulk;- if(!confirm(`把当前全部「未看」标记为${to==='seen'?'已看':'已忽略'}?`))return;- button.disabled=true;+ return confirmModal({title:to==='seen'?'标记已看':'标记已忽略',body:`将把当前未看作品标记为${to==='seen'?'已看':'已忽略'}。`,confirmLabel:to==='seen'?'标记已看':'标记已忽略',danger:false,onConfirm:async()=>{+ setActionBusy(button);try{const pending=await api('/api/follow?status=new&limit=1000');const ids=(pending.groups||[]).flatMap(g=>[g.primary,...g.variants,...g.duplicates])@@ -5348,7 +5359,8 @@ function wireFollowManage(creds=[]){await openFollowManage(false);if(failed.length)actionFailure(`批量更新 ${failed.length}/${ids.length} 项`,failed[0].error);else actionReceipt(`已批量标记 ${ids.length} 项`);- }catch(error){button.disabled=false;actionFailure('批量更新关注状态',error)}+ }catch(error){setActionBusy(button,false);throw error}+ }});});root.querySelectorAll('[data-follow-view]').forEach(button=>button.onclick=()=>openFollow());@@ -7900,7 +7912,7 @@ async function openTok(startId,push=true){const selectedItem=await api('/api/item?id='+startId);if(selectedItem.id)tokList=[selectedItem,...tokList.filter(x=>x.id!==startId)];}- if(!tokList.length){alert('当前筛选下没有可直接播放的内容(计费源不进沉浸模式)');$('#tokClose').click();return}+ if(!tokList.length){$('#tokClose').click();toast({text:'当前筛选下没有可直接播放的内容'});return}tokIdx=Math.max(0,tokList.findIndex(x=>x.id===startId));await tokShow();}catch(_e){setTokLoading(false);$('#tokClose').click()}diff --git a/web/css/11-identity.css b/web/css/11-identity.cssindex 16cce0492..1c015f670 100644--- a/web/css/11-identity.css+++ b/web/css/11-identity.css@@ -118,7 +118,7 @@ button.serieslink.entitylink:hover{color:var(--tungsten);text-decoration:none}.revieworigin>div button{display:inline-flex;align-items:center;gap:6px;border:0;border-radius:var(--control-radius);background:var(--hover);padding:6px 9px;color:var(--ink-2);cursor:pointer}.revieworigin>div button:hover{color:var(--ink)}.revieworigin>div button svg{width:15px;height:15px;stroke:currentColor;fill:none;stroke-width:2}@media(max-width:640px){.qualitylist{grid-template-columns:1fr}.qualityitem{grid-template-columns:110px minmax(0,1fr)}.qualitycover{width:110px}.reviewcompare{grid-template-columns:1fr}.revieworigin{grid-template-columns:110px minmax(0,1fr)}.revieworigincover{width:110px}}-@media(max-width:640px){.resourcesync .resourcesources{grid-template-columns:1fr}.resourcesync .resourcesources article+article{border-left:0;border-top:1px solid var(--line-soft)}.resourcesync .resourcecache{grid-template-columns:1fr}.resourcesync .resourcecache>div+div{border-left:0;border-top:1px solid var(--line-soft)}}+@media(max-width:640px){.resourcesync .resourcesources{grid-auto-flow:row;grid-template-columns:1fr}.resourcesync .resourcesources article+article{border-left:0;border-top:1px solid var(--line-soft)}.resourcesync .resourcecache{grid-template-columns:1fr}.resourcesync .resourcecache>div+div{border-left:0;border-top:1px solid var(--line-soft)}}.indexmore[hidden],.entitymore[hidden]{display:none}.indexmore,.entitymore{display:flex;align-items:center;justify-content:center;margin:20px auto 0;min-width:124px;diff --git a/web/css/12-cards.css b/web/css/12-cards.cssindex c25059e9b..20492d3ed 100644--- a/web/css/12-cards.css+++ b/web/css/12-cards.css@@ -40,7 +40,7 @@ main{position:relative;z-index:1;padding:14px 16px 90px}.count.count-actions-only{position:relative;top:auto;min-height:0;margin:0 0 16px;padding:0;justify-content:flex-end}.count.count-actions-only:empty{display:none}.resourcesync{scroll-margin-top:calc(var(--topH) + 18px);display:grid;gap:16px}.resourcesync>h2{margin:0;font-size:var(--fs-xl)}-.resourcesyncbox,.resourcepanel{overflow:clip;border:1px solid var(--field-ring);border-radius:var(--floating-radius);background:var(--ground)}.resourcesyncbody{padding:20px}.resourcesyncbody p{max-width:760px;margin:0;color:var(--muted);font-size:var(--fs-sm);line-height:1.55}.resourcesyncfooter,.resourceapplyrow{box-sizing:border-box;min-height:var(--fieldset-bar-h);display:flex;align-items:center;justify-content:flex-end;gap:8px;padding:12px 12px 12px 20px;border-top:1px solid var(--line-soft);background:var(--overlay-5)}.resourcesyncfooter p,.resourceapplyrow>p{margin:0;color:var(--muted);font-size:var(--fs-xs);line-height:1.5}.resourceaction{box-sizing:border-box;height:36px;padding:0 12px;border:1px solid var(--line-soft);border-radius:var(--control-radius);background:var(--ground);color:var(--ink-2);display:inline-flex;align-items:center;justify-content:center;gap:8px;flex:none;font:inherit;font-size:var(--fs-sm);font-weight:500;cursor:pointer;transition:background-color .12s,border-color .12s,color .12s}.resourceaction:hover:not(:disabled){background:var(--surface);color:var(--ink)}.resourceaction:focus-visible{outline:2px solid var(--tungsten);outline-offset:2px}.resourceaction:disabled{background:var(--sunk);border-color:var(--line-soft);color:var(--muted);cursor:default}.resourceaction svg{width:16px;height:16px;stroke:currentColor;fill:none}#resourceSyncResult:empty{display:none}.resourcescanning{margin:0;padding:14px 16px;border:1px solid var(--line-soft);border-radius:var(--control-radius);color:var(--muted)}.resourcesources{display:grid;grid-template-columns:repeat(3,minmax(0,1fr))}.resourcesources article{display:grid;gap:4px;min-width:0;padding:16px}.resourcesources article+article{border-left:1px solid var(--line-soft)}.resourcesourcetitle{display:flex;align-items:center;justify-content:space-between;gap:12px}.resourcesourcetitle span{font-size:var(--fs-xs)}.resourcesources .online{color:var(--success)}.resourcesources .offline{color:var(--drop)}.resourcesources strong{margin-top:10px;font-size:var(--fs-2xl);font-variant-numeric:tabular-nums}.resourcesources small,.resourcecache small{color:var(--muted)}/* 这里是一排读数,不是又一个盒子。原先它自带填色和分格线,和下面的操作条同色,+.resourcesyncbox,.resourcepanel{overflow:clip;border:1px solid var(--field-ring);border-radius:var(--floating-radius);background:var(--ground)}.resourcesyncbody{padding:20px}.resourcesyncbody p{max-width:760px;margin:0;color:var(--muted);font-size:var(--fs-sm);line-height:1.55}.resourcesyncfooter,.resourceapplyrow{box-sizing:border-box;min-height:var(--fieldset-bar-h);display:flex;align-items:center;justify-content:flex-end;gap:8px;padding:12px 12px 12px 20px;border-top:1px solid var(--line-soft);background:var(--overlay-5)}.resourcesyncfooter p,.resourceapplyrow>p{margin:0;color:var(--muted);font-size:var(--fs-xs);line-height:1.5}.resourceaction{box-sizing:border-box;height:36px;padding:0 12px;border:1px solid var(--line-soft);border-radius:var(--control-radius);background:var(--ground);color:var(--ink-2);display:inline-flex;align-items:center;justify-content:center;gap:8px;flex:none;font:inherit;font-size:var(--fs-sm);font-weight:500;cursor:pointer;transition:background-color .12s,border-color .12s,color .12s}.resourceaction:hover:not(:disabled){background:var(--surface);color:var(--ink)}.resourceaction:focus-visible{outline:2px solid var(--tungsten);outline-offset:2px}.resourceaction:disabled{background:var(--sunk);border-color:var(--line-soft);color:var(--muted);cursor:default}.resourceaction svg{width:16px;height:16px;stroke:currentColor;fill:none}#resourceSyncResult:empty{display:none}.resourcescanning{margin:0;padding:14px 16px;border:1px solid var(--line-soft);border-radius:var(--control-radius);color:var(--muted)}.resourcesources{display:grid;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr)}.resourcesources article{display:grid;gap:4px;min-width:0;padding:16px}.resourcesources article+article{border-left:1px solid var(--line-soft)}.resourcesourcetitle{display:flex;align-items:center;justify-content:space-between;gap:12px}.resourcesourcetitle span{font-size:var(--fs-xs)}.resourcesources .online{color:var(--success)}.resourcesources .offline{color:var(--drop)}.resourcesources strong{margin-top:10px;font-size:var(--fs-2xl);font-variant-numeric:tabular-nums}.resourcesources small,.resourcecache small{color:var(--muted)}/* 这里是一排读数,不是又一个盒子。原先它自带填色和分格线,和下面的操作条同色,两条带子连在一起看不出边界;框里再套框也是多余的一层。 */.resourcecache{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 32px;border-top:1px solid var(--line-soft);padding:16px 20px}.resourcecache>div{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:baseline;gap:4px 16px}.resourcecache b{font-size:var(--fs-2xl);font-variant-numeric:tabular-nums}.resourcecache span{font-weight:600}.resourcecache small{grid-column:1/-1}.resourceapplyrow .resourcesyncok{color:var(--success)}.resourcedanger{color:var(--drop)}.resourcedanger:hover:not(:disabled){background:var(--drop);border-color:var(--drop);color:#fff}.resourcesyncok{margin:0;color:var(--success)}.tagbar,.count,.entitytagbar,.entitycollectionhead{transition:background-color .16s ease,border-color .16s ease}diff --git a/web/css/23-configuration.css b/web/css/23-configuration.cssindex 9d1beb34d..425799c24 100644--- a/web/css/23-configuration.css+++ b/web/css/23-configuration.css@@ -40,6 +40,7 @@.configpage .geist-input[aria-invalid="true"]{border-color:var(--drop)}.configpage .geist-input[aria-invalid="true"]:focus{box-shadow:0 0 0 4px color-mix(in srgb,var(--drop) 24%,transparent)}.confighelp{margin:8px 0 0;color:var(--muted);font-size:var(--fs-sm);line-height:1.5}+.cloudguide{min-width:0}.cloudguide details{margin-top:16px}.cloudguide summary{cursor:pointer;font-size:var(--fs-sm);min-height:var(--control-h);display:flex;align-items:center;gap:8px}.cloudguide summary:focus-visible{outline:2px solid var(--tungsten);outline-offset:2px}.cloudguide-profiles{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:20px;margin-top:16px}.cloudguide-profiles section{min-width:0}.cloudguide h4{font-size:var(--fs-sm);font-weight:600;margin:0 0 12px}.cloudguide dl{margin:0;font-size:var(--fs-sm);line-height:1.5}.cloudguide dt{color:var(--muted);margin-top:8px}.cloudguide dd{margin:0;font-variant-numeric:tabular-nums}.cloudguide-notes{padding-left:20px;font-size:var(--fs-sm);line-height:1.6;color:var(--muted)}.cloudguide-notes li+li{margin-top:8px}@media(max-width:640px){.cloudguide-profiles{grid-template-columns:1fr}.cloudguide-profiles section+section{border-top:1px solid var(--line-soft);padding-top:16px}.cloudguide summary{min-height:44px}}.confighelp a{color:var(--tungsten);text-decoration:none;margin-inline-start:6px}.confighelp a:hover{text-decoration:underline;text-underline-offset:3px}.confighelp a svg{display:inline-block;width:14px;height:14px;margin-inline-start:4px;vertical-align:-2px;stroke:currentColor;fill:none;stroke-width:2}diff --git a/web/dist/peach-ui.js b/web/dist/peach-ui.jsindex 8e907ce7e..ac377d9c8 100644--- a/web/dist/peach-ui.js+++ b/web/dist/peach-ui.js@@ -1066,19 +1066,116 @@ function st({ uninstall: e }) {});}//#endregion+//#region src/islands/clouddrive-guide.tsx+var ct = [+ {+ name: "机械硬盘或内存不超过 8 GB",+ cache: "10–20 GiB",+ read: "256 / 128 KB",+ task: "同时处理 1 个视频",+ advice: "缓存优先放内置 SSD。只有机械硬盘时,先用按需读取;反复观看同一批文件才开启文件夹缓存。"+ },+ {+ name: "SATA SSD,8–16 GB 内存",+ cache: "20–50 GiB",+ read: "256 / 128 KB",+ task: "同时处理 1–2 个视频",+ advice: "扫描、抽帧用小读块。观看高码率视频若仍缓冲,再试 512 / 256 KB。"+ },+ {+ name: "NVMe SSD,16 GB 以上内存",+ cache: "50–100 GiB",+ read: "256 / 128 KB",+ task: "同时处理 2 个视频起步",+ advice: "以扫描和拖动播放为主时保留小读块。连续看高码率视频可试 512 / 256 KB,速度不升就调回。"+ }+];+function lt() {+ let e = q(null);+ return K(() => {+ e.current && v(e.current, "details", "clouddrive-guide");+ }, []), /* @__PURE__ */ J("div", {+ ref: e,+ class: "cloudguide",+ children: [/* @__PURE__ */ J("p", {+ class: "confighelp",+ children: ["先在 CloudDrive 登录网盘并挂载,开启「启动时自动挂载」。", /* @__PURE__ */ J("a", {+ href: "https://www.clouddrive2.com/help.html",+ target: "_blank",+ rel: "noreferrer",+ children: ["挂载帮助", /* @__PURE__ */ J("svg", {+ "aria-hidden": "true",+ viewBox: "0 0 24 24",+ children: /* @__PURE__ */ J("use", { href: "#i-external-link" })+ })]+ })]+ }), /* @__PURE__ */ J("details", { children: [+ /* @__PURE__ */ J("summary", { children: "CloudDrive 速度与缓存建议" }),+ /* @__PURE__ */ J("p", {+ class: "confighelp",+ children: "按缓存所在的硬盘选起步配置。优先保证播放流畅,再用同一视频比较冷启动、拖动和流量;参数越大不一定越快。"+ }),+ /* @__PURE__ */ J("div", {+ class: "cloudguide-profiles",+ children: ct.map((e) => /* @__PURE__ */ J("section", {+ "aria-label": e.name,+ children: [+ /* @__PURE__ */ J("h4", { children: e.name }),+ /* @__PURE__ */ J("dl", { children: [+ /* @__PURE__ */ J("dt", { children: "磁盘缓存上限" }),+ /* @__PURE__ */ J("dd", { children: e.cache }),+ /* @__PURE__ */ J("dt", { children: "默认 / 最小读取长度" }),+ /* @__PURE__ */ J("dd", { children: e.read }),+ /* @__PURE__ */ J("dt", { children: "Peach 并行任务" }),+ /* @__PURE__ */ J("dd", { children: e.task })+ ] }),+ /* @__PURE__ */ J("p", {+ class: "confighelp",+ children: e.advice+ })+ ]+ }, e.name))+ }),+ /* @__PURE__ */ J("ul", {+ class: "cloudguide-notes",+ children: [+ /* @__PURE__ */ J("li", { children: "在 CloudDrive「设置」中设置磁盘缓存上限和 LRU(优先清理最久没用的缓存)。系统盘至少留 40 GiB;上限不要填 0。设置后重新打开确认,并观察实际占盘。" }),+ /* @__PURE__ */ J("li", { children: "在各网盘的下载设置中调整读取长度和下载线程。115 从 2 线程开始,遵守当前客户端上限;PikPak / WebDAV 从 2 线程开始,带宽充足且速度确实提升时再试 4。开启支持的直链选项,确认播放可用。" }),+ /* @__PURE__ */ J("li", { children: "PikPak 按当前 CloudDrive 提供的接入方式配置;使用 WebDAV 时,先确认服务端允许直链。不能直接套用 115 的连接方式。" }),+ /* @__PURE__ */ J("li", { children: "看视频时暂停批量抽帧,关闭不用的播放页。下载速度应高于视频码率除以 8,并留出余量:80 Mbps 视频约需 10 MB/s,建议稳定达到 15 MB/s。" }),+ /* @__PURE__ */ J("li", { children: "Buffer Cache 的内存占用、磁盘缓存和文件夹缓存是不同设置。磁盘显示的逻辑大小也不等于实际占盘;只改一个上限不能限制所有缓存。" })+ ]+ }),+ /* @__PURE__ */ J("p", {+ class: "confighelp",+ children: ["上表容量和并发是起步建议,按实际占盘与播放结果调整。直链和代理是不同设置;连接慢时分别比较,不能只看开关是否开启。", /* @__PURE__ */ J("a", {+ href: "https://www.clouddrive2.com/features.html",+ target: "_blank",+ rel: "noreferrer",+ children: ["缓存说明", /* @__PURE__ */ J("svg", {+ "aria-hidden": "true",+ viewBox: "0 0 24 24",+ children: /* @__PURE__ */ J("use", { href: "#i-external-link" })+ })]+ })]+ })+ ] })]+ });+}+//#endregion//#region src/islands/configuration.tsx-var ct = "/api/configuration", lt = "/api/pick-folder", ut = 8e3, dt = (e, t) => z(ct, t), Y = ({ html: e, class: t }) => /* @__PURE__ */ J("div", {+var ut = "/api/configuration", dt = "/api/pick-folder", ft = 8e3, pt = (e, t) => z(ut, t), mt = ({ html: e, class: t }) => /* @__PURE__ */ J("div", {class: t,dangerouslySetInnerHTML: { __html: e }-}), ft = (e) => !(e instanceof ke) || e.status !== 400 ? null : e.body?.errors ?? null;-function pt({ facts: e }) {+}), ht = (e) => !(e instanceof ke) || e.status !== 400 ? null : e.body?.errors ?? null;+function gt({ facts: e }) {return /* @__PURE__ */ J("section", {class: "configfieldset","data-geist-fieldset": !0,"aria-labelledby": "configFactsTitle",children: /* @__PURE__ */ J("div", {class: "geist-fieldset-content",- children: [/* @__PURE__ */ J(Y, { html: u("configFactsTitle", "运行信息") }), /* @__PURE__ */ J("dl", {+ children: [/* @__PURE__ */ J(mt, { html: u("configFactsTitle", "运行信息") }), /* @__PURE__ */ J("dl", {class: "configfacts",children: e.map((e) => /* @__PURE__ */ J(I, { children: [/* @__PURE__ */ J("dt", { children: e.term }), /* @__PURE__ */ J("dd", { children: [e.value, e.download_url ? /* @__PURE__ */ J("span", {class: "confighelp",@@ -1097,7 +1194,7 @@ function pt({ facts: e }) {})});}-function mt({ data: e }) {+function _t({ data: e }) {let [t, n] = W(e.media_sources), [r, i] = W(""), a = q(null);G(() => () => a.current?.abort(), []);let s = async (e) => {@@ -1105,7 +1202,7 @@ function mt({ data: e }) {let t = new AbortController();a.current = t, _(e, !0), i("");try {- let e = await z(ct, t.signal);+ let e = await z(ut, t.signal);t.signal.aborted || n(e.media_sources);} catch (e) {t.signal.aborted || i(R(e));@@ -1119,7 +1216,7 @@ function mt({ data: e }) {children: [/* @__PURE__ */ J("div", {class: "geist-fieldset-content",children: [- /* @__PURE__ */ J(Y, { html: u("configMountsTitle", "挂载状态") }),+ /* @__PURE__ */ J(mt, { html: u("configMountsTitle", "挂载状态") }),/* @__PURE__ */ J("dl", {class: "configfacts",children: t.map((e) => /* @__PURE__ */ J(I, { children: [/* @__PURE__ */ J("dt", { children: [/* @__PURE__ */ J("span", {@@ -1156,7 +1253,7 @@ function mt({ data: e }) {})]}) : null;}-function ht({ value: e, label: t, onChange: n }) {+function vt({ value: e, label: t, onChange: n }) {let r = q(null), i = q(null), a = q(n);return a.current = n, K(() => {let n = r.current;@@ -1182,7 +1279,7 @@ function ht({ value: e, label: t, onChange: n }) {class: "configsourcecontrol"});}-function gt({ data: e, receipt: t }) {+function yt({ data: e, receipt: t }) {let n = e.media_sources?.filter((e) => ["local","115",@@ -1192,7 +1289,7 @@ function gt({ data: e, receipt: t }) {w !== null && (O.current[w]?.focus(), T(null));}, [w]), G(() => {if (!S) return;- let e = setTimeout(() => location.assign(S.url), ut);+ let e = setTimeout(() => location.assign(S.url), ft);return () => clearTimeout(e);}, [S]);let A = (e, t) => {@@ -1211,7 +1308,7 @@ function gt({ data: e, receipt: t }) {if (t.getAttribute("aria-busy") !== "true") {_(t, !0);try {- let { path: t } = await B(lt, { initial: r[e] ?? "" });+ let { path: t } = await B(dt, { initial: r[e] ?? "" });t && (A(e, t), M(e, ""));} catch (t) {M(e, R(t));@@ -1247,7 +1344,7 @@ function gt({ data: e, receipt: t }) {if (n.preventDefault(), !E.current) {E.current = !0, _(k.current, !0), x("");try {- let n = await B(ct, {+ let n = await B(ut, {revision: D.current,media_dirs: r,...e.media_sources ? { media_sources: r.map((e, t) => ({@@ -1260,7 +1357,7 @@ function gt({ data: e, receipt: t }) {});D.current = n.revision, g([]), y(""), t("已保存配置"), C(n);} catch (e) {- let t = ft(e);+ let t = ht(e);t ? (g(t.media_dirs ?? []), y(t.port ?? "")) : (g([]), y(""), x(R(e)));} finally {E.current = !1, _(k.current, !1);@@ -1271,7 +1368,7 @@ function gt({ data: e, receipt: t }) {children: [/* @__PURE__ */ J("div", {class: "geist-fieldset-content",children: [- /* @__PURE__ */ J(Y, { html: u("configTitle", "这台电脑") }),+ /* @__PURE__ */ J(mt, { html: u("configTitle", "这台电脑") }),/* @__PURE__ */ J("div", {class: "configfield",children: [@@ -1328,7 +1425,7 @@ function gt({ data: e, receipt: t }) {class: "configsource",children: [/* @__PURE__ */ J("div", {class: "configsourcelabel",- children: ["媒体来源", /* @__PURE__ */ J(ht, {+ children: ["媒体来源", /* @__PURE__ */ J(vt, {label: `媒体来源 ${n + 1}`,value: a[n] || "local",onChange: (e) => {@@ -1361,19 +1458,7 @@ function gt({ data: e, receipt: t }) {onClick: ee,children: "添加文件夹"}),- a.some((e) => e === "115" || e === "pikpak") ? /* @__PURE__ */ J("p", {- class: "confighelp",- children: ["先在 CloudDrive 登录网盘并完成挂载。", /* @__PURE__ */ J("a", {- href: "https://www.clouddrive2.com/help.html",- target: "_blank",- rel: "noreferrer",- children: ["挂载帮助", /* @__PURE__ */ J("svg", {- "aria-hidden": "true",- viewBox: "0 0 24 24",- children: /* @__PURE__ */ J("use", { href: "#i-external-link" })- })]- })]- }) : null,+ a.some((e) => e === "115" || e === "pikpak") ? /* @__PURE__ */ J(lt, {}) : null,a.some((e) => e === "115" || e === "pikpak") ? e.mount_dependencies?.filter((e) => !e.available).map((e) => /* @__PURE__ */ J("p", {class: "confighelp",children: [@@ -1446,7 +1531,7 @@ function gt({ data: e, receipt: t }) {})]}), /* @__PURE__ */ J("span", { children: "保存后扫描并补全资料" })]}),- b ? /* @__PURE__ */ J(Y, { html: f(b, {+ b ? /* @__PURE__ */ J(mt, { html: f(b, {variant: "error",label: "没有保存"}) }) : null@@ -1463,8 +1548,8 @@ function gt({ data: e, receipt: t }) {})]});}-function _t({ receipt: e, data: t, error: n }) {- return n || !t ? /* @__PURE__ */ J(Y, {+function bt({ receipt: e, data: t, error: n }) {+ return n || !t ? /* @__PURE__ */ J(mt, {class: "configpage",html: f(n || "没有读到配置", {variant: "error",@@ -1485,14 +1570,14 @@ function _t({ receipt: e, data: t, error: n }) {class: "configgroup",children: "媒体"}),- t.editable ? /* @__PURE__ */ J(gt, {+ t.editable ? /* @__PURE__ */ J(yt, {data: t,receipt: e- }) : /* @__PURE__ */ J(Y, { html: f(t.notice, {+ }) : /* @__PURE__ */ J(mt, { html: f(t.notice, {variant: "secondary",label: "只读"}) }),- /* @__PURE__ */ J(mt, { data: t }),+ /* @__PURE__ */ J(_t, { data: t }),t.peach_proxy || t.access ? /* @__PURE__ */ J("h2", {class: "configgroup",children: "网络与访问"@@ -1513,30 +1598,30 @@ function _t({ receipt: e, data: t, error: n }) {initial: t.updates,initialJob: t.update_job}) : null,- /* @__PURE__ */ J(pt, { facts: t.facts }),+ /* @__PURE__ */ J(gt, { facts: t.facts }),t.uninstall ? /* @__PURE__ */ J(st, { uninstall: t.uninstall }) : null]});}//#endregion//#region node_modules/@preact/signals-core/dist/signals-core.module.js-var vt = Symbol.for("preact-signals");-function yt() {- if (Z > 1) Z--;+var xt = Symbol.for("preact-signals");+function St() {+ if (X > 1) X--;else {var e, t = !1;for ((function() {- var e = Dt;- for (Dt = void 0; e !== void 0;) {+ var e = At;+ for (At = void 0; e !== void 0;) {var t = e.S;if (t.v === e.v) for (var n = t.t; n !== void 0; n = n.x) n.i === e.i && (n.i = t.i);e = e.o;}- })(); Ct !== void 0;) {- var n = Ct;- for (Ct = void 0, wt++; n !== void 0;) {+ })(); Et !== void 0;) {+ var n = Et;+ for (Et = void 0, Dt++; n !== void 0;) {var r = n.u;- if (n.u = void 0, n.f &= -3, !(8 & n.f) && jt(n)) try {+ if (n.u = void 0, n.f &= -3, !(8 & n.f) && Pt(n)) try {n.c();} catch (n) {t ||= (e = n, !0);@@ -1544,116 +1629,116 @@ function yt() {n = r;}}- if (wt = 0, Z--, t) throw e;+ if (Dt = 0, X--, t) throw e;}}-function bt(e) {- if (Z > 0) return e();- Et = ++Tt, Z++;+function Ct(e) {+ if (X > 0) return e();+ kt = ++Ot, X++;try {return e();} finally {- yt();+ St();}}-var xt, X = void 0;-function St(e) {- var t = X, n = xt;- X = void 0, xt = void 0;+var wt, Y = void 0;+function Tt(e) {+ var t = Y, n = wt;+ Y = void 0, wt = void 0;try {return e();} finally {- X = t, xt = n;+ Y = t, wt = n;}}-var Ct = void 0, Z = 0, wt = 0, Tt = 0, Et = 0, Dt = void 0, Ot = 0;-function kt(e) {- if (X !== void 0) {+var Et = void 0, X = 0, Dt = 0, Ot = 0, kt = 0, At = void 0, jt = 0;+function Mt(e) {+ if (Y !== void 0) {var t = e.n;- if (t === void 0 || t.t !== X) return t = {+ if (t === void 0 || t.t !== Y) return t = {i: 0,S: e,- p: X.s,+ p: Y.s,n: void 0,- t: X,+ t: Y,e: void 0,x: void 0,r: t- }, X.s !== void 0 && (X.s.n = t), X.s = t, e.n = t, 32 & X.f && e.S(t), t;- if (t.i === -1) return t.i = 0, t.n !== void 0 && (t.n.p = t.p, t.p !== void 0 && (t.p.n = t.n), t.p = X.s, t.n = void 0, X.s.n = t, X.s = t), t;+ }, Y.s !== void 0 && (Y.s.n = t), Y.s = t, e.n = t, 32 & Y.f && e.S(t), t;+ if (t.i === -1) return t.i = 0, t.n !== void 0 && (t.n.p = t.p, t.p !== void 0 && (t.p.n = t.n), t.p = Y.s, t.n = void 0, Y.s.n = t, Y.s = t), t;}}-function Q(e, t) {+function Z(e, t) {this.v = e, this.i = 0, this.n = void 0, this.t = void 0, this.l = 0, this.W = t?.watched, this.Z = t?.unwatched, this.name = t?.name;}-Q.prototype.brand = vt, Q.prototype.h = function() {+Z.prototype.brand = xt, Z.prototype.h = function() {return !0;-}, Q.prototype.S = function(e) {+}, Z.prototype.S = function(e) {var t = this, n = this.t;- n !== e && e.e === void 0 && (e.x = n, this.t = e, n === void 0 ? St(function() {+ n !== e && e.e === void 0 && (e.x = n, this.t = e, n === void 0 ? Tt(function() {var e;(e = t.W) == null || e.call(t);}) : n.e = e);-}, Q.prototype.U = function(e) {+}, Z.prototype.U = function(e) {var t = this;if (this.t !== void 0) {var n = e.e, r = e.x;- n !== void 0 && (n.x = r, e.e = void 0), r !== void 0 && (r.e = n, e.x = void 0), e === this.t && (this.t = r, r === void 0 && St(function() {+ n !== void 0 && (n.x = r, e.e = void 0), r !== void 0 && (r.e = n, e.x = void 0), e === this.t && (this.t = r, r === void 0 && Tt(function() {var e;(e = t.Z) == null || e.call(t);}));}-}, Q.prototype.subscribe = function(e) {+}, Z.prototype.subscribe = function(e) {var t = this;- return zt(function() {+ return Ht(function() {var n = t.value;- St(function() {+ Tt(function() {return e(n);});}, { name: "sub" });-}, Q.prototype.valueOf = function() {+}, Z.prototype.valueOf = function() {return this.value;-}, Q.prototype.toString = function() {+}, Z.prototype.toString = function() {return this.value + "";-}, Q.prototype.toJSON = function() {+}, Z.prototype.toJSON = function() {return this.value;-}, Q.prototype.peek = function() {+}, Z.prototype.peek = function() {var e = this;- return St(function() {+ return Tt(function() {return e.value;});-}, Object.defineProperty(Q.prototype, "value", {+}, Object.defineProperty(Z.prototype, "value", {get: function() {- var e = kt(this);+ var e = Mt(this);return e !== void 0 && (e.i = this.i), this.v;},set: function(e) {if (e !== this.v) {- if (wt > 100) throw Error("Cycle detected");+ if (Dt > 100) throw Error("Cycle detected");(function(e) {- Z !== 0 && wt === 0 && e.l !== Et && (e.l = Et, Dt = {+ X !== 0 && Dt === 0 && e.l !== kt && (e.l = kt, At = {S: e,v: e.v,i: e.i,- o: Dt+ o: At});- })(this), this.v = e, this.i++, Ot++, Z++;+ })(this), this.v = e, this.i++, jt++, X++;try {for (var t = this.t; t !== void 0; t = t.x) t.t.N();} finally {- yt();+ St();}}}});-function At(e, t) {- return new Q(e, t);+function Nt(e, t) {+ return new Z(e, t);}-function jt(e) {+function Pt(e) {for (var t = e.s; t !== void 0; t = t.n) if (t.S.i !== t.i || !t.S.h() || t.S.i !== t.i) return !0;return !1;}-function Mt(e) {+function Ft(e) {for (var t = e.s; t !== void 0; t = t.n) {var n = t.S.n;if (n !== void 0 && (t.r = n), t.S.n = t, t.i = -1, t.n === void 0) {@@ -1662,81 +1747,81 @@ function Mt(e) {}}}-function Nt(e) {+function It(e) {for (var t = e.s, n = void 0; t !== void 0;) {var r = t.p;t.i === -1 ? (t.S.U(t), r !== void 0 && (r.n = t.n), t.n !== void 0 && (t.n.p = r)) : n = t, t.S.n = t.r, t.r !== void 0 && (t.r = void 0), t = r;}e.s = n;}-function $(e, t) {- Q.call(this, void 0, t), this.x = e, this.s = void 0, this.g = Ot - 1, this.f = 4;+function Q(e, t) {+ Z.call(this, void 0, t), this.x = e, this.s = void 0, this.g = jt - 1, this.f = 4;}-$.prototype = new Q(), $.prototype.h = function() {+Q.prototype = new Z(), Q.prototype.h = function() {if (this.f &= -3, 1 & this.f) return !1;- if ((36 & this.f) == 32 || (this.f &= -5, this.g === Ot)) return !0;- if (this.g = Ot, this.f |= 1, this.i > 0 && !jt(this)) return this.f &= -2, !0;- var e = X;+ if ((36 & this.f) == 32 || (this.f &= -5, this.g === jt)) return !0;+ if (this.g = jt, this.f |= 1, this.i > 0 && !Pt(this)) return this.f &= -2, !0;+ var e = Y;try {- Mt(this), X = this;+ Ft(this), Y = this;var t = this.x();(16 & this.f || this.v !== t || this.i === 0) && (this.v = t, this.f &= -17, this.i++);} catch (e) {this.v = e, this.f |= 16, this.i++;}- return X = e, Nt(this), this.f &= -2, !0;-}, $.prototype.S = function(e) {+ return Y = e, It(this), this.f &= -2, !0;+}, Q.prototype.S = function(e) {if (this.t === void 0) {this.f |= 36;for (var t = this.s; t !== void 0; t = t.n) t.S.S(t);}- Q.prototype.S.call(this, e);-}, $.prototype.U = function(e) {- if (this.t !== void 0 && (Q.prototype.U.call(this, e), this.t === void 0)) {+ Z.prototype.S.call(this, e);+}, Q.prototype.U = function(e) {+ if (this.t !== void 0 && (Z.prototype.U.call(this, e), this.t === void 0)) {this.f &= -33;for (var t = this.s; t !== void 0; t = t.n) t.S.U(t);}-}, $.prototype.N = function() {+}, Q.prototype.N = function() {if (!(2 & this.f)) {this.f |= 6;for (var e = this.t; e !== void 0; e = e.x) e.t.N();}-}, Object.defineProperty($.prototype, "value", { get: function() {+}, Object.defineProperty(Q.prototype, "value", { get: function() {if (1 & this.f) throw Error("Cycle detected");- var e = kt(this);+ var e = Mt(this);if (this.h(), e !== void 0 && (e.i = this.i), 16 & this.f) throw this.v;return this.v;} });-function Pt(e, t) {- return new $(e, t);+function Lt(e, t) {+ return new Q(e, t);}-function Ft(e) {+function Rt(e) {var t = e.m;if (e.m = void 0, typeof t == "function") {- Z++;- var n = X;- X = void 0;+ X++;+ var n = Y;+ Y = void 0;try {t();} catch (t) {- throw e.f &= -2, e.f |= 8, It(e), t;+ throw e.f &= -2, e.f |= 8, zt(e), t;} finally {- X = n, yt();+ Y = n, St();}}}-function It(e) {+function zt(e) {for (var t = e.s; t !== void 0; t = t.n) t.S.U(t);- e.x = void 0, e.s = void 0, Ft(e);+ e.x = void 0, e.s = void 0, Rt(e);}-function Lt(e) {- if (X !== this) throw Error("Out-of-order effect");- Nt(this), X = e, this.f &= -2, 8 & this.f && It(this), yt();+function Bt(e) {+ if (Y !== this) throw Error("Out-of-order effect");+ It(this), Y = e, this.f &= -2, 8 & this.f && zt(this), St();}-function Rt(e, t) {- this.x = e, this.m = void 0, this.s = void 0, this.u = void 0, this.f = 32, this.name = t?.name, xt && xt.push(this);+function Vt(e, t) {+ this.x = e, this.m = void 0, this.s = void 0, this.u = void 0, this.f = 32, this.name = t?.name, wt && wt.push(this);}-Rt.prototype.c = function() {+Vt.prototype.c = function() {var e = this.S();try {if (8 & this.f || this.x === void 0) return;@@ -1745,20 +1830,20 @@ Rt.prototype.c = function() {} finally {e();}-}, Rt.prototype.S = function() {+}, Vt.prototype.S = function() {if (1 & this.f) throw Error("Cycle detected");- this.f |= 1, this.f &= -9, Ft(this), Mt(this), Z++;- var e = X;- return X = this, Lt.bind(this, e);-}, Rt.prototype.N = function() {- 2 & this.f || (this.f |= 2, this.u = Ct, Ct = this);-}, Rt.prototype.d = function() {- this.f |= 8, 1 & this.f || It(this);-}, Rt.prototype.dispose = function() {+ this.f |= 1, this.f &= -9, Rt(this), Ft(this), X++;+ var e = Y;+ return Y = this, Bt.bind(this, e);+}, Vt.prototype.N = function() {+ 2 & this.f || (this.f |= 2, this.u = Et, Et = this);+}, Vt.prototype.d = function() {+ this.f |= 8, 1 & this.f || zt(this);+}, Vt.prototype.dispose = function() {this.d();};-function zt(e, t) {- var n = new Rt(e, t);+function Ht(e, t) {+ var n = new Vt(e, t);try {n.c();} catch (e) {@@ -1769,35 +1854,35 @@ function zt(e, t) {}//#endregion//#region node_modules/@preact/signals/dist/signals.module.js-var Bt, Vt, Ht = typeof window < "u" && !!window.__PREACT_SIGNALS_DEVTOOLS__, Ut = [];-zt(function() {- Bt = this.N;+var Ut, Wt, Gt = typeof window < "u" && !!window.__PREACT_SIGNALS_DEVTOOLS__, Kt = [];+Ht(function() {+ Ut = this.N;})();-function Wt(e, t) {+function qt(e, t) {x[e] = t.bind(null, x[e] || function() {});}-function Gt(e) {- if (Vt) {- var t = Vt;- Vt = void 0, t();+function Jt(e) {+ if (Wt) {+ var t = Wt;+ Wt = void 0, t();}- Vt = e && e.S();+ Wt = e && e.S();}-function Kt(e) {- var t = this, n = e.data, r = Jt(n);+function Yt(e) {+ var t = this, n = e.data, r = Zt(n);r.name = "ReactiveDom", r.value = n;var i = Ue(function() {for (var e = t, n = t.__v; n = n.__;) if (n.__c) {n.__c.__$f |= 4;break;}- var i = Pt(function() {+ var i = Lt(function() {var e = r.value.value;return e === 0 ? 0 : !0 === e ? "" : e || "";- }), a = Pt(function() {+ }), a = Lt(function() {return !Array.isArray(i.value) && !C(i.value);- }), o = zt(function() {- if (this.N = Zt, a.value) {+ }), o = Ht(function() {+ if (this.N = en, a.value) {var t = i.value;e.__v && e.__v.__e && e.__v.__e.nodeType === 3 && (e.__v.__e.data = t);}@@ -1808,14 +1893,14 @@ function Kt(e) {}, []), a = i[0], o = i[1];return a.value ? o.peek() : o.value;}-Kt.displayName = "ReactiveTextNode", Object.defineProperties(Q.prototype, {+Yt.displayName = "ReactiveTextNode", Object.defineProperties(Z.prototype, {constructor: {configurable: !0,value: void 0},type: {configurable: !0,- value: Kt+ value: Yt},props: {configurable: !0,@@ -1830,35 +1915,35 @@ Kt.displayName = "ReactiveTextNode", Object.defineProperties(Q.prototype, {configurable: !0,value: 1}-}), Wt("__b", function(e, t) {+}), qt("__b", function(e, t) {if (typeof t.type == "string") {var n, r = t.props;for (var i in r) if (i !== "children") {var a = r[i];- a instanceof Q && (n || (t.__np = n = {}), n[i] = a, r[i] = a.peek());+ a instanceof Z && (n || (t.__np = n = {}), n[i] = a, r[i] = a.peek());}}e(t);-}), Wt("__r", function(e, t) {+}), qt("__r", function(e, t) {if (e(t), t.type !== I) {- Gt();+ Jt();var n, r = t.__c;r && (r.__$f &= -2, (n = r.__$u) === void 0 && (r.__$u = n = function(e, t) {var n;- return zt(function() {+ return Ht(function() {n = this;}, { name: t }), n.c = e, n;}(function(e) {return function() {var t;- Ht && ((t = this.y) == null || t.call(this)), e.__$f |= 1, e.setState({});+ Gt && ((t = this.y) == null || t.call(this)), e.__$f |= 1, e.setState({});};- }(r), typeof t.type == "function" ? t.type.displayName || t.type.name : ""))), Gt(n);+ }(r), typeof t.type == "function" ? t.type.displayName || t.type.name : ""))), Jt(n);}-}), Wt("__e", function(e, t, n, r) {- Gt(), e(t, n, r);-}), Wt("diffed", function(e, t) {- Gt();+}), qt("__e", function(e, t, n, r) {+ Jt(), e(t, n, r);+}), qt("diffed", function(e, t) {+ Jt();var n;if (typeof t.type == "string" && (n = t.__e)) {var r = t.__np, i = t.props, a = n.U;@@ -1868,25 +1953,25 @@ Kt.displayName = "ReactiveTextNode", Object.defineProperties(Q.prototype, {}if (r) for (var c in a || (a = {}, n.U = a), r) {var l = a[c], u = r[c];- l === void 0 ? (l = qt(n, c, u, i), a[c] = l) : l.o(u, i);+ l === void 0 ? (l = Xt(n, c, u, i), a[c] = l) : l.o(u, i);}}e(t);});-function qt(e, t, n, r) {- var i = t in e && e.ownerSVGElement === void 0, a = At(n);+function Xt(e, t, n, r) {+ var i = t in e && e.ownerSVGElement === void 0, a = Nt(n);return {o: function(e, t) {a.value = e, r = t;},- d: zt(function() {- this.N = Zt;+ d: Ht(function() {+ this.N = en;var n = a.value.value;r[t] !== n && (r[t] = n, i ? e[t] = n : n != null && (!1 !== n || t[4] === "-") ? e.setAttribute(t, n) : e.removeAttribute(t));})};}-Wt("unmount", function(e, t) {+qt("unmount", function(e, t) {if (typeof t.type == "string") {var n = t.__e;if (n) {@@ -1910,7 +1995,7 @@ Wt("unmount", function(e, t) {}}e(t);-}), Wt("__h", function(e, t, n, r) {+}), qt("__h", function(e, t, n, r) {r < 3 && (t.__$f |= 2), e(t, n, r);}), se.prototype.shouldComponentUpdate = function(e, t) {if (this.__R) return !0;@@ -1924,44 +2009,44 @@ Wt("unmount", function(e, t) {for (var s in this.props) if (!(s in e)) return !0;return !1;};-function Jt(e, t) {+function Zt(e, t) {return Ue(function() {- return At(e, t);+ return Nt(e, t);}, []);}-var Yt = function(e) {+var Qt = function(e) {queueMicrotask(function() {queueMicrotask(e);});};-function Xt() {- bt(function() {- for (var e; e = Ut.shift();) Bt.call(e);+function $t() {+ Ct(function() {+ for (var e; e = Kt.shift();) Ut.call(e);});}-function Zt() {- Ut.push(this) === 1 && (x.requestAnimationFrame || Yt)(Xt);+function en() {+ Kt.push(this) === 1 && (x.requestAnimationFrame || Qt)($t);}//#endregion//#region src/state/quality-goals.ts-var Qt = "/api/quality-goals?limit=200", $t = {+var tn = "/api/quality-goals?limit=200", nn = {data: null,error: ""-}, en = At($t), tn = 0, nn = Pt(() => en.value);-Pt(() => en.value.data?.total ?? null);-function rn() {- tn += 1, en.value = $t;+}, rn = Nt(nn), an = 0, on = Lt(() => rn.value);+Lt(() => rn.value.data?.total ?? null);+function sn() {+ an += 1, rn.value = nn;}-async function an(e) {- let t = tn += 1;+async function cn(e) {+ let t = an += 1;try {- let n = await z(Qt, e);- return t === tn && (en.value = {+ let n = await z(tn, e);+ return t === an && (rn.value = {data: n,error: ""}), n;} catch (n) {- throw !e?.aborted && t === tn && (en.value = {+ throw !e?.aborted && t === an && (rn.value = {data: null,error: R(n)}), n;@@ -1969,9 +2054,9 @@ async function an(e) {}//#endregion//#region src/islands/quality-goals.tsx-var on = (e, t) => an(t), sn = (e) => e.has_cover ? `/cover?code=${encodeURIComponent(e.code ?? "")}` : `/poster?id=${e.id}&c=4`;-function cn({ openItem: t, javTitleHtml: i, javDisplayName: a, srcBadge: o }) {- let { data: s, error: c } = nn.value;+var ln = (e, t) => cn(t), un = (e) => e.has_cover ? `/cover?code=${encodeURIComponent(e.code ?? "")}` : `/poster?id=${e.id}&c=4`;+function dn({ openItem: t, javTitleHtml: i, javDisplayName: a, srcBadge: o }) {+ let { data: s, error: c } = on.value;if (c) return /* @__PURE__ */ J("div", {class: "qualitylist",dangerouslySetInnerHTML: { __html: f(c, {@@ -1990,7 +2075,7 @@ function cn({ openItem: t, javTitleHtml: i, javDisplayName: a, srcBadge: o }) {"aria-label": `打开 ${a(s)}`,onClick: () => t(s.id),children: /* @__PURE__ */ J("img", {- src: sn(s),+ src: un(s),alt: "",loading: "lazy",onError: (e) => e.currentTarget.remove()@@ -2024,7 +2109,7 @@ function cn({ openItem: t, javTitleHtml: i, javDisplayName: a, srcBadge: o }) {}//#endregion//#region src/jobs.ts-async function ln(e) {+async function fn(e) {let t = e.pause || ((e) => new Promise((t) => setTimeout(t, e))), n = 0;for (; e.active();) {let r;@@ -2039,11 +2124,11 @@ async function ln(e) {await t(2e3);}}-function un(e) {+function pn(e) {let t = document.createElement("div");e.host.hidden = !0, t.dataset.followJob = "", t.setAttribute("aria-live", "polite"), e.host.prepend(t);let n = e.storageKey || "peach-follow-job", r = sessionStorage.getItem(n) || void 0, i = !1;- ln({+ fn({read: e.read,active: () => !i && e.active() && t.isConnected,keepWatching: e.watchIdle !== !1,@@ -2069,8 +2154,8 @@ function un(e) {}//#endregion//#region src/islands/scraping.tsx-var dn = (e, t) => z("/api/scraping", t);-function fn({ value: e, onChange: t }) {+var mn = (e, t) => z("/api/scraping", t);+function hn({ value: e, onChange: t }) {let n = q(null), r = q(t);return r.current = t, K(() => {let t = n.current;@@ -2084,7 +2169,7 @@ function fn({ value: e, onChange: t }) {class: "scraping-network"});}-function pn({ source: e, toast: t }) {+function gn({ source: e, toast: t }) {let [n, r] = W(e), [i, a] = W(e.network), [o, s] = W(""), [c, l] = W(""), [d, p] = W("paste"), [m, h] = W(""), [g, v] = W(!1), [y, b] = W(""), [x, S] = W([]), C = q(null), w = q(null);K(() => {w.current?.querySelectorAll("footer button").forEach((e) => _(e, g));@@ -2139,7 +2224,7 @@ function pn({ source: e, toast: t }) {}),/* @__PURE__ */ J("div", {class: "scraping-label",- children: ["连接方式", /* @__PURE__ */ J(fn, {+ children: ["连接方式", /* @__PURE__ */ J(hn, {value: i,onChange: a})]@@ -2250,13 +2335,13 @@ function pn({ source: e, toast: t }) {})});}-function mn({ data: e, error: t, toast: n }) {+function _n({ data: e, error: t, toast: n }) {let [r, i] = W(""), [a, o] = W(!1), [s, c] = W(""), l = q(null);K(() => _(l.current, a), [a]);let d = q(new AbortController()), p = q(0);async function m(e = !1) {let t = ++p.current;- await ln({+ await fn({read: (e) => z("/api/scraping/cover", e),active: () => !d.current.signal.aborted && t === p.current,render: (t) => {@@ -2317,7 +2402,7 @@ function mn({ data: e, error: t, toast: n }) {]})}),- e?.sources.map((e) => /* @__PURE__ */ J(pn, {+ e?.sources.map((e) => /* @__PURE__ */ J(gn, {source: e,toast: n}, e.source))@@ -2326,13 +2411,13 @@ function mn({ data: e, error: t, toast: n }) {}//#endregion//#region src/islands/library-processing.tsx-var hn = (e, t) => z("/api/library-processing", t);-function gn({ data: e, error: t, toast: n, onComplete: r, mode: i, monitor: a }) {+var vn = (e, t) => z("/api/library-processing", t);+function yn({ data: e, error: t, toast: n, onComplete: r, mode: i, monitor: a }) {let [o, s] = W(e || { status: "idle" }), [c, l] = W(t), [h, g] = W(!1), [v, y] = W(!1), b = q(new AbortController()), x = q(0), S = q(o.status), C = q(null), w = h || o.status === "running";K(() => _(C.current, w), [w]);async function T() {let e = ++x.current;- await ln({+ await fn({read: (e) => z("/api/library-processing", e),active: () => !b.current.signal.aborted && x.current === e,keepWatching: i === "notice" || !!a,@@ -2430,12 +2515,12 @@ function gn({ data: e, error: t, toast: n, onComplete: r, mode: i, monitor: a })}//#endregion//#region src/state/index.ts-var _n = { "quality-goals": {- refresh: an,- reset: rn-} }, vn = () => Object.keys(_n);-async function yn(e) {- let t = _n[e];+var bn = { "quality-goals": {+ refresh: cn,+ reset: sn+} }, xn = () => Object.keys(bn);+async function Sn(e) {+ let t = bn[e];if (!t) throw Error(`未登记的共享 store:${String(e)}`);try {return await t.refresh(), !0;@@ -2445,24 +2530,24 @@ async function yn(e) {}//#endregion//#region src/review-evidence.ts-var bn = (e = "") => /^https?:\/\//i.test(e) ? e : "";-function xn(e = "") {- let n = bn(e) || (e.startsWith("/") && !e.startsWith("//") ? e : "");+var Cn = (e = "") => /^https?:\/\//i.test(e) ? e : "";+function wn(e = "") {+ let n = Cn(e) || (e.startsWith("/") && !e.startsWith("//") ? e : "");return `<div class="reviewimage" data-review-picture><span class="reviewimageempty"${n ? " hidden" : ""}>未取得来源图片</span>${n ? `<img src="${t(n)}" alt="来源候选图片" loading="lazy">` : ""}</div>`;}-function Sn(e) {- let n = bn(e.profile_url), r = (e.preview_assets || []).slice(0, 6), i = Math.max(0, Number(e.video_count || e.videos || 0));+function Tn(e) {+ let n = Cn(e.profile_url), r = (e.preview_assets || []).slice(0, 6), i = Math.max(0, Number(e.video_count || e.videos || 0));return `<section class="reviewidentityevidence"><h5>候选身份:${t(e.babepedia_name || "未标注")}</h5><div class="reviewevidenceactions">${n ? `<a class="geist-button" href="${t(n)}" target="_blank" rel="noopener noreferrer">来源资料 ↗</a>` : ""}<button type="button" class="geist-button" data-entity-kind="creator" data-entity-name="${t(e.creator || "")}">查看全部 ${i.toLocaleString()} 部作品</button></div>- ${xn(e.preview_url)}+ ${wn(e.preview_url)}<p>通过后记录身份判断。</p>${r.length ? `<h5>本地作品样本</h5><div class="reviewevidencesamples">${r.map((e) => `<div class="reviewevidencesample"><button class="geist-button" type="button" data-review-open-item="${e.id}"><span data-middle-truncate title="${t(e.name)}">${t(e.name)}</span></button><button class="geist-button" type="button" data-review-reveal="${e.id}" aria-label="打开 ${t(e.name)} 的文件位置">文件位置</button></div>`).join("")}</div>` : "<p>暂无本地作品样本,打开全部作品核对。</p>"}</section>`;}-function Cn(e) {+function En(e) {for (let t of e.querySelectorAll("[data-review-picture] img")) {let e = () => {t.hidden = !0;@@ -2474,7 +2559,7 @@ function Cn(e) {}//#endregion//#region src/review-bulk.ts-var wn = () => ({+var Dn = () => ({busy: !1,category: "",filter: "",@@ -2485,7 +2570,7 @@ var wn = () => ({assets: /* @__PURE__ */ new Map(),errors: /* @__PURE__ */ new Map()});-function Tn(e) {+function On(e) {let t = e?.querySelector(".reviewcontrols");if (!e || !t || t.offsetParent === null) return;let n = e.closest("main");@@ -2495,7 +2580,7 @@ function Tn(e) {n.classList.toggle("is-stuck", n.offsetParent !== null && window.scrollY > 0 && Number.isFinite(e) && Math.abs(n.getBoundingClientRect().top - e) <= 1);}}-function En(e, t) {+function kn(e, t) {let n = [["candidates",t ? "按候选数量" : "全部待复核",@@ -2511,7 +2596,7 @@ function En(e, t) {"list-filter"]), n;}-function Dn(e, t) {+function An(e, t) {let n = /* @__PURE__ */ new Map();for (let r of e) {let e, i;@@ -2528,11 +2613,11 @@ function Dn(e, t) {}return [...n.values()];}-function On(e, t, n, r, i) {+function jn(e, t, n, r, i) {let a = e.anchor === null ? -1 : t.indexOf(e.anchor), o = t.indexOf(n);r && a >= 0 && o >= 0 ? t.slice(Math.min(a, o), Math.max(a, o) + 1).forEach((t) => e.selected.add(t)) : i ? e.selected.add(n) : e.selected.delete(n), e.anchor = n;}-async function kn(e, t, n, r) {+async function Mn(e, t, n, r) {let i = [], a = 0;for (let o of e) {if (!r()) break;@@ -2552,17 +2637,17 @@ async function kn(e, t, n, r) {failures: i};}-function An(e) {+function Nn(e) {return e.length ? [...new Set(e.flatMap((e) => e.candidates?.map((e) => e.source || "") || []))].filter((t) => t && e.every((e) => e.candidates?.filter((e) => e.source === t).length === 1)) : [];}-function jn(e, t) {+function Pn(e, t) {let n = e.querySelector(".reviewlist");if (!n || !t.rows.length || t.locked) return;let r = t.state, i = [...n.querySelectorAll("[data-review-key]")];t.category !== void 0 && r.category !== t.category && (r.category = t.category, r.filter = "", r.groupBy = "candidates", r.anchor = null);- let a = En(t.rows, t.metadata);+ let a = kn(t.rows, t.metadata);a.some((e) => e[0] === r.groupBy) || (r.groupBy = "candidates", r.filter = "");- let o = Dn(t.rows, r.groupBy);+ let o = An(t.rows, r.groupBy);o.some((e) => e.key === r.filter) || (r.filter = "");let c = () => [...n.querySelectorAll("[data-review-key]")].filter((e) => !e.closest("[hidden]")), l = () => c().filter((e) => r.selected.has(e.dataset.reviewKey)), u = () => t.rows.filter((e) => l().some((t) => t.dataset.reviewKey === e.item_key)), d = (e) => !e.querySelector("[data-review-status=\"approved\"]")?.disabled, f = (e, t = "") => {let n = document.createElement("button");@@ -2654,7 +2739,7 @@ function jn(e, t) {e.className = "reviewpickname", e.append(...n.childNodes), n.classList.add("reviewpickheading"), n.append(i, e);} else e.prepend(i);let o = (e, n) => {- On(r, c().map((e) => e.dataset.reviewKey), t, e, n), P();+ jn(r, c().map((e) => e.dataset.reviewKey), t, e, n), P();};if (i.addEventListener("mousedown", (e) => {e.shiftKey && e.preventDefault();@@ -2668,7 +2753,7 @@ function jn(e, t) {else if (n.key === "ArrowDown" || n.key === "ArrowUp") {n.preventDefault();let i = c(), a = i[i.indexOf(e) + (n.key === "ArrowDown" ? 1 : -1)];- a && (r.anchor === null && (r.anchor = t), On(r, i.map((e) => e.dataset.reviewKey), a.dataset.reviewKey, !0, !0), P(), a.querySelector(".reviewpickitem input")?.focus());+ a && (r.anchor === null && (r.anchor = t), jn(r, i.map((e) => e.dataset.reviewKey), a.dataset.reviewKey, !0, !0), P(), a.querySelector(".reviewpickitem input")?.focus());}}}), M.push(() => {@@ -2697,14 +2782,14 @@ function jn(e, t) {function P() {let e = l();S.textContent = e.length === c().length ? "清空当前选择" : r.filter ? "全选当前分类" : "全选本页", k.hidden = !e.length, T.textContent = `已选 ${e.length} 项`, C.disabled = !e.length || e.some((e) => !d(e)), w.disabled = !e.length;- let n = An(u());+ let n = Nn(u());E.hidden = !t.metadata || !u().some((e) => (e.candidates?.length || 0) > 1);let i = e.length && !n.length ? "所选项目无共同来源" : "统一选择来源", a = JSON.stringify([i, n]);if (a !== N) {N = a, E.innerHTML = h([["", i], ...n.map((e) => [e, e])], "", { label: "统一选择来源" });let e = y(E.firstElementChild);e.disabled = !n.length, e.addEventListener("change", () => {- if (!(r.busy || !An(u()).includes(e.value))) {+ if (!(r.busy || !Nn(u()).includes(e.value))) {for (let n of l()) {let i = t.rows.find((e) => e.item_key === n.dataset.reviewKey).candidates.find((t) => t.source === e.value);n.querySelectorAll("input[type=\"radio\"]").forEach((e) => {@@ -2737,7 +2822,7 @@ function jn(e, t) {e instanceof KeyboardEvent && e.key === "Tab" || (e.preventDefault(), e.stopImmediatePropagation());};e.addEventListener("click", c, !0), e.addEventListener("keydown", c, !0);- let u = 0, d = await kn(a, async (e) => {+ let u = 0, d = await Mn(a, async (e) => {try {return await t.submit(e);} finally {@@ -2754,14 +2839,14 @@ function jn(e, t) {let f = e.parentElement;t.refresh(), f?.querySelector(".reviewbulktoolbar button")?.focus({ preventScroll: !0 });}- P(), Tn(e);+ P(), On(e);}//#endregion//#region src/native-image.ts-function Mn(e, t, n, r) {+function Fn(e, t, n, r) {return e > 0 && t > 0 && e === n && t === r;}-function Nn(e, t, n, r, i = 1) {+function In(e, t, n, r, i = 1) {let a = Number.isFinite(i) && i > 0 ? i : 1;e /= a, t /= a;let o = [@@ -2778,7 +2863,7 @@ function Nn(e, t, n, r, i = 1) {}//#endregion//#region src/entity-skeleton.ts-function Pn(e, t) {+function Ln(e, t) {return `<section data-skeleton="entity/${e}" role="status" aria-label="正在读取资料"><span class="sr-only">正在读取资料</span><div aria-hidden="true"><div class="entityhero"><div class="entityportrait ${e === "studio" || e === "agency" ? "square " : ""}skeleton"></div>@@ -2790,7 +2875,7 @@ function Pn(e, t) {}//#endregion//#region src/catalog-onboarding.ts-var Fn = [+var Rn = ["loc","creator","performer",@@ -2807,16 +2892,16 @@ var Fn = ["jav","thumb"];-function In() {+function zn() {let e = (e) => Array(64).fill(e).join("");return {tiers: "<div class=\"tier catalog-placeholder\" aria-hidden=\"true\">" + e("<span class=\"av\"><span class=\"ring\"></span><span class=\"nm\"> </span></span>") + "</div><div class=\"tier catalog-placeholder\" aria-hidden=\"true\">" + e("<span class=\"brandpill\"><span class=\"mk\"></span><span class=\"placeholder-name\"> </span></span>") + "</div>",tags: "<span class=\"catalog-placeholder placeholder-tags\" aria-hidden=\"true\">" + e("<span class=\"pill\"> </span>") + "</span>"};}-async function Ln(e, t) {+async function Bn(e, t) {let n = new URLSearchParams();- for (let t of Fn) e[t] && n.set(t, e[t]);+ for (let t of Rn) e[t] && n.set(t, e[t]);let [r, i] = await Promise.all([t("/api/facets?" + n), t("/api/items?" + n + "&limit=5")]), a = [...new Set([...r.creators || [],...r.tagperformers || [],@@ -2827,7 +2912,7 @@ async function Ln(e, t) {return r.set("q", e), r.set("limit", "1"), (await t("/api/items?" + r)).total > 0 ? e : "";}))).filter(Boolean);}-function Rn({ kind: e = "catalog", filtered: t = !1, jav: n = !1, configurable: r = !1, online: i = !1 } = {}) {+function Vn({ kind: e = "catalog", filtered: t = !1, jav: n = !1, configurable: r = !1, online: i = !1 } = {}) {let a = r ? "<a class=\"geist-button primary\" href=\"/configuration\">添加内容</a>" : "", o = "<a class=\"geist-button\" href=\"/follow-manage\">添加来源</a>";return t || n ? l("search", n ? "还没有符合条件的 JAV 作品" : "没有符合条件的内容", n ? "已扫描但尚未补充发行资料的视频可在全部内容中查看。" : "清除筛选或搜索条件后查看全部内容。", { actions: "<a class=\"geist-button primary\" href=\"/?loc=&thumb=0\">查看全部内容</a>" }) : e === "catalog" ? l("play", "还没有视频", "添加媒体文件夹或关注来源,开始建立你的馆藏。", { actions: a + o }) : l(e === "tags" ? "tags" : "user-round", "还没有" + ({tags: "标签",@@ -2840,7 +2925,7 @@ function Rn({ kind: e = "catalog", filtered: t = !1, jav: n = !1, configurable:}//#endregion//#region src/sidebar.ts-function zn(e) {+function Hn(e) {return ["/","/unseen",@@ -2850,23 +2935,23 @@ function zn(e) {"/junk-files"].includes(e) || /^\/(item|mix|parts|editions)\//.test(e) || /^\/playlists\/\d+\/\d+$/.test(e) || /^\/(performers|studios|creators|series|agencies)\/.+/.test(e);}-function Bn(e, t) {+function Un(e, t) {return e.dataset.surface === t && e.querySelector(".dnav") ? !1 : (e.dataset.surface = t, e.replaceChildren(), !0);}-function Vn(e) {+function Wn(e) {let t = /* @__PURE__ */ new Map();for (let n of e) for (let e of new Set(n.tags || [])) t.set(e, (t.get(e) || 0) + 1);return [...t].sort((e, t) => t[1] - e[1]).slice(0, 30);}//#endregion//#region src/management.ts-function Hn(e) {+function Gn(e) {return e.filter((e) => ["115", "pikpak"].includes(e.location) && (e.roots === void 0 || e.roots.length > 0)).map((e) => e.location);}-function Un(e, t) {+function Kn(e, t) {return t.filter((t) => e.some((e) => e.location === t));}-function Wn() {+function qn() {return `<div class="cleanuppage" data-skeleton="cleanup" aria-busy="true" aria-label="正在读取数据管理状态"><div class="cleanupgrid">${[[@@ -2912,7 +2997,7 @@ function Wn() {<footer class="geist-fieldset-footer" data-geist-fieldset-footer><button type="button"${r === 3 ? " class=\"danger\"" : ""} disabled>${r === 3 ? "<svg aria-hidden=\"true\"><use href=\"#i-trash\"></use></svg><span>" + t + "</span>" : t}</button></footer></section>`).join("")}</div></div>`;}-function Gn(e, t = !1, n = !1) {+function Jn(e, t = !1, n = !1) {if (t || n) return "";let r = "<svg aria-hidden=\"true\"><use href=\"#i-external-link\"></use></svg>";return `<details class="taste-history-guide"${e ? " open" : ""}>@@ -2926,70 +3011,92 @@ function Gn(e, t = !1, n = !1) {<button type="button" class="geist-button taste-guide-skip">跳过</button></div></details>`;}-var Kn = "peach-taste-guide-dismissed";-function qn(e, t) {+var Yn = "peach-taste-guide-dismissed";+function Xn(e, t) {v(e, ".taste-history-guide", "taste-guide-collapse");let n = e.querySelector(".taste-history-guide");n?.querySelector(".taste-guide-skip")?.addEventListener("click", () => {- t.setItem(Kn, "1"), n.remove();+ t.setItem(Yn, "1"), n.remove();});}//#endregion+//#region src/resource-sync.ts+var $ = (e = 0) => Number(e).toLocaleString(), Zn = {+ local: "本地磁盘",+ 115: "115",+ pikpak: "PikPak"+};+function Qn(e, t) {+ let n = e.cache || {+ files: 0,+ bytes: 0+ }, r = !!(e.missing || n.files);+ return `<div class="resourcepanel" data-geist-fieldset><div class="resourcesources">${(e.sources || []).map((e) => `<article>+ <div class="resourcesourcetitle"><b>${Zn[e.location] || "媒体来源"}</b><span class="${e.online ? "online" : "offline"}">${e.online ? "可访问" : "离线,已跳过"}</span></div>+ <strong>${e.online ? `${$(e.missing)} 项` : "—"}</strong>+ <small>${e.online ? `找不到文件 · 已检查 ${$(e.checked)} 项` : `馆藏中有 ${$(e.total)} 项`}</small>+ ${e.unreadable ? `<small>${$(e.unreadable)} 项读取失败,已跳过</small>` : ""}</article>`).join("")}</div>+ <div class="resourcecache"><div><span>可清理的缓存</span><b>${$(n.files)} 个</b><small>${t(n.bytes)}</small></div>+ <div><span>待移入回收站</span><b>${$(e.missing)} 项</b></div></div>+ ${r ? f(`将把找不到文件的 ${$(e.missing)} 项馆藏记录移入回收站,并清理 ${$(n.files)} 个闲置缓存。`, { label: "清理内容" }) : ""}+ <div class="resourceapplyrow geist-fieldset-footer" data-geist-fieldset-footer>${r ? "<button class=\"geist-button primary\" type=\"button\" id=\"resourceApply\">清理失效记录与缓存</button>" : "<p class=\"resourcesyncok\">已检查可访问的来源,没有待清理的记录或缓存。</p>"}</div></div>`;+}+//#endregion//#region src/jav-artwork.ts-function Jn(e) {+function $n(e) {return ["small","sleeve","preview"].includes(String(e)) ? "small" : "big";}-function Yn(e) {+function er(e) {return {- javLayout: Jn(e.javLayout),- javImage: Xn(e.javLayout === "preview" ? "thumbnail" : e.javImage)+ javLayout: $n(e.javLayout),+ javImage: tr(e.javLayout === "preview" ? "thumbnail" : e.javImage)};}-function Xn(e) {+function tr(e) {return e === "thumbnail" ? "thumbnail" : "cover";}-function Zn(e, t) {- return e.is_jav && e.code && e.has_cover && (Xn(t) === "cover" || !e.has_thumb) ? "cover" : e.has_thumb ? "thumbnail" : "";+function nr(e, t) {+ return e.is_jav && e.code && e.has_cover && (tr(t) === "cover" || !e.has_thumb) ? "cover" : e.has_thumb ? "thumbnail" : "";}-function Qn(e, t) {+function rr(e, t) {e.querySelectorAll("img[data-jav-image]").forEach((e) => {- let n = e.dataset.javCover || "", r = e.dataset.javThumb || "", i = !!(n && (Xn(t) === "cover" || !r)), a = i ? n : r;+ let n = e.dataset.javCover || "", r = e.dataset.javThumb || "", i = !!(n && (tr(t) === "cover" || !r)), a = i ? n : r;e.classList.toggle("cover", i), e.classList.toggle("whole", i && e.dataset.javImageLayout !== "big"), e.classList.toggle("front", i && e.dataset.javImageLayout === "big"), e.removeAttribute("style"), a && e.getAttribute("src") !== a && (e.src = a);});}//#endregion//#region src/islands.ts-var $n = {+var ir = {"library-processing": {- load: hn,- component: gn+ load: vn,+ component: yn},scraping: {- load: dn,- component: mn+ load: mn,+ component: _n},"quality-goals": {- load: on,- component: cn+ load: ln,+ component: dn},configuration: {- load: dt,- component: _t+ load: pt,+ component: bt}-}, er = () => Object.keys($n), tr = /* @__PURE__ */ new Map();-async function nr(e, t, n, r = {}) {- let i = $n[e];+}, ar = () => Object.keys(ir), or = /* @__PURE__ */ new Map();+async function sr(e, t, n, r = {}) {+ let i = ir[e];if (!i) throw Error(`未注册的 island:${String(e)}`);- rr(t);+ cr(t);let a = {controller: new AbortController(),painted: !1};- tr.set(t, a);+ or.set(t, a);let o;try {o = {@@ -3003,9 +3110,9 @@ async function nr(e, t, n, r = {}) {error: R(e)};}- if (tr.get(t) !== a) return;+ if (or.get(t) !== a) return;if (r.isCurrent && !r.isCurrent()) {- tr.delete(t);+ or.delete(t);return;}t.textContent = "", a.painted = !0;@@ -3015,9 +3122,9 @@ async function nr(e, t, n, r = {}) {};De(ae(i.component, s), t);}-function rr(e) {- let t = tr.get(e);- t && (t.controller.abort(), tr.delete(e), t.painted && De(null, e));+function cr(e) {+ let t = or.get(e);+ t && (t.controller.abort(), or.delete(e), t.painted && De(null, e));}//#endregion-export { Kn as TASTE_GUIDE_KEY, Rn as catalogEmptyHtml, Ln as catalogSuggestions, Wn as cleanupSkeletonHtml, Hn as cloudLocations, Un as cloudPreferenceLocations, wn as createReviewSelection, In as emptyCatalogLayout, Pn as entitySkeletonHtml, un as followJobProgress, Sn as identityEvidenceHtml, er as islandNames, Zn as javImageKind, Mn as matchesFaceSource, nr as mountIsland, Nn as nativeImageFit, Xn as normalizeJavImage, Jn as normalizeJavLayout, Yn as normalizeJavPreferences, Oe as preferredDirection, yn as refreshStore, xn as reviewImageHtml, zn as sidebarHasCatalogContent, Vn as sidebarTagCounts, vn as storeNames, Qn as syncJavImages, Bn as syncSidebarSurface, Gn as tasteHistoryGuideHtml, rr as unmountIsland, Tn as updateReviewSticky, ln as watchJob, Cn as wireReviewPictures, jn as wireReviewSelection, qn as wireTasteHistoryGuide };+export { Yn as TASTE_GUIDE_KEY, Vn as catalogEmptyHtml, Bn as catalogSuggestions, qn as cleanupSkeletonHtml, Gn as cloudLocations, Kn as cloudPreferenceLocations, Dn as createReviewSelection, zn as emptyCatalogLayout, Ln as entitySkeletonHtml, pn as followJobProgress, Tn as identityEvidenceHtml, ar as islandNames, nr as javImageKind, Fn as matchesFaceSource, sr as mountIsland, In as nativeImageFit, tr as normalizeJavImage, $n as normalizeJavLayout, er as normalizeJavPreferences, Oe as preferredDirection, Sn as refreshStore, Qn as resourceScanHtml, wn as reviewImageHtml, Hn as sidebarHasCatalogContent, Wn as sidebarTagCounts, xn as storeNames, rr as syncJavImages, Un as syncSidebarSurface, Jn as tasteHistoryGuideHtml, cr as unmountIsland, On as updateReviewSticky, fn as watchJob, En as wireReviewPictures, Pn as wireReviewSelection, Xn as wireTasteHistoryGuide };diff --git a/web/js/ui-components.js b/web/js/ui-components.jsindex 579d4e9aa..db6a27120 100644--- a/web/js/ui-components.js+++ b/web/js/ui-components.js@@ -684,18 +684,22 @@ export function confirmModal({title,body,confirmLabel,cancelLabel='取消',onCondocument.body.append(dialog);return new Promise(resolve=>{let settled=null;+ let busy=false;dialog.addEventListener('close',()=>{dialog.remove();if(trigger instanceof HTMLElement&&trigger.isConnected)trigger.focus();resolve(settled||{confirmed:false});},{once:true});- cancel.onclick=()=>dialog.close();+ cancel.onclick=()=>{if(!busy)dialog.close()};+ dialog.addEventListener('cancel',event=>{if(busy)event.preventDefault()});/* 遮罩上的点击落在 <dialog> 自己身上,卡片里的落在子元素上。这个动作可撤销,按 Geist 的判据允许点外面关掉。 */- dialog.addEventListener('click',event=>{if(event.target===dialog)dialog.close()});+ dialog.addEventListener('click',event=>{if(event.target===dialog&&!busy&&!danger)dialog.close()});accept.onclick=async()=>{+ if(busy)return;if(!onConfirm){settled={confirmed:true};dialog.close();return}failure.innerHTML='';+ busy=true;setActionBusy(accept);try{settled={confirmed:true,result:await onConfirm()};@@ -703,9 +707,9 @@ export function confirmModal({title,body,confirmLabel,cancelLabel='取消',onCon}catch(error){failure.innerHTML=noteHtml(error.message||'操作未完成',{variant:'error'});setActionBusy(accept,false);- }+ }finally{busy=false}};dialog.showModal();- accept.focus();+ (danger?cancel:accept).focus();});}