Peach: Local-first video metadata scraper and media manager.
feat(web): 完善资料页取景、加载骨架与播放偏好
longmeidaodf3fdbd79bf7
diff --git a/README.en.md b/README.en.mdindex 808244c04..e989675ea 100644--- a/README.en.md+++ b/README.en.md@@ -43,7 +43,9 @@ Follow sources include FANBOX, Patreon, SubscribeStar, Kemono, Pawchive, Coomer,## Quick start-Portraits and brand marks use their native size with a blurred background when too small for large or compact views. Display areas below 64 px retain the regular icon treatment.+Settings control whether local and followed videos play automatically when their details open.++Portraits and brand marks allow moderate enlargement in large and compact views. Very small images use their native size with a blurred background. Display areas below 64 px retain the regular icon treatment.Peach is **pre-1.0**. The application interface is currently Chinese only.diff --git a/README.md b/README.mdindex 463f42c09..ea0c71341 100644--- a/README.md+++ b/README.md@@ -41,7 +41,9 @@ CloudDrive · 115 与 CloudDrive · PikPak 按本机文件夹接入;先在 Clo关注来源包括 FANBOX、Patreon、SubscribeStar,以及 Kemono、Pawchive、Coomer、Rule34 系列与 F95zone。来源可用性受站点和使用者权限限制;采集边界与支持情况见 [来源采集](docs/SOURCING.md)。-人物头像和厂牌标识在大图、紧凑模式中按清晰度显示;小图居中,周围用同图模糊补底。小于 64 px 的展示区域保持普通图标样式。+右上角设置可控制打开本地作品和关注视频详情时是否自动播放。++人物头像和厂牌标识在大图、紧凑模式中允许适度放大;明显过小的图片居中,周围用同图模糊补底。小于 64 px 的展示区域保持普通图标样式。## 快速开始diff --git a/docs/PRODUCT_BACKLOG.md b/docs/PRODUCT_BACKLOG.mdindex fc4ca601b..956818a42 100644--- a/docs/PRODUCT_BACKLOG.md+++ b/docs/PRODUCT_BACKLOG.md@@ -94,5 +94,7 @@29. `peach-data/review/composite-names-20260904.csv` 里还剩 28 条 creator 规范名带括号,括号里是读音或罗马音(`Egami(えがみ)`、`永地(eichi)`、`猫屋(NEKOYA)`),用户定了不拆——它们不像艺名那样各自独立,是同一个名字的注音。同一份 CSV 里 575 条 tag 是角色的作品出处消歧,10 条 series 括号里是厂牌或载体消歧(拆了会把三个 `AV DEBUT` 撞成一个),都不要动。剩下真正待判的只有 performer 规范名 `Mana(23)` 一条:数字是去重后缀还是名字的一部分要看源站。30. Mac 追上 master 的一组操作,按顺序做完再重启菜单栏——做完之前不要重启:master 上的 `peach serve --host 0.0.0.0` 没有口令会拒绝启动,reader 会直接消失。① `git pull` 到 master;② `pip uninstall -y peach-app && pip install -e ".[macos]"`;③ 先把 Windows 的 `peach-data/secrets/auth-token` 复制到 Mac 数据根的同一路径——reader 取 writer 复核结果发的是自己的口令,两边必须是同一份,而 `--from-existing` 找不到文件会自己生成一份不同的;④ `peach init --from-existing --mount local=<落点>`;⑤ 重启菜单栏,核对 `/healthz`、`/review` 能读到 writer,手机与 Mac 浏览器各登录一次。第 28 条的标签改名可以放进同一个维护窗口。31. 事务所改名复核:Wish/GIRFY、LiStarPRO/GRANZPRO 缺可核验官网;LIGHT 与 ELTRA/EST 存在分流,不能整体合并;Prime Agency/GG 有歧义,Cruse Group 官网证书链未取得。原始请求与逐条结论位于顶层 `attic/reviews/20260906-portrait-agency/agency-review.csv`。只对取得证据且获用户批准的记录执行合并。+ 2026-09-06 核对 wish-promotion.jp 已是其他内容站,不能作为现官网。15 条现官网链接使用共用 Chrome UA 重查,13 条返回 200;Cruse Group 证书链与 Prime Agency TLS 连接仍未取得。+32. 封面来源头像逐条复核:78 张仍来自 `cover-fallback`,清单位于 `attic/reviews/20260906-portrait-agency/remaining-cover-avatars.csv`。封面关联单一演员不构成人脸身份核验,采集器只生成候选,不自动安装。日向真凛缓存为 SSIS-135 封面,印刷署名与别名一致,独立官方人像来源仍待补齐。32. `install_entity_links.py` 的可达性门槛按「非 200 就跳过」执行,而同文件的 `is_gone()` 明确写着 403/5xx/连接错误不能当「页面没了」。首批 703 条里 137 条因此没装,其中 31 条 twitter.com、23 条 t-powers.co.jp。把跳过分成「确证没了」和「这次没取到」两档:后者留进待复查队列,配合 `rediscover_entity_links.py` 对 t-powers/nax-pro/mines-pro 这些已经搬家的域名上溯找新锚,再装一次。33. 托盘自重建被测试记录门槛卡住:2026-09-05 22:54 托盘为 0.8.5 起的那次「同步开发进度」全量 3181 个用例全绿,`scripts/test_runner.py` 却因验证前后主检出的内容或依赖快照不一致判本次记录无效、退出码 1,托盘按测试失败处理,没有打包也没有换 EXE,并且同一 HEAD 不再重试;同一时段两次 `auto` 记录也是空的 `validated`。第二次(23:14 起,HEAD 5a4b37f8)跑到一半,协调者于 23:17:42 把 0.8.6 合进了同一个主检出,全量因此 6 个用例失败、记录再次无效;失败用例名未取得,第三次尝试一开始就把日志覆盖了。机制已确认:托盘在主检出跑全量,`integrate` 的 `integration.lock` 与全量的 `full-suite.lock` 互不排斥,任何一次集成都会改掉正在验证的树。要做三件事:集成前等主检出里正在跑的全量结束(或让两把锁互斥),并把「记录无效」和「用例失败」在退出码或输出上分开,让托盘对前者重试而不是放弃;托盘的日志只写 stderr,没有落盘,22:43 那次托盘连同两个服务一起消失的原因也因此未取得,给托盘补一份 `logs/tray.log`。现场:线上服务 0.8.5 正常,托盘 EXE 仍是 21:08 打的 0.8.1,`pyproject.toml` 与 `windows_update.py` 的改动没进 EXE。diff --git a/docs/REUSE.md b/docs/REUSE.mdindex 94d3ba212..bba7753dd 100644--- a/docs/REUSE.md+++ b/docs/REUSE.md@@ -139,7 +139,7 @@ CloudDrive 为外部应用,本项目不捆绑其二进制或依赖其管理 AP- 名字里的括号都走 `split_composite_aliases.py`:自动那拨只认罗马字复合人名,把 r18.dev 打包的 17 条拆成 37 条别名;`--from-review` 那拨按人工判定清掉 9 条不承载名字的尾巴,旧写法留作别名。备份是 2026-09-04 的两份 `ledger.pre-*.db`。剩下的读音、厂牌消歧和角色出处不拆,清单见 BACKLOG 第 29 条。- 实体链接可安装:`entity_link` 表、`q_entity` 的 `links` 契约、资料页 favicon 与管理页链接管理成套;死链区分「搬走了」和「没了」,`rediscover_entity_links.py` 从站点索引页上溯找新锚。- 事务所是实体:57 家各有 `/agencies/<名字>` 页,成员、官网、标签与作品都按 `entity_membership` 算,女优页点得进去,搜名字出这家人的片;原文留在 `metadata.agency`。-- 外链圆标与厂牌标识取站点自己声明的资产,宽扁字标不参加小圆标竞选;`/logo` 的 `variant` 分 `icon`、`logo` 与最清晰的 `large`,大图版式和资料页取 `large`,紧凑版式取 `icon`。头像与标识共用 `nativeImageFit`:源尺寸不足框八成时等比居中且不放大,四周同图模糊补底;框短边小于 64 px 不补底,70 px 紧凑圆框适用。加载、图片回落和版式切换均重新度量。+- 外链圆标与厂牌标识取站点自己声明的资产,宽扁字标不参加小圆标竞选;`/logo` 的 `variant` 分 `icon`、`logo` 与最清晰的 `large`,大图版式和资料页取 `large`,紧凑版式取 `icon`。头像与标识共用 `nativeImageFit`:按屏幕像素密度折算的源尺寸不足框四成时等比居中且不放大,四周同图模糊补底;框短边小于 64 px 不补底,70 px 紧凑圆框适用。加载、图片回落和版式切换均重新度量。- 厂牌标识由契约位 `has_logo` 决定出不出图:没装标识的厂牌一个 `<img>` 都不发,改用首字母底板,不靠 404 摘。- 关注检查分两阶段:列表阶段落 partial 行,详情补全按 provider 额度只补新行和未补齐行。- `/api/related` 用 Tag IDF 加 MMR 排序并缓存;搜索使用 FTS5 trigram,短查询回退 LIKE 并覆盖规范名、别名和检索词,搜索历史在 reader 写入被拒时降级到页面内存。@@ -240,3 +240,6 @@ Python、npm 与 GitHub Actions 的版本由 `.github/dependabot.yml` 每周检AVBase 已变为 Cloudflare 验证页,批量流程不再请求也不绕过;DUGA Web API 需代理店应用 ID,未配置前只复用成功日志的精确 URL。MDC-NG 公共仓库只证明 Amazon 日本渠道存在,后端匹配逻辑未公开,故只留POC 候选。该流程不新增依赖、不写 ledger,操作步骤见 `peach-jav-cover-workflow`。++- 对外请求的 UA 统一取 `peach.user_agent.USER_AGENT`(标准桌面 Chrome);HTTPX、来源连接器、FFmpeg 抽帧与脚本共用。复用现有 transport、限速和证书校验,无新增依赖;标准 UA 不保证站点放行。FANBOX 浏览器传输使用已安装 curl_cffi 的 Chrome 150 配置。+- 作品封面只进入头像候选,单人作品关联不证明画面中的人物身份;`cover_fallback` 显式标记身份未核实,安装闸门独立拒绝这类来源。diff --git a/frontend/src/entity-skeleton.ts b/frontend/src/entity-skeleton.tsnew file mode 100644index 000000000..c9c3f74b1--- /dev/null+++ b/frontend/src/entity-skeleton.ts@@ -0,0 +1,12 @@+/** 实体资料的等待态使用资料头、标签条和对应正文布局。 */+export function entitySkeletonHtml(kind: string, body: string) {+ const square = kind === 'studio' || kind === 'agency';+ return `<section data-skeleton="entity/${kind}" role="status" aria-label="正在读取资料">+ <span class="sr-only">正在读取资料</span><div aria-hidden="true">+ <div class="entityhero"><div class="entityportrait ${square ? 'square ' : ''}skeleton"></div>+ <div class="entityskeletontext"><div class="entitytitle"><h2 class="skeleton"> </h2></div>+ <div class="alias"><span class="skeleton"></span></div>+ <div class="entitylinks"><span class="skeleton"></span></div></div></div>+ <section class="entitytagbar"><div class="entitytags"><span class="skeleton entitymediaskeleton"></span><span class="skeleton entitymediaskeleton"></span></div></section>+ <div class="entitysection">${body}</div></div></section>`;+}diff --git a/frontend/src/islands.ts b/frontend/src/islands.tsindex 781dff506..5579dfa8c 100644--- a/frontend/src/islands.ts+++ b/frontend/src/islands.ts@@ -30,6 +30,7 @@ import type { ScrapingData, ScrapingProps } from './islands/scraping';export { refreshStore, storeNames } from './state';export { watchJob, followJobProgress } from './jobs';export { nativeImageFit } from './native-image';+export { entitySkeletonHtml } from './entity-skeleton';export { syncSidebarSurface, sidebarTagCounts, sidebarHasCatalogContent } from './sidebar';export { cleanupSkeletonHtml, cloudLocations, cloudPreferenceLocations, tasteHistoryGuideHtml, wireTasteHistoryGuide, TASTE_GUIDE_KEY } from './management';export type { StoreName } from './state';diff --git a/frontend/src/native-image.ts b/frontend/src/native-image.tsindex 1f972b0e9..99f49b8d8 100644--- a/frontend/src/native-image.ts+++ b/frontend/src/native-image.ts@@ -5,7 +5,7 @@ export function nativeImageFit(width: number, height: number, frameWidth: numberheight /= density;const valid = [width, height, frameWidth, frameHeight].every(value => Number.isFinite(value) && value > 0);const small = valid && Math.min(frameWidth, frameHeight) >= 64- && (width < frameWidth * .8 || height < frameHeight * .8);+ && (width < frameWidth * .4 || height < frameHeight * .4);const scale = valid ? Math.min(1, frameWidth / width, frameHeight / height) : 1;return { small, width: width * scale, height: height * scale };}diff --git a/frontend/test/entity-skeleton.test.ts b/frontend/test/entity-skeleton.test.tsnew file mode 100644index 000000000..e1da51908--- /dev/null+++ b/frontend/test/entity-skeleton.test.ts@@ -0,0 +1,16 @@+import { describe, expect, it } from 'vitest';+import { entitySkeletonHtml } from '../src/entity-skeleton';++describe('实体资料骨架', () => {+ it('事务所使用方形标识、资料头、标签和成员正文', () => {+ const html = entitySkeletonHtml('agency', '<div class="igrid">成员</div>');+ expect(html).toContain('data-skeleton="entity/agency"');+ expect(html).toContain('entityportrait square skeleton');+ expect(html).toContain('entityhero');+ expect(html).toContain('entitytagbar');+ expect(html).toContain('<div class="entitysection"><div class="igrid">');+ });+ it('人物资料使用圆形头像', () => {+ expect(entitySkeletonHtml('performer', '')).toContain('entityportrait skeleton');+ });+});diff --git a/frontend/test/native-image.test.ts b/frontend/test/native-image.test.tsindex 29b180228..27879cf32 100644--- a/frontend/test/native-image.test.ts+++ b/frontend/test/native-image.test.ts@@ -6,18 +6,19 @@ describe('头像和标识的小图补底', () => {expect(nativeImageFit(64, 64, 180, 240)).toEqual({ small: true, width: 64, height: 64 });});it('70 px 紧凑头像适用,32 px 图标不补底', () => {- expect(nativeImageFit(32, 32, 70, 70).small).toBe(true);+ expect(nativeImageFit(16, 16, 70, 70).small).toBe(true);expect(nativeImageFit(16, 16, 32, 32).small).toBe(false);});it('宽字标保持比例且不超出容器', () => {expect(nativeImageFit(400, 40, 180, 180)).toEqual({ small: true, width: 180, height: 18 });});- it('高像素密度屏幕上的 64 px 方标在紧凑模式按 32 CSS px 显示', () => {- expect(nativeImageFit(64, 64, 70, 70, 2)).toEqual({ small: true, width: 32, height: 32 });+ it('高像素密度屏幕上的 64 px 方标允许在紧凑模式放大', () => {+ expect(nativeImageFit(64, 64, 70, 70, 2)).toEqual({ small: false, width: 32, height: 32 });expect(nativeImageFit(64, 64, 32, 32, 2).small).toBe(false);});it('清晰图片和只需轻微放大的图片铺满', () => {expect(nativeImageFit(300, 400, 180, 240).small).toBe(false);+ expect(nativeImageFit(350, 350, 369, 369, 2).small).toBe(false);expect(nativeImageFit(150, 200, 180, 240).small).toBe(false);expect(nativeImageFit(0, 0, 180, 240).small).toBe(false);});diff --git a/scripts/check_reference_updates.py b/scripts/check_reference_updates.pyindex 5070f5af4..fe3d20367 100644--- a/scripts/check_reference_updates.py+++ b/scripts/check_reference_updates.py@@ -16,6 +16,8 @@ from typing import CallableROOT = Path(__file__).resolve().parents[1]+sys.path.insert(0, str(ROOT / 'src'))+from peach.user_agent import USER_AGENTDEFAULT_REGISTRY = ROOT / "docs" / "reference-sources.json"@@ -32,7 +34,7 @@ def fetch_bytes(url: str, *, timeout: float = 20.0) -> bytes:url,headers={"Accept": "text/markdown,text/plain;q=0.9,*/*;q=0.1",- "User-Agent": "Peach-reference-update-check/1",+ "User-Agent": USER_AGENT,},)with urllib.request.urlopen(request, timeout=timeout) as response:diff --git a/scripts/harvest_social_avatars.py b/scripts/harvest_social_avatars.pyindex f6cf7c41c..848074b29 100644--- a/scripts/harvest_social_avatars.py+++ b/scripts/harvest_social_avatars.py@@ -592,6 +592,7 @@ def cover_fallback(connection, record: dict, cache: AvatarCandidateCache,height=inspected.height, mime_type=inspected.mime_type,sha256=inspected.sha256, object_path=stored,matched=record['canonical'], name_source='ledger-performer',+ identity_verified=False,evidence=f'单人作品 {code} 完整封面'))if not candidates:return None@@ -928,7 +929,7 @@ def run(args) -> int:cache = caches[PROVIDER_CACHES[candidate["provider"]]]provenance_path = cache.store_provenance(provenance_for(cache, entity_id, candidate))- identity_ok = candidate.get("identity_verified", True) and bool(+ identity_ok = candidate.get("source_kind") != 'single_performer_cover' and candidate.get("identity_verified", True) and bool(candidate.get("matched"))is_winner = candidate is winnernote = ""diff --git a/scripts/harvest_studio_icons.py b/scripts/harvest_studio_icons.pyindex ca527c37d..befbd00fa 100644--- a/scripts/harvest_studio_icons.py+++ b/scripts/harvest_studio_icons.py@@ -89,8 +89,7 @@ FIELDS = ("entity_id", "studio", "safe", "variant", "installed", "original_size""candidate", "evidence")#: 和 `/link-mark` 用同一个 UA:站点按它决定给不给图标,两处不一致会取到不同的东西。-USER_AGENT = ("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"- " (KHTML, like Gecko) Chrome/126.0 Safari/537.36")+from peach.user_agent import USER_AGENTOK, WORDMARK, TOOSMALL = "ok", "仍是字标", "只有小图标"MISSING, SKIP = "未取得", "无官网链接"diff --git a/src/peach/follow_avatar.py b/src/peach/follow_avatar.pyindex 924b9d6bc..475ac9e69 100644--- a/src/peach/follow_avatar.py+++ b/src/peach/follow_avatar.py@@ -1,5 +1,6 @@"""Resolve creator avatars from verified official profile endpoints."""from __future__ import annotations+from .user_agent import USER_AGENTimport jsonimport re@@ -41,7 +42,7 @@ def resolve_official_profile(service: str, user_id: str, *,profile_url = f"https://www.pixiv.net/fanbox/creator/{user_id}"page = request(HttpRequest("GET", profile_url, {- "Accept": "text/html", "User-Agent": "Peach/0.2",+ "Accept": "text/html", "User-Agent": USER_AGENT,}),15.0,MAX_PROFILE_BYTES,@@ -68,7 +69,7 @@ def resolve_official_profile(service: str, user_id: str, *,response = request(HttpRequest("GET", api_url, {"Accept": "application/json", "Origin": creator_origin,- "Referer": creator_origin + "/", "User-Agent": "Peach/0.2",+ "Referer": creator_origin + "/", "User-Agent": USER_AGENT,}),15.0,MAX_PROFILE_BYTES,diff --git a/src/peach/follow_covers.py b/src/peach/follow_covers.pyindex d8361e2d0..109bc74e9 100644--- a/src/peach/follow_covers.py+++ b/src/peach/follow_covers.py@@ -5,6 +5,7 @@ The card therefore extracts the first non-black decodable frame once and servescached JPEG."""from __future__ import annotations+from .user_agent import USER_AGENTimport hashlibimport os@@ -89,7 +90,7 @@ class FollowCoverService:f"{destination.stem}.{os.getpid()}.{threading.get_ident()}.tmp.jpg")command = [str(choice.path), "-y", "-v", "error",- "-rw_timeout", "15000000", "-user_agent", "Peach follow cover",+ "-rw_timeout", "15000000", "-user_agent", USER_AGENT,]if target.referer:command.extend(("-referer", target.referer))diff --git a/src/peach/follow_gofile.py b/src/peach/follow_gofile.pyindex 504a180b8..c468ddbd4 100644--- a/src/peach/follow_gofile.py+++ b/src/peach/follow_gofile.py@@ -28,7 +28,7 @@ from .http import HttpRequest, HttpResponse, HttpTransport#: 请求 Gofile 用的固定 UA。刻意不复用连接器的 `_headers()`——那里面可能有来源站#: 的 Cookie,而这里是另一个主机。-USER_AGENT = "Peach/0.2 (+local self-hosted follow reader)"+from .user_agent import USER_AGENT_FOLDER_PATH = re.compile(r"/d/([A-Za-z0-9_-]+)")_LABELED_FOLDER = re.compile(diff --git a/src/peach/follow_sources.py b/src/peach/follow_sources.pyindex 3b96d194b..7b502dc7d 100644--- a/src/peach/follow_sources.py+++ b/src/peach/follow_sources.py@@ -31,7 +31,7 @@ from .http import CurlCffiTransport, HttpRequest, HttpResponse, HttpTransport, H#: 默认连接器共用的 UA。只有 ADR-0019 明确登记的 FANBOX 详情传输例外。-USER_AGENT = "Peach/0.2 (+local self-hosted follow reader)"+from .user_agent import USER_AGENT#: 单次抓取的条目上限。追更只关心增量,不做全站归档。DEFAULT_MAX_ITEMS = 100@@ -1902,7 +1902,7 @@ class FanboxConnector(_BaseConnector):def profile_handle(cls, ref: str) -> str:return str(ref or "").strip()- _IMPERSONATION = "firefox147"+ _IMPERSONATION = "chrome150"def __init__(self, *, detail_transport: HttpTransport | None = None, **kwargs):injected_transport = kwargs.get("transport")@@ -1920,10 +1920,7 @@ class FanboxConnector(_BaseConnector):"Accept": "application/json","Origin": "https://www.fanbox.cc","Referer": "https://www.fanbox.cc/",- "User-Agent": (- "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:147.0) "- "Gecko/20100101 Firefox/147.0"- ),+ "User-Agent": USER_AGENT,})if self.credential and self.credential.values.get("cookie"):headers["Cookie"] = self.credential.values["cookie"]diff --git a/src/peach/follow_stream.py b/src/peach/follow_stream.pyindex 0abd3d820..f3ece32e2 100644--- a/src/peach/follow_stream.py+++ b/src/peach/follow_stream.py@@ -238,7 +238,7 @@ def proxy_request_headers(target: ResolvedFollowMedia,incoming: Mapping[str, str]) -> dict[str, str]:"""代理请求要带的头。只透传范围请求相关的那两个,别的一律由这里决定。"""headers = {- "User-Agent": "Peach/0.2",+ "User-Agent": USER_AGENT,"Accept": incoming.get("accept") or "*/*","Accept-Encoding": "identity",}diff --git a/src/peach/http.py b/src/peach/http.pyindex c55198d40..4d29baade 100644--- a/src/peach/http.py+++ b/src/peach/http.py@@ -1,5 +1,6 @@"""共享 HTTP transport:连接池、超时、有界读取与可注入测试边界。"""from __future__ import annotations+from .user_agent import USER_AGENTfrom dataclasses import dataclassfrom typing import Mapping, Protocol@@ -44,7 +45,7 @@ class HttpxTransport:self.client = client or httpx.Client(follow_redirects=True,limits=httpx.Limits(max_connections=32, max_keepalive_connections=16),- headers={"User-Agent": "Peach/0.2"},+ headers={"User-Agent": USER_AGENT},)self._owns_client = client is None or owns_clientdiff --git a/src/peach/page_cache.py b/src/peach/page_cache.pyindex a50d632be..9fa49f019 100644--- a/src/peach/page_cache.py+++ b/src/peach/page_cache.py@@ -19,8 +19,7 @@ from .http import HttpRequest, HttpxTransportfrom .scripting import RateLimiter-USER_AGENT = ("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 "- "(KHTML, like Gecko) Chrome/128.0 Safari/537.36")+from .user_agent import USER_AGENTclass HttpStatusError(RuntimeError):diff --git a/src/peach/providers.py b/src/peach/providers.pyindex f84a348fd..cbbb63ef9 100644--- a/src/peach/providers.py+++ b/src/peach/providers.py@@ -1,5 +1,6 @@"""AI Provider capability registry; health discovery never sends model requests."""from __future__ import annotations+from .user_agent import USER_AGENTimport shutilimport json@@ -45,7 +46,7 @@ class OpenCodeGoClient:with self._lock:if self._cache and now - self._cache[0] < self.cache_ttl:return [dict(item) for item in self._cache[1]]- headers = {"Accept": "application/json", "User-Agent": "Peach/0.2"}+ headers = {"Accept": "application/json", "User-Agent": USER_AGENT}if self._api_key:headers["Authorization"] = "Bearer " + self._api_keyrequest = HttpRequest("GET", self.base_url + "/models", headers)diff --git a/src/peach/routes_media.py b/src/peach/routes_media.pyindex 5ec0bc807..c14df5fed 100644--- a/src/peach/routes_media.py+++ b/src/peach/routes_media.py@@ -57,8 +57,7 @@ AVATAR_CACHE_SECONDS = 30 * 24 * 3600#: 取图标时报浏览器 UA。CDN 上的图标资产(p-smith、static.cdninstagram)对#: 机器人 UA 会直接 403,而这只是一次公开静态文件请求,没有伪装成用户的意思。-ICON_USER_AGENT = ("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 "- "(KHTML, like Gecko) Chrome/128.0 Safari/537.36")+from .user_agent import USER_AGENT#: 文件名里不能出现的字符,按 Windows 的最严口径取——落盘的那台多半是它。_UNSAFE_FILENAME = re.compile('[\\/:*?"<>|]+|[\x00-\x1f]+')@@ -505,7 +504,7 @@ def link_mark(request: Request, id: int = 0, args: dict[str, str] = Depends(requdef fetch(target: str):try:upstream = state.http_transport.client.get(- target, headers={"User-Agent": ICON_USER_AGENT},+ target, headers={"User-Agent": USER_AGENT},timeout=8, follow_redirects=True)except (OSError, httpx.HTTPError):return Nonediff --git a/src/peach/scripting.py b/src/peach/scripting.pyindex c3e728c38..3d759b234 100644--- a/src/peach/scripting.py+++ b/src/peach/scripting.py@@ -24,13 +24,7 @@ from pathlib import Pathfrom .config import DATABASE_PATHfrom .migrations import sqlite_backup-#: 对外抓取统一使用的 User-Agent。-#:-#: 形态是浏览器而不是老实的机器人标识,这是被上游逼出来的:javbus、babepedia、-#: linktr.ee 一类站点对陌生 UA 直接回 403,取证会全军覆没。版本取树里出现过的-#: 最新一个(Chrome/131),因为落后的版本号才是会被挑出来拦掉的那种特征。-USER_AGENT = ("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 "- "(KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36")+from .user_agent import USER_AGENT#: `--apply` 缺 `--backup` 时的唯一拒绝话术。BACKUP_REQUIRED = "--apply 必须同时给 --backup"diff --git a/src/peach/user_agent.py b/src/peach/user_agent.pynew file mode 100644index 000000000..537d5b428--- /dev/null+++ b/src/peach/user_agent.py@@ -0,0 +1,5 @@+"""对外请求使用同一份标准桌面 Chrome User-Agent。"""++# Chrome 152,2026-09-06 核对本机版本 152.0.7977.77;采用标准缩减版本格式。+USER_AGENT = ("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 "+ "(KHTML, like Gecko) Chrome/152.0.0.0 Safari/537.36")diff --git a/src/peach/web_links.py b/src/peach/web_links.pyindex 0cbd89b8d..18c30a133 100644--- a/src/peach/web_links.py+++ b/src/peach/web_links.py@@ -22,8 +22,7 @@ import httpxfrom .jobs import BackgroundJob-USER_AGENT = ("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 "- "(KHTML, like Gecko) Chrome/128.0 Safari/537.36")+from .user_agent import USER_AGENT#: 「这个页面没了」——只有上游明确这么说,才够格作为删除依据。GONE_STATUSES = frozenset({404, 410})CHECK_TIMEOUT = 12.0diff --git a/tests/test_follow_sources.py b/tests/test_follow_sources.pyindex cc90be558..0473e685f 100644--- a/tests/test_follow_sources.py+++ b/tests/test_follow_sources.py@@ -231,7 +231,7 @@ class OfficialConnectorTests(unittest.TestCase):self.assertTrue(all("post.listCreator" in request.url for request in list_seen))self.assertEqual(len(detail_seen), 1)self.assertIn("post.info", detail_seen[0].url)- self.assertIn("Firefox/147.0", detail_seen[0].headers["User-Agent"])+ self.assertEqual(USER_AGENT, detail_seen[0].headers["User-Agent"])self.assertEqual(detail_seen[0].headers["Referer"],"https://www.fanbox.cc/@ffxivinitiala/posts/12489354",diff --git a/tests/test_follow_web.py b/tests/test_follow_web.pyindex f5a5da482..485821b28 100644--- a/tests/test_follow_web.py+++ b/tests/test_follow_web.py@@ -2220,7 +2220,7 @@ class FollowWebSourceTests(unittest.TestCase):def test_follow_video_uses_the_shared_videojs_player_and_quality_control(self):self.assertPageContains('class="video-js vjs-big-play-centered" controls playsinline preload="metadata"')self.assertPageContains("if(followVideo){")- self.assertPageContains("const followPlayer=await mountDetailPlayer(item,followVideo,false,{")+ self.assertPageContains("const followPlayer=await mountDetailPlayer(item,followVideo,appSettings.detailAutoplay,{")self.assertPageContains("source:{src,type:selectedMedia?.media_type||item.media_type||'video/mp4'}")# 第四个参数是来源自己给的清晰度表:rule34video 把每档写成独立 mp4 字段,# videojs 的 qualityLevels 只认 HLS/DASH 的自适应轨道,看不到它们。diff --git a/tests/test_http.py b/tests/test_http.pyindex 3d1d95587..e5087a37b 100644--- a/tests/test_http.py+++ b/tests/test_http.py@@ -1,8 +1,37 @@import unittest+import ast+from pathlib import Pathimport httpxfrom peach.http import CurlCffiTransport, HttpRequest, HttpxTransport+from peach.user_agent import USER_AGENT+++class UserAgentTests(unittest.TestCase):+ def test_transport_defaults_to_shared_browser_user_agent(self):+ transport = HttpxTransport()+ try:+ self.assertEqual(transport.client.headers['User-Agent'], USER_AGENT)+ finally:+ transport.close()+ self.assertIn('Chrome/', USER_AGENT)++ def test_browser_user_agent_has_one_definition(self):+ root = Path(__file__).resolve().parents[1]+ offenders = []+ for folder in ('src', 'scripts'):+ for path in (root / folder).rglob('*.py'):+ if path.name == 'user_agent.py':+ continue+ for node in ast.walk(ast.parse(path.read_text(encoding='utf-8'))):+ if isinstance(node, ast.Constant) and isinstance(node.value, str) and node.value.startswith('Mozilla/5.0'):+ offenders.append(str(path.relative_to(root)))+ if isinstance(node, ast.Dict):+ for key, value in zip(node.keys, node.values):+ if isinstance(key, ast.Constant) and str(key.value).lower() == 'user-agent' and isinstance(value, ast.Constant):+ offenders.append(str(path.relative_to(root)))+ self.assertEqual(offenders, [])class _CurlResponse:diff --git a/tests/test_social_avatar_harvest.py b/tests/test_social_avatar_harvest.pyindex 589867ce1..ce3717cc8 100644--- a/tests/test_social_avatar_harvest.py+++ b/tests/test_social_avatar_harvest.py@@ -45,6 +45,7 @@ class CoverFallbackTests(unittest.TestCase):cache = module.AvatarCandidateCache(root/'cache')result = module.cover_fallback(con, record, cache, root)self.assertEqual(result['source_kind'], 'single_performer_cover')+ self.assertFalse(result['identity_verified'])self.assertEqual((result['width'], result['height']), (1000,700))con.execute("INSERT INTO asset_entity VALUES(1,6,'performer')")self.assertIsNone(module.cover_fallback(con, record, cache, root))diff --git a/tests/test_web_js.py b/tests/test_web_js.pyindex 713792903..e32c88f20 100644--- a/tests/test_web_js.py+++ b/tests/test_web_js.py@@ -414,6 +414,10 @@ class WebJsBehaviourTests(unittest.TestCase):def test_a_zoomed_avatar_covers_the_frame_and_centres_the_face(self):square = {"cx": 0.5, "cy": 0.3, "faceW": 150, "imgW": 1000, "imgH": 1000}self.assertJsResults([+ ("face-frame.js", "faceFrame", [{"cx": .736, "cy": .181,+ "faceW": 234, "imgW": 2184, "imgH": 1468}, {"w": 160, "h": 160}, 2],+ {"zoom": 2.008, "width": 298.67, "height": 200.75,+ "left": -169.82, "top": 0}),# 图撑到 200%×300%,负偏移把脸心拉向框心。宽高都不小于 100%,圆框里# 一丝白边都不会露——那是「放大」和「换一张构图」的分界。("face-frame.js", "faceFrame", [self.SMALL_FACE, {"w": 160, "h": 160}, 2],diff --git a/tests/test_web_ui.py b/tests/test_web_ui.pyindex 681b88a95..4429c2ead 100644--- a/tests/test_web_ui.py+++ b/tests/test_web_ui.py@@ -351,7 +351,7 @@ class WebUiSourceTests(unittest.TestCase):":focus", # 焦点环::focus / :focus-visible / :focus-within".geist-progress", ".watchprogress", ".vjs-play-progress", ".vjs-progress-holder",".trace .bar", ".tokbar", # 进度与数据- "#censorSetting:checked", # Toggle 开态:Geist Toggle 实测轨道 rgb(0,112,243)+ ":is(#censorSetting,#detailAutoplaySetting):checked", # Toggle 开态:Geist Toggle 实测轨道 rgb(0,112,243)".entitylink", ".flink", ".fsourcelink", ".fcred a", ".tokauthor>a", ".confighelp a", ".taste-history-guide-content a", # 真正的链接)@@ -1539,14 +1539,20 @@ class WebUiSourceTests(unittest.TestCase):self.assertPageContains('<span class="sr-only">${esc(x.label)}</span></a>')self.assertPageContains('.entitylinks a.iconlink{padding:4px;gap:0;border-radius:50%}')- def test_a_studio_official_link_shows_its_url_and_no_icon(self):- # 厂牌页的头像就是厂牌 logo,旁边再放一枚同品牌的小图标只是把同一个东西说两遍;- # 域名本身就是名字,比图标说得清楚。女优页不一样:那里的头像是人,事务所图标- # 不构成重复,标签也是事务所名而非域名。+ def test_a_studio_official_link_shows_its_url_and_globe(self):self.assertPageContains("if(kind==='studio')")self.assertPageContains('<a class="urllink" href="${esc(x.url)}"')self.assertPageContains("${esc(linkHost(x.url)||x.label)}")- self.assertPageContains(".entitylinks a.urllink{padding:4px 14px")+ self.assertPageContains(".entitylinks a.urllink{padding:4px 12px 4px 4px")++ def test_entity_loading_and_detail_autoplay_share_their_entry_contracts(self):+ self.assertPageContains("showEntityLoading(ROUTE_ENTITIES[path.split('/')[1]])")+ self.assertPageContains('showEntityLoading(kind);')+ self.assertPageContains('appSettings.detailAutoplay=appSettings.detailAutoplay!==false;')+ self.assertPageContains('mountDetailPlayer(it,vv,appSettings.detailAutoplay)')+ self.assertPageContains('mountDetailPlayer(item,followVideo,appSettings.detailAutoplay,{')+ self.assertPageContains('id="detailAutoplaySetting"')+ self.assertPageContains('fill="#000" stroke="none"/><path fill="#fff"')def test_entity_links_have_no_external_arrow(self):# `target="_blank"` 已经是外链,箭头只是重复;一排链接里它还会挤掉本就不多的@@ -1554,15 +1560,10 @@ class WebUiSourceTests(unittest.TestCase):self.assertPageLacks('entitylinkarrow', "外链箭头应当已删除")self.assertPageLacks('↗', "外链箭头字符应当已删除")- def test_x_links_use_an_inline_brand_mark_instead_of_a_fetched_favicon(self):- # favicon 是别人服务器上的一张小位图:X 直接挡掉爬取(资料页上那个空白白圆就是- # 它),取到的也多是 16×16,放进 32px 的圆里必然糊。416 条社媒链接里 372 条是- # x.com/twitter.com,只给它一个内联标记就覆盖了 89%,还省一次跨站请求。- # 哪些主机走内联标记(含子域、且只认后缀边界)由- # test_web_js.test_brand_marks_cover_the_host_and_its_subdomains_only 验收。+ def test_x_links_preserve_the_black_plate_and_white_mark(self):self.assertPageContains('<symbol id="i-brand-x"')# 填充字形不吃通用的 stroke:currentColor;fill:none。- self.assertPageContains('.entitylinkicon.brand svg{width:15px;height:15px;fill:currentColor;stroke:none}')+ self.assertPageContains('.entitylinkicon.brand svg{width:20px;height:20px;stroke:none;filter:none}')def test_the_link_icon_disc_carries_no_plate_of_its_own(self):"""内联品牌标记直接画在药丸上。垫一层 `--sunk` 会让它比周围暗一档,看着像@@ -4531,13 +4532,16 @@ class WebUiSourceTests(unittest.TestCase):# 公司名自己说明了它是什么,这一行只出名字,不加类别名占横向空间。self.assertPageLacks("· 事务所 ${esc(agencyName)}")# 链接标签写的是域名归谁,不是事务所名。- self.assertPageContains("标签写的是这个域名归谁")+ self.assertPageContains("linkHost(x.url)||x.label")def test_the_agency_page_reuses_the_entity_route_table(self):"""实体本来就只有 kind 不同,事务所加进同一张表就有了 `/agencies/<名字>`。"""self.assertPageContains("agency:'agencies'")self.assertPageContains("agencies:'agency'")+ def test_portrait_pixels_do_not_size_the_face_frame(self):+ self.assertPageContains(".entityportrait img{position:absolute;inset:0;grid-area:auto;")+def test_the_agency_page_gets_the_same_loading_skeleton(self):self.assertPageContains("performers|creators|studios|agencies")@@ -5711,8 +5715,8 @@ class WebUiSourceTests(unittest.TestCase):self.assertNotIn("box-shadow:0 8px 32px -12px", self.css, "浮层靠发丝线不靠投影")# 布尔开关是 Geist 中号 Toggle(36×20 轨道 + 17px 圆点),不是原生复选框;# Geist 的 Switch 是分段选择器,别用错控件。- self.assertPageContains("#censorSetting{appearance:none;-webkit-appearance:none;width:36px;height:20px;flex:none;")- self.assertPageContains("#censorSetting:checked{background:var(--tungsten)}")+ self.assertPageContains(":is(#censorSetting,#detailAutoplaySetting){appearance:none;-webkit-appearance:none;width:36px;height:20px;flex:none;")+ self.assertPageContains(":is(#censorSetting,#detailAutoplaySetting):checked{background:var(--tungsten)}")# 没有直接证据的 command-menu 入场动画与无有效高度约束的复核卡# Scroller 不应继续作为「Vercel 对齐」进入产品。self.assertPageLacks("animation:panel-in")@@ -6798,8 +6802,8 @@ class WebUiSourceTests(unittest.TestCase):"$('#stats').hidden=true;$('#index').hidden=false;$('#grid').innerHTML='';""$('#combo').innerHTML='';","索引页与资料页的共用铺开函数必须收掉目录的筛选芯片")- for name in ("openIndex", "openEntity"):- self.assertIn("showIndexLoading(", self._js_function(name),+ for name, loader in (("openIndex", "showIndexLoading("), ("openEntity", "showEntityLoading(")):+ self.assertIn(loader, self._js_function(name),name + " 自己铺索引页主体,多半又抄漏了一行")# 详情页内联在目录里,两个容器都还藏着:芯片在那里继续成立,不能被一起收掉。self.assertPageContains("if(push&&!queueContext)route('/item/'+id);")diff --git a/web/app.js b/web/app.jsindex 8155d0d56..abc49d426 100644--- a/web/app.js+++ b/web/app.js@@ -6,7 +6,7 @@ import { matchRoute, routeLabel } from './js/routes.js';import { initMiddleTruncate } from './js/middle-truncate.js';import { tagLabel } from './js/tags.js';import { syncSidebarSurface, sidebarTagCounts, sidebarHasCatalogContent, cleanupSkeletonHtml, cloudLocations, cloudPreferenceLocations, tasteHistoryGuideHtml, wireTasteHistoryGuide, TASTE_GUIDE_KEY } from './dist/peach-ui.js';-import { nativeImageFit } from './dist/peach-ui.js';+import { nativeImageFit, entitySkeletonHtml } from './dist/peach-ui.js';import {attachOverlayScrollbar, breadcrumbHtml, checkboxHtml, closeAnchoredMenu, confirmModal, emptyStateHtml, fieldsetTitle,fillSkeletonTier, fitSkeleton, iconSwitchHtml, indexSkeletonHtml, loadingDotsHtml,@@ -293,7 +293,7 @@ function renderInitialSurfaceLoading(){if(/^\/(?:performers|creators|studios|agencies)\//.test(path)){hideDiscoveryBars();$('#index').hidden=false;$('#grid').innerHTML='';- $('#index').innerHTML=pageSkeletonHtml('正在读取页面',{cards:true});+ showEntityLoading(ROUTE_ENTITIES[path.split('/')[1]]);fitSkeleton($('#index'));return;}@@ -421,6 +421,7 @@ appSettings.seekSeconds=allowedSetting(+appSettings.seekSeconds,[5,10,30],10);appSettings.ambientMode=appSettings.ambientMode!==false;appSettings.theaterMode=appSettings.theaterMode===true;appSettings.groupCollapse=appSettings.groupCollapse!==false;+appSettings.detailAutoplay=appSettings.detailAutoplay!==false;appSettings.searchHistoryLimit=allowedSetting(+appSettings.searchHistoryLimit,[5,10,20],10);appSettings.relatedLimit=allowedSetting(+appSettings.relatedLimit,[12,20,30],20);appSettings.theme=allowedSetting(appSettings.theme,THEME_CHOICES,'system');@@ -492,6 +493,7 @@ function renderSettingSelects(){}function syncSettingsPanel(){$('#groupCollapseSetting').checked=appSettings.groupCollapse;+ $('#detailAutoplaySetting').checked=appSettings.detailAutoplay;renderSettingSelects();renderThemeSetting();renderSidebarOrderSetting();@@ -532,6 +534,7 @@ $('#settingsPanel').onkeydown=e=>{/* 关掉后同一番号的每个分卷/版次各占一张卡。改完要重取当前列表:折叠是在渲染时做的,不重画的话已经被跳过的那些卡不会自己冒出来。 */$('#groupCollapseSetting').onchange=e=>{appSettings.groupCollapse=!!e.target.checked;saveSettings();reloadCurrentSurface()};+$('#detailAutoplaySetting').onchange=e=>{appSettings.detailAutoplay=e.target.checked;saveSettings()};let followScheduleRequest=0;const followScheduleCopy=status=>{if(!status.available)return '只在账本写入端运行';@@ -1948,13 +1951,11 @@ document.addEventListener('load',event=>{度量只能在 `load` 之后做:图没加载完时 `naturalWidth` 读到的是 0。换过回落图后`load` 会再来一次,这里读的 `currentSrc` 也就跟着是当前真正显示的那张。 */-//: 图至少要占到框的这一成才算「够大,铺满就行」。0.8 等于最多放大 1.25 倍。+// 允许适度放大;明显过小的图片才按源尺寸补底。function fitNativeImage(img){const box=img.closest('[data-fit-native]');if(!box||!img.naturalWidth)return;- /* 只比框小一点点的照旧铺满:放大一成多看不出糊,而按原尺寸摆只会在四周留一圈- 七八像素的窄边,模糊补底铺在那么窄的地方就是一道生硬的灰线。- 版式一换框就换了大小,所以这个判断要能重算,见 setPeopleIndexLayout。 */+ // 版式切换会改变框的大小,每次按屏幕像素密度重新判断。const {small,width,height}=nativeImageFit(img.naturalWidth,img.naturalHeight,box.clientWidth,box.clientHeight,window.devicePixelRatio||1);box.dataset.nativeSmall=String(small);box.style.setProperty('--markw',small?width+'px':'100%');@@ -4256,7 +4257,7 @@ async function openFollowDetail(id,push=true,mediaIndex=null,preserveReturn=fals/* 清晰度与字节数的解析跟默认片源并行。它需要回源抓详情、再 HEAD 一次正片,不能挡住播放器挂载;否则来源慢一点,详情里就会先留下一个没有 src 的空视频框。 */const mediaPromise=api(`/follow-qualities?id=${encodeURIComponent(item.id)}`).catch(()=>null);- const followPlayer=await mountDetailPlayer(item,followVideo,false,{+ const followPlayer=await mountDetailPlayer(item,followVideo,appSettings.detailAutoplay,{source:{src,type:selectedMedia?.media_type||item.media_type||'video/mp4'},checkSourceStatus:false,size:selectedMedia?.size,@@ -6238,6 +6239,13 @@ function wireNamePicker(kind,current){});}+function showEntityLoading(kind){+ const body=kind==='agency'?'<div class="entitycollectionhead"><h3 class="skeleton"> </h3></div>'+indexSkeletonHtml({kind:'performers',layout:peopleIndexLayout()}):pageSkeletonHtml('正在读取作品',{cards:true});+ const placeholder=entitySkeletonHtml(kind,body);+ if($('#index').firstElementChild?.dataset.skeleton!==`entity/${kind}`){+ $('#index').innerHTML=placeholder;fitSkeleton($('#index'));+ }+}async function openEntity(kind,name,push=true){releaseHoverPreviews();const filters=push?emptyEntityFilters():parseEntityFilters(location.search);@@ -6251,7 +6259,9 @@ async function openEntity(kind,name,push=true){showHomeSurfaces();disposeStage(false);document.body.classList.add('entity-open');- showIndexLoading('正在读取资料');+ $('#stats').hidden=true;$('#index').hidden=false;$('#grid').innerHTML='';$('#combo').innerHTML='';+ $('#count').textContent='';$('#loadSentinel').hidden=true;+ showEntityLoading(kind);detailReturnBarsContext=null;entityJavLayout=false;agencyRosterView='people';@@ -6301,13 +6311,9 @@ async function openEntity(kind,name,push=true){// 纯图标的链接自己不带可读文字,得把标签留给辅助技术。return `<a class="iconlink" href="${esc(x.url)}" target="_blank" rel="noreferrer" title="${esc(x.label)}">${mark}<span class="sr-only">${esc(x.label)}</span></a>`;}- /* 厂牌页的官网链接不放图标,直接给网址。-- 这一页的头像就是厂牌 logo,旁边再放一枚同品牌的小图标只是把同一个东西说两遍;- 而域名本身就是名字,比图标说得更清楚。女优页不一样:那里的头像是人,站点图标- 不构成重复,标签写的是这个域名归谁——图标、文字和落点因此说的是同一件事。 */+ // 官网用地球图标标明链接类型。if(kind==='studio')- return `<a class="urllink" href="${esc(x.url)}" target="_blank" rel="noreferrer" title="${esc(x.label)}"><span class="entitylinklabel">${esc(linkHost(x.url)||x.label)}</span></a>`;+ return `<a class="urllink" href="${esc(x.url)}" target="_blank" rel="noreferrer" title="${esc(x.label)}"><span class="entitylinkicon">${icon('globe')}</span><span class="entitylinklabel">${esc(linkHost(x.url)||x.label)}</span></a>`;return `<a href="${esc(x.url)}" target="_blank" rel="noreferrer" title="${esc(x.label)}"><span class="entitylinkicon">${icon('globe')}<img class="entityfavicon" src="${esc(linkMarkUrl(x))}" alt="" loading="lazy" referrerpolicy="no-referrer" data-drop="self"></span><span class="entitylinklabel">${esc(x.label)}</span></a>`;}).join('');const tags=(d.tags||[]).map(x=>`<button class="pill" data-entity-tag="${esc(x.k)}" aria-pressed="${tagPressed(filters.tag,x.k)}">${esc(tagLabel(x.k))}<small>${x.n.toLocaleString()}</small></button>`).join('');@@ -7661,7 +7667,7 @@ async function openItem(id,push=true,queueContext=null,anchor=null){followFilter='saved';route(followViewPath());openFollow(false)};}else if(g)g.onclick=async()=>{vv.hidden=false;g.remove();const mounted=await mountDetailPlayer(it,vv,true);stopAmbient=mountPlayerAmbient(vv);mounted?.one?.('dispose',stopAmbient)};- else{const mounted=await mountDetailPlayer(it,vv,true);stopAmbient=mountPlayerAmbient(vv);mounted?.one?.('dispose',stopAmbient)}+ else{const mounted=await mountDetailPlayer(it,vv,appSettings.detailAutoplay);stopAmbient=mountPlayerAmbient(vv);mounted?.one?.('dispose',stopAmbient)}vv.addEventListener('emptied',()=>stopAmbient(),{once:true});buildBars();scrollItemDetailIntoView();diff --git a/web/css/07-entity.css b/web/css/07-entity.cssindex 52ea88a67..f827a07be 100644--- a/web/css/07-entity.css+++ b/web/css/07-entity.css@@ -10,7 +10,7 @@取图失败时 img 会被兜底链移除,:has 随之不匹配,首字母自动回来——不用再写一段 JS 去同步。厂牌标识本身是不透明方图,下面那条 cover 把它铺满整框。 */.entityportrait:has(img)>span{display:none}-.entityportrait img{width:100%;height:100%;object-fit:cover;display:block;z-index:1}+.entityportrait img{position:absolute;inset:0;grid-area:auto;width:100%;height:100%;object-fit:cover;display:block;z-index:1}.entityhero>div:last-child{min-width:0;max-width:100%}.entityhero h2{font-size:var(--fs-3xl);font-weight:400;line-height:1.2;letter-spacing:0;margin:0 0 9px;overflow-wrap:anywhere}.entityhero .alias b{color:var(--ink);font-weight:inherit}/* 统称选择器贴着标题:它改的就是标题上那个名字,隔开就看不出改的是哪一个。@@ -51,12 +51,19 @@现在 X 走内联品牌标记不再发请求,其余主机也不再垫白底。 */.entitylinkicon img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;background:var(--sunk)}/* 品牌标记是填充字形,不吃上面那套描边。 */-.entitylinkicon.brand svg{width:15px;height:15px;fill:currentColor;stroke:none}+.entitylinkicon.brand svg{width:20px;height:20px;stroke:none;filter:none}/* 纯图标的社媒链接:收成圆形,没有文字就不给文字留位置。 */.entitylinks a.iconlink{padding:4px;gap:0;border-radius:50%}-/* 只有网址的官网链接:没有图标,左内边距不必再给图标留位置。- 默认那条 `4px 12px 4px 4px` 是按「圆图标 + 文字」调的,直接套用会让文字贴左。 */-.entitylinks a.urllink{padding:4px 14px;letter-spacing:.02em}+/* 官网域名前显示地球图标,与带名称的链接共用间距。 */+.entitylinks a.urllink{padding:4px 12px 4px 4px;letter-spacing:.02em}+.entityskeletontext{width:100%}+.entityskeletontext .entitytitle .skeleton{width:60%;height:auto}+.entityskeletontext .alias .skeleton{display:block;width:40%;height:20px}+.entityskeletontext .entitylinks .skeleton{width:180px;height:40px}+[data-skeleton^="entity/"] .entityportrait{height:auto}+[data-skeleton^="entity/"] .entitytags .entitymediaskeleton{width:var(--filterItemH);height:var(--filterItemH);border-radius:50%;flex:none}+[data-skeleton^="entity/"] .entitycollectionhead .skeleton{width:90px;height:20px}+@media(max-width:600px){.entityskeletontext .alias .skeleton{margin-inline:auto}}.entitylinklabel{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.entitymeta{display:grid;gap:22px;margin:0 0 6px;min-width:0}.entitymeta section{min-width:0}.entitysection h3{font-size:var(--fs-sm);letter-spacing:.08em;color:var(--muted);margin:0 0 12px}.entitytagbar{position:sticky;top:var(--topH);z-index:61;display:flex;align-items:center;diff --git a/web/css/16-settings.css b/web/css/16-settings.cssindex 580b6c495..3135ed46d 100644--- a/web/css/16-settings.css+++ b/web/css/16-settings.css@@ -38,14 +38,14 @@ body.settings-open{overflow:hidden}/* 布尔开关用 Geist Toggle 而不是原生复选框(取证 vercel-geist-semantics-measured.md):中号 36×20 轨道 + 17px 圆点,关 = 灰轨道圆点靠左,开 = 主题蓝圆点靠右;Geist 的「Switch」是分段选择器(radio 语义),布尔开关的正确控件叫 Toggle。 */-#censorSetting{appearance:none;-webkit-appearance:none;width:36px;height:20px;flex:none;+:is(#censorSetting,#detailAutoplaySetting){appearance:none;-webkit-appearance:none;width:36px;height:20px;flex:none;border-radius:var(--pill-radius);background:var(--line);position:relative;cursor:pointer;margin:0;transition:background-color .15s ease}-#censorSetting::after{content:'';position:absolute;top:1.5px;left:2px;width:17px;height:17px;+:is(#censorSetting,#detailAutoplaySetting)::after{content:'';position:absolute;top:1.5px;left:2px;width:17px;height:17px;border-radius:50%;background:rgba(237,237,237,.84);transition:left .15s ease}-#censorSetting:checked{background:var(--tungsten)}-#censorSetting:checked::after{left:17px}-#censorSetting:focus-visible{outline:2px solid var(--tungsten);outline-offset:2px}+:is(#censorSetting,#detailAutoplaySetting):checked{background:var(--tungsten)}+:is(#censorSetting,#detailAutoplaySetting):checked::after{left:17px}+:is(#censorSetting,#detailAutoplaySetting):focus-visible{outline:2px solid var(--tungsten);outline-offset:2px}/* 主题选择器是 Geist 里唯一给选中项加环的控件:三档的底色和它坐着的面板同色,光靠填充分不出当前是哪一档。几何按 2026-09-04 实测 vercel.com 的 system/light/dark三枚圆形按钮:外框是 32px 高、无填充的胶囊加一圈 1px 环,每档 32×32 正圆、图标 16px,diff --git a/web/dist/peach-ui.js b/web/dist/peach-ui.jsindex aa3e21b56..33d3944ad 100644--- a/web/dist/peach-ui.js+++ b/web/dist/peach-ui.js@@ -1718,7 +1718,7 @@ function Qt(e, t, n, r, i = 1) {t,n,r- ].every((e) => Number.isFinite(e) && e > 0), s = o && Math.min(n, r) >= 64 && (e < n * .8 || t < r * .8), c = o ? Math.min(1, n / e, r / t) : 1;+ ].every((e) => Number.isFinite(e) && e > 0), s = o && Math.min(n, r) >= 64 && (e < n * .4 || t < r * .4), c = o ? Math.min(1, n / e, r / t) : 1;return {small: s,width: e * c,@@ -1726,8 +1726,20 @@ function Qt(e, t, n, r, i = 1) {};}//#endregion+//#region src/entity-skeleton.ts+function $t(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>+ <div class="entityskeletontext"><div class="entitytitle"><h2 class="skeleton"> </h2></div>+ <div class="alias"><span class="skeleton"></span></div>+ <div class="entitylinks"><span class="skeleton"></span></div></div></div>+ <section class="entitytagbar"><div class="entitytags"><span class="skeleton entitymediaskeleton"></span><span class="skeleton entitymediaskeleton"></span></div></section>+ <div class="entitysection">${t}</div></div></section>`;+}+//#endregion//#region src/sidebar.ts-function $t(e) {+function en(e) {return ["/","/unseen",@@ -1737,23 +1749,23 @@ function $t(e) {"/junk-files"].includes(e) || /^\/(item|mix|parts|editions)\//.test(e) || /^\/playlists\/\d+\/\d+$/.test(e) || /^\/(performers|studios|creators|series|agencies)\/.+/.test(e);}-function en(e, t) {+function tn(e, t) {return e.dataset.surface === t && e.querySelector(".dnav") ? !1 : (e.dataset.surface = t, e.replaceChildren(), !0);}-function tn(e) {+function nn(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 nn(e) {+function rn(e) {return e.filter((e) => ["115", "pikpak"].includes(e.location) && (e.roots === void 0 || e.roots.length > 0)).map((e) => e.location);}-function rn(e, t) {+function an(e, t) {return t.filter((t) => e.some((e) => e.location === t));}-function an() {+function on() {return `<div class="cleanuppage" data-skeleton="cleanup" aria-busy="true" aria-label="正在读取数据管理状态"><div class="cleanupgrid">${[[@@ -1799,7 +1811,7 @@ function an() {<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 on(e, t = !1, n = !1) {+function sn(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" : ""}>@@ -1813,16 +1825,16 @@ function on(e, t = !1, n = !1) {<button type="button" class="taste-guide-skip">跳过</button></div></details>`;}-var sn = "peach-taste-guide-dismissed";-function cn(e, t) {+var cn = "peach-taste-guide-dismissed";+function ln(e, t) {let n = e.querySelector(".taste-history-guide");n?.querySelector(".taste-guide-skip")?.addEventListener("click", () => {- t.setItem(sn, "1"), n.remove();+ t.setItem(cn, "1"), n.remove();});}//#endregion//#region src/islands.ts-var ln = {+var un = {scraping: {load: Gt,component: Jt@@ -1835,11 +1847,11 @@ var ln = {load: Xe,component: nt}-}, un = () => Object.keys(ln), $ = /* @__PURE__ */ new Map();-async function dn(e, t, n, r = {}) {- let i = ln[e];+}, dn = () => Object.keys(un), $ = /* @__PURE__ */ new Map();+async function fn(e, t, n, r = {}) {+ let i = un[e];if (!i) throw Error(`未注册的 island:${String(e)}`);- fn(t);+ pn(t);let a = {controller: new AbortController(),painted: !1@@ -1870,9 +1882,9 @@ async function dn(e, t, n, r = {}) {};xe(te(i.component, s), t);}-function fn(e) {+function pn(e) {let t = $.get(e);t && (t.controller.abort(), $.delete(e), t.painted && xe(null, e));}//#endregion-export { sn as TASTE_GUIDE_KEY, an as cleanupSkeletonHtml, nn as cloudLocations, rn as cloudPreferenceLocations, Wt as followJobProgress, un as islandNames, dn as mountIsland, Qt as nativeImageFit, Zt as refreshStore, $t as sidebarHasCatalogContent, tn as sidebarTagCounts, Xt as storeNames, en as syncSidebarSurface, on as tasteHistoryGuideHtml, fn as unmountIsland, Ut as watchJob, cn as wireTasteHistoryGuide };+export { cn as TASTE_GUIDE_KEY, on as cleanupSkeletonHtml, rn as cloudLocations, an as cloudPreferenceLocations, $t as entitySkeletonHtml, Wt as followJobProgress, dn as islandNames, fn as mountIsland, Qt as nativeImageFit, Zt as refreshStore, en as sidebarHasCatalogContent, nn as sidebarTagCounts, Xt as storeNames, tn as syncSidebarSurface, sn as tasteHistoryGuideHtml, pn as unmountIsland, Ut as watchJob, ln as wireTasteHistoryGuide };diff --git a/web/index.html b/web/index.htmlindex 98863a8c3..463537463 100644--- a/web/index.html+++ b/web/index.html@@ -117,7 +117,7 @@不吃通用的 `stroke:currentColor;fill:none`。只做 X 一个:416 条社媒链接里 372 条(89%)是 x.com/twitter.com,而 X 恰好会挡掉 favicon 请求——资料页上那个空白白圆就是它。其余主机继续走 favicon。 -->- <symbol id="i-brand-x" viewBox="-0.9 -0.9 25.9 25.9"><path fill="currentColor" stroke="none" d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"/></symbol>+ <symbol id="i-brand-x" viewBox="-0.9 -0.9 25.9 25.9"><rect x="-0.9" y="-0.9" width="25.9" height="25.9" fill="#000" stroke="none"/><path fill="#fff" stroke="none" d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"/></symbol><symbol id="i-bookmark-plus" viewBox="0 0 24 24"><path d="M12 7v6" /><path d="M15 10H9" /><path d="M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z" /></symbol><symbol id="i-bookmark" viewBox="0 0 24 24"><path d="M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z" /></symbol><symbol id="i-gallery-vertical-end" viewBox="0 0 24 24"><path d="M7 2h10" /><path d="M5 6h14" /><rect width="18" height="12" x="3" y="10" rx="2" /></symbol>@@ -205,6 +205,7 @@<label class="settingrow"><span><b>合并分卷与版本</b><small>同一番号的多个分卷或版次只占一张卡,展示第一个。</small></span><span class="pcheck"><input type="checkbox" id="groupCollapseSetting"><span aria-hidden="true"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="#i-check"/></svg></span></span></label></section><section class="settinggroup"><h3>播放</h3>+ <label class="settingrow"><span><b>打开详情自动播放</b><small id="detailAutoplayDescription">打开本地作品或关注视频详情时开始播放;关闭后点击播放按钮开始。</small></span><input type="checkbox" id="detailAutoplaySetting" aria-describedby="detailAutoplayDescription"></label><div class="settingrow"><span><b>快进 / 快退</b><small>卡片预览和详情播放器共用。</small></span><div id="seekSecondsSetting"></div></div><div class="settingrow"><span><b>相关推荐</b><small>详情下方一次显示的相似作品数量。</small></span><div id="relatedLimitSetting"></div></div></section>