Peach: Local-first video metadata scraper and media manager.
feat(ui): CloudDrive 建议改用表格并改写说明
longmeidaobd350805dd3b
diff --git a/docs/reference-snapshots/vercel-geist-table-ranking.md b/docs/reference-snapshots/vercel-geist-table-ranking.mdindex b3d0d06e6..54fa6e904 100644--- a/docs/reference-snapshots/vercel-geist-table-ranking.md+++ b/docs/reference-snapshots/vercel-geist-table-ranking.md@@ -62,8 +62,11 @@- 使用空间的四个位置属于同形可比较数据,使用原生 `table`(`.insightdatatable`),列为位置、已用、可用与使用率;数字列 tabular numerals。容量拿不到时单元格写 `未取得`/`离线` 而不是`—`:Peach 的取证规则要求区分「不适用」与「取证失败」,这一处主动偏离 Geist。-- 三张表(`.insightdatatable`、`.insighttable`、`.linktable`)都采用分隔线变体,不叠加隔栏异色:- Geist 的这两个变体互斥,叠起来等于同时用两套分行手段。+- 四张表(`.insightdatatable`、`.insighttable`、`.linktable`、`.cloudguide-table`)都采用分隔线变体,+ 不叠加隔栏异色:Geist 的这两个变体互斥,叠起来等于同时用两套分行手段。+- 配置页的 CloudDrive 起步配置是三行同形、四列跨行比较的数据,用原生 `table`(`.cloudguide-table`),+ 首列是硬盘档位、其余三列右对齐并走 tabular numerals。表格保留 520px 最小宽度,窄屏由+ `.cloudguide-tablewrap` 自己横向滚动,页面本身不出现横向滚动条。- 悬停填充只给可点的行(`.insighttablerow:is(button)`、`.insightrankrow`)。不可点的行不加悬停,那等于给一个不存在的动作画反馈。- 内容标签是固定 Top 30 排行并可直接筛选,不提供虚假的列排序;桌面以两栏有序列表提高扫描diff --git a/frontend/src/islands/clouddrive-guide.tsx b/frontend/src/islands/clouddrive-guide.tsxindex 6874e1358..a893e7390 100644--- a/frontend/src/islands/clouddrive-guide.tsx+++ b/frontend/src/islands/clouddrive-guide.tsx@@ -2,9 +2,9 @@ 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,速度不升就调回。'},+ {name: '机械硬盘,或内存 8 GB 以内', cache: '10–20 GiB', read: '256 / 128 KB', task: '1 个'},+ {name: 'SATA SSD,内存 8–16 GB', cache: '20–50 GiB', read: '256 / 128 KB', task: '1–2 个'},+ {name: 'NVMe SSD,内存 16 GB 以上', cache: '50–100 GiB', read: '256 / 128 KB', task: '2 个起步'},] as const;export function CloudDriveGuide() {@@ -14,20 +14,25 @@ export function CloudDriveGuide() {<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>+ <p class="confighelp">看缓存放在哪块硬盘上,照那一行填。先保证播放不卡,再拿同一个视频比较打开速度、拖动和流量;数值填得越大不一定越快。</p>+ <div class="cloudguide-tablewrap">+ <table class="cloudguide-table">+ <thead><tr><th scope="col">缓存所在硬盘</th><th scope="col">缓存上限</th><th scope="col">读取长度(默认 / 最小)</th><th scope="col">同时处理视频</th></tr></thead>+ <tbody>{CLOUDDRIVE_PROFILES.map(profile => <tr key={profile.name}>+ <th scope="row">{profile.name}</th><td>{profile.cache}</td><td>{profile.read}</td><td>{profile.task}</td>+ </tr>)}</tbody>+ </table>+ </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>+ <li>缓存尽量放在内置固态盘上。只有机械硬盘时先用按需读取,反复看同一批文件才打开文件夹缓存。</li>+ <li>256 / 128 KB 适合扫描、抽帧和拖动播放。看高码率视频还是缓冲,就试 512 / 256 KB;速度没提上来就调回去。</li>+ <li>缓存上限和清理方式在 CloudDrive「设置」里填。清理方式选 LRU,也就是空间不够时先删最久没用过的缓存。上限不要填 0,系统盘至少留 40 GiB。填完重新打开这一页确认存住了,再看硬盘实际少了多少。</li>+ <li>读取长度和下载线程在每个网盘各自的下载设置里改,线程都从 2 开始。115 不要超过客户端标出的上限;PikPak 和 WebDAV 在带宽有余、加到 4 确实更快时才留 4。能开直链就开,开完放个视频确认还能播。</li>+ <li>PikPak 按 CloudDrive 当前提供的接入方式配置。走 WebDAV 时先确认服务端允许直链;115 的连接方式不能照搬过来。</li>+ <li>看视频时先暂停批量抽帧,关掉不用的播放页。码率按 Mbps 算,下载速度按 MB/s 算,除以 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>+ <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/test/clouddrive-guide.test.tsx b/frontend/test/clouddrive-guide.test.tsxindex 592218487..2b7bc9c6d 100644--- a/frontend/test/clouddrive-guide.test.tsx+++ b/frontend/test/clouddrive-guide.test.tsx@@ -6,7 +6,9 @@ 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.querySelectorAll('.cloudguide-table tbody tr')).toHaveLength(3);+ expect([...host.querySelectorAll('.cloudguide-table thead th')].map(th=>th.textContent)).toEqual(['缓存所在硬盘','缓存上限','读取长度(默认 / 最小)','同时处理视频']);+ expect([...host.querySelectorAll('.cloudguide-table tbody th')].every(th=>th.getAttribute('scope')==='row')).toBe(true);expect(host.textContent).toContain('256 / 128 KB');expect(host.textContent).toContain('上限不要填 0');expect(host.querySelector('details')?.open).toBe(false);diff --git a/web/css/23-configuration.css b/web/css/23-configuration.cssindex 425799c24..fadf8353a 100644--- a/web/css/23-configuration.css+++ b/web/css/23-configuration.css@@ -40,7 +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}}+.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-tablewrap{margin-top:16px;overflow-x:auto;overscroll-behavior-x:contain}.cloudguide-table{width:100%;min-width:520px;border-collapse:collapse;font-size:var(--fs-sm)}.cloudguide-table th,.cloudguide-table td{padding:10px 12px;border-bottom:1px solid var(--line-soft);text-align:right;font-weight:400;line-height:1.5}.cloudguide-table thead th{height:36px;padding-top:0;padding-bottom:0;color:var(--muted);font-size:var(--fs-xs)}.cloudguide-table th:first-child,.cloudguide-table td:first-child{text-align:left}.cloudguide-table tbody th{font-weight:600}.cloudguide-table tbody td{font-variant-numeric:tabular-nums;white-space:nowrap}.cloudguide-table tbody tr:last-child>*{border-bottom:0}.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 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}