Peach: Local-first video metadata scraper and media manager.
feat(web): 人物页给出 JavDB、minnano-av 与 MISSAV 的直达入口
longmeidao650a7841447e
diff --git a/docs/SOURCING.md b/docs/SOURCING.mdindex 8b8b018b3..36d666cc9 100644--- a/docs/SOURCING.md+++ b/docs/SOURCING.md@@ -568,6 +568,12 @@ av911.tv,三条候选已进复核队列。逐个写法搜 `search?f=actor&q=`,结果卡片的 `title` 一栏就是这个人在站上的全部写法,不点进去就能判身份。名字链要整条搜完再放弃——账本的规范名多是简体(`三上悠亚`),javdb 上是 `三上悠亜`/`三上悠亞`,`name_key()` 不做简繁转换,只搜规范名一个都搜不到(`harvest_directory_links.collect_javdb`)。+- **javdb 的演员 id 在作品详情页就拿得到,不必另走一趟资料页。** 演員一栏每个名字都挂着+ `/actors/<id>`,`community_catalog.javdb_actresses` 取名字时顺手带出来,名字精确匹配到这条+ 资产已关联的人物实体才登记成 `entity_external_ref(provider='javdb', external_kind='performer')`。+ 人物页的 JavDB 入口就是靠它拼的(`peach.entry_links`),另开一页只是把同一页再取一遍,+ 而 javdb 的配额最紧。历史数据走 `scripts/backfill_performer_entry_ids.py`:javdb 页面缓存与+ `review/agency-rosters.csv` 的 `actress_id` 各补一路,先出 dry-run CSV 再 `--apply`。- **同名两条记录不取第一个。** 同一位女优在站上常有「有碼」「無碼」两条,搜索结果把两条都给出来;两页都进判定,撞上的账号会落成 `conflict` 进复核表。取第一个是默默替用户挑了一位。- **一部分资料页要登录,回的是登入页而不是 401。** 不注册账号,那一页记一行「未取得」并写明是谁——diff --git a/frontend/src/react/bundle.d.ts b/frontend/src/react/bundle.d.tsindex 1dbb0aec5..95b6eee32 100644--- a/frontend/src/react/bundle.d.ts+++ b/frontend/src/react/bundle.d.ts@@ -37,6 +37,18 @@ export interface UninstallState {export interface PeachProxyState { mode: string; proxy_saved: boolean; needs_selection: boolean }+/** 人物资料页上的一枚外部入口。`placeholder` 是这一站的模板里该填的那个占位符。 */+export interface EntryLinkSite {+ key: string;+ label: string;+ placeholder: string;+ enabled: boolean;+ template: string;+ default_template: string;+}++export interface EntryLinksState { sites: EntryLinkSite[] }+export interface AutomaticUpdateState {mode: string; interval_hours: number; available: boolean; download_available: boolean; error?: string;}@@ -71,6 +83,7 @@ export interface ConfigurationData {startup?: StartupState;uninstall?: UninstallState;peach_proxy?: PeachProxyState;+ entry_links?: EntryLinksState;updates?: ReleaseState;update_job?: UpdateJob;automatic_updates?: AutomaticUpdateState;diff --git a/frontend/src/react/settings/configuration-page.tsx b/frontend/src/react/settings/configuration-page.tsxindex b6dad8192..04e18aa11 100644--- a/frontend/src/react/settings/configuration-page.tsx+++ b/frontend/src/react/settings/configuration-page.tsx@@ -31,11 +31,12 @@ export function ConfigurationPage({ receipt, reopenTutorial }: ConfigurationProp);}const group: ConfigurationGroupProps = { data, receipt };+ const general = Boolean(data.startup || data.entry_links);const network = Boolean(data.peach_proxy || data.access || data.tunnel);return (<div className="configpage">- {data.startup ? <h2 className="configgroup">通用</h2> : null}- {data.startup ? <GeneralSettings {...group} /> : null}+ {general ? <h2 className="configgroup">通用</h2> : null}+ {general ? <GeneralSettings {...group} /> : null}<h2 className="configgroup">媒体</h2><MediaSettings {...group} />{network ? <h2 className="configgroup">网络与访问</h2> : null}diff --git a/frontend/src/react/settings/entry-links-settings.tsx b/frontend/src/react/settings/entry-links-settings.tsxnew file mode 100644index 000000000..52713d07a--- /dev/null+++ b/frontend/src/react/settings/entry-links-settings.tsx@@ -0,0 +1,71 @@+/* 「外部入口」:人物资料页上通向 JavDB、minnano-av 与 MISSAV 的那三枚直达入口。+ *+ * 每站一个开关加一条地址模板。地址由服务端拼(`peach.entry_links`),这一页交的只是+ * 模板本身——站点 id 与规范名都在账本里,前端拿不到也不该拿。模板里的占位符由服务端+ * 按站点给(`{javdb_id}`、`{minnano_id}`、`{name}`),所以提示里直接写它那一个。+ *+ * 校验也只在服务端:哪种地址算得上一条入口是它说了算,前端复制一份判定只会漂。 */+import { useState, type FormEvent } from 'react';++import { SettingsRow } from '@/components/application/settings/settings-rows';+import { Button } from '@/components/base/buttons/button';+import { Input } from '@/components/base/input/input';+import { Switch } from '@/components/base/switch/switch';++import { apiSend } from '../../api';+import type { EntryLinkSite, EntryLinksState } from '../bundle';+import { ErrorText, Footer, Help, Rows, Section, Stack } from './section';+import { busyProps, useAction } from './use-action';++export function EntryLinksForm({ initial, receipt }: {+ initial: EntryLinksState;+ receipt(message: string): void;+}) {+ const [sites, setSites] = useState<EntryLinkSite[]>(initial.sites);+ const action = useAction();++ const change = (key: string, patch: Partial<EntryLinkSite>) =>+ setSites((rows) => rows.map((row) => (row.key === key ? { ...row, ...patch } : row)));++ const submit = (event: FormEvent<HTMLFormElement>) => {+ event.preventDefault();+ const body = {+ sites: Object.fromEntries(sites.map((site) =>+ [site.key, { enabled: site.enabled, template: site.template }])),+ };+ void action.run('save', (signal) =>+ apiSend<EntryLinksState>('/api/configuration/entry-links', body, 'POST', signal),+ (next) => {+ setSites(next.sites);+ receipt('已保存配置');+ });+ };++ return (+ <Section title="外部入口" onSubmit={submit}>+ <Rows>+ {sites.map((site) => (+ <SettingsRow key={site.key} label={site.label}+ description="在女优资料页给出这个站点的直达入口。">+ <Switch aria-label={`在资料页显示 ${site.label} 入口`} isSelected={site.enabled}+ onChange={(enabled) => change(site.key, { enabled })} />+ </SettingsRow>+ ))}+ </Rows>+ <Stack divided>+ <Help>账本里没有这个站点 id 的人物不显示它那一枚入口,地址不会退回站内搜索。</Help>+ {sites.map((site) => (+ <Input key={site.key} id={`entry-link-${site.key}`} label={`${site.label} 地址模板`}+ autoComplete="off" maxLength={300} value={site.template}+ onChange={(template) => change(site.key, { template })}+ validationBehavior="aria"+ hint={`用 {${site.placeholder}} 占位,默认 ${site.default_template}`} />+ ))}+ {action.error ? <ErrorText>{action.error}</ErrorText> : null}+ </Stack>+ <Footer>+ <Button type="submit" {...busyProps(action.busy === 'save')}>保存配置</Button>+ </Footer>+ </Section>+ );+}diff --git a/frontend/src/react/settings/general-settings.tsx b/frontend/src/react/settings/general-settings.tsxindex bc36f8cf6..cd428b51e 100644--- a/frontend/src/react/settings/general-settings.tsx+++ b/frontend/src/react/settings/general-settings.tsx@@ -1,4 +1,4 @@-/* 「通用」分组:开机自启与桌面快捷方式。 */+/* 「通用」分组:开机自启与桌面快捷方式,加上人物资料页那三枚外部入口。 */import { useState, type FormEvent } from 'react';import { SettingsRow } from '@/components/application/settings/settings-rows';@@ -7,11 +7,17 @@ import { Switch } from '@/components/base/switch/switch';import { apiSend } from '../../api';import type { ConfigurationGroupProps, StartupState } from '../bundle';+import { EntryLinksForm } from './entry-links-settings';import { ErrorText, Footer, Help, Rows, Section, Stack } from './section';import { busyProps, useAction } from './use-action';export function GeneralSettings({ data, receipt }: ConfigurationGroupProps) {- return data.startup ? <StartupSettings startup={data.startup} receipt={receipt} /> : null;+ return (+ <div className="flex flex-col gap-6">+ {data.startup ? <StartupSettings startup={data.startup} receipt={receipt} /> : null}+ {data.entry_links ? <EntryLinksForm initial={data.entry_links} receipt={receipt} /> : null}+ </div>+ );}export function StartupSettings({ startup, receipt }: { startup: StartupState; receipt(message: string): void }) {diff --git a/frontend/test/react/entry-links.test.tsx b/frontend/test/react/entry-links.test.tsxnew file mode 100644index 000000000..6ccad7624--- /dev/null+++ b/frontend/test/react/entry-links.test.tsx@@ -0,0 +1,58 @@+import { expect, it, vi } from 'vitest';++import { GeneralSettings } from '../../src/react/settings/general-settings';+import type { ConfigurationData, EntryLinksState } from '../../src/react/bundle';+import { buttonNamed, click, fetchMock, mount, sentBody, settle, submit, switches, type } from './render';++const data = (over: Partial<ConfigurationData> = {}): ConfigurationData => ({+ editable: true, notice: '', revision: 'rev-1', media_dirs: [], port: 9123, facts: [], ...over,+});++const state: EntryLinksState = {+ sites: [+ { key: 'javdb', label: 'JavDB', placeholder: 'javdb_id', enabled: true,+ template: 'https://javdb.com/actors/{javdb_id}?sort_type=4',+ default_template: 'https://javdb.com/actors/{javdb_id}?sort_type=4' },+ { key: 'minnano-av', label: 'minnano-av', placeholder: 'minnano_id', enabled: true,+ template: 'https://www.minnano-av.com/actress{minnano_id}.html',+ default_template: 'https://www.minnano-av.com/actress{minnano_id}.html' },+ { key: 'missav', label: 'MISSAV', placeholder: 'name', enabled: false,+ template: 'https://missav.ws/dm42/cn/actresses/{name}',+ default_template: 'https://missav.ws/dm42/cn/actresses/{name}' },+ ],+};++it('外部入口:三站各一颗开关与一条模板,保存发出开关与模板的实际值', async () => {+ const fetcher = fetchMock(200, state);+ vi.stubGlobal('fetch', fetcher);+ const receipt = vi.fn();+ const host = await mount(<GeneralSettings data={data({ entry_links: state })} receipt={receipt} />);+ expect(switches(host).map((input) => input.getAttribute('aria-label')))+ .toEqual(['在资料页显示 JavDB 入口', '在资料页显示 minnano-av 入口', '在资料页显示 MISSAV 入口']);+ expect(switches(host).map((input) => input.checked)).toEqual([true, true, false]);+ // 占位符按站给:提示里写错一个,改模板的人就会把服务端填不进去的名字写进地址。+ expect(host.textContent).toContain('用 {javdb_id} 占位');+ expect(host.textContent).toContain('用 {name} 占位');+ await click(switches(host)[2]);+ await type(host.querySelector('#entry-link-minnano-av'),+ 'https://www.minnano-av.com/actress{minnano_id}.html?x=1');+ expect(fetcher).not.toHaveBeenCalled();+ await submit(host.querySelector('form'));+ await settle();+ expect(fetcher.mock.calls[0]?.[0]).toBe('/api/configuration/entry-links');+ expect(sentBody(fetcher)).toEqual({+ sites: {+ javdb: { enabled: true, template: 'https://javdb.com/actors/{javdb_id}?sort_type=4' },+ 'minnano-av': { enabled: true, template: 'https://www.minnano-av.com/actress{minnano_id}.html?x=1' },+ missav: { enabled: true, template: 'https://missav.ws/dm42/cn/actresses/{name}' },+ },+ });+ expect(receipt).toHaveBeenCalledWith('已保存配置');+});++it('服务端没下发外部入口时通用组里不画这一节', async () => {+ // 站点清单由服务端给。前端自己兜一份默认的话,那份迟早和 `peach.entry_links` 分叉。+ const host = await mount(<GeneralSettings data={data()} receipt={vi.fn()} />);+ expect(host.textContent).not.toContain('外部入口');+ expect(buttonNamed('保存配置', host)).toBeNull();+});diff --git a/scripts/backfill_performer_entry_ids.py b/scripts/backfill_performer_entry_ids.pynew file mode 100644index 000000000..89f7ad7c3--- /dev/null+++ b/scripts/backfill_performer_entry_ids.py@@ -0,0 +1,196 @@+#!/usr/bin/env python3+# -*- coding: utf-8 -*-+"""把历史证据里的 javdb 演员 id 与 minnano-av 女优 id 落成 `entity_external_ref`。++人物资料页的外部入口按 `entity_external_ref` 里的站点 id 拼地址,没有 id 的站点不出现。+采集作品页时 id 跟着名字一起回来(`community_catalog.javdb_actresses`);账本里已有的+几百位女优,她们的 id 散在两处**已经取回来的**证据里:++- **javdb 的页面缓存**(`peach.page_cache.Site` 落盘的整页 HTML)。资料页里有+ `href="/actors/<id>/collect"`,解析走 `peach.javdb`,和取中文名那条路同一份判据。+- **复核 CSV**。`harvest_agency_rosters.py` 的名册件每行都带 `entity_id` 与+ `actress_id`,那就是 minnano-av 的女优 id;`harvest_javdb_cn_names.py` 的件带+ `actor_id`。++两处都是磁盘上现成的东西,这个脚本一次网都不出。默认 dry-run,只产出复核 CSV;+`--apply` 才写库,并且必须同时给 `--backup`。++名字对不上就不登记:javdb 页那一侧按整条名字链(规范名加别名)精确匹配,同一页对上两条+实体、或同一条实体对上两个 id 时都记 `冲突` 让人看,不挑一个。已经有同 provider 的 id 时+不覆盖——那是另一件事,要先判哪个对。+"""+from __future__ import annotations++import argparse+import collections+import sqlite3+import sys+from pathlib import Path++PROJECT_ROOT = Path(__file__).resolve().parent.parent+SRC_DIR = PROJECT_ROOT / "src"+if str(SRC_DIR) not in sys.path:+ sys.path.insert(0, str(SRC_DIR))++from peach import javdb # noqa: E402+from peach.config import STATE_DIR # noqa: E402+from peach.entry_links import EXTERNAL_KIND # noqa: E402+from peach.review_csv import read_rows, write_rows # noqa: E402+from peach.scripting import add_ledger_write_args, open_for_write, verify_after_write # noqa: E402+from peach.social_links import name_key # noqa: E402++JAVDB, MINNANO = "javdb", "minnano-av"+#: 复核 CSV 里这两列就是站点 id,列名由产出它们的脚本定下。+CSV_COLUMNS = {"actor_id": JAVDB, "actress_id": MINNANO}++OK, HAVE, CONFLICT, NOT_PERFORMER = "ok", "已有", "冲突", "不是女优实体"++FIELDS = ("entity_id", "canonical_name", "provider", "external_id",+ "origin", "verdict", "evidence")+++def name_owners(connection: sqlite3.Connection) -> dict[str, set[int]]:+ """折叠键 → 拥有这个写法的女优实体。一个键对上两条就是重名,不猜。"""+ owners: dict[str, set[int]] = collections.defaultdict(set)+ for entity_id, written in connection.execute(+ "SELECT e.id,e.canonical_name FROM entity e WHERE e.kind='performer'"+ " UNION SELECT a.entity_id,a.alias FROM entity_alias a"+ " JOIN entity e ON e.id=a.entity_id WHERE e.kind='performer'"):+ if written:+ owners[name_key(str(written))].add(int(entity_id))+ return owners+++def from_page_cache(cache_dir: Path, owners: dict[str, set[int]]) -> dict:+ """缓存下来的 javdb 资料页 → 实体 → 演员 id 集合。"""+ found: dict[int, set[str]] = collections.defaultdict(set)+ for path in sorted(Path(cache_dir).glob("*.html")):+ try:+ html = path.read_text(encoding="utf-8", errors="replace")+ except OSError:+ continue+ actor = javdb.actor_id(html)+ if not actor:+ continue+ for written in javdb.all_names(html):+ for entity_id in owners.get(name_key(written), ()):+ found[entity_id].add(actor)+ return found+++def from_csv(paths, provider_of: dict[str, str]) -> dict:+ """复核 CSV → (provider, 实体)→ id 集合。列名决定这一列属于哪个站。"""+ found: dict[tuple[str, int], set[str]] = collections.defaultdict(set)+ for path in paths:+ try:+ rows = read_rows(path)+ except OSError:+ continue+ for row in rows:+ raw = str(row.get("entity_id") or "").strip()+ if not raw.isdigit():+ continue+ for column, provider in provider_of.items():+ value = str(row.get(column) or "").strip()+ if value:+ found[(provider, int(raw))].add(value)+ return found+++def _existing(connection: sqlite3.Connection) -> dict[tuple[str, int], str]:+ return {(str(provider), int(entity_id)): str(external_id)+ for entity_id, provider, external_id in connection.execute(+ "SELECT entity_id,provider,external_id FROM entity_external_ref"+ " WHERE external_kind=?", (EXTERNAL_KIND,))}+++def plan(connection: sqlite3.Connection, args: argparse.Namespace) -> list[dict]:+ """每条候选一行。已有、冲突、实体不对的也留行:下一趟要看得出这一位查过。"""+ owners = name_owners(connection)+ candidates: dict[tuple[str, int], tuple[set[str], str]] = {}+ if args.javdb_cache and Path(args.javdb_cache).is_dir():+ for entity_id, ids in from_page_cache(Path(args.javdb_cache), owners).items():+ candidates[(JAVDB, entity_id)] = (ids, f"javdb 页面缓存 {args.javdb_cache}")+ for path in args.csv:+ for (provider, entity_id), ids in from_csv([path], CSV_COLUMNS).items():+ have, origin = candidates.get((provider, entity_id), (set(), ""))+ candidates[(provider, entity_id)] = (+ have | ids, f"{origin};{Path(path).name}".strip(";"))+ names = {int(entity_id): str(written) for entity_id, written in connection.execute(+ "SELECT id,canonical_name FROM entity WHERE kind='performer'")}+ saved = _existing(connection)+ rows: list[dict] = []+ for (provider, entity_id), (ids, origin) in sorted(+ candidates.items(), key=lambda item: (item[0][0], item[0][1])):+ row = {"entity_id": entity_id, "canonical_name": names.get(entity_id, ""),+ "provider": provider, "external_id": "", "origin": origin,+ "verdict": OK, "evidence": ""}+ if entity_id not in names:+ row.update(verdict=NOT_PERFORMER, evidence="账本里这条实体不是女优")+ elif len(ids) > 1:+ row.update(verdict=CONFLICT,+ evidence=f"同一位对上 {len(ids)} 个 id:{'、'.join(sorted(ids))}")+ elif (provider, entity_id) in saved:+ row.update(external_id=saved[(provider, entity_id)],+ verdict=HAVE if saved[(provider, entity_id)] in ids else CONFLICT,+ evidence=(f"账本已有 {saved[(provider, entity_id)]},"+ f"证据给的是 {sorted(ids)[0]}"))+ else:+ row.update(external_id=sorted(ids)[0], evidence=f"{origin} 里只有这一个 id")+ rows.append(row)+ return rows+++def apply_rows(connection: sqlite3.Connection, rows: list[dict]) -> int:+ written = 0+ for row in rows:+ if row["verdict"] != OK or not row["external_id"]:+ continue+ connection.execute(+ "INSERT OR IGNORE INTO entity_external_ref"+ "(entity_id,provider,external_kind,external_id,metadata_json)"+ " VALUES(?,?,?,?,?)",+ (row["entity_id"], row["provider"], EXTERNAL_KIND, row["external_id"],+ '{"source": "backfill_performer_entry_ids"}'))+ written += connection.execute("SELECT changes()").fetchone()[0]+ connection.commit()+ return written+++def build_parser() -> argparse.ArgumentParser:+ parser = argparse.ArgumentParser(+ description="把 javdb 演员 id 与 minnano-av 女优 id 落成 entity_external_ref")+ add_ledger_write_args(parser)+ parser.add_argument("--out", type=Path, required=True, help="复核 CSV 的落点")+ parser.add_argument("--javdb-cache", type=Path,+ default=STATE_DIR / "directory-links" / "javdb",+ help="javdb 的页面缓存目录")+ parser.add_argument("--csv", type=Path, action="append", default=[],+ help="带 entity_id 与 actor_id/actress_id 的复核 CSV,可重复给")+ return parser+++def run(args: argparse.Namespace) -> int:+ connection = open_for_write(args)+ try:+ rows = plan(connection, args)+ write_rows(args.out, FIELDS, rows, fill_missing=True)+ counts = collections.Counter(str(row["verdict"]) for row in rows)+ by_site = collections.Counter(+ str(row["provider"]) for row in rows if row["verdict"] == OK)+ print(f"外部入口 id 候选 {len(rows)} 行,复核 CSV:{args.out}")+ print(" 判定分布:", dict(counts))+ print(" 可补的人物:", dict(by_site))+ if args.apply:+ written = apply_rows(connection, rows)+ integrity, violations = verify_after_write(connection)+ print(f"已写入 {written} 条 entity_external_ref;"+ f"integrity_check={integrity}、外键违规 {violations} 条")+ return 1 if violations or integrity != "ok" else 0+ finally:+ connection.close()+ return 0+++if __name__ == "__main__":+ raise SystemExit(run(build_parser().parse_args()))diff --git a/scripts/test_runner.py b/scripts/test_runner.pyindex 2c56790d4..1220c99ac 100644--- a/scripts/test_runner.py+++ b/scripts/test_runner.py@@ -38,7 +38,7 @@ SCOPES: dict[str, tuple[str, ...]] = {"test_entity_merge.py", "test_fastapi_api.py", "test_field_owners.py","test_migrations.py","test_review_mirror.py", "test_rm_web.py",- "test_entity_link_install.py", "test_web_links.py",+ "test_entity_link_install.py", "test_web_links.py", "test_entry_links.py","test_link_marks.py", "test_site_icons.py", "test_site_logos.py","test_avatar_face.py","test_brand_marks.py", "test_studio_icon_variants.py",diff --git a/src/peach/api.py b/src/peach/api.pyindex 0b2fe1ded..c4a56fa55 100644--- a/src/peach/api.py+++ b/src/peach/api.py@@ -138,6 +138,7 @@ def create_app(transcode_root=settings.transcode_root,stream_root=settings.stream_root,follow_state_root=settings.follow_state_root,+ entry_links_root=settings.entry_links_root,taste_history_root=settings.taste_history_output_root,taste_history_store=settings.taste_history_store,taste_history_import_root=settings.taste_history_import_root,diff --git a/src/peach/community_catalog.py b/src/peach/community_catalog.pyindex 64cbe476a..5f195b431 100644--- a/src/peach/community_catalog.py+++ b/src/peach/community_catalog.py@@ -79,7 +79,10 @@ _JAVDB_PANEL = re.compile(r'<div class="panel-block[^"]*">\s*<strong>([^<::]+)r'<span class="value">(.*?)</span>', re.S)_JAVDB_TITLE = re.compile(r'<strong class="current-title">([^<]*)</strong>')_JAVDB_COVER = re.compile(r'<img src="(https://[^"]+)" class="video-cover"')-_JAVDB_ACTRESS = re.compile(r'<a[^>]*class="actor-female"[^>]*>([^<]+)</a>')+_JAVDB_ACTRESS = re.compile(r'<a\s([^>]*)>([^<]+)</a>')+#: 演員一栏里每个人名都挂着自己的资料页。那串 id 正是人物页 JavDB 入口要的东西,+#: 取名字时顺手带出来——另走一趟演员页只是把同一页再取一遍,而 javdb 的配额最紧。+_JAVDB_ACTOR_HREF = re.compile(r'href="/actors/([A-Za-z0-9]+)"')_JAPANESE = re.compile(r"[-ヿ一-鿿]")@@ -183,6 +186,22 @@ def javbus_work(transport, code: str, *, deadline: float | None = None) -> dict:cover_urls=covers, cover_url=covers[0] if covers else "")+def javdb_actresses(value: str) -> list[dict]:+ """演員一栏里的女优:名字,以及她在 javdb 的演员 id。++ 男优挂的是同样的 `/actors/` 链接,靠 `actor-female` 分开。href 与 class 在标签里的+ 先后不固定,所以先取整段属性再判,不假设它们的次序。+ """+ found = []+ for attributes, name in _JAVDB_ACTRESS.findall(value):+ if "actor-female" not in attributes:+ continue+ actor = _JAVDB_ACTOR_HREF.search(attributes)+ found.append({"japanese_name": clean(name), "profile_source": "javdb",+ "external_id": actor.group(1) if actor else ""})+ return found++def _javdb_page(transport, url: str, *, deadline: float | None) -> str:page = _text(_fetch(transport, url, referer=JAVDB_BASE + "/", limit=PAGE_LIMIT, deadline=deadline))if JAVDB_LOGIN.search(page):@@ -211,7 +230,7 @@ def javdb_work(transport, code: str, *, deadline: float | None = None) -> dict:title = _JAVDB_TITLE.search(page)cover = _JAVDB_COVER.search(page)return dict(id=shown, source_url=url, title=clean(title.group(1)) if title else "",- actresses=[{"japanese_name": clean(name)} for name in _JAVDB_ACTRESS.findall(panel.get("演員", ""))],+ actresses=javdb_actresses(panel.get("演員", "")),maker=_maker_writing(clean(panel.get("片商", ""))), label=clean(panel.get("發行", "")),series=clean(panel.get("系列", "")), director=clean(panel.get("導演", "")),release_date=clean(panel.get("日期", "")), runtime=int(runtime.group()) if runtime else None,diff --git a/src/peach/config.py b/src/peach/config.pyindex 31c4b089b..78e91f9d8 100644--- a/src/peach/config.py+++ b/src/peach/config.py@@ -141,3 +141,5 @@ class PeachSettings:taste_history_manifest: Path = STATE_DIR / "taste-history" / "manifest.json"# 自动追更频率是本机运行偏好,不属于 ledger 真相。follow_state_root: Path = STATE_DIR+ # 人物页外部入口的开关与地址模板,同样是本机偏好。+ entry_links_root: Path = STATE_DIRdiff --git a/src/peach/entry_links.py b/src/peach/entry_links.pynew file mode 100644index 000000000..9f39ee517--- /dev/null+++ b/src/peach/entry_links.py@@ -0,0 +1,176 @@+"""人物资料页的外部入口:三个站点的直达地址,以及它们的本机开关与模板。++入口只由后端拼:地址要用的两样东西都在服务端——`entity_external_ref` 里的站点 id,+和 `entity.canonical_name`。前端拿到的是一串 `{site, label, url}`,没有模板也没有+拼装规则,换一个站不必同时改两侧。++**没有 id 的站点不出现。** 退回搜索地址等于把「这个人在那边是谁」这件事交给站内检索+去猜,而同名的人正是最需要点进去核对的那一批;MISSAV 那条按规范名拼,是因为它的路径+本来就是名字,不是猜出来的检索词。+"""+from __future__ import annotations++import json+from dataclasses import dataclass+from pathlib import Path+from urllib.parse import quote++from filelock import FileLock++from .fsutil import atomic_write_text++#: 入口设置落在数据根的 state 目录下。它是本机显示偏好,不是账本真相。+FILENAME = "entry-links.json"+#: `entity_external_ref.external_kind`:人物那一档。+EXTERNAL_KIND = "performer"+++@dataclass(frozen=True)+class EntrySite:+ """一个入口站点。`provider` 空串表示这一站按名字拼,不需要账本里的 id。"""++ key: str+ label: str+ placeholder: str+ provider: str+ template: str+++SITES: tuple[EntrySite, ...] = (+ EntrySite("javdb", "JavDB", "javdb_id", "javdb",+ "https://javdb.com/actors/{javdb_id}?sort_type=4"),+ EntrySite("minnano-av", "minnano-av", "minnano_id", "minnano-av",+ "https://www.minnano-av.com/actress{minnano_id}.html"),+ EntrySite("missav", "MISSAV", "name", "",+ "https://missav.ws/dm42/cn/actresses/{name}"),+)+_BY_KEY = {site.key: site for site in SITES}+#: 模板长度上限。地址栏塞得下的东西远不止这个数,但入口模板只有一个占位符要填。+_TEMPLATE_LIMIT = 300+++def defaults() -> dict:+ """三站全开,模板即上面那三条。"""+ return {site.key: {"enabled": True, "template": site.template} for site in SITES}+++def _clean(saved: object) -> dict:+ """把读到的内容收敛成已知站点。坏值退回默认,不让一个手改坏的文件关掉整行入口。"""+ result = defaults()+ if not isinstance(saved, dict):+ return result+ rows = saved.get("sites")+ for key, value in (rows.items() if isinstance(rows, dict) else ()):+ site = _BY_KEY.get(str(key))+ if site is None or not isinstance(value, dict):+ continue+ if isinstance(value.get("enabled"), bool):+ result[site.key]["enabled"] = value["enabled"]+ template = value.get("template")+ if isinstance(template, str) and _template_problem(site, template.strip()) == "":+ result[site.key]["template"] = template.strip()+ return result+++def read(root: Path) -> dict:+ """当前设置。文件不在、读不出或内容坏掉都退回默认。"""+ try:+ return _clean(json.loads((Path(root) / FILENAME).read_text(encoding="utf-8")))+ except (OSError, ValueError):+ return defaults()+++def snapshot(root: Path) -> dict:+ """配置页要的形状:每站一行,带站名、占位符和可恢复的默认模板。"""+ saved = read(root)+ return {"sites": [{+ "key": site.key,+ "label": site.label,+ "placeholder": site.placeholder,+ "enabled": saved[site.key]["enabled"],+ "template": saved[site.key]["template"],+ "default_template": site.template,+ } for site in SITES]}+++def _template_problem(site: EntrySite, template: str) -> str:+ """模板不能用时的那一句原因;能用时是空串。"""+ mark = "{" + site.placeholder + "}"+ if not template:+ return f"{site.label} 的地址模板不能为空"+ if len(template) > _TEMPLATE_LIMIT:+ return f"{site.label} 的地址模板请控制在 {_TEMPLATE_LIMIT} 个字符以内"+ if any(char.isspace() for char in template):+ return f"{site.label} 的地址模板里不能有空格"+ if not template.startswith("https://"):+ return f"{site.label} 的地址模板要以 https:// 开头"+ if template.count(mark) != 1:+ return f"{site.label} 的地址模板要且只要一个 {mark}"+ if template.replace(mark, "").count("{") or template.replace(mark, "").count("}"):+ return f"{site.label} 的地址模板里只认 {mark} 这一个占位符"+ return ""+++def save(root: Path, body: dict) -> dict:+ """写回三站的开关与模板。任一项不合规就整批不写。"""+ rows = body.get("sites")+ if not isinstance(rows, dict):+ raise ValueError("请提交每个站点的开关与地址模板")+ result = defaults()+ for site in SITES:+ row = rows.get(site.key)+ if not isinstance(row, dict):+ raise ValueError(f"缺少 {site.label} 的设置")+ if not isinstance(row.get("enabled"), bool):+ raise ValueError(f"{site.label} 的开关必须是 true 或 false")+ template = row.get("template")+ if not isinstance(template, str):+ raise ValueError(f"{site.label} 的地址模板必须是文字")+ problem = _template_problem(site, template.strip())+ if problem:+ raise ValueError(problem)+ result[site.key] = {"enabled": row["enabled"], "template": template.strip()}+ path = Path(root) / FILENAME+ path.parent.mkdir(parents=True, exist_ok=True)+ with FileLock(str(path) + ".lock", timeout=5):+ atomic_write_text(path, json.dumps({"sites": result}, ensure_ascii=False))+ return snapshot(root)+++def provider_ids(refs) -> dict[str, str]:+ """`entity_external_ref` 的行 → 站点 id。只认人物那一档。"""+ found: dict[str, str] = {}+ for ref in refs or ():+ if str(ref.get("external_kind") or "") != EXTERNAL_KIND:+ continue+ external_id = str(ref.get("external_id") or "").strip()+ provider = str(ref.get("provider") or "")+ if external_id and provider not in found:+ found[provider] = external_id+ return found+++def build(settings: dict, canonical_name: str, refs) -> list[dict]:+ """这条人物实体能直达的站点。缺 id 的站点不出现在结果里。"""+ ids = provider_ids(refs)+ name = str(canonical_name or "").strip()+ out: list[dict] = []+ for site in SITES:+ row = settings.get(site.key) or {}+ if not row.get("enabled", True):+ continue+ value = ids.get(site.provider, "") if site.provider else name+ if not value:+ continue+ template = str(row.get("template") or site.template)+ if _template_problem(site, template):+ template = site.template+ out.append({"site": site.key, "label": site.label,+ "url": template.replace("{" + site.placeholder + "}",+ quote(value, safe=""))})+ return out+++def entry_links(root: Path, canonical_name: str, refs) -> list[dict]:+ """读设置并拼出入口。资料页只调这一个。"""+ return build(read(root), canonical_name, refs)diff --git a/src/peach/metadata.py b/src/peach/metadata.pyindex e1499d5a4..30515629c 100644--- a/src/peach/metadata.py+++ b/src/peach/metadata.py@@ -453,7 +453,9 @@ def normalized_performers(raw: object) -> tuple[list[dict], list[str]]:aliases.append(cleaned)performer = {"name": name,- "external_id": str(item.get("dmm_id") or ""),+ # `dmm_id` 是 r18/DMM 那一路的写法;别的来源给的是同一件东西的通用写法,+ # 两个键在这里合成一个字段,落库时跟着 `profile_source` 走。+ "external_id": str(item.get("dmm_id") or item.get("external_id") or ""),"thumb_url": str(item.get("thumb_url") or ""),}if aliases:diff --git a/src/peach/routes_configuration.py b/src/peach/routes_configuration.pyindex 9abc1f0fc..e84aa3e3b 100644--- a/src/peach/routes_configuration.py+++ b/src/peach/routes_configuration.py@@ -19,7 +19,8 @@ from fastapi import APIRouter, Body, Depends, HTTPException, Requestfrom fastapi.responses import JSONResponsefrom filelock import FileLock, Timeout-from . import access, distribution, folder_picker, onboarding, settings_file, media_configuration, tunnel+from . import (access, distribution, entry_links, folder_picker, onboarding, settings_file,+ media_configuration, tunnel)from .routes_auth import require_auth, same_originfrom .web_entry import runtime_fact_entriesfrom . import release_updates, standalone_update, peach_proxy, desktop_startup, desktop_uninstall@@ -107,6 +108,7 @@ def snapshot(config) -> dict[str, Any]:"startup": desktop_startup.snapshot(config),"uninstall": desktop_uninstall.snapshot(config),"peach_proxy": peach_proxy.describe(config.directory("secrets")),+ "entry_links": entry_links.snapshot(config.directory("state")),"updates": release_updates.snapshot(),"update_job": standalone_update.public(),"access": access.public(access.load(config.directory("secrets") / "access.json")),@@ -185,6 +187,16 @@ def save_peach_proxy(request: Request, body: dict = Body(...), _args=Depends(reqraise HTTPException(400, str(exc)) from exc[email protected]("/api/configuration/entry-links")+def save_entry_links(request: Request, body: dict = Body(...), _args=Depends(require_auth)):+ local_only(request)+ same_origin(request)+ try:+ return entry_links.save(settings_file.load_config().directory("state"), body)+ except (ValueError, OSError, Timeout) as exc:+ raise HTTPException(400, str(exc)) from exc++@router.post("/api/configuration/startup")def save_startup(request: Request, body: dict = Body(...), _args=Depends(require_auth)):local_only(request)diff --git a/src/peach/web_entity.py b/src/peach/web_entity.pyindex 5b9a4dd60..0432d4c74 100644--- a/src/peach/web_entity.py+++ b/src/peach/web_entity.py@@ -14,6 +14,7 @@ import timefrom urllib.parse import urlsplit+from . import entry_linksfrom .catalog_rules import LENGTH_TAGS, dir_expr, photo_set_title, tag_catfrom .entities import normalize_entity_name, resolve_entity, rewrite_flat_projectionfrom .web_catalog import (@@ -119,6 +120,12 @@ def q_entity(contract: WebContract, args):"FROM entity_external_ref WHERE entity_id=? ORDER BY provider,external_kind",(d["id"],),)]+ # 外部入口下发的是拼好的地址,不是模板:拼它要的站点 id 和规范名都在服务端,+ # 前端再拼一遍就会有两份规则。缺 id 的站点不出现在这个列表里。+ d["entry_links"] = (+ entry_links.entry_links(contract.entry_links_root, d["canonical_name"],+ d["external_refs"])+ if kind == "performer" else [])scope = scope_predicate(kind, "ae.entity_id")count, rep = c.execute("SELECT count(DISTINCT ae.asset_id),"diff --git a/src/peach/web_state.py b/src/peach/web_state.pyindex 1ac7d45cd..b11415e8b 100644--- a/src/peach/web_state.py+++ b/src/peach/web_state.py@@ -81,6 +81,7 @@ class WebContract:follow_secrets_root: Path | None = None,follow_state_root: Path | None = None,follow_shared_root: Path | None = None,+ entry_links_root: Path | None = None,taste_history_root: Path | None = None,taste_history_store: Path | None = None,taste_history_import_root: Path | None = None,@@ -116,6 +117,10 @@ class WebContract:if follow_secrets_root is not None else SECRETS_DIR)self.follow_state_root = (Path(follow_state_root)if follow_state_root is not None else STATE_DIR)+ # 人物页外部入口的开关与地址模板。和上面几个同一个道理:走实例属性,测试才+ # 落得进临时目录,不会读到这台机器真实的偏好。+ self.entry_links_root = (Path(entry_links_root)+ if entry_links_root is not None else STATE_DIR)# 共享副本只承载**声明为可同步**的凭据字段,见 follow_secrets.SYNCABLE_FIELDS。# 复制关掉时 SHARED_CREDENTIAL_ROOT 是 None,凭据只留在本机。self.follow_shared_root = (Path(follow_shared_root)diff --git a/tests/test_community_catalog.py b/tests/test_community_catalog.pyindex f4b7bb895..4ece74037 100644--- a/tests/test_community_catalog.py+++ b/tests/test_community_catalog.py@@ -6,7 +6,7 @@ import unittestfrom PIL import Imagefrom peach.community_catalog import (COMMUNITY_SOURCES, IMAGE_LIMIT, avbase_work, community_sources_for,- javbus_work, javdb_work, verified_cover)+ javbus_work, javdb_actresses, javdb_work, verified_cover)from peach.http import HttpResponsefrom peach.jav_cover_fetch import Candidate, NotFound, Unavailable, _fetch@@ -145,9 +145,21 @@ class CommunityCatalogTests(unittest.TestCase):work = javdb_work(serve({JAVDB_SEARCH: JAVDB_RESULTS, JAVDB_DETAIL: JAVDB_PAGE}), "ABW-358")self.assertEqual((work["id"], work["title"], work["maker"], work["release_date"], work["runtime"]),("ABW-358", TITLE, "プレステージ", "2023-05-23", 210))- self.assertEqual(work["actresses"], [{"japanese_name": "涼森れむ"}], "男优不进演员")+ self.assertEqual(+ work["actresses"],+ [{"japanese_name": "涼森れむ", "profile_source": "javdb", "external_id": "a"}],+ "男优不进演员;女优带着她在 javdb 的演员 id")self.assertEqual((work["source_url"], work["cover_urls"]), ("https://javdb.com/v/Zb7mX", [JAVDB_COVER]))+ def test_javdb_reads_the_actor_id_whichever_side_of_the_class_it_sits(self):+ """属性的先后由站方模板决定,不该成为拿不到演员 id 的理由。"""+ self.assertEqual(+ javdb_actresses('<a class="actor-female" href="/actors/z9">葵いぶき</a>'),+ [{"japanese_name": "葵いぶき", "profile_source": "javdb", "external_id": "z9"}])+ self.assertEqual(+ javdb_actresses('<a class="actor-female">名字没挂链接</a>'),+ [{"japanese_name": "名字没挂链接", "profile_source": "javdb", "external_id": ""}])+def test_javdb_reports_a_missing_code_and_a_login_wall_differently(self):with self.assertRaises(NotFound):javdb_work(serve({JAVDB_SEARCH: JAVDB_RESULTS.replace(b"<strong>ABW-358</strong>", b"<strong>ABW-359</strong>")}),diff --git a/tests/test_desktop_settings.py b/tests/test_desktop_settings.pyindex 48c9730f8..1c6b2e514 100644--- a/tests/test_desktop_settings.py+++ b/tests/test_desktop_settings.py@@ -13,7 +13,8 @@ from types import SimpleNamespaceimport unittestfrom unittest.mock import patch-from peach import desktop_startup, desktop_uninstall, peach_proxy, scraping_access, settings_file+from peach import (desktop_startup, desktop_uninstall, entry_links, peach_proxy,+ scraping_access, settings_file)class DesktopSettingsTests(unittest.TestCase):@@ -150,6 +151,15 @@ class DesktopSettingsTests(unittest.TestCase):remove.assert_called_once_with(self.config,False)self.assertEqual(client.post('/api/configuration/startup',json={'enabled':'false','silent':True}).status_code,400)self.assertEqual(client.post('/api/configuration/peach-proxy',json={'mode':'proxy','proxy':'invalid'}).status_code,400)+ # 外部入口:模板缺占位符时整批不写,落下去的会是一枚点过去必然落空的入口。+ sites = {site.key: {'enabled': True, 'template': site.template}+ for site in entry_links.SITES}+ self.assertEqual(client.post('/api/configuration/entry-links',json={'sites':sites}).status_code,200)+ broken = {key: dict(row) for key, row in sites.items()}+ broken['javdb']['template'] = 'https://javdb.com/actors/'+ self.assertEqual(client.post('/api/configuration/entry-links',json={'sites':broken}).status_code,400)+ self.assertEqual(entry_links.read(self.config.directory('state'))['javdb']['template'],+ 'https://javdb.com/actors/{javdb_id}?sort_type=4')def test_startup_does_not_overwrite_another_installation(self):with patch.object(desktop_startup, 'startup_directory', return_value=self.root), patch.object(desktop_startup, 'shortcut', side_effect=[diff --git a/tests/test_entry_links.py b/tests/test_entry_links.pynew file mode 100644index 000000000..dfd7fdfec--- /dev/null+++ b/tests/test_entry_links.py@@ -0,0 +1,106 @@+"""人物资料页那三枚外部入口:地址怎么拼,什么时候不出。"""+from __future__ import annotations++import json+import tempfile+import unittest+from pathlib import Path++from peach import entry_links+++def ref(provider: str, external_id: str, kind: str = "performer") -> dict:+ return {"provider": provider, "external_kind": kind, "external_id": external_id}+++class EntryLinkAddressTests(unittest.TestCase):+ def test_three_sites_line_up_when_both_ids_are_known(self):+ rows = entry_links.build(entry_links.defaults(), "河合あすな",+ [ref("javdb", "QDvG"), ref("minnano-av", "155084")])+ self.assertEqual([row["site"] for row in rows], ["javdb", "minnano-av", "missav"])+ self.assertEqual(rows[0]["url"], "https://javdb.com/actors/QDvG?sort_type=4")+ self.assertEqual(rows[1]["url"], "https://www.minnano-av.com/actress155084.html")+ self.assertEqual([row["label"] for row in rows], ["JavDB", "minnano-av", "MISSAV"])++ def test_a_site_without_an_id_is_absent_instead_of_a_search_address(self):+ rows = entry_links.build(entry_links.defaults(), "深田えいみ", [])+ self.assertEqual([row["site"] for row in rows], ["missav"])+ self.assertNotIn("search", rows[0]["url"])++ def test_the_name_is_percent_encoded(self):+ rows = entry_links.build(entry_links.defaults(), "楪 カレン", [])+ self.assertEqual(+ rows[0]["url"],+ "https://missav.ws/dm42/cn/actresses/%E6%A5%AA%20%E3%82%AB%E3%83%AC%E3%83%B3")++ def test_ids_from_another_entity_kind_do_not_count(self):+ # 事务所那 55 条 minnano-av 引用记的是 `production`,不是这个人在站上的号。+ rows = entry_links.build(entry_links.defaults(), "七沢みあ",+ [ref("minnano-av", "110", kind="production")])+ self.assertEqual([row["site"] for row in rows], ["missav"])++ def test_a_closed_site_drops_out(self):+ settings = entry_links.defaults()+ settings["missav"]["enabled"] = False+ rows = entry_links.build(settings, "七沢みあ", [ref("javdb", "NPD3")])+ self.assertEqual([row["site"] for row in rows], ["javdb"])++ def test_a_custom_template_is_used_as_written(self):+ settings = entry_links.defaults()+ settings["javdb"]["template"] = "https://javdb.com/actors/{javdb_id}"+ rows = entry_links.build(settings, "七沢みあ", [ref("javdb", "NPD3")])+ self.assertEqual(rows[0]["url"], "https://javdb.com/actors/NPD3")+++class EntryLinkSettingsFileTests(unittest.TestCase):+ def setUp(self):+ temporary = tempfile.TemporaryDirectory()+ self.addCleanup(temporary.cleanup)+ self.root = Path(temporary.name).resolve()++ def test_an_absent_file_reads_as_three_sites_open(self):+ saved = entry_links.read(self.root)+ self.assertEqual(sorted(saved), ["javdb", "minnano-av", "missav"])+ self.assertTrue(all(row["enabled"] for row in saved.values()))++ def test_saving_round_trips_through_the_snapshot(self):+ entry_links.save(self.root, {"sites": {+ "javdb": {"enabled": False, "template": "https://javdb.com/actors/{javdb_id}"},+ "minnano-av": {"enabled": True,+ "template": "https://www.minnano-av.com/actress{minnano_id}.html"},+ "missav": {"enabled": True, "template": "https://missav.ws/dm42/cn/actresses/{name}"},+ }})+ rows = {row["key"]: row for row in entry_links.snapshot(self.root)["sites"]}+ self.assertFalse(rows["javdb"]["enabled"])+ self.assertEqual(rows["javdb"]["template"], "https://javdb.com/actors/{javdb_id}")+ self.assertEqual(rows["javdb"]["default_template"],+ "https://javdb.com/actors/{javdb_id}?sort_type=4")+ self.assertEqual(rows["missav"]["placeholder"], "name")++ def test_a_template_without_its_placeholder_is_refused(self):+ body = {"sites": {site.key: {"enabled": True, "template": site.template}+ for site in entry_links.SITES}}+ body["sites"]["javdb"]["template"] = "https://javdb.com/actors/"+ with self.assertRaises(ValueError) as caught:+ entry_links.save(self.root, body)+ self.assertIn("{javdb_id}", str(caught.exception))++ def test_a_plain_http_template_is_refused(self):+ body = {"sites": {site.key: {"enabled": True, "template": site.template}+ for site in entry_links.SITES}}+ body["sites"]["missav"]["template"] = "http://missav.ws/dm42/cn/actresses/{name}"+ with self.assertRaises(ValueError) as caught:+ entry_links.save(self.root, body)+ self.assertIn("https://", str(caught.exception))++ def test_a_hand_broken_file_falls_back_instead_of_emptying_the_row(self):+ (self.root / entry_links.FILENAME).write_text(+ json.dumps({"sites": {"javdb": {"template": "not a url"}}}), encoding="utf-8")+ saved = entry_links.read(self.root)+ self.assertEqual(saved["javdb"]["template"],+ "https://javdb.com/actors/{javdb_id}?sort_type=4")+ self.assertTrue(saved["javdb"]["enabled"])+++if __name__ == "__main__":+ unittest.main()diff --git a/tests/test_fastapi_api.py b/tests/test_fastapi_api.pyindex 39ee67267..a66408df9 100644--- a/tests/test_fastapi_api.py+++ b/tests/test_fastapi_api.py@@ -7,6 +7,7 @@ import unittestfrom contextlib import closingfrom pathlib import Pathfrom unittest.mock import patch+from urllib.parse import quotefrom peach import __version__from support.mp4 import minimal_mp4@@ -282,6 +283,7 @@ class FastApiContractTests(unittest.IsolatedAsyncioTestCase):taste_history_import_root=self.taste_import_root,taste_history_output_root=self.taste_output_root,taste_history_manifest=self.taste_manifest,+ entry_links_root=self.root / "state",)self.app = create_app(self.settings)# 字节与时间表夹具不含可解码画面;编码判定由媒体域的真实样本覆盖。@@ -1015,6 +1017,32 @@ class FastApiContractTests(unittest.IsolatedAsyncioTestCase):self.assertEqual(response.status_code, 200, response.text)self.assertEqual(response.json()["avatar_focus"], {"axis": "y", "pct": 23})+ async def test_entity_gives_direct_entries_only_for_the_sites_it_has_an_id_for(self):+ """外部入口随资料一起下发;账本里没有那个站点 id 的,那一枚就不在列表里。"""+ connection = sqlite3.connect(self.db)+ connection.execute(+ "INSERT INTO entity(id,kind,canonical_name,normalized_name) "+ "VALUES(3,'performer','七沢みあ','七沢みあ')"+ )+ connection.execute(+ "INSERT INTO asset_entity(asset_id,entity_id,role,source,confidence) "+ "VALUES(1,3,'performer','test',1.0)"+ )+ connection.execute(+ "INSERT INTO entity_external_ref(entity_id,provider,external_kind,external_id) "+ "VALUES(3,'javdb','performer','NPD3')"+ )+ connection.commit(); connection.close()++ response = await self.client.get(+ "/api/entity?t=secret&kind=performer&name=" + quote("七沢みあ")+ )+ self.assertEqual(response.status_code, 200, response.text)+ entries = response.json()["entry_links"]+ self.assertEqual([row["site"] for row in entries], ["javdb", "missav"])+ self.assertEqual(entries[0]["url"], "https://javdb.com/actors/NPD3?sort_type=4")+ self.assertTrue(entries[1]["url"].startswith("https://missav.ws/dm42/cn/actresses/%"))+async def test_review_queue_is_readable_and_decisions_are_persisted(self):response = await self.client.get("/api/review?t=secret")self.assertEqual(response.status_code, 200)diff --git a/tests/test_metadata_performer_profiles.py b/tests/test_metadata_performer_profiles.pyindex f18ae1e3c..941a94563 100644--- a/tests/test_metadata_performer_profiles.py+++ b/tests/test_metadata_performer_profiles.py@@ -78,6 +78,28 @@ class ImportedPerformerProfileTests(unittest.TestCase):self.assertTrue((self.root / "avatars" / "performer-7.img").is_file())transport.assert_called_once()+ def test_a_javdb_actor_id_lands_as_a_performer_external_ref(self):+ """javdb 的演员 id 落进账本,人物页的 JavDB 入口就是靠它拼出来的。++ 这一路不带头像,整段一次网都不出;名字没连着这条资产的人一个都不登记。+ """+ group = dict(self.group(), candidates_json=json.dumps([{+ "candidate_key": "profile", "source": "javdb",+ "value": [{"name": "涼森れむ", "external_id": "NPD3", "profile_source": "javdb"},+ {"name": "別人", "external_id": "ZZZZ", "profile_source": "javdb"}],+ }], ensure_ascii=False))+ transport = Mock()+ result = enrich_performer_profiles(+ self.database, [group], self.root / "avatars", self.root / "providers",+ transport_factory=lambda: transport)+ self.assertEqual(result["avatars"], 0)+ transport.assert_not_called()+ with closing(sqlite3.connect(self.db)) as connection:+ refs = connection.execute(+ "SELECT entity_id,external_id FROM entity_external_ref "+ "WHERE provider='javdb' AND external_kind='performer'").fetchall()+ self.assertEqual(refs, [(7, "NPD3")])+def test_tampered_avatar_url_is_never_requested_but_aliases_still_land(self):transport = Mock()result = enrich_performer_profiles(diff --git a/tests/test_web_ui.py b/tests/test_web_ui.pyindex 0f97f9b0a..3d90932ec 100644--- a/tests/test_web_ui.py+++ b/tests/test_web_ui.py@@ -2240,6 +2240,33 @@ class WebUiSourceTests(unittest.TestCase):self.assertIn('<img class="entityfavicon" src="${esc(linkMarkUrl(x))}"', official)self.assertIn('data-drop="self"', official)+ def test_the_entry_row_only_prints_addresses_the_server_already_built(self):+ """外部入口这一排是服务端拼好的地址,页面只负责排。++ 前端手里没有站点 id 也没有规范名,模板拼在这边等于再养一份规则;缺 id 的站点+ 根本不在 `entry_links` 里,页面上也就没有一枚点过去落空的入口。文字就写站名:+ `/link-mark` 认的是账本里的链接 id,这几条不是账本链接,取不到圆标。+ """+ self.assertPageContains("const entryLinks=(d.entry_links||[]).map(x=>")+ self.assertPageContains(+ '<a href="${esc(x.url)}" target="_blank" rel="noopener noreferrer">${esc(x.label)}</a>')+ self.assertPageContains(+ '<div class="entryrow"><span class="entryhead">外部入口</span>'+ '<span class="entryentries">${entryLinks}</span></div>')+ entry = self.app_js[self.app_js.index("const entryLinks=(d.entry_links"):]+ self.assertNotIn("http", entry[:entry.index(".join('');")], "地址由服务端拼,页面不许自己接")+ self.assertPageContains(+ ".entryrow{display:flex;flex-wrap:wrap;align-items:center;gap:10px;"+ "margin-top:14px;max-width:100%}")+ self.assertPageContains(".entryentries{display:flex;flex-wrap:wrap;gap:12px;min-width:0}")+ # 入口的形状归 Board 的站外文字链那条规则管,这里不再写一份药丸盖在它上面:+ # 那份写了也不生效(`body a:is(...)` 的权重更高),只会让人以为改它有用。+ entries = self.page[self.page.index(".entryentries{"):]+ self.assertNotIn("border", entries[:entries.index(".entityskeletontext{")])+ # 窄屏只换行不横滑:三枚最多堆两行,接一套横滑省不下什么,整行跟着单列卡居中。+ self.assertPageContains(+ ".entityhero .entryrow,.entityhero .entryentries{justify-content:center}")+def test_entity_loading_and_detail_autoplay_share_their_entry_contracts(self):self.assertPageContains("showEntityLoading(ROUTE_ENTITIES[path.split('/')[1]])")self.assertPageContains('showEntityLoading(kind);')diff --git a/web/app.js b/web/app.jsindex f32a51bc3..af6a5a054 100644--- a/web/app.js+++ b/web/app.js@@ -7901,6 +7901,14 @@ async function openEntity(kind,name,push=true){把 img 撤掉,露出底下那枚地球。 */return `<a class="urllink" href="${esc(x.url)}" target="_blank" rel="noreferrer" title="${esc(x.label)}"><span class="entitylinkicon">${icon('globe')}<img class="entityfavicon" src="${esc(linkMarkUrl(x))}" alt="" loading="lazy" referrerpolicy="no-referrer" data-drop="self"></span><span class="entitylinklabel">${esc(linkHost(x.url)||x.label)}</span></a>`;}).join('');+ /* 外部入口:同一个人在 JavDB、minnano-av 与 MISSAV 的那一页。地址由服务端按站点 id+ 和规范名拼好下发(`peach.entry_links`),这里只排版——站点 id 缺席时那一枚根本不在+ `entry_links` 里,页面上也就没有一个点过去落空的入口。++ 文字就是站名:这一排只有三枚,而「去哪」这件事站名自己说得最清楚;`/link-mark` 那条+ 图标链认的是账本里的链接 id,这几条不是账本链接,取不到圆标。 */+ const entryLinks=(d.entry_links||[]).map(x=>+ `<a href="${esc(x.url)}" target="_blank" rel="noopener noreferrer">${esc(x.label)}</a>`).join('');const tags=(d.tags||[]).map(x=>filterChipHtml(tagLabel(x.k),{attr:'data-entity-tag',value:x.k,selected:tagPressed(filters.tag,x.k),count:x.n.toLocaleString()})).join('');/* 事务所名下的这批人不摆在这排小圆头像里:那是「同台艺人」,一条附注;名册是这一页的正文,占的是下面那整块。所以同一份 `related_performers` 在事务所页走另一条路。 */@@ -7977,7 +7985,8 @@ async function openEntity(kind,name,push=true){people?'<span data-avatar-picker></span>':''}</div><div class="entityidentity"><div class="entitytitle"><h2>${esc(d.canonical_name)}</h2>${namePick}</div><div class="alias">${(d.display_aliases||[]).length?`${d.display_aliases.map(esc).join(' / ')} · `:''}<b>${d.asset_count.toLocaleString()}</b> 个视频${memberHtml}${agencyHtml}</div>- ${links?`<div class="entitylinks">${links}</div>`:''}</div></div>+ ${links?`<div class="entitylinks">${links}</div>`:''}+ ${entryLinks?`<div class="entryrow"><span class="entryhead">外部入口</span><span class="entryentries">${entryLinks}</span></div>`:''}</div></div>${related?`<div class="entityfoot" aria-label="同台艺人"><div class="relatedpeople">${related}</div></div>`:''}</section><div class="combo entitycombo"></div><section class="entitytagbar" aria-label="媒体与标签">${mediaToggle}${mediaToggle?'<span class="sep" aria-hidden="true"></span>':''}<div class="filterscroll"><div class="viewpills entityviews" role="group" aria-label="观看状态">${VIEW_PILLS.map(v=>`<button type="button" class="pill" data-entity-state="${v.k}" aria-pressed="${(filters.state||'')===v.k}">${v.label}</button>`).join('')}<span class="sep" aria-hidden="true"></span></div><div class="tagscroll entitytags">${tags}</div></div></section>diff --git a/web/css/07-entity.css b/web/css/07-entity.cssindex db02c7e02..cb6dd59c5 100644--- a/web/css/07-entity.css+++ b/web/css/07-entity.css@@ -71,6 +71,14 @@.entitylinks a.iconlink{width:36px;padding:0;gap:0;justify-content:center}/* 官网域名前显示站点自己那枚图标,取不到才露出地球;与带名称的链接共用间距。 */.entitylinks a.urllink{letter-spacing:.02em}+/* 外部入口那一排:同一个人在别处的那一页。行首那个词说明这一排通向站外,不是馆藏里的+ 东西。入口本身不另写形状——Board 对不带圆标的站外链接已有一套文字链写法+ (board.css 里 `a:is(.externallink,[target=_blank]):not(:has(.entitylinkicon))`),+ 这三枚正落在里面;上面那排外链是药丸,因为它们每枚都带一个圆标撑着。+ 窄屏下整行换行,入口跟着往下排——三枚横滚一个都省不下,不值得再接一套拖动映射。 */+.entryrow{display:flex;flex-wrap:wrap;align-items:center;gap:10px;margin-top:14px;max-width:100%}+.entryhead{flex:none;color:var(--muted);font-size:var(--fs-sm)}+.entryentries{display:flex;flex-wrap:wrap;gap:12px;min-width:0}.entityskeletontext{width:100%}.entityskeletontext .entitytitle .skeleton{width:60%;height:auto}.entityskeletontext .alias .skeleton{display:block;width:40%;height:20px}diff --git a/web/css/19-immersive.css b/web/css/19-immersive.cssindex e5292923c..8f90541ca 100644--- a/web/css/19-immersive.css+++ b/web/css/19-immersive.css@@ -210,6 +210,8 @@ body:has(#batchbar:not([hidden])) #stage{padding-bottom:180px}overflow-x:auto;overflow-y:hidden;scrollbar-width:none;overscroll-behavior-inline:contain}.entityhero .entitylinks::-webkit-scrollbar{display:none}.entityhero .entitylinks>*{flex:none}+ /* 外部入口只有三枚,窄屏下换行最多占两行,不值得再接一套横滑;整行跟着单列卡居中。 */+ .entityhero .entryrow,.entityhero .entryentries{justify-content:center}.stats h2{font-size:var(--fs-xl)}.stats .insightcopy h2{font-size:var(--fs-3xl)}/* 窄屏下标题也得一起缩。`/follow` 渲染在 `#stats` 里,上面那条 `.stats h2`会只把它打到 23px,而 `#manageTitle` 在 `#stats` 外面,手机上又变成两种大小。 */diff --git a/web/dist/peach-react.js b/web/dist/peach-react.jsindex 266be3921..edc9791b6 100644--- a/web/dist/peach-react.js+++ b/web/dist/peach-react.js@@ -31401,14 +31401,74 @@ function GE({ className: e, children: t, size: n = "md", shape: r = "pill", ref:});}//#endregion+//#region src/react/settings/entry-links-settings.tsx+function KE({ initial: e, receipt: t }) {+ let [n, r] = (0, C.useState)(e.sites), i = $y(), a = (e, t) => r((n) => n.map((n) => n.key === e ? {+ ...n,+ ...t+ } : n));+ return /* @__PURE__ */ (0, w.jsxs)(nS, {+ title: "外部入口",+ onSubmit: (e) => {+ e.preventDefault();+ let a = { sites: Object.fromEntries(n.map((e) => [e.key, {+ enabled: e.enabled,+ template: e.template+ }])) };+ i.run("save", (e) => Qm("/api/configuration/entry-links", a, "POST", e), (e) => {+ r(e.sites), t("已保存配置");+ });+ },+ children: [+ /* @__PURE__ */ (0, w.jsx)(rS, { children: n.map((e) => /* @__PURE__ */ (0, w.jsx)($x, {+ label: e.label,+ description: "在女优资料页给出这个站点的直达入口。",+ children: /* @__PURE__ */ (0, w.jsx)(GE, {+ "aria-label": `在资料页显示 ${e.label} 入口`,+ isSelected: e.enabled,+ onChange: (t) => a(e.key, { enabled: t })+ })+ }, e.key)) }),+ /* @__PURE__ */ (0, w.jsxs)(iS, {+ divided: !0,+ children: [+ /* @__PURE__ */ (0, w.jsx)(oS, { children: "账本里没有这个站点 id 的人物不显示它那一枚入口,地址不会退回站内搜索。" }),+ n.map((e) => /* @__PURE__ */ (0, w.jsx)(Zy, {+ id: `entry-link-${e.key}`,+ label: `${e.label} 地址模板`,+ autoComplete: "off",+ maxLength: 300,+ value: e.template,+ onChange: (t) => a(e.key, { template: t }),+ validationBehavior: "aria",+ hint: `用 {${e.placeholder}} 占位,默认 ${e.default_template}`+ }, e.key)),+ i.error ? /* @__PURE__ */ (0, w.jsx)(sS, { children: i.error }) : null+ ]+ }),+ /* @__PURE__ */ (0, w.jsx)(aS, { children: /* @__PURE__ */ (0, w.jsx)(X, {+ type: "submit",+ ...Z(i.busy === "save"),+ children: "保存配置"+ }) })+ ]+ });+}+//#endregion//#region src/react/settings/general-settings.tsx-function KE({ data: e, receipt: t }) {- return e.startup ? /* @__PURE__ */ (0, w.jsx)(qE, {- startup: e.startup,- receipt: t- }) : null;+function qE({ data: e, receipt: t }) {+ return /* @__PURE__ */ (0, w.jsxs)("div", {+ className: "flex flex-col gap-6",+ children: [e.startup ? /* @__PURE__ */ (0, w.jsx)(JE, {+ startup: e.startup,+ receipt: t+ }) : null, e.entry_links ? /* @__PURE__ */ (0, w.jsx)(KE, {+ initial: e.entry_links,+ receipt: t+ }) : null]+ });}-function qE({ startup: e, receipt: t }) {+function JE({ startup: e, receipt: t }) {let [n, r] = (0, C.useState)(e.enabled), [i, a] = (0, C.useState)(e.silent), [o, s] = (0, C.useState)(e.desktop), c = $y(), l = e.available && !e.desktop_message;return /* @__PURE__ */ (0, w.jsxs)(nS, {title: "开机自启",@@ -31466,7 +31526,7 @@ function qE({ startup: e, receipt: t }) {}//#endregion//#region src/react/settings/media-repair.tsx-var JE = {+var YE = {status: "idle",stage: "",checked: 0,@@ -31476,16 +31536,16 @@ var JE = {failed: 0,skipped: 0,message: ""-}, YE = (e) => Number(e).toLocaleString();-function XE(e) {+}, XE = (e) => Number(e).toLocaleString();+function ZE(e) {if (e.status === "running") {- let t = e.total ? `${YE(e.checked)} / ${YE(e.total)}` : "准备中";+ let t = e.total ? `${XE(e.checked)} / ${XE(e.total)}` : "准备中";return e.stage === "修复" && e.message ? `修复 ${t} · ${e.message}` : `${e.stage || "扫描"} ${t}`;}- return e.status === "complete" && (e.repaired || e.failed) ? e.failed ? `修好 ${YE(e.repaired)} 部,${YE(e.failed)} 部修不了` : `修好 ${YE(e.repaired)} 部` : "";+ return e.status === "complete" && (e.repaired || e.failed) ? e.failed ? `修好 ${XE(e.repaired)} 部,${XE(e.failed)} 部修不了` : `修好 ${XE(e.repaired)} 部` : "";}-function ZE({ initial: e }) {- let [t, n] = (0, C.useState)(e || JE), [r, i] = (0, C.useState)(!1), a = $y(), o = t.status === "running";+function QE({ initial: e }) {+ let [t, n] = (0, C.useState)(e || YE), [r, i] = (0, C.useState)(!1), a = $y(), o = t.status === "running";(0, C.useEffect)(() => {let e = new AbortController(), t, r = async () => {try {@@ -31523,9 +31583,9 @@ function ZE({ initial: e }) {}) : null,a.error || t.error ? /* @__PURE__ */ (0, w.jsx)(sS, { children: a.error || t.error }) : null] }), /* @__PURE__ */ (0, w.jsx)(aS, {- status: XE(t) ? /* @__PURE__ */ (0, w.jsx)("p", {+ status: ZE(t) ? /* @__PURE__ */ (0, w.jsx)("p", {role: "status",- children: XE(t)+ children: ZE(t)}) : null,children: o ? /* @__PURE__ */ (0, w.jsx)(X, {onClick: c,@@ -31541,23 +31601,23 @@ function ZE({ initial: e }) {}//#endregion//#region src/react/settings/release-updates.tsx-var QE = /* @__PURE__ */ new Set([+var $E = /* @__PURE__ */ new Set(["downloading","verifying","extracting","preparing","restarting","installing"-]), $E = [+]), eD = [65,67,90-], eD = 120;-function tD({ initial: e, initialJob: t }) {+], tD = 120;+function nD({ initial: e, initialJob: t }) {let [n, r] = (0, C.useState)(e), [i, a] = (0, C.useState)(t || {state: "idle",progress: 0- }), [o, s] = (0, C.useState)(""), l = $y(), u = (0, C.useRef)(!1), d = (0, C.useRef)(!0), f = QE.has(i.state);+ }), [o, s] = (0, C.useState)(""), l = $y(), u = (0, C.useRef)(!1), d = (0, C.useRef)(!0), f = $E.has(i.state);(0, C.useEffect)(() => (d.current = !0, () => {d.current = !1;}), []);@@ -31574,7 +31634,7 @@ function tD({ initial: e, initialJob: t }) {(0, C.useEffect)(() => {i.state !== "ready" || u.current || (u.current = !0, m());}, [i.state]), (0, C.useEffect)(() => {- let e = new AbortController(), t = QE.has(i.state) ? 1e3 : 3e4, n, o = 0, c = async () => {+ let e = new AbortController(), t = $E.has(i.state) ? 1e3 : 3e4, n, o = 0, c = async () => {try {let t = await Zm("/api/configuration/update-status", e.signal);if (e.signal.aborted) return;@@ -31587,9 +31647,9 @@ function tD({ initial: e, initialJob: t }) {let n = await Zm("/api/configuration/automatic-updates", e.signal);!e.signal.aborted && n.result && r(n.result);} catch {- o += 1, o >= eD && !e.signal.aborted && s("尚未连接到 Peach,请检查托盘后刷新页面。");+ o += 1, o >= tD && !e.signal.aborted && s("尚未连接到 Peach,请检查托盘后刷新页面。");}- !e.signal.aborted && o < eD && (n = setTimeout(c, t));+ !e.signal.aborted && o < tD && (n = setTimeout(c, t));};return n = setTimeout(c, t), () => {e.abort(), clearTimeout(n);@@ -31644,7 +31704,7 @@ function tD({ initial: e, initialJob: t }) {/* @__PURE__ */ (0, w.jsx)(dh, {label: "更新准备进度",value: i.progress,- stops: $E+ stops: eD}),/* @__PURE__ */ (0, w.jsxs)(oS, { children: ["下载 → 校验 → 解压 → 准备安装 · ", i.message] }),/* @__PURE__ */ (0, w.jsx)(oS, { children: v })@@ -31680,37 +31740,37 @@ function tD({ initial: e, initialJob: t }) {}//#endregion//#region src/react/settings/maintenance-settings.tsx-var nD = [+var rD = [["6", "每 6 小时"],["24", "每天"],["168", "每周"]];-function rD({ data: e, receipt: t, reopenTutorial: n }) {+function iD({ data: e, receipt: t, reopenTutorial: n }) {return /* @__PURE__ */ (0, w.jsxs)("div", {className: "flex flex-col gap-6",children: [- e.automatic_updates ? /* @__PURE__ */ (0, w.jsx)(aD, {+ e.automatic_updates ? /* @__PURE__ */ (0, w.jsx)(oD, {initial: e.automatic_updates,receipt: t}) : null,- e.updates ? /* @__PURE__ */ (0, w.jsx)(tD, {+ e.updates ? /* @__PURE__ */ (0, w.jsx)(nD, {initial: e.updates,initialJob: e.update_job}) : null,- /* @__PURE__ */ (0, w.jsx)(ZE, {}),- /* @__PURE__ */ (0, w.jsx)(oD, { facts: e.facts }),- e.uninstall ? /* @__PURE__ */ (0, w.jsx)(sD, {+ /* @__PURE__ */ (0, w.jsx)(QE, {}),+ /* @__PURE__ */ (0, w.jsx)(sD, { facts: e.facts }),+ e.uninstall ? /* @__PURE__ */ (0, w.jsx)(cD, {uninstall: e.uninstall,receipt: t}) : null,- /* @__PURE__ */ (0, w.jsx)(iD, {+ /* @__PURE__ */ (0, w.jsx)(aD, {receipt: t,reopenTutorial: n})]});}-function iD({ receipt: e, reopenTutorial: t }) {+function aD({ receipt: e, reopenTutorial: t }) {let n = $y();return /* @__PURE__ */ (0, w.jsxs)(nS, {title: "安装教程",@@ -31721,7 +31781,7 @@ function iD({ receipt: e, reopenTutorial: t }) {}) })]});}-function aD({ initial: e, receipt: t }) {+function oD({ initial: e, receipt: t }) {let [n, r] = (0, C.useState)(e.mode), [i, a] = (0, C.useState)(e.interval_hours), o = $y(e.error), s = (r) => {r.preventDefault(), e.available && o.run("save", (e) => Qm("/api/configuration/automatic-updates", {mode: n,@@ -31761,7 +31821,7 @@ function aD({ initial: e, receipt: t }) {onSelectionChange: (e) => {e !== null && a(Number(e));},- children: nD.map(([e, t]) => /* @__PURE__ */ (0, w.jsx)(Cw, {+ children: rD.map(([e, t]) => /* @__PURE__ */ (0, w.jsx)(Cw, {id: e,children: t}, e))@@ -31781,7 +31841,7 @@ function aD({ initial: e, receipt: t }) {]});}-function oD({ facts: e }) {+function sD({ facts: e }) {return /* @__PURE__ */ (0, w.jsx)(nS, {title: "运行信息",children: /* @__PURE__ */ (0, w.jsx)(uS, { children: e.map((e) => /* @__PURE__ */ (0, w.jsxs)(dS, {@@ -31793,7 +31853,7 @@ function oD({ facts: e }) {}, e.term)) })});}-function sD({ uninstall: e, receipt: t }) {+function cD({ uninstall: e, receipt: t }) {let [n, r] = (0, C.useState)(!1), [i, a] = (0, C.useState)(""), o = () => void c({title: "卸载 Peach",danger: !0,@@ -31842,7 +31902,7 @@ function sD({ uninstall: e, receipt: t }) {}//#endregion//#region src/react/settings/clouddrive-guide.tsx-var cD = [+var lD = [{name: "机械硬盘,或内存 8 GB 以内",cache: "10–20 GiB",@@ -31861,12 +31921,12 @@ var cD = [read: "256 / 128 KB",task: "2 个起步"}-], lD = [+], uD = [["cache", "缓存上限"],["read", "读取长度(默认 / 最小)"],["task", "同时处理视频"]];-function uD() {+function dD() {return /* @__PURE__ */ (0, w.jsxs)("div", {className: "@container flex flex-col gap-3",children: [/* @__PURE__ */ (0, w.jsxs)(oS, { children: ["先在 CloudDrive 登录网盘并挂载,开启「启动时自动挂载」。", /* @__PURE__ */ (0, w.jsx)(lS, {@@ -31879,14 +31939,14 @@ function uD() {/* @__PURE__ */ (0, w.jsx)("ul", {"aria-label": "按缓存所在硬盘分档",className: "flex flex-col gap-2",- children: cD.map((e) => /* @__PURE__ */ (0, w.jsxs)("li", {+ children: lD.map((e) => /* @__PURE__ */ (0, w.jsxs)("li", {className: "flex flex-col gap-2 rounded-2lg border border-separator-border bg-background-primary-default p-3",children: [/* @__PURE__ */ (0, w.jsx)("p", {className: "text-body-medium text-text-primary",children: e.name}), /* @__PURE__ */ (0, w.jsx)("dl", {className: "inline-grid grid-cols-1 gap-2 @md:grid-cols-3",- children: lD.map(([t, n]) => /* @__PURE__ */ (0, w.jsxs)("div", {+ children: uD.map(([t, n]) => /* @__PURE__ */ (0, w.jsxs)("div", {className: "flex flex-col",children: [/* @__PURE__ */ (0, w.jsx)("dt", {className: "text-caption-1-regular text-text-secondary",@@ -31921,7 +31981,7 @@ function uD() {}//#endregion//#region src/react/settings/library-icon-picker.tsx-var dD = [+var fD = [["", "自动识别"],["hard-drive", "磁盘"],["database", "资料库"],@@ -31965,13 +32025,13 @@ var dD = [["star", "收藏"],["tags", "主题"]];-function fD(e) {+function pD(e) {let t = e === "local" ? "" : o[e];return t ? [t, "自动识别"] : ["hard-drive", "默认"];}-var pD = "auto";-function mD({ value: e, label: t, kind: n = "local", onChange: r }) {- let i = (0, C.useRef)(null), [a, o] = (0, C.useState)(!1), [s, c] = (0, C.useState)(e), [l, u] = fD(n);+var mD = "auto";+function hD({ value: e, label: t, kind: n = "local", onChange: r }) {+ let i = (0, C.useRef)(null), [a, o] = (0, C.useState)(!1), [s, c] = (0, C.useState)(e), [l, u] = pD(n);return /* @__PURE__ */ (0, w.jsxs)(w.Fragment, { children: [/* @__PURE__ */ (0, w.jsx)(X, {ref: i,variant: "secondary",@@ -31985,7 +32045,7 @@ function mD({ value: e, label: t, kind: n = "local", onChange: r }) {children: /* @__PURE__ */ (0, w.jsxs)("span", {"data-icon-choice": !0,className: "flex items-center gap-2",- children: [/* @__PURE__ */ (0, w.jsx)(mS, { mark: e || l }), ((e) => e && dD.find(([t]) => t === e)?.[1] || u)(e)]+ children: [/* @__PURE__ */ (0, w.jsx)(mS, { mark: e || l }), ((e) => e && fD.find(([t]) => t === e)?.[1] || u)(e)]})}), /* @__PURE__ */ (0, w.jsx)(q_, {triggerRef: i,@@ -32005,15 +32065,15 @@ function mD({ value: e, label: t, kind: n = "local", onChange: r }) {}),/* @__PURE__ */ (0, w.jsx)(mv, {"aria-label": "候选图标",- value: s || pD,- onChange: (e) => c(e === pD ? "" : e),+ value: s || mD,+ onChange: (e) => c(e === mD ? "" : e),className: "inline-grid grid-cols-7 gap-1",- children: dD.map(([e, t]) => /* @__PURE__ */ (0, w.jsx)(hv, {- value: e || pD,+ children: fD.map(([e, t]) => /* @__PURE__ */ (0, w.jsx)(hv, {+ value: e || mD,"aria-label": e ? t : u,className: "flex h-10 cursor-pointer items-center justify-center rounded-lg text-foreground-icon-secondary outline-none hover:bg-dropdown-item-hover-background focus-visible:ring-2 focus-visible:ring-border-focus-ring data-selected:bg-dropdown-item-hover-background data-selected:text-text-primary",children: /* @__PURE__ */ (0, w.jsx)(mS, { mark: e || l })- }, e || pD))+ }, e || mD))}),/* @__PURE__ */ (0, w.jsxs)("div", {className: "flex justify-end gap-2 border-t border-separator-border pt-2.5",@@ -32035,8 +32095,8 @@ function mD({ value: e, label: t, kind: n = "local", onChange: r }) {}//#endregion//#region src/react/settings/media-settings.tsx-var hD = 8e3;-function gD({ className: e }) {+var gD = 8e3;+function _D({ className: e }) {return /* @__PURE__ */ (0, w.jsx)("svg", {"aria-hidden": !0,viewBox: "0 0 24 24",@@ -32049,48 +32109,48 @@ function gD({ className: e }) {children: /* @__PURE__ */ (0, w.jsx)("use", { href: "#i-folder-search" })});}-var _D = [+var vD = [["local", "本地磁盘"],["115", "CloudDrive · 115"],["pikpak", "CloudDrive · PikPak"]-], vD = (e) => _D.find(([t]) => t === e)?.[1] ?? e, yD = (e) => o[e] || "database", bD = (e = "") => ({+], yD = (e) => vD.find(([t]) => t === e)?.[1] ?? e, bD = (e) => o[e] || "database", xD = (e = "") => ({path: e,location: "local",root: "",library: "",library_icon: ""});-function xD(e) {- let t = e.media_sources?.filter((e) => _D.some(([t]) => t === e.location));+function SD(e) {+ let t = e.media_sources?.filter((e) => vD.some(([t]) => t === e.location));return t?.length ? t.map((e) => ({path: e.path,location: e.location,root: e.root,library: e.library || "",library_icon: e.library_icon || ""- })) : (e.media_dirs.length ? e.media_dirs : [""]).map((e) => bD(e));+ })) : (e.media_dirs.length ? e.media_dirs : [""]).map((e) => xD(e));}-var SD = (e) => !(e instanceof Ym) || e.status !== 400 ? null : e.body?.errors ?? null;-function CD({ data: e, receipt: t }) {+var CD = (e) => !(e instanceof Ym) || e.status !== 400 ? null : e.body?.errors ?? null;+function wD({ data: e, receipt: t }) {return /* @__PURE__ */ (0, w.jsxs)("div", {className: "flex flex-col gap-6",- children: [e.editable ? /* @__PURE__ */ (0, w.jsx)(wD, {+ children: [e.editable ? /* @__PURE__ */ (0, w.jsx)(TD, {data: e,receipt: t}) : /* @__PURE__ */ (0, w.jsx)(J, {tone: "neutral",title: "只读",children: e.notice- }), /* @__PURE__ */ (0, w.jsx)(ED, { data: e })]+ }), /* @__PURE__ */ (0, w.jsx)(DD, { data: e })]});}-function wD({ data: e, receipt: t }) {- let [n, r] = (0, C.useState)(() => xD(e)), [i, a] = (0, C.useState)(String(e.port)), [o, s] = (0, C.useState)(!1), [c, l] = (0, C.useState)([]), [u, d] = (0, C.useState)(""), [f, p] = (0, C.useState)(""), [m, h] = (0, C.useState)(null), [g, _] = (0, C.useState)(null), [v, y] = (0, C.useState)(null), b = (0, C.useRef)(!1), x = (0, C.useRef)(e.revision), S = (0, C.useRef)([]), T = $y();+function TD({ data: e, receipt: t }) {+ let [n, r] = (0, C.useState)(() => SD(e)), [i, a] = (0, C.useState)(String(e.port)), [o, s] = (0, C.useState)(!1), [c, l] = (0, C.useState)([]), [u, d] = (0, C.useState)(""), [f, p] = (0, C.useState)(""), [m, h] = (0, C.useState)(null), [g, _] = (0, C.useState)(null), [v, y] = (0, C.useState)(null), b = (0, C.useRef)(!1), x = (0, C.useRef)(e.revision), S = (0, C.useRef)([]), T = $y();(0, C.useLayoutEffect)(() => {g !== null && (S.current[g]?.focus(), _(null));}, [g]), (0, C.useEffect)(() => {if (!m) return;- let e = setTimeout(() => location.assign(m.url), hD);+ let e = setTimeout(() => location.assign(m.url), gD);return () => clearTimeout(e);}, [m]);let E = (e, t) => r((n) => n.map((n, r) => r === e ? {@@ -32101,7 +32161,7 @@ function wD({ data: e, receipt: t }) {for (; r.length <= e;) r.push("");return r[e] = t, r;}), O = () => {- _(n.length), r((e) => [...e, bD()]);+ _(n.length), r((e) => [...e, xD()]);}, k = (e) => {r((t) => t.filter((t, n) => n !== e)), l((t) => t.filter((t, n) => n !== e));}, A = async (e) => {@@ -32126,7 +32186,7 @@ function wD({ data: e, receipt: t }) {}, "POST", t), (e) => {x.current = e.revision, l([]), d(""), t("已保存配置"), h(e);}, (e) => {- let t = SD(e);+ let t = CD(e);l(t?.media_dirs ?? []), d(t?.port ?? ""), t || p(q(e));});};@@ -32179,7 +32239,7 @@ function wD({ data: e, receipt: t }) {hint: c[r] || void 0}),/* @__PURE__ */ (0, w.jsx)(Wy, {- icon: gD,+ icon: _D,"aria-label": "选择文件夹",onClick: () => void A(r),...Z(v === r)@@ -32202,7 +32262,7 @@ function wD({ data: e, receipt: t }) {}),/* @__PURE__ */ (0, w.jsxs)("div", {className: "flex flex-col gap-1.5",- children: [/* @__PURE__ */ (0, w.jsx)(cS, { children: "媒体库图标" }), /* @__PURE__ */ (0, w.jsx)(mD, {+ children: [/* @__PURE__ */ (0, w.jsx)(cS, { children: "媒体库图标" }), /* @__PURE__ */ (0, w.jsx)(hD, {label: `媒体库图标 ${r + 1}`,value: t.library_icon,kind: t.location,@@ -32217,10 +32277,10 @@ function wD({ data: e, receipt: t }) {onSelectionChange: (e) => {e !== null && E(r, { location: String(e) });},- children: _D.map(([e, t]) => /* @__PURE__ */ (0, w.jsxs)(Cw, {+ children: vD.map(([e, t]) => /* @__PURE__ */ (0, w.jsxs)(Cw, {id: e,textValue: t,- children: [/* @__PURE__ */ (0, w.jsx)(mS, { mark: yD(e) }), t]+ children: [/* @__PURE__ */ (0, w.jsx)(mS, { mark: bD(e) }), t]}, e))})]}),@@ -32241,7 +32301,7 @@ function wD({ data: e, receipt: t }) {})]}),- M ? /* @__PURE__ */ (0, w.jsx)(uD, {}) : null,+ M ? /* @__PURE__ */ (0, w.jsx)(dD, {}) : null,N.map((e) => /* @__PURE__ */ (0, w.jsxs)(oS, { children: ["未检测到 ",e.name,@@ -32282,7 +32342,7 @@ function wD({ data: e, receipt: t }) {})]});}-function TD({ online: e }) {+function ED({ online: e }) {return e === !0 ? /* @__PURE__ */ (0, w.jsxs)("span", {"data-mount": "online",className: "inline-flex items-center gap-1.5 text-body-2-medium text-notification-success-foreground",@@ -32306,14 +32366,14 @@ function TD({ online: e }) {}), "未检测"]});}-function ED({ data: e }) {+function DD({ data: e }) {let t = e.media_sources, n = $y();return t ? /* @__PURE__ */ (0, w.jsxs)(nS, {title: "挂载状态",children: [/* @__PURE__ */ (0, w.jsx)(uS, { children: t.map((e, t) => /* @__PURE__ */ (0, w.jsxs)(dS, {- term: /* @__PURE__ */ (0, w.jsxs)(w.Fragment, { children: [/* @__PURE__ */ (0, w.jsx)(mS, { mark: yD(e.location) }), vD(e.location)] }),- children: [e.path || "未配置挂载点", /* @__PURE__ */ (0, w.jsx)(TD, { online: e.online })]+ term: /* @__PURE__ */ (0, w.jsxs)(w.Fragment, { children: [/* @__PURE__ */ (0, w.jsx)(mS, { mark: bD(e.location) }), yD(e.location)] }),+ children: [e.path || "未配置挂载点", /* @__PURE__ */ (0, w.jsx)(ED, { online: e.online })]}, t)) }),n.error ? /* @__PURE__ */ (0, w.jsx)(iS, {divided: !0,@@ -32329,12 +32389,12 @@ function ED({ data: e }) {}//#endregion//#region src/react/settings/access-settings.tsx-var DD = {+var OD = {legacy: "当前使用系统生成的访问口令。改设自己的密码,或关闭登录要求。",locked: "访问设置无法读取,请在本机检查配置文件。",password: "已设置密码。新设备需要登录,保持登录时间在登录页选择。"};-function OD({ initial: e, receipt: t }) {+function kD({ initial: e, receipt: t }) {let [n, r] = (0, C.useState)(e), [i, a] = (0, C.useState)(""), [o, s] = (0, C.useState)(""), [c, l] = (0, C.useState)(""), [u, d] = (0, C.useState)(!1), [f, p] = (0, C.useState)({}), m = (0, C.useRef)(null), h = $y(), g = (e) => {e.preventDefault();let f = {};@@ -32355,7 +32415,7 @@ function OD({ initial: e, receipt: t }) {let t = e instanceof Ym ? e.body : null, n = t?.errors || t?.detail?.errors;n ? p(n) : h.setError(q(e));});- }, _ = DD[n.mode], v = n.mode !== "locked";+ }, _ = OD[n.mode], v = n.mode !== "locked";return /* @__PURE__ */ (0, w.jsxs)(nS, {title: "访问密码",onSubmit: g,@@ -32432,11 +32492,11 @@ function OD({ initial: e, receipt: t }) {}//#endregion//#region src/react/settings/tunnel-settings.tsx-var kD = 2e3, AD = [["quick", "临时链接"], ["named", "命名隧道"]], jD = {+var AD = 2e3, jD = [["quick", "临时链接"], ["named", "命名隧道"]], MD = {quick: "只用于临时预览;地址随机、重启后会变化。启动前必须设置访问密码。",named: "地址是 Cloudflare 后台绑定的公开主机名,重启后不变。启动前必须设置访问密码,身份策略在 Cloudflare Access 里配置。"};-function MD({ revision: e, initial: t, receipt: n }) {+function ND({ revision: e, initial: t, receipt: n }) {let [r, i] = (0, C.useState)(t), [a, o] = (0, C.useState)(e), [s, c] = (0, C.useState)(t.mode), [l, u] = (0, C.useState)(t.hostname), [d, f] = (0, C.useState)(""), [p, m] = (0, C.useState)({}), h = $y(), g = r.state === "starting" || r.state === "running", _ = r.named_available && s === "named";(0, C.useEffect)(() => {if (r.state !== "starting") return;@@ -32444,7 +32504,7 @@ function MD({ revision: e, initial: t, receipt: n }) {VE(e.signal).then((t) => {e.signal.aborted || !t.tunnel || (fh.setQueryData(BE, t), i(t.tunnel), o(t.revision));}).catch(() => void 0);- }, kD);+ }, AD);return () => {e.abort(), window.clearInterval(t);};@@ -32475,13 +32535,13 @@ function MD({ revision: e, initial: t, receipt: n }) {isDisabled: g,onChange: (e) => c(e),className: Ix,- children: AD.map(([e, t]) => /* @__PURE__ */ (0, w.jsx)(hv, {+ children: jD.map(([e, t]) => /* @__PURE__ */ (0, w.jsx)(hv, {value: e,className: Lx,children: t}, e))}) : null,- /* @__PURE__ */ (0, w.jsx)(oS, { children: jD[_ ? "named" : "quick"] }),+ /* @__PURE__ */ (0, w.jsx)(oS, { children: MD[_ ? "named" : "quick"] }),_ ? /* @__PURE__ */ (0, w.jsxs)(w.Fragment, { children: [/* @__PURE__ */ (0, w.jsx)(Zy, {id: "tunnel-hostname",label: "公开主机名",@@ -32541,24 +32601,24 @@ function MD({ revision: e, initial: t, receipt: n }) {}//#endregion//#region src/react/settings/network-settings.tsx-var ND = [+var PD = [["environment", "系统代理"],["direct", "直连"],["proxy", "自定义"]];-function PD({ data: e, receipt: t }) {+function FD({ data: e, receipt: t }) {return /* @__PURE__ */ (0, w.jsxs)("div", {className: "flex flex-col gap-6",children: [- e.peach_proxy ? /* @__PURE__ */ (0, w.jsx)(FD, {+ e.peach_proxy ? /* @__PURE__ */ (0, w.jsx)(ID, {initial: e.peach_proxy,receipt: t}) : null,- e.access ? /* @__PURE__ */ (0, w.jsx)(OD, {+ e.access ? /* @__PURE__ */ (0, w.jsx)(kD, {initial: e.access,receipt: t}) : null,- e.tunnel ? /* @__PURE__ */ (0, w.jsx)(MD, {+ e.tunnel ? /* @__PURE__ */ (0, w.jsx)(ND, {revision: e.revision,initial: e.tunnel,receipt: t@@ -32566,7 +32626,7 @@ function PD({ data: e, receipt: t }) {]});}-function FD({ initial: e, receipt: t }) {+function ID({ initial: e, receipt: t }) {let [n, r] = (0, C.useState)(e), [i, a] = (0, C.useState)(e.mode), [o, s] = (0, C.useState)(""), c = $y();return /* @__PURE__ */ (0, w.jsxs)(nS, {id: "peachProxy",@@ -32589,7 +32649,7 @@ function FD({ initial: e, receipt: t }) {onSelectionChange: (e) => {e !== null && a(String(e));},- children: ND.map(([e, t]) => /* @__PURE__ */ (0, w.jsx)(Cw, {+ children: PD.map(([e, t]) => /* @__PURE__ */ (0, w.jsx)(Cw, {id: e,children: t}, e))@@ -32625,7 +32685,7 @@ function FD({ initial: e, receipt: t }) {}//#endregion//#region src/react/settings/configuration-page.tsx-function ID({ receipt: e, reopenTutorial: t }) {+function LD({ receipt: e, reopenTutorial: t }) {let n = ut({queryKey: BE,queryFn: ({ signal: e }) => VE(e)@@ -32641,30 +32701,30 @@ function ID({ receipt: e, reopenTutorial: t }) {let i = {data: r,receipt: e- }, a = !!(r.peach_proxy || r.access || r.tunnel);+ }, a = !!(r.startup || r.entry_links), o = !!(r.peach_proxy || r.access || r.tunnel);return /* @__PURE__ */ (0, w.jsxs)("div", {className: "configpage",children: [- r.startup ? /* @__PURE__ */ (0, w.jsx)("h2", {+ a ? /* @__PURE__ */ (0, w.jsx)("h2", {className: "configgroup",children: "通用"}) : null,- r.startup ? /* @__PURE__ */ (0, w.jsx)(KE, { ...i }) : null,+ a ? /* @__PURE__ */ (0, w.jsx)(qE, { ...i }) : null,/* @__PURE__ */ (0, w.jsx)("h2", {className: "configgroup",children: "媒体"}),- /* @__PURE__ */ (0, w.jsx)(CD, { ...i }),- a ? /* @__PURE__ */ (0, w.jsx)("h2", {+ /* @__PURE__ */ (0, w.jsx)(wD, { ...i }),+ o ? /* @__PURE__ */ (0, w.jsx)("h2", {className: "configgroup",children: "网络与访问"}) : null,- a ? /* @__PURE__ */ (0, w.jsx)(PD, { ...i }) : null,+ o ? /* @__PURE__ */ (0, w.jsx)(FD, { ...i }) : null,/* @__PURE__ */ (0, w.jsx)("h2", {className: "configgroup",children: "更新与维护"}),- /* @__PURE__ */ (0, w.jsx)(rD, {+ /* @__PURE__ */ (0, w.jsx)(iD, {...i,reopenTutorial: t})@@ -32673,15 +32733,15 @@ function ID({ receipt: e, reopenTutorial: t }) {}//#endregion//#region src/react/stats/stats.ts-var LD = "/api/stats", RD = ["stats"], zD = (e) => Zm(LD, e);-async function BD(e) {+var RD = "/api/stats", zD = ["stats"], BD = (e) => Zm(RD, e);+async function VD(e) {await fh.fetchQuery({- queryKey: RD,- queryFn: () => zD(e)+ queryKey: zD,+ queryFn: () => BD(e)});}-var VD = (e, t) => t ? Math.round(e / t * 100) : 0, HD = (e) => e >= 3600 ? `${(e / 3600).toFixed(1)} 小时` : `${Math.round(e / 60)} 分钟`, UD = (e) => e.duration ? Math.min(e.play_seconds / e.duration, 1) * 100 : 0, WD = (e) => (e.max_reached || 0) * 100, GD = (e) => e.kind === "online" ? "在线直接观看" : UD(e) < WD(e) - 25 ? "快进扫过" : e.o_count ? `高潮 ${e.o_count}` : "正常观看", KD = (e) => `${e.kind === "online" ? "/follow/item/" : "/item/"}${e.id}`;-function qD(e) {+var HD = (e, t) => t ? Math.round(e / t * 100) : 0, UD = (e) => e >= 3600 ? `${(e / 3600).toFixed(1)} 小时` : `${Math.round(e / 60)} 分钟`, WD = (e) => e.duration ? Math.min(e.play_seconds / e.duration, 1) * 100 : 0, GD = (e) => (e.max_reached || 0) * 100, KD = (e) => e.kind === "online" ? "在线直接观看" : WD(e) < GD(e) - 25 ? "快进扫过" : e.o_count ? `高潮 ${e.o_count}` : "正常观看", qD = (e) => `${e.kind === "online" ? "/follow/item/" : "/item/"}${e.id}`;+function JD(e) {let t = Math.max(1, ...e) * 1.1, n = Math.min(22, 110 / Math.max(1, e.length)), r = Math.min(15, n * .68);return e.map((e, i) => ({radius: 32 + i * n,@@ -32691,7 +32751,7 @@ function qD(e) {}//#endregion//#region src/react/components/expandable-ranking.tsx-function JD({ children: e, className: t = "", previewCount: n = 10 }) {+function YD({ children: e, className: t = "", previewCount: n = 10 }) {let r = (0, C.useId)(), i = (0, C.useRef)(null), [a, o] = (0, C.useState)(!1), [s, c] = (0, C.useState)(!1), l = C.Children.toArray(e), u = l.length > n;(0, C.useLayoutEffect)(() => {let e = i.current;@@ -32738,21 +32798,21 @@ function JD({ children: e, className: t = "", previewCount: n = 10 }) {}//#endregion//#region src/react/stats/radial-card.tsx-var YD = [+var XD = ["stroke-chart-1","stroke-chart-2","stroke-chart-3","stroke-chart-4","stroke-chart-5","stroke-chart-6"-], XD = [+], ZD = ["bg-chart-1","bg-chart-2","bg-chart-3","bg-chart-4","bg-chart-5","bg-chart-6"-], ZD = [+], QD = ["aria-pressed:bg-chart-1/10 aria-pressed:ring-chart-1","aria-pressed:bg-chart-2/10 aria-pressed:ring-chart-2","aria-pressed:bg-chart-3/10 aria-pressed:ring-chart-3",@@ -32760,10 +32820,10 @@ var YD = ["aria-pressed:bg-chart-5/10 aria-pressed:ring-chart-5","aria-pressed:bg-chart-6/10 aria-pressed:ring-chart-6"];-function QD({ title: e, rows: t, unit: n = "个视频" }) {+function $D({ title: e, rows: t, unit: n = "个视频" }) {let [r, i] = (0, C.useState)(-1), [a, o] = (0, C.useState)(-1), s = t.filter((e) => Number.isFinite(e.value) && e.value >= 0);if (!s.length) return null;- let c = a >= 0 ? a : r, l = s.reduce((e, t) => e + t.value, 0), u = qD(s.map((e) => e.value)), d = s[c], f = (e) => i((t) => t === e ? -1 : e);+ let c = a >= 0 ? a : r, l = s.reduce((e, t) => e + t.value, 0), u = JD(s.map((e) => e.value)), d = s[c], f = (e) => i((t) => t === e ? -1 : e);return /* @__PURE__ */ (0, w.jsxs)("section", {className: `${oh({ radius: "chart" })} flex flex-col gap-4 max-sm:p-4`,children: [@@ -32812,7 +32872,7 @@ function QD({ title: e, rows: t, unit: n = "个视频" }) {pathLength: 100,transform: "rotate(-90 160 160)",strokeDasharray: `${u[t].length} ${100 - u[t].length}`,- className: c >= 0 && c !== t ? `cursor-pointer opacity-30 transition-opacity ${YD[t % 6]}` : `cursor-pointer transition-opacity ${YD[t % 6]}`+ className: c >= 0 && c !== t ? `cursor-pointer opacity-30 transition-opacity ${XD[t % 6]}` : `cursor-pointer transition-opacity ${XD[t % 6]}`})]}, e.name))@@ -32827,13 +32887,13 @@ function QD({ title: e, rows: t, unit: n = "个视频" }) {onPointerLeave: () => o(-1),onFocus: () => o(t),onBlur: () => o(-1),- className: `flex min-w-0 cursor-pointer flex-col items-start gap-1 rounded-xl bg-background-tertiary-default p-2.5 text-left outline-none aria-pressed:ring-1 aria-pressed:ring-inset focus-visible:ring-2 focus-visible:ring-border-focus-ring ${ZD[t % 6]}`,+ className: `flex min-w-0 cursor-pointer flex-col items-start gap-1 rounded-xl bg-background-tertiary-default p-2.5 text-left outline-none aria-pressed:ring-1 aria-pressed:ring-inset focus-visible:ring-2 focus-visible:ring-border-focus-ring ${QD[t % 6]}`,children: [/* @__PURE__ */ (0, w.jsxs)("span", {className: "flex min-w-0 items-center gap-1.5 text-caption-1-regular text-text-secondary",children: [/* @__PURE__ */ (0, w.jsx)("i", {"aria-hidden": !0,- className: `size-3 shrink-0 rounded-sm ${XD[t % 6]}`+ className: `size-3 shrink-0 rounded-sm ${ZD[t % 6]}`}), e.name]}),/* @__PURE__ */ (0, w.jsx)("b", {@@ -32852,8 +32912,8 @@ function QD({ title: e, rows: t, unit: n = "个视频" }) {}//#endregion//#region src/react/stats/stats-page.tsx-var $D = 10, eO = `${oh()} flex flex-col gap-4`, tO = "添加媒体文件夹或关注来源后,这里会显示馆藏统计。", nO = "补全资料或添加标签后,这里会显示馆藏中的内容标签。", rO = "开始播放后,这里会显示最近的真实观看证据。", iO = "刮削或手动打标之后,这里会显示每个来源覆盖了多少视频。", aO = "添加媒体文件夹后,这里会显示存储空间。";-function oO({ term: e, value: t }) {+var eO = 10, tO = `${oh()} flex flex-col gap-4`, nO = "添加媒体文件夹或关注来源后,这里会显示馆藏统计。", rO = "补全资料或添加标签后,这里会显示馆藏中的内容标签。", iO = "开始播放后,这里会显示最近的真实观看证据。", aO = "刮削或手动打标之后,这里会显示每个来源覆盖了多少视频。", oO = "添加媒体文件夹后,这里会显示存储空间。";+function sO({ term: e, value: t }) {return /* @__PURE__ */ (0, w.jsxs)("div", {className: "flex min-h-16 min-w-0 flex-col gap-1.5 rounded-2lg bg-background-primary-default p-3",children: [/* @__PURE__ */ (0, w.jsx)("span", {@@ -32865,7 +32925,7 @@ function oO({ term: e, value: t }) {})]});}-function sO({ term: e, value: t, total: n }) {+function cO({ term: e, value: t, total: n }) {return /* @__PURE__ */ (0, w.jsxs)("div", {className: "flex flex-col gap-1.5 border-b border-separator-border py-3 last:border-b-0",children: [/* @__PURE__ */ (0, w.jsxs)("p", {@@ -32874,7 +32934,7 @@ function sO({ term: e, value: t, total: n }) {className: "tabular-nums",children: [t.toLocaleString(), /* @__PURE__ */ (0, w.jsxs)("span", {className: "ml-1.5 text-caption-1-regular text-text-secondary",- children: [VD(t, n), "%"]+ children: [HD(t, n), "%"]})]})]}), /* @__PURE__ */ (0, w.jsx)(dh, {@@ -32884,7 +32944,7 @@ function sO({ term: e, value: t, total: n }) {})]});}-function cO({ term: e, figure: t, unit: n }) {+function lO({ term: e, figure: t, unit: n }) {return /* @__PURE__ */ (0, w.jsxs)("div", {className: "flex shrink-0 flex-col gap-0.5 pb-5 md:w-64 md:pr-6 md:pb-0",children: [@@ -32903,26 +32963,26 @@ function cO({ term: e, figure: t, unit: n }) {]});}-function lO({ headline: e, children: t }) {+function uO({ headline: e, children: t }) {return /* @__PURE__ */ (0, w.jsxs)("div", {- className: `${eO} md:flex-row md:gap-6`,+ className: `${tO} md:flex-row md:gap-6`,children: [e, /* @__PURE__ */ (0, w.jsx)("div", {className: "min-w-0 grow",children: t})]});}-function uO({ data: t, configurable: r, openMediaSettings: i }) {+function dO({ data: t, configurable: r, openMediaSettings: i }) {return t.by_loc.reduce((e, t) => e + t.videos, 0) ? /* @__PURE__ */ (0, w.jsxs)("div", {className: "inline-grid w-full gap-5 md:grid-cols-2",- children: [/* @__PURE__ */ (0, w.jsx)(QD, {+ children: [/* @__PURE__ */ (0, w.jsx)($D, {title: "网盘与本地",rows: t.by_loc.map((t) => ({name: e[t.k] ?? t.k,value: t.videos,detail: n(t.bytes)}))- }), /* @__PURE__ */ (0, w.jsx)(QD, {+ }), /* @__PURE__ */ (0, w.jsx)($D, {title: "媒体库",rows: t.by_library.map((e) => ({name: e.name,@@ -32943,35 +33003,35 @@ function uO({ data: t, configurable: r, openMediaSettings: i }) {size: "small",children: "添加关注"})] }),- children: tO+ children: nO});}-function dO({ attribution: e }) {+function fO({ attribution: e }) {let t = e.videos;return /* @__PURE__ */ (0, w.jsxs)("div", {className: "flex flex-col",children: [- /* @__PURE__ */ (0, w.jsx)(sO, {+ /* @__PURE__ */ (0, w.jsx)(cO, {term: "有创作者",value: e.creator,total: t}),- /* @__PURE__ */ (0, w.jsx)(sO, {+ /* @__PURE__ */ (0, w.jsx)(cO, {term: "有番号",value: e.code,total: t}),- /* @__PURE__ */ (0, w.jsx)(sO, {+ /* @__PURE__ */ (0, w.jsx)(cO, {term: "有厂牌",value: e.studio,total: t}),- /* @__PURE__ */ (0, w.jsx)(sO, {+ /* @__PURE__ */ (0, w.jsx)(cO, {term: "已抽帧",value: e.thumb,total: t}),- /* @__PURE__ */ (0, w.jsx)(sO, {+ /* @__PURE__ */ (0, w.jsx)(cO, {term: "已探测时长",value: e.duration,total: t@@ -32979,7 +33039,7 @@ function dO({ attribution: e }) {]});}-function fO({ volume: e }) {+function pO({ volume: e }) {let t = e.total, r = e.used ?? 0;return /* @__PURE__ */ (0, w.jsxs)("article", {className: "flex min-w-0 flex-col gap-1.5",@@ -32991,7 +33051,7 @@ function fO({ volume: e }) {children: e.label}), /* @__PURE__ */ (0, w.jsx)("b", {className: "text-body-2-medium whitespace-nowrap text-text-primary",- children: t == null ? e.online ? "容量未取得" : "离线" : `${VD(r, t)}%`+ children: t == null ? e.online ? "容量未取得" : "离线" : `${HD(r, t)}%`})]}),/* @__PURE__ */ (0, w.jsx)("small", {@@ -33015,10 +33075,10 @@ function fO({ volume: e }) {]});}-function pO({ volumes: e, configurable: t, openMediaSettings: n }) {+function mO({ volumes: e, configurable: t, openMediaSettings: n }) {return e.length ? /* @__PURE__ */ (0, w.jsx)("div", {className: "flex flex-col gap-5",- children: e.map((e) => /* @__PURE__ */ (0, w.jsx)(fO, { volume: e }, `${e.kind}:${e.label}`))+ children: e.map((e) => /* @__PURE__ */ (0, w.jsx)(pO, { volume: e }, `${e.kind}:${e.label}`))}) : /* @__PURE__ */ (0, w.jsx)(ch, {shell: "plain",icon: qf,@@ -33028,12 +33088,12 @@ function pO({ volumes: e, configurable: t, openMediaSettings: n }) {onClick: n,children: "添加媒体文件夹"}) : void 0,- children: aO+ children: oO});}-function mO({ tags: e, tagLabel: t, onTag: n }) {- return e.length ? /* @__PURE__ */ (0, w.jsx)(JD, {- previewCount: $D,+function hO({ tags: e, tagLabel: t, onTag: n }) {+ return e.length ? /* @__PURE__ */ (0, w.jsx)(YD, {+ previewCount: eO,className: "inline-grid w-full gap-x-6 gap-y-1 sm:grid-cols-2",children: e.map((e, r) => /* @__PURE__ */ (0, w.jsx)("li", {className: "min-w-0",@@ -33066,14 +33126,14 @@ function mO({ tags: e, tagLabel: t, onTag: n }) {size: "small",children: "补全资料"}),- children: nO+ children: rO});}-function hO({ rows: e }) {+function gO({ rows: e }) {return e.length ? /* @__PURE__ */ (0, w.jsx)("div", {className: "flex flex-col gap-5",children: e.map((e) => {- let t = UD(e);+ let t = WD(e);return /* @__PURE__ */ (0, w.jsxs)("article", {className: "flex flex-wrap items-center gap-x-6 gap-y-2",children: [/* @__PURE__ */ (0, w.jsxs)("div", {@@ -33081,14 +33141,14 @@ function hO({ rows: e }) {children: [/* @__PURE__ */ (0, w.jsx)("h3", {className: "min-w-0 text-body-2-medium text-text-primary",children: /* @__PURE__ */ (0, w.jsx)("a", {- href: KD(e),+ href: qD(e),"data-middle-truncate": !0,className: "block max-w-full overflow-hidden whitespace-nowrap hover:underline",children: e.name})}), /* @__PURE__ */ (0, w.jsxs)("p", {className: "flex flex-wrap gap-3 text-caption-1-regular text-text-secondary",- children: [/* @__PURE__ */ (0, w.jsx)("span", { children: e.creator ?? "" }), /* @__PURE__ */ (0, w.jsx)("span", { children: GD(e) })]+ children: [/* @__PURE__ */ (0, w.jsx)("span", { children: e.creator ?? "" }), /* @__PURE__ */ (0, w.jsx)("span", { children: KD(e) })]})]}), /* @__PURE__ */ (0, w.jsxs)("div", {className: "min-w-0 basis-40",@@ -33097,7 +33157,7 @@ function hO({ rows: e }) {value: t}), /* @__PURE__ */ (0, w.jsx)("small", {className: "mt-1.5 block text-caption-1-regular text-text-secondary",- children: `真实 ${t.toFixed(0)}% · 到达 ${WD(e).toFixed(0)}%`+ children: `真实 ${t.toFixed(0)}% · 到达 ${GD(e).toFixed(0)}%`})]})]}, `${e.kind}:${e.id}`);@@ -33111,10 +33171,10 @@ function hO({ rows: e }) {size: "small",children: "浏览馆藏"}),- children: rO+ children: iO});}-function gO({ sources: e, videos: t }) {+function _O({ sources: e, videos: t }) {return e.length ? /* @__PURE__ */ (0, w.jsx)("div", {className: "inline-grid w-full gap-x-8 gap-y-6 sm:grid-cols-2",children: e.map((e) => /* @__PURE__ */ (0, w.jsxs)("article", {@@ -33153,10 +33213,10 @@ function gO({ sources: e, videos: t }) {size: "small",children: "补全资料"}),- children: iO+ children: aO});}-function _O({ id: e, label: t, figure: n, detail: r, icon: i, accent: a }) {+function vO({ id: e, label: t, figure: n, detail: r, icon: i, accent: a }) {return /* @__PURE__ */ (0, w.jsx)(Fy, {id: e,className: Bx({@@ -33172,17 +33232,17 @@ function _O({ id: e, label: t, figure: n, detail: r, icon: i, accent: a }) {})});}-function vO(e) {+function yO(e) {let t = ut({- queryKey: RD,- queryFn: ({ signal: e }) => zD(e)+ queryKey: zD,+ queryFn: ({ signal: e }) => BD(e)}), r = t.data;if (!r) return /* @__PURE__ */ (0, w.jsx)(uh, { children: /* @__PURE__ */ (0, w.jsx)(J, {tone: "error",title: "读取失败",children: t.error ? q(t.error) : "读取统计失败"}) });- let i = r.consumption, a = r.storage_summary, o = r.by_loc.reduce((e, t) => e + t.videos, 0), s = r.by_loc.reduce((e, t) => e + t.bytes, 0), c = VD(r.tag_cov, r.attribution.videos);+ let i = r.consumption, a = r.storage_summary, o = r.by_loc.reduce((e, t) => e + t.videos, 0), s = r.by_loc.reduce((e, t) => e + t.bytes, 0), c = HD(r.tag_cov, r.attribution.videos);return /* @__PURE__ */ (0, w.jsxs)(uh, { children: [/* @__PURE__ */ (0, w.jsx)("p", {className: "text-caption-1-regular text-text-secondary",@@ -33195,7 +33255,7 @@ function vO(e) {"aria-label": "统计视图",className: Vx,children: [- /* @__PURE__ */ (0, w.jsx)(_O, {+ /* @__PURE__ */ (0, w.jsx)(vO, {id: "inventory",label: "馆藏视频",icon: Bf,@@ -33203,15 +33263,15 @@ function vO(e) {figure: o.toLocaleString(),detail: n(s)}),- /* @__PURE__ */ (0, w.jsx)(_O, {+ /* @__PURE__ */ (0, w.jsx)(vO, {id: "viewing",label: "看过",icon: Wf,accent: 1,figure: i.played.toLocaleString(),- detail: HD(i.play_seconds)+ detail: UD(i.play_seconds)}),- /* @__PURE__ */ (0, w.jsx)(_O, {+ /* @__PURE__ */ (0, w.jsx)(vO, {id: "coverage",label: "内容标签",icon: tp,@@ -33219,7 +33279,7 @@ function vO(e) {figure: `${c}%`,detail: `${r.tag_cov.toLocaleString()} / ${r.attribution.videos.toLocaleString()}`}),- /* @__PURE__ */ (0, w.jsx)(_O, {+ /* @__PURE__ */ (0, w.jsx)(vO, {id: "storage",label: "使用空间",icon: qf,@@ -33231,15 +33291,15 @@ function vO(e) {}),/* @__PURE__ */ (0, w.jsx)(Iy, {id: "inventory",- children: /* @__PURE__ */ (0, w.jsx)(uO, {+ children: /* @__PURE__ */ (0, w.jsx)(dO, {data: r,...e})}),/* @__PURE__ */ (0, w.jsx)(Iy, {id: "viewing",- children: /* @__PURE__ */ (0, w.jsx)(lO, {- headline: /* @__PURE__ */ (0, w.jsx)(cO, {+ children: /* @__PURE__ */ (0, w.jsx)(uO, {+ headline: /* @__PURE__ */ (0, w.jsx)(lO, {term: "观看",figure: i.played.toLocaleString(),unit: "个作品有播放记录"@@ -33247,31 +33307,31 @@ function vO(e) {children: /* @__PURE__ */ (0, w.jsxs)("div", {className: "inline-grid w-full gap-3 sm:grid-cols-2",children: [- /* @__PURE__ */ (0, w.jsx)(oO, {+ /* @__PURE__ */ (0, w.jsx)(sO, {term: "馆藏观看",value: i.library_played}),- /* @__PURE__ */ (0, w.jsx)(oO, {+ /* @__PURE__ */ (0, w.jsx)(sO, {term: "在线直接观看",value: i.online_played}),- /* @__PURE__ */ (0, w.jsx)(oO, {+ /* @__PURE__ */ (0, w.jsx)(sO, {term: "高潮计数",value: i.o_total}),- /* @__PURE__ */ (0, w.jsx)(oO, {+ /* @__PURE__ */ (0, w.jsx)(sO, {term: "快进扫过",value: i.skimmed}),- /* @__PURE__ */ (0, w.jsx)(oO, {+ /* @__PURE__ */ (0, w.jsx)(sO, {term: "明确不喜欢",value: i.dislike}),- /* @__PURE__ */ (0, w.jsx)(oO, {+ /* @__PURE__ */ (0, w.jsx)(sO, {term: "看过了",value: i.seen}),- /* @__PURE__ */ (0, w.jsx)(oO, {+ /* @__PURE__ */ (0, w.jsx)(sO, {term: "回收站",value: i.trash})@@ -33281,24 +33341,24 @@ function vO(e) {}),/* @__PURE__ */ (0, w.jsx)(Iy, {id: "coverage",- children: /* @__PURE__ */ (0, w.jsx)(lO, {- headline: /* @__PURE__ */ (0, w.jsx)(cO, {+ children: /* @__PURE__ */ (0, w.jsx)(uO, {+ headline: /* @__PURE__ */ (0, w.jsx)(lO, {term: "内容标签覆盖",figure: `${c}%`,unit: `${r.tag_cov.toLocaleString()} / ${r.attribution.videos.toLocaleString()}`}),- children: /* @__PURE__ */ (0, w.jsx)(dO, { attribution: r.attribution })+ children: /* @__PURE__ */ (0, w.jsx)(fO, { attribution: r.attribution })})}),/* @__PURE__ */ (0, w.jsx)(Iy, {id: "storage",- children: /* @__PURE__ */ (0, w.jsx)(lO, {- headline: /* @__PURE__ */ (0, w.jsx)(cO, {+ children: /* @__PURE__ */ (0, w.jsx)(uO, {+ headline: /* @__PURE__ */ (0, w.jsx)(lO, {term: "使用空间",figure: String(a.measured),unit: "个卷已取得容量"}),- children: /* @__PURE__ */ (0, w.jsx)(pO, {+ children: /* @__PURE__ */ (0, w.jsx)(mO, {volumes: r.storage_volumes,...e})@@ -33336,7 +33396,7 @@ function vO(e) {/* @__PURE__ */ (0, w.jsx)(Iy, {id: "tags",className: "px-4 pt-3.5 pb-4",- children: /* @__PURE__ */ (0, w.jsx)(mO, {+ children: /* @__PURE__ */ (0, w.jsx)(hO, {tags: r.top_tags,...e})@@ -33344,12 +33404,12 @@ function vO(e) {/* @__PURE__ */ (0, w.jsx)(Iy, {id: "recent",className: "px-4 pt-3.5 pb-4",- children: /* @__PURE__ */ (0, w.jsx)(hO, { rows: r.recent })+ children: /* @__PURE__ */ (0, w.jsx)(gO, { rows: r.recent })}),/* @__PURE__ */ (0, w.jsx)(Iy, {id: "sources",className: "px-4 pt-3.5 pb-4",- children: /* @__PURE__ */ (0, w.jsx)(gO, {+ children: /* @__PURE__ */ (0, w.jsx)(_O, {sources: r.tag_source,videos: r.attribution.videos})@@ -33360,7 +33420,7 @@ function vO(e) {}//#endregion//#region node_modules/d3-array/src/max.js-function yO(e, t) {+function bO(e, t) {let n;if (t === void 0) for (let t of e) t != null && (n < t || n === void 0 && t >= t) && (n = t);else {@@ -33371,7 +33431,7 @@ function yO(e, t) {}//#endregion//#region node_modules/d3-array/src/min.js-function bO(e, t) {+function xO(e, t) {let n;if (t === void 0) for (let t of e) t != null && (n > t || n === void 0 && t >= t) && (n = t);else {@@ -33382,7 +33442,7 @@ function bO(e, t) {}//#endregion//#region node_modules/d3-array/src/sum.js-function xO(e, t) {+function SO(e, t) {let n = 0;if (t === void 0) for (let t of e) (t = +t) && (n += t);else {@@ -33393,66 +33453,66 @@ function xO(e, t) {}//#endregion//#region node_modules/d3-sankey/src/align.js-function SO(e, t) {+function CO(e, t) {return e.sourceLinks.length ? e.depth : t - 1;}//#endregion//#region node_modules/d3-sankey/src/constant.js-function CO(e) {+function wO(e) {return function() {return e;};}//#endregion//#region node_modules/d3-sankey/src/sankey.js-function wO(e, t) {- return EO(e.source, t.source) || e.index - t.index;-}function TO(e, t) {- return EO(e.target, t.target) || e.index - t.index;+ return DO(e.source, t.source) || e.index - t.index;}function EO(e, t) {+ return DO(e.target, t.target) || e.index - t.index;+}+function DO(e, t) {return e.y0 - t.y0;}-function DO(e) {+function OO(e) {return e.value;}-function OO(e) {+function kO(e) {return e.index;}-function kO(e) {+function AO(e) {return e.nodes;}-function AO(e) {+function jO(e) {return e.links;}-function jO(e, t) {+function MO(e, t) {let n = e.get(t);if (!n) throw Error("missing: " + t);return n;}-function MO({ nodes: e }) {+function NO({ nodes: e }) {for (let t of e) {let e = t.y0, n = e;for (let n of t.sourceLinks) n.y0 = e + n.width / 2, e += n.width;for (let e of t.targetLinks) e.y1 = n + e.width / 2, n += e.width;}}-function NO() {- let e = 0, t = 0, n = 1, r = 1, i = 24, a = 8, o, s = OO, c = SO, l, u, d = kO, f = AO, p = 6;+function PO() {+ let e = 0, t = 0, n = 1, r = 1, i = 24, a = 8, o, s = kO, c = CO, l, u, d = AO, f = jO, p = 6;function m() {let e = {nodes: d.apply(null, arguments),links: f.apply(null, arguments)};- return h(e), g(e), _(e), v(e), x(e), MO(e), e;+ return h(e), g(e), _(e), v(e), x(e), NO(e), e;}m.update = function(e) {- return MO(e), e;+ return NO(e), e;}, m.nodeId = function(e) {- return arguments.length ? (s = typeof e == "function" ? e : CO(e), m) : s;+ return arguments.length ? (s = typeof e == "function" ? e : wO(e), m) : s;}, m.nodeAlign = function(e) {- return arguments.length ? (c = typeof e == "function" ? e : CO(e), m) : c;+ return arguments.length ? (c = typeof e == "function" ? e : wO(e), m) : c;}, m.nodeSort = function(e) {return arguments.length ? (l = e, m) : l;}, m.nodeWidth = function(e) {@@ -33460,9 +33520,9 @@ function NO() {}, m.nodePadding = function(e) {return arguments.length ? (a = o = +e, m) : a;}, m.nodes = function(e) {- return arguments.length ? (d = typeof e == "function" ? e : CO(e), m) : d;+ return arguments.length ? (d = typeof e == "function" ? e : wO(e), m) : d;}, m.links = function(e) {- return arguments.length ? (f = typeof e == "function" ? e : CO(e), m) : f;+ return arguments.length ? (f = typeof e == "function" ? e : wO(e), m) : f;}, m.linkSort = function(e) {return arguments.length ? (u = e, m) : u;}, m.size = function(i) {@@ -33478,12 +33538,12 @@ function NO() {for (let [e, r] of t.entries()) {r.index = e;let { source: t, target: i } = r;- typeof t != "object" && (t = r.source = jO(n, t)), typeof i != "object" && (i = r.target = jO(n, i)), t.sourceLinks.push(r), i.targetLinks.push(r);+ typeof t != "object" && (t = r.source = MO(n, t)), typeof i != "object" && (i = r.target = MO(n, i)), t.sourceLinks.push(r), i.targetLinks.push(r);}if (u != null) for (let { sourceLinks: t, targetLinks: n } of e) t.sort(u), n.sort(u);}function g({ nodes: e }) {- for (let t of e) t.value = t.fixedValue === void 0 ? Math.max(xO(t.sourceLinks, DO), xO(t.targetLinks, DO)) : t.fixedValue;+ for (let t of e) t.value = t.fixedValue === void 0 ? Math.max(SO(t.sourceLinks, OO), SO(t.targetLinks, OO)) : t.fixedValue;}function _({ nodes: e }) {let t = e.length, n = new Set(e), r = /* @__PURE__ */ new Set(), i = 0;@@ -33508,7 +33568,7 @@ function NO() {}}function y({ nodes: t }) {- let r = yO(t, (e) => e.depth) + 1, a = (n - e - i) / (r - 1), o = Array(r);+ let r = bO(t, (e) => e.depth) + 1, a = (n - e - i) / (r - 1), o = Array(r);for (let n of t) {let t = Math.max(0, Math.min(r - 1, Math.floor(c.call(null, n, r))));n.layer = t, n.x0 = e + t * a, n.x1 = n.x0 + i, o[t] ? o[t].push(n) : o[t] = [n];@@ -33517,7 +33577,7 @@ function NO() {return o;}function b(e) {- let n = bO(e, (e) => (r - t - (e.length - 1) * o) / xO(e, DO));+ let n = xO(e, (e) => (r - t - (e.length - 1) * o) / SO(e, OO));for (let i of e) {let e = t;for (let t of i) {@@ -33534,7 +33594,7 @@ function NO() {}function x(e) {let n = y(e);- o = Math.min(a, (r - t) / (yO(n, (e) => e.length) - 1)), b(n);+ o = Math.min(a, (r - t) / (bO(n, (e) => e.length) - 1)), b(n);for (let e = 0; e < p; ++e) {let t = .99 ** e, r = Math.max(1 - t, (e + 1) / p);C(n, t, r), S(n, t, r);@@ -33553,7 +33613,7 @@ function NO() {let i = (n / r - e.y0) * t;e.y0 += i, e.y1 += i, D(e);}- l === void 0 && i.sort(EO), w(i, n);+ l === void 0 && i.sort(DO), w(i, n);}}function C(e, t, n) {@@ -33569,7 +33629,7 @@ function NO() {let i = (n / r - e.y0) * t;e.y0 += i, e.y1 += i, D(e);}- l === void 0 && i.sort(EO), w(i, n);+ l === void 0 && i.sort(DO), w(i, n);}}function w(e, n) {@@ -33590,12 +33650,12 @@ function NO() {}function D({ sourceLinks: e, targetLinks: t }) {if (u === void 0) {- for (let { source: { sourceLinks: e } } of t) e.sort(TO);- for (let { target: { targetLinks: t } } of e) t.sort(wO);+ for (let { source: { sourceLinks: e } } of t) e.sort(EO);+ for (let { target: { targetLinks: t } } of e) t.sort(TO);}}function O(e) {- if (u === void 0) for (let { sourceLinks: t, targetLinks: n } of e) t.sort(TO), n.sort(wO);+ if (u === void 0) for (let { sourceLinks: t, targetLinks: n } of e) t.sort(EO), n.sort(TO);}function k(e, t) {let n = e.y0 - (e.sourceLinks.length - 1) * o / 2;@@ -33625,15 +33685,15 @@ function NO() {}//#endregion//#region node_modules/d3-path/src/path.js-var PO = Math.PI, FO = 2 * PO, IO = 1e-6, LO = FO - IO;-function RO() {+var FO = Math.PI, IO = 2 * FO, LO = 1e-6, RO = IO - LO;+function zO() {this._x0 = this._y0 = this._x1 = this._y1 = null, this._ = "";}-function zO() {- return new RO();+function BO() {+ return new zO();}-RO.prototype = zO.prototype = {- constructor: RO,+zO.prototype = BO.prototype = {+ constructor: zO,moveTo: function(e, t) {this._ += "M" + (this._x0 = this._x1 = +e) + "," + (this._y0 = this._y1 = +t);},@@ -33654,11 +33714,11 @@ RO.prototype = zO.prototype = {var a = this._x1, o = this._y1, s = n - e, c = r - t, l = a - e, u = o - t, d = l * l + u * u;if (i < 0) throw Error("negative radius: " + i);if (this._x1 === null) this._ += "M" + (this._x1 = e) + "," + (this._y1 = t);- else if (d > IO) {- if (!(Math.abs(u * s - c * l) > IO) || !i) this._ += "L" + (this._x1 = e) + "," + (this._y1 = t);+ else if (d > LO) {+ if (!(Math.abs(u * s - c * l) > LO) || !i) this._ += "L" + (this._x1 = e) + "," + (this._y1 = t);else {- var f = n - a, p = r - o, m = s * s + c * c, h = f * f + p * p, g = Math.sqrt(m), _ = Math.sqrt(d), v = i * Math.tan((PO - Math.acos((m + d - h) / (2 * g * _))) / 2), y = v / _, b = v / g;- Math.abs(y - 1) > IO && (this._ += "L" + (e + y * l) + "," + (t + y * u)), this._ += "A" + i + "," + i + ",0,0," + +(u * f > l * p) + "," + (this._x1 = e + b * s) + "," + (this._y1 = t + b * c);+ var f = n - a, p = r - o, m = s * s + c * c, h = f * f + p * p, g = Math.sqrt(m), _ = Math.sqrt(d), v = i * Math.tan((FO - Math.acos((m + d - h) / (2 * g * _))) / 2), y = v / _, b = v / g;+ Math.abs(y - 1) > LO && (this._ += "L" + (e + y * l) + "," + (t + y * u)), this._ += "A" + i + "," + i + ",0,0," + +(u * f > l * p) + "," + (this._x1 = e + b * s) + "," + (this._y1 = t + b * c);}}},@@ -33666,7 +33726,7 @@ RO.prototype = zO.prototype = {e = +e, t = +t, n = +n, a = !!a;var o = n * Math.cos(r), s = n * Math.sin(r), c = e + o, l = t + s, u = 1 ^ a, d = a ? r - i : i - r;if (n < 0) throw Error("negative radius: " + n);- this._x1 === null ? this._ += "M" + c + "," + l : (Math.abs(this._x1 - c) > IO || Math.abs(this._y1 - l) > IO) && (this._ += "L" + c + "," + l), n && (d < 0 && (d = d % FO + FO), d > LO ? this._ += "A" + n + "," + n + ",0,1," + u + "," + (e - o) + "," + (t - s) + "A" + n + "," + n + ",0,1," + u + "," + (this._x1 = c) + "," + (this._y1 = l) : d > IO && (this._ += "A" + n + "," + n + ",0," + +(d >= PO) + "," + u + "," + (this._x1 = e + n * Math.cos(i)) + "," + (this._y1 = t + n * Math.sin(i))));+ this._x1 === null ? this._ += "M" + c + "," + l : (Math.abs(this._x1 - c) > LO || Math.abs(this._y1 - l) > LO) && (this._ += "L" + c + "," + l), n && (d < 0 && (d = d % IO + IO), d > RO ? this._ += "A" + n + "," + n + ",0,1," + u + "," + (e - o) + "," + (t - s) + "A" + n + "," + n + ",0,1," + u + "," + (this._x1 = c) + "," + (this._y1 = l) : d > LO && (this._ += "A" + n + "," + n + ",0," + +(d >= FO) + "," + u + "," + (this._x1 = e + n * Math.cos(i)) + "," + (this._y1 = t + n * Math.sin(i))));},rect: function(e, t, n, r) {this._ += "M" + (this._x0 = this._x1 = +e) + "," + (this._y0 = this._y1 = +t) + "h" + +n + "v" + +r + "h" + -n + "Z";@@ -33677,90 +33737,90 @@ RO.prototype = zO.prototype = {};//#endregion//#region node_modules/d3-shape/src/constant.js-function BO(e) {+function VO(e) {return function() {return e;};}//#endregion//#region node_modules/d3-shape/src/point.js-function VO(e) {+function HO(e) {return e[0];}-function HO(e) {+function UO(e) {return e[1];}//#endregion//#region node_modules/d3-shape/src/array.js-var UO = Array.prototype.slice;+var WO = Array.prototype.slice;//#endregion//#region node_modules/d3-shape/src/link/index.js-function WO(e) {+function GO(e) {return e.source;}-function GO(e) {+function KO(e) {return e.target;}-function KO(e) {- var t = WO, n = GO, r = VO, i = HO, a = null;+function qO(e) {+ var t = GO, n = KO, r = HO, i = UO, a = null;function o() {- var o, s = UO.call(arguments), c = t.apply(this, s), l = n.apply(this, s);- if (a ||= o = zO(), e(a, +r.apply(this, (s[0] = c, s)), +i.apply(this, s), +r.apply(this, (s[0] = l, s)), +i.apply(this, s)), o) return a = null, o + "" || null;+ var o, s = WO.call(arguments), c = t.apply(this, s), l = n.apply(this, s);+ if (a ||= o = BO(), e(a, +r.apply(this, (s[0] = c, s)), +i.apply(this, s), +r.apply(this, (s[0] = l, s)), +i.apply(this, s)), o) return a = null, o + "" || null;}return o.source = function(e) {return arguments.length ? (t = e, o) : t;}, o.target = function(e) {return arguments.length ? (n = e, o) : n;}, o.x = function(e) {- return arguments.length ? (r = typeof e == "function" ? e : BO(+e), o) : r;+ return arguments.length ? (r = typeof e == "function" ? e : VO(+e), o) : r;}, o.y = function(e) {- return arguments.length ? (i = typeof e == "function" ? e : BO(+e), o) : i;+ return arguments.length ? (i = typeof e == "function" ? e : VO(+e), o) : i;}, o.context = function(e) {return arguments.length ? (a = e ?? null, o) : a;}, o;}-function qO(e, t, n, r, i) {+function JO(e, t, n, r, i) {e.moveTo(t, n), e.bezierCurveTo(t = (t + r) / 2, n, t, i, r, i);}-function JO() {- return KO(qO);+function YO() {+ return qO(JO);}//#endregion//#region node_modules/d3-sankey/src/sankeyLinkHorizontal.js-function YO(e) {+function XO(e) {return [e.source.x1, e.y0];}-function XO(e) {+function ZO(e) {return [e.target.x0, e.y1];}-function ZO() {- return JO().source(YO).target(XO);+function QO() {+ return YO().source(XO).target(ZO);}//#endregion//#region src/react/taste/taste.ts-var QO = "/api/taste", $O = "/api/taste/refresh", ek = "/api/taste/import", tk = "/api/taste/source", nk = (e) => ["taste", e], rk = ["taste", "refresh"], ik = [+var $O = "/api/taste", ek = "/api/taste/refresh", tk = "/api/taste/import", nk = "/api/taste/source", rk = (e) => ["taste", e], ik = ["taste", "refresh"], ak = [["7d", "最近 7 天"],["30d", "最近 30 天"],["90d", "最近 90 天"],["365d", "最近一年"],["all", "全部时间"]-], ak = (e, t) => Zm(`${QO}?window=${e}`, t), ok = (e) => Zm($O, e);-async function sk(e, t) {+], ok = (e, t) => Zm(`${$O}?window=${e}`, t), sk = (e) => Zm(ek, e);+async function ck(e, t) {await fh.fetchQuery({- queryKey: nk(e),- queryFn: () => ak(e, t)+ queryKey: rk(e),+ queryFn: () => ok(e, t)});}-var ck = (e) => Qm($O, {+var lk = (e) => Qm(ek, {window: e,background: !0-}), lk = (e, t) => Qm(tk, {+}), uk = (e, t) => Qm(nk, {operation: "remove",source_key: e,window: t});-async function uk(e) {- let t = await fetch(ek, {+async function dk(e) {+ let t = await fetch(tk, {method: "POST",credentials: "same-origin",headers: {@@ -33778,34 +33838,34 @@ async function uk(e) {}return n;}-var dk = 2e3, fk = 1e4, pk = (e) => e?.status === "running" ? dk : fk, mk = (e) => e ? new Date(e).toLocaleDateString("zh-CN") : "—", hk = (e) => e >= 3600 ? `${(e / 3600).toFixed(1)} 小时` : `${Math.round(e / 60)} 分钟`, gk = (e) => Number(e.web_visits ?? e.score ?? e.visits ?? e.peach_items ?? 0);-function _k(e) {+var fk = 2e3, pk = 1e4, mk = (e) => e?.status === "running" ? fk : pk, hk = (e) => e ? new Date(e).toLocaleDateString("zh-CN") : "—", gk = (e) => e >= 3600 ? `${(e / 3600).toFixed(1)} 小时` : `${Math.round(e / 60)} 分钟`, _k = (e) => Number(e.web_visits ?? e.score ?? e.visits ?? e.peach_items ?? 0);+function vk(e) {if (e.web_visits == null) return Number(e.score || e.visits || 0).toLocaleString();let t = [];return e.web_visits && t.push(`浏览 ${e.web_visits}`), e.peach_items && t.push(`Peach ${e.peach_items}`), t.join(" · ");}-function vk(e) {- let t = e.map(gk), n = Math.max(1, ...t);+function yk(e) {+ let t = e.map(_k), n = Math.max(1, ...t);return t.map((e) => Math.max(0, Math.min(100, e / n * 100)));}-var yk = {+var bk = {x: 160,y: 140-}, bk = [+}, xk = [25,50,75,100-], xk = (e, t, n) => {+], Sk = (e, t, n) => {let r = e / t * Math.PI * 2 - Math.PI / 2;- return [yk.x + Math.cos(r) * n, yk.y + Math.sin(r) * n];+ return [bk.x + Math.cos(r) * n, bk.y + Math.sin(r) * n];};-function Sk(e) {+function Ck(e) {let t = e.filter((e) => Number.isFinite(Number(e.score)) && Number(e.score) > 0).slice().sort((e, t) => Number(t.score) - Number(e.score)).slice(0, 6);if (t.length < 3) return [];let n = Math.max(...t.map((e) => Number(e.score)));return t.map((e, r) => {- let [i, a] = xk(r, t.length, Number(e.score) / n * 100), [o, s] = xk(r, t.length, 116);+ let [i, a] = Sk(r, t.length, Number(e.score) / n * 100), [o, s] = Sk(r, t.length, 116);return {name: e.name,x: i,@@ -33815,7 +33875,7 @@ function Sk(e) {};});}-var Ck = (e, t) => Array.from({ length: t }, (n, r) => xk(r, t, e).map((e) => e.toFixed(2)).join(",")).join(" "), wk = (e) => e.map((e) => `${e.x.toFixed(2)},${e.y.toFixed(2)}`).join(" "), Tk = [+var wk = (e, t) => Array.from({ length: t }, (n, r) => Sk(r, t, e).map((e) => e.toFixed(2)).join(",")).join(" "), Tk = (e) => e.map((e) => `${e.x.toFixed(2)},${e.y.toFixed(2)}`).join(" "), Ek = ["周一","周二","周三",@@ -33823,8 +33883,8 @@ var Ck = (e, t) => Array.from({ length: t }, (n, r) => xk(r, t, e).map((e) => e."周五","周六","周日"-], Ek = (e, t) => e ? Math.max(.12, e / t) : 0;-function Dk(e) {+], Dk = (e, t) => e ? Math.max(.12, e / t) : 0;+function Ok(e) {let t = Array.from({ length: 7 }, () => Array(24).fill(0));for (let n of e?.hours || []) {let { weekday: e, hour: r, count: i } = n;@@ -33834,14 +33894,14 @@ function Dk(e) {return {cells: t.flatMap((e, t) => e.map((e, n) => ({key: `${t}-${n}`,- label: `${Tk[t]} ${n}:00`,+ label: `${Ek[t]} ${n}:00`,count: e,- share: Ek(e, r)+ share: Dk(e, r)}))),total: n.reduce((e, t) => e + t, 0)};}-function Ok(e) {+function kk(e) {let t = (e?.days || []).filter((e) => /^\d{4}-\d{2}-\d{2}$/.test(e.date) && Number.isFinite(e.count) && e.count >= 0).slice().sort((e, t) => e.date.localeCompare(t.date)), n = {cells: [],total: 0,@@ -33859,7 +33919,7 @@ function Ok(e) {key: r,label: r,count: s,- share: Ek(s, o)+ share: Dk(s, o)};});return {@@ -33869,17 +33929,17 @@ function Ok(e) {end: t.at(-1).date};}-var kk = {+var Ak = {width: 720,height: 435-}, Ak = {+}, jk = {source: 145,target: 545};-function jk(e = []) {+function Mk(e = []) {let t = e.filter((e) => e.source && e.target && Number.isFinite(e.value) && e.value > 0);if (!t.length) return null;- let n = [...new Set(t.map((e) => e.source))], r = [...new Set(t.map((e) => e.target))], i = NO().nodeId((e) => e.id).nodeWidth(10).nodePadding(22).extent([[155, 16], [535, 404]])({+ let n = [...new Set(t.map((e) => e.source))], r = [...new Set(t.map((e) => e.target))], i = PO().nodeId((e) => e.id).nodeWidth(10).nodePadding(22).extent([[155, 16], [535, 404]])({nodes: [...n.map((e) => ({id: `source:${e}`,name: e,@@ -33894,7 +33954,7 @@ function jk(e = []) {target: `target:${e.target}`,value: e.value}))- }), a = t.reduce((e, t) => e + t.value, 0), o = ZO();+ }), a = t.reduce((e, t) => e + t.value, 0), o = QO();return {nodes: i.nodes.map((e) => ({id: e.id,@@ -33924,22 +33984,22 @@ function jk(e = []) {total: a};}-var Mk = (e) => e.length > 18 ? `${e.slice(0, 16)}…` : e, Nk = [+var Nk = (e) => e.length > 18 ? `${e.slice(0, 16)}…` : e, Pk = ["stroke-chart-1","stroke-chart-2","stroke-chart-3","stroke-chart-4","stroke-chart-5","stroke-chart-6"-], Pk = [+], Fk = ["fill-chart-1","fill-chart-2","fill-chart-3","fill-chart-4","fill-chart-5","fill-chart-6"-], Fk = `${oh({ radius: "chart" })} flex flex-col gap-4 max-sm:p-4`;-function Ik({ title: e, figure: t, note: n }) {+], Ik = `${oh({ radius: "chart" })} flex flex-col gap-4 max-sm:p-4`;+function Lk({ title: e, figure: t, note: n }) {return /* @__PURE__ */ (0, w.jsxs)("header", {className: "flex flex-wrap items-end justify-between gap-x-4 gap-y-1",children: [/* @__PURE__ */ (0, w.jsxs)("span", {@@ -33957,8 +34017,8 @@ function Ik({ title: e, figure: t, note: n }) {})]});}-function Lk({ rows: e, label: t }) {- let n = Sk(e);+function Rk({ rows: e, label: t }) {+ let n = Ck(e);if (!n.length) return null;let r = n.length;return /* @__PURE__ */ (0, w.jsxs)("svg", {@@ -33968,14 +34028,14 @@ function Lk({ rows: e, label: t }) {className: "block w-full overflow-visible",children: [/* @__PURE__ */ (0, w.jsx)("title", { children: n.map((e) => e.name).join(",") }),- bk.map((e) => /* @__PURE__ */ (0, w.jsx)("polygon", {- points: Ck(e, r),+ xk.map((e) => /* @__PURE__ */ (0, w.jsx)("polygon", {+ points: wk(e, r),fill: "none",className: "stroke-separator-border",strokeWidth: 1}, e)),/* @__PURE__ */ (0, w.jsx)("polygon", {- points: wk(n),+ points: Tk(n),strokeWidth: 2,strokeLinejoin: "round",fillOpacity: .18,@@ -33992,10 +34052,10 @@ function Lk({ rows: e, label: t }) {]});}-function Rk({ rows: e, label: t }) {+function zk({ rows: e, label: t }) {let n = e.filter((e) => Number.isFinite(Number(e.score)) && Number(e.score) > 0).slice().sort((e, t) => Number(t.score) - Number(e.score)).slice(0, 8);if (!n.length) return null;- let r = vk(n);+ let r = yk(n);return /* @__PURE__ */ (0, w.jsx)("ol", {"aria-label": t,className: "flex flex-col gap-2",@@ -34028,12 +34088,12 @@ function Rk({ rows: e, label: t }) {}, e.name))});}-function zk({ title: e, unit: t, cells: n, total: r, columns: i, rows: a, axis: o, footer: s }) {+function Bk({ title: e, unit: t, cells: n, total: r, columns: i, rows: a, axis: o, footer: s }) {let [c, l] = (0, C.useState)(null), u = o ? 30 : 0, d = o ? 18 : 0;return /* @__PURE__ */ (0, w.jsxs)("section", {- className: Fk,+ className: Ik,children: [- /* @__PURE__ */ (0, w.jsx)(Ik, {+ /* @__PURE__ */ (0, w.jsx)(Lk, {title: e,figure: (c ? c.count : r).toLocaleString(),note: c ? c.label : t@@ -34073,11 +34133,11 @@ function zk({ title: e, unit: t, cells: n, total: r, columns: i, rows: a, axis:]});}-var Bk = "口味网站访问";-function Vk({ activity: e }) {- let t = Dk(e), n = Ok(e);+var Vk = "口味网站访问";+function Hk({ activity: e }) {+ let t = Ok(e), n = kk(e);if (!n.cells.length) return /* @__PURE__ */ (0, w.jsxs)("section", {- className: Fk,+ className: Ik,children: [/* @__PURE__ */ (0, w.jsx)("h3", {className: "text-title-2-medium text-text-primary",children: "浏览活跃时间"@@ -34086,7 +34146,7 @@ function Vk({ activity: e }) {children: "还没有可用于分析的口味网站访问记录。"})]});- let r = /* @__PURE__ */ (0, w.jsxs)(w.Fragment, { children: [Tk.map((e, t) => /* @__PURE__ */ (0, w.jsx)("text", {+ let r = /* @__PURE__ */ (0, w.jsxs)(w.Fragment, { children: [Ek.map((e, t) => /* @__PURE__ */ (0, w.jsx)("text", {x: 0,y: 18 + t * 17 + 7,dominantBaseline: "middle",@@ -34101,18 +34161,18 @@ function Vk({ activity: e }) {}, t))] });return /* @__PURE__ */ (0, w.jsxs)("div", {className: "inline-grid w-full gap-5 lg:grid-cols-2",- children: [/* @__PURE__ */ (0, w.jsx)(zk, {+ children: [/* @__PURE__ */ (0, w.jsx)(Bk, {title: "浏览活跃时间",- unit: Bk,+ unit: Vk,cells: t.cells,total: t.total,columns: 24,rows: 7,axis: r,footer: /* @__PURE__ */ (0, w.jsxs)(w.Fragment, { children: [/* @__PURE__ */ (0, w.jsx)("span", { children: "星期 × 小时" }), /* @__PURE__ */ (0, w.jsx)("span", { children: e?.timezone || "UTC+08:00" })] })- }), /* @__PURE__ */ (0, w.jsx)(zk, {+ }), /* @__PURE__ */ (0, w.jsx)(Bk, {title: "每日活跃",- unit: Bk,+ unit: Vk,cells: n.cells,total: n.total,columns: 13,@@ -34121,14 +34181,14 @@ function Vk({ activity: e }) {})]});}-function Hk({ flows: e }) {- let [t, n] = (0, C.useState)(null), r = jk(e);+function Uk({ flows: e }) {+ let [t, n] = (0, C.useState)(null), r = Mk(e);if (!r) return null;let i = t?.node ?? null, a = (e, n) => t ? i === null ? t.label === n : e.source === i || e.target === i : !0;return /* @__PURE__ */ (0, w.jsxs)("section", {- className: Fk,+ className: Ik,children: [- /* @__PURE__ */ (0, w.jsx)(Ik, {+ /* @__PURE__ */ (0, w.jsx)(Lk, {title: "创作者线索来源",figure: (t ? t.value : r.total).toLocaleString(),note: t ? t.label : "条线索"@@ -34136,7 +34196,7 @@ function Hk({ flows: e }) {/* @__PURE__ */ (0, w.jsx)("div", {className: "min-w-0 overflow-x-auto",children: /* @__PURE__ */ (0, w.jsxs)("svg", {- viewBox: `0 0 ${kk.width} ${kk.height}`,+ viewBox: `0 0 ${Ak.width} ${Ak.height}`,fill: "none",role: "img","aria-label": "来源网站与创作者线索",@@ -34150,7 +34210,7 @@ function Hk({ flows: e }) {"aria-label": `${e.label}:${e.value} 条线索`,fillOpacity: 0,strokeOpacity: a(e, e.label) ? .55 : .08,- className: `outline-none transition-opacity ${Nk[e.color]}`,+ className: `outline-none transition-opacity ${Pk[e.color]}`,onPointerEnter: () => n({value: e.value,label: e.label,@@ -34184,15 +34244,15 @@ function Hk({ flows: e }) {width: 10,height: e.height,rx: 5,- className: e.side === "source" ? Pk[e.color] : "fill-text-secondary"+ className: e.side === "source" ? Fk[e.color] : "fill-text-secondary"}), /* @__PURE__ */ (0, w.jsxs)("text", {- x: Ak[e.side],+ x: jk[e.side],y: e.y + e.height / 2,textAnchor: e.side === "source" ? "end" : "start",dominantBaseline: "middle",className: "fill-text-secondary text-caption-1-regular",- children: [Mk(e.name), /* @__PURE__ */ (0, w.jsx)("tspan", {- x: Ak[e.side],+ children: [Nk(e.name), /* @__PURE__ */ (0, w.jsx)("tspan", {+ x: jk[e.side],dy: 15,children: e.side === "source" ? e.value.toLocaleString() : `${e.share.toFixed(1)}%`})]@@ -34209,8 +34269,8 @@ function Hk({ flows: e }) {}//#endregion//#region src/react/taste/taste-page.tsx-var Uk = 10, Wk = K(Yx, Xx, "text-body-2-medium"), Gk = `${oh()} flex flex-col gap-4`, Kk = "rounded-xl bg-background-primary-default p-3", qk = "读取运行 Peach 的这台电脑上的浏览记录", Jk = "导入或读取浏览记录后,这里会列出已采集设备。", Yk = "馆藏里暂时没有对得上浏览信号的标签。", Xk = "采集浏览记录后,这里会显示聚合后的口味证据。", Zk = "这些词在浏览记录中出现,但 Peach 观看记录还没有对应证据", Qk = "在运行 Peach 的电脑上使用浏览器:点上面的「读取浏览器历史」。", $k = "记录在其他设备上:导出文件后,点上面的「导入历史文件」。多台设备的文件分别导入。", eA = "需要刷新时再次读取或导入;数据源可在页面底部移除。", tA = "这个数据源将不再用于口味分析。原始导出文件保留。", nA = "peach-taste-guide-dismissed";-function rA({ icon: e, term: t, figure: n, detail: r, accent: i }) {+var Wk = 10, Gk = K(Yx, Xx, "text-body-2-medium"), Kk = `${oh()} flex flex-col gap-4`, qk = "rounded-xl bg-background-primary-default p-3", Jk = "读取运行 Peach 的这台电脑上的浏览记录", Yk = "导入或读取浏览记录后,这里会列出已采集设备。", Xk = "馆藏里暂时没有对得上浏览信号的标签。", Zk = "采集浏览记录后,这里会显示聚合后的口味证据。", Qk = "这些词在浏览记录中出现,但 Peach 观看记录还没有对应证据", $k = "在运行 Peach 的电脑上使用浏览器:点上面的「读取浏览器历史」。", eA = "记录在其他设备上:导出文件后,点上面的「导入历史文件」。多台设备的文件分别导入。", tA = "需要刷新时再次读取或导入;数据源可在页面底部移除。", nA = "这个数据源将不再用于口味分析。原始导出文件保留。", rA = "peach-taste-guide-dismissed";+function iA({ icon: e, term: t, figure: n, detail: r, accent: i }) {return /* @__PURE__ */ (0, w.jsx)("div", {className: Bx(),children: /* @__PURE__ */ (0, w.jsx)(Hx, {@@ -34222,7 +34282,7 @@ function rA({ icon: e, term: t, figure: n, detail: r, accent: i }) {})});}-function iA({ name: e, domain: t }) {+function aA({ name: e, domain: t }) {return /* @__PURE__ */ (0, w.jsxs)("span", {className: "relative inline-grid size-8 shrink-0 place-items-center overflow-hidden rounded-lg bg-background-tertiary-default text-caption-1-medium text-text-secondary",children: [e.slice(0, 1).toUpperCase(), /* @__PURE__ */ (0, w.jsx)("img", {@@ -34236,22 +34296,22 @@ function iA({ name: e, domain: t }) {})]});}-function aA({ html: e }) {+function oA({ html: e }) {return /* @__PURE__ */ (0, w.jsx)("span", {className: "relative inline-grid size-8 shrink-0 place-items-center overflow-hidden rounded-full bg-background-tertiary-default text-caption-1-medium text-text-secondary [&_img]:absolute [&_img]:inset-0 [&_img]:size-full [&_img]:object-cover",dangerouslySetInnerHTML: { __html: e }});}-function oA({ rows: e, kind: t, visual: n, empty: r, onSignal: i, avatarInner: a }) {+function sA({ rows: e, kind: t, visual: n, empty: r, onSignal: i, avatarInner: a }) {if (!e.length) return /* @__PURE__ */ (0, w.jsx)(ch, {shell: "plain",icon: ip,title: "暂无足够证据",children: r});- let o = vk(e);- return /* @__PURE__ */ (0, w.jsx)(JD, {- previewCount: Uk,+ let o = yk(e);+ return /* @__PURE__ */ (0, w.jsx)(YD, {+ previewCount: Wk,className: "inline-grid w-full gap-x-7 gap-y-2 sm:grid-cols-2",children: e.map((e, r) => {let s = !!t && !!e.peach_items, c = String(e.source_domain || ""), l = /* @__PURE__ */ (0, w.jsxs)(w.Fragment, { children: [@@ -34270,15 +34330,15 @@ function oA({ rows: e, kind: t, visual: n, empty: r, onSignal: i, avatarInner: aclassName: "w-6 shrink-0 text-caption-1-regular tabular-nums text-text-secondary",children: r + 1}),- n === "domain" ? /* @__PURE__ */ (0, w.jsx)(iA, {+ n === "domain" ? /* @__PURE__ */ (0, w.jsx)(aA, {name: e.name,domain: e.name}) : null,- n === "creator" && !e.entity_id && !e.has_avatar && c ? /* @__PURE__ */ (0, w.jsx)(iA, {+ n === "creator" && !e.entity_id && !e.has_avatar && c ? /* @__PURE__ */ (0, w.jsx)(aA, {name: e.name,domain: c}) : null,- n !== "none" && n !== "domain" && (e.entity_id || e.has_avatar || !c) ? /* @__PURE__ */ (0, w.jsx)(aA, { html: a(e.name, e.entity_id ? {+ n !== "none" && n !== "domain" && (e.entity_id || e.has_avatar || !c) ? /* @__PURE__ */ (0, w.jsx)(oA, { html: a(e.name, e.entity_id ? {id: e.entity_id,has_image: !!e.has_image,avatar_focus: e.avatar_focus@@ -34290,7 +34350,7 @@ function oA({ rows: e, kind: t, visual: n, empty: r, onSignal: i, avatarInner: achildren: e.name}), /* @__PURE__ */ (0, w.jsx)("small", {className: "text-caption-1-regular text-text-secondary",- children: _k(e)+ children: vk(e)})]}),s ? /* @__PURE__ */ (0, w.jsx)(Nf, {@@ -34313,7 +34373,7 @@ function oA({ rows: e, kind: t, visual: n, empty: r, onSignal: i, avatarInner: a})});}-function sA({ label: e, panels: t, onSignal: n, avatarInner: r }) {+function cA({ label: e, panels: t, onSignal: n, avatarInner: r }) {return /* @__PURE__ */ (0, w.jsxs)(jy, {className: `${oh({ padding: "none" })} flex flex-col`,children: [/* @__PURE__ */ (0, w.jsx)("div", {@@ -34330,7 +34390,7 @@ function sA({ label: e, panels: t, onSignal: n, avatarInner: r }) {}), t.map((e) => /* @__PURE__ */ (0, w.jsx)(Iy, {id: e.id,className: "px-4 pt-3.5 pb-4",- children: /* @__PURE__ */ (0, w.jsx)(oA, {+ children: /* @__PURE__ */ (0, w.jsx)(sA, {...e.props,onSignal: n,avatarInner: r@@ -34338,7 +34398,7 @@ function sA({ label: e, panels: t, onSignal: n, avatarInner: r }) {}, e.id))]});}-function cA({ data: e, onSignal: t, navigate: n }) {+function lA({ data: e, onSignal: t, navigate: n }) {let r = e.analysis;if (!r?.headline) return null;let i = r.confidence || {}, a = [...(r.explore || []).map((e) => ({@@ -34353,7 +34413,7 @@ function cA({ data: e, onSignal: t, navigate: n }) {act: () => n(e.route)}))];return /* @__PURE__ */ (0, w.jsxs)("section", {- className: Gk,+ className: Kk,"aria-label": "口味总结",children: [/* @__PURE__ */ (0, w.jsxs)("header", {@@ -34379,7 +34439,7 @@ function cA({ data: e, onSignal: t, navigate: n }) {r.points?.length ? /* @__PURE__ */ (0, w.jsx)("div", {className: "inline-grid w-full gap-3 sm:grid-cols-2",children: r.points.map((e) => /* @__PURE__ */ (0, w.jsxs)("div", {- className: `flex min-w-0 flex-col gap-1 ${Kk}`,+ className: `flex min-w-0 flex-col gap-1 ${qk}`,children: [/* @__PURE__ */ (0, w.jsx)("span", {className: "text-caption-1-regular text-text-secondary",children: e.label@@ -34394,7 +34454,7 @@ function cA({ data: e, onSignal: t, navigate: n }) {children: a.map((e) => /* @__PURE__ */ (0, w.jsxs)("button", {type: "button",onClick: e.act,- className: `flex w-full min-w-0 cursor-pointer items-center gap-3 ${Kk} text-left outline-none hover:bg-background-primary-hover focus-visible:ring-2 focus-visible:ring-border-focus-ring`,+ className: `flex w-full min-w-0 cursor-pointer items-center gap-3 ${qk} text-left outline-none hover:bg-background-primary-hover focus-visible:ring-2 focus-visible:ring-border-focus-ring`,children: [/* @__PURE__ */ (0, w.jsxs)("span", {className: "flex min-w-0 grow flex-col gap-1",children: [/* @__PURE__ */ (0, w.jsx)("b", {@@ -34413,15 +34473,15 @@ function cA({ data: e, onSignal: t, navigate: n }) {shell: "plain",icon: ip,title: "还没有可探索的入口",- children: Yk+ children: Xk})]});}-function lA({ onboarding: e, done: t }) {+function uA({ onboarding: e, done: t }) {let [n, r] = (0, C.useState)(() => {try {- return localStorage.getItem(nA) === "1";+ return localStorage.getItem(rA) === "1";} catch {return !1;}@@ -34437,11 +34497,11 @@ function lA({ onboarding: e, done: t }) {children: [/* @__PURE__ */ (0, w.jsx)("p", {className: "text-body-2-regular text-text-secondary",- children: Qk+ children: $k}),/* @__PURE__ */ (0, w.jsx)("p", {className: "text-body-2-regular text-text-secondary",- children: $k+ children: eA}),/* @__PURE__ */ (0, w.jsxs)("ul", {className: "flex list-disc flex-col gap-1 pl-5 text-body-2-regular text-text-secondary",@@ -34471,7 +34531,7 @@ function lA({ onboarding: e, done: t }) {}),/* @__PURE__ */ (0, w.jsx)("p", {className: "text-body-2-regular text-text-secondary",- children: eA+ children: tA}),/* @__PURE__ */ (0, w.jsx)("span", {className: "self-start",@@ -34480,7 +34540,7 @@ function lA({ onboarding: e, done: t }) {size: "small",onClick: () => {try {- localStorage.setItem(nA, "1");+ localStorage.setItem(rA, "1");} catch {}r(!0);},@@ -34491,7 +34551,7 @@ function lA({ onboarding: e, done: t }) {})});}-function uA({ busy: e, onRefresh: t, onImport: n }) {+function dA({ busy: e, onRefresh: t, onImport: n }) {let r = (0, C.useRef)(null), [i, a] = (0, C.useState)(!1), o = (e) => {a(!1), e();};@@ -34501,7 +34561,7 @@ function uA({ busy: e, onRefresh: t, onImport: n }) {"data-variant": "primary",children: [/* @__PURE__ */ (0, w.jsx)(X, {leadingIcon: zf,- title: qk,+ title: Jk,onClick: t,...Z(e),children: "读取浏览器历史"@@ -34526,7 +34586,7 @@ function uA({ busy: e, onRefresh: t, onImport: n }) {className: "flex w-52 flex-col gap-1 outline-none",children: [/* @__PURE__ */ (0, w.jsxs)("button", {type: "button",- className: Wk,+ className: Gk,onClick: () => o(t),children: [/* @__PURE__ */ (0, w.jsx)(zf, {"aria-hidden": !0,@@ -34534,7 +34594,7 @@ function uA({ busy: e, onRefresh: t, onImport: n }) {}), "读取浏览器历史"]}), /* @__PURE__ */ (0, w.jsxs)("button", {type: "button",- className: Wk,+ className: Gk,onClick: () => o(n),children: [/* @__PURE__ */ (0, w.jsx)(cp, {"aria-hidden": !0,@@ -34544,15 +34604,15 @@ function uA({ busy: e, onRefresh: t, onImport: n }) {})})] });}-function dA({ sources: e, window: t, toast: n }) {+function fA({ sources: e, window: t, toast: n }) {let r = dt({- mutationFn: (e) => lk(e, t),+ mutationFn: (e) => uk(e, t),onSuccess: (e) => {- fh.setQueryData(nk(t), e.dashboard), n("已移除口味数据源");+ fh.setQueryData(rk(t), e.dashboard), n("已移除口味数据源");}});return /* @__PURE__ */ (0, w.jsxs)("section", {- className: Gk,+ className: Kk,"aria-label": "数据源",children: [/* @__PURE__ */ (0, w.jsx)("h3", {@@ -34566,7 +34626,7 @@ function dA({ sources: e, window: t, toast: n }) {e.length ? /* @__PURE__ */ (0, w.jsx)("div", {className: "inline-grid w-full gap-2 sm:grid-cols-2",children: e.map((e) => /* @__PURE__ */ (0, w.jsxs)("div", {- className: `flex min-w-0 items-center gap-3 ${Kk}`,+ className: `flex min-w-0 items-center gap-3 ${qk}`,children: [/* @__PURE__ */ (0, w.jsx)("span", {className: "inline-grid size-8 shrink-0 place-items-center rounded-lg text-text-secondary",@@ -34598,7 +34658,7 @@ function dA({ sources: e, window: t, toast: n }) {onClick: () => {r.isPending || c({title: "移除口味数据源",- body: tA,+ body: nA,confirmLabel: "移除口味数据源",onConfirm: () => r.mutateAsync(e.source_key)});@@ -34610,29 +34670,29 @@ function dA({ sources: e, window: t, toast: n }) {shell: "plain",icon: Bf,title: "还没有数据源",- children: Jk+ children: Yk})]});}-function fA(e) {+function pA(e) {let { onSignal: t, navigate: r, toast: i, avatarInner: a, onboarding: o } = e, [s, c] = (0, C.useState)("all"), [l, u] = (0, C.useState)("browser"), [d, f] = (0, C.useState)(!1), [p, m] = (0, C.useState)(null), h = (0, C.useRef)(null), g = ut({- queryKey: nk(s),- queryFn: ({ signal: e }) => ak(s, e),+ queryKey: rk(s),+ queryFn: ({ signal: e }) => ok(s, e),placeholderData: L}), _ = ut({- queryKey: rk,- queryFn: ({ signal: e }) => ok(e),- refetchInterval: (e) => pk(e.state.data)+ queryKey: ik,+ queryFn: ({ signal: e }) => sk(e),+ refetchInterval: (e) => mk(e.state.data)}), v = dt({- mutationFn: () => ck(s),+ mutationFn: () => lk(s),onSuccess: () => {- f(!0), m(null), fh.invalidateQueries({ queryKey: rk });+ f(!0), m(null), fh.invalidateQueries({ queryKey: ik });}}), y = dt({- mutationFn: (e) => uk(e),+ mutationFn: (e) => dk(e),onSuccess: (e) => {- fh.setQueryData(nk("all"), e.dashboard), c("all"), i("已导入口味数据");+ fh.setQueryData(rk("all"), e.dashboard), c("all"), i("已导入口味数据");}}), b = _.data?.status === "running";(0, C.useEffect)(() => {@@ -34690,12 +34750,12 @@ function fA(e) {onSelectionChange: (e) => {e !== null && c(String(e));},- children: ik.map(([e, t]) => /* @__PURE__ */ (0, w.jsx)(Cw, {+ children: ak.map(([e, t]) => /* @__PURE__ */ (0, w.jsx)(Cw, {id: e,children: t}, e))}),- /* @__PURE__ */ (0, w.jsx)(uA, {+ /* @__PURE__ */ (0, w.jsx)(dA, {busy: b || v.isPending || y.isPending,onRefresh: S,onImport: () => h.current?.click()@@ -34711,7 +34771,7 @@ function fA(e) {]})]}),- /* @__PURE__ */ (0, w.jsx)(lA, {+ /* @__PURE__ */ (0, w.jsx)(uA, {onboarding: o,done: !!(E.history_sources || T.updated_at)}),@@ -34744,27 +34804,27 @@ function fA(e) {/* @__PURE__ */ (0, w.jsxs)("div", {className: Vx,children: [- /* @__PURE__ */ (0, w.jsx)(rA, {+ /* @__PURE__ */ (0, w.jsx)(iA, {accent: 0,icon: Jf,term: "浏览记录",figure: Number(E.history_visits || 0).toLocaleString(),- detail: `${E.history_sources || 0} 个数据源 · ${mk(E.range_start)}—${mk(E.range_end)}`+ detail: `${E.history_sources || 0} 个数据源 · ${hk(E.range_start)}—${hk(E.range_end)}`}),- /* @__PURE__ */ (0, w.jsx)(rA, {+ /* @__PURE__ */ (0, w.jsx)(iA, {accent: 1,icon: tp,term: "口味维度",figure: A.length.toLocaleString(),detail: A[0]?.name || "尚无主维度"}),- /* @__PURE__ */ (0, w.jsx)(rA, {+ /* @__PURE__ */ (0, w.jsx)(iA, {accent: 2,icon: ip,term: "浏览候选",figure: j.length.toLocaleString()}),- /* @__PURE__ */ (0, w.jsx)(rA, {+ /* @__PURE__ */ (0, w.jsx)(iA, {accent: 3,icon: Bf,term: "私有导出",@@ -34774,7 +34834,7 @@ function fA(e) {]}),/* @__PURE__ */ (0, w.jsxs)("section", {- className: `${Gk} md:flex-row md:gap-6`,+ className: `${Kk} md:flex-row md:gap-6`,"aria-label": "浏览器画像",children: [/* @__PURE__ */ (0, w.jsxs)("div", {className: "flex shrink-0 flex-col gap-2 pb-5 md:w-72 md:pr-6 md:pb-0",@@ -34783,31 +34843,31 @@ function fA(e) {className: "text-caption-1-regular text-text-secondary",children: "浏览器画像"}),- /* @__PURE__ */ (0, w.jsx)(Lk, {+ /* @__PURE__ */ (0, w.jsx)(Rk, {rows: A,label: "主要口味维度"}),/* @__PURE__ */ (0, w.jsx)("small", {className: "text-caption-1-regular text-text-secondary",- children: T.updated_at ? `更新于 ${mk(T.updated_at)}` : "尚未采集浏览记录"+ children: T.updated_at ? `更新于 ${hk(T.updated_at)}` : "尚未采集浏览记录"})]}), /* @__PURE__ */ (0, w.jsx)("div", {className: "min-w-0 grow",- children: A.length ? /* @__PURE__ */ (0, w.jsx)(Rk, {+ children: A.length ? /* @__PURE__ */ (0, w.jsx)(zk, {rows: A,label: "口味维度排名"}) : /* @__PURE__ */ (0, w.jsx)(ch, {shell: "plain",icon: ip,title: "暂无口味维度",- children: Xk+ children: Zk})})]}),- /* @__PURE__ */ (0, w.jsx)(Vk, { activity: T.activity }),- /* @__PURE__ */ (0, w.jsx)(Hk, { flows: T.creator_flows }),- /* @__PURE__ */ (0, w.jsx)(sA, {+ /* @__PURE__ */ (0, w.jsx)(Hk, { activity: T.activity }),+ /* @__PURE__ */ (0, w.jsx)(Uk, { flows: T.creator_flows }),+ /* @__PURE__ */ (0, w.jsx)(cA, {label: "浏览器口味维度",onSignal: t,avatarInner: a,@@ -34849,7 +34909,7 @@ function fA(e) {rows: j,kind: "",visual: "none",- empty: Zk+ empty: Qk}}]@@ -34863,26 +34923,26 @@ function fA(e) {/* @__PURE__ */ (0, w.jsxs)("div", {className: Vx,children: [- /* @__PURE__ */ (0, w.jsx)(rA, {+ /* @__PURE__ */ (0, w.jsx)(iA, {accent: 0,icon: Wf,term: "Peach 看过",figure: Number(E.peach_items || 0).toLocaleString(),- detail: hk(E.peach_seconds || 0)+ detail: gk(E.peach_seconds || 0)}),- /* @__PURE__ */ (0, w.jsx)(rA, {+ /* @__PURE__ */ (0, w.jsx)(iA, {accent: 1,icon: sp,term: "喜欢",figure: Number(E.liked || 0).toLocaleString()}),- /* @__PURE__ */ (0, w.jsx)(rA, {+ /* @__PURE__ */ (0, w.jsx)(iA, {accent: 2,icon: op,term: "不合口味",figure: Number(E.disliked || 0).toLocaleString()}),- /* @__PURE__ */ (0, w.jsx)(rA, {+ /* @__PURE__ */ (0, w.jsx)(iA, {accent: 3,icon: tp,term: "有标签",@@ -34891,7 +34951,7 @@ function fA(e) {]}),/* @__PURE__ */ (0, w.jsxs)("section", {- className: `${Gk} md:flex-row md:gap-6`,+ className: `${Kk} md:flex-row md:gap-6`,"aria-label": "Peach 观看",children: [/* @__PURE__ */ (0, w.jsxs)("div", {className: "flex shrink-0 flex-col gap-0.5 pb-5 md:w-72 md:pr-6 md:pb-0",@@ -34911,18 +34971,18 @@ function fA(e) {]}), /* @__PURE__ */ (0, w.jsxs)("div", {className: "flex min-w-0 grow flex-col",- children: [/* @__PURE__ */ (0, w.jsx)(pA, {+ children: [/* @__PURE__ */ (0, w.jsx)(mA, {term: "有标签",value: M,rest: D.untagged || 0- }), /* @__PURE__ */ (0, w.jsx)(pA, {+ }), /* @__PURE__ */ (0, w.jsx)(mA, {term: "有身份",value: N,rest: D.unidentified || 0})]})]}),- /* @__PURE__ */ (0, w.jsx)(sA, {+ /* @__PURE__ */ (0, w.jsx)(cA, {label: "Peach 口味维度",onSignal: t,avatarInner: a,@@ -34963,19 +35023,19 @@ function fA(e) {})]}),- /* @__PURE__ */ (0, w.jsx)(cA, {+ /* @__PURE__ */ (0, w.jsx)(lA, {data: T,onSignal: t,navigate: r}),- /* @__PURE__ */ (0, w.jsx)(dA, {+ /* @__PURE__ */ (0, w.jsx)(fA, {sources: T.sources || [],window: s,toast: i})] });}-function pA({ term: e, value: t, rest: n }) {+function mA({ term: e, value: t, rest: n }) {let r = Math.max(t + n, 1);return /* @__PURE__ */ (0, w.jsxs)("div", {className: "flex flex-col gap-1.5 border-b border-separator-border py-3 last:border-b-0",@@ -34997,16 +35057,16 @@ function pA({ term: e, value: t, rest: n }) {}//#endregion//#region src/react/entry.tsx-var mA = null;-function hA() {- return mA?.isConnected || (mA = document.createElement("div"), mA.className = "peach-react", mA.dataset.reactOverlays = "", document.body.append(mA)), mA;+var hA = null;+function gA() {+ return hA?.isConnected || (hA = document.createElement("div"), hA.className = "peach-react", hA.dataset.reactOverlays = "", document.body.append(hA)), hA;}-function gA(e) {+function _A(e) {return (t, n) => {let r = (0, Of.createRoot)(t), i = (t) => r.render(/* @__PURE__ */ (0, w.jsx)(D, {client: fh,children: /* @__PURE__ */ (0, w.jsx)(bc, {- getContainer: hA,+ getContainer: gA,children: /* @__PURE__ */ (0, w.jsx)(e, { ...t })})}));@@ -35016,47 +35076,47 @@ function gA(e) {};};}-var _A = {+var vA = {activity: {prefetch: (e, t) => yh(t),- mount: gA(Ph)+ mount: _A(Ph)},"avatar-picker": {prefetch: async () => {},- mount: gA(fb)+ mount: _A(fb)},configuration: {prefetch: (e, t) => HE(t),- mount: gA(ID)+ mount: _A(LD)},"follow-manage": {prefetch: (e, t) => Sx(t),- mount: gA(Iw)+ mount: _A(Iw)},"library-processing": {prefetch: (e, t) => Bw(t),- mount: gA((e) => e.mode === "notice" ? /* @__PURE__ */ (0, w.jsx)(fT, { ...e }) : /* @__PURE__ */ (0, w.jsx)(cT, { ...e }))+ mount: _A((e) => e.mode === "notice" ? /* @__PURE__ */ (0, w.jsx)(fT, { ...e }) : /* @__PURE__ */ (0, w.jsx)(cT, { ...e }))},"quality-goals": {prefetch: (e, t) => gT(t),- mount: gA(yT)+ mount: _A(yT)},review: {prefetch: (e, t) => YT(t),- mount: gA(bE)+ mount: _A(bE)},scraping: {prefetch: (e, t) => AE(t),- mount: gA(LE)+ mount: _A(LE)},stats: {- prefetch: (e, t) => BD(t),- mount: gA(vO)+ prefetch: (e, t) => VD(t),+ mount: _A(yO)},taste: {- prefetch: (e, t) => sk("all", t),- mount: gA(fA)+ prefetch: (e, t) => ck("all", t),+ mount: _A(pA)}};//#endregion-export { _A as pages };+export { vA as pages };