Peach: Local-first video metadata scraper and media manager.
feat: harden Peach local service and refine UI
Peach local maintenancebba0b7761124
diff --git a/AGENTS.md b/AGENTS.mdindex da86327f4..39572411e 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -23,6 +23,7 @@ Working rules:- User-confirmed corpus context: Peach contains consenting adults only. Labels such as `萝莉`、`学生`、`洛丽塔`、`制服`、`泄露` and `流出` are role-play, genre or marketing/source vocabulary, not evidence of age or consent. Do not skip cataloguing solely because those strings occur. If direct file evidence contradicts this corpus-level context, stop and report the specific evidence instead of inferring from a label.- Do not create dated handoff documents. Update `docs/STATUS.md` for current runtime/next work and `docs/HANDOFF.md` for durable operating knowledge as part of the same change.- Before adding or restoring an implementation, check `docs/REUSE.md`, the current tree and Git history. A missing legacy filename does not prove the capability is missing. Update the reuse register when the decision changes.+- When the user says to imitate, reference or align with another product, obtain current reproducible evidence first: live behavior plus DOM/CSS/source/bundle where available, or exact screenshot measurements when source is unavailable. Record the URL/version/hash and intentional Peach deviations in `docs/HANDOFF.md`. If evidence is unavailable, write `未取得`; do not ship a guessed approximation as a faithful reproduction.- Never require the user to relay implementation details between agents. Put current facts in `docs/STATUS.md`, durable rules in `docs/HANDOFF.md`/`docs/REUSE.md`, and architecture decisions in an ADR.- Run the verification commands in `README.md` before committing relevant changes.- Reuse existing usage surfaces and protocols. T3 Code/CodexBar cover historical token and API-equivalent cost views; official provider quota endpoints cover live remaining windows. Do not build another session-log cost scanner or depend on T3 Code's private localhost API.diff --git a/README.md b/README.mdindex de669c39f..fcda797fc 100644--- a/README.md+++ b/README.md@@ -48,12 +48,31 @@ cd R:\peach-app```powershell& .\.venv\Scripts\peach.exe serve --host 0.0.0.0 --port 443 `+ --mdns-address 192.168.50.162 `--ssl-certfile R:\peach-data\secrets\tls\peach.crt `--ssl-keyfile R:\peach-data\secrets\tls\peach.key```证书必须包含实际访问名(例如 `peach.local`)并被客户端信任;启用 TLS 时 mDNS 自动发布 HTTPS。+本机局域网不使用 Let's Encrypt。项目提供可重复执行的本地 CA + 服务器证书生成脚本;默认只写+`R:\peach-data\secrets\tls`,`-TrustCurrentUser` 只把 CA 加入当前 Windows 用户的信任库:++```powershell+& .\scripts\setup_local_tls.ps1 -Address 192.168.50.162 -TrustCurrentUser+```++每台访问设备都必须单独信任 `peach-local-ca.crt`,只需安装一次,证书续签仍可沿用同一 CA:++- macOS:把 CA 拖入“钥匙串访问”的“登录”或“系统”钥匙串,双击后在“信任”中将 SSL+ 设为始终信任。Apple 官方步骤:<https://support.apple.com/guide/keychain-access/kyca11871/mac>。+- iPhone/iPad:先安装 CA 描述文件,再进入“设置 → 通用 → 关于本机 → 证书信任设置”,+ 为该根证书开启完全信任。Apple 官方步骤:<https://support.apple.com/en-us/102390>。+- 只传 `peach-local-ca.crt`。绝不传 `peach-local-ca.key`、`peach.key` 或整个 `tls` 目录。++如果不愿在设备上安装本地 CA,继续使用 `http://peach.local`。浏览器无法在不信任 CA 的+前提下把自签 HTTPS 变成无警告连接;Let's Encrypt 也不会签发 `.local`。+当前运行态与下一任务只看 [`docs/STATUS.md`](docs/STATUS.md);跨 Codex/Claude 的固定接手方式只看 [`docs/HANDOFF.md`](docs/HANDOFF.md)。准备新增、恢复或替换实现前,必须查 [`docs/REUSE.md`](docs/REUSE.md),避免按旧文件名重复造轮子。diff --git a/docs/HANDOFF.md b/docs/HANDOFF.mdindex 1f5e9d08d..491164de4 100644--- a/docs/HANDOFF.md+++ b/docs/HANDOFF.md@@ -101,6 +101,59 @@ Codex does not currently expose an equivalent project task-completion hook. Itsrequires the coordinating agent to update STATUS/HANDOFF in the same change; do not invent a brittle logwatcher to simulate lifecycle events.+## Referenced-product evidence register++“模仿/参考/对齐” requires current reproducible evidence before implementation. Record the source,+retrieval date/hash, exact behavior reused and intentional Peach deviation here. If evidence is not+available, write `未取得`; an approximation must not be described as a faithful reproduction.++- **Beeg card controls, verified 2026-08-15:** the current root loads+ `https://beeg.com/dist/main.9442c3b8.css` (SHA-256+ `E585B07CA0C312C28903DB939144B26A3C4BFBC9499F5997BDDE168A197CDB34`) and+ `https://beeg.com/dist/main.9442c3b8.js` (SHA-256+ `A7321F6E84D97417B588B6E98EEC86A15B30DC4C36B03537481CC55A4CF933E7`).+ The verified counter is 36 px at top/right 12 px, uses `rgba(0,0,0,.24)`,+ `saturate(180%) blur(12px)`, a 2 px white r=17 ring with circumference 106.814150222,+ and scales to 1.2 on desktop hover. The save control uses the same translucent treatment at+ bottom/right 12 px. Beeg starts the counter when preview playback is active and uses the preview+ duration. Peach now also waits for a usable preview before showing/arming the ring, but intentionally+ uses the user's five-second threshold before enlargement; metered still-image previews arm it when+ frame cycling begins. The enlarged Peach overlay keeps centered -10/+10/detail controls because that+ is the requested Peach interaction, not a claimed Beeg copy.+- **TikTok one-column transition, verified 2026-08-15:** the current page loads+ `https://lf16-tiktok-web.tiktokcdn-us.com/obj/tiktok-web-tx/tiktok/webapp/main/react-v18/webapp-desktop/static/js/async/89993.30b4c2a9.js`+ (SHA-256 `C4D4867C5C6C89DCE560D429A4686427C911267DCBB2787AEB31B7BD333E9088`).+ Its current programmatic one-column scroll uses 200 ms, cubic-bezier(.2,.2,.4,.9), target+ `offsetTop`, and temporarily disables/restores `scrollSnapType`. Peach reuses the measured duration+ and easing for its two-video 100%-height track, while keeping its own preload and wheel/touch queue.+- **Apple transport controls, verified against the Apple HIG “Playing video” page on 2026-08-15:**+ the evidence supports familiar, minimal transport controls and system-player semantics, but does not+ provide reusable web SVG source for `gobackward.10`/`goforward.10`. Peach therefore uses its pinned+ local icon subset plus explicit “后退/前进 10 秒” accessible labels; it does not claim an exact iOS+ glyph copy.+- **Rule34 styling:** earlier code comments claimed Rule34-style tag colors without recorded DOM/CSS+ evidence. Those claims were removed. Peach's tag colors are its own semantic categories.+- **CodexBar/T3 usage:** this is a reuse decision, not a copied Peach UI. CodexBar's public CLI/provider+ documentation confirms local Claude/Codex cost aggregation; T3 Code's public README and the user's+ current Usage screen establish the existing history surface. Peach has no token-log scanner or copied+ dashboard implementation. Live remaining windows must still come from official provider surfaces.+- **Vercel design guidance, fetched 2026-08-15:** `https://vercel.com/design.md` (SHA-256+ `07ED2923294AA326F65F9D9D4094B6E97BF7DE10C39ACD8BE935F2045C5A688F`) is used as a review+ checklist, not a component source. Applied rules: establish hierarchy with type and spacing before+ surfaces, keep one continuous canvas, avoid arbitrary icon tiles/nested cards/tiny muted copy, and use+ motion only for state or continuity. Peach keeps functional source badges, filter tags and video-overlay+ translucency because they encode state or preserve legibility over moving imagery.+- **kill-ai-slop, reviewed at commit `96d1ca568a1db7e1ef9a381644c744440f816ee4` on+ 2026-08-15:** the Apache-2.0 project was used as a subtractive audit checklist. The current pass removes+ the decorative page gradient, frosted navigation/drawer, excessive pill radii and an unnecessary nested+ preference panel. It does not install the agent skill or copy its scanner into Peach.+- **Lucide Icons:** action and navigation glyphs use a pinned local subset of `lucide-static` 1.31.0+ (ISC, npm integrity+ `sha512-XFX9NO+gcLsOkXISmeQZYGJa2siGWZc/lgT/BK1b83h9RdOiz3cj1eQP5nWhELiB1KhW5ryk0nmMopOgm/CuSA==`).+ The paths are embedded in `web/index.html`; attribution is in `web/vendor/lucide-LICENSE.txt`.+ Brand/source marks and the timed preview ring remain separate because they are identities or data+ visualizations, not general-purpose interface icons.+## Agent capacity and usage routing- Use official quota windows for dispatch decisions, not API-equivalent dollar estimates. Codex exposes@@ -135,14 +188,14 @@ all three.- Real ledger: `R:\peach-data\database\ledger.db`; WAL mode; normal browsing legitimately changes play/activity fields.- Tests must create temporary SQLite databases and temporary media files.- Before real migration: SQLite backup, asset/tag counts, `PRAGMA integrity_check`, migration version check, then service smoke test.-- Formal migrations `0000`–`0006` are applied to the real ledger. `0003` adds the local default profile, profile-scoped watch queue, typed entity links and entity search terms. `0004` adds synchronized SQLite FTS5 trigram search. `0005` backfills late compatibility tags into canonical relations. `0006` adds profile-scoped `asset_preference` without changing asset rows. Its backup is `R:\peach-data\database\ledger.pre-migrate-20260815-000500.db`; retain it with the earlier recovery points until a later verified migration.+- Formal migrations `0000`–`0007` are applied to the real ledger. `0003` adds the local default profile, profile-scoped watch queue, typed entity links and entity search terms. `0004` adds synchronized SQLite FTS5 trigram search. `0005` backfills late compatibility tags into canonical relations. `0006` adds profile-scoped `asset_preference`. `0007` removes reviewed structural folder names (`门槛`, `视频`, `宣传文件`) from creator identity without deleting assets. Retain the pre-migration backups until a later verified migration.- Media and runtime data remain under `R:\media` and `R:\peach-data`; they are not repository assets.## Operations- Main command: `peach serve|migrate` after editable installation.-- `peach serve` 默认用 Python zeroconf 发布唯一入口 `peach.local`;使用 `--no-mdns` 可关闭。必须保留迁移前已验证的 `Zeroconf()` 全合格网卡语义,不要缩窄为单一 IPv4,也不要改用只能发布服务/SRV 的 Windows `DnsServiceRegister`。注册在 FastAPI lifespan 中执行,不能在事件循环内同步阻塞。mDNS 修改的验收门槛是:单元测试、运行态 health、DNS-SD 查询、主机名解析,以及一台真实 LAN 客户端;监听端口枚举或注册回调不能单独证明可用。-- TLS 仅在同时提供 `--ssl-certfile` 和 `--ssl-keyfile` 时启用;`.local` 使用本地 CA,不使用 Let's Encrypt,证书和私钥留在 `R:\peach-data\secrets`。+- `peach serve` 默认用 Python zeroconf 发布唯一入口 `peach.local`;使用 `--no-mdns` 可关闭。必须保留迁移前已验证的 `Zeroconf()` 全合格网卡监听语义,不要改用只能发布服务/SRV 的 Windows `DnsServiceRegister`。隧道软件可能让自动路由选择落到 `198.18.0.0/15`;生产启动因此显式传 `--mdns-address 192.168.50.162`,只固定发布的 A 地址,不缩窄 Zeroconf 监听接口。注册在 FastAPI lifespan 中执行,不能在事件循环内同步阻塞。mDNS 修改的验收门槛是:单元测试、运行态 health、DNS-SD 查询、主机名解析,以及一台真实 LAN 客户端;监听端口枚举或注册回调不能单独证明可用。+- TLS 仅在同时提供 `--ssl-certfile` 和 `--ssl-keyfile` 时启用;`.local` 使用本地 CA,不使用 Let's Encrypt,证书和私钥留在 `R:\peach-data\secrets`。本地 CA 必须带 critical `CA:TRUE` 和 `keyCertSign,cRLSign`;生成脚本签发后必须用 OpenSSL 验证链。macOS/iOS 只安装并信任 `peach-local-ca.crt`,不得分发 CA key 或服务器 key。- FastAPI is the only Web server. `web_contract.py` contains the stable JSON surface; do not recreate a parallel `http.server` or dynamic legacy loader.- FFmpeg/ffprobe resolve from explicit environment overrides, then `R:\peach-data\tools\ffmpeg\bin`, then `PATH`. No active code may fall back to the Stash private directory.- Long-running inventory helpers are under `scripts/`; their scheduled tasks use `R:\peach-app\.venv\Scripts\python.exe`. They use absolute data paths and may be interrupted/restarted where their own locking contract allows it.@@ -166,6 +219,9 @@ all three.- Long-card enlargement and seek controls require five continuous hover seconds. Short cards keep immediate “稍后看”. A creator/studio/performer text link consumes the click and opens the entity page; it must never bubble into video expansion.- Card identity is performer-first: use `performer_entities` for the portrait and performer-page link before falling back to creator/studio representative art. Keep this payload consistent across normal, related and review queues. Back buttons use the shared `backbtn`; closing the drawer for navigation must suppress immediate rail-hover reopening.- Like and the private reason remain one profile preference. A non-empty reason implies Like, but the saved prose is not itself a ranking feature until a provenance-backed taste-facet pipeline exists; UI copy must not claim otherwise.+- Detail identity uses one compact row per entity, with a small performer portrait or studio logo immediately before its label; it is not a standalone bordered card. Legacy length labels (`短片-2分内` / `中片-10分内` / `长片-30分内` / `超长片`) stay in compatibility data but are not UI tags or facets; duration filtering is numeric minutes only.+- Detail feedback is a compact icon toolbar backed by the pinned Lucide set. Like/dislike/seen/Later/deletion candidate use accessible labels, hover explanations, semantic hover/active color and restrained motion. Later is not a separate full-width action. Orgasm count remains a separate icon row. “待删” always means candidate-only; actual deletion is a later reviewed CSV apply step.+- The desktop filter drawer may open only after the pointer enters the visible 72 px rail. Do not restore a hidden content-area hot zone.- Source and studio marks use cached official assets with provenance. Missing studio logos show initials, never an arbitrary work/avatar. Current canonical studio coverage is 28/114 after the official kawaii asset was added (S1 was already cached); continue through the review queue instead of inventing logos.- Entity portraits resolve `generated/avatars/<kind>-<entity_id>.img` first and carry content-type/provenance sidecars. Do not accept Stash's default SVG silhouette or search-result thumbnails as portraits; representative asset crops are fallback only.- `scripts/import_stash_entities.py` is the transitional performer identity importer. It uses `StashClient`, exact canonical-name matches, stable external refs, dry-run by default and a required backup on apply. Only localhost Stash image URLs are accepted; placeholders and images below a 512 px short side are rejected. Only aliases explicitly marked `X:`/`Twitter:` become social links; plain `@handle` remains a search term because its network is ambiguous.diff --git a/docs/REUSE.md b/docs/REUSE.mdindex 7346102e1..9f62263ad 100644--- a/docs/REUSE.md+++ b/docs/REUSE.md@@ -33,6 +33,7 @@ These are product behavior and remain custom:| LAN discovery | Python zeroconf | service lifecycle and real-client acceptance || Agent usage/quota | official provider quota APIs; T3 Code/CodexBar for local history | task routing, redaction and stale-snapshot labeling || Video source/end-card evidence | existing FFmpeg frame extraction plus a reviewed OCR/vision adapter | opening/ending sample policy, provenance and incomplete-version candidates |+| Referenced product behavior | current live interaction plus versioned public DOM/CSS/JS, or exact screenshot measurements when source is unavailable | evidence register, accessibility, Peach-specific deviations and regression checks |Do not introduce a dependency until its first consumer and isolated tests land in the same change.@@ -58,3 +59,4 @@ Completed in the consolidation slice: shared Media/Job/HTTP boundaries, feedpars2. Configure and evaluate Stash metadata providers before writing another source adapter.3. Move remaining legacy status/suggest/ledger application logic behind repository/application ports, then delete obsolete CLI surfaces.4. Do not build a token/cost log scanner inside Peach or bind to T3 Code's private RPC; use its UI/CodexBar and official live quota surfaces.+5. “模仿/参考/对齐” is not authorization to approximate from memory. Obtain and record reproducible evidence before implementation; otherwise mark the item `未取得` and keep it out of production.diff --git a/docs/STATUS.md b/docs/STATUS.mdindex 7ff05fd51..1636457c3 100644--- a/docs/STATUS.md+++ b/docs/STATUS.md@@ -4,12 +4,12 @@ Last verified: 2026-08-15## Runtime-- Production Peach: FastAPI `0.2.0` from `R:\peach-app` on `0.0.0.0:80`, listener PID observed as 12980 after the card-interaction deployment (venv launcher PID 33456); health mode is `fastapi`.+- Production Peach: FastAPI `0.2.0` from `R:\peach-app` on HTTP `0.0.0.0:80` (PID 46372) and HTTPS `192.168.50.162:443` (PID 60632); health mode is `fastapi`.- `peach.local` is again the single official LAN entry. The publisher restores the verified pre-migration behavior: Python zeroconf listens on all eligible interfaces and publishes `peach.local -> 192.168.50.162`. Production health reports `mdns_backend=zeroconf-all-interfaces`; same-host DNS-SD discovery and `getaddrinfo('peach.local')` both resolved the correct address after restart. A second LAN device remains the final external check; no firewall or router rule was changed.- Stash: `127.0.0.1:9999`, PID observed as 35332.- Traffic monitor: running through `RM-TrafficWatch` from `R:\peach-app\.venv`; all probe/sheets tasks use the same project environment.- Runtime Python: 3.14.7. The removed system Python 3.12 invalidated the old venv, which was rebuilt and reverified before production start.-- Real ledger migrations: `0000`–`0006` applied; zero pending. Preference migration backup: `R:\peach-data\database\ledger.pre-migrate-20260815-000500.db`. It preserved 81,873 assets, passed `integrity_check`, and has zero foreign-key violations.+- Real ledger migrations: `0000`–`0007` applied; zero pending. The `0007` backup is `R:\peach-data\database\ledger.pre-migrate-20260815-013554.db`. It preserved 81,873 assets and 88,672 compatibility tag links, removed 298 reviewed structural creator links, passed `integrity_check`, and has zero foreign-key violations.- Current pre-0002 recovery point: `R:\peach-data\archive\ledger.pre-migrate-20260814-162004.db`.Runtime PIDs are observations, not configuration; always re-check them.@@ -37,18 +37,18 @@ Runtime PIDs are observations, not configuration; always re-check them.- Creator/studio top lists and related-item creator/tag/studio matching now read canonical entity relations. Real-ledger timings were 0.055 s for 28 top entries and 0.055 s for 24 related items.- Creator/studio filters, canonical-name search, creator index, facets and attribution stats now also read entity relations. Real-ledger timings were 0.040 s for a 1,545-item creator filter, 0.043 s for the first 60 creators, 0.132 s for facets and 0.394 s for stats.- Snapshot availability checks use the same strict legacy-prefix resolver as `/thumb`, so the front end requests migrated previews instead of displaying false “无预览” cards.-- 66 isolated tests pass under Python 3.14, including profile preference API/migration coverage and atomic/redacted automatic-handoff coverage. The current inline JavaScript also passes syntax validation.+- 75 isolated tests pass under Python 3.14, including profile preference, batch operations, client routes, duration range, structural creator cleanup and mDNS tunnel-route fallback. The current inline JavaScript also passes syntax validation.- Real migration preserved 81,873 assets and 59,697 tag links; both live database and backup passed `integrity_check` and `foreign_key_check` before later metadata writes.-- The shared responsive base previously passed desktop 1280×720 and mobile 390×844. The current preference slice was reverified at desktop 1280×720; its 390×844 visual rerun remains explicitly outstanding because the connected browser did not expose viewport emulation.+- The current slice passed isolated desktop 1280×720 and mobile 390×844 browser checks with zero horizontal overflow, all Lucide references resolved, no visible legacy length tags, and the mobile rail hidden.- Restarted production port 80 passed health, home, public OpenCode Go model discovery (26 models at verification time), canonical filtered-list/item reads, thumbnail `200` and 1 KiB `206 Partial Content` Range smoke checks.- After deleting the legacy server, restarted production also passed real `stats`, `tops` and `facets` aggregate contract checks.-- Optional SSL is supported with an explicit certificate/key pair. Production remains HTTP until a trusted local certificate is supplied.-- Immersive-mode actions now use optically centered 60 px controls with visible `不喜欢` / `看过` / `高潮` labels; the orgasm count is a corner badge and the watched state changes to `已看`.+- HTTPS is running on `192.168.50.162:443` with a local CA for `peach.local` and the LAN IP. The first generated CA lacked `keyUsage`; the script now emits critical CA constraints/key-sign usage and verifies the chain before install. Python/OpenSSL verification with the corrected CA passed. macOS/iOS clients must install only `peach-local-ca.crt` and explicitly trust it.+- Immersive-mode actions use the shared local Lucide set; visible labels are replaced by accessible names and hover titles where the surrounding context is sufficient.- Long-card hover now enlarges the card and exposes ±10-second preview seeking; short cards expose a profile-backed “稍后看” action. Item details show linked performers/studio/creator/series, and top performer/studio entries navigate to entity pages instead of mutating filters.- The interaction pass now delays long-card enlargement and ±10-second controls until five seconds of continuous hover; quick pointer movement only previews. Creator names on cards and details navigate directly to entity pages. “换一批” is a filled action, not a pressed sort filter, and bottom “再来 60 个” pagination is replaced by an intersection-driven continuation sentinel.- The desktop rail now prioritizes “全部艺人” and “全部标签” instead of duplicating “没看过/看过”; the drawer exposes the same destinations. The performer wall returned 600 entries and the tag cloud 173 in candidate verification. The statistics surface uses the shared card/grid language and no longer exposes a bottom load/refresh control.- Item details now expose an independent Like signal plus a private “为什么喜欢” text field. Migration `0006` stores both by profile in `asset_preference`; it does not overload `asset.feedback`, `watch_queue`, rating, or orgasm count. The original note is truth and AI may only propose separately reviewed taste facets later.-- The detail feedback surface now uses four equal icon controls; Like moved beside dislike/seen/dispose, while entering a reason implies Like and the separate oversized Like block is gone. The UI truthfully says the signal is recorded as a taste preference: its free-text semantics are not yet consumed by ranking.+- The detail feedback surface now uses one compact five-icon toolbar: Like, dislike, seen, Later and deletion candidate. Each has a semantic hover/active color, restrained motion, accessible label and hover explanation. “待删” explicitly means candidate-only; deletion still requires the reviewed CSV apply step. Orgasm count is a separate compact row. Entering a reason implies Like; its free-text semantics are not yet consumed by ranking.- Video cards now prefer canonical performer portraits over creator/studio crops, and the portrait itself opens the performer page. The same performer payload is attached to homepage, related and ad-review cards. Back controls share one aligned pill treatment; drawer navigation has a short reopen guard so the rail cannot immediately cover the destination page.- Five-second hover controls use consistent top-right circular rewind/forward/open actions, while short cards retain the immediate Later action. Homepage/filter/tag pills and studio icon treatments are now deliberately subdued instead of category-bright.- Official 115 (120 px PNG), PikPak (SVG), S1 and kawaii marks are cached with source sidecars and rendered centered in source filters/badges. The complete studio-logo audit now finds 28/114 canonical studios with a cached logo and 86 missing. Missing studios show initials rather than a misleading representative-work crop; online logo completion remains queued.@@ -56,9 +56,9 @@ Runtime PIDs are observations, not configuration; always re-check them.- FC2's 16×16 favicon was replaced by the official 102×43 asset and the user-provided Prestige logo was cached locally, both with provenance sidecars. Performer-image routing prefers a provenance-backed entity cache; Stash's default SVG silhouette is rejected rather than mislabeled as an HD portrait.- `scripts/import_stash_entities.py` reconciled the Stash public performer contract into Peach without making Stash authoritative: 383 exact stable refs, 52 aliases/search terms and two explicitly declared X links were imported. Of 42 non-placeholder Stash images, 14 passed the 512 px short-side gate and were cached with provenance; 28 smaller images were rejected. Top entries including 一个ren、高桥千凛 and 小桃 now use 720 px-class cached portraits.- Current production desktop verification passed home loading, 60 cards, item expansion, Like/reason controls and zero horizontal overflow. No real preference or playback data was written during this production browser check.-- The card-interaction deployment passed an isolated desktop candidate check for the detail controls, performer portrait navigation, aligned back action and drawer-close guard. Restarted production then loaded 78 visible cards, 12 performer-linked portraits, and the S1/kawaii marks without opening a video or writing feedback. The connected browser still has no supported 390×844 viewport control, so this slice's mobile visual rerun remains explicitly outstanding.+- The current isolated candidate passed desktop and 390×844 checks for detail identity rows, the five icon controls, 4 px progress bars, mobile overflow, route changes and hidden legacy length tags. The drawer remained closed at content x=120 and opened only after entering the actual 72 px rail. Five-second hover exposed the pinned Lucide rewind/forward/maximize controls only after the preview ring completed its delay.- The 20:36 Peach restart was launched only after verifying the port-80 command line in the host session. The replacement process can see CloudDrive: asset 4289 again passed `video/mp4` 1 KiB `206 Partial Content` and poster `200`; local asset 1 passed the same Range contract. A sandbox drive check is not authoritative.-- The mDNS regression fix remains deployed. Listener PID 12980 passed health, Windows hostname resolution and CloudDrive asset 4289 with a 1 KiB `206 Partial Content` response after the card-interaction deployment; both `A:` and `B:` were visible in the restart context.+- The mDNS regression fix remains deployed. Production explicitly advertises `192.168.50.162` while Zeroconf listens on all eligible interfaces; health and `Resolve-DnsName peach.local` returned that address after restart. No `lmd-dst.local` alias is published by Peach.- The original Peach process could not see CloudDrive `A:`/`B:` even though CloudDrive was running. After confirming zero copy tasks and no I/O, CloudDrive and Peach were restarted in the same execution context. Asset 4289 (`669.mp4`) then passed `video/mp4`, 1 KiB `206 Range`, thumbnail and generated-poster API checks. Drive-letter visibility differs by Windows token, so the HTTP stream check is the authoritative service test.## Batch jobs@@ -127,7 +127,7 @@ Runtime PIDs are observations, not configuration; always re-check them.- `scripts/find_ads.py` was converted from a one-off hard-coded script into an import-safe, configurable, read-only candidate scanner with isolated tests. Its 82-row generated review result remains unchanged; it still deletes nothing.- The reuse register and ADR-0010 record required mature dependencies, Peach-owned domain logic and old-to-current script successors. Production port 80 and the scheduled traffic watcher were both restarted onto the consolidated code.- Final API smoke checks passed `/healthz`, FTS search, local asset 1 Range and CloudDrive asset 4289 Range. No real playback/feedback rows were written by verification.-- Desktop 1280×720 is currently verified. The current slice's 390×844 visual rerun remains unverified due to unavailable viewport emulation; this is reported as a gap, not a pass.+- Desktop 1280×720 and mobile 390×844 are currently verified against an isolated copy of the database. Production HTTP/HTTPS/API checks are reported separately and never use feedback/play writes.## Next work@@ -138,24 +138,24 @@ Runtime PIDs are observations, not configuration; always re-check them.seconds point to `fansly.com/smuzillipussy`; do not persist the attribution without frame evidence.2. Finish visual identity quality: implement the deferred portrait scoring hierarchy (reviewed/public HDportrait → high-quality public portrait → face-aware crop from the most-watched work → sharp keyframe),- and source the 87 missing studio logos from official/public sources with provenance and quality gates.+ and source the 86 missing studio logos from official/public sources with provenance and quality gates.3. Add a Media Engine stream-plan endpoint and integrate hls.js or Shaka Player before enabling Stash HLS/DASH fallback in the browser.4. Configure/evaluate Stash CommunityScrapers and metadata providers before writing another source adapter.5. Add explicit feed configuration and reviewed import; only then use APScheduler. Add reviewed inference requests afterward, with AI output remaining candidates.-6. Move remaining legacy status/suggest/ledger application logic behind repository/application ports, then delete obsolete CLI surfaces.+6. Run a pre-release copy audit: replace or delete construction-stage explanatory prose, keeping only text that changes a decision, prevents data loss or explains an unfamiliar state. Then move remaining legacy status/suggest/ledger application logic behind repository/application ports and delete obsolete CLI surfaces.Claude project hooks now refresh the managed batch block on Stop, StopFailure and SessionEnd. Codex has no equivalent task-end project hook; its coordinator must keep the same STATUS/HANDOFF write contract manually. Hook verification used a synthetic event and a temporary document/state file; no prompt, response or token was persisted.-The preference UI candidate passed JavaScript parse, 66 isolated tests, API persistence and desktop 1280×720 browser behavior. The browser surface did not expose 390×844 viewport emulation for this pass, so the new preference block was not visually reverified at that width; its existing single-column breakpoint remains unchanged. Production was restarted from the host context that sees `A:`/`B:`. Port 80 then passed health, `peach.local -> 192.168.50.162`, the new item preference contract, and a 1 KiB `206 Partial Content` Range read for CloudDrive asset 4289. Candidate port 8900 was stopped.+The current UI/API candidate passed JavaScript parse, 75 isolated tests, desktop 1280×720 and mobile 390×844. Production HTTP, HTTPS and mDNS were restarted onto this code. HTTPS chain verification passed with the corrected local CA; browsing tests remained on the isolated candidate and did not write real playback, preference or feedback data.## 批处理进度(自动生成)<!-- job-status:start --><!-- 由 scripts/job_status.py 生成,勿手改;数字现算于账本与产物 -->-<!-- generated 2026-08-14T15:37Z -->+<!-- generated 2026-08-14T17:57Z -->-- 最近自动交接:`claude` / `Stop` / `completed`,2026-08-14T15:37:53+00:00。+- 最近自动交接:`claude` / `SessionEnd` / `other`,2026-08-14T17:57:39+00:00。- 资产 81873 条,其中视频 24980 条。- 待抽帧(可抽 / 缺时长待 probe / 合计):- `local`:4 / 1 / 5diff --git a/migrations/0007_remove_structural_creators.sql b/migrations/0007_remove_structural_creators.sqlnew file mode 100644index 000000000..f099eeb0c--- /dev/null+++ b/migrations/0007_remove_structural_creators.sql@@ -0,0 +1,17 @@+-- Remove three reviewed folder/category labels that the legacy importer flattened+-- into creator truth. Current scanners no longer infer creators from folders.+DELETE FROM asset_entity+WHERE entity_id IN (+ SELECT id FROM entity+ WHERE kind='creator' AND canonical_name IN ('门槛','视频','宣傳文件','宣传文件')+);++UPDATE asset+SET creator=(+ SELECT e.canonical_name+ FROM asset_entity ae JOIN entity e ON e.id=ae.entity_id+ WHERE ae.asset_id=asset.id AND e.kind='creator'+ ORDER BY ae.confidence DESC,e.canonical_name+ LIMIT 1+)+WHERE creator IN ('门槛','视频','宣傳文件','宣传文件');diff --git a/scripts/audit_creator_placeholders.py b/scripts/audit_creator_placeholders.pynew file mode 100644index 000000000..4ac7bc41e--- /dev/null+++ b/scripts/audit_creator_placeholders.py@@ -0,0 +1,76 @@+"""Audit legacy creator projections that look like folders/categories.++Read-only by default. The three ``remove`` verdicts were manually verified from+their paths; broader heuristics remain ``review`` and are never auto-applied.+"""+from __future__ import annotations++import argparse+import csv+import re+import sqlite3+import sys+from pathlib import Path++from peach.config import DATABASE_PATH+++REMOVE = {"门槛", "视频", "宣傳文件", "宣传文件"}+REVIEW = re.compile(+ r"(^|[ _-])(视频|文件|资源|合集|下载|会员|付费|试看|预览|宣传|宣傳|无水印|无码厂标)([ _-]|$)",+ re.IGNORECASE,+)+++def rows(database: Path) -> list[dict[str, object]]:+ connection = sqlite3.connect(f"file:{database.as_posix()}?mode=ro", uri=True)+ connection.row_factory = sqlite3.Row+ result = []+ for row in connection.execute(+ """+ SELECT e.canonical_name AS name,COUNT(DISTINCT ae.asset_id) AS assets,+ MIN(a.location) AS location,MIN(a.path) AS sample_path+ FROM entity e JOIN asset_entity ae ON ae.entity_id=e.id+ JOIN asset a ON a.id=ae.asset_id+ WHERE e.kind='creator'+ GROUP BY e.id,e.canonical_name+ ORDER BY assets DESC,e.canonical_name+ """+ ):+ name = row["name"]+ verdict = "remove" if name in REMOVE else ("review" if REVIEW.search(name) else "")+ if not verdict:+ continue+ result.append({+ "verdict": verdict,+ "name": name,+ "assets": row["assets"],+ "location": row["location"],+ "sample_path": row["sample_path"],+ "reason": "reviewed structural folder" if verdict == "remove" else "structural-name heuristic",+ })+ connection.close()+ return result+++def main() -> int:+ parser = argparse.ArgumentParser()+ parser.add_argument("--db", type=Path, default=DATABASE_PATH)+ parser.add_argument("--output", type=Path)+ args = parser.parse_args()+ findings = rows(args.db)+ fields = ("verdict", "name", "assets", "location", "sample_path", "reason")+ if not args.output and hasattr(sys.stdout, "reconfigure"):+ sys.stdout.reconfigure(encoding="utf-8")+ stream = args.output.open("w", encoding="utf-8-sig", newline="") if args.output else sys.stdout+ try:+ writer = csv.DictWriter(stream, fieldnames=fields)+ writer.writeheader(); writer.writerows(findings)+ finally:+ if args.output:+ stream.close()+ return 0+++if __name__ == "__main__":+ raise SystemExit(main())diff --git a/scripts/audit_studio_logos.py b/scripts/audit_studio_logos.pynew file mode 100644index 000000000..38726653c--- /dev/null+++ b/scripts/audit_studio_logos.py@@ -0,0 +1,67 @@+"""Export the canonical studio-logo completion queue without network writes."""+from __future__ import annotations++import argparse+import csv+import re+import sqlite3+from pathlib import Path++from peach.config import DATABASE_PATH, GENERATED_DIR+++def safe_name(name: str) -> str:+ return re.sub(r"[^A-Za-z0-9_-]", "_", name)[:60]+++def rows(database: Path, logo_root: Path) -> list[dict[str, object]]:+ connection = sqlite3.connect(f"file:{database.as_posix()}?mode=ro", uri=True)+ connection.row_factory = sqlite3.Row+ result: list[dict[str, object]] = []+ for row in connection.execute(+ """+ SELECT e.canonical_name AS studio,COUNT(DISTINCT ae.asset_id) AS assets+ FROM entity e LEFT JOIN asset_entity ae ON ae.entity_id=e.id+ WHERE e.kind='studio'+ GROUP BY e.id,e.canonical_name+ ORDER BY assets DESC,e.canonical_name+ """+ ):+ cached = logo_root / f"{safe_name(row['studio'])}.img"+ has_logo = cached.is_file()+ sidecar = Path(str(cached) + ".provenance.json")+ result.append({+ "status": "cached" if has_logo else "missing",+ "studio": row["studio"],+ "assets": row["assets"],+ "cache_path": str(cached),+ "has_provenance": sidecar.is_file(),+ "suggested_query": f"{row['studio']} official logo",+ "source_url": "",+ "review": "" if has_logo else "pending",+ "notes": "",+ })+ connection.close()+ return result+++def main() -> int:+ parser = argparse.ArgumentParser()+ parser.add_argument("--db", type=Path, default=DATABASE_PATH)+ parser.add_argument("--logo-root", type=Path, default=GENERATED_DIR / "logos")+ parser.add_argument("--output", type=Path, required=True)+ args = parser.parse_args()+ findings = rows(args.db, args.logo_root)+ args.output.parent.mkdir(parents=True, exist_ok=True)+ fields = ("status", "studio", "assets", "cache_path", "has_provenance",+ "suggested_query", "source_url", "review", "notes")+ with args.output.open("w", encoding="utf-8-sig", newline="") as stream:+ writer = csv.DictWriter(stream, fieldnames=fields)+ writer.writeheader(); writer.writerows(findings)+ cached = sum(row["status"] == "cached" for row in findings)+ print(f"studios={len(findings)} cached={cached} missing={len(findings)-cached} output={args.output}")+ return 0+++if __name__ == "__main__":+ raise SystemExit(main())diff --git a/scripts/setup_local_tls.ps1 b/scripts/setup_local_tls.ps1new file mode 100644index 000000000..a348251f5--- /dev/null+++ b/scripts/setup_local_tls.ps1@@ -0,0 +1,79 @@+[CmdletBinding()]+param(+ [string]$Address = '192.168.50.162',+ [string]$DnsName = 'peach.local',+ [string]$OutDir = 'R:\peach-data\secrets\tls',+ [switch]$TrustCurrentUser,+ [switch]$Force+)++$ErrorActionPreference = 'Stop'+$openssl = (Get-Command openssl -ErrorAction SilentlyContinue).Source+if (-not $openssl) {+ $bundled = 'C:\Program Files\Git\usr\bin\openssl.exe'+ if (Test-Path -LiteralPath $bundled -PathType Leaf) { $openssl = $bundled }+}+if (-not $openssl) { throw 'OpenSSL not found. Install it or use the Git for Windows bundle.' }++New-Item -ItemType Directory -Path $OutDir -Force | Out-Null+$caKey = Join-Path $OutDir 'peach-local-ca.key'+$caCert = Join-Path $OutDir 'peach-local-ca.crt'+$serverKey = Join-Path $OutDir 'peach.key'+$serverCert = Join-Path $OutDir 'peach.crt'+$request = Join-Path $OutDir 'peach.csr'+$extensions = Join-Path $OutDir 'peach-san.cnf'+$previousCaThumbprint = $null++if ($Force -and $TrustCurrentUser -and (Test-Path -LiteralPath $caCert -PathType Leaf)) {+ $previousCaThumbprint = ((& $openssl x509 -in $caCert -noout -fingerprint -sha1) -replace '^.*=', '') -replace ':', ''+}++$targets = @($caKey, $caCert, $serverKey, $serverCert, $request, $extensions)+if (-not $Force -and ($targets | Where-Object { Test-Path -LiteralPath $_ })) {+ throw 'TLS files already exist. Re-run with -Force only when rotating the local CA.'+}++@"+[server]+basicConstraints=critical,CA:FALSE+keyUsage=critical,digitalSignature,keyEncipherment+extendedKeyUsage=serverAuth+subjectAltName=DNS:$DnsName,IP:$Address+"@ | Set-Content -LiteralPath $extensions -Encoding ascii++& $openssl genrsa -out $caKey 3072+if ($LASTEXITCODE) { throw 'Failed to create local CA key.' }+& $openssl req -x509 -new -sha256 -key $caKey -out $caCert -days 3650 `+ -subj '/CN=Peach Local CA/O=Peach' `+ -addext 'basicConstraints=critical,CA:TRUE,pathlen:0' `+ -addext 'keyUsage=critical,keyCertSign,cRLSign' `+ -addext 'subjectKeyIdentifier=hash'+if ($LASTEXITCODE) { throw 'Failed to create local CA certificate.' }+& $openssl genrsa -out $serverKey 2048+if ($LASTEXITCODE) { throw 'Failed to create server key.' }+& $openssl req -new -sha256 -key $serverKey -out $request -subj "/CN=$DnsName/O=Peach"+if ($LASTEXITCODE) { throw 'Failed to create server request.' }+& $openssl x509 -req -sha256 -in $request -CA $caCert -CAkey $caKey -CAcreateserial `+ -out $serverCert -days 397 -extfile $extensions -extensions server+if ($LASTEXITCODE) { throw 'Failed to sign server certificate.' }++& $openssl verify -CAfile $caCert $serverCert | Out-Null+if ($LASTEXITCODE) { throw 'Generated certificate chain did not verify.' }++if ($TrustCurrentUser) {+ if ($previousCaThumbprint) {+ & certutil.exe -user -delstore Root $previousCaThumbprint | Out-Null+ }+ & certutil.exe -user -addstore Root $caCert | Out-Null+ if ($LASTEXITCODE) { throw 'Failed to trust Peach Local CA for the current Windows user.' }+}++$fingerprint = (& $openssl x509 -in $serverCert -noout -fingerprint -sha256) -replace '^.*=', ''+[pscustomobject]@{+ Certificate = $serverCert+ PrivateKey = $serverKey+ LocalCA = $caCert+ TrustedCurrentUser = [bool]$TrustCurrentUser+ Names = "$DnsName, $Address"+ SHA256Fingerprint = $fingerprint+}diff --git a/src/peach/api.py b/src/peach/api.pyindex e9346cc02..9220f4b5c 100644--- a/src/peach/api.py+++ b/src/peach/api.py@@ -64,7 +64,8 @@ def create_app(settings: PeachSettings | None = None) -> FastAPI:settings.avatar_root, settings.logo_root, settings.legacy_snapshot_roots,)mdns = create_mdns_publisher(- settings.mdns_name, settings.mdns_port, secure=settings.tls_enabled+ settings.mdns_name, settings.mdns_port, secure=settings.tls_enabled,+ address=settings.mdns_address,) if settings.mdns_enabled else Noneproviders = default_registry()opencode_go = OpenCodeGoClient(transport=http_transport)@@ -216,6 +217,16 @@ def create_app(settings: PeachSettings | None = None) -> FastAPI:response.headers["Cache-Control"] = "public, max-age=86400"return response+ @app.api_route("/item/{item_id}", methods=["GET", "HEAD"])+ @app.api_route("/entity/{kind}/{name:path}", methods=["GET", "HEAD"])+ @app.api_route("/performers", methods=["GET", "HEAD"])+ @app.api_route("/tags", methods=["GET", "HEAD"])+ @app.api_route("/stats", methods=["GET", "HEAD"])+ @app.api_route("/immerse", methods=["GET", "HEAD"])+ def client_route(request: Request, item_id: int | None = None,+ kind: str | None = None, name: str | None = None):+ return index(request)+@app.api_route("/entity-image", methods=["GET", "HEAD"])def entity_image(request: Request, kind: str, id: int):args = _first_query_values(request)diff --git a/src/peach/cli.py b/src/peach/cli.pyindex ca0c77fef..7d0d0e72e 100644--- a/src/peach/cli.py+++ b/src/peach/cli.py@@ -28,6 +28,7 @@ def _serve(args: argparse.Namespace) -> int:mdns_enabled=not args.no_mdns,mdns_name=args.mdns_name,mdns_port=args.port,+ mdns_address=args.mdns_address,tls_enabled=tls_enabled,)uvicorn.run(@@ -68,6 +69,7 @@ def build_parser() -> argparse.ArgumentParser:serve.add_argument("--docs", action="store_true")serve.add_argument("--no-mdns", action="store_true")serve.add_argument("--mdns-name", default="peach")+ serve.add_argument("--mdns-address", help="explicit LAN IPv4 to publish")serve.add_argument("--ssl-certfile", type=Path)serve.add_argument("--ssl-keyfile", type=Path)serve.set_defaults(handler=_serve)diff --git a/src/peach/config.py b/src/peach/config.pyindex 752a3ba12..67d5a42b1 100644--- a/src/peach/config.py+++ b/src/peach/config.py@@ -28,6 +28,7 @@ class PeachSettings:mdns_enabled: bool = Falsemdns_name: str = "peach"mdns_port: int = 80+ mdns_address: str | None = Nonetls_enabled: bool = Falseallowed_media_roots: tuple[Path, ...] = (Path(r"R:\media"), Path("B:/"), Path("A:/"))snapshot_root: Path = GENERATED_DIR / "snapshots"diff --git a/src/peach/mdns.py b/src/peach/mdns.pyindex faaaf562a..9967ba2d5 100644--- a/src/peach/mdns.py+++ b/src/peach/mdns.py@@ -1,6 +1,7 @@from __future__ import annotationsimport socket+import ipaddressfrom collections.abc import Callablefrom zeroconf import ServiceInfo, Zeroconf@@ -22,9 +23,36 @@ def lan_ipv4() -> str:sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)try:sock.connect(("192.0.2.1", 80))- return str(sock.getsockname()[0])+ routed = str(sock.getsockname()[0])finally:sock.close()+ benchmark = ipaddress.ip_network("198.18.0.0/15")+ if ipaddress.ip_address(routed) not in benchmark:+ return routed+ # Full-tunnel proxies may own the default route. Fall back to host interfaces,+ # rejecting the benchmarking range used by Mihomo and obvious host-only endpoints.+ candidates = []+ for value in socket.gethostbyname_ex(socket.gethostname())[2]:+ address = ipaddress.ip_address(value)+ if not isinstance(address, ipaddress.IPv4Address) or address in benchmark:+ continue+ if address.is_loopback or address.is_link_local or address.is_unspecified:+ continue+ prefix_score = 3 if value.startswith("192.168.") else (2 if value.startswith("10.") else 1)+ endpoint_score = 0 if int(value.rsplit(".", 1)[1]) in {1, 2} else 1+ candidates.append((prefix_score, endpoint_score, value))+ if not candidates:+ raise RuntimeError("no publishable LAN IPv4 address; pass --mdns-address")+ return max(candidates)[2]+++def _explicit_resolver(address: str) -> Callable[[], str]:+ parsed = ipaddress.ip_address(address)+ if not isinstance(parsed, ipaddress.IPv4Address):+ raise ValueError("mDNS address must be IPv4")+ if parsed.is_loopback or parsed.is_multicast or parsed.is_unspecified:+ raise ValueError("mDNS address must be a publishable interface IPv4")+ return lambda: str(parsed)class MdnsPublisher:@@ -96,5 +124,8 @@ class MdnsPublisher:self.status = "stopped"-def create_mdns_publisher(name: str, port: int, secure: bool = False) -> MdnsPublisher:- return MdnsPublisher(name, port, secure=secure)+def create_mdns_publisher(+ name: str, port: int, secure: bool = False, address: str | None = None,+) -> MdnsPublisher:+ resolver = _explicit_resolver(address) if address else lan_ipv4+ return MdnsPublisher(name, port, secure=secure, address_resolver=resolver)diff --git a/src/peach/web_contract.py b/src/peach/web_contract.pyindex 99658caac..ce6c5b5fd 100644--- a/src/peach/web_contract.py+++ b/src/peach/web_contract.py@@ -108,7 +108,7 @@ def q_items(contract: WebContract, args):"WHERE ae.asset_id=a.id AND e.kind='series' AND e.canonical_name=?)"); par.append(args["series"])if args.get("tag"):- # 逗号分隔 = 组合筛选,全部满足(Beeg 的 /PinkLoving+Anal)+ # 逗号分隔 = 组合筛选,全部满足。for tg in [x for x in args["tag"].split(",") if x]:where.append("(EXISTS(SELECT 1 FROM asset_entity ae JOIN entity e ON e.id=ae.entity_id "@@ -118,6 +118,10 @@ def q_items(contract: WebContract, args):par.extend((tg, tg))if args.get("len"):where.append("a.ctx_length = ?"); par.append(args["len"])+ if args.get("dur_min"):+ where.append("a.duration >= ?"); par.append(max(0, float(args["dur_min"])))+ if args.get("dur_max"):+ where.append("a.duration <= ?"); par.append(max(0, float(args["dur_max"])))if args.get("orient"):where.append("a.ctx_orient = ?"); par.append(args["orient"])if args.get("q"):@@ -281,20 +285,25 @@ def q_item(contract: WebContract, aid):"SELECT tag FROM asset_tag WHERE asset_id=? ORDER BY tag", (aid,),)]canonical = list(c.execute(- "SELECT DISTINCT e.kind,e.canonical_name FROM asset_entity ae "+ "SELECT DISTINCT e.id,e.kind,e.canonical_name FROM asset_entity ae ""JOIN entity e ON e.id=ae.entity_id WHERE ae.asset_id=? ""AND e.kind IN ('tag','performer','creator','studio','series') ""ORDER BY e.kind,e.canonical_name", (aid,),))- canonical_tags = [name for kind, name in canonical if kind == "tag"]- canonical_performers = [name for kind, name in canonical if kind == "performer"]+ canonical_tags = [name for _, kind, name in canonical if kind == "tag"]+ canonical_performers = [name for _, kind, name in canonical if kind == "performer"]tags = canonical_tags or [tag for tag in legacy if not tag.startswith("演员:")]- d["tags"] = [{"k": tag, "cat": tag_cat(tag)} for tag in tags]+ d["tags"] = [{"k": tag, "cat": tag_cat(tag)} for tag in tags if tag not in LENGTH_TAGS]d["performers"] = canonical_performers or [tag[3:] for tag in legacy if tag.startswith("演员:")]d["entities"] = {- kind: [name for item_kind, name in canonical if item_kind == kind]+ kind: [name for _, item_kind, name in canonical if item_kind == kind]+ for kind in ("creator", "performer", "studio", "series")+ }+ d["entity_refs"] = {+ kind: [{"id": entity_id, "name": name}+ for entity_id, item_kind, name in canonical if item_kind == kind]for kind in ("creator", "performer", "studio", "series")}if d["entities"]["creator"]:@@ -307,9 +316,10 @@ def q_item(contract: WebContract, aid):d.pop("snapshot_path", None); d.pop("path", None)return d-# ── 标签分级(配色用,参考 rule34 的分类着色)──+# ── 标签语义分级 ──+LENGTH_TAGS = {"短片-2分内", "中片-10分内", "长片-30分内", "超长片"}TECH_TAGS = {"1080P", "720P", "4K", "2K", "2160P", "480P", "低画质", "高帧率",- "短片-2分内", "中片-10分内", "长片-30分内", "超长片", "横屏", "竖屏",+ "横屏", "竖屏","真人", "混合集", "身份待确认", "R-18", "有码", "无码"}COPYRIGHT_HINT = re.compile(r"(ブルーアーカイブ|崩壊|崩坏|原神|勝利の女神|NIKKE|アークナイツ|明日方舟|"@@ -317,8 +327,9 @@ COPYRIGHT_HINT = re.compile(r"サイバーパンク|Honkai|Genshin|Blue Archive|VTuber|hololive|にじさんじ)", re.I)def tag_cat(t):- """rule34 式分级:meta 规格 / artist 创作者 / character 角色 / copyright 作品 / general 内容"""+ """meta 规格 / artist 创作者 / character 角色 / copyright 作品 / general 内容。"""if t.startswith("演员:"): return "artist"+ if t in LENGTH_TAGS: return "meta"if t in TECH_TAGS: return "meta"if COPYRIGHT_HINT.search(t): return "copyright"if re.search(r"(ちゃん|さん|酱|娘)$", t) and len(t) <= 8: return "character"@@ -637,7 +648,7 @@ def q_facets(contract: WebContract):# 标签要分层 —— 原来一锅端,结果「演员:一个ren」和「1080P」「足交」混在一起。# 三类分开:技术规格(画质/时长/画幅,筛选价值低)、内容维度(真正有用的)、演员(另立一栏)。TECH = ("1080P", "720P", "4K", "2160P", "480P", "低画质", "高帧率",- "短片-2分内", "中片-10分内", "长片-30分内", "超长片", "横屏", "竖屏",+ "横屏", "竖屏","真人", "混合集", "身份待确认", "R-18")rows = [dict(r) for r in c.execute("SELECT e.canonical_name AS k, count(DISTINCT ae.asset_id) AS n "@@ -645,7 +656,7 @@ def q_facets(contract: WebContract):"JOIN asset a ON a.id=ae.asset_id WHERE a.medium='video' AND e.kind='tag' ""GROUP BY e.id,e.canonical_name ORDER BY n DESC LIMIT 400")]out["tags"] = [dict(r, cat=tag_cat(r["k"])) for r in rows- if r["k"] not in TECH][:44]+ if r["k"] not in TECH and r["k"] not in LENGTH_TAGS][:44]out["tech"] = [r for r in rows if r["k"] in TECH][:14]out["tagperformers"] = [dict(r) for r in c.execute("SELECT e.canonical_name AS k,count(DISTINCT ae.asset_id) AS n "@@ -794,6 +805,54 @@ def w_preference(contract: WebContract, body):"like_reason": row["reason"] if row else ""}+def w_batch(contract: WebContract, body):+ """Apply one explicit, reversible marker to a bounded selected set."""+ raw_ids = body.get("ids")+ if not isinstance(raw_ids, list):+ raise TypeError("ids must be a list")+ ids = list(dict.fromkeys(int(item) for item in raw_ids))+ if not ids or len(ids) > 200:+ raise ValueError("batch requires 1 to 200 assets")+ operation = body.get("operation")+ if operation not in {"like", "seen", "later", "dispose"}:+ raise ValueError("unsupported batch operation")+ marks = ",".join("?" * len(ids))+ contract.cache_bust()+ with contract.write_lock:+ connection = contract.db(write=True)+ found = connection.execute(+ f"SELECT id FROM asset WHERE id IN ({marks})", ids,+ ).fetchall()+ valid_ids = [row["id"] for row in found]+ if not valid_ids:+ connection.close()+ raise ValueError("assets not found")+ now = time.time()+ if operation in {"seen", "dispose"}:+ column, value = ("feedback", "seen") if operation == "seen" else ("disposal", "pending")+ placeholders = ",".join("?" * len(valid_ids))+ connection.execute(+ f"UPDATE asset SET {column}=?,feedback_at=? WHERE id IN ({placeholders})",+ [value, now, *valid_ids],+ )+ elif operation == "later":+ connection.executemany(+ "INSERT OR IGNORE INTO watch_queue(profile_id,asset_id,added_at,source) "+ "VALUES('local-default',?,strftime('%Y-%m-%dT%H:%M:%fZ','now'),'web-batch')",+ [(asset_id,) for asset_id in valid_ids],+ )+ else:+ connection.executemany(+ "INSERT INTO asset_preference(profile_id,asset_id,liked,reason,source,updated_at) "+ "VALUES('local-default',?,1,'','web-batch',strftime('%Y-%m-%dT%H:%M:%fZ','now')) "+ "ON CONFLICT(profile_id,asset_id) DO UPDATE SET liked=1,source='web-batch',"+ "updated_at=excluded.updated_at",+ [(asset_id,) for asset_id in valid_ids],+ )+ connection.commit(); connection.close()+ return {"ok": True, "operation": operation, "changed": len(valid_ids)}++def dispatch_api_get(contract: WebContract, path, args):"""Dispatch the stable JSON read contract used by the current web client."""if path == "/api/items":@@ -829,4 +888,6 @@ def dispatch_api_post(contract: WebContract, path, body):return w_watch_later(contract, body)if path == "/api/preference":return w_preference(contract, body)+ if path == "/api/batch":+ return w_batch(contract, body)raise KeyError(path)diff --git a/tests/test_fastapi_api.py b/tests/test_fastapi_api.pyindex da20ef267..76f1ad955 100644--- a/tests/test_fastapi_api.py+++ b/tests/test_fastapi_api.py@@ -190,6 +190,14 @@ class FastApiContractTests(unittest.IsolatedAsyncioTestCase):self.assertIn("tok=secret", cookie)self.assertIn("HttpOnly", cookie)+ async def test_client_routes_serve_the_single_page_surface(self):+ await self.client.get("/?t=secret")+ for path in ("/item/1", "/entity/performer/Alice", "/performers",+ "/tags", "/stats", "/immerse"):+ response = await self.client.get(path)+ self.assertEqual(response.status_code, 200, path)+ self.assertIn("Peach test", response.text)+async def test_standard_range_and_head_contract(self):headers = {"X-Token": "secret"}full = await self.client.get("/stream?id=1", headers=headers)diff --git a/tests/test_mdns.py b/tests/test_mdns.pyindex 02bb25266..26c665d83 100644--- a/tests/test_mdns.py+++ b/tests/test_mdns.py@@ -1,7 +1,7 @@import unittest-from unittest.mock import patch+from unittest.mock import MagicMock, patch-from peach.mdns import MdnsPublisher, create_mdns_publisher+from peach.mdns import MdnsPublisher, create_mdns_publisher, lan_ipv4class MdnsPublisherTests(unittest.TestCase):@@ -42,6 +42,27 @@ class MdnsPublisherTests(unittest.TestCase):def test_factory_uses_verified_zeroconf_backend(self):self.assertIsInstance(create_mdns_publisher("peach", 80), MdnsPublisher)+ def test_explicit_address_avoids_tunnel_route(self):+ with patch("peach.mdns.Zeroconf") as zeroconf_type:+ publisher = create_mdns_publisher(+ "peach", 80, address="192.168.50.162",+ )+ publisher.start()+ self.assertEqual(publisher.address, "192.168.50.162")+ publisher.stop()+ zeroconf_type.assert_called_once_with()++ def test_tunnel_route_falls_back_to_real_host_interface(self):+ fake_socket = MagicMock()+ fake_socket.getsockname.return_value = ("198.18.0.1", 50000)+ with patch("peach.mdns.socket.socket", return_value=fake_socket), patch(+ "peach.mdns.socket.gethostname", return_value="host",+ ), patch(+ "peach.mdns.socket.gethostbyname_ex",+ return_value=("host", [], ["172.31.112.1", "192.168.56.1", "192.168.50.162"]),+ ):+ self.assertEqual(lan_ipv4(), "192.168.50.162")+if __name__ == "__main__":unittest.main()diff --git a/tests/test_migrations.py b/tests/test_migrations.pyindex 04ed19505..b3c1c54ba 100644--- a/tests/test_migrations.py+++ b/tests/test_migrations.py@@ -24,7 +24,7 @@ class MigrationTests(unittest.TestCase):backup = self.root / "before.db"done = upgrade(self.db, MIGRATIONS, backup)self.assertEqual([m.version for m in done],- ["0000", "0001", "0002", "0003", "0004", "0005", "0006"])+ ["0000", "0001", "0002", "0003", "0004", "0005", "0006", "0007"])self.assertTrue(backup.exists())con = sqlite3.connect(self.db)tables = {row[0] for row in con.execute(@@ -39,7 +39,7 @@ class MigrationTests(unittest.TestCase):"entity_external_ref", "asset_entity", "entity_link","entity_search_term", "watch_queue", "asset_preference", "asset_search","schema_migration"} <= tables)- self.assertEqual(versions, ["0000", "0001", "0002", "0003", "0004", "0005", "0006"])+ self.assertEqual(versions, ["0000", "0001", "0002", "0003", "0004", "0005", "0006", "0007"])self.assertEqual(upgrade(self.db, MIGRATIONS), [])self.assertEqual(plan(self.db, MIGRATIONS)[1], [])@@ -147,6 +147,37 @@ class MigrationTests(unittest.TestCase):self.assertIn('足交', search_entities)self.assertIn('Late Performer', search_entities)+ def test_structural_creator_cleanup_keeps_real_creator(self):+ base_migrations = self.root / "base-migrations"+ base_migrations.mkdir()+ for path in sorted(MIGRATIONS.glob("*.sql")):+ if not path.name.startswith("0007_"):+ shutil.copyfile(path, base_migrations / path.name)+ sqlite3.connect(self.db).close()+ upgrade(self.db, base_migrations)+ connection = sqlite3.connect(self.db)+ connection.executescript("""+ INSERT INTO asset(id,location,path,name,medium,creator)+ VALUES(1,'115','B:/xxr/门槛/one.mp4','one.mp4','video','门槛');+ INSERT INTO entity(id,kind,canonical_name,normalized_name,created_at,updated_at)+ VALUES(101,'creator','门槛','门槛','now','now'),+ (102,'creator','Actual Creator','actual creator','now','now');+ INSERT INTO asset_entity(asset_id,entity_id,role,source,confidence)+ VALUES(1,101,'creator','legacy:asset',0.8),+ (1,102,'creator','reviewed',1.0);+ """)+ connection.close()+ upgrade(self.db, MIGRATIONS)+ connection = sqlite3.connect(self.db)+ self.assertEqual(connection.execute(+ "SELECT creator FROM asset WHERE id=1"+ ).fetchone()[0], "Actual Creator")+ self.assertEqual(connection.execute(+ "SELECT e.canonical_name FROM asset_entity ae JOIN entity e ON e.id=ae.entity_id "+ "WHERE ae.asset_id=1 AND e.kind='creator'"+ ).fetchall(), [("Actual Creator",)])+ connection.close()+def test_fts_tracks_asset_entity_alias_and_search_term_changes(self):sqlite3.connect(self.db).close()upgrade(self.db, MIGRATIONS)diff --git a/tests/test_rm_web.py b/tests/test_rm_web.pyindex 6998ad03c..68672f2b9 100644--- a/tests/test_rm_web.py+++ b/tests/test_rm_web.py@@ -143,6 +143,27 @@ class WebDataTests(unittest.TestCase):self.assertNotIn("path", result["items"][0])self.assertNotIn("snapshot_path", result["items"][0])+ def test_items_support_duration_range(self):+ result = rm_web.q_items(+ self.contract, {"dur_min": "90", "dur_max": "110", "limit": "10"},+ )+ self.assertEqual([item["id"] for item in result["items"]], [1])++ def test_legacy_length_tags_are_hidden_in_favor_of_numeric_minutes(self):+ con = sqlite3.connect(self.db_path)+ con.execute(+ "INSERT INTO entity(id,kind,canonical_name,normalized_name) VALUES(14,'tag','短片-2分内','短片-2分内')"+ )+ con.execute(+ "INSERT INTO asset_entity(asset_id,entity_id,role,source,confidence) "+ "VALUES(1,14,'tag','test',1.0)"+ )+ con.commit(); con.close()+ self.assertNotIn("短片-2分内", [tag["k"] for tag in rm_web.q_item(self.contract, 1)["tags"]])+ facets = rm_web.q_facets(self.contract)+ visible = {row["k"] for row in facets["tags"] + facets["tech"]}+ self.assertNotIn("短片-2分内", visible)+def test_activity_accumulates_real_play_time_and_max_position(self):first = rm_web.w_activity(self.contract, {"id": 1, "position": 50, "duration": 100, "delta": 12, "seeks": 2,@@ -177,6 +198,9 @@ class WebDataTests(unittest.TestCase):item = rm_web.q_item(self.contract, 1)self.assertTrue(item["liked"])self.assertEqual(item["like_reason"], "喜欢自然的节奏和镜头")+ self.assertEqual(item["entity_refs"]["performer"], [+ {"id": 11, "name": "Canonical Alice"},+ ])self.assertIsNone(self.row()["feedback"])cleared = rm_web.w_preference(self.contract, {@@ -190,6 +214,16 @@ class WebDataTests(unittest.TestCase):self.assertEqual(self.contract.cached("same", lambda: "first"), "first")self.assertEqual(other.cached("same", lambda: "second"), "second")+ def test_batch_markers_are_bounded_and_preserve_like_reason(self):+ rm_web.w_preference(self.contract, {"id": 1, "liked": False, "reason": "保留原文"})+ result = rm_web.w_batch(self.contract, {"ids": [1, 2, 2], "operation": "like"})+ self.assertEqual(result["changed"], 2)+ self.assertEqual(rm_web.q_item(self.contract, 1)["like_reason"], "保留原文")+ rm_web.w_batch(self.contract, {"ids": [1, 2], "operation": "dispose"})+ self.assertEqual(self.row(1)["disposal"], "pending")+ with self.assertRaises(ValueError):+ rm_web.w_batch(self.contract, {"ids": list(range(201)), "operation": "seen"})+def test_top_lists_and_related_items_use_canonical_entities(self):tops = rm_web.q_tops(self.contract, 10)self.assertEqual(tops["performers"][0]["k"], "Canonical Alice")diff --git a/tests/test_scripts.py b/tests/test_scripts.pyindex 96382ddf1..a2fec22db 100644--- a/tests/test_scripts.py+++ b/tests/test_scripts.py@@ -86,6 +86,32 @@ class OperationalScriptTests(unittest.TestCase):self.assertFalse(self.traffic_watch.is_direct({"chains": ["Proxy", "Relay"]}))self.assertEqual(self.creator_boards.safe_name("A/B:C"), "A_B_C")+ def test_probe_never_records_an_unknown_duration_as_zero(self):+ """0 会同时躲过 probe 的 `duration IS NULL` 和抽帧的 `duration>2`,永久卡住。"""+ module = self.probe++ class _Empty:+ stdout = b'{"format":{},"streams":[{"width":0,"height":0}]}'++ original = module.subprocess.run+ module.subprocess.run = lambda *args, **kwargs: _Empty()+ try:+ duration, width, height, codec, fps, audio = module.probe_file("ffprobe", "x.mp4")+ finally:+ module.subprocess.run = original+ self.assertEqual(duration, -1.0)+ self.assertEqual((width, height, codec), (0, 0, None))+ self.assertEqual(module.context_fields(width, height, duration), (None, None, None))++ def test_probe_redo_separates_unprobed_from_failed(self):+ selection = self.probe.duration_selection+ self.assertEqual(selection("none"), "duration IS NULL")+ self.assertEqual(selection("zero"), "(duration IS NULL OR duration=0)")+ self.assertEqual(selection("failed"), "(duration IS NULL OR duration<0)")+ self.assertEqual(selection("all"), "(duration IS NULL OR duration<=0)")+ self.assertEqual(self.probe.build_parser().parse_args([]).redo, "none")+ self.assertEqual(self.probe.build_parser().parse_args(["--redo", "zero"]).redo, "zero")+def test_code_normalization(self):normalise = self.scrape_codes.normaliseself.assertEqual(normalise("fc2ppv-1234567"), "FC2-PPV-1234567")diff --git a/web/index.html b/web/index.htmlindex d07429450..b5d1bfd4f 100644--- a/web/index.html+++ b/web/index.html@@ -33,9 +33,6 @@*,*::before,*::after{box-sizing:border-box}html,body{margin:0;padding:0}body{background:var(--ground);color:var(--ink);- background-image:radial-gradient(1200px 420px at 30% -80px,- color-mix(in srgb,var(--tungsten) 13%,transparent), transparent 70%);- background-attachment:fixed;font-family:Roboto,"Segoe UI Variable Text","Segoe UI","Microsoft YaHei UI","PingFang SC",sans-serif;font-size:14px;line-height:1.45;-webkit-font-smoothing:antialiased}.disp{font-family:Bahnschrift,"Segoe UI Variable Display","Microsoft YaHei UI",sans-serif;@@ -62,12 +59,11 @@ button,input,textarea{font:inherit;color:inherit}/* ── 顶栏:无侧栏,图占主导 ── */.top{position:sticky;top:0;z-index:70;display:flex;align-items:center;gap:12px;height:var(--topH);padding:0 16px;border-bottom:1px solid var(--line-soft);- background:color-mix(in srgb,var(--ground) 72%,transparent);- backdrop-filter:saturate(1.8) blur(20px);-webkit-backdrop-filter:saturate(1.8) blur(20px)}-.ib{background:none;border:0;border-radius:9999px;cursor:pointer;width:40px;height:40px;+ background:var(--ground)}+.ib{background:none;border:0;border-radius:8px;cursor:pointer;width:40px;height:40px;flex:none;display:inline-flex;align-items:center;justify-content:center;color:var(--ink-2);padding:0;line-height:0;transition:background .12s,color .12s}-.ib svg{width:21px;height:21px;stroke:currentColor;fill:none;stroke-width:1.8;+.ib svg{width:21px;height:21px;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;display:block}.ib:hover{color:var(--ink);background:var(--hover)}.ib[aria-pressed="true"]{color:var(--tungsten);background:var(--tungsten-soft)}@@ -80,6 +76,7 @@ button,input,textarea{font:inherit;color:inherit}background:var(--surface);border:1px solid var(--line);border-radius:9999px;padding:8px 16px}.search:focus-within{border-color:var(--tungsten)}.search input{flex:1;min-width:0;background:none;border:0;outline:none;font-size:15px}+.search>svg{width:21px;height:21px;flex:none;stroke:var(--muted);fill:none;stroke-width:1.8;stroke-linecap:round}.readout{display:flex;gap:20px;flex:none;align-items:center}.readout div{display:flex;flex-direction:column;line-height:1.3;align-items:flex-start}.readout b{font-size:15px;font-weight:600;font-variant-numeric:tabular-nums}@@ -88,8 +85,7 @@ button,input,textarea{font:inherit;color:inherit}/* ── 顶部三层:女优圆头像 / 厂牌 / 内容标签 ── */.tiers{position:relative;z-index:1;padding:10px 0 8px;border-bottom:1px solid var(--line-soft);- background:color-mix(in srgb,var(--ground) 72%,transparent);- backdrop-filter:saturate(1.8) blur(20px);-webkit-backdrop-filter:saturate(1.8) blur(20px)}+ background:var(--ground)}.tier{display:flex;gap:14px;overflow-x:auto;scrollbar-width:none;padding:0 16px 8px;align-items:flex-start}.tier::-webkit-scrollbar{display:none}.tier:last-child{padding-bottom:2px}@@ -106,8 +102,8 @@ button,input,textarea{font:inherit;color:inherit}text-overflow:ellipsis;white-space:nowrap;max-width:76px}.av[aria-pressed="true"] .nm{color:var(--tungsten)}/* 二层:厂牌大药丸 */-.brandpill{flex:none;display:flex;align-items:center;gap:8px;padding:6px 16px 6px 6px;- border-radius:9999px;background:var(--surface);border:1px solid var(--line);cursor:pointer;+.brandpill{flex:none;display:flex;align-items:center;gap:8px;padding:6px 14px 6px 6px;+ border-radius:9px;background:var(--surface);border:1px solid var(--line);cursor:pointer;font-size:14px;white-space:nowrap}.brandpill:hover{border-color:var(--tungsten)}.brandpill[aria-pressed="true"]{border-color:var(--tungsten);background:var(--tungsten-soft)}@@ -121,12 +117,11 @@ button,input,textarea{font:inherit;color:inherit}.tagbar{position:sticky;top:var(--topH);z-index:61;padding:9px 16px;transition:transform .22s ease, opacity .22s ease;border-bottom:1px solid var(--line-soft);- background:color-mix(in srgb,var(--ground) 72%,transparent);- backdrop-filter:saturate(1.8) blur(20px);-webkit-backdrop-filter:saturate(1.8) blur(20px);+ background:var(--ground);display:flex;gap:7px;overflow-x:auto;scrollbar-width:none;align-items:center}.tagbar::-webkit-scrollbar{display:none}.pill{flex:none;padding:7px 15px;border:1px solid color-mix(in srgb,var(--line) 82%,transparent);- border-radius:9999px;background:color-mix(in srgb,var(--surface) 78%,var(--ground));+ border-radius:8px;background:var(--surface);color:var(--ink-2);cursor:pointer;font-size:13px;white-space:nowrap}.pill:hover{border-color:var(--ink-2);color:var(--ink)}.pill[aria-pressed="true"]{background:var(--ink-2);color:var(--ground);border-color:var(--ink-2)}@@ -135,7 +130,7 @@ button,input,textarea{font:inherit;color:inherit}/* 向下滚时把标签条收起来,别和顶栏一起压住内容;向上滚立刻带回来 */.tagbar.tuck{transform:translateY(-140%);opacity:0;pointer-events:none}-/* 组合筛选条(Beeg 的 /PinkLoving+Anal) */+/* 多标签交集筛选条 */.combo{display:flex;flex-wrap:wrap;gap:6px;align-items:center;margin:0 0 10px}.combo .cb{display:inline-flex;align-items:center;gap:6px;padding:4px 8px 4px 11px;border-radius:15px;border:1px solid var(--tungsten);color:var(--tungsten);@@ -170,9 +165,9 @@ button,input,textarea{font:inherit;color:inherit}.index .ihead h2{margin:0;font-size:20px}.index .ihead .isearch{margin-left:auto}.backbtn{width:auto;min-width:92px;height:40px;padding:0 14px;border:1px solid var(--line);- border-radius:999px;background:var(--surface);display:inline-flex;align-items:center;+ border-radius:8px;background:var(--surface);display:inline-flex;align-items:center;justify-content:center;gap:8px;cursor:pointer;color:var(--ink-2);white-space:nowrap;line-height:1}-.backbtn svg{width:18px;height:18px;stroke:currentColor;fill:none;stroke-width:1.9;+.backbtn svg{width:18px;height:18px;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;flex:none}.backbtn:hover{border-color:var(--ink-2);color:var(--ink);background:var(--hover)}.index .isearch{flex:1;max-width:320px;background:var(--sunk);border:1px solid var(--line);@@ -197,7 +192,7 @@ button,input,textarea{font:inherit;color:inherit}.entityportrait img{width:100%;height:100%;object-fit:cover;display:block}.entityhero h2{font-size:27px;margin:0 0 5px}.entityhero .alias{color:var(--muted);margin-bottom:14px}.entitysummary{line-height:1.75;max-width:820px}.entitylinks{display:flex;flex-wrap:wrap;gap:7px;margin-top:15px}-.entitylinks a,.entitylinks span{border:1px solid var(--line);border-radius:99px;padding:6px 12px;+.entitylinks a,.entitylinks span{border:1px solid var(--line);border-radius:7px;padding:6px 10px;font-size:12px;text-decoration:none;color:var(--ink)}.entitylinks a:hover{border-color:var(--tungsten);color:var(--tungsten)}.entitylinks .private{color:var(--muted);border-style:dashed}@@ -210,7 +205,7 @@ button,input,textarea{font:inherit;color:inherit}main{padding:14px 16px 90px}.count{color:var(--ink-2);margin:0 0 12px;display:flex;align-items:center;gap:10px;flex-wrap:wrap}.count .sorts{display:flex;gap:5px;margin-left:auto;flex-wrap:wrap}-.count .sorts button{padding:4px 11px;border:1px solid var(--line);border-radius:99px;+.count .sorts button{padding:5px 11px;border:1px solid var(--line);border-radius:7px;background:transparent;cursor:pointer;font-size:12px;color:var(--ink-2)}.count .sorts button:hover{border-color:var(--tungsten);color:var(--ink)}.count .sorts button[aria-pressed="true"]{background:var(--tungsten-soft);@@ -221,6 +216,9 @@ main{padding:14px 16px 90px}.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(var(--tile),1fr));gap:16px 8px}.card{cursor:pointer;display:flex;flex-direction:column;gap:8px;min-width:0;position:relative;transition:transform .18s ease,filter .18s ease;transform-origin:center}+.card.selected .pic{box-shadow:0 0 0 3px var(--tungsten)}+.card.selected::after{content:'✓';position:absolute;top:8px;left:8px;z-index:7;width:27px;height:27px;border-radius:50%;+ display:grid;place-items:center;background:var(--tungsten);color:#15110b;font-weight:800;border:2px solid #fff}.pic{position:relative;aspect-ratio:16/9;background:#000;border-radius:4px;overflow:hidden;display:flex;align-items:center;justify-content:center}/* 预览图:单格,contain 放进固定 16:9 框 —— 不拉伸、不裁切、不改框体大小 */@@ -234,22 +232,33 @@ main{padding:14px 16px 90px}@media (hover:hover) and (pointer:fine){.card.longhover{transform:translateY(-7px) scale(1.065);z-index:8;filter:brightness(1.04)}}-.hovertools{position:absolute;z-index:4;display:flex;align-items:center;gap:8px;- opacity:0;transition:opacity .16s;pointer-events:none}-.card.longhover .hovertools,.card.scard:hover .hovertools{opacity:1}-.hovertools.seektools{top:10px;right:10px}-.hovertools button{pointer-events:auto;width:48px;height:48px;border-radius:50%;border:1px solid #FFFFFF3D;- background:#252525C7;color:#fff;backdrop-filter:blur(12px);display:flex;align-items:center;- justify-content:center;cursor:pointer;box-shadow:0 8px 24px #0008;position:relative}+.hovertools{position:absolute;z-index:4;display:flex;align-items:center;gap:14px;+ opacity:0;transition:opacity .15s;pointer-events:none}+.card.longhover .seektools,.card:hover .later-tools{opacity:1}+.hovertools.seektools{inset:50% auto auto 50%;transform:translate(-50%,-50%)}+.hovertools button{pointer-events:auto;width:58px;height:58px;border-radius:50%;border:1px solid rgba(255,255,255,.12);+ background:rgba(0,0,0,.24);color:#fff;backdrop-filter:saturate(180%) blur(12px);+ -webkit-backdrop-filter:saturate(180%) blur(12px);display:flex;align-items:center;+ justify-content:center;cursor:pointer;position:relative;transition:transform .15s ease,background .15s ease}.hovertools button svg{width:25px;height:25px;stroke:currentColor;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}.hovertools button b{position:absolute;inset:0;display:grid;place-items:center;font:700 9px/1 "Cascadia Mono",monospace;padding-top:1px}-.hovertools button:hover{background:#FFFFFFE8;color:#151515;border-color:#fff}-.hovertools.later-tools{inset:0}-.hovertools .laterbtn{position:absolute;right:10px;bottom:10px;width:auto;height:38px;border-radius:20px;- padding:0 14px;font-family:inherit;font-size:13px;display:flex;gap:6px}-.hovertools .laterbtn[aria-pressed="true"]{background:var(--tungsten);color:#17110a}+.hovertools button:hover{transform:scale(1.12);background:rgba(0,0,0,.34)}+.hovertools.later-tools{right:12px;bottom:12px}+.hovertools .laterbtn{width:36px;height:36px;padding:0;font-family:inherit}+.hovertools .laterbtn svg{width:21px;height:21px}.hovertools .laterbtn[aria-pressed="true"]{background:var(--tungsten);color:#17110a}+.previewcounter{position:absolute;right:12px;top:12px;z-index:4;width:36px;height:36px;border:0;padding:0;+ border-radius:50%;display:grid;place-items:center;color:#fff;cursor:pointer;opacity:0;pointer-events:none;+ background:rgba(0,0,0,.24);backdrop-filter:saturate(180%) blur(12px);-webkit-backdrop-filter:saturate(180%) blur(12px);+ transition:transform .15s ease,opacity .15s}+.card.previewing .previewcounter{opacity:1;pointer-events:auto}.card.longhover .previewcounter{opacity:0;pointer-events:none}+.previewcounter:hover{transform:scale(1.2)}.previewcounter>svg{position:absolute;inset:0;width:36px;height:36px;transform:rotate(-90deg)}+.previewcounter circle{fill:none;stroke-width:2}.previewcounter circle:first-child{stroke:rgba(255,255,255,.18)}+.previewcounter circle:last-child{stroke:#fff;stroke-linecap:round;stroke-dasharray:106.814;stroke-dashoffset:106.814}+.card.previewing .previewcounter circle:last-child{animation:preview-arc 5s linear forwards}.card.longhover .previewcounter circle:last-child{animation:none}+.previewcounter .ringplay{position:relative;inset:auto;width:14px;height:14px;transform:none;stroke:#fff;fill:none;stroke-width:2;margin-left:1px}+@keyframes preview-arc{to{stroke-dashoffset:0}}.nopic{font-size:11px;letter-spacing:.12em;color:var(--muted);text-transform:uppercase}.badge{position:absolute;top:6px;left:6px;display:flex;gap:4px;z-index:2;align-items:center}/* 来源徽标:图标 + 名字。绿=免费(本地/115),橙=计费(PikPak) */@@ -296,14 +305,17 @@ main{padding:14px 16px 90px}.flags i.dislike{background:var(--drop)}.flags i.seen{background:var(--muted)}.flags i.dispose{background:var(--meter)}.flags i.later{background:var(--tungsten)}-/* 标签分级配色(参考 rule34) */+/* 标签语义分级 */.ctags{display:flex;flex-wrap:wrap;gap:5px}-.tg{padding:3px 9px;border-radius:999px;font-size:12px;border:1px solid var(--line);+.tg{padding:3px 8px;border-radius:6px;font-size:12.5px;border:1px solid var(--line);line-height:1.45;white-space:nowrap;cursor:pointer;color:var(--ink-2);background:color-mix(in srgb,var(--surface) 82%,var(--ground))}.tg.general,.tg.artist,.tg.character,.tg.copyright,.tg.meta{color:var(--ink-2);border-color:var(--line)}.tg.artist{font-weight:600}.tg:hover{border-color:var(--ink-2);color:var(--ink);background:var(--hover)}+body[data-density="dense"] .card .ctags .tg:nth-child(n+2){display:none}+body[data-density="dense"] .card .ctags .tg{max-width:132px;overflow:hidden;text-overflow:ellipsis}+body[data-density="dense"] .card .meta .t{-webkit-line-clamp:1;white-space:nowrap;text-overflow:ellipsis}/* 短片带 */.shorts{margin:30px 0 8px;border-top:1px solid var(--line-soft);padding-top:16px}@@ -315,10 +327,10 @@ main{padding:14px 16px 90px}.scard{flex:none;width:214px;cursor:pointer}/* ── 放大播放(就地展开) ── */-.stage{margin:0 0 22px;border-radius:5px;background:var(--surface);+.stage{margin:0 0 22px;border-radius:5px;background:var(--surface);scroll-margin-top:calc(var(--topH) + 8px);border:1px solid var(--line);overflow:hidden}.stage[hidden]{display:none}-.sgrid{display:grid;grid-template-columns:minmax(0,1fr) 310px}+.sgrid{display:grid;grid-template-columns:minmax(0,1fr) minmax(350px,390px)}.vwrap{background:#000;position:relative;display:flex;align-items:center;justify-content:center}.vwrap video{width:100%;max-height:76vh;display:block}.gate{aspect-ratio:16/9;width:100%;background:var(--sunk);border:1px dashed var(--meter);@@ -335,26 +347,30 @@ main{padding:14px 16px 90px}.stitle{font-size:15px;line-height:1.4;word-break:break-all;margin-bottom:6px}.smeta{display:flex;gap:9px;flex-wrap:wrap;color:var(--muted);margin-bottom:11px}.stags{display:flex;flex-wrap:wrap;gap:4px;margin-bottom:13px}+.detailidentity{display:grid;gap:6px;margin:2px 0 13px;padding:0}+.identityrow{display:grid;grid-template-columns:28px 42px minmax(0,1fr);gap:8px;align-items:center;min-height:30px}+.identitymark{width:26px;height:26px;border-radius:50%;overflow:hidden;background:var(--sunk);color:var(--muted);+ display:grid;place-items:center;position:relative;font-size:11px;border:0;padding:0;cursor:pointer}+.identitymark.logo{border-radius:6px;background:#fff;color:#555}.identitymark img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;display:block}+.identitymark.logo img{object-fit:contain;padding:2px}.identitymark svg{width:15px;height:15px;stroke:currentColor;fill:none;stroke-width:2}+.identityrow .ilabel{font-size:12px;color:var(--muted)}.identityrow .entitylink{font-size:14px;text-align:left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.trace{margin-bottom:14px}.trace .lab{display:flex;justify-content:space-between;color:var(--muted);margin-bottom:5px}-.trace .bar{position:relative;height:20px;background:var(--sunk);border:1px solid var(--line);border-radius:3px}+.trace .bar{position:relative;height:4px;background:var(--line);border:0;border-radius:2px}.trace .bar u{position:absolute;inset:0 auto 0 0;background:color-mix(in srgb,var(--loupe) 26%,transparent);text-decoration:none}-.trace .bar b{position:absolute;top:-3px;bottom:-3px;width:2px;background:var(--tungsten)}+.trace .bar b{position:absolute;top:-3px;bottom:-3px;width:2px;background:var(--tungsten);border-radius:1px}.ticks{display:flex;justify-content:space-between;margin-top:4px;color:var(--muted)}-.fb{display:grid;grid-template-columns:repeat(4,1fr);gap:7px;margin-bottom:9px}-.fb button{min-height:76px;padding:10px 5px;border:1px solid var(--line);background:transparent;border-radius:12px;- cursor:pointer;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px}-.fb button svg{width:21px;height:21px;stroke:currentColor;fill:none;stroke-width:1.8;- stroke-linecap:round;stroke-linejoin:round}-.fb button:hover{border-color:var(--ink-2)}-.fb button .k{font-size:13.5px;font-weight:600}-.fb button .d{font-size:11px;color:var(--muted)}-.fb button[aria-pressed="true"]{background:var(--tungsten-soft)}-.fb .dislike[aria-pressed="true"]{border-color:var(--drop);color:var(--drop)}-.fb .seen[aria-pressed="true"]{border-color:var(--muted)}-.fb .dispose[aria-pressed="true"]{border-color:var(--meter);color:var(--meter)}-.fb .like[aria-pressed="true"]{border-color:var(--tungsten);color:var(--tungsten);background:var(--tungsten-soft)}-.preference{border:1px solid var(--line);border-radius:12px;padding:11px;margin:1px 0 8px;+.fb{display:flex;align-items:center;gap:7px;margin:0 0 10px;padding:7px 0;border-top:1px solid var(--line-soft);border-bottom:1px solid var(--line-soft)}+.fb button{width:42px;height:42px;padding:0;border:1px solid transparent;background:transparent;border-radius:8px;+ cursor:pointer;display:grid;place-items:center;color:var(--muted);transition:transform .14s ease,color .14s ease,background .14s ease}+.fb button svg{width:21px;height:21px;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}+.fb button:hover{transform:translateY(-2px);background:var(--hover)}+.fb .like:hover,.fb .like[aria-pressed="true"]{color:var(--tungsten);background:var(--tungsten-soft)}+.fb .dislike:hover,.fb .dislike[aria-pressed="true"]{color:var(--drop);background:color-mix(in srgb,var(--drop) 12%,transparent)}+.fb .seen:hover,.fb .seen[aria-pressed="true"]{color:var(--keep);background:color-mix(in srgb,var(--keep) 12%,transparent)}+.fb .dispose:hover,.fb .dispose[aria-pressed="true"]{color:var(--meter);background:color-mix(in srgb,var(--meter) 12%,transparent)}+.fb .later:hover,.fb .later[aria-pressed="true"]{color:var(--loupe);background:color-mix(in srgb,var(--loupe) 12%,transparent)}+.preference{border-top:1px solid var(--line-soft);padding:12px 0 0;margin:4px 0 8px;background:color-mix(in srgb,var(--surface) 78%,transparent)}.preference textarea{display:block;width:100%;min-height:62px;resize:vertical;padding:8px 9px;color:var(--ink);background:var(--ground);border:1px solid var(--line);border-radius:5px;@@ -362,12 +378,12 @@ main{padding:14px 16px 90px}.preference textarea:focus{border-color:var(--tungsten);outline:0}.preference-foot{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:7px}.preference-foot span{color:var(--muted);font-size:12px}-.savepreference{border:0;border-radius:999px;min-height:38px;padding:7px 15px;background:var(--ink);color:var(--ground);+.savepreference{border:0;border-radius:8px;min-height:38px;padding:7px 15px;background:var(--ink);color:var(--ground);cursor:pointer;font-size:13px}.savepreference:disabled{opacity:.55;cursor:default}-.obtn{width:100%;min-height:48px;padding:10px;border:1px solid var(--line);background:transparent;- border-radius:12px;cursor:pointer;margin-bottom:9px;font-size:14px}-.obtn:hover{border-color:var(--tungsten)}+.obtn{width:100%;min-height:44px;padding:9px 12px;border:1px solid var(--line-soft);background:transparent;+ border-radius:8px;cursor:pointer;margin-bottom:9px;font-size:14px;display:flex;align-items:center;justify-content:center;gap:8px}+.obtn svg{width:18px;height:18px;stroke:currentColor;fill:none;stroke-width:2}.obtn:hover{border-color:var(--tungsten);color:var(--tungsten)}.obtn[aria-pressed="true"]{border-color:var(--tungsten);background:var(--tungsten-soft);color:var(--tungsten)}.hint{color:var(--muted);line-height:1.65;font-size:12px}.next{border-top:1px solid var(--line-soft);padding:13px 15px 15px}@@ -377,25 +393,23 @@ main{padding:14px 16px 90px}.ncard .why{color:var(--loupe)}/* ── 筛选抽屉(默认收起,不占版面) ── */-/* 常驻窄图标条 —— Beeg 的左侧不是完全隐藏,而是一条只有图标的窄栏 */+/* 常驻 72 px 窄图标条。外部实现证据和有意差异登记在 docs/HANDOFF.md。 */.edge{position:fixed;top:0;bottom:0;left:0;width:var(--railW);z-index:92;padding-top:14px;- background:color-mix(in srgb,var(--surface) 38%,transparent);- backdrop-filter:saturate(1.8) blur(20px);-webkit-backdrop-filter:saturate(1.8) blur(20px);- border-right:1px solid color-mix(in srgb,var(--line) 45%,transparent);+ background:var(--surface);+ border-right:1px solid var(--line-soft);display:flex;flex-direction:column;align-items:center;gap:4px;padding:10px 0}-.edge button{width:52px;height:52px;border-radius:14px;background:none;border:0;cursor:pointer;+.edge button{width:52px;height:52px;border-radius:8px;background:none;border:0;cursor:pointer;display:flex;align-items:center;justify-content:center;color:var(--muted);transition:background .12s}.edge button:hover{background:var(--hover);color:var(--tungsten)}.edge button[aria-pressed="true"]{background:var(--tungsten-soft);color:var(--tungsten)}-.edge svg{width:25px;height:25px;stroke:currentColor;fill:none;stroke-width:1.7;+.edge svg{width:24px;height:24px;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}-/* 窄栏从 y=0 贯通到底,顶栏只在右侧内容列里 —— 与参考站结构一致 */+/* 窄栏从 y=0 贯通到底,顶栏只在右侧内容列里。 */body{padding-left:var(--railW)}@media (max-width:760px){body{padding-left:0}.edge{display:none}}.drawer{position:fixed;top:0;bottom:0;left:0;width:360px;z-index:97;- background:color-mix(in srgb,var(--surface) 46%,transparent);- backdrop-filter:saturate(1.8) blur(20px);-webkit-backdrop-filter:saturate(1.8) blur(20px);+ background:var(--surface);border-right:1px solid var(--line);padding:16px 12px 60px;overflow-y:auto;transform:translateX(-100%);transition:transform .2s cubic-bezier(.3,.8,.3,1)}.drawer.open{transform:none;box-shadow:18px 0 60px -24px #000}@@ -406,7 +420,7 @@ body.drawer-open .edge{opacity:0;pointer-events:none} /* 展开时窄栏让位.dnav svg{width:24px;height:24px;margin:0 15px 0 24px} /* 图标落在窄栏原来的位置 */.dnav{display:flex;flex-direction:column;gap:3px;margin-bottom:18px}.dnav button{display:flex;align-items:center;gap:14px;padding:11px 14px;background:none;- border:0;border-radius:22px;cursor:pointer;text-align:left;font-size:15px;color:var(--ink)}+ border:0;border-radius:8px;cursor:pointer;text-align:left;font-size:15px;color:var(--ink)}.dnav button:hover{background:var(--hover)}.dnav button[aria-pressed="true"]{background:var(--tungsten-soft);font-weight:600}.dnav svg{width:20px;height:20px;flex:none;stroke:currentColor;fill:none;stroke-width:1.7;@@ -425,12 +439,13 @@ body.drawer-open .edge{opacity:0;pointer-events:none} /* 展开时窄栏让位.sec > h3 button:hover{color:var(--tungsten)}.chips{display:flex;flex-wrap:wrap;gap:4px}.chip img,.chip>svg{width:14px;height:14px;border-radius:3px;object-fit:contain;flex:none}+.source-icon{display:block!important;width:16px!important;height:16px!important;min-width:16px;opacity:1!important;filter:none!important;object-fit:contain}.chip>svg{stroke:currentColor;fill:none;stroke-width:1.7}.chip{display:inline-flex;align-items:center;gap:6px;padding:3px 9px;border:1px solid var(--line);border-radius:3px;background:transparent;cursor:pointer;font-size:12px}.chip:hover{border-color:var(--tungsten)}.chip[aria-pressed="true"]{background:var(--tungsten-soft);border-color:var(--tungsten)}-/* rule34 式:不同类别的筛选用不同颜色,一眼分得开 */+/* 不同类别保留语义色,内容卡片本身维持中性。 */.sec.cat-artist .chip{color:#D2703F;border-color:#D2703F44}.sec.cat-artist .chip[aria-pressed="true"]{background:#D2703F22;border-color:#D2703F}.sec.cat-general .chip{color:#6C9BD6;border-color:#6C9BD644}@@ -446,14 +461,20 @@ body.drawer-open .edge{opacity:0;pointer-events:none} /* 展开时窄栏让位.chip .n{font-size:10px;color:var(--muted);font-variant-numeric:tabular-nums}.cost{width:5px;height:5px;border-radius:50%;flex:none}.cost.free{background:var(--keep)} .cost.metered{background:var(--meter)}+.duration-filter{padding:3px 2px 8px}.duration-readout{display:flex;justify-content:space-between;align-items:center;+ color:var(--ink-2);font-size:12px;margin-bottom:8px}.duration-readout b{color:var(--tungsten);font-weight:600}+.dual-range{position:relative;height:28px;--lo:0%;--hi:100%}.range-base,.range-fill{position:absolute;left:0;right:0;top:12px;height:4px;border-radius:99px;background:var(--line)}+.range-fill{left:var(--lo);right:calc(100% - var(--hi));background:var(--tungsten)}+.dual-range input{position:absolute;inset:0;width:100%;height:28px;margin:0;background:none;pointer-events:none;appearance:none;-webkit-appearance:none}+.dual-range input::-webkit-slider-thumb{appearance:none;-webkit-appearance:none;width:18px;height:18px;border-radius:50%;background:var(--ink);border:3px solid var(--tungsten);pointer-events:auto;cursor:grab}+.dual-range input::-moz-range-thumb{width:14px;height:14px;border-radius:50%;background:var(--ink);border:3px solid var(--tungsten);pointer-events:auto;cursor:grab}/* ── 短片全屏 ── */-.tok{position:fixed;inset:0;z-index:200;background:#000;display:flex;align-items:center;justify-content:center}+.tok{position:fixed;inset:0;z-index:200;background:#000;display:flex;align-items:center;justify-content:center;overflow:hidden}.tok[hidden]{display:none}-.tok video{max-height:100vh;max-width:100vw;width:100%;height:100%;object-fit:contain;background:#000;- transition:transform .26s cubic-bezier(.22,.9,.3,1),opacity .2s}-.tok video.slide-up{transform:translateY(-8%);opacity:0}-.tok video.slide-dn{transform:translateY(8%);opacity:0}+.toktrack{position:absolute;inset:0;overflow:hidden}.toktrack video{position:absolute;inset:0;max-height:100vh;max-width:100vw;+ width:100%;height:100%;object-fit:contain;background:#000;will-change:transform;+ transition:transform .2s cubic-bezier(.2,.2,.4,.9)}.tokui{position:absolute;inset:auto 0 0 0;padding:18px 20px 26px;color:#F3ECE2;background:linear-gradient(transparent,rgba(0,0,0,.84));pointer-events:none}.tokbtns{position:absolute;right:max(14px,env(safe-area-inset-right));bottom:106px;@@ -487,6 +508,12 @@ body.drawer-open .edge{opacity:0;pointer-events:none} /* 展开时窄栏让位.loadmore{min-height:42px;margin:18px auto 0;text-align:center;color:var(--muted);padding:12px}.empty{color:var(--muted);padding:44px 0;text-align:center}+.batchbar{position:fixed;left:50%;bottom:22px;z-index:180;transform:translateX(-50%);display:flex;align-items:center;gap:7px;+ padding:9px 11px;border:1px solid var(--line);border-radius:10px;background:var(--surface);+ box-shadow:0 8px 24px #0005}.batchbar[hidden]{display:none}+.batchbar span{padding:0 8px;color:var(--ink-2);white-space:nowrap}.batchbar button{border:1px solid var(--line);border-radius:12px;+ background:var(--surface);color:var(--ink);padding:9px 12px;cursor:pointer}.batchbar button:hover{border-color:var(--tungsten)}+.batchbar .danger{color:var(--drop)}@media (max-width:1080px){.sgrid{grid-template-columns:minmax(0,1fr)}.side{border-left:0;border-top:1px solid var(--line-soft);max-height:none}}@@ -502,30 +529,60 @@ body.drawer-open .edge{opacity:0;pointer-events:none} /* 展开时窄栏让位.search{position:absolute;left:8px;right:8px;top:8px;max-width:none;margin:0;display:none;z-index:5;background:var(--surface)}.search.open{display:flex}- #searchBtn{display:inline-flex}+ #searchBtn{display:inline-flex!important}/* 移动端不需要密度切换和筛选抽屉按钮挤在一起 */#density{display:none}.entityhero{grid-template-columns:92px minmax(0,1fr);gap:14px;padding:13px}.entityportrait{width:92px}.entityhero h2{font-size:20px}.statshead{align-items:center}.stats h2{font-size:23px}.scards{grid-template-columns:minmax(0,1fr)}.scard2{padding:16px}.kv .u{display:block;margin-left:0;margin-top:2px}- .fb{grid-template-columns:repeat(2,1fr)}+ .ctags .tg:nth-child(n+3){display:none}}#searchBtn{display:none}</style></head><body>+<!-- Lucide static 1.31.0, ISC. Local pinned subset; no CDN/runtime dependency. -->+<svg aria-hidden="true" width="0" height="0" style="position:absolute;overflow:hidden">+ <symbol id="i-home" viewBox="0 0 24 24"><path d="M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8"/><path d="M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/></symbol>+ <symbol id="i-sliders-horizontal" viewBox="0 0 24 24"><path d="M10 5H3"/><path d="M12 19H3"/><path d="M14 3v4"/><path d="M16 17v4"/><path d="M21 12h-9"/><path d="M21 19h-5"/><path d="M21 5h-7"/><path d="M8 10v4"/><path d="M8 12H3"/></symbol>+ <symbol id="i-search" viewBox="0 0 24 24"><path d="m21 21-4.34-4.34"/><circle cx="11" cy="11" r="8"/></symbol>+ <symbol id="i-layout-grid" viewBox="0 0 24 24"><rect width="7" height="7" x="3" y="3" rx="1"/><rect width="7" height="7" x="14" y="3" rx="1"/><rect width="7" height="7" x="14" y="14" rx="1"/><rect width="7" height="7" x="3" y="14" rx="1"/></symbol>+ <symbol id="i-refresh-cw" viewBox="0 0 24 24"><path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/><path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"/><path d="M8 16H3v5"/></symbol>+ <symbol id="i-user-round" viewBox="0 0 24 24"><circle cx="12" cy="8" r="5"/><path d="M20 21a8 8 0 0 0-16 0"/></symbol>+ <symbol id="i-tags" viewBox="0 0 24 24"><path d="M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z"/><path d="M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193"/><circle cx="10.5" cy="6.5" r=".5" fill="currentColor"/></symbol>+ <symbol id="i-star" viewBox="0 0 24 24"><path d="M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z"/></symbol>+ <symbol id="i-list-filter" viewBox="0 0 24 24"><path d="M2 5h20"/><path d="M6 12h12"/><path d="M9 19h6"/></symbol>+ <symbol id="i-chart" viewBox="0 0 24 24"><path d="M5 21v-6"/><path d="M12 21V3"/><path d="M19 21V9"/></symbol>+ <symbol id="i-x" viewBox="0 0 24 24"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></symbol>+ <symbol id="i-hard-drive" viewBox="0 0 24 24"><path d="M10 16h.01"/><path d="M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"/><path d="M21.946 12.013H2.054"/><path d="M6 16h.01"/></symbol>+ <symbol id="i-globe" viewBox="0 0 24 24"><path d="M21.54 15H17a2 2 0 0 0-2 2v4.54"/><path d="M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17"/><path d="M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05"/><circle cx="12" cy="12" r="10"/></symbol>+ <symbol id="i-thumbs-up" viewBox="0 0 24 24"><path d="M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z"/><path d="M7 10v12"/></symbol>+ <symbol id="i-thumbs-down" viewBox="0 0 24 24"><path d="M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z"/><path d="M17 14V2"/></symbol>+ <symbol id="i-eye" viewBox="0 0 24 24"><path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"/><circle cx="12" cy="12" r="3"/></symbol>+ <symbol id="i-trash" viewBox="0 0 24 24"><path d="M10 11v6"/><path d="M14 11v6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"/><path d="M3 6h18"/><path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/></symbol>+ <symbol id="i-plus" viewBox="0 0 24 24"><path d="M5 12h14"/><path d="M12 5v14"/></symbol>+ <symbol id="i-check" viewBox="0 0 24 24"><path d="M20 6 9 17l-5-5"/></symbol>+ <symbol id="i-rotate-ccw" viewBox="0 0 24 24"><path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/></symbol>+ <symbol id="i-rotate-cw" viewBox="0 0 24 24"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/></symbol>+ <symbol id="i-maximize" viewBox="0 0 24 24"><path d="M8 3H5a2 2 0 0 0-2 2v3"/><path d="M21 8V5a2 2 0 0 0-2-2h-3"/><path d="M3 16v3a2 2 0 0 0 2 2h3"/><path d="M16 21h3a2 2 0 0 0 2-2v-3"/></symbol>+ <symbol id="i-chevron-left" viewBox="0 0 24 24"><path d="m15 18-6-6 6-6"/></symbol>+ <symbol id="i-heart" viewBox="0 0 24 24"><path d="M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5"/></symbol>+ <symbol id="i-play" viewBox="0 0 24 24"><path d="M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z"/></symbol>+ <symbol id="i-clock" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="M12 6v6l4 2"/></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>+</svg><header class="top">- <button class="ib" id="filterBtn" title="筛选"><svg viewBox="0 0 24 24"><path d="M4 6h16M7 12h10M10 18h4"/></svg></button>+ <button class="ib" id="filterBtn" title="筛选"><svg viewBox="0 0 24 24"><use href="#i-sliders-horizontal"/></svg></button><a class="brand" href="#" id="brandHome"><svg class="mark" viewBox="0 0 32 32" aria-hidden="true"><defs><linearGradient id="pg" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#FF9A76"/><stop offset="1" stop-color="#F2557B"/></linearGradient></defs><path d="M16 29c-6.1 0-10.4-3.9-10.4-9.2 0-4.6 3-8.2 7-8.2 1.5 0 2.6.5 3.4 1.2.8-.7 1.9-1.2 3.4-1.2 4 0 7 3.6 7 8.2C26.4 25.1 22.1 29 16 29z" fill="url(#pg)"/><path d="M16 13.2V28" stroke="#0B0B0D" stroke-width="1.1" opacity=".28" stroke-linecap="round"/><path d="M17.2 11.4c.6-3 3-4.9 6-5.1-.2 3-2.4 5-6 5.1z" fill="#5FB95F"/><path d="M16 11.6c0-2 .5-3.6 1.6-4.8" stroke="#8A5A3B" stroke-width="1.5" stroke-linecap="round" fill="none"/></svg><h1 class="disp">Peach</h1><span class="sub mono">蜜桃</span></a>- <div class="search"><span class="mono" style="color:var(--muted)">⌕</span>+ <div class="search"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="#i-search"/></svg><input id="q" type="search" placeholder="搜名字 / 创作者 / 番号" autocomplete="off"></div>- <button class="ib" id="immerseBtn" title="沉浸模式 · 随机连播"><svg viewBox="0 0 24 24"><path d="M4 8V5.5A1.5 1.5 0 0 1 5.5 4H8M20 8V5.5A1.5 1.5 0 0 0 18.5 4H16M4 16v2.5A1.5 1.5 0 0 0 5.5 20H8M20 16v2.5a1.5 1.5 0 0 1-1.5 1.5H16"/><path d="M10.5 9.3v5.4l4.5-2.7z"/></svg></button>+ <button class="ib" id="immerseBtn" title="沉浸模式 · 随机连播"><svg viewBox="0 0 24 24"><use href="#i-play"/></svg></button>- <button class="ib" id="searchBtn" title="搜索"><svg viewBox="0 0 24 24"><circle cx="11" cy="11" r="7"/><path d="M16.5 16.5 21 21"/></svg></button>- <button class="ib" id="density" title="密度:大图 / 密集"><svg viewBox="0 0 24 24"><rect x="3" y="3" width="8" height="8" rx="1"/><rect x="13" y="3" width="8" height="8" rx="1"/><rect x="3" y="13" width="8" height="8" rx="1"/><rect x="13" y="13" width="8" height="8" rx="1"/></svg></button>- <button class="ib" id="refresh" title="换一批推荐"><svg viewBox="0 0 24 24"><path d="M20 11a8 8 0 1 0-.6 4"/><path d="M20 5v6h-6"/></svg></button>+ <button class="ib" id="searchBtn" title="搜索"><svg viewBox="0 0 24 24"><use href="#i-search"/></svg></button>+ <button class="ib" id="density" title="密度:大图 / 密集"><svg viewBox="0 0 24 24"><use href="#i-layout-grid"/></svg></button>+ <button class="ib" id="refresh" title="换一批推荐"><svg viewBox="0 0 24 24"><use href="#i-refresh-cw"/></svg></button></header>@@ -550,15 +607,18 @@ body.drawer-open .edge{opacity:0;pointer-events:none} /* 展开时窄栏让位<div class="scrim" id="scrim"></div><aside class="drawer" id="drawer"></aside>+<div class="batchbar" id="batchbar" hidden><span id="batchCount">已选 0 项</span>+ <button data-batch="like">喜欢</button><button data-batch="seen">看过</button><button data-batch="later">稍后看</button>+ <button class="danger" data-batch="dispose">标记待删</button><button id="batchClear">取消</button></div><div class="tok" id="tok" hidden>- <video id="tokVid" playsinline></video>+ <div class="toktrack" id="tokTrack"><video id="tokVid" playsinline></video></div><div class="tokhint mono">滚轮 / ↑↓ 切换 · Esc 退出 · 横竖屏混流</div><button class="tokclose" id="tokClose">退出</button><div class="tokbtns">- <button id="tokDislike" title="标为不喜欢" aria-label="标为不喜欢"><svg viewBox="0 0 24 24"><path d="M17 14V3H7l-3 8v3h5l-1 5 5-5z" transform="rotate(180 12 12)"/></svg><span class="toklabel">不喜欢</span></button>- <button id="tokSeen" title="标为看过" aria-label="标为看过"><svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="8.5"/><path d="m8.5 12 2.3 2.3 4.9-5"/></svg><span class="toklabel">看过</span></button>- <button id="tokO" title="记一次高潮" aria-label="记一次高潮"><svg viewBox="0 0 24 24"><path d="M12 21s-7-4.6-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 11c0 5.4-7 10-7 10z"/></svg><span class="toklabel">高潮</span><b class="tokcount" id="tokOn">0</b></button>+ <button id="tokDislike" title="标为不喜欢" aria-label="标为不喜欢"><svg viewBox="0 0 24 24"><use href="#i-thumbs-down"/></svg><span class="toklabel">不喜欢</span></button>+ <button id="tokSeen" title="标为看过" aria-label="标为看过"><svg viewBox="0 0 24 24"><use href="#i-eye"/></svg><span class="toklabel">看过</span></button>+ <button id="tokO" title="记一次高潮" aria-label="记一次高潮"><svg viewBox="0 0 24 24"><use href="#i-heart"/></svg><span class="toklabel">高潮</span><b class="tokcount" id="tokOn">0</b></button></div><div class="tokbar" id="tokBar"><i id="tokProg"></i></div><div class="tokui"><div id="tokTitle" style="font-size:14px;margin-bottom:5px"></div>@@ -567,36 +627,58 @@ body.drawer-open .edge{opacity:0;pointer-events:none} /* 展开时窄栏让位<script>const $=s=>document.querySelector(s);+const icon=(name,cls='')=>`<svg${cls?` class="${cls}"`:''} viewBox="0 0 24 24" aria-hidden="true"><use href="#i-${name}"/></svg>`;const api=(p,o)=>fetch(p,Object.assign({headers:{'Content-Type':'application/json'}},o||{})).then(r=>r.json());+const route=(path,replace=false)=>history[replace?'replaceState':'pushState']({},'',path);const esc=s=>String(s??'').replace(/[&<>"]/g,c=>({'&':'&','<':'<','>':'>','"':'"'}[c]));const fmtDur=s=>{if(!s)return'—';s=Math.round(s);const h=s/3600|0,m=(s%3600)/60|0,x=s%60;return h?`${h}:${String(m).padStart(2,'0')}:${String(x).padStart(2,'0')}`:`${m}:${String(x).padStart(2,'0')}`};const fmtSize=b=>b>=1099511627776?(b/1099511627776).toFixed(2)+' TB':b>=1073741824?(b/1073741824).toFixed(1)+' GB':(b/1048576|0)+' MB';const LOC={local:'本地','115':'115',pikpak:'PikPak',online:'在线'};-/* 来源图标:115 / PikPak 用抓到的官方 favicon;本地自绘硬盘图标 */+const DURATION_TAGS=new Set(['短片-2分内','中片-10分内','长片-30分内','超长片']);+/* 来源图标:品牌使用已缓存的官方资产;通用操作图标统一使用本地 Lucide 子集。 */const SRCICON={- local:'<svg viewBox="0 0 24 24"><rect x="3" y="4" width="18" height="7" rx="1.6"/>'- +'<rect x="3" y="13" width="18" height="7" rx="1.6"/>'- +'<path d="M6.6 7.5h.01M6.6 16.5h.01"/></svg>',- '115':'<img src="/logo?studio=115" alt="" onerror="this.remove()">',- pikpak:'<img src="/logo?studio=pikpak" alt="" onerror="this.remove()">',- online:'<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="9"/><path d="M3 12h18M12 3a15 15 0 0 1 0 18a15 15 0 0 1 0-18"/></svg>',+ local:icon('hard-drive'),+ '115':'<img class="source-icon" src="/logo?studio=115" alt="" onerror="this.remove()">',+ pikpak:'<img class="source-icon" src="/logo?studio=pikpak" alt="" onerror="this.remove()">',+ online:icon('globe'),};const srcBadge=(loc,cost,cls)=>`<span class="${cls||'src'} ${cost==='metered'?'metered':'free'}">`+(SRCICON[loc]||'')+`${LOC[loc]||loc}${cost==='metered'?' · 计费':''}</span>`;// sort 默认 daily:同一天进来顺序固定,隔天自动换一批(不是每次刷新都变)-let state={loc:'local,115',creator:'',studio:'',tag:'',len:'',orient:'',state:'',sort:'daily',seed:String((Date.now()^(Math.random()*1e9|0))%99991),q:'',thumb:'1'};+const initialParams=new URLSearchParams(location.search);+let state={loc:initialParams.get('loc')||'local,115',creator:initialParams.get('creator')||'',studio:initialParams.get('studio')||'',+ tag:initialParams.get('tag')||'',len:initialParams.get('len')||'',dur_min:initialParams.get('dur_min')||'',dur_max:initialParams.get('dur_max')||'',+ orient:initialParams.get('orient')||'',state:initialParams.get('state')||'',sort:initialParams.get('sort')||'daily',+ seed:initialParams.get('seed')||String((Date.now()^(Math.random()*1e9|0))%99991),q:initialParams.get('q')||'',thumb:'1'};+$('#q').value=state.q;const REP={}; // 创作者/厂牌 → 代表作 id,用来做圆头像(裁接触印相中心格,不另造图)let offset=0,total=0,facets=null,current=null;const CACHE={};const cache=items=>{items.forEach(x=>CACHE[x.id]=x);return items};+const selected=new Set();+function paintSelection(){+ document.querySelectorAll('.card[data-id]').forEach(card=>card.classList.toggle('selected',selected.has(+card.dataset.id)));+ $('#batchbar').hidden=!selected.size;$('#batchCount').textContent=`已选 ${selected.size} 项`;+}+function toggleSelection(id){selected.has(id)?selected.delete(id):selected.add(id);paintSelection()}+$('#batchClear').onclick=()=>{selected.clear();paintSelection()};+$('#batchbar').querySelectorAll('[data-batch]').forEach(button=>button.onclick=async()=>{+ const labels={like:'喜欢',seen:'标为看过',later:'加入稍后看',dispose:'标记待删'};+ const operation=button.dataset.batch,ids=[...selected];if(!ids.length)return;+ if(!confirm(`确认对 ${ids.length} 个作品执行“${labels[operation]}”?\n这会写入本机账本;标记待删不会删除文件。`))return;+ button.disabled=true;+ try{await api('/api/batch',{method:'POST',body:JSON.stringify({ids,operation})});selected.clear();await load(true)}+ finally{button.disabled=false;paintSelection()}+});/* 密度:大图为主,密集为辅 */const TILES={big:'336px',dense:'168px'}; /* 168px 模块单位 */let density=localStorage.getItem('density')||'big';function applyDensity(){document.documentElement.style.setProperty('--tile',TILES[density]);+ document.body.dataset.density=density;$('#density').setAttribute('aria-pressed',density==='dense');$('#density').title='当前:'+(density==='big'?'大图':'密集')}$('#density').onclick=()=>{density=density==='big'?'dense':'big';@@ -609,8 +691,8 @@ const POS=[[0,0],[50,0],[100,0],[0,50],[50,50],[100,50],[0,100],[50,100],[100,10function wireHover(el,it){const pic=el.querySelector('.pic'); if(!pic)return;let longTimer=null;- const armLong=()=>{longTimer=setTimeout(()=>el.classList.add('longhover'),5000)};- const clearLong=()=>{clearTimeout(longTimer);el.classList.remove('longhover')};+ const armLong=()=>{clearTimeout(longTimer);el.classList.add('previewing');longTimer=setTimeout(()=>el.classList.add('longhover'),5000)};+ const clearLong=()=>{clearTimeout(longTimer);el.classList.remove('previewing','longhover')};if(it.cost==='metered'){ // 计费源:只换预览图逐格扫视,零流量const im=pic.querySelector('.poster'); if(!im)return;let t=null,i=4;@@ -622,7 +704,6 @@ function wireHover(el,it){let timer=null,v=null;el.addEventListener('mouseenter',()=>{if(window.__scrolling)return; // 滚动中不起播,否则每张卡都发请求 → 卡死- armLong();timer=setTimeout(()=>{if(window.__scrolling)return;v=document.createElement('video');@@ -632,7 +713,7 @@ function wireHover(el,it){const SEG=[0.08,0.22,0.36,0.50,0.64,0.78,0.90]; let si=0, hop=null;const seek=()=>{try{v.currentTime=(v.duration||0)*SEG[si]}catch(e){}};v.addEventListener('loadedmetadata',()=>{- seek(); v.classList.add('on');+ seek(); v.classList.add('on');armLong();hop=setInterval(()=>{si=(si+1)%SEG.length;seek()},1400);v._hop=hop;},{once:true});@@ -660,7 +741,7 @@ function cardHtml(it,cls){const performerRef=(it.performer_entities||[])[0];const who=it.creator||performer||it.code||it.studio||'未归属';const whoKind=it.creator?'creator':(it.studio?'studio':'');- const perf=(it.performers||[]).map(x=>`<button class="tg artist entitylink" data-entity-kind="performer" data-entity-name="${esc(x)}">${esc(x)}</button>`).join('');+ const perf=(it.performers||[]).slice(0,1).map(x=>`<button class="tg artist entitylink" data-entity-kind="performer" data-entity-name="${esc(x)}">${esc(x)}</button>`).join('');const tgs=(it.tags||[]).slice(0,3).map(x=>`<span class="tg general" data-tag="${esc(x)}">${esc(x)}</span>`).join('');const avatarName=performer||it.creator||it.studio||who;const avatarKind=performer?'performer':(it.creator?'creator':(it.studio?'studio':''));@@ -673,12 +754,14 @@ function cardHtml(it,cls){const avatar=avatarKind? `<button class="mav entitylink" data-entity-kind="${avatarKind}" data-entity-name="${esc(avatarName)}" title="打开${performer?'女优':'资料'}页">${av}</button>`: `<span class="mav">${av}</span>`;- const tools=cls==='scard'- ? `<div class="hovertools later-tools"><button class="laterbtn" data-later aria-pressed="${!!it.watch_later}" title="稍后看">${it.watch_later?'✓ 已加入':'+ 稍后看'}</button></div>`- : `<div class="hovertools seektools">- <button data-seek="-10" title="后退 10 秒" aria-label="后退 10 秒"><svg viewBox="0 0 24 24"><path d="M8 7H4V3"/><path d="M4.5 7.5A8 8 0 1 1 4 16"/></svg><b>10</b></button>- <button data-seek="10" title="前进 10 秒" aria-label="前进 10 秒"><svg viewBox="0 0 24 24"><path d="M16 7h4V3"/><path d="M19.5 7.5A8 8 0 1 0 20 16"/></svg><b>10</b></button>- <button data-open title="打开详情" aria-label="打开详情"><svg viewBox="0 0 24 24"><path d="M8 3H3v5M16 3h5v5M8 21H3v-5M16 21h5v-5"/></svg></button></div>`;+ const tools=`<button class="previewcounter" data-open title="打开预览" aria-label="打开预览">+ <svg viewBox="-18 -18 36 36"><circle r="17"></circle><circle r="17"></circle></svg>${icon('play','ringplay')}</button>+ <div class="hovertools later-tools"><button class="laterbtn" data-later aria-pressed="${!!it.watch_later}" title="稍后看" aria-label="稍后看">+ ${it.watch_later?icon('check'):icon('bookmark-plus')}</button></div>+ <div class="hovertools seektools">+ <button data-seek="-10" title="后退 10 秒" aria-label="后退 10 秒">${icon('rotate-ccw')}<b>10</b></button>+ <button data-seek="10" title="前进 10 秒" aria-label="前进 10 秒">${icon('rotate-cw')}<b>10</b></button>+ <button data-open title="打开详情" aria-label="打开详情">${icon('maximize')}</button></div>`;return `<article class="card ${cls||''}" data-id="${it.id}"><div class="pic">${thumb}<div class="badge mono">${srcBadge(it.location,it.cost)}</div>@@ -703,13 +786,14 @@ function wireCards(root,onClick){const later=e.target.closest('[data-later]');if(later){e.stopPropagation();api('/api/watch-later',{method:'POST',body:JSON.stringify({id:it.id})}).then(r=>{it.watch_later=r.watch_later;later.setAttribute('aria-pressed',r.watch_later);- later.textContent=r.watch_later?'✓ 已加入':'+ 稍后看'});return}+ later.innerHTML=r.watch_later?icon('check'):icon('bookmark-plus')});return}if(e.target.closest('[data-open]')){e.stopPropagation();openItem(it.id);return}const ent=e.target.closest('[data-entity-kind]');if(ent){e.stopPropagation();openEntity(ent.dataset.entityKind,ent.dataset.entityName);return}const tg=e.target.closest('.tg');if(tg){e.stopPropagation();state.tag=tg.dataset.tag;buildBars();load(true);window.scrollTo({top:0,behavior:'smooth'});return}+ if(e.shiftKey){e.preventDefault();toggleSelection(it.id);return}(onClick||openItem)(+el.dataset.id);};if(it)wireHover(el,it);@@ -765,26 +849,26 @@ async function buildBars(){return `<button class="chip" aria-pressed="${sel}" data-key="${key}" data-multi="${multi?1:0}"data-val="${esc(it.k)}">${dot}${esc(it.label||it.k)}${it.n!=null?`<span class="n">${it.n.toLocaleString()}</span>`:''}</button>`;}).join('')+`</div>`;- // 按类别配色:来源/时长/画幅/排序=meta 灰,创作者=artist 橙,内容标签=general 蓝,规格=meta+ // 按语义类别区分来源、创作者、内容和技术规格。const sec=(t,b,x,cat)=>`<div class="sec${cat?' cat-'+cat:''}"><h3>${t}${x||''}</h3>${b}</div>`;// 与窄栏共用 EDGE_ICONS —— 两边条目必须一致,原来抽屉是另一份硬编码const navBtn=(k,label,ic)=>`<button data-nav="${k}" aria-pressed="${navOn(k)}">- <svg viewBox="0 0 24 24">${ic}</svg><span>${label}</span></button>`;+ ${icon(ic)}<span>${label}</span></button>`;$('#drawer').innerHTML=`<div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:10px"><b class="disp" style="font-size:15px;letter-spacing:.1em">导航与筛选</b>- <button id="drawerClose" class="ib" title="收起"><svg viewBox="0 0 24 24"><path d="M6 6l12 12M18 6L6 18"/></svg></button></div>`++ <button id="drawerClose" class="ib" title="收起">${icon('x')}</button></div>`+`<div class="dnav">${EDGE_ICONS.map(([k,label,ic])=>navBtn(k,label,ic)).join('')}</div>`+sec('来源',chips(facets.locations.map(l=>({k:l.k,label:LOC[l.k]||l.k,n:l.n,cost:(l.k==='pikpak'||l.k==='online')?'metered':'free'})),'loc',true),'','src')- +sec('时长',chips([{k:'速食'},{k:'短'},{k:'中'},{k:'长'}],'len'),'','meta')+ +sec('时长',`<div class="duration-filter"><div class="duration-readout"><span id="durMinText">不限</span><b>—</b><span id="durMaxText">不限</span></div>+ <div class="dual-range" id="durationRange"><span class="range-base"></span><span class="range-fill"></span>+ <input id="durMin" type="range" min="0" max="180" step="5" value="${state.dur_min?Math.min(180,+state.dur_min/60):0}" aria-label="最短时长(分钟)">+ <input id="durMax" type="range" min="0" max="180" step="5" value="${state.dur_max?Math.min(180,+state.dur_max/60):180}" aria-label="最长时长(分钟)"></div></div>`,'','meta')+sec('画幅',chips([{k:'竖屏'},{k:'横屏'}],'orient'),'','meta')+sec('创作者',chips(facets.creators,'creator',false,26),'<button data-more="creator">更多</button>','artist')+sec('内容标签',chips(facets.tags,'tag',false,30),'<button data-more="tag">更多</button>','general')- +sec('规格',chips(facets.tech,'tag',false,12),'','meta')- +`<div class="sec"><h3>目录</h3><div class="chips navpages">- <button class="chip navpage" data-page="performers">全部艺人 →</button>- <button class="chip" data-page="tags">全部标签 →</button></div></div>`;+ +sec('规格',chips(facets.tech,'tag',false,12),'','meta');const dc=$('#drawerClose'); if(dc)dc.onclick=()=>openDrawer(false);$('#drawer').querySelectorAll('[data-page]').forEach(b=>b.onclick=()=>{openIndex(b.dataset.page); closeDrawerAfterNav()});@@ -804,6 +888,16 @@ async function buildBars(){else state[k]=state[k]===v?'':v;buildBars();load(true)});bind();+ const durMin=$('#durMin'),durMax=$('#durMax'),durRange=$('#durationRange');+ const syncDuration=(commit=false,changed='')=>{+ let lo=+durMin.value,hi=+durMax.value;+ if(lo>hi){if(changed==='min')hi=lo;else lo=hi;durMin.value=lo;durMax.value=hi}+ durRange.style.setProperty('--lo',(lo/180*100)+'%');durRange.style.setProperty('--hi',(hi/180*100)+'%');+ $('#durMinText').textContent=lo?lo+' 分钟':'不限';$('#durMaxText').textContent=hi<180?hi+' 分钟':'不限';+ if(commit){state.len='';state.dur_min=lo?String(lo*60):'';state.dur_max=hi<180?String(hi*60):'';buildBars();load(true)}+ };+ durMin.oninput=()=>syncDuration(false,'min');durMax.oninput=()=>syncDuration(false,'max');+ durMin.onchange=()=>syncDuration(true,'min');durMax.onchange=()=>syncDuration(true,'max');syncDuration();$('#drawer').querySelectorAll('[data-more]').forEach(b=>b.onclick=e=>{e.stopPropagation();const sec=b.closest('.sec'), k=b.dataset.more;const src=k==='tag'?facets.tags:facets.creators;@@ -831,7 +925,7 @@ function renderCount(){load(true)});}-/* ── 组合筛选:多个标签同时生效(Beeg 的 /PinkLoving+Anal) ── */+/* ── 组合筛选:多个标签同时生效 ── */const tagList=()=>(state.tag||'').split(',').filter(Boolean);function toggleTag(t){if(!t){state.tag='';}@@ -856,7 +950,8 @@ function renderCombo(){}/* ── 统计与管理 ── */-async function openStats(){+async function openStats(push=true){+ if(push)route('/stats');const d=await api('/api/stats');$('#stats').hidden=false; $('#index').hidden=true; $('#grid').innerHTML='';$('#count').textContent=''; $('#loadSentinel').hidden=true; $('#shortsSec').hidden=true;@@ -869,7 +964,7 @@ async function openStats(){const card=(t,body)=>`<div class="scard2"><h3>${t}</h3>${body}</div>`;const kv=(k,v,u)=>`<div class="kv"><span>${k}</span><b>${v}${u?`<span class="u">${u}</span>`:''}</b></div>`;$('#stats').innerHTML=`- <div class="statshead"><button class="backbtn" id="statsBack" title="返回浏览"><svg viewBox="0 0 24 24"><path d="M15 18l-6-6 6-6"/></svg><span>返回</span></button>+ <div class="statshead"><button class="backbtn" id="statsBack" title="返回浏览">${icon('chevron-left')}<span>返回</span></button><div><h2 class="disp">统计与管理</h2><div class="sub mono">馆藏、归属、加工与真实观看行为</div></div></div>@@ -916,11 +1011,12 @@ async function openStats(){closeStats(); toggleTag(b.dataset.k)});window.scrollTo({top:0,behavior:'smooth'});}-function closeStats(){$('#stats').hidden=true;+function closeStats(push=true){if(push)route('/');$('#stats').hidden=true;$('#tiers').style.display='';$('#tagbar').style.display='';load(true)}/* ── 全部艺人 / 创作者 / 标签索引页 ── */-async function openIndex(kind,q){+async function openIndex(kind,q,push=true){+ if(push)route('/'+kind+(q?'?q='+encodeURIComponent(q):''),!!q);const d=await api('/api/index?kind='+kind+(q?'&q='+encodeURIComponent(q):''));$('#index').hidden=false; $('#grid').innerHTML=''; $('#count').textContent='';$('#loadSentinel').hidden=true; $('#shortsSec').hidden=true; $('#stage').hidden=true;@@ -936,20 +1032,21 @@ async function openIndex(kind,q){: `<div class="tagwall">`+d.items.map(x=>`<button class="tg ${x.cat||'general'}" data-k="${esc(x.k)}"style="padding:5px 12px;font-size:13px">${esc(x.k)}<span style="opacity:.6;font-size:11px">${x.n.toLocaleString()}</span></button>`).join('')+`</div>`;- $('#index').innerHTML=`<div class="ihead"><button class="backbtn" id="iClose"><svg viewBox="0 0 24 24"><path d="M15 18l-6-6 6-6"/></svg><span>返回</span></button>+ $('#index').innerHTML=`<div class="ihead"><button class="backbtn" id="iClose">${icon('chevron-left')}<span>返回</span></button><h2 class="disp">${title}</h2><span class="mono" style="color:var(--muted)">${d.items.length} 项</span><div class="isearch"><input id="iq" placeholder="过滤…" value="${esc(q||'')}"></div></div>${body}`;- $('#iClose').onclick=()=>{$('#index').hidden=true;load(true)};- let it2; $('#iq').oninput=e=>{clearTimeout(it2);it2=setTimeout(()=>openIndex(kind,e.target.value.trim()),300)};+ $('#iClose').onclick=()=>{route('/');$('#index').hidden=true;load(true)};+ let it2; $('#iq').oninput=e=>{clearTimeout(it2);it2=setTimeout(()=>openIndex(kind,e.target.value.trim(),true),300)};$('#index').querySelectorAll('[data-k]').forEach(b=>b.onclick=()=>{if(people){openEntity(b.dataset.kind,b.dataset.k);return}else{toggleTag(b.dataset.k);return}$('#index').hidden=true;buildBars();load(true)});}-async function openEntity(kind,name){+async function openEntity(kind,name,push=true){+ if(push)route(`/entity/${encodeURIComponent(kind)}/${encodeURIComponent(name)}`);const d=await api(`/api/entity?kind=${encodeURIComponent(kind)}&name=${encodeURIComponent(name)}`);if(d.error)return;const p=new URLSearchParams();p.set(kind,name);p.set('limit','120');p.set('sort','new');@@ -963,7 +1060,7 @@ async function openEntity(kind,name){? `<a href="${esc(x.url)}" target="_blank" rel="noreferrer">${esc(x.label)} ↗</a>`: `<span class="private" title="私人馆藏来源记录,不直接打开下载页">来源 · ${esc(x.label||x.hostname||'已记录')}</span>`).join('');const terms=(d.search_terms||[]).map(x=>`<code>${esc(x.term)}</code>`).join('');- $('#index').innerHTML=`<div class="ihead"><button class="backbtn" id="iClose"><svg viewBox="0 0 24 24"><path d="M15 18l-6-6 6-6"/></svg><span>返回</span></button>+ $('#index').innerHTML=`<div class="ihead"><button class="backbtn" id="iClose">${icon('chevron-left')}<span>返回</span></button><span class="mono" style="color:var(--muted)">${labels[kind]||kind}资料页</span></div><div class="entityhero"><div class="entityportrait">${image}<span>${esc(name.slice(0,1))}</span></div><div><h2 class="disp">${esc(d.canonical_name)}</h2>@@ -973,7 +1070,7 @@ async function openEntity(kind,name){${terms?`<div class="entityterms">馆藏检索词 · ${terms}</div>`:''}</div></div><div class="entitysection"><h3>${labels[kind]||kind}的馆藏作品 · ${items.total.toLocaleString()}</h3><div class="grid">${items.items.map(it=>cardHtml(it)).join('')}</div></div>`;- $('#iClose').onclick=()=>{$('#index').hidden=true;load(true)};+ $('#iClose').onclick=()=>{route('/');$('#index').hidden=true;load(true)};wireCards($('#index'));window.scrollTo({top:0,behavior:'smooth'});}@@ -985,14 +1082,13 @@ const closeDrawerAfterNav=()=>{drawerSuppressUntil=Date.now()+650;openDrawer(fal$('#filterBtn').onclick=()=>openDrawer(!$('#drawer').classList.contains('open'));/* 常驻窄图标条:点即切视图,鼠标停留 180ms 展开完整抽屉 */const EDGE_ICONS=[- ['','首页','<path d="M3 10.5 12 3l9 7.5V21H3z"/>'],- ['performers','全部艺人','<circle cx="12" cy="8" r="4"/><path d="M4.5 21a7.5 7.5 0 0 1 15 0"/>'],- ['tags','全部标签','<path d="M20 13l-7 7-9-9V4h7z"/><circle cx="8.5" cy="8.5" r="1.2"/>'],- ['flagged','已标记','<path d="M12 3.5 14.6 9l6 .9-4.3 4.2 1 6-5.3-2.8L6.7 20l1-6L3.4 9.9 9.4 9z"/>'],- ['shorts','短片','<rect x="7" y="3" width="10" height="18" rx="2"/><path d="M11 9l4 3-4 3z"/>'],- ['ads','疑似广告','<path d="M3 6h18M3 12h18M3 18h12"/><circle cx="19" cy="18" r="2.4"/>'],- ['immerse','沉浸模式','<path d="M4 8V5a1 1 0 0 1 1-1h3M20 8V5a1 1 0 0 0-1-1h-3M4 16v3a1 1 0 0 0 1 1h3M20 16v3a1 1 0 0 1-1 1h-3"/><path d="M10 9.2v5.6l5-2.8z"/>'],- ['stats','统计与管理','<path d="M4 20V10M10 20V4M16 20v-7M22 20H2"/>'],+ ['','首页','home'],+ ['performers','全部艺人','user-round'],+ ['tags','全部标签','tags'],+ ['flagged','已标记','star'],+ ['ads','疑似广告','list-filter'],+ ['immerse','沉浸模式','play'],+ ['stats','统计与管理','chart'],];function navOn(k){if(['immerse','stats','performers','tags'].includes(k))return false;@@ -1002,7 +1098,7 @@ function navOn(k){function buildEdge(){$('#edge').innerHTML=EDGE_ICONS.map(([k,t,ic])=>`<button data-nav="${k}" title="${t}" aria-pressed="${navOn(k)}">- <svg viewBox="0 0 24 24">${ic}</svg></button>`).join('')+ ${icon(ic)}</button>`).join('');$('#edge').querySelectorAll('[data-loc]').forEach(b=>b.onclick=()=>{const cur=(state.loc||'').split(',').filter(Boolean);@@ -1024,8 +1120,6 @@ function buildEdge(){let edgeT=null;$('#edge').addEventListener('mouseenter',()=>{if(Date.now()<drawerSuppressUntil)return;edgeT=setTimeout(()=>openDrawer(true),180)});-/* 主区左侧 110px 内也算感应区。- ⚠️ 上一版每次 mousemove 都查 DOM,滚动时明显卡顿 —— 加节流并缓存节点。 *//* 滚动期间挂起悬停预览:内容在鼠标下滑过会连续触发 mouseenter,每次都新建 video 并发起 /stream 请求,直接把页面拖垮。 */window.__scrolling=false; let scrollT=null, lastY=0, rafPending=false;@@ -1051,14 +1145,7 @@ window.addEventListener('scroll',()=>{clearTimeout(scrollT); scrollT=setTimeout(()=>{window.__scrolling=false},180);},{passive:true});-const drawerEl=$('#drawer'); let mmLast=0;-document.addEventListener('mousemove',e=>{- const now=e.timeStamp||Date.now();- if(now-mmLast<120)return; mmLast=now;- if(drawerEl.classList.contains('open')||Date.now()<drawerSuppressUntil)return;- if(e.clientX<110&&e.clientY>60){if(!edgeT)edgeT=setTimeout(()=>{openDrawer(true);edgeT=null},240)}- else if(edgeT){clearTimeout(edgeT);edgeT=null}-},{passive:true});+/* 只在真正进入 72 px 图标栏时展开;内容区左缘不再设隐形热区。 */$('#edge').addEventListener('mouseleave',()=>clearTimeout(edgeT));$('#drawer').addEventListener('mouseleave',()=>{setTimeout(()=>{if(!$('#drawer').matches(':hover')&&!$('#edge').matches(':hover'))openDrawer(false)},240)});@@ -1082,6 +1169,7 @@ async function load(reset){renderCount();$('#loadSentinel').hidden=$('#grid').children.length>=total;wireCards($('#grid'));+ paintSelection();if(reset)loadShorts();}const loadObserver=new IntersectionObserver(entries=>{@@ -1089,7 +1177,11 @@ const loadObserver=new IntersectionObserver(entries=>{offset+=60;load(false)}},{rootMargin:'320px'});loadObserver.observe($('#loadSentinel'));-let qt;$('#q').oninput=e=>{clearTimeout(qt);qt=setTimeout(()=>{state.q=e.target.value.trim();load(true)},320)};+const SEARCH_HINTS=['Prestige','FC2','Sakura Misaki','丝袜','足交','ABW 番号'];+$('#q').placeholder='试试:'+SEARCH_HINTS[Math.floor(Math.random()*SEARCH_HINTS.length)];+const runSearch=()=>{state.q=$('#q').value.trim();route(state.q?'/?q='+encodeURIComponent(state.q):'/',true);load(true)};+let qt;$('#q').oninput=()=>{clearTimeout(qt);qt=setTimeout(runSearch,320)};+$('#q').onkeydown=e=>{if(e.key==='Enter'){e.preventDefault();clearTimeout(qt);runSearch();$('#q').blur()}};async function loadShorts(){if(state.orient==='竖屏'||state.state==='ads'){$('#shortsSec').hidden=true;return}@@ -1104,17 +1196,29 @@ async function loadShorts(){}/* ── 就地展开播放 ── */-async function openItem(id){+async function openItem(id,push=true){+ if(push)route('/item/'+id);const it=await api('/api/item?id='+id); if(it.error)return;current=it; CACHE[it.id]=it;const gated=it.cost==='metered';const who=it.creator||it.code||it.studio||'未归属';- const entityPills=[- ...(it.performers||[]).map(x=>['performer','女优',x]),- ...((it.entities&&it.entities.studio)||[]).map(x=>['studio','厂牌',x]),- ...((it.entities&&it.entities.creator)||[]).map(x=>['creator','创作者',x]),- ...((it.entities&&it.entities.series)||[]).map(x=>['series','系列',x]),- ].map(([k,l,n])=>`<button class="entitylink" data-entity-kind="${k}" data-entity-name="${esc(n)}">${l} · ${esc(n)}</button>`).join('');+ const refs=it.entity_refs||{},performerRef=(refs.performer||[])[0],studioRef=(refs.studio||[])[0];+ const performerName=performerRef?.name||(it.performers||[])[0]||'';+ const studioName=studioRef?.name||it.studio||'';+ const identityEntries=[+ performerName&&['performer','女优',performerName],+ studioName&&['studio','厂牌',studioName],+ ...((it.entities&&it.entities.creator)||[]).slice(0,1).map(x=>['creator','创作者',x]),+ ...((it.entities&&it.entities.series)||[]).slice(0,1).map(x=>['series','系列',x]),+ ].filter(Boolean);+ const identityRows=identityEntries.map(([k,l,n])=>{+ const visual=k==='performer'+ ? `<span>${esc(n.slice(0,1))}</span>${performerRef?`<img src="/entity-image?kind=performer&id=${performerRef.id}" alt="" onerror="this.remove()">`:''}`+ : k==='studio'+ ? `<span>${esc(n.slice(0,2))}</span><img src="/logo?studio=${encodeURIComponent(n)}" alt="" onerror="this.remove()">`+ : k==='series'?icon('tags'):`<span>${esc(n.slice(0,1))}</span>`;+ return `<div class="identityrow"><button class="identitymark ${k==='studio'?'logo ':''}entitylink" data-entity-kind="${k}" data-entity-name="${esc(n)}" title="打开${l}页">${visual}</button><span class="ilabel">${l}</span><button class="entitylink" data-entity-kind="${k}" data-entity-name="${esc(n)}">${esc(n)}</button></div>`;+ }).join('');$('#stage').hidden=false; delete $('#stage').dataset.c;$('#stage').innerHTML=`<div class="sgrid"><div class="vwrap"><button class="closestage" id="closeStage">收起 <kbd>Esc</kbd></button>@@ -1127,11 +1231,10 @@ async function openItem(id){<div class="side"><div class="stitle">${esc(it.name)}</div><div class="smeta mono">${srcBadge(it.location,it.cost,'srcbig')}- ${it.creator?`<button class="entitylink" data-entity-kind="creator" data-entity-name="${esc(it.creator)}">${esc(it.creator)}</button>`:`<span style="color:var(--tungsten);align-self:center">${esc(who)}</span>`}<span style="align-self:center">${it.width||'?'}×${it.height||'?'}</span><span style="align-self:center">${fmtSize(it.size||0)}</span></div>- ${entityPills?`<div class="stags" style="gap:9px">${entityPills}</div>`:''}- ${(it.tags||[]).length?`<div class="stags">${it.tags.slice(0,18).map(t=>+ <div class="detailidentity">${identityRows||`<div class="identityrow"><span></span><span class="ilabel">归属</span><span>${esc(who)}</span></div>`}</div>+ ${(it.tags||[]).some(t=>!DURATION_TAGS.has(t.k))?`<div class="stags">${it.tags.filter(t=>!DURATION_TAGS.has(t.k)).slice(0,18).map(t=>`<span class="tg ${t.cat}" data-tag="${esc(t.k)}">${esc(t.k)}</span>`).join('')}</div>`:''}<div class="trace"><div class="lab mono"><span>离开位置 / 全片</span><span id="ratioTxt">—</span></div><div class="bar"><u id="watched"></u><b id="mark" style="left:0"></b></div>@@ -1141,30 +1244,22 @@ async function openItem(id){<div class="bar"><u id="realBar" style="background:color-mix(in srgb,var(--keep) 40%,transparent)"></u></div></div><div class="fb">- <button class="dislike" data-kind="dislike" aria-pressed="${it.feedback==='dislike'}">- <svg viewBox="0 0 24 24"><path d="M7 14v7H3v-7h4Zm0 1h10.2a2 2 0 0 0 1.9-1.4l1.7-5.5A2 2 0 0 0 18.9 5H14l.7-3.3M7 14l5.6 7.2a2.2 2.2 0 0 0 2.1-2.7L14 15"/></svg>- <span class="k">不合口味</span><span class="d">降维度权重</span></button>- <button class="seen" data-kind="seen" aria-pressed="${it.feedback==='seen'}">- <svg viewBox="0 0 24 24"><path d="M2.5 12s3.5-6 9.5-6 9.5 6 9.5 6-3.5 6-9.5 6-9.5-6-9.5-6Z"/><circle cx="12" cy="12" r="2.5"/></svg>- <span class="k">看过了</span><span class="d">只降近期</span></button>- <button class="dispose" data-kind="dispose" aria-pressed="${it.disposal==='pending'}">- <svg viewBox="0 0 24 24"><path d="M4 7h16M9 7V4h6v3M7 7l1 14h8l1-14M10 11v6M14 11v6"/></svg>- <span class="k">标记待删</span><span class="d">不删文件</span></button>- <button class="like" id="likeBtn" aria-pressed="${!!it.liked}">- <svg viewBox="0 0 24 24"><path d="M7 10v10H3V10h4Zm0 9h10.2a2 2 0 0 0 1.9-1.4l1.7-5.5A2 2 0 0 0 18.9 9H14l.7-3.3A2.2 2.2 0 0 0 12.6 3L7 10Z"/></svg>- <span class="k">${it.liked?'已喜欢':'喜欢'}</span><span class="d">记录口味偏好</span></button></div>+ <button class="like" id="likeBtn" aria-label="${it.liked?'取消喜欢':'喜欢'}" title="喜欢 · 记录口味偏好" aria-pressed="${!!it.liked}">${icon('thumbs-up')}</button>+ <button class="dislike" data-kind="dislike" aria-label="不合口味" title="不合口味 · 降低推荐权重" aria-pressed="${it.feedback==='dislike'}">${icon('thumbs-down')}</button>+ <button class="seen" data-kind="seen" aria-label="看过了" title="看过了 · 只降低近期推荐" aria-pressed="${it.feedback==='seen'}">${icon('eye')}</button>+ <button class="later" id="stageLater" aria-label="稍后看" title="稍后看 · 加入或移出队列" aria-pressed="${!!it.watch_later}">${it.watch_later?icon('check'):icon('bookmark-plus')}</button>+ <button class="dispose" data-kind="dispose" aria-label="加入待删候选" title="加入待删候选 · 不立即删除;统一复核 CSV 后才执行" aria-pressed="${it.disposal==='pending'}">${icon('trash')}</button></div><div class="preference"><textarea id="likeReason" maxlength="2000" placeholder="为什么喜欢?例如节奏、人物、镜头、氛围……">${esc(it.like_reason||'')}</textarea><div class="preference-foot"><span id="preferenceState">原文仅保存在本机</span><button class="savepreference" id="savePreference">保存原因</button></div></div>- <button class="obtn" data-kind="o">记一次高潮 <b class="mono" id="oCount">${it.o_count||0}</b></button>- <button class="obtn" id="stageLater" aria-pressed="${!!it.watch_later}">${it.watch_later?'✓ 已加入稍后看':'+ 稍后看'}</button>- <div class="hint mono">前三个只打标记,随时可撤。删除永远走「先出 CSV 再执行」,不在这个页面里。</div>+ <button class="obtn" data-kind="o">${icon('heart')}<span>记一次高潮</span><b class="mono" id="oCount">${it.o_count||0}</b></button>+ <div class="hint mono">待删只加入候选,不会删除文件;实际删除需复核 CSV 后单独执行。</div></div></div><div class="next"><h3>接着看 · 口味接近</h3><div class="nrow" id="nrow">载入中…</div></div>`;- $('#closeStage').onclick=()=>{const v=$('#vid');v&&v.pause();$('#stage').hidden=true};+ $('#closeStage').onclick=()=>{const v=$('#vid');v&&v.pause();$('#stage').hidden=true;route('/')};const g=$('#gate'); if(g)g.onclick=()=>{const v=$('#vid');v.src='/stream?id='+it.id;v.hidden=false;g.remove();v.play()};$('#stage').querySelectorAll('[data-kind]').forEach(b=>b.onclick=async()=>{@@ -1181,7 +1276,7 @@ async function openItem(id){$('#stageLater').onclick=async()=>{const r=await api('/api/watch-later',{method:'POST',body:JSON.stringify({id:it.id})});it.watch_later=r.watch_later;$('#stageLater').setAttribute('aria-pressed',r.watch_later);- $('#stageLater').textContent=r.watch_later?'✓ 已加入稍后看':'+ 稍后看'};+ $('#stageLater').innerHTML=r.watch_later?icon('check'):icon('bookmark-plus')};const savePreference=async()=>{const btn=$('#savePreference'),like=$('#likeBtn'),stateText=$('#preferenceState');btn.disabled=true;stateText.textContent='保存中…';@@ -1189,7 +1284,7 @@ async function openItem(id){const liked=like.getAttribute('aria-pressed')==='true'||reason.trim().length>0;try{const r=await api('/api/preference',{method:'POST',body:JSON.stringify({id:it.id,liked,reason})});it.liked=r.liked;it.like_reason=r.like_reason;- like.setAttribute('aria-pressed',r.liked);like.querySelector('.k').textContent=r.liked?'已喜欢':'喜欢';+ like.setAttribute('aria-pressed',r.liked);like.setAttribute('aria-label',r.liked?'取消喜欢':'喜欢');stateText.textContent='已保存 · AI 不会直接改写原文';}catch(e){stateText.textContent='保存失败 · 请重试'}finally{btn.disabled=false}};@@ -1206,7 +1301,7 @@ async function openItem(id){$('#realBar').style.width=rp.toFixed(1)+'%';}wireTelemetry(it,vv,{watched:'#watched',mark:'#mark',ratio:'#ratioTxt'});- $('#stage').scrollIntoView({behavior:'smooth',block:'start'});+ $('#stage').scrollIntoView({behavior:'auto',block:'start'});api('/api/related?id='+it.id+'&limit=20').then(d=>{const n=$('#nrow'); if(!n)return; cache(d.items);@@ -1241,7 +1336,7 @@ function wireTelemetry(it,v,sel){}/* ── 短片全屏 ── */-let tokList=[],tokIdx=0;+let tokList=[],tokIdx=0,tokSwitching=false;/* 沉浸模式 = 滚动刷新的连续流,横屏竖屏都进(不是「短片模式」)。队列滚到尾自动续取下一页,形成无限流。 */let tokOffset=0, tokLoading=false;@@ -1255,7 +1350,8 @@ async function fetchTok(off){for(let i=list.length-1;i>0;i--){const j=Math.random()*(i+1)|0;[list[i],list[j]]=[list[j],list[i]]}return list;}-async function openTok(startId){+async function openTok(startId,push=true){+ if(push)route('/immerse');tokOffset=0;tokList=await fetchTok(0);if(!tokList.length){alert('当前筛选下没有可直接播放的内容(计费源不进沉浸模式)');return}@@ -1263,17 +1359,31 @@ async function openTok(startId){$('#tok').hidden=false;document.body.style.overflow='hidden';tokShow();}async function tokShow(dir){- const it=tokList[tokIdx];if(!it)return;- const vEl=$('#tokVid');- if(dir){ // 切换动画:先滑出,换源后滑回- vEl.classList.add(dir>0?'slide-up':'slide-dn');- await new Promise(r=>setTimeout(r,180));- vEl.classList.remove('slide-up','slide-dn');- vEl.classList.add(dir>0?'slide-dn':'slide-up');- requestAnimationFrame(()=>requestAnimationFrame(()=>vEl.classList.remove('slide-up','slide-dn')));- }+ const it=tokList[tokIdx];if(!it||tokSwitching)return;+ tokSwitching=true;const full=await api('/api/item?id='+it.id);- const v=$('#tokVid');v.src='/stream?id='+it.id;v.play().catch(()=>{});+ const track=$('#tokTrack'),old=$('#tokVid');+ let v=old;+ if(dir&&old&&old.getAttribute('src')){+ v=document.createElement('video');v.id='tokIncoming';v.playsInline=true;v.preload='auto';+ v.src='/stream?id='+it.id;v.style.transform=`translateY(${dir>0?100:-100}%)`;track.appendChild(v);+ await Promise.race([new Promise(resolve=>v.addEventListener('loadeddata',resolve,{once:true})),+ new Promise(resolve=>setTimeout(resolve,650))]);+ requestAnimationFrame(()=>requestAnimationFrame(()=>{+ old.style.transform=`translateY(${dir>0?-100:100}%)`;v.style.transform='translateY(0)'}));+ await new Promise(resolve=>setTimeout(resolve,210));+ old.pause();old.remove();v.id='tokVid';v.style.transform='';+ }else{+ v.src='/stream?id='+it.id;+ }+ if(location.pathname==='/'){+ const url=new URL(location.href),query=new URLSearchParams();+ for(const key of ['q','loc','creator','studio','tag','len','dur_min','dur_max','orient','state','sort']){+ const value=state[key];if(value&&!(key==='loc'&&value==='local,115')&&!(key==='sort'&&value==='daily'))query.set(key,value)+ }+ url.search=query.toString();history.replaceState({},'',url.pathname+(url.search||''));+ }+ v.play().catch(()=>{});$('#tokTitle').textContent=it.name;const who=(full.performers&&full.performers[0])||full.creator||it.code||'未归属';$('#tokWho').textContent=who;@@ -1297,8 +1407,10 @@ async function tokShow(dir){$('#tokOn').textContent=full.o_count||0;api('/api/play',{method:'POST',body:JSON.stringify({id:it.id})});wireTelemetry(it,v,{});+ tokSwitching=false;}async function tokNext(d){+ if(tokSwitching)return;tokIdx=tokIdx+d;// 滚到尾部就续取下一页 —— 无限流if(tokIdx>=tokList.length-3 && !tokLoading){@@ -1310,7 +1422,7 @@ async function tokNext(d){}if(tokIdx>=tokList.length)tokIdx=0;if(tokIdx<0)tokIdx=tokList.length-1;- tokShow(d);+ await tokShow(d);}$('#tokBtn').onclick=()=>openTok();$('#immerseBtn').onclick=()=>openTok();@@ -1319,12 +1431,13 @@ $('#searchBtn').onclick=()=>{const s=$('.search');s.classList.toggle('open');if(s.classList.contains('open'))$('#q').focus()};$('#q').addEventListener('blur',()=>{if(!$('#q').value)$('.search').classList.remove('open')});$('#brandHome').onclick=e=>{e.preventDefault();- state={loc:state.loc,creator:'',studio:'',tag:'',len:'',orient:'',state:'',sort:'daily',seed:String((Date.now()^(Math.random()*1e9|0))%99991),q:'',thumb:'1'};- $('#q').value='';$('#stage').hidden=true;buildBars();load(true);window.scrollTo({top:0,behavior:'smooth'})};-$('#tokClose').onclick=()=>{$('#tok').hidden=true;const v=$('#tokVid');v.pause();v.removeAttribute('src');- v.load();document.body.style.overflow=''};+ state={loc:state.loc,creator:'',studio:'',tag:'',len:'',dur_min:'',dur_max:'',orient:'',state:'',sort:'daily',seed:String((Date.now()^(Math.random()*1e9|0))%99991),q:'',thumb:'1'};+ route('/');$('#q').value='';$('#stage').hidden=true;buildBars();load(true);window.scrollTo({top:0,behavior:'smooth'})};+$('#tokClose').onclick=()=>{route('/');$('#tok').hidden=true;$('#tokTrack').querySelectorAll('video').forEach(v=>{+ v.pause();v.removeAttribute('src');v.load();if(v.id!=='tokVid')v.remove()});+ const v=$('#tokVid');if(v){v.style.transform=''}tokSwitching=false;document.body.style.overflow=''};let wl=0;-$('#tok').addEventListener('wheel',e=>{const n=Date.now();if(n-wl<420)return;wl=n;tokNext(e.deltaY>0?1:-1)},{passive:true});+$('#tok').addEventListener('wheel',e=>{const n=Date.now();if(n-wl<260)return;wl=n;tokNext(e.deltaY>0?1:-1)},{passive:true});let ty=0;$('#tok').addEventListener('touchstart',e=>ty=e.touches[0].clientY,{passive:true});$('#tok').addEventListener('touchend',e=>{const dy=ty-e.changedTouches[0].clientY;@@ -1386,8 +1499,18 @@ function wireDrag(el){function wireAllDrag(){['#tagbar','#srow','#nrow'].forEach(s=>wireDrag($(s)));document.querySelectorAll('.tier').forEach(wireDrag)}+async function restoreRoute(){+ const path=decodeURIComponent(location.pathname),parts=path.split('/').filter(Boolean);+ if(parts[0]==='item'&&/^\d+$/.test(parts[1]||'')){await openItem(+parts[1],false);return}+ if(parts[0]==='entity'&&parts.length>=3){await openEntity(parts[1],parts.slice(2).join('/'),false);return}+ if(path==='/performers'||path==='/tags'){await openIndex(path.slice(1),new URLSearchParams(location.search).get('q')||'',false);return}+ if(path==='/stats'){await openStats(false);return}+ if(path==='/immerse'){await openTok(undefined,false);return}+ $('#stats').hidden=true;$('#index').hidden=true;$('#stage').hidden=true;+}+window.addEventListener('popstate',restoreRoute);buildEdge();-buildBars().then(()=>{buildEdge();wireAllDrag();load(true)});+buildBars().then(async()=>{buildEdge();wireAllDrag();await load(true);await restoreRoute()});</script></body></html>diff --git a/web/vendor/lucide-LICENSE.txt b/web/vendor/lucide-LICENSE.txtnew file mode 100644index 000000000..0d69492b2--- /dev/null+++ b/web/vendor/lucide-LICENSE.txt@@ -0,0 +1,41 @@+ISC License++Copyright (c) 2026 Lucide Icons and Contributors++Permission to use, copy, modify, and/or distribute this software for any+purpose with or without fee is hereby granted, provided that the above+copyright notice and this permission notice appear in all copies.++THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY+SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR+IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.++Some included Lucide icons are derived from Feather.++The MIT License (MIT)++Copyright (c) 2013-present Cole Bemis++Permission is hereby granted, free of charge, to any person obtaining a copy+of this software and associated documentation files (the "Software"), to deal+in the Software without restriction, including without limitation the rights+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+copies of the Software, and to permit persons to whom the Software is+furnished to do so, subject to the following conditions:++The above copyright notice and this permission notice shall be included in all+copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE+SOFTWARE.++Full upstream license: https://github.com/lucide-icons/lucide/blob/main/LICENSE