Peach: Local-first video metadata scraper and media manager.
fix(ui): align settings and follow loading feedback
longmeidaodec41f29dedf
diff --git a/.claude/skills/peach-web-ui/SKILL.md b/.claude/skills/peach-web-ui/SKILL.mdindex 3ae3ecbbd..7ad4f3abe 100644--- a/.claude/skills/peach-web-ui/SKILL.md+++ b/.claude/skills/peach-web-ui/SKILL.md@@ -11,7 +11,7 @@ description: 在新增、修改或复核 Peach 页面、控件、提示、错误1. 读取相关页面、`web/js/ui-components.js`、`web/app.css` 与 `tests/test_web_ui.py`,先找现成控件、token 和行为。2. 外部产品被称为参考时同时执行 `peach-reference-evidence`;没有当前可复现证据就写 `未取得`,不补动画、间距或交互猜测。-3. 新控件先检查 `docs/reference-snapshots/vercel-geist-controls-measured.md`、`vercel-geist-semantics-measured.md` 与 `vercel-geist-note-progress-switch-analytics.md`。+3. 新控件先检查 `docs/reference-snapshots/vercel-geist-controls-measured.md`、`vercel-geist-semantics-measured.md`、`vercel-geist-note-progress-switch-analytics.md` 与 `vercel-geist-command-search-loading.md`。## 组件选择@@ -22,10 +22,13 @@ description: 在新增、修改或复核 Peach 页面、控件、提示、错误| 短暂操作回执 | Toast | 持久 Note || 销毁确认 | Modal/现有 confirm | Toast || 已知总量的进行状态 | Progress | 装饰性蓝条 |-| 未知总量短等待 | Spinner/Loading Dots | 假百分比 |+| 用户触发动作等待结果 | Spinner | 旋转原操作图标、Loading Dots |+| 后台任务仍在推进 | Loading Dots | Spinner、假百分比 || 2–3 个互斥视图 | Switch(radio) | Toggle || 布尔开关 | Toggle | Switch || 无布局高度变化的菜单 | Menu/Listbox,无动画 | Collapse 动画 |+| 带搜索语义的输入 | Search Input(搜索图标前缀;搜索中原位换 Spinner) | 无图标裸输入 |+| 全屏命令/设置覆盖层 | 有锁定证据的 Dialog motion | 把同一动画套给普通菜单 || 展开正文或分组 | Collapse | 自造 easing || 一组输入/候选及其底部动作 | Fieldset | 自造卡片 Footer || 固定高度区域中的溢出内容 | Scroller | 页面级滚动或嵌套滚动区 |@@ -39,6 +42,8 @@ description: 在新增、修改或复核 Peach 页面、控件、提示、错误- Progress 必须有真实 `value/max`、可见单位与 `aria-valuemin/max/now`;分隔线放在完整指标(含进度条)之后。- Switch 必须共享 radio `name`、初始一个 `checked`、键盘可用;布尔状态继续使用 Toggle。- 菜单每项包含与入口相同的图标和文字,菜单内部滚动、`overscroll-behavior:contain`,不得把浏览器页面撑出滚动条。+- Spinner 只反馈用户直接触发的动作,触发器声明 `aria-busy` 且等待时保持可聚焦;未知时长的后台抓取使用 Loading Dots。两者都必须保留可读状态文字并尊重 reduced motion。+- 分页末尾、空页和“没有更多内容”是中性终止状态,用可关闭 Note;只有需要恢复或处理的故障才能进入红色 error Note。- 弹层标题栏与滚动正文分层:标题分隔线属于卡片全宽,滚动条只属于正文。- 没有直接证据不得新增动效;参考产品无动画的菜单保持无动画。- Fieldset 的正文统一 20px 内边距,Footer 最小 56px、上/右/下 12px、左 20px;同组卡片必须同高,变化内容只放一个纵向 Scroller。diff --git a/docs/HANDOFF.md b/docs/HANDOFF.mdindex 18d474e71..02053ab38 100644--- a/docs/HANDOFF.md+++ b/docs/HANDOFF.md@@ -1,7 +1,6 @@# Peach 交接与长期工作约定本文件只保存跨任务长期有效的事实和工作规则,不记录逐次聊天流水。-## 界面、媒体与复核的既定判据- 卡片实体链接必须由同一个 `{kind,name}` 结构生成,禁止先独立选择显示名、再根据其他字段推断类型。此前 `FSDSS-376-C.mp4` 显示演员 `新ありな`,却因同时存在厂牌而生成 `/studios/新ありな`;真实 ledger 关系是演员 `新ありな`、厂牌 `FALENO`,错误只在前端映射。@@ -77,6 +76,7 @@ Claude 的 `.claude/settings.json` 已配置 Stop、StopFailure、SessionEnd hoo但 Tag 仍保留 6px 小圆角,普通排行不复制演示页的大留白或装饰性引导线。**Vercel Geist 控件(2026-08-28)**:官方 introduction 页实测普通操作使用 4/6px 圆角、图标操作为 32×32px,圆形留给 emoji 反馈等特殊语义。Peach 的普通操作和关闭按钮因此统一用 `--control-radius:6px`,菜单与 Modal 使用 `--floating-radius:12px`,状态标记使用 `--badge-radius:4px`;Tag 保持胶囊,媒体左右切换与头像保留圆形。全站字号、顶栏、搜索、播放列表、设置、管理、详情、关注与移动端共用这套语义 token;弹层自己的滚动容器必须使用 `overscroll-behavior:contain`,粘性标题栏要设置 `scroll-padding-top`,不能遮住键盘焦点。锁定版本、完整测量和有意差异见 `vercel-geist-controls-measured.md`。**Vercel Geist MiddleTruncate(2026-08-30)**:官方页 <https://vercel.com/geist/middle-truncate> 规定只对文件路径、URL、ID、SHA 等首尾都有信息的值做中间省略;单个 `…` 随容器宽度重算,复制和无障碍名称保留完整原文,外层不得再套 `text-overflow:ellipsis`。Peach 用原生 ES module 适配这套行为,不引入 React;资源标识必须显式使用 `data-middle-truncate`,标题、说明、人名和标签保留末尾省略;页面源门槛登记全部末尾省略选择器,任何新增截断都必须先分类。实时浏览器 DOM/CSS/JS 本轮未取得,通道错误与候选判断见 `vercel-geist-middle-truncate.md`。**Vercel Tooltip/Collapse/Projects/Analytics 与 Geist Note/Progress/Switch/Fieldset/Scroller/Empty State(2026-08-30)**:登录态项目页确认搜索占剩余宽度、筛选为方形图标钮、主操作在右,菜单无展开动画且内部滚动;Analytics 使用全局筛选、摘要指标和带独立 header 的分区数据面板。Tooltip 固定在视口内,来源菜单不得套用 Collapse motion,作者别名才使用 Collapse;Note 只放字段/卡片/分区旁的持久上下文,页面问题用 Banner、瞬时回执用 Toast;Progress 必须有真实 value/max 和 ARIA,Switch 只用于 2–3 个互斥视图,布尔值用 Toggle;Fieldset 同组卡片固定同高,变化正文放单一 Scroller,Footer 保持固定动作区;Empty State 必须把图标、标题、说明和可选动作收在同一组件,且与上方工具条保持统一间距。完整 URL、HTML SHA、浏览器未取得面和 Peach 差异见 `vercel-geist-semantics-measured.md`、`vercel-geist-note-progress-switch-analytics.md` 与 `vercel-geist-fieldset-scroller-empty-state.md`;实现门槛见 `peach-web-ui`。+**Vercel Command Menu/Search Input/Spinner/Loading Dots(2026-08-30)**:设置覆盖层使用锁定 Dialog CSS 的 350ms、`cubic-bezier(.4,0,.2,1)` 与 -40px 淡入轨迹,普通菜单仍无动画;Search Input 的搜索图标在查询期间原位换成 Spinner。用户直接触发的检查、加载、保存与应用使用 Spinner,后台抓取和扫描进度使用 Loading Dots;“没有更多历史内容”是中性、可关闭的 Note,不得登记为红色故障。证据哈希、未取得面与 Peach 差异见 `vercel-geist-command-search-loading.md`。**Beeg 资料页(2026-08-29)**:Reislin 页面实测顺序是头像与名称、简介、外部链接、关联艺人、标签、内容。Peach 的女优/厂牌资料页和关注页复用这个阅读顺序,但媒体切换只按 Peach 的真实视频/图片数量出现;合集详情继续使用普通详情的左媒体、右信息,下方另设 Mix/分卷/播放列表/多视频的横向切换带。锁定样式摘要、截图摘要和主动差异见 `beeg-profile-layout.md`。YouTube Shorts 沉浸页使用用户截图记录 `docs/reference-snapshots/youtube-shorts-immersive-user-screenshot.md`:竖屏复用中央 9:16 舞台和外置动作列,横屏使用在整个视口视觉居中的 16:9 舞台并把动作列收进视频右侧;Peach 保留自己的反馈语义,不复制订阅或社交动作。沉浸视频每次加载都要带独立 `session`,切片、关闭、失败和页面离开时取消旧会话;只清浏览器的 `src` 不足以停止 CloudDrive 预读或 FFmpeg。F95 masked 链接与 Gofile 文件列表的凭据边界见 `f95-masked-gofile-media`;Mix 只按已解析且diff --git a/docs/REUSE.md b/docs/REUSE.mdindex e24965e6b..495dcb4f6 100644--- a/docs/REUSE.md+++ b/docs/REUSE.md@@ -84,7 +84,7 @@3. 将剩余 status/suggest/ledger 应用逻辑移到 repository/application 端口,再删除旧 CLI 表面。4. Peach 不做 token/成本日志扫描器,也不绑定 T3 Code 私有 RPC;使用其界面、CodexBar 和官方实时配额入口。5. 「模仿/参考/对齐」不等于允许凭记忆近似。先取得并登记可复现证据;否则标记 `未取得`,不得作为忠实复刻发布。2026-08-17 的 YouTube 详情与 Shorts 动作栏参考已登记在 `docs/HANDOFF.md`,Peach 只复用可测量的层级、尺寸和状态语义。-6. Web UI 组件优先复用 `web/js/ui-components.js` 和 `.claude/skills/peach-web-ui/SKILL.md` 的语义矩阵。Peach 不引入 Geist React 运行时,只复用已锁定证据中的 Note/Progress/Switch/Tooltip/Collapse/Menu/Fieldset/Scroller/Empty State 语义、ARIA 与版式层级;整页异步重绘复用导航代际隔离,没有消费者的 Vercel 后台筛选器不照搬。+6. Web UI 组件优先复用 `web/js/ui-components.js` 和 `.claude/skills/peach-web-ui/SKILL.md` 的语义矩阵。Peach 不引入 Geist React 运行时,只复用已锁定证据中的 Note/Progress/Switch/Tooltip/Collapse/Menu/Fieldset/Scroller/Empty State/Search Input/Spinner/Loading Dots 与 Dialog motion 语义、ARIA 和版式层级;整页异步重绘复用导航代际隔离,没有消费者的 Vercel 后台筛选器不照搬。## 2026-08-28 自研实现审计diff --git a/docs/STATUS.md b/docs/STATUS.mdindex c03881f85..7af5dc3cd 100644--- a/docs/STATUS.md+++ b/docs/STATUS.md@@ -37,6 +37,7 @@ undefine## 本批修正与验证+- 2026-08-30 按 Vercel Geist Command Menu/Search Input/Spinner/Loading Dots 的锁定源码证据修正等待与反馈语义:设置 Dialog 恢复 350ms 进出动画,导航项目靠左,滚动容器用双侧稳定 gutter 保持视觉居中;关注查找固定搜索图标前缀,请求时原位换 Spinner,来源筛选保留“全部来源”,添加与检查等用户动作使用 Spinner,后台抓取使用 Loading Dots。历史分页的 400/404/空页按来源契约归为“没有更多历史内容”,不再写失败状态、推进游标或显示红色,并提供可关闭的中性 Note。Windows 正式全量 1272 项通过、13 项按平台跳过;临时账本的 1280×720 与 390×844 浏览器实测横向溢出 0,设置卡中心与视口中心一致,打开/关闭动画和再次打开无残留,控制台 0 错误。只启动并关闭 8912 开发服务,未部署、未重启生产、未写真实 ledger。- 2026-08-30 依据锁定的 Vercel Geist Fieldset/Scroller/Empty State 官方 HTML/CSS 复核人工复核和管理空态:复核卡改为真实 fieldset,统一 440px 高,20px 正文内边距、单一纵向 Scroller 与最小 56px 固定 Footer;关注管理的“添加关注/关注列表/凭据”标题条实测均为 56px。回收站、普通零结果、重复文件、复核、高清版、播放列表与关注空态统一使用共享组件,标题下说明和可选动作不再拆散或套双层空卡;重复页与回收站在 390×844 下距上方摘要均为 16px、横向溢出 0。新增导航代际 token;浏览器连续快速切换疑似广告→重复→复核→重复后最终路径与内容一致,旧网格 0 项、控制台 0 错误。42 张创作者复核卡实测全部 440px,高内容卡 Scroller 为 1566/333px 且显示底部渐隐。Windows 正式全量 1265 项通过、13 项按平台跳过。浏览器 Fieldset DOM 已取得,但官方页计算样式读取 20 秒超时并重置;未取得面已登记,尺寸使用同日锁定哈希的官方资源,没有目测补值。本地预览只使用真实 ledger 的临时副本,未部署、未重启生产服务、未写真实 ledger。- 2026-08-30 依据锁定的 Vercel Geist Note/Progress/Switch 官方 HTML 与登录态 Analytics DOM 复核近期 UI:新增原生 ES module 组件层,资源同步、口味加载和关注检查明细统一为持久 error Note,关注页历史故障明确归为可关闭 Banner;统计页改成有独立 header/body 的 Analytics 式数据面板,所有进度条使用真实 value/max、`progressbar` ARIA,指标分隔线位于进度条下;设置标题移出滚动正文,分隔线到达卡片两边;导航添加改成每项有图标、内部滚动、无入场动画的 listbox;JAV 三种版式改用共享 radio name 的 Geist Switch,布尔遮挡继续使用 Toggle。新增 `peach-web-ui` 项目技能、引用快照和源码门槛,后续 UI 改动必须先复用现有组件与证据。Windows 正式全量 1262 项通过、13 项按平台跳过;最终菜单焦点修正后的 `catalog` 434 项复测通过。本地 1440×900 与 390×844 实测面板、分隔线、菜单图标/边界、Switch、横向溢出 0 和控制台 0 错误。Speed Insights 登录态页面因浏览器导航超时未取得,已明确登记,未用 Analytics 臆测替代。本轮只启动并关闭 8901 开发服务,未部署/重启 80/443,未写真实 ledger。- 2026-08-30 修复 JAV「小图 · 整张封套」多人卡片过高:根因是该版式只改封面比例,仍复用普通卡片的 3 头像、两行标题、大小、观看次数和标签,字段换行后单卡会撑高整行。现在只在 `jav-small` 下显示前 2 个头像,标题和身份各 1 行,次要元数据留到详情;大图、预览图和详情不变。分支重放到最新 `master` 后正式 `catalog` 432 项全绿;生产页面 1280×720 与 390×844 实测多人卡片头像为 2、元数据区 40px、次要字段不占布局,控制台无错误。纯前端资源实时生效,无需重启,本轮未写真实 ledger、未替换生产 EXE。diff --git a/docs/reference-snapshots/vercel-geist-command-search-loading.md b/docs/reference-snapshots/vercel-geist-command-search-loading.mdnew file mode 100644index 000000000..e28c2b7b4--- /dev/null+++ b/docs/reference-snapshots/vercel-geist-command-search-loading.md@@ -0,0 +1,32 @@+# Vercel Geist Command Menu、Search Input、Spinner 与 Loading Dots++取证日期:2026-08-30。++## 锁定来源++- <https://vercel.com/geist/command-menu> HTML SHA-256:`0AC2CA5DBC1FC07E48700206C8E8EC21C447460C089D65CFC3324CAC9D0EC13E`+- <https://vercel.com/geist/search-input> HTML SHA-256:`55F62A034450EB68A4D2A46726A0A9A8CF806570C2E31162C6C869F4B38C21A2`+- <https://vercel.com/geist/spinner> HTML SHA-256:`DD1B8A0742A6504D0E8852FAA61269C8720CB7C360B1B9FED6C9BF4C64772C60`+- <https://vercel.com/geist/loading-dots> HTML SHA-256:`CB5548EF02D135DFA26DF1A9881F3E57E79F3F846C4DE3F3A94FB4AC4CEB8983`+- 官方 CSS `1zsi1fomvr48z.css`:`62B3416EB6D73D86FCF284B5A9FD05A69DCBB091E3D79B6725EC83F0990E6ECE`+- 官方 CSS `328y7_b581oob.css`:`3034E6739AE0E19814DF6E53BA7FEBEFE56CF986ED0F1C3534DF9AEE1F751B87`+- 官方 CSS `3ej-07gndl9ds.css`:`587B35B6741B202EE2A7ACAFB4D2A9C6EA2A2819DA55BCF218634FA91A5617EE`++通过项目既有 OpenSSL curl 路径取得。登录态浏览器已加载 Vercel 后台,但导航到 Command Menu 的自动化调用在 30 秒超时并重置运行时,因此实时动画帧与计算样式记为“未取得”;实现只采用锁定 CSS 中可重放的数值。++## 可迁移事实++- Command Menu 是全屏覆盖层。官方 Dialog 打开时使用 `350ms cubic-bezier(.4,0,.2,1)`,内容从 `translate3d(0,-40px,0); opacity:0` 到原位;关闭反向,背景同步淡入淡出。+- Search Input 前缀是搜索图标。Peach 在请求期间原位替换为 Spinner,输入框几何不变。+- Spinner 用于用户直接触发且等待结果的动作,例如按钮与分页;容器声明 `aria-busy=true`,Spinner 自身为 `role=status`。+- 官方 Spinner 由 10 根径向条组成,相隔 36°,持续 1000ms,延迟从 -900ms 到 0ms,透明度从 1 降至 .15。+- Loading Dots 用于仍在后台推进、总量未知的工作,不代替用户动作按钮的 Spinner。+- `prefers-reduced-motion: reduce` 下不得强行动画;状态文字与 ARIA 仍要保留。++## Peach 采用与差异++- 设置面板复用 Dialog 轨迹;普通来源菜单仍按既有证据无动画,不能把 Command Menu 动画套给所有展开控件。+- 添加关注使用 Search Input 前缀;搜索时只把前缀替换成 Spinner,来源筛选保留“全部来源”可见文字。+- 检查、加载、保存、应用等用户动作使用 Spinner;抓取更早内容和后台资源扫描说明使用 Loading Dots。+- Peach 是原生 ES module,不引入 Geist React 运行时;共享实现位于 `web/js/ui-components.js`。+- “没有更多历史内容”是成功的终止状态,使用中性可关闭 Note,不使用红色 error Note。diff --git a/docs/reference-sources.json b/docs/reference-sources.jsonindex 71bc9e436..eba4f6f24 100644--- a/docs/reference-sources.json+++ b/docs/reference-sources.json@@ -150,6 +150,22 @@"web/app.js","tests/test_web_ui.py"]+ },+ {+ "id": "vercel-geist-command-search-loading",+ "name": "Vercel Geist Command Menu、Search Input、Spinner 与 Loading Dots",+ "url": "https://vercel.com/geist/command-menu",+ "snapshot": "docs/reference-snapshots/vercel-geist-command-search-loading.md",+ "checked_on": "2026-08-30",+ "sha256": "3be4d0f23965c2b0ef5865432d5db37f14f66f9e00dfa97801ec6074f0aab5d9",+ "role": "设置 Dialog 动效、搜索前缀、用户动作 Spinner、后台 Loading Dots 与无更多历史内容中性反馈的项目级依据。",+ "consumers": [+ "web/js/ui-components.js",+ "web/app.css",+ "web/app.js",+ "tests/test_follow_web.py",+ "tests/test_web_ui.py"+ ]}]}diff --git a/src/peach/follow.py b/src/peach/follow.pyindex c1e260770..59c9b5ff9 100644--- a/src/peach/follow.py+++ b/src/peach/follow.py@@ -24,6 +24,10 @@ class FollowSourceError(RuntimeError):pass+class FollowHistoryEnd(FollowSourceError):+ """A valid backfill response that means there are no older items."""++def plain_text(value: str | None) -> str | None:"""把站点返回的 HTML 片段压成一行纯文本。"""if not value:diff --git a/src/peach/follow_sources.py b/src/peach/follow_sources.pyindex b58d77864..e00546efd 100644--- a/src/peach/follow_sources.py+++ b/src/peach/follow_sources.py@@ -21,7 +21,9 @@ from bs4 import BeautifulSoupfrom .fanbox import FanboxContentError, normalize_fanbox_postfrom . import follow_providers-from .follow import DEFAULT_MAX_BYTES, FollowSourceError, plain_text, stable_id+from .follow import (+ DEFAULT_MAX_BYTES, FollowHistoryEnd, FollowSourceError, plain_text, stable_id,+)from .follow_secrets import Credential, CredentialErrorfrom .follow_gofile import GofileExpanderfrom .http import CurlCffiTransport, HttpRequest, HttpResponse, HttpTransport, HttpxTransport@@ -392,6 +394,7 @@ class _BaseConnector:last_modified: str | None = None, page: int = 0,headers: Mapping[str, str] | None = None,request_url: str | None = None,+ history_end_statuses: tuple[int, ...] = (),) -> tuple[dict[str, object], HttpResponse | None]:"""每个连接器 fetch 开头都一样的那段:条件请求 → 304 短路 → 状态检查。@@ -415,6 +418,8 @@ class _BaseConnector:}if response.status == 304:return common, None+ if page and response.status in history_end_statuses:+ raise FollowHistoryEnd("没有更多历史内容")self._check_status(response)return common, response@@ -496,7 +501,8 @@ class KemonoConnector(_BaseConnector):# 实测这个接口一页固定 50 条,往回翻用 `?o=` 偏移。url = f"{url}?o={page * self.PAGE_SIZE}"common, response = self._request(url, ref=ref, etag=etag,- last_modified=last_modified, page=page)+ last_modified=last_modified, page=page,+ history_end_statuses=(400, 404))if response is None:return SourceFetch(not_modified=True, **common)payload = self.parse_json(response)@@ -504,6 +510,8 @@ class KemonoConnector(_BaseConnector):posts = payload.get("posts", []) if isinstance(payload, dict) else payloadif not isinstance(posts, list):raise FollowSourceError(f"{self.provider} 的帖子列表格式不符")+ if page and not posts:+ raise FollowHistoryEnd("没有更多历史内容")kept, skipped, probed = [], 0, 0for post in posts[: self.max_items]:if not isinstance(post, dict):@@ -664,7 +672,8 @@ class Rule34VideoConnector(_BaseConnector):f"&sort_by=post_date&from={page + 1:02d}")common, response = self._request(url, ref=slug, etag=etag,last_modified=last_modified, page=page,- headers={"Accept": "text/html"})+ headers={"Accept": "text/html"},+ history_end_statuses=(404,))if response is None:return SourceFetch(not_modified=True, **common)soup = BeautifulSoup(response.body, "html.parser")@@ -680,6 +689,8 @@ class Rule34VideoConnector(_BaseConnector):if len(listed) >= self.max_items:breakif not listed:+ if page:+ raise FollowHistoryEnd("没有更多历史内容")raise FollowSourceError("rule34video 创作者页没有解析出任何作品:页面结构可能已变,""或该 slug 不存在")@@ -865,6 +876,8 @@ class Rule34XxxConnector(_BaseConnector):for post in posts[: self.max_items]if isinstance(post, dict))+ if page and not candidates:+ raise FollowHistoryEnd("没有更多历史内容")return SourceFetch(candidates=candidates, raw_body=response.body, **common)#: 拼可读标签时跳过的词:作者手柄、媒体类型和评级,留下的才是内容。@@ -952,7 +965,8 @@ class Rule34PahealConnector(_BaseConnector):url = f"https://rule34.paheal.net/post/list/{encoded}/{page_number}"common, response = self._request(url, ref=tag, etag=etag,last_modified=last_modified, page=page,- headers={"Accept": "text/html"})+ headers={"Accept": "text/html"},+ history_end_statuses=(404,))if response is None:return SourceFetch(not_modified=True, **common)soup = BeautifulSoup(response.body, "html.parser")@@ -993,6 +1007,8 @@ class Rule34PahealConnector(_BaseConnector):"tag_types": {value: "general" for value in tag_values}},))if not candidates:+ if page:+ raise FollowHistoryEnd("没有更多历史内容")raise FollowSourceError("rule34.paheal 标签页没有解析出任何作品")return SourceFetch(candidates=tuple(candidates), probed=len(candidates),raw_body=response.body, **common)diff --git a/src/peach/follow_store.py b/src/peach/follow_store.pyindex 87e2ccd73..7b4ec02f9 100644--- a/src/peach/follow_store.py+++ b/src/peach/follow_store.py@@ -254,6 +254,14 @@ class FollowStore:"UPDATE follow_source SET last_checked_at=?, last_status=?, last_error=?,"" updated_at=? WHERE id=?", (stamp, status, message[:500], stamp, source_id))+ def record_history_end(self, source_id: int,+ moment: datetime | None = None) -> None:+ """Record a successful terminal backfill without advancing its cursor."""+ stamp = _now_text(moment)+ self._connect().execute(+ "UPDATE follow_source SET last_checked_at=?, last_status='not_modified',"+ " last_error=NULL, updated_at=? WHERE id=?", (stamp, stamp, source_id))+def _persist_evidence(self, fetch: SourceFetch,moment: datetime | None) -> tuple[str | None, str | None]:"""存原始响应。存不下来不算检查失败。diff --git a/src/peach/web_follow.py b/src/peach/web_follow.pyindex fad56366a..94c12fbf8 100644--- a/src/peach/web_follow.py+++ b/src/peach/web_follow.py@@ -14,7 +14,7 @@ import urllib.parsefrom datetime import datetime, timezonefrom . import follow_providers-from .follow import FollowSourceError+from .follow import FollowHistoryEnd, FollowSourceErrorfrom .follow_discovery import discoverfrom .follow_secrets import CredentialError, CredentialStorefrom .follow_sources import (@@ -516,6 +516,7 @@ def _official_avatar_url(provider: str, ref: str) -> str | None:def _source_payload(row, aliases: dict[str, str] | None = None) -> dict:+ history_exhausted = _legacy_history_end(row)return {"id": row["id"],"provider": row["provider"],@@ -535,11 +536,25 @@ def _source_payload(row, aliases: dict[str, str] | None = None) -> dict:# 否则用户点一次只看到列表变长一点,不知道自己走到第几页。"backfill_page": row["backfill_page"],"last_checked_at": row["last_checked_at"],- "last_status": row["last_status"],- "last_error": row["last_error"],+ "last_status": "not_modified" if history_exhausted else row["last_status"],+ "last_error": None if history_exhausted else row["last_error"],+ "history_exhausted": history_exhausted,}+def _legacy_history_end(row) -> bool:+ """Normalize terminal backfill responses recorded as errors by older builds."""+ if int(row["backfill_page"] or 0) <= 0 or row["last_status"] != "error":+ return False+ provider = str(row["provider"] or "")+ message = str(row["last_error"] or "").casefold()+ if provider in {"kemono", "coomer", "pawchive"}:+ return message in {f"{provider} 返回 http 400", f"{provider} 返回 http 404"}+ if provider == "rule34paheal":+ return message == "rule34paheal 返回 http 404"+ return False++def q_follow(contract, args) -> dict:statuses = tuple(value for value in str(args.get("status") or "").split(",") if value in _STATUSES@@ -727,6 +742,17 @@ def _run_follow_check(contract, body) -> dict:connector = build_connector(provider, **connector_kwargs)fetch = connector.fetch(ref, etag=row["etag"],last_modified=row["last_modified"], page=page)+ except FollowHistoryEnd:+ with contract.database.write_transaction() as connection:+ _store(contract, connection).record_history_end(row["id"], moment)+ results.append({+ "source": row["id"], "provider": provider,+ "provider_label": PROVIDER_LABELS.get(provider, provider),+ "ref": ref, "label": row["label"], "ok": True,+ "page": page, "older": older, "exhausted": True,+ "message": "没有更多历史内容",+ })+ continueexcept CredentialError as error:results.append(_failure(contract, row, error, moment, "unauthorized"))continuediff --git a/tests/test_follow_sources.py b/tests/test_follow_sources.pyindex 0d4d4fe35..6f81c6be9 100644--- a/tests/test_follow_sources.py+++ b/tests/test_follow_sources.py@@ -12,7 +12,7 @@ import unittestfrom datetime import datetime, timezonefrom pathlib import Path-from peach.follow import FollowSourceError+from peach.follow import FollowHistoryEnd, FollowSourceErrorfrom peach.follow_secrets import Credential, CredentialError, CredentialStorefrom peach.follow_sources import (USER_AGENT, F95ZoneConnector, FanboxConnector, KemonoConnector,@@ -365,6 +365,11 @@ class Rule34PahealConnectorTests(unittest.TestCase):"https://r34i.paheal-cdn.net/df/fb/video")self.assertFalse(item.title_is_name)+ def test_backfill_404_means_history_is_exhausted(self):+ connector = Rule34PahealConnector(transport=_transport(status=404))+ with self.assertRaises(FollowHistoryEnd):+ connector.fetch("initiala", page=3)+class KemonoConnectorTests(unittest.TestCase):def test_fetch_normalizes_posts_and_sends_the_documented_accept_header(self):@@ -577,6 +582,11 @@ class KemonoConnectorTests(unittest.TestCase):self.assertTrue(result.not_modified)self.assertEqual(result.candidates, ())+ def test_backfill_400_means_history_is_exhausted(self):+ connector = KemonoConnector(transport=_transport(status=400))+ with self.assertRaises(FollowHistoryEnd):+ connector.fetch("fanbox/1", page=2)+def test_malformed_ref_is_rejected_before_any_request(self):seen = []connector = KemonoConnector(transport=_transport(record=seen))@@ -608,6 +618,11 @@ class Rule34VideoConnectorTests(unittest.TestCase):self.assertEqual(result.candidates[0].duration, 20.0)self.assertEqual(result.candidates[1].duration, 433.0)+ def test_empty_backfill_page_means_history_is_exhausted(self):+ connector = Rule34VideoConnector(transport=_transport(body=b"<html></html>"))+ with self.assertRaises(FollowHistoryEnd):+ connector.fetch("lazyprocrastinator", page=4)+def test_data_uri_placeholder_is_not_used_as_a_thumbnail(self):first = self._fetch().candidates[0]self.assertTrue(first.thumb_url.endswith("/3.jpg"))@@ -862,6 +877,10 @@ class Rule34XxxConnectorTests(unittest.TestCase):self.assertEqual(result.candidates, ())self.assertEqual(result.raw_body, b" \r\n")+ def test_an_empty_backfill_response_means_history_is_exhausted(self):+ with self.assertRaises(FollowHistoryEnd):+ self._connector(body=b" \r\n").fetch("lazyprocrastinator", page=4)+def test_the_declared_origin_becomes_a_cross_site_group_key(self):# 同一个 fanbox 帖在 source 里有两种写法,必须归一到同一个键——而那串数字# 正是 kemono 上同一帖子的 post id,跨站重复因此能精确命中。diff --git a/tests/test_follow_web.py b/tests/test_follow_web.pyindex a38c339ef..a4411841f 100644--- a/tests/test_follow_web.py+++ b/tests/test_follow_web.py@@ -15,6 +15,7 @@ from pathlib import Pathfrom unittest import mockfrom peach import web_follow+from peach.follow import FollowHistoryEndfrom peach.follow import FollowSourceErrorfrom peach.follow_discovery import Discovery, ExternalSearchfrom peach.follow_secrets import CredentialError@@ -151,6 +152,29 @@ class FollowContractTests(unittest.TestCase):if row["provider"] == "f95zone")self.assertFalse(source["can_backfill"])+ def test_history_end_is_a_neutral_success_and_does_not_advance_cursor(self):+ source_id = self._seed()++ class _Ended:+ provider, semantics = "rule34video", "work"++ def fetch(self, ref, *, etag=None, last_modified=None, page=0):+ raise FollowHistoryEnd("没有更多历史内容")++ with mock.patch.object(web_follow, "build_connector", return_value=_Ended()):+ result = self._post("/api/follow/check", {"older": True})+ row = result["results"][0]+ self.assertTrue(row["ok"])+ self.assertTrue(row["exhausted"])+ self.assertEqual(row["message"], "没有更多历史内容")+ with self.contract.database.read_connection() as connection:+ state = dict(connection.execute(+ "SELECT backfill_page,last_status,last_error FROM follow_source WHERE id=?",+ (source_id,)).fetchone())+ self.assertEqual(state["backfill_page"], 0)+ self.assertEqual(state["last_status"], "not_modified")+ self.assertIsNone(state["last_error"])+def test_feed_groups_variants_under_one_card(self):self._seed()payload = self._get()@@ -1167,15 +1191,16 @@ class FollowWebSourceTests(unittest.TestCase):self.assertIn("height:38px", add_button[:add_button.index("}")])def test_source_filter_uses_the_project_toolbar_layout_without_menu_motion(self):- # Vercel Projects:搜索占剩余宽度,筛选是方形图标按钮,主操作在右;+ # Vercel Projects:搜索占剩余宽度,筛选带明确标签,主操作在右;# 菜单没有展开动画,并在自己的视口内滚动。self.assertPageContains(- ".faddform{display:grid;grid-template-columns:minmax(0,1fr) 38px auto;gap:8px")+ ".faddform{display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:8px")self.assertPageContains(- ".faddform .fsrcfilter .fbtn{width:38px;height:38px;min-height:38px;padding:0}")+ ".faddform .fsrcfilter .fbtn{width:auto;height:38px;min-height:38px;padding:0 11px}")self.assertPageContains('aria-expanded="false" aria-haspopup="menu"')self.assertPageContains('aria-label="${esc(label())}" title="${esc(label())}"')- self.assertPageLacks("data-srcfilter-label")+ self.assertPageContains("data-srcfilter-label")+ self.assertPageContains("'全部来源'")menu = self.page[self.page.index(".fsrcmenu{"):]menu = menu[:menu.index("}")]self.assertIn("position:fixed", menu)@@ -1638,7 +1663,8 @@ class FollowWebSourceTests(unittest.TestCase):self.assertPageContains("followCheckReport=result;")self.assertPageContains("${followCheckReport?followCheckFailNote(followCheckReport):''}")for needle in ("新增 <b>", "更新 <b>", "个来源没有更新", "没有任何更新",- "个失败", "fcheckfail"):+ "个失败", "fcheckfail", "没有更多历史内容",+ "data-follow-report-dismiss"):self.assertPageContains(needle)# 失败要说清是哪个站,不能让用户去猜 `rule34xxx` 是什么。self.assertPageContains("row.provider_label||row.provider")@@ -1708,10 +1734,11 @@ class FollowWebSourceTests(unittest.TestCase):self.assertPageContains(".followresources a:hover")self.assertPageContains("text-decoration:none")- def test_follow_check_icons_spin_and_known_copy_says_followed(self):- # 转圈动画全站只有一套:busy 挂在按钮上,图标自己转(peach-spin)。- self.assertPageContains("@keyframes peach-spin")- self.assertPageContains("button.busy>svg{animation:peach-spin .8s linear infinite}")+ def test_loading_semantics_and_known_copy_says_followed(self):+ self.assertPageContains("@keyframes geist-spinner-opacity")+ self.assertPageContains("@keyframes geist-loading-dot")+ self.assertPageContains("spinnerHtml('查找中')")+ self.assertPageContains("loadingDotsHtml('抓取中…')")self.assertPageContains("c.known?'已经关注':c.evidence")self.assertPageLacks("已经在追")diff --git a/tests/test_reference_updates.py b/tests/test_reference_updates.pyindex be6640418..0bf2a03f5 100644--- a/tests/test_reference_updates.py+++ b/tests/test_reference_updates.py@@ -32,7 +32,8 @@ class ReferenceUpdateTests(unittest.TestCase):"fiu758-studio-logo-discovery", "rule34-follow-tags-and-collections","f95-masked-gofile-media", "follow-fanbox-gofile-paheal","fanbox-browser-transport", "beeg-profile-layout",- "vercel-geist-fieldset-scroller-empty-state"},+ "vercel-geist-fieldset-scroller-empty-state",+ "vercel-geist-command-search-loading"},)self.assertNotEqual(sources["vercel-report-design"]["url"],diff --git a/tests/test_web_ui.py b/tests/test_web_ui.pyindex 099f03892..df4b622bb 100644--- a/tests/test_web_ui.py+++ b/tests/test_web_ui.py@@ -113,9 +113,15 @@ class WebUiSourceTests(unittest.TestCase):self.assertPageContains("document.body.classList.add('settings-open')")self.assertPageContains("document.body.classList.remove('settings-open')")+ def test_settings_dialog_uses_the_evidenced_command_menu_motion(self):+ self.assertPageContains("animation:settings-dialog-in .35s cubic-bezier(.4,0,.2,1) both")+ self.assertPageContains("translate3d(0,-40px,0);opacity:0")+ self.assertPageContains("panel.classList.add('closing')")+ self.assertPageContains("prefers-reduced-motion: reduce")+def test_settings_titlebar_owns_the_full_width_above_its_scroll_container(self):self.assertPageContains(".settingsscroll{flex:1;min-height:0;overflow-y:auto;padding:0 20px 20px")- self.assertPageContains("scrollbar-gutter:stable;overscroll-behavior:contain")+ self.assertPageContains("scrollbar-gutter:stable both-edges;overscroll-behavior:contain")self.assertPageContains(".settingshead{z-index:2;display:flex")self.assertPageContains("border-bottom:1px solid var(--line-soft);background:var(--frost-panel)")self.assertPageContains('<div class="settingscard">\n <div class="settingshead">')@@ -710,7 +716,10 @@ class WebUiSourceTests(unittest.TestCase):self.assertPageLacks('class="prog"')def test_note_semantics_replace_empty_states_for_persistent_errors(self):- self.assertPageContains("import { emptyStateHtml, noteHtml, progressHtml, scrollerHtml, wireScrollers } from './js/ui-components.js'")+ for name in ("emptyStateHtml", "loadingDotsHtml", "noteHtml", "progressHtml",+ "scrollerHtml", "spinnerHtml", "wireScrollers"):+ self.assertPageContains(name)+ self.assertPageContains("from './js/ui-components.js'")self.assertPageContains("const NOTE_VARIANTS=new Set(['secondary','warning','error','success'])")self.assertPageContains("const role=kind==='error'?' role=\"alert\"':' role=\"note\"'")self.assertPageContains("noteHtml(error.message,{variant:'error',label:'同步失败'})")@@ -1399,12 +1408,12 @@ class WebUiSourceTests(unittest.TestCase):# fwarn 提供 dismiss(会话内记忆),关闭钮样式与 toast 关闭钮同量纲。self.assertPageContains("data-fwarn-dismiss")self.assertPageContains("sessionStorage.setItem('peach-fwarn-dismissed','1')")- self.assertPageContains(".fwarn .wclose{flex:none;width:24px;height:24px;margin-left:auto;padding:0;border:0;")+ self.assertPageContains(".fwarn .wclose,.fcheckreport .wclose{flex:none;width:24px;height:24px;margin-left:auto;padding:0;border:0;")# 报告条:danger 语义(红发丝边 + 微红底),不再是左侧粗条。self.assertPageContains("background:color-mix(in srgb,var(--drop) 7%,transparent);\n border:1px solid color-mix(in srgb,var(--drop) 30%,transparent);")self.assertPageLacks("border-left:2px solid var(--drop)")# 来源行状态徽章(ok 绿 tint / 失败红 tint / 未检查灰)。- self.assertPageContains('<span class="sbadge ${badge}" title="${esc(state)}"><i aria-hidden="true"></i></span>')+ self.assertPageContains('<span class="sbadge ${badge}" title="${esc(stateTitle)}"><i aria-hidden="true"></i>')self.assertPageContains(".sbadge i{width:6px;height:6px;border-radius:50%;background:var(--muted);flex:none}")self.assertPageContains(".sbadge.ok i{background:var(--success)}")self.assertPageContains(".sbadge.error i{background:var(--drop)}")@@ -1616,7 +1625,8 @@ class WebUiSourceTests(unittest.TestCase):reviewed_end_selectors = {".alphatag span:first-of-type", ".av .nm", ".entitylinklabel",".entitytags button", ".fauthor .fsource.frow>b", ".fauthorhead b",- ".fchip", ".frow>b", ".fvkind", ".idname", ".kv>span:first-child",+ ".fchip", ".folderfoot .fmeta", ".fpickactions [data-pick-state]",+ ".frow>b", ".fvkind", ".idname", ".kv>span:first-child",".jav-small .meta .t", ".meta .t", ".meta .who", ".mixcopy b,.mixcopy span",".mixitemtext [data-truncate-end]", ".mixqueuehead h2",".playerstats dd", ".relatedperson .nm", ".reviewentity b",@@ -1939,7 +1949,7 @@ class WebUiSourceTests(unittest.TestCase):self.assertPageContains(".resourcesources article+article{border-left:1px solid var(--line-soft)}")self.assertPageContains(".resourceapplyrow .resourcesyncok{color:var(--success)}")self.assertPageContains("border-radius:var(--control-radius)")- self.assertPageContains("animation:peach-spin .8s linear infinite")+ self.assertPageContains("@keyframes geist-spinner-opacity")sections = self.page.split("const MANAGE_SECTIONS=[", 1)[1].split("];", 1)[0]self.assertNotIn("'resources'", sections)diff --git a/web/app.css b/web/app.cssindex 35ef24d00..68aa56539 100644--- a/web/app.css+++ b/web/app.css@@ -76,11 +76,18 @@ button,input,textarea{font:inherit;color:inherit}button,a,input,textarea,select,summary{touch-action:manipulation}:focus-visible{outline:2px solid var(--tungsten);outline-offset:2px}@media (prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}-/* 全站唯一的转圈动画。凡是会等网络或账本的按钮(检查更新、抓更早、扫描、同步、- 换一批)把 busy 类挂在自己身上,按钮里的 refresh-cw 图标自己转;- 以前 resource-spin / follow-spin / spin 三套定义同一个效果,已并入这一条。 */-@keyframes peach-spin{to{transform:rotate(360deg)}}-button.busy>svg{animation:peach-spin .8s linear infinite}+/* Geist Spinner = 用户触发动作的即时反馈;Loading Dots = 后台任务仍在推进。 */+@keyframes geist-spinner-opacity{0%{opacity:1}100%{opacity:.15}}+.geist-spinner{position:relative;display:inline-block;flex:none;width:16px;height:16px;color:currentColor}+.geist-spinner>i{position:absolute;top:1px;left:7px;width:2px;height:4px;border-radius:2px;+ background:currentColor;transform-origin:1px 7px;transform:rotate(var(--spinner-angle));+ animation:geist-spinner-opacity 1s linear var(--spinner-delay) infinite}+@keyframes geist-loading-dot{0%,80%,100%{opacity:.25;transform:translateY(0)}40%{opacity:1;transform:translateY(-2px)}}+.geist-loading{display:inline-flex;align-items:center;min-width:0;gap:8px;color:var(--muted)}+.geist-loading-dots{display:inline-flex;align-items:center;gap:3px;flex:none}+.geist-loading-dots>i{width:4px;height:4px;border-radius:50%;background:currentColor;+ animation:geist-loading-dot 1.2s ease-in-out infinite}+.geist-loading-dots>i:nth-child(2){animation-delay:.15s}.geist-loading-dots>i:nth-child(3){animation-delay:.3s}.skiplink{position:fixed;z-index:1000;left:12px;top:8px;transform:translateY(-150%);padding:9px 13px;border-radius:8px;background:var(--ink);color:var(--ground);text-decoration:none;transition:transform .12s ease}@@ -1021,9 +1028,16 @@ body.settings-open{overflow:hidden}/* 模态层次对齐 Geist dialog:scrim 压暗 + 轻毛玻璃。42% 黑在暗色主题下几乎看不出遮挡关系,暗色下加深到 62%。 */.settingspanel{backdrop-filter:blur(5px)}-.settingscard{display:flex;flex-direction:column;width:min(520px,100%);max-height:min(720px,90vh);max-height:min(720px,90dvh);overflow:hidden;+.settingspanel:not([hidden]){animation:settings-backdrop-in .35s cubic-bezier(.4,0,.2,1) both}+.settingspanel.closing{animation-name:settings-backdrop-out}+.settingspanel.closing :where(.settingscard){animation-name:settings-dialog-out}+@keyframes settings-backdrop-in{from{opacity:0}to{opacity:1}}+@keyframes settings-backdrop-out{from{opacity:1}to{opacity:0}}+@keyframes settings-dialog-in{from{transform:translate3d(0,-40px,0);opacity:0}to{transform:translate3d(0,0,0);opacity:1}}+@keyframes settings-dialog-out{from{transform:translate3d(0,0,0);opacity:1}to{transform:translate3d(0,-40px,0);opacity:0}}+.settingscard{display:flex;flex-direction:column;width:min(520px,100%);max-height:min(720px,90vh);max-height:min(720px,90dvh);overflow:hidden;animation:settings-dialog-in .35s cubic-bezier(.4,0,.2,1) both;border:1px solid var(--border-15);border-radius:var(--floating-radius);background:var(--frost-panel);box-shadow:0 2px 4px #0004,0 30px 90px -30px #000;- backdrop-filter:saturate(1.7) blur(24px)}.settingsscroll{flex:1;min-height:0;overflow-y:auto;padding:0 20px 20px;scrollbar-gutter:stable;overscroll-behavior:contain}.settingshead{z-index:2;display:flex;align-items:center;justify-content:space-between;flex:none;padding:20px 20px 16px;border-bottom:1px solid var(--line-soft);background:var(--frost-panel);backdrop-filter:saturate(1.7) blur(24px)}+ backdrop-filter:saturate(1.7) blur(24px)}.settingsscroll{flex:1;min-height:0;overflow-y:auto;padding:0 20px 20px;scrollbar-gutter:stable both-edges;overscroll-behavior:contain}.settingshead{z-index:2;display:flex;align-items:center;justify-content:space-between;flex:none;padding:20px 20px 16px;border-bottom:1px solid var(--line-soft);background:var(--frost-panel);backdrop-filter:saturate(1.7) blur(24px)}/* 暗色命中要跟随主题机制:app 不写 data-theme,暗色来自 prefers-color-scheme;data-theme="dark" 分支给将来手动切主题留位,两条保持同值。主题覆盖放在基础规则后面——`.settingscard{` 的子串查找以首条为准。 */@@ -1055,6 +1069,7 @@ body.settings-open{overflow:hidden}.sidebarsetting{display:grid;gap:12px;padding:0}.sidebarsetting>span b,.sidebarsetting>span small{display:block}.sidebarsetting>span small{margin-top:3px;color:var(--muted);line-height:1.45}.sidebarorder{display:grid;gap:6px}.sidebarorderrow{position:relative;display:flex;align-items:center;justify-content:space-between;min-height:48px;padding:5px 6px;border:1px solid var(--line-soft);border-radius:9px;background:var(--overlay-3);cursor:grab}.sidebarorderrow:active{cursor:grabbing}.sidebarorderrow.dragging{opacity:.42}.sidebarorderrow.drop-before::before,.sidebarorderrow.drop-after::after{content:'';position:absolute;z-index:2;left:7px;right:7px;height:2px;border-radius:2px;background:var(--tungsten)}.sidebarorderrow.drop-before::before{top:-5px}.sidebarorderrow.drop-after::after{bottom:-5px}.sidebarorderrow>span{display:flex;align-items:center;gap:8px}.sidebarorderrow svg{width:18px;height:18px;stroke:currentColor;fill:none}.sidebarorderlabel{min-width:0}.sidebarorderlabel>b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sidebardrag{display:grid;place-items:center;width:24px;color:var(--muted)}.sidebardrag svg{width:20px;height:20px}.sidebarorderactions{flex:none}.sidebarorderrow button,.sidebaradd button{display:grid;place-items:center;min-width:34px;height:34px;border:0;border-radius:7px;background:transparent;color:var(--muted);cursor:pointer}.sidebarorderrow button:hover:not(:disabled),.sidebaradd button:hover:not(:disabled){background:var(--hover);color:var(--ink)}.sidebarorderrow button:disabled,.sidebaradd button:disabled{opacity:.25;cursor:default}.sidebaradd{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;margin-top:5px}.sidebaraddpicker{position:relative;min-width:0}.sidebaradd .sidebaraddfield{display:grid;grid-template-columns:auto minmax(0,1fr) auto;width:100%;height:42px;box-sizing:border-box;align-items:center;gap:9px;padding:0 11px;border:1px solid var(--line);border-radius:8px;background:#181a1d;color:#f5f7fa;text-align:left;font:inherit}.sidebaraddfield svg:last-child{color:var(--muted)}.sidebaraddmenu{position:absolute;z-index:4;left:0;right:0;bottom:calc(100% + 6px);max-height:min(312px,48vh);overflow:auto;overscroll-behavior:contain;padding:6px;border:1px solid var(--border-15);border-radius:10px;background:#181a1d;box-shadow:0 16px 44px -20px #000}.sidebaraddmenu[hidden]{display:none}.sidebaradd .sidebaraddmenu button{grid-template-columns:auto minmax(0,1fr);width:100%;height:38px;justify-content:start;gap:9px;padding:0 8px;border:0;text-align:left}.sidebaraddmenu button[aria-selected="true"]{background:var(--hover);color:var(--ink)}.sidebaradd button{grid-template-columns:auto auto;gap:6px;padding:0 11px;border:1px solid var(--line);color:var(--ink-2)}.sidebaradd svg{width:17px;height:17px;stroke:currentColor;fill:none}.sidebaradd>button{height:42px;box-sizing:border-box}@media(max-width:600px){.settingsscroll{padding:0 17px 17px}.settingshead{padding:17px 17px 14px}.settingrow{grid-template-columns:1fr;gap:9px}.settingrow select{width:100%;min-width:0}.settingrow input[type=checkbox]{justify-self:start}}+.sidebaradd .sidebaraddmenu button{justify-items:start}/* ── Toast:Geist 的非阻塞回执 ──右下角浮层,自动消失,hover 暂停计时,右上角关闭。挂在 body 直下@@ -1578,6 +1593,8 @@ body.drawer-open .edge{opacity:0;pointer-events:none} /* 展开时窄栏让位.fcheckreport>svg,.fwarn>svg{width:14px;height:14px;flex:none;margin-top:4px;stroke:var(--drop);fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}.fcheckreport>div{flex:1;min-width:0}+.fcheckreport.neutral{background:var(--overlay-5);border-color:var(--line-soft);color:var(--muted)}+.fcheckreport.neutral>svg{stroke:var(--muted)}.fcheckreport p,.fwarn p{margin:0}.fwarn>span{flex:1;min-width:0}.fcheckreport b{color:var(--ink);font-variant-numeric:tabular-nums}@@ -1589,11 +1606,11 @@ body.drawer-open .edge{opacity:0;pointer-events:none} /* 展开时窄栏让位.sbadge i{width:6px;height:6px;border-radius:50%;background:var(--muted);flex:none}.sbadge.ok i{background:var(--success)}.sbadge.error i{background:var(--drop)}-.fwarn .wclose{flex:none;width:24px;height:24px;margin-left:auto;padding:0;border:0;+.fwarn .wclose,.fcheckreport .wclose{flex:none;width:24px;height:24px;margin-left:auto;padding:0;border:0;border-radius:var(--control-radius);background:transparent;color:var(--muted);display:grid;place-items:center;cursor:pointer}-.fwarn .wclose:hover{background:var(--hover);color:var(--ink)}-.fwarn .wclose svg{width:13px;height:13px;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round}+.fwarn .wclose:hover,.fcheckreport .wclose:hover{background:var(--hover);color:var(--ink)}+.fwarn .wclose svg,.fcheckreport .wclose svg{width:13px;height:13px;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round}/* 批量动作是 2292 条级别的操作,不是行内文字链接:按钮的边界让「这会改状态」在点击前就看得见,也和本页其他 .fbtn(检查全部/去看更新)同一套语言。 */.fbulk{display:inline-flex;gap:8px;margin-left:auto}@@ -1626,10 +1643,13 @@ body.drawer-open .edge{opacity:0;pointer-events:none} /* 展开时窄栏让位.fbtn.fquiet:hover{border-color:var(--drop);color:var(--drop)}.fbtn svg{width:14px;height:14px;stroke:currentColor;fill:none;stroke-width:1.8}-.faddform{display:grid;grid-template-columns:minmax(0,1fr) 38px auto;gap:8px;align-items:start}-.faddform textarea{flex:1 1 auto;min-width:0;height:38px;min-height:38px;max-height:220px;+.faddform{display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:8px;align-items:start}+.fsearchinput{position:relative;min-width:0}.fsearchprefix{position:absolute;z-index:1;left:12px;top:11px;+ display:grid;place-items:center;width:16px;height:16px;color:var(--muted);pointer-events:none}+.fsearchprefix>svg{width:16px;height:16px;stroke:currentColor;fill:none}+.faddform textarea{width:100%;flex:1 1 auto;min-width:0;height:38px;min-height:38px;max-height:220px;box-sizing:border-box;border:1px solid var(--border-15);border-radius:6px;- background:var(--ground);color:var(--ink);padding:5px 12px;font-size:var(--fs-md);font-family:inherit;+ background:var(--ground);color:var(--ink);padding:5px 12px 5px 38px;font-size:var(--fs-md);font-family:inherit;line-height:20px;resize:none;overflow-y:auto;overflow-x:hidden;transition:border-color .12s ease}.faddform .fbtn{height:38px;min-height:38px}.faddform textarea::placeholder{color:var(--muted)}@@ -1766,8 +1786,8 @@ details.fcred{display:block}.fsecfoot{margin:14px -13px -14px;padding:12px 13px}.fdetails{margin-inline:-13px}.fdetails summary,.fdetails p{padding-inline:13px}- .faddform{grid-template-columns:38px minmax(0,1fr)}- .faddform>textarea{grid-column:1/-1}+ .faddform{grid-template-columns:minmax(0,1fr) auto}+ .faddform>.fsearchinput{grid-column:1/-1}.faddform>.fbtn.primary{width:100%}.frow{gap:8px}.fsources{grid-template-columns:1fr}@@ -1782,8 +1802,8 @@ details.fcred{display:block}.fpicks .fsechead h3{font-size:var(--fs-md)}.fpickhead{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:10px}.fpickhead h3{margin:0;font-size:var(--fs-md)}-.fsrcfilter{position:relative;display:inline-flex;width:38px}-.faddform .fsrcfilter .fbtn{width:38px;height:38px;min-height:38px;padding:0}+.fsrcfilter{position:relative;display:inline-flex;min-width:0}+.faddform .fsrcfilter .fbtn{width:auto;height:38px;min-height:38px;padding:0 11px}.fsrcmenu{position:fixed;z-index:var(--layer-popover);width:min(250px,calc(100vw - 16px));max-height:calc(100dvh - 16px);padding:6px;border:1px solid var(--border-15);border-radius:12px;background:var(--surface);box-shadow:0 12px 40px #0006;@@ -1815,21 +1835,22 @@ details.fcred{display:block}.fpicksearch span{min-width:0;overflow-wrap:anywhere;color:var(--tungsten)}.fpicksearch i{grid-column:1/-1;font-style:normal;color:var(--muted)}.fpickfail{color:var(--drop)!important}-.fpickactions{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-top:10px}+.fpickactions{display:flex;gap:8px;align-items:center;flex-wrap:nowrap;min-width:0;margin-top:10px}.fpickactions button{border:1px solid var(--border-15);border-radius:8px;background:transparent;color:var(--ink-2);padding:6px 14px;font-size:var(--fs-xs);cursor:pointer}.fpickactions [data-pick-add]{background:var(--tungsten);border-color:var(--tungsten);color:#fff;font-weight:600}.fpickactions button:disabled{opacity:.6;cursor:default}-.fpickactions [data-pick-state]{font-size:var(--fs-xs);color:var(--muted)}+.fpickactions [data-pick-state]{display:flex;align-items:center;min-width:0;overflow:hidden;+ white-space:nowrap;text-overflow:ellipsis;font-size:var(--fs-xs);color:var(--muted)}/* 关注页底部的「往回抓」。放在列表末尾而不是顶部:它的语义是「这些之外还有更早的」,顶部会让人以为是刷新。 */-.folderfoot{display:flex;align-items:center;gap:12px;margin:18px 0 0;+.folderfoot{display:flex;align-items:center;gap:12px;min-width:0;white-space:nowrap;margin:18px 0 0;padding-top:14px;border-top:1px solid var(--line-soft)}/* 「加载更多」和「抓更早的一页」是两件事:前者翻本地已有的条目,后者去站点上要更早的。版式共用一套,语义不同不合并。 */.followmore{display:flex;align-items:center;gap:12px;margin:18px 0 0;padding-top:14px;border-top:1px solid var(--line-soft)}-.folderfoot .fmeta{margin-left:0}+.folderfoot .fmeta{min-width:0;margin-left:0;overflow:hidden;text-overflow:ellipsis}/* 资源标识统一由 MiddleTruncate 计算可见文本。星号让本规则与「类 + 元素」的末尾省略选择器同权重,并凭源码顺序覆盖,避免两套省略同时生效。 */diff --git a/web/app.js b/web/app.jsindex 36bd50e2f..41b18fce3 100644--- a/web/app.js+++ b/web/app.js@@ -21,7 +21,10 @@ import {LOC,} from './js/core.js';import { initMiddleTruncate } from './js/middle-truncate.js';-import { emptyStateHtml, noteHtml, progressHtml, scrollerHtml, wireScrollers } from './js/ui-components.js';+import {+ emptyStateHtml, loadingDotsHtml, noteHtml, progressHtml, scrollerHtml,+ spinnerHtml, wireScrollers,+} from './js/ui-components.js';initMiddleTruncate(document);@@ -109,16 +112,27 @@ function syncSettingsPanel(){renderSidebarOrderSetting();loadFollowScheduleSetting();}-let settingsReturnFocus=null;+let settingsReturnFocus=null,settingsTransition=0;function openSettings(open=true){const panel=$('#settingsPanel');if(open){- settingsReturnFocus=document.activeElement;panel.hidden=false;document.body.classList.add('settings-open');syncSettingsPanel();+ settingsTransition++;panel.classList.remove('closing');+ settingsReturnFocus=settingsReturnFocus||document.activeElement;panel.hidden=false;document.body.classList.add('settings-open');syncSettingsPanel();queueMicrotask(()=>$('#settingsClose').focus());return}- panel.hidden=true;document.body.classList.remove('settings-open');- if(settingsReturnFocus&&document.contains(settingsReturnFocus))settingsReturnFocus.focus();- settingsReturnFocus=null;+ if(panel.hidden||panel.classList.contains('closing'))return;+ const transition=++settingsTransition;panel.classList.add('closing');+ const finish=()=>{+ if(transition!==settingsTransition||!panel.classList.contains('closing'))return;+ panel.hidden=true;panel.classList.remove('closing');document.body.classList.remove('settings-open');+ if(settingsReturnFocus&&document.contains(settingsReturnFocus))settingsReturnFocus.focus();+ settingsReturnFocus=null;+ };+ if(matchMedia('(prefers-reduced-motion: reduce)').matches)queueMicrotask(finish);+ else{+ panel.querySelector('.settingscard')?.addEventListener('animationend',finish,{once:true});+ setTimeout(finish,380);+ }}$('#settingsBtn').onclick=()=>openSettings(true);$('#settingsClose').onclick=()=>openSettings(false);$('#settingsPanel').onclick=e=>{if(e.target===$('#settingsPanel'))openSettings(false)};@@ -148,7 +162,7 @@ const followScheduleCopy=status=>{};async function loadFollowScheduleSetting(){const select=$('#followScheduleSetting'),state=$('#followScheduleState'),request=++followScheduleRequest;- select.disabled=true;+ select.disabled=true;state.innerHTML=loadingDotsHtml('正在读取状态');try{const status=await api('/api/follow/schedule');if(request!==followScheduleRequest)return;select.value=status.enabled?String(status.interval_minutes):'0';@@ -156,7 +170,8 @@ async function loadFollowScheduleSetting(){}catch(error){if(request===followScheduleRequest)state.textContent=`状态未取得:${error.message||error}`}}$('#followScheduleSetting').onchange=async e=>{- const minutes=+e.target.value,state=$('#followScheduleState');e.target.disabled=true;state.textContent='正在保存…';+ const minutes=+e.target.value,state=$('#followScheduleState');e.target.disabled=true;+ state.innerHTML=`${spinnerHtml('保存中')}<span>正在保存…</span>`;try{const status=await api('/api/follow/schedule',{method:'POST',body:JSON.stringify({enabled:minutes>0,interval_minutes:minutes||60})});state.textContent=followScheduleCopy(status);@@ -1096,8 +1111,7 @@ async function wireResourceSync(){const active=()=>location.pathname==='/stats'&&!$('#stats').hidden&&document.body.contains(result);const setBusy=(busy,done=false)=>{scan.disabled=busy;scan.setAttribute('aria-busy',String(busy));- scan.classList.toggle('busy',busy);- scan.innerHTML=`${icon('refresh-cw')}<span>${busy?'扫描中':done?'重新扫描':'扫描差异'}</span>`;+ scan.innerHTML=`${busy?spinnerHtml('扫描中'):icon('refresh-cw')}<span>${busy?'扫描中':done?'重新扫描':'扫描差异'}</span>`;};const render=payload=>{const sources=payload.sources||[];@@ -1114,24 +1128,24 @@ async function wireResourceSync(){$('#resourceApply')?.addEventListener('click',async event=>{const button=event.currentTarget;if(!confirm(`把 ${payload.missing||0} 项移入回收站,并清理 ${cache.files||0} 个可重建缓存?`))return;- button.disabled=true;button.classList.add('busy');- button.innerHTML=`${icon('refresh-cw')}<span>正在重新核对并应用…</span>`;+ button.disabled=true;button.setAttribute('aria-busy','true');+ 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||''})});result.innerHTML=`<p class="resourcesyncok">已把 ${applied.moved_to_trash.toLocaleString()} 项移入回收站,清理 ${applied.cache_removed.toLocaleString()} 个缓存,释放 ${fmtSize(applied.bytes_reclaimed||0)}。</p>`;}catch(error){- button.disabled=false;button.classList.remove('busy');+ button.disabled=false;button.removeAttribute('aria-busy');button.innerHTML=`${icon('refresh-cw')}<span>重试同步</span>`;result.insertAdjacentHTML('beforeend',noteHtml(error.message,{variant:'error',label:'同步失败'}))}});};const followScan=async payload=>{- setBusy(true);result.innerHTML='<p class="resourcescanning">正在后台核对网盘元数据,不会读取视频内容。</p>';+ setBusy(true);result.innerHTML=`<p class="resourcescanning">${loadingDotsHtml('正在后台核对网盘元数据,不会读取视频内容。')}</p>`;try{if(!payload)payload=await api('/api/resource-sync/scan',{method:'POST',body:JSON.stringify({background:true,restart:true})});while(payload.status==='running'){const done=payload.sources||[];- result.innerHTML=`<p class="resourcescanning">后台扫描中:已完成 ${payload.completed_sources||0} / ${payload.total_sources||3} 个来源${done.length?`(${done.map(source=>esc(LOC[source.location]||source.location)).join('、')})`:''}。离开本页不会中断。</p>`;+ result.innerHTML=`<p class="resourcescanning">${loadingDotsHtml(`后台扫描中:已完成 ${payload.completed_sources||0} / ${payload.total_sources||3} 个来源${done.length?`(${done.map(source=>LOC[source.location]||source.location).join('、')})`:''}。离开本页不会中断。`)}</p>`;await new Promise(resolve=>setTimeout(resolve,2000));if(!active())return;payload=await api('/api/resource-sync/scan',{method:'POST',body:JSON.stringify({background:true})});@@ -1226,11 +1240,14 @@ function renderTaste(d){root.querySelector('[data-taste-window]').value=d.window||tasteWindow;root.querySelector('[data-taste-window]').onchange=e=>{tasteWindow=e.target.value;openTaste(false)};root.querySelector('[data-taste-refresh]').onclick=async e=>{const button=e.currentTarget;- button.disabled=true;button.classList.add('busy');- stateEl.textContent='正在读取 Peach 所在主机的浏览器…';+ const oldButton=button.innerHTML;+ button.disabled=true;button.setAttribute('aria-busy','true');+ button.innerHTML=`${spinnerHtml('正在读取')}<span>读取中…</span>`;+ stateEl.innerHTML=loadingDotsHtml('正在读取 Peach 所在主机的浏览器…');try{const result=await api('/api/taste/refresh',{method:'POST',body:JSON.stringify({window:tasteWindow})});tasteCache.set(tasteWindow,result.dashboard);renderTaste(result.dashboard)}- catch(error){stateEl.textContent=error.message||'读取失败';button.disabled=false;button.classList.remove('busy')}};+ catch(error){stateEl.textContent=error.message||'读取失败';button.disabled=false;+ button.removeAttribute('aria-busy');button.innerHTML=oldButton}};root.querySelector('[data-taste-import]').onclick=()=>file.click();file.onchange=async()=>{const selected=file.files[0];if(!selected)return;stateEl.textContent=`正在导入 ${selected.name}…`;try{const response=await fetch('/api/taste/import',{method:'POST',headers:{'Content-Type':'application/octet-stream','X-Peach-Filename':encodeURIComponent(selected.name)},body:selected});@@ -1363,7 +1380,7 @@ async function openDuplicates(push=true){buildManageBar();$('#stats').hidden=false;$('#index').hidden=true;$('#grid').innerHTML='';$('#count').textContent='';$('#loadSentinel').hidden=true;$('#shortsSec').hidden=true;- $('#stats').innerHTML='<div class="review"><p class="empty">正在比对…</p></div>';+ $('#stats').innerHTML=`<div class="review"><p class="empty">${loadingDotsHtml('正在比对')}</p></div>`;const next=await api('/api/duplicates?limit=120');if(!surfaceCurrent(surface))return;dupData=next;@@ -1577,7 +1594,7 @@ async function openQualityGoals(push=true){const surface=claimSurface('/quality-goals');buildManageBar();$('#stats').hidden=false;$('#index').hidden=true;$('#grid').innerHTML='';$('#count').textContent='';$('#loadSentinel').hidden=true;$('#shortsSec').hidden=true;- $('#stats').innerHTML='<div class="review"><p class="empty">正在读取…</p></div>';+ $('#stats').innerHTML=`<div class="review"><p class="empty">${loadingDotsHtml('正在读取')}</p></div>`;const next=await api('/api/quality-goals?limit=200');if(!surfaceCurrent(surface))return;qualityData=next;@@ -1634,7 +1651,9 @@ function mergeFollowGroups(existing,incoming){}async function loadMoreFollow(button){if(!followData||followBusy)return;- followBusy=true;if(button)button.classList.add('busy');+ followBusy=true;+ const oldButton=button?.innerHTML;+ if(button){button.setAttribute('aria-busy','true');button.innerHTML=`${spinnerHtml('加载更多')}<span>加载中…</span>`}try{const next=await api(followPageUrl((followData.offset||0)+FOLLOW_PAGE));followData={...next,@@ -1642,7 +1661,7 @@ async function loadMoreFollow(button){// counts 一直是全库口径,用新的那份即可;offset/has_more 跟着最新一页走。sources:next.sources||followData.sources};renderFollow();- }finally{followBusy=false;if(button)button.classList.remove('busy')}+ }finally{followBusy=false;if(button){button.removeAttribute('aria-busy');button.innerHTML=oldButton}}}let followCredentialProviders=new Set();/* 上一次检查的结果。检查完页面会整页重画,如果不把结果留在这里,用户看到的就只是@@ -1993,7 +2012,9 @@ function followCheckBits(report){function followCheckToast(report){const {rows,bits}=followCheckBits(report);const failed=rows.filter(r=>!r.ok).length;+ const exhausted=rows.filter(r=>r.exhausted).length;toast(`检查了 <b>${rows.length}</b> 个来源:${bits.join(' · ')}`++ (exhausted?` · <b>${exhausted} 个没有更多内容</b>`:'')+(failed?` · <b>${failed} 个失败</b>`:''),{warn:!!failed,timeout:failed?8000:6000,action:{label:'去看更新',run:()=>openFollow()}});@@ -2004,15 +2025,23 @@ function followCheckToast(report){function followCheckFailNote(report){const rows=report.results||[];const failed=rows.filter(r=>!r.ok);+ const exhausted=rows.filter(r=>r.exhausted);const evidence=rows.filter(r=>r.evidence_error);- if(!failed.length&&!evidence.length)return '';- return `<div class="geist-note geist-note-error fcheckreport" role="alert">${icon('alert')}<div>- <p><b>${failed.length} 个来源检查失败</b></p>+ if(!failed.length&&!evidence.length&&!exhausted.length)return '';+ const dismiss=`<button type="button" class="wclose" data-follow-report-dismiss+ aria-label="关闭检查结果">${icon('x')}</button>`;+ const ended=exhausted.length?`<div class="geist-note geist-note-secondary fcheckreport neutral" role="note">+ ${icon('info')}<div><p><b>${exhausted.length} 个来源没有更多内容</b></p>+ ${exhausted.map(row=>`<p class="fchecknote">${esc([row.provider_label||row.provider,row.ref]+ .filter(Boolean).join(' '))}:没有更多历史内容</p>`).join('')}</div>${dismiss}</div>`:'';+ const errors=failed.length||evidence.length?`<div class="geist-note geist-note-error fcheckreport" role="alert">${icon('alert')}<div>+ ${failed.length?`<p><b>${failed.length} 个来源检查失败</b></p>`:''}${failed.map(row=>`<p class="fcheckfail">${esc([row.provider_label||row.provider,row.ref].filter(Boolean).join(' '))}${row.provider?':':''}${esc(row.error||'未说明原因')}</p>`).join('')}${evidence.length?`<p class="fchecknote">候选已入库,但这一次的原始响应没有留档:${esc(evidence[0].evidence_error)}</p>`:''}- </div></div>`;+ </div>${dismiss}</div>`:'';+ return `<div class="fcheckreports">${ended}${errors}</div>`;}/* ── 看的那一页 ── */@@ -2155,8 +2184,8 @@ function wireFollowOlder(){if(!button)return;button.onclick=async()=>{if(followBusy)return;- followBusy=true;button.disabled=true;button.classList.add('busy');- button.innerHTML=`${icon('refresh-cw')}<span>抓取中…</span>`;+ followBusy=true;button.setAttribute('aria-busy','true');+ button.innerHTML=loadingDotsHtml('抓取中…');try{followCheckReport=await api('/api/follow/check',{method:'POST',body:JSON.stringify({older:true})});@@ -2166,7 +2195,7 @@ function wireFollowOlder(){followCheckReport={results:[{ok:false,error:error.message}]};followCheckToast(followCheckReport);await openFollow(false);- }finally{followBusy=false}+ }finally{followBusy=false;button.removeAttribute('aria-busy')}};}@@ -2181,7 +2210,7 @@ async function openFollow(push=true,renderForDetail=false){$('#count').textContent='';$('#loadSentinel').hidden=true;$('#shortsSec').hidden=true;$('#tiers').style.display='none';$('#tagbar').style.display='none';$('#managebar').hidden=true;$('#manageTitle').hidden=true;buildEdge();- $('#stats').innerHTML='<div class="follow"><p class="empty">正在读取…</p></div>';+ $('#stats').innerHTML=`<div class="follow"><p class="empty">${loadingDotsHtml('正在读取')}</p></div>`;const [data,credentials]=await Promise.all([api(followPageUrl(0)),api('/api/follow/credentials').catch(()=>({providers:[]})),@@ -2301,6 +2330,7 @@ function followSourceRow(source){/* 状态用 Geist 的低饱和徽章(取证 vercel-geist-semantics-measured.md):行级状态不上实底彩色,ok 绿 tint、失败红 tint、未检查灰。 */const badge=state==='ok'?'ok':bad?'error':'none';+ const stateTitle=source.history_exhausted?'没有更多历史内容':state;return `<div class="frow fsource${bad?' bad':''}${source.enabled?'':' disabled'}"><label class="fchannelcheck" title="${source.enabled?'参与检查更新':'暂停检查更新'}"><input type="checkbox" data-follow-enabled="${source.id}" ${source.enabled?'checked':''}@@ -2311,7 +2341,8 @@ function followSourceRow(source){rel="noreferrer noopener" title="打开原来源">${esc(source.label)}</a></b><span class="fmeta fprovider">${sourceIcon(source.provider)}${esc(source.provider_label)}</span><span class="fmeta fchecked">${esc(source.last_checked_at?localTime(source.last_checked_at):'未检查')}</span>- <span class="sbadge ${badge}" title="${esc(state)}"><i aria-hidden="true"></i></span>+ <span class="sbadge ${badge}" title="${esc(stateTitle)}"><i aria-hidden="true"></i>+ ${source.history_exhausted?'<span>没有更多</span>':''}</span><span class="fsourceactions"><button class="frowicon" data-follow-check="${source.id}" title="检查更新"${source.enabled?'':'disabled'}@@ -2414,8 +2445,10 @@ function renderFollowManage(credentials){<section class="fsec"><div class="fsechead"><h3>添加关注</h3></div><form class="faddform" id="followAdd">- <textarea name="lines" rows="1" required spellcheck="false"- aria-label="来源链接、名字或 id"></textarea>+ <div class="fsearchinput" data-follow-search-input>+ <span class="fsearchprefix" data-follow-search-prefix>${icon('search')}</span>+ <textarea name="lines" rows="1" required spellcheck="false"+ aria-label="来源链接、名字或 id"></textarea></div><div class="fsrcfilter" id="followSrcFilter"></div><button class="fbtn primary" type="submit">查找</button></form>@@ -2475,7 +2508,7 @@ async function openFollowManage(push=true){buildManageBar();$('#stats').hidden=false;$('#index').hidden=true;$('#grid').innerHTML='';$('#count').textContent='';$('#loadSentinel').hidden=true;$('#shortsSec').hidden=true;- $('#stats').innerHTML='<div class="follow"><p class="empty">正在读取…</p></div>';+ $('#stats').innerHTML=`<div class="follow"><p class="empty">${loadingDotsHtml('正在读取')}</p></div>`;const [data,credentials,runtime]=await Promise.all([api('/api/follow?limit=1'),api('/api/follow/credentials'),api('/healthz')]);if(!surfaceCurrent(surface))return;@@ -2599,17 +2632,18 @@ function wireFollowManage(){}if(form)form.onsubmit=async event=>{event.preventDefault();+ if(form.dataset.busy==='true')return;/* 状态提示在表单外面的说明行里,不能在 form 里找——找不到就是 null,第一次赋值直接抛 TypeError,整个提交静默失败。 */const state=root.querySelector('[data-follow-add-state]');- const button=form.querySelector('button');+ const button=form.querySelector('button[type="submit"]');+ const prefix=form.querySelector('[data-follow-search-prefix]');const lines=String(new FormData(form).get('lines')||'').split('\n').map(line=>line.trim()).filter(Boolean);if(!lines.length)return;const byName=lines.some(line=>!line.includes('/'));- button.disabled=true;button.classList.add('busy');- const oldButton=button.innerHTML;- button.innerHTML=`${icon('refresh-cw')}<span>查找中</span>`;+ form.dataset.busy='true';button.setAttribute('aria-busy','true');+ if(prefix)prefix.innerHTML=spinnerHtml('查找中');// 索引下载的提醒只在真按名字查时出现;常驻成一句说明就是噪音。state.textContent=byName?'查找中…(首次按名字查要下载创作者索引,可能几十秒)':'识别中…';try{@@ -2618,7 +2652,8 @@ function wireFollowManage(){state.textContent='';if(box){box.value='';box.style.height='auto'}renderFollowPicks(result.results||[]);}catch(error){state.textContent=error.message||'查找失败'}- finally{button.disabled=false;button.classList.remove('busy');button.innerHTML=oldButton}+ finally{form.dataset.busy='false';button.removeAttribute('aria-busy');+ if(prefix)prefix.innerHTML=icon('search')}};root.querySelectorAll('[data-follow-remove]').forEach(button=>button.onclick=async()=>{if(!confirm('不再追这个来源?已经抓到的条目会一并移除,媒体本身不受影响。'))return;@@ -2641,8 +2676,10 @@ function wireFollowManage(){if(followBusy)return;followBusy=true;const oldTitle=button.title;const oldAria=button.getAttribute('aria-label');- button.disabled=true;button.classList.add('busy');button.title='检查中…';+ const oldButton=button.innerHTML;+ button.setAttribute('aria-busy','true');button.title='检查中…';button.setAttribute('aria-label','检查中…');+ button.innerHTML=`${spinnerHtml('检查中')}${button.matches('.frowicon')?'':'<span>检查中…</span>'}`;try{const id=button.dataset.followCheck;const result=await api('/api/follow/check',{method:'POST',@@ -2658,11 +2695,11 @@ function wireFollowManage(){followCheckReport={results:[{ok:false,error:e.message}]};followCheckToast(followCheckReport);const note=followCheckFailNote(followCheckReport);- const box=$('#stats').querySelector('.fcheckreport');- if(box)box.outerHTML=note;+ const box=$('#stats').querySelector('.fcheckreports');+ if(box)box.outerHTML=note;else $('#stats').querySelector('.fsec')?.insertAdjacentHTML('afterbegin',note);}- finally{followBusy=false;button.disabled=false;button.classList.remove('busy');+ finally{followBusy=false;button.removeAttribute('aria-busy');button.innerHTML=oldButton;button.title=oldTitle;if(oldAria===null)button.removeAttribute('aria-label');else button.setAttribute('aria-label',oldAria)}});@@ -2742,6 +2779,8 @@ function wireFollowManage(){});root.querySelectorAll('[data-follow-view]').forEach(button=>button.onclick=()=>openFollow());+ root.querySelectorAll('[data-follow-report-dismiss]').forEach(button=>button.onclick=()=>{+ followCheckReport=null;root.querySelector('.fcheckreports')?.remove()});}/* 查找结果先摆出来由人勾选,不自动登记:发现要联网,结果也可能不止一个,@@ -2756,11 +2795,11 @@ function renderFollowSrcFilter(mount){providers.forEach(provider=>{if(!fsrcProviders.has(provider))fsrcProviders.add(provider)});if(!providers.length){mount.innerHTML='';return}const label=()=>{const n=providers.filter(p=>!fsrcUnchecked.has(p)).length;- return n===providers.length?'来源:全部':`来源:${n}/${providers.length}`};+ return n===providers.length?'全部来源':`${n}/${providers.length} 个来源`};mount.innerHTML=`<button type="button" class="fbtn" data-srcfilter-togglearia-expanded="false" aria-haspopup="menu" aria-controls="follow-source-menu"aria-label="${esc(label())}" title="${esc(label())}">- ${icon('list-filter')}</button>+ ${icon('list-filter')}<span data-srcfilter-label>${esc(label())}</span></button><div class="fsrcmenu" id="follow-source-menu" role="menu" data-srcfilter-menu hidden>${providers.map(provider=>`<label><input type="checkbox" data-srcfilter="${esc(provider)}"${fsrcUnchecked.has(provider)?'':' checked'}><span>${esc(provider)}</span></label>`).join('')}</div>`;@@ -2799,6 +2838,7 @@ function renderFollowSrcFilter(mount){input.checked?fsrcUnchecked.delete(input.dataset.srcfilter):fsrcUnchecked.add(input.dataset.srcfilter);toggle.setAttribute('aria-label',label());toggle.title=label();+ toggle.querySelector('[data-srcfilter-label]').textContent=label();document.querySelectorAll('.fpickitem').forEach(item=>{item.hidden=fsrcUnchecked.has(item.dataset.provider||'')})});}@@ -2851,10 +2891,11 @@ function renderFollowPicks(results){return !row||!row.hidden;});if(!picked.length)return;const state=box.querySelector('[data-pick-state]');- addButton.disabled=true;+ if(addButton.getAttribute('aria-busy')==='true')return;+ addButton.setAttribute('aria-busy','true');let done=0;const failures=[];for(const input of picked){- state.textContent=`添加中… ${++done}/${picked.length}`;+ state.innerHTML=`${spinnerHtml('添加中')}<span>添加中… ${++done}/${picked.length}</span>`;try{await api('/api/follow/source',{method:'POST',body:JSON.stringify({action:'add',url:input.value,label:input.dataset.label,@@ -2866,7 +2907,7 @@ function renderFollowPicks(results){}if(failures.length){state.textContent=failures.join(';');- addButton.disabled=false;+ addButton.removeAttribute('aria-busy');return;}await openFollowManage(false);@@ -4841,9 +4882,9 @@ async function refreshAll(automatic=false){/* 没有前台定时器:页面不会在你看着的时候自己重排。换排序是加载时结算的,「后台每 N 分钟换一次」的效果由种子的时间窗实现(见 persistedSeed)。 */$('#refresh').onclick=async()=>{const b=$('#refresh');- if(b.classList.contains('busy'))return;- b.classList.add('busy');- try{await refreshAll()}finally{b.classList.remove('busy')}};+ if(b.getAttribute('aria-busy')==='true')return;+ const old=b.innerHTML;b.setAttribute('aria-busy','true');b.innerHTML=spinnerHtml('换一批');+ try{await refreshAll()}finally{b.removeAttribute('aria-busy');b.innerHTML=old}};/* ── 审查遮挡 ──共享屏幕 / 录屏 / 截图时把全站内容画面盖住。开关在设置面板(安全组),diff --git a/web/js/ui-components.js b/web/js/ui-components.jsindex 1607f4f98..621fc3bae 100644--- a/web/js/ui-components.js+++ b/web/js/ui-components.js@@ -21,6 +21,20 @@ export function progressHtml(label,value,max=100){style="--progress-value:${percent}%"><i></i></div>`;}+/** Geist Spinner: immediate feedback for a user-triggered action. */+export function spinnerHtml(label='加载中'){+ const bars=Array.from({length:10},(_,index)=>+ `<i aria-hidden="true" style="--spinner-angle:${index*36}deg;--spinner-delay:${index*100-900}ms"></i>`).join('');+ return `<span class="geist-spinner" role="status" aria-label="${esc(label)}">${bars}</span>`;+}++/** Geist Loading Dots: indeterminate work continuing in the background. */+export function loadingDotsHtml(label='正在处理', {className=''}={}){+ return `<span class="geist-loading${className?` ${esc(className)}`:''}" role="status">+ <span class="geist-loading-dots" aria-hidden="true"><i></i><i></i><i></i></span>+ <span>${esc(label)}</span></span>`;+}+/** Geist Empty State: icon tile, title and explanatory copy stay one semantic unit. */export function emptyStateHtml(iconName,title,description,{className='',actions=''}={}){return `<div class="emptystate${className?` ${esc(className)}`:''}" data-geist-empty-state role="status">