Skip to content

armgit / peach

Public Imported from GitHub
0

Peach: Local-first video metadata scraper and media manager.

fix(library): 扫描后落库并修正首次设置

longmeidao0b2e7a0ffc4e
diff --git a/docs/BOARD_UI.md b/docs/BOARD_UI.md
index fe2ecd78a..0cdc10ef4 100644
--- a/docs/BOARD_UI.md
+++ b/docs/BOARD_UI.md
@@ -322,12 +322,22 @@ Radio card 沿用 2026-09-08 取得的 `r/checkbox-card.json`(`checkbox-card.t
## 首次设置 Auth Card
Button 取证(2026-09-10):对照官网 `/components/button` 与保存的
-`board-reference/button.json`。选择文件夹为 medium 纯图标 secondary,添加媒体库为
-带前置图标的 secondary,完成设置为 primary;高度 36px、图标 20px、圆角 10px。
+`board-reference/button.json`。选择文件夹为纯图标 secondary,添加媒体库为带前置图标的
+secondary,完成设置为 primary;标准按钮高度 36px、图标 20px、圆角 10px。
主按钮渐变使用官网实测色值;按下缩放至 0.98,
按下 220ms、释放 420ms,曲线为 `cubic-bezier(.4,0,.2,1)`,减少动态效果时关闭。
按钮保留原动作、键盘焦点、忙态防重复与禁用语义,不写入预览配置。
+媒体库路径行的选择与移除按钮主动采用 40×40px,与相邻 40px 输入框等高;这是组合输入
+对齐需要的局部差异,不改变页面底部「完成设置」的 36px Board primary。访问密码使用
+Board Switch medium:42×24px 轨道、18px 滑块,关闭时密码输入区域不渲染为可见控件。
+媒体库、访问密码、高级设置、完成设置后的选项以 24px 上下留白和 1px `separator` 横线分组;
+密码组内标签到输入框 6px,两项密码之间 16px。浏览器历史记录作为完成设置后的独立子组,
+同样以横线分隔。
+一级分类标题统一为 14/20、600、主文字色;分类内字段标签统一为 14/20、500、次级文字色;
+辅助说明统一为 12/18、弱文字色。「浏览器历史记录」是「完成设置后」的二级标题,用
+14/20、500,不与一级分类争夺层级。
+
纠正(2026-09-12):这一段此处一度记过「上游 primary 没有悬停态」,同日取到规则原文后作废。
当时那三条证据全落在同一个盲点上——悬停那一层挂在伪元素上。① 读 `className` 看不到:悬停
不是 Tailwind 的 `hover:` 类,写在样式表里;② 真鼠标悬停读 computed 也看不到:读的是元素
diff --git a/frontend/src/react/entry.tsx b/frontend/src/react/entry.tsx
index 037759e6e..6818f6ee3 100644
--- a/frontend/src/react/entry.tsx
+++ b/frontend/src/react/entry.tsx
@@ -90,10 +90,9 @@ export const pages: Bundle.ReactPages = {
'quality-goals': {
prefetch: (_props, signal) => prefetchQualityGoals(signal), mount: mounter(QualityGoalsPage),
},
- /* 确定的那部分先落库再取队列(ADR-0018)。只读账本上不发那一次 POST——reader 明知
- 不能写就不该制造一次 409。 */
+ /* ADR-0018 的确定项已由扫描与资料处理任务落库;复核页只读取剩下的判断题。 */
review: {
- prefetch: (props, signal) => prefetchReview(props.readOnly, signal), mount: mounter(ReviewPage),
+ prefetch: (_props, signal) => prefetchReview(signal), mount: mounter(ReviewPage),
},
scraping: { prefetch: (_props, signal) => prefetchScraping(signal), mount: mounter(ScrapingPage) },
stats: { prefetch: (_props, signal) => prefetchStats(signal), mount: mounter(StatsPage) },
diff --git a/frontend/src/react/library-processing/library-processing-card.tsx b/frontend/src/react/library-processing/library-processing-card.tsx
index 2e8da3d42..c36c7f41c 100644
--- a/frontend/src/react/library-processing/library-processing-card.tsx
+++ b/frontend/src/react/library-processing/library-processing-card.tsx
@@ -48,7 +48,7 @@ const CARD_TEXT = '扫描媒体文件夹,导入已有资料,采集缺失信
const STALLED_TEXT = '这个项目处理时间较长,暂时没有新进展。可以继续等待,或在任务结束后重试未完成项。';
const receiptText = (state: LibraryProcessingData) =>
`已扫描 ${state.scanned || 0} 个文件,识别 ${state.identified || 0} 个番号,`
- + `整理 ${state.candidates || 0} 组资料候选。`;
+ + `整理 ${state.candidates || 0} 组资料候选,自动落库 ${state.auto_applied || 0} 条。`;
/** 主键加一个下拉:三种方式改的是同一件事,摊成三颗按钮读不出哪个是常用的那一个。
*
diff --git a/frontend/src/react/library-processing/library-processing.ts b/frontend/src/react/library-processing/library-processing.ts
index 4baf6e5e9..736164bd2 100644
--- a/frontend/src/react/library-processing/library-processing.ts
+++ b/frontend/src/react/library-processing/library-processing.ts
@@ -32,6 +32,7 @@ export interface LibraryProcessingData {
scanned?: number;
identified?: number;
candidates?: number;
+ auto_applied?: number;
covers?: number;
error?: string;
issue_count?: number;
@@ -155,5 +156,5 @@ export function announceCompletion(
if (state.job_id) localStorage.setItem(ANNOUNCED_KEY, state.job_id);
} catch { /* 存储不可用时照常提示,最多重复一次 */ }
toast(`扫描与资料采集已完成:识别 ${state.identified || 0} 个番号,`
- + `整理 ${state.candidates || 0} 组资料候选`);
+ + `整理 ${state.candidates || 0} 组资料候选,自动落库 ${state.auto_applied || 0} 条`);
}
diff --git a/frontend/src/react/review/review-page.tsx b/frontend/src/react/review/review-page.tsx
index 1a2618c6c..4e7eb308d 100644
--- a/frontend/src/react/review/review-page.tsx
+++ b/frontend/src/react/review/review-page.tsx
@@ -1,8 +1,7 @@
/* 人工复核页:把带出处的候选摆到人面前,等一次明确的批准或否决。
*
- * 进页面先落库再取队列(ADR-0018):能直接补空的那部分不该占着人的注意力,剩下的才是
- * 题。落库没有按钮,所以它的回执必须画在页面上——只写控制台的话,用户看到的只有一条
- * 不见少的队列,无从知道这一步到底有没有发生。
+ * ADR-0018 的确定项在扫描与资料处理任务结束时已经落库;这一页只读取剩下的判断题,
+ * 打开页面不会再触发一次写操作。
*
* 地址栏与组件状态的分界(ADR-0031「迁移桥接」):
* - `category` 在地址栏上。十个分类是固定的一组身份,「在看哪一条队列」链接得过来,
@@ -25,13 +24,11 @@ import { Page } from '../components/page';
import { BulkToolbar } from './bulk-toolbar';
import { GenreTagList } from './candidate-form';
import { ReviewCard } from './review-card';
-import type {
- AutoApplyResult, DecisionStatus, ReviewCategory, ReviewData, ReviewGrouping, ReviewRow, RowChoice,
-} from './review';
+import type { DecisionStatus, ReviewCategory, ReviewData, ReviewGrouping, ReviewRow, RowChoice } from './review';
import {
- autoApplyReceipt, canApprove, DEFAULT_CATEGORY, decisionPayload, decisionReceipt, defaultChoice,
+ canApprove, DEFAULT_CATEGORY, decisionPayload, decisionReceipt, defaultChoice,
dropReviewRows, fetchReview, filterReviewRows, groupReviewRows, isReviewCategory, mirrorText,
- REVIEW_AUTO_APPLY_KEY, REVIEW_CATEGORIES, REVIEW_KEY, REVIEW_LABELS, reviewGroupingOptions,
+ REVIEW_CATEGORIES, REVIEW_KEY, REVIEW_LABELS, reviewGroupingOptions,
reviewWindow, selectReviewRange, submitDecision,
} from './review';
@@ -66,22 +63,6 @@ function Pagination(
);
}
-/** 自动落库的回执。一条都没落下时也要说一句:否则「它到底跑没跑」只能靠数队列长度猜,
- * 而队列本来就不见得会变短。只读账本上这一步根本没发生,那句话由门禁说,这里不出。 */
-function AutoApplyNote({ receipt }: { receipt: AutoApplyResult | undefined }) {
- if (!receipt || receipt.state === 'skipped') return null;
- if (receipt.state === 'failed') {
- return <Note tone="warning" title="自动落库">{`自动落库这一步没能执行:${receipt.error}`}</Note>;
- }
- return (
- <Note tone={receipt.applied ? 'success' : 'neutral'} title="自动落库">
- {receipt.applied
- ? `${receipt.applied} 条候选补进了空字段,已从下面的队列里移走。`
- : '这一批候选没有可以直接补空的:字段已有值、几家来源给的值不一样,或者番号和文件名对不上,都要人来判。'}
- </Note>
- );
-}
-
export function ReviewPage(props: ReviewProps) {
const {
route, openItem, openEntity, revealSource, avatarInner, toast,
@@ -106,11 +87,6 @@ export function ReviewPage(props: ReviewProps) {
useEffect(() => () => { alive.current = false }, []);
const review = useQuery({ queryKey: REVIEW_KEY, queryFn: ({ signal }) => fetchReview(signal) });
- /* 回执由 `prefetchReview` 在进页面那一刻写进缓存。这一步没有按钮,重新挂载也不该再
- POST 一次,所以只订阅、不取数;订阅本身是必要的——没有观察者的那一份会被回收掉。 */
- const auto = useQuery({
- queryKey: REVIEW_AUTO_APPLY_KEY, queryFn: () => autoApplyReceipt(), enabled: false,
- });
const data: ReviewData = review.data || { sections: {}, counts: {} };
const queue = data.sections[category] || [];
@@ -256,7 +232,6 @@ export function ReviewPage(props: ReviewProps) {
{mirror}
</Note>
) : null}
- <AutoApplyNote receipt={auto.data} />
<GenreTagList tags={genreTags} />
{/* 分类列钉在正文右边,跟着页面滚;窄到放不下两列时并回正文上方排成一行药丸。 */}
diff --git a/frontend/src/react/review/review.ts b/frontend/src/react/review/review.ts
index 066280f3c..e87428e74 100644
--- a/frontend/src/react/review/review.ts
+++ b/frontend/src/react/review/review.ts
@@ -1,32 +1,25 @@
-/* 人工复核页的数据契约、分组分页纯函数与写操作。四条端点在 `frontend/src` 里都只在这里
+/* 人工复核页的数据契约、分组分页纯函数与写操作。三条端点在 `frontend/src` 里都只在这里
* 声明一次(`tests/test_frontend_build.py` 盯着)。
*
- * 这一页有两份节律不同的真相,所以有两个键:
- * - `['review']` 是整条复核队列。接口一次给出全部分类(实测 4.6 MB、1300 行,本机读
+ * `['review']` 是整条复核队列。接口一次给出全部分类(实测 4.6 MB、1300 行,本机读
* 0.1 秒),十个分类合在一个响应里,所以也只用一个 `queryKey`:分类切换是翻这一份的
* 不同段落,不是另一份真相。判定写回来时只把那几行从缓存里摘掉(`dropReviewRows`),
* 不为一次判定把整条队列重取一遍。
- * - `['review','auto-apply']` 是进页面那一刻自动落库的回执(ADR-0018)。它由
- * `prefetchReview` 写一次,说的是「本次进入做了什么」,不是账本此刻的样子;和队列
- * 合成一个键的话,收录一个 genre 之后重取队列会把这句回执一起变成新的。
*
* 分组、筛选、分页都是纯函数:工具条上的计数说的是整条队列,卡片只画当前这一页,两边
* 用同一套判据算,各写一份迟早对不上。 */
-import { apiGet, apiSend, errorMessage } from '../../api';
+import { apiGet, apiSend } from '../../api';
import { clampPage, pageCount } from '../../pagination';
import { selectRange } from '../../selection';
import { queryClient } from '../query';
import { localTime } from '../time';
export const REVIEW_URL = '/api/review';
-export const REVIEW_AUTO_APPLY_URL = '/api/review/auto-apply';
export const REVIEW_DECISION_URL = '/api/review/decision';
export const REVIEW_GENRE_URL = '/api/review/genre';
/** 整条复核队列。 */
export const REVIEW_KEY = ['review'] as const;
-/** 本次进入时自动落库的回执。 */
-export const REVIEW_AUTO_APPLY_KEY = ['review', 'auto-apply'] as const;
/** 复核分类与它们在界面上的名字。次序就是页签次序。 */
export const REVIEW_LABELS = {
@@ -151,13 +144,6 @@ export interface ReviewData {
mirror?: ReviewMirror | null;
}
-/** 自动落库这一步的三种结局。它没有按钮,进页面就跑完了,所以回执必须画在页面上:
- * 只写控制台的话,用户看到的只有一条不见少的队列。 */
-export type AutoApplyResult =
- | { state: 'applied'; applied: number }
- | { state: 'failed'; error: string }
- | { state: 'skipped' };
-
/* ── 分组、筛选、分页 ── */
export type ReviewGrouping = 'candidates' | 'source' | 'field';
@@ -325,26 +311,8 @@ export const submitDecision = (payload: Record<string, unknown>) =>
export const recordGenre = (genre: string, tag: string) =>
apiSend<DecisionResult>(REVIEW_GENRE_URL, { genre, tag });
-/** 落库一次并把回执收成页面数据(ADR-0018:确定的那部分先落库再取队列)。
- *
- * `prefetchReview` 是唯一的调用者——这一步没有按钮,进页面就跑完了,所以组件那边
- * `enabled: false`,只读它写进缓存的那一份,不会在挂载时再 POST 一次。 */
-export async function autoApplyReceipt(signal?: AbortSignal): Promise<AutoApplyResult> {
- try {
- const result = await apiSend<{ applied?: number }>(REVIEW_AUTO_APPLY_URL, {}, 'POST', signal);
- return { state: 'applied', applied: Number(result?.applied || 0) };
- } catch (cause) {
- if (signal?.aborted) throw cause;
- return { state: 'failed', error: errorMessage(cause) };
- }
-}
-
-/** 首屏:先落库、再取队列。
- *
- * 只读账本上不发那一次 POST——reader 明知不能写就不该制造一次 409,回执写成「跳过」。 */
-export async function prefetchReview(readOnly: boolean, signal: AbortSignal): Promise<void> {
- const receipt: AutoApplyResult = readOnly ? { state: 'skipped' } : await autoApplyReceipt(signal);
- queryClient.setQueryData<AutoApplyResult>(REVIEW_AUTO_APPLY_KEY, receipt);
+/** 首屏只读复核队列。符合 ADR-0018 的候选已在扫描与资料处理结束时落库。 */
+export async function prefetchReview(signal: AbortSignal): Promise<void> {
await queryClient.fetchQuery({ queryKey: REVIEW_KEY, queryFn: () => fetchReview(signal) });
}
diff --git a/frontend/test/react/library-processing.test.tsx b/frontend/test/react/library-processing.test.tsx
index 5b21973d8..5a68fbd85 100644
--- a/frontend/test/react/library-processing.test.tsx
+++ b/frontend/test/react/library-processing.test.tsx
@@ -115,7 +115,8 @@ it('启动只提交一次,进度用 GET 读回来,完成后给出回执与
expect(toast).toHaveBeenCalledTimes(1);
const receipt = host.querySelector('[role="status"]');
expect(receipt?.textContent).toContain('处理完成');
- expect(receipt?.textContent).toContain('已扫描 9 个文件,识别 4 个番号,整理 2 组资料候选。');
+ expect(receipt?.textContent).toContain(
+ '已扫描 9 个文件,识别 4 个番号,整理 2 组资料候选,自动落库 0 条。');
});
it('首屏读到的上一趟终态不冒充这一次的回执', async () => {
@@ -245,7 +246,8 @@ it('刚结束的任务横幅第一次读到也报,同一个任务号只报一
await mounted.unmount();
}
expect(toast).toHaveBeenCalledTimes(1);
- expect(toast).toHaveBeenNthCalledWith(1, '扫描与资料采集已完成:识别 3 个番号,整理 2 组资料候选');
+ expect(toast).toHaveBeenNthCalledWith(
+ 1, '扫描与资料采集已完成:识别 3 个番号,整理 2 组资料候选,自动落库 0 条');
});
it('两个容器读同一趟任务:一个周期只问一次,撤掉一个另一个照常', async () => {
diff --git a/frontend/test/react/review.test.tsx b/frontend/test/react/review.test.tsx
index dedcdf515..b769d1221 100644
--- a/frontend/test/react/review.test.tsx
+++ b/frontend/test/react/review.test.tsx
@@ -9,8 +9,8 @@ import { afterEach, expect, it, vi } from 'vitest';
import { queryClient } from '../../src/react/query';
import {
- commonReviewSources, filterReviewRows, groupReviewRows, prefetchReview, REVIEW_AUTO_APPLY_URL,
- REVIEW_DECISION_URL, REVIEW_KEY, REVIEW_PAGE_SIZE, REVIEW_URL, reviewGroupingOptions,
+ commonReviewSources, filterReviewRows, groupReviewRows, prefetchReview, REVIEW_DECISION_URL,
+ REVIEW_KEY, REVIEW_PAGE_SIZE, REVIEW_URL, reviewGroupingOptions,
reviewWindow, type ReviewCandidate, type ReviewData, type ReviewRow,
} from '../../src/react/review/review';
import { ReviewPage } from '../../src/react/review/review-page';
@@ -53,8 +53,6 @@ const ok = (body: unknown) => ({ ok: true, status: 200, json: async () => body }
interface Plan {
data?: ReviewData;
- /** 自动落库这一趟的结局:给数就是落了几条,给 Error 就是这一步没能执行。 */
- applied?: number | Error;
/** 判定的回答:给一串就按顺序一条一条回(最后一条之后一直回它)。 */
decisions?: { ok: boolean; error?: string }[];
}
@@ -63,10 +61,6 @@ function serve(plan: Plan = {}) {
const decisions = [...(plan.decisions ?? [{ ok: true }])];
const fetcher = vi.fn(async (input: string) => {
const url = String(input);
- if (url === REVIEW_AUTO_APPLY_URL) {
- if (plan.applied instanceof Error) throw plan.applied;
- return ok({ applied: plan.applied ?? 0 });
- }
if (url === REVIEW_DECISION_URL) {
return ok(decisions.length > 1 ? decisions.shift()! : decisions[0]!);
}
@@ -93,11 +87,11 @@ const shellProps = (over: Partial<Props> = {}): Props => ({
...over,
});
-/** 走完真实的首屏路径:先落库再取队列,然后挂载。 */
+/** 走完真实的首屏路径:只取队列,然后挂载。 */
async function open(plan: Plan = {}, over: Partial<Props> = {}) {
const fetcher = serve(plan);
const props = shellProps(over);
- await prefetchReview(!!props.readOnly, new AbortController().signal).catch(() => {});
+ await prefetchReview(new AbortController().signal).catch(() => {});
const mounted = await mountRoot(
<QueryClientProvider client={queryClient}><ReviewPage {...props} /></QueryClientProvider>);
await settle();
@@ -226,11 +220,11 @@ it('多来源候选没选来源就批量通过时先说清楚,不替人按下
expect(queueOf().sections.metadata_fields).toHaveLength(QUEUE.length);
});
-it('只读账本上不发自动落库,判定与批量都不给点', async () => {
+it('只读账本上判定与批量都不给点', async () => {
const { host, fetcher } = await open(
{ data: review({ mirror: { state: 'live' } }) },
{ readOnly: true, writerUrl: 'https://writer.example/review' });
- expect(fetcher.mock.calls.map(([url]) => String(url))).not.toContain(REVIEW_AUTO_APPLY_URL);
+ expect(fetcher.mock.calls.map(([url]) => String(url))).toEqual([REVIEW_URL]);
expect(noteText(host).join()).toContain('正在显示写入端的实时复核队列');
expect(host.querySelector('a[href="https://writer.example/review"]')).toBeTruthy();
// 勾选与批量操作整条都不出现:没有可写的东西,工具条只是一排点不动的按钮。
@@ -241,23 +235,7 @@ it('只读账本上不发自动落库,判定与批量都不给点', async () =
}
});
-it('自动落库落下了几条就报几条', async () => {
- const { host } = await open({ applied: 7 });
- expect(noteText(host).join()).toContain('7 条候选补进了空字段,已从下面的队列里移走。');
-});
-
-it('自动落库一条都没落下时也说一句', async () => {
- const { host } = await open({ applied: 0 });
- expect(noteText(host).join()).toContain('这一批候选没有可以直接补空的');
-});
-
-it('自动落库没能执行时说出原因,队列照常显示', async () => {
- const { host } = await open({ applied: new Error('账本被占用') });
- expect(noteText(host).join()).toContain('自动落库这一步没能执行:账本被占用');
- expect(cards(host)).toHaveLength(REVIEW_PAGE_SIZE);
-});
-
-it('只读账本上不出自动落库那句话:这一步根本没发生', async () => {
- const { host } = await open({}, { readOnly: true });
- expect(noteText(host).join()).not.toContain('自动落库');
+it('打开复核页只读队列,不再触发自动落库写操作', async () => {
+ const { fetcher } = await open();
+ expect(fetcher.mock.calls.map(([url]) => String(url))).toEqual([REVIEW_URL]);
});
diff --git a/src/peach/cli.py b/src/peach/cli.py
index 3fadc8b6c..2bde9a01f 100644
--- a/src/peach/cli.py
+++ b/src/peach/cli.py
@@ -470,10 +470,12 @@ def _scan(args: argparse.Namespace) -> int:
def _process_library(args: argparse.Namespace) -> int:
from .library_processing import process_library
+ from .web_review import auto_apply_metadata
_require_readable_settings()
config = settings_file.active()
result = process_library(config, args.db, config.directory('generated'),
config.directory('generated') / 'covers', location=args.location,
+ apply_candidates=auto_apply_metadata,
report=lambda state: print(f"{state['stage']}:{state['checked']}/{state['total']}", flush=True))
return 0 if result['status'] == 'complete' else 1
diff --git a/src/peach/library_processing.py b/src/peach/library_processing.py
index d7e2b5f38..74dd0dc5f 100644
--- a/src/peach/library_processing.py
+++ b/src/peach/library_processing.py
@@ -646,9 +646,17 @@ class _RemoteSession:
return 0
+def _apply_finished_candidates(callback, db_path, candidate_root):
+ """调用组装层的自动落库规则;未注入时保留核心处理器的独立可用性。"""
+ if callback is None:
+ return {"applied": 0}
+ return callback(Path(db_path), Path(candidate_root))
+
+
def process_library(config, db_path, candidate_root, cover_root, *, location='configured',
report=lambda state: None, provider_factory=None, job_id=None,
- retry_ids=None, active=lambda: True, stage=ALL_STAGES):
+ retry_ids=None, active=lambda: True, stage=ALL_STAGES,
+ apply_candidates=None):
"""登记文件与确定的番号,外部资料保留为可复核候选。
`retry_ids` 为 `None` 时处理整个馆藏;给定时只处理这些项目(上一任务记录的
@@ -870,8 +878,12 @@ def process_library(config, db_path, candidate_root, cover_root, *, location='co
current_asset_id=None, current_asset_name='', current_action='',
current_started_at=None, current_deadline_at=None)
flush_candidates(force=True)
+ # 候选完整落盘后立即执行调用方注入的窄规则,不再等人打开复核页才触发。
+ # 核心处理层不反向依赖 Web 复核层;CLI 与 Web 两个组装入口都传入同一实现。
+ auto_apply = _apply_finished_candidates(apply_candidates, db_path, candidate_root)
update(status='failed' if state['issue_count'] else 'complete', stage='处理结束',
checked=len(rows),
+ auto_applied=auto_apply['applied'],
error=f"{state['issue_count']} 项需要处理,请查看详情并重试。" if state['issue_count'] else '',
completed_at=time.time(), current_asset_id=None, current_asset_name='',
current_action='', current_started_at=None, current_deadline_at=None)
diff --git a/src/peach/routes_pages.py b/src/peach/routes_pages.py
index 218505e76..50cfa709f 100644
--- a/src/peach/routes_pages.py
+++ b/src/peach/routes_pages.py
@@ -76,8 +76,8 @@ border:1px solid var(--line);border-radius:var(--control-radius);background:var(
color:var(--ink);font:inherit}
.affix{display:flex;align-items:center;height:var(--control-h);border:1px solid var(--line);
border-radius:var(--control-radius);background:var(--ground)}
-.affix input[type=text]{flex:1 1 auto;min-width:0;height:100%;border:0;border-radius:0;background:transparent}
-.affix input[type=text]:focus-visible{outline:0}
+.affix input:is([type=text],[type=number]){flex:1 1 auto;min-width:0;height:100%;border:0;border-radius:0;background:transparent}
+.affix input:is([type=text],[type=number]):focus-visible{outline:0}
.affix:focus-within{outline:2px solid var(--tungsten);outline-offset:3px}
.affix>span{flex:none;padding:0 12px;height:100%;display:grid;place-items:center;
color:var(--muted);border-left:1px solid var(--line-soft)}
@@ -178,22 +178,34 @@ _SETUP_COPY = {
#: 同一局域网里的设备看。命令行问答按 `HOST_OPTIONS` 的编号顺序念,两边取值一致。
_HOST_ORDER = ("2", "1")
-#: 选「只有这台电脑」时局域网地址没有意义,输入框跟着禁用;禁用的字段不随表单提交,
-#: 服务端按题目默认值补上。没有脚本时两个字段都可编辑,提交照样成立。
+#: 选「只有这台电脑」时局域网地址没有意义,整项隐藏且输入框禁用;禁用的字段不随表单
+#: 提交,服务端按题目默认值补上。密码同样只在开关打开后显示并启用输入框。
#: 媒体文件夹列表的「添加文件夹」与每行的移除键也在这里亮出来:只剩一行时移除键隐藏。
_SETUP_SCRIPT = """<script>
(function(){
var radios=document.querySelectorAll('input[name="host"]');
var field=document.getElementById('f-mdns_name');
- if(radios.length&&field){
+ var fieldRow=document.getElementById('field-mdns_name');
+ if(radios.length&&field&&fieldRow){
var sync=function(){
var lan=false;
radios.forEach(function(radio){if(radio.checked&&radio.value==="2"){lan=true;}});
field.disabled=!lan;
+ fieldRow.hidden=!lan;
};
radios.forEach(function(radio){radio.addEventListener('change',sync);});
sync();
}
+ var accessToggle=document.getElementById('access-enabled');
+ var accessFields=document.getElementById('access-password-fields');
+ if(accessToggle&&accessFields){
+ var syncAccess=function(){
+ accessFields.hidden=!accessToggle.checked;
+ accessFields.querySelectorAll('input').forEach(function(input){input.disabled=!accessToggle.checked;});
+ };
+ accessToggle.addEventListener('change',syncAccess);
+ syncAccess();
+ }
var list=document.getElementById('dirs');
var add=document.getElementById('add-dir');
var template=document.getElementById('dir-row');
@@ -328,15 +340,17 @@ def _button_rules() -> str:
def _board_button_rules() -> str:
"""入口页的主按钮就是站内那一颗:规则和 token 都从 `board.css` 原样取。
- 错误页、登录页和首启页都是没登录时看到的 Peach,按钮换一种蓝就等于说这是另一个
- 产品。把值抄进 `board-entry.css` 也能画成一样,但那是第二份色值——站内改一次渐变,
- 这三页就悄悄留在旧的那一版上。
+ 错误页、登录页和首启页都是没登录时看到的 Peach,按钮换一种颜色就等于说这是另一个
+ 产品。表单提交键由 `board-entry.css` 接同一组 token,渐变色值仍只在 `board.css` 一处。
只取主按钮那几条(静止、悬停铺的那层底、按下、尺寸)和它们用到的 token:`board.css`
的 `:root` 里还有一份把 `--page` `--ground` 按 Board 的角色重排的映射,整块搬过来
会把入口页自己的面色对调。
"""
board = (PROJECT_ROOT / "web/board.css").read_text(encoding="utf-8")
+ accent = re.search(
+ r'^:root,:root\[data-accent=blue\],\[data-accent-ball=blue\]'
+ r'\{--color-accent-50:[^}]*\}', board, re.M).group(0)
palettes = re.findall(
r'^(?:@media\(prefers-color-scheme:dark\)\{)?:root[^{]*\{--color-text-primary:[^}]*\}\}?',
board, re.M)
@@ -346,7 +360,7 @@ def _board_button_rules() -> str:
rules = re.findall(
r'^body :is\([^)]*\)\.primary(?::not\(:disabled\))?'
r'(?::hover|:active)?(?:::before)?\{[^}]*\}', board, re.M)
- return ''.join(palettes) + ''.join(switches) + ':root{' + ';'.join(fonts) + '}' + ''.join(rules)
+ return accent + ''.join(palettes) + ''.join(switches) + ':root{' + ';'.join(fonts) + '}' + ''.join(rules)
#: 运行信息的术语/取值两列,窄屏叠成一列。只有带 `configfacts` 的页面才内联。
@@ -428,7 +442,7 @@ def _media_dirs_html(values: Sequence[str], errors: Sequence[str], note: str, *,
for index, value in enumerate(rows))
return (
'<div class="field">'
- f'<label for="f-media_dir">{escape(title)}<span class="req" aria-hidden="true">*</span></label>'
+ f'<label class="setting-title" for="f-media_dir">{escape(title)}<span class="req" aria-hidden="true">*</span></label>'
f'<div class="dirs" id="dirs">{body}</div>'
'<button type="button" class="add" id="add-dir" hidden><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg>添加媒体库</button>'
f'<template id="dir-row">{_media_dir_row("", "", first=False, windows=windows)}</template>'
@@ -469,7 +483,7 @@ def _field_html(question, value: str, error: str, note: str) -> str:
)
control = (f'<div class="switch" role="radiogroup" aria-labelledby="l-{key}">'
f'{options}</div>')
- label = f'<span class="legend" id="l-{key}">{escape(title)}</span>'
+ label = f'<span class="legend field-label" id="l-{key}">{escape(title)}</span>'
else:
kind = "number" if question.key == "port" else "text"
control = (f'<input id="f-{key}" name="{key}" type="{kind}" required autocomplete="off" '
@@ -477,13 +491,15 @@ def _field_html(question, value: str, error: str, note: str) -> str:
f'value="{escape(value, quote=True)}">')
if question.key == "mdns_name":
control = f'<div class="affix"><span>https://</span>{control}<span>.local</span></div>'
+ elif question.key == "port":
+ control = f'<div class="affix"><span>localhost:</span>{control}</div>'
else:
control = f'<span class="entry-input">{control}</span>'
- label = f'<label for="f-{key}">{escape(title)}{star}</label>'
+ label = f'<label class="field-label" for="f-{key}">{escape(title)}{star}</label>'
tail = "".join(
f'<p class="help">{escape(line)}</p>' for line in (help_text, note) if line)
tail += f'<p class="bad" role="alert">{escape(error)}</p>' if error else ""
- return f'<div class="field">{label}{control}{tail}</div>'
+ return f'<div class="field" id="field-{key}">{label}{control}{tail}</div>'
def setup_page(
@@ -518,19 +534,28 @@ def setup_page(
value = str(values.get(question.key, question.default))
advanced.append(_field_html(question, value, str(errors.get(question.key, "")), ""))
opened = " open" if any(errors.get(key) for key in ("data_root", "host", "port", "mdns_name")) else ""
- fields.append(f'<details{opened}><summary><span>高级设置</span>{_CHEVRON_SVG}</summary>'
+ fields.append(f'<details{opened}><summary><span class="setting-title">高级设置</span>{_CHEVRON_SVG}</summary>'
+ "".join(advanced) + "</details>")
access_error = str(errors.get("access_password", ""))
- fields.insert(1, '<div class="field"><label for="access-password">访问密码<span class="optional">可选</span></label>'
- '<span class="entry-input"><input id="access-password" name="access_password" type="password" maxlength="256" '
- f'aria-invalid="{"true" if access_error else "false"}" '
- 'autocomplete="new-password" aria-describedby="access-help"></span>'
+ access_enabled = values.get("access_enabled") == "y" or bool(access_error)
+ access_hidden = "" if access_enabled else " hidden"
+ access_disabled = "" if access_enabled else " disabled"
+ fields.insert(1, '<div class="field access-field">'
+ '<label class="toggle-setting" for="access-enabled"><span><strong class="setting-title">访问密码</strong>'
+ '<small>开启后,访问 Peach 需要先登录。</small></span>'
+ f'<input id="access-enabled" class="ptoggle" name="access_enabled" type="checkbox" role="switch" value="y"'
+ f'{" checked" if access_enabled else ""}></label>'
+ f'<div class="password-fields" id="access-password-fields"{access_hidden}>'
+ '<label class="field-label" for="access-password">访问密码</label><span class="entry-input">'
+ '<input id="access-password" name="access_password" type="password" maxlength="256" '
+ f'aria-invalid="{"true" if access_error else "false"}" autocomplete="new-password" '
+ f'aria-describedby="access-help"{access_disabled}></span>'
+ (f'<p class="bad" id="access-help" role="alert">{escape(access_error)}</p>' if access_error
- else '<p class="help" id="access-help">留空即可直接访问;设置密码需至少 8 个字符。</p>')
- + '<p class="help">未设置密码时,能连接到 Peach 的设备可直接进入。</p>'
- '<label for="access-confirm">确认访问密码</label><span class="entry-input"><input id="access-confirm" '
- f'aria-invalid="{"true" if access_error else "false"}" '
- 'name="access_confirm" type="password" maxlength="256" autocomplete="new-password"></span></div>')
+ else '<p class="help" id="access-help">请输入 8–256 个字符。</p>')
+ + '<label class="field-label" for="access-confirm">确认访问密码</label><span class="entry-input">'
+ '<input id="access-confirm" name="access_confirm" type="password" maxlength="256" '
+ f'aria-invalid="{"true" if access_error else "false"}" autocomplete="new-password"{access_disabled}></span>'
+ '</div></div>')
filled = [path for path in media_dirs if path]
if not filled:
scan_text = "完成设置后扫描并补全资料"
@@ -544,10 +569,11 @@ def setup_page(
'<p class="lede">添加媒体库,开始整理你的馆藏。</p></header>'
'<form method="post" action="/setup">'
+ "".join(fields)
- + '<section class="setup-options" aria-label="完成设置后">'
+ + '<section class="setup-options" aria-labelledby="setup-options-title">'
+ + '<h2 class="setting-title" id="setup-options-title">完成设置后</h2>'
+ _check_html("scan_now", scan_text, checked=scan_now)
- + '<p class="help">读取已有 NFO 和封面,采集缺失资料。进度可在设置中查看,资料候选在复核后应用。</p>'
- + '<section class="history-guide-choice"><h2>浏览器历史记录<span class="optional">可选</span></h2>'
+ + '<p class="help">读取已有 NFO 和封面,采集缺失资料。符合自动规则的资料会在处理完成后落库,其余候选留在复核。</p>'
+ + '<section class="history-guide-choice"><h3 class="setting-subtitle">浏览器历史记录<span class="optional">可选</span></h3>'
+ _check_html("history_guide", "接下来导入浏览器历史记录", checked=values.get("history_guide") == "y")
+ '<p class="help">用于生成口味分析。完成设置后选择读取这台电脑,或导入其他设备的记录;也可稍后从「口味」进入。</p></section>'
+ '</section><button type="submit">完成设置</button></form></section>'
@@ -702,8 +728,13 @@ async def setup_submit(request: Request):
config = settings_file.active()
answers, errors = _read_answers(config, submitted, windows=windows)
from . import access
+ password_enabled = "access_enabled" in form
+ password = str(submitted.get("access_password", "")) if password_enabled else ""
+ confirmation = str(submitted.get("access_confirm", "")) if password_enabled else ""
try:
- access.validate_password(str(submitted.get("access_password", "")), str(submitted.get("access_confirm", "")))
+ if password_enabled and not password:
+ raise ValueError("请输入访问密码")
+ access.validate_password(password, confirmation)
except ValueError as exc:
errors["access_password"] = str(exc)
if distribution.standalone() and answers is not None:
@@ -724,7 +755,7 @@ async def setup_submit(request: Request):
raise HTTPException(status_code=409, detail="settings file already exists")
try:
applied = onboarding.apply(resolved, answers, windows=windows,
- access_password=str(submitted.get("access_password", "")))
+ access_password=password)
except (OSError, RuntimeError) as exc:
return HTMLResponse(setup_page(config, windows=windows, values=submitted,
errors={"data_root": str(exc)}, scan_now=scan_now), status_code=400)
diff --git a/src/peach/web_batch.py b/src/peach/web_batch.py
index 57381d456..179f2ff9c 100644
--- a/src/peach/web_batch.py
+++ b/src/peach/web_batch.py
@@ -144,6 +144,9 @@ AD_DIR_APP = re.compile(r"(?:^|[^A-Za-z.])APP(?:[^A-Za-z.]|$)", re.I)
#: `麻豆传媒` 单独出现可能是这个厂牌的资源目录。
AD_DIR_BRAND_MEDIA = re.compile(r"(?:视频|視頻|影视|影視|传媒|傳媒|直播|短视频|短視頻)", re.I)
JUNK_KINDS = frozenset({"video", "image", "audio", "archive", "url", "other"})
+#: 达到这个体积的视频不再当广告残留。这个值与原有「小于 120 MB」证据同源;
+#: 较大的同番号短版本属于重复清理问题,由 ``q_duplicates`` 承接。
+JUNK_VIDEO_MAX_BYTES = 120 * 1024**2
def promo_residue(name: str) -> int:
@@ -223,6 +226,21 @@ def _promo_directory(parts) -> bool:
return False
+def _junk_rows(connection):
+ """读取能进入垃圾复核的物理文件;NFO 与大视频在最外层就排除。"""
+ rows = connection.execute(
+ "SELECT id,location,name,medium,creator,code,size,duration,width,height,snapshot_path,"
+ "feedback,disposal,play_count,leave_ratio,o_count,studio,ctx_orient,path "
+ "FROM asset WHERE location IN ('local','115','pikpak') AND disposal IS NULL "
+ "AND (COALESCE(medium,'other')<>'video' OR (size < ? "
+ "AND duration IS NOT NULL AND duration BETWEEN 15 AND 1200))",
+ (JUNK_VIDEO_MAX_BYTES,)).fetchall()
+ # NFO 是媒体资料边车,不是等待清理的物理内容;即使名字或所在目录带推广词,
+ # 也应由资料读取报告解析问题,不能进入会把文件移入回收站的垃圾队列。
+ return [row for row in rows if PureWindowsPath(
+ row["name"] or row["path"] or "").suffix.casefold() != ".nfo"]
+
+
def q_ads(contract: WebContract, limit=200, offset=0, kind="", status="pending"):
"""疑似垃圾复核队列 —— **不自动删**,只排队让人看证据确认。
@@ -256,12 +274,7 @@ def q_ads(contract: WebContract, limit=200, offset=0, kind="", status="pending")
if status not in {"pending", "dismissed"}:
raise ValueError("invalid junk status")
with contract.read_connection() as c:
- rows = c.execute(
- "SELECT id,location,name,medium,creator,code,size,duration,width,height,snapshot_path,"
- "feedback,disposal,play_count,leave_ratio,o_count,studio,ctx_orient,path "
- "FROM asset WHERE location IN ('local','115','pikpak') AND disposal IS NULL "
- "AND (COALESCE(medium,'other')<>'video' OR (size < 500*1024*1024 "
- "AND duration IS NOT NULL AND duration BETWEEN 15 AND 1200))").fetchall()
+ rows = _junk_rows(c)
# 同番号是否存在明显更长的版本;只在 code 是真番号时才有意义。
longer = {r[0]: r[1] for r in c.execute(
"SELECT code, max(duration) FROM asset WHERE medium='video' AND code IS NOT NULL "
@@ -367,7 +380,7 @@ def q_ads(contract: WebContract, limit=200, offset=0, kind="", status="pending")
s += 40; why.append(f"同番号有 {mx/60:.0f} 分完整版")
if d["duration"] < 240:
s += 15; why.append("不足 4 分钟")
- if (d["size"] or 0) < 120 * 1024**2:
+ if (d["size"] or 0) < JUNK_VIDEO_MAX_BYTES:
s += 10; why.append("小于 120 MB")
if promo_dir:
# 30 分单独不构成删片理由:正片也可能躺在别人起错名的目录里,
@@ -802,33 +815,37 @@ def w_batch(contract: WebContract, body):
return {"ok": True, "operation": operation, "changed": len(valid_ids)}
-def q_duplicates(contract: WebContract, args):
- """按番号 + 时长找真重复;每簇标出最大与最长的那个。"""
- limit = min(max(int(args.get("limit", "60")), 1), 300)
- offset = max(int(args.get("offset", "0")), 0)
- with contract.read_connection() as connection:
- rows = connection.execute(
- "SELECT id,code,location,path,name,size,duration,hash,disposal "
- "FROM asset WHERE medium='video' AND code IS NOT NULL AND code<>'' "
- "AND (disposal IS NULL OR disposal<>'trash')"
- ).fetchall()
-
- grouped: dict[str, list[dict]] = {}
- for row in rows:
- if not is_jav_code(row["code"]):
- continue
- item = dict(row)
- # 盘符只用于判定跨盘;重复项页面还要显示完整路径,不能在契约层丢掉。
- item["drive"] = str(item.get("path") or "")[:2].upper()
- grouped.setdefault(normalise_code_key(row["code"]), []).append(item)
-
+def _add_large_short_copy_cluster(items: list[dict], clusters: list[list[dict]]):
+ """把同番号的大体积短版本并到完整版所在组,返回这个组。"""
+ claimed = {item["id"] for cluster in clusters for item in cluster}
+ full = max(items, key=lambda item: item.get("duration") or 0)
+ full_duration = float(full.get("duration") or 0)
+ short_copies = [item for item in items
+ if item["id"] not in claimed and item["id"] != full["id"]
+ and (item.get("size") or 0) >= JUNK_VIDEO_MAX_BYTES
+ and 0 < float(item.get("duration") or 0) < full_duration * 0.2
+ and not PART_MARK.search(PureWindowsPath(
+ str(item.get("name") or "")).stem)]
+ if not short_copies:
+ return None
+ cluster = next((candidate for candidate in clusters if any(
+ item["id"] == full["id"] for item in candidate)), None)
+ if cluster is None:
+ cluster = [full]
+ clusters.append(cluster)
+ cluster.extend(short_copies)
+ return cluster
+
+
+def _duplicate_groups(grouped: dict[str, list[dict]]):
+ """把已按番号归组的资产整理成重复项 API 结果。"""
groups = []
for code, items in grouped.items():
if len(items) < 2:
continue
- for cluster in duration_clusters(items):
- if len(cluster) < 2:
- continue
+ clusters = [cluster for cluster in duration_clusters(items) if len(cluster) >= 2]
+ short_copy_cluster = _add_large_short_copy_cluster(items, clusters)
+ for cluster in clusters:
largest = max(cluster, key=lambda x: x.get("size") or 0)
longest = max(cluster, key=lambda x: x.get("duration") or 0)
hashes_present = [x["hash"] for x in cluster if x["hash"]]
@@ -842,6 +859,8 @@ def q_duplicates(contract: WebContract, args):
"code": code,
"files": sorted(cluster, key=lambda x: -(x.get("size") or 0)),
"count": len(cluster),
+ "evidence": "same_code_short_copy" if cluster is short_copy_cluster
+ else "duration",
# 必须每个文件都有 sha1 且完全相同才算确证字节一致。缺一个哈希
# 就只是「时长相近」的推断,不能对外宣称已确证。
"identical": len(hashes) == 1 and len(hashes_present) == len(cluster),
@@ -850,6 +869,30 @@ def q_duplicates(contract: WebContract, args):
"reclaimable": sum(x.get("size") or 0 for x in cluster)
- (largest.get("size") or 0),
})
+ return groups
+
+
+def q_duplicates(contract: WebContract, args):
+ """按番号 + 时长找真重复,也收同番号的大体积短版本。"""
+ limit = min(max(int(args.get("limit", "60")), 1), 300)
+ offset = max(int(args.get("offset", "0")), 0)
+ with contract.read_connection() as connection:
+ rows = connection.execute(
+ "SELECT id,code,location,path,name,size,duration,hash,disposal "
+ "FROM asset WHERE medium='video' AND code IS NOT NULL AND code<>'' "
+ "AND (disposal IS NULL OR disposal<>'trash')"
+ ).fetchall()
+
+ grouped: dict[str, list[dict]] = {}
+ for row in rows:
+ if not is_jav_code(row["code"]):
+ continue
+ item = dict(row)
+ # 盘符只用于判定跨盘;重复项页面还要显示完整路径,不能在契约层丢掉。
+ item["drive"] = str(item.get("path") or "")[:2].upper()
+ grouped.setdefault(normalise_code_key(row["code"]), []).append(item)
+
+ groups = _duplicate_groups(grouped)
groups.sort(key=lambda g: -g["reclaimable"])
window = groups[offset:offset + limit]
return {
diff --git a/src/peach/web_library_processing.py b/src/peach/web_library_processing.py
index d7caa56ff..990bd8f4f 100644
--- a/src/peach/web_library_processing.py
+++ b/src/peach/web_library_processing.py
@@ -4,6 +4,7 @@ import json
from . import settings_file
from .library_processing import (ALL_STAGES, COLLECT_STAGE, SCAN_STAGE, STAGES,
decorate, issues_path, process_library, snapshot)
+from .web_review import auto_apply_metadata
def _current(contract):
@@ -85,6 +86,7 @@ def w_library_processing(contract, body):
try:
result = process_library(config, contract.db_path, contract.candidate_root, contract.cover_root,
job_id=job_id, retry_ids=retry_ids, stage=stage,
+ apply_candidates=auto_apply_metadata,
active=lambda: (contract.library_processing_job.snapshot() or {}).get('job_id') == job_id,
report=lambda state: contract.library_processing_job.update(job_id, **{
key: value for key, value in state.items() if key != 'job_id'}))
diff --git a/src/peach/web_review.py b/src/peach/web_review.py
index ea60b3df6..4ab9b983b 100644
--- a/src/peach/web_review.py
+++ b/src/peach/web_review.py
@@ -55,6 +55,7 @@ from .metadata_policy import (
FALLBACK_SOURCES, FIELD_SOURCE_ORDER, PREFERRED_COMMUNITY_SOURCE, SOURCE_SPECS,
)
from .previews import logo_key
+from .repository import LedgerDatabase
from .review_csv import read_rows
@@ -1720,6 +1721,29 @@ def w_review_auto_apply(contract: ReviewContract, _body=None):
"items": applied}
+def auto_apply_metadata(db_path: Path, candidate_root: Path):
+ """资料处理完成后立即应用符合窄规则的候选。
+
+ 命令行首扫与 Web 后台任务都经过 ``process_library``,不能依赖有人随后打开复核页。
+ 这里给同一套复核写入逻辑装一个最小契约,仍走 ``LedgerDatabase`` 的写事务、字段归属
+ 与 ``review_decision`` 留痕;没有另开一条绕过闸门的写入路径。
+ """
+ database = LedgerDatabase(Path(db_path))
+
+ class ProcessingReviewContract:
+ def __init__(self):
+ self.candidate_root = Path(candidate_root)
+
+ def write_transaction(self):
+ return database.write_transaction()
+
+ @staticmethod
+ def cache_bust():
+ return None
+
+ return w_review_auto_apply(ProcessingReviewContract())
+
+
def w_review_decision(contract: ReviewContract, body):
category = str(body.get("category", "")).strip()
item_key = str(body.get("item_key", "")).strip()
diff --git a/tests/test_access.py b/tests/test_access.py
index e7291cffd..089b8932e 100644
--- a/tests/test_access.py
+++ b/tests/test_access.py
@@ -127,13 +127,15 @@ class AccessTests(unittest.IsolatedAsyncioTestCase):
await self.login("wrong")
self.assertEqual((await self.login("wrong")).status_code, 429)
- def test_setup_password_is_visible_optional_and_never_echoed(self):
+ def test_setup_password_uses_an_opt_in_switch_and_never_echoes_the_secret(self):
from peach import routes_pages, settings_file
config = settings_file.load_config(environ={"PEACH_DATA_ROOT": str(self.path.parent)})
- html = routes_pages.setup_page(config, windows=True, values={"access_password": "sensitive-password"})
- self.assertIn('访问密码<span class="optional">可选</span>', html)
+ html = routes_pages.setup_page(config, windows=True, values={
+ "access_enabled": "y", "access_password": "sensitive-password"})
+ self.assertIn('name="access_enabled" type="checkbox" role="switch" value="y" checked', html)
+ self.assertIn('id="access-password-fields"', html)
+ self.assertNotIn('id="access-password-fields" hidden', html)
self.assertIn('input[type=password]{width:100%;height:var(--control-h)', html)
- self.assertIn('.optional{margin-inline-start:8px;color:var(--muted)', html)
form = html.split('<form method="post" action="/setup">', 1)[1]
self.assertLess(form.index('name="access_password"'), form.index("高级设置"))
self.assertNotIn("sensitive-password", html)
diff --git a/tests/test_ad_judgement.py b/tests/test_ad_judgement.py
index c92acf485..e776dbb49 100644
--- a/tests/test_ad_judgement.py
+++ b/tests/test_ad_judgement.py
@@ -218,6 +218,16 @@ class ResourceJunkQueueTests(unittest.TestCase):
{(10, "image"), (11, "other")},
)
+ def test_nfo_and_large_same_code_clips_never_enter_the_junk_queue(self):
+ """NFO 是资料边车;达到 120 MB 的同番号短版本归重复清理,不归垃圾。"""
+ self.add(13, "local", r"R:\番号\点击观看.nfo", "other", 4096)
+ self.add(14, "local", r"R:\番号\FC2-PPV-1110408.mp4", "video",
+ 4 * 1024**3, 50 * 60, code="FC2-PPV-1110408")
+ self.add(15, "local", r"R:\番号\FC2-PPV-1110408-2-4K修复.mp4", "video",
+ 488 * 1024**2, 3 * 60, code="FC2-PPV-1110408")
+
+ self.assertEqual(q_ads(self.contract, limit=200)["items"], [])
+
def test_mib_archives_can_be_excluded_and_reconsidered_per_asset(self):
"""域名文件名可能是真资源;“不是垃圾”必须可持久排除且能撤销。"""
self.add(20, "115", r"B:\\MIB\\Mib19.com.zip", "archive", 14 * 1024**3)
diff --git a/tests/test_frontend_build.py b/tests/test_frontend_build.py
index 8aca3854b..c088511fd 100644
--- a/tests/test_frontend_build.py
+++ b/tests/test_frontend_build.py
@@ -605,8 +605,7 @@ class ReviewEndpointTests(unittest.TestCase):
"""
PAGE = FRONTEND / "src" / "react" / "review"
- ENDPOINTS = ("/api/review", "/api/review/auto-apply", "/api/review/decision",
- "/api/review/genre")
+ ENDPOINTS = ("/api/review", "/api/review/decision", "/api/review/genre")
def setUp(self):
self.data = (self.PAGE / "review.ts").read_text(encoding="utf-8")
@@ -635,7 +634,7 @@ class ReviewEndpointTests(unittest.TestCase):
"产物里没有这一页,先跑 npm --prefix frontend run build")
def test_each_endpoint_is_declared_once(self):
- """四条端点与那一个 `queryKey` 在前端各只有一个声明处,就是这一页的数据模块。
+ """三条端点与那一个 `queryKey` 在前端各只有一个声明处,就是这一页的数据模块。
这一页读一整条队列(一次几兆、上千行),判定、批量判定和收录 genre 三个写操作
全都只改缓存里那几行。第二处再写一遍就等于给同一条队列开了第二份快照:判过的行
@@ -655,24 +654,17 @@ class ReviewEndpointTests(unittest.TestCase):
if "/api/review" in path.read_text(encoding="utf-8")]
self.assertEqual(len(routed), 1, f"/api/review 的路由声明在 {routed}")
- def test_the_queue_and_the_receipt_are_two_keys(self):
- """队列和本次自动落库的回执各走各的键。
-
- 合成一个键的话,收录一个 genre 之后重取队列会把那句回执一起变成新的——它说的
- 是「这一次进来做了什么」,不是账本此刻的样子。
- """
+ def test_the_queue_has_one_query_key(self):
self.assertIn("export const REVIEW_KEY = ['review'] as const;", self.data)
- self.assertIn("export const REVIEW_AUTO_APPLY_KEY = ['review', 'auto-apply'] as const;",
- self.data)
self.assertIn("queryClient.setQueryData<ReviewData>(REVIEW_KEY", self.data)
self.assertIn("export function dropReviewRows(", self.data)
- def test_the_read_only_end_does_not_write_before_it_reads(self):
- """只读账本上不发那一次 POST:明知不能写就不该制造一次 409。"""
+ def test_opening_review_only_reads_the_queue(self):
+ """自动落库已跟随处理任务完成,打开复核页不能再发写请求。"""
prefetch = self.data[self.data.index("export async function prefetchReview"):]
prefetch = prefetch[:prefetch.index("\n}")]
- self.assertIn("readOnly ? { state: 'skipped' } : await autoApplyReceipt(signal)", prefetch)
self.assertIn("queryKey: REVIEW_KEY", prefetch)
+ self.assertNotIn("apiSend", prefetch)
def test_empty_and_error_states_reuse_the_shared_components(self):
"""空态与失败态走 `src/react/components/` 的组合件,不是一行灰字。"""
diff --git a/tests/test_metadata_library.py b/tests/test_metadata_library.py
index e1674043a..0f6745264 100644
--- a/tests/test_metadata_library.py
+++ b/tests/test_metadata_library.py
@@ -12,14 +12,14 @@ from contextlib import closing
from filelock import FileLock
-from peach.field_owners import owner_of, review_owner
+from peach.field_owners import auto_owner, owner_of, review_owner
from peach.genre_taxonomy import map_genres
from peach.library_nfo import read_nfo, sidecars, local_art
from peach.library_processing import (STALL_AFTER_SECONDS, decorate, issues_path,
process_library, snapshot, state_path, _fields)
from peach.review_csv import read_rows
from peach.settings_file import PeachConfig
-from peach.web_review import _apply_metadata_candidate
+from peach.web_review import _apply_metadata_candidate, auto_apply_metadata
from support.conditions import windows_ledger_roots
from support.ledger import fresh_ledger
@@ -142,6 +142,36 @@ class LibraryNfoTests(unittest.TestCase):
self.assertEqual(q_library_processing(contract, {})['job_id'], 'one')
worker.assert_not_called()
+ @windows_ledger_roots
+ def test_processing_auto_applies_safe_nfo_fields_before_it_finishes(self):
+ media = self.root / 'media'
+ media.mkdir()
+ (media / 'ABW-358.mp4').write_bytes(b'video')
+ (media / 'ABW-358.nfo').write_text(
+ '<movie><title>涼森れむ流</title><sorttitle>ABW-358</sorttitle></movie>',
+ encoding='utf-8')
+ db = fresh_ledger(self.root)
+ config = PeachConfig(self.root, self.root / 'config.toml', present=True,
+ locations={'local': (str(media),)})
+ provider = Mock()
+ provider.query.return_value = {'id': 'ABW-358'}
+
+ result = process_library(config, db, self.root / 'generated', self.root / 'covers',
+ provider_factory=Mock(return_value=provider),
+ apply_candidates=auto_apply_metadata)
+
+ self.assertGreaterEqual(result['auto_applied'], 1)
+ with closing(sqlite3.connect(db)) as connection:
+ title, owners = connection.execute(
+ "SELECT catalog_title,field_owners FROM asset WHERE code='ABW-358'").fetchone()
+ decision = connection.execute(
+ "SELECT status,note FROM review_decision WHERE category='metadata_fields' "
+ "AND item_key='asset:1:title'").fetchone()
+ self.assertEqual(title, '涼森れむ流')
+ self.assertEqual(owner_of(owners, 'catalog_title'), auto_owner('local_nfo'))
+ self.assertEqual(decision[0], 'approved')
+ self.assertEqual(json.loads(decision[1])['rule'], 'adr-0029-empty-field-local-nfo')
+
@windows_ledger_roots
def test_no_code_video_pairs_with_its_sibling_image_without_nfo(self):
"""无番号、无 NFO 的视频也拿同目录图片当海报,落在 `{id}_4.jpg`。"""
diff --git a/tests/test_module_layering.py b/tests/test_module_layering.py
index 701bbb13e..a6aa5d65c 100644
--- a/tests/test_module_layering.py
+++ b/tests/test_module_layering.py
@@ -28,14 +28,14 @@ SOURCE_ROOT = pathlib.Path(peach.__file__).parent
#: 守规则的东西自己先漂了,是这条门槛最容易出的故障。
WEB_MODULES = {path.stem for path in SOURCE_ROOT.glob("web_*.py")}
-#: FastAPI 适配层:`api` 是组装点,`routes_*` 是它挂上去的路由表。把 web 层接到
-#: HTTP 上是这一层的职责,方向是对的。
+#: FastAPI 与命令行适配层:`api` / `cli` 是组装点,`routes_*` 是前者挂上去的路由表。
+#: 把 Web 服务接到 HTTP 或顶层命令上是这一层的职责,方向是对的。
#:
#: 和 `WEB_MODULES` 同样按文件名推导。只写着 `api` 的话,`create_app` 拆成
#: `routes_auth`/`routes_pages`/`routes_media`/`routes_api` 之后再拆一个模块就会被判成
#: 「非 web 模块 import 了 web 层」——门槛报的是假警,改的人只会来把它加进清单。
ROUTE_MODULES = {path.stem for path in SOURCE_ROOT.glob("routes_*.py")}
-COMPOSITION_ROOTS = {"api"} | ROUTE_MODULES
+COMPOSITION_ROOTS = {"api", "cli"} | ROUTE_MODULES
def _local_imports(path: pathlib.Path) -> set[str]:
diff --git a/tests/test_onboarding.py b/tests/test_onboarding.py
index 31db61998..517c870d2 100644
--- a/tests/test_onboarding.py
+++ b/tests/test_onboarding.py
@@ -437,7 +437,7 @@ class SetupPageTests(_Case):
self.assertIn(f">{title}<", body)
# 只有媒体文件夹非填不可。其余四项都有能直接用的默认值,折进「高级设置」,
# 独立包与源码部署是同一张表单;有一项报错时折叠展开着。
- details = body.index("<details><summary><span>高级设置</span>")
+ details = body.index('<details><summary><span class="setting-title">高级设置</span>')
self.assertLess(body.index('id="add-dir"'), details)
for key in ("data_root", "host", "port", "mdns_name"):
self.assertLess(details, body.index(f'name="{key}"'), key)
@@ -471,11 +471,32 @@ class SetupPageTests(_Case):
self.assertIn(f"<span>{label}</span>", body)
self.assertIn('<input type="radio" name="host" value="2" checked>', body)
self.assertLess(body.index('value="2" checked'), body.index('name="host" value="1"'))
- # 选「只有这台电脑」时局域网地址输入框由页内脚本禁用。
+ # 选「只有这台电脑」时局域网地址整项隐藏,输入框同时禁用、不随表单提交。
self.assertIn("field.disabled=!lan", body)
+ self.assertIn("fieldRow.hidden=!lan", body)
# 局域网访问地址只填名字,框内前缀 `https://`、后缀 `.local` 拼成完整网址。
self.assertIn('<div class="affix"><span>https://</span><input', body)
self.assertIn("<span>.local</span>", body)
+ # 端口只填写数字,localhost 是不可编辑的固定前缀。
+ self.assertIn('<div class="affix"><span>localhost:</span><input id="f-port"', body)
+ # 密码默认关闭;开启后脚本才显示并启用两项输入。
+ self.assertIn('id="access-enabled" class="ptoggle" name="access_enabled" type="checkbox" role="switch"', body)
+ self.assertIn('id="access-password-fields" hidden', body)
+ self.assertIn("accessFields.hidden=!accessToggle.checked", body)
+ for title in ("媒体库", "访问密码", "高级设置", "完成设置后"):
+ self.assertIn(f'>{title}<', body)
+ self.assertIn('<h2 class="setting-title" id="setup-options-title">完成设置后</h2>', body)
+ self.assertIn('<h3 class="setting-subtitle">浏览器历史记录', body)
+ self.assertIn('.setup-auth-card .setting-title,.setup-auth-card .field>label.setting-title{margin:0;'
+ 'padding:0;border:0;color:var(--ink);font:600 14px/20px', body)
+ self.assertIn('.setup-auth-card .field-label{color:var(--ink-2);font:500 14px/20px', body)
+ self.assertIn(
+ '.setup-auth-card form>:is(.access-field,details,.setup-options){margin-top:24px;'
+ 'padding-top:24px;border-top:1px solid var(--line)}', body)
+ self.assertIn('.setup-auth-card .password-fields>label:not(:first-child){margin-top:16px}', body)
+ self.assertIn(
+ '.setup-auth-card .history-guide-choice{margin-top:16px;padding-top:24px;'
+ 'border-top:1px solid var(--line)}', body)
# 勾选框用站内共用的自绘结构,路径使用普通文字。
self.assertIn('<span class="pcheck"><input type="checkbox" name="scan_now" value="y" checked>', body)
self.assertIn("完成设置后扫描并补全资料:", body)
@@ -484,6 +505,12 @@ class SetupPageTests(_Case):
self.assertIn('数据目录<span class="req"', body)
self.assertIn('端口<span class="req"', body)
self.assertIn('局域网访问地址<span class="req"', body)
+ # 首启页唯一主操作与站内 Board primary 共用蓝色渐变。
+ self.assertIn(
+ '.setup-auth-card :is(button[type=submit],.setup-enter){position:relative;'
+ 'isolation:isolate;border:0;color:#fff;background:var(--board-blue)}', body)
+ self.assertIn('background:var(--board-blue-hover)', body)
+ self.assertIn('.setup-auth-card .dir :is(button.pick,button.rm){width:40px;height:40px', body)
@unittest.skipIf(NATIVE_WINDOWS, "盘符本身就是挂载点,Windows 上没有这句话")
def test_the_mounts_explanation_sits_under_the_media_field_on_posix(self):
@@ -531,12 +558,37 @@ class SetupPageTests(_Case):
self.assertFalse(self.data_root.exists())
def test_a_disabled_lan_address_falls_back_to_the_default_name(self):
- """选「只有这台电脑」后地址框是禁用的,不随表单提交;服务端按默认值补上。"""
+ """选「只有这台电脑」后地址项隐藏且不提交;服务端按默认值补上。"""
response = self._post("/setup", self._form(host="1", mdns_name=None))
self.assertEqual(response.status_code, 200)
loaded = self._loaded()
self.assertEqual((loaded.server.host, loaded.server.mdns_name), ("127.0.0.1", "peach"))
+ def test_password_switch_requires_a_password_and_stays_open_on_error(self):
+ response = self._post("/setup", self._form(access_enabled="y"))
+ self.assertEqual(response.status_code, 400)
+ self.assertIn("请输入访问密码", response.text)
+ self.assertIn('name="access_enabled" type="checkbox" role="switch" value="y" checked', response.text)
+ self.assertNotIn('id="access-password-fields" hidden', response.text)
+
+ def test_password_fields_are_ignored_while_the_switch_is_off(self):
+ from peach import access
+ response = self._post("/setup", self._form(
+ access_password="should-not-be-used", access_confirm="should-not-be-used"))
+ self.assertEqual(response.status_code, 200, response.text)
+ policy = access.load(self.data_root / "secrets" / "access.json")
+ self.assertEqual(policy["mode"], "open")
+
+ def test_password_switch_saves_the_confirmed_password(self):
+ from peach import access
+ response = self._post("/setup", self._form(
+ access_enabled="y", access_password="correct-password",
+ access_confirm="correct-password"))
+ self.assertEqual(response.status_code, 200, response.text)
+ policy = access.load(self.data_root / "secrets" / "access.json")
+ self.assertEqual(policy["mode"], "password")
+ self.assertTrue(access.verify(policy, "correct-password"))
+
def test_a_valid_submission_builds_the_tree_and_shows_what_happens_next(self):
response = self._post("/setup", self._form())
self.assertEqual(response.status_code, 200)
@@ -624,7 +676,7 @@ class SetupPageTests(_Case):
def test_advanced_settings_fold_with_the_shared_collapse_and_the_site_scrollbar(self):
"""高级设置是 Geist Collapse:借主站的 wireCollapse,chevron 与高度都 200ms;滚动条也是主站那条。"""
body = self._get("/").text
- self.assertIn('<summary><span>高级设置</span><svg viewBox="0 0 24 24" aria-hidden="true">', body)
+ self.assertIn('<summary><span class="setting-title">高级设置</span><svg viewBox="0 0 24 24" aria-hidden="true">', body)
self.assertIn('import{attachOverlayScrollbar,wireCollapse,selectFieldHtml,wireSelectField,MEDIA_SOURCE_ICONS}from"/js/ui-components.js";'
'attachOverlayScrollbar(document.documentElement,{variant:"page"});'
'wireCollapse(document,"details","setup-collapse");', body)
@@ -650,7 +702,7 @@ class SetupPageTests(_Case):
response = self._post("/setup", self._form(port="99999"))
self.assertEqual(response.status_code, 400)
body = response.text
- self.assertIn("<details open><summary><span>高级设置</span>", body)
+ self.assertIn('<details open><summary><span class="setting-title">高级设置</span>', body)
self.assertLess(body.index('name="port"'), body.index('<p class="bad" role="alert">'))
def test_a_second_submission_refuses_to_overwrite_the_settings_file(self):
diff --git a/tests/test_rm_web.py b/tests/test_rm_web.py
index 0da2f43bf..681a4cebb 100644
--- a/tests/test_rm_web.py
+++ b/tests/test_rm_web.py
@@ -2563,6 +2563,20 @@ class DuplicateDetectionTests(unittest.TestCase):
flagged = {f["id"] for g in result["groups"] for f in g["files"]}
self.assertNotIn(real, flagged, "199 分钟的正片不该被判成重复")
+ def test_large_short_same_code_copy_is_a_duplicate_not_junk(self):
+ full = self.add("FC2-PPV-1110408", 50 * 60, 4_000_000_000,
+ name="FC2-PPV-1110408.mp4")
+ short = self.add("FC2-PPV-1110408", 3 * 60, 488 * 1024**2,
+ name="FC2-PPV-1110408-2-4K修复.mp4")
+
+ result = self.groups()
+
+ self.assertEqual(result["total"], 1)
+ group = result["groups"][0]
+ self.assertEqual({item["id"] for item in group["files"]}, {full, short})
+ self.assertEqual(group["evidence"], "same_code_short_copy")
+ self.assertEqual(group["reclaimable"], 488 * 1024**2)
+
def test_largest_and_longest_are_marked_separately(self):
# 时长差必须落在容差内才是同一簇;体积最大与时长最长可以是不同文件,
# 实测 MEYD-692 里最长的那个反而是码率更低的 nyap2p 版本。
diff --git a/tests/test_web_ui.py b/tests/test_web_ui.py
index 38d8a5228..5d448c3b3 100644
--- a/tests/test_web_ui.py
+++ b/tests/test_web_ui.py
@@ -9999,7 +9999,7 @@ class WebUiSourceTests(unittest.TestCase):
data = self.read_react("library-processing/library-processing.ts")
self.assertIn("Date.now() / 1000 - state.completed_at < FRESH_COMPLETION_SECONDS", data)
self.assertIn("localStorage.getItem(ANNOUNCED_KEY) === state.job_id", data)
- self.assertIn("toast(`扫描与资料采集已完成:识别 ${state.identified || 0} 个番号", data)
+ self.assertIn("自动落库 ${state.auto_applied || 0} 条", data)
self.assertNotIn("toast('已完成扫描与资料采集')", data)
shared = self.read_react("library-processing/use-library-processing.ts")
self.assertIn("if (witnessed || mode === 'notice') announceCompletion(state, toast, witnessed);", shared)
@@ -10339,12 +10339,11 @@ class WebUiSourceTests(unittest.TestCase):
for stale in ("#ff3347", "#e60012", "#ff6471"):
self.assertNotIn(stale, board, f"危险档的红只从 token 来,{stale} 是第二份")
- def test_the_entry_pages_primary_button_is_the_one_from_inside_the_app(self):
- """错误页、登录页和首启页的主按钮跟站内是同一颗规则,不是抄一份色值。
+ def test_the_entry_pages_keep_the_shared_geist_primary_rule(self):
+ """入口页的主按钮跟站内是同一颗规则,不是抄一份色值。
- 这三张页面是没登录时看到的 Peach,按钮换一种蓝就等于说这是另一个产品。它们的
- 样式内联在页面里,`routes_pages._board_button_rules()` 把 board.css 的强调档连同
- 它用到的 token 一起取过去,站内改一次渐变这三页跟着走。
+ 首启与登录表单从 `board-entry.css` 使用同一组渐变 token;带
+ `.geist-button primary` 的独立错误页直接使用提取出的完整规则。
"""
root = Path(__file__).resolve().parents[1]
board = (root / "web/board.css").read_text(encoding="utf-8")
@@ -10353,6 +10352,9 @@ class WebUiSourceTests(unittest.TestCase):
self.assertNotIn("--board-blue:", entry, "那条渐变只在 board.css 声明")
from peach.routes_pages import _board_button_rules
rules = _board_button_rules()
+ self.assertIn(":root,:root[data-accent=blue],[data-accent-ball=blue]{--color-accent-50:",
+ rules, "入口页必须取得默认蓝色色阶,渐变 token 才有实际色值")
+ self.assertIn("--color-accent-500:", rules)
# board.css 里这个 token 声明了两遍,Board 那一层的映射排在后面、也是实际生效的
# 那一份;取过去的要是最后一处。
gradient = re.findall(r"--board-blue:(linear-gradient\([^;}]+\))", board)[-1]
diff --git a/web/app.js b/web/app.js
index 6e118ed3e..9f992e679 100644
--- a/web/app.js
+++ b/web/app.js
@@ -4996,7 +4996,9 @@ function renderDuplicates(){
${groups.length?groups.map((g,gi)=>`<section class="dupgroup" data-dup-group="${gi}">
<div class="duphead"><b class="mono">${esc(g.code)}</b>
<span class="mono">${g.count} 个 · 可回收 ${fmtSize(g.reclaimable)}</span>
- ${g.identical?'<span class="dupflag ok">sha1 一致</span>':'<span class="dupflag">时长推断</span>'}
+ ${g.identical?'<span class="dupflag ok">sha1 一致</span>'
+ :g.evidence==='same_code_short_copy'?'<span class="dupflag">同番号短版本</span>'
+ :'<span class="dupflag">时长推断</span>'}
${g.cross_drive?`<span class="dupflag">跨盘 ${esc(g.drives.join(' '))}</span>`:''}
<span class="dupbtns"><button data-dup-keep="largest" data-dup-i="${gi}">留最大</button>
<button data-dup-keep="longest" data-dup-i="${gi}">留最长</button>
diff --git a/web/board-entry.css b/web/board-entry.css
index f5e6f2789..2f1517cda 100644
--- a/web/board-entry.css
+++ b/web/board-entry.css
@@ -6,9 +6,7 @@ body{background:var(--page)}
main{background:var(--ground);border:1px solid var(--line);border-radius:24px;padding:28px;box-shadow:0 4px 16px #00000008}
h1{font-weight:500}
input[type=text],input[type=password],input[type=number],select,.affix{background:var(--field);border-radius:10px}
-/* 主按钮那一颗不写在这里:`routes_pages._board_button_rules()` 把 `board.css` 里的
- Board primary 连同它用到的 token 一起内联进这三页,站内改一次渐变这里跟着走。
- 表单里那些没带 `.geist-button primary` 的提交键还是要自己接上同一副盒子。 */
+/* 表单提交是这一屏唯一主操作,复用站内 Board primary 的三档渐变。 */
button[type=submit],form>button{position:relative;isolation:isolate;height:36px;background:var(--board-blue);color:#fff;border:0;box-shadow:0 1px 2px #0000000d;border-radius:10px}
button[type=submit]::before,form>button::before{content:"";position:absolute;inset:0;z-index:-1;pointer-events:none;border-radius:inherit;background:var(--board-blue-hover);opacity:0;transition:opacity .15s ease}
button[type=submit]:hover:not(:disabled)::before,form>button:hover:not(:disabled)::before{opacity:1}
@@ -29,16 +27,20 @@ main:has(.setup-auth-card){width:100%;max-width:560px;padding:32px;box-shadow:0
.setup-auth-card form{margin-top:28px}
.setup-auth-card .field{margin-top:24px}
.setup-auth-card form>.field:first-child{margin-top:0}
+.setup-auth-card form>:is(.access-field,details,.setup-options){margin-top:24px;padding-top:24px;border-top:1px solid var(--line)}
.setup-auth-card .dir{padding:12px;background:var(--surface);border:0;border-radius:var(--control-radius)}
.setup-auth-card input,.setup-auth-card .affix{background:var(--surface)}
.setup-auth-card .help{font-size:12px;line-height:18px}
+.setup-auth-card .setting-title,.setup-auth-card .field>label.setting-title{margin:0;padding:0;border:0;color:var(--ink);font:600 14px/20px var(--board-font,system-ui,sans-serif)}
+.setup-auth-card .field-label{color:var(--ink-2);font:500 14px/20px var(--board-font,system-ui,sans-serif)}
+.setup-auth-card .setting-subtitle{margin:0;color:var(--ink);font:500 14px/20px var(--board-font,system-ui,sans-serif)}
.setup-auth-card .field>label:not(:first-child){margin-top:16px}
.setup-auth-card details{padding:0;background:transparent;border-radius:0}
.setup-auth-card summary{min-height:32px;justify-content:space-between;font-size:14px}
-.setup-auth-card .setup-options{margin-top:24px;display:grid;gap:8px}
+.setup-auth-card .setup-options{display:grid;gap:8px}
.setup-auth-card .check{margin:0;align-items:flex-start;min-height:24px;gap:8px;font-size:13px;line-height:20px}
-.setup-auth-card .history-guide-choice{margin-top:12px}
-.setup-auth-card .history-guide-choice h2{margin:0 0 12px;padding:0;border:0;font-size:14px;font-weight:500}
+.setup-auth-card .history-guide-choice{margin-top:16px;padding-top:24px;border-top:1px solid var(--line)}
+.setup-auth-card .history-guide-choice .setting-subtitle{margin:0 0 12px;padding:0;border:0}
.setup-auth-card .bad{padding:8px 10px;border-radius:var(--control-radius);background:color-mix(in srgb,var(--drop) 8%,var(--ground));overflow-wrap:anywhere}
.setup-auth-card :is(button[type=submit],.setup-enter){margin-top:24px;min-height:36px}
.setup-auth-card .switch label{height:auto;min-height:40px;padding:6px 8px;text-align:center;font-size:13px;line-height:18px}
@@ -72,6 +74,20 @@ main:has(.setup-auth-card){width:100%;max-width:560px;padding:32px;box-shadow:0
.setup-auth-card .switch:has(label:nth-of-type(2) input:checked)::before{transform:translateX(calc(100% + 4px))}
.setup-auth-card .switch label:has(input:checked){background:transparent;box-shadow:none;color:var(--ink)}
.setup-auth-card .switch label{min-height:32px;color:var(--muted)}
+.setup-auth-card .toggle-setting{display:flex;align-items:center;justify-content:space-between;gap:16px;margin:0;color:var(--ink);cursor:pointer}
+.setup-auth-card .toggle-setting>span:first-child{display:grid;gap:2px}
+.setup-auth-card .toggle-setting small{color:var(--muted);font-size:12px;line-height:18px;font-weight:400}
+.setup-auth-card .ptoggle{appearance:none;position:relative;flex:none;width:42px;height:24px;margin:0;border:0;border-radius:999px;background:var(--button-border-active);cursor:pointer;transition:background .2s ease}
+.setup-auth-card .ptoggle::after{content:'';position:absolute;width:18px;height:18px;left:3px;top:3px;border-radius:50%;background:linear-gradient(#fff 44%,#f3f3f3);box-shadow:0 3px 3px #00000008,0 .75px 0 #0000000d;transition:transform .2s ease}
+.setup-auth-card .ptoggle::before{content:'';position:absolute;z-index:1;left:8.25px;top:8.25px;width:7.5px;height:7.5px;border-radius:50%;background:var(--surface);box-shadow:inset 0 0 0 .375px var(--line);transition:transform .2s ease}
+.setup-auth-card .ptoggle:checked{background:var(--board-blue);box-shadow:inset 0 1.5px 0 #ffffff40,inset 0 0 0 .75px var(--color-accent-400)}
+.setup-auth-card .ptoggle:checked::after,.setup-auth-card .ptoggle:checked::before{transform:translateX(18px)}
+.setup-auth-card .ptoggle:checked::before{background:linear-gradient(var(--color-accent-700),var(--color-accent-500))}
+.setup-auth-card .ptoggle:focus-visible{outline:2px solid var(--tungsten);outline-offset:2px}
+.setup-auth-card .password-fields{margin-top:20px}
+.setup-auth-card .password-fields>label{display:block;margin:0 0 6px;color:var(--ink-2);font-size:14px;line-height:20px;font-weight:500}
+.setup-auth-card .password-fields>label:not(:first-child){margin-top:16px}
+.setup-auth-card .password-fields[hidden]{display:none}
.setup-auth-card summary:hover{color:var(--ink-2)}
.setup-auth-card .gselectfield{padding:0 12px;gap:8px;width:100%;color:var(--ink)}
.setup-auth-card .gselectfield>svg{width:16px;height:16px}
@@ -91,7 +107,7 @@ main:has(.setup-auth-card){width:100%;max-width:560px;padding:32px;box-shadow:0
.setup-auth-card input[type=text]{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888888' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 20H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h5l2 2h9a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2Z'/%3E%3C/svg%3E")}
.setup-auth-card input[type=password]{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888888' stroke-width='1.8' stroke-linecap='round'%3E%3Crect x='4' y='10' width='16' height='11' rx='2'/%3E%3Cpath d='M8 10V7a4 4 0 0 1 8 0v3M12 14v3'/%3E%3C/svg%3E")}
.setup-auth-card input[type=number]{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888888' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M4 9h16M3 15h16M10 3 8 21M16 3l-2 18'/%3E%3C/svg%3E")}
-.setup-auth-card .affix input[type=text]{padding-left:12px;background-image:none}
+.setup-auth-card .affix input:is([type=text],[type=number]){padding-left:12px;background-image:none}
.setup-auth-card .entry-input{display:block;position:relative;min-width:0;width:100%}
.setup-auth-card .dir>.entry-input{flex:1 1 0;width:0}
.setup-auth-card .entry-input>input{display:block;width:100%}
@@ -102,26 +118,23 @@ main:has(.setup-auth-card){width:100%;max-width:560px;padding:32px;box-shadow:0
.setup-auth-card{--button-border:#ebebeb;--button-border-hover:#d4d4d4;--button-border-active:#a3a3a3;--button-hover:#f7f7f7;--button-active:#ebebeb;--button-shadow:#0000000d;--button-disabled:linear-gradient(#ebebeb,#d4d4d4)}
@media(prefers-color-scheme:dark){:root:not([data-theme=light]) .setup-auth-card{--button-border:#404040;--button-border-hover:#737373;--button-border-active:#525252;--button-hover:color-mix(in srgb,#404040 60%,transparent);--button-active:#262626;--button-shadow:#0000002e;--button-disabled:linear-gradient(#404040,#262626)}}
:root[data-theme=dark] .setup-auth-card{--button-border:#404040;--button-border-hover:#737373;--button-border-active:#525252;--button-hover:color-mix(in srgb,#404040 60%,transparent);--button-active:#262626;--button-shadow:#0000002e;--button-disabled:linear-gradient(#404040,#262626)}
-.setup-auth-card :is(.pick,.add,button[type=submit],.setup-enter){display:inline-flex;align-items:center;justify-content:center;height:36px;padding:8px 12px;border-radius:10px;font-size:14px;font-weight:500;line-height:20px;white-space:nowrap;user-select:none;box-shadow:0 1px 2px var(--button-shadow);transition:background-color .15s ease,border-color .15s ease,box-shadow .15s ease,color .15s ease,transform .42s cubic-bezier(.4,0,.2,1)}
-.setup-auth-card :is(.pick,.add)[hidden]{display:none}
-.setup-auth-card button.pick{width:36px;padding:8px;align-self:flex-start;margin-top:2px}
+.setup-auth-card :is(.pick,.rm,.add,button[type=submit],.setup-enter){display:inline-flex;align-items:center;justify-content:center;height:36px;padding:8px 12px;border-radius:10px;font-size:14px;font-weight:500;line-height:20px;white-space:nowrap;user-select:none;box-shadow:0 1px 2px var(--button-shadow);transition:background-color .15s ease,border-color .15s ease,box-shadow .15s ease,color .15s ease,transform .42s cubic-bezier(.4,0,.2,1)}
+.setup-auth-card :is(.pick,.rm,.add)[hidden]{display:none}
+.setup-auth-card .dir :is(button.pick,button.rm){width:40px;height:40px;padding:10px;align-self:flex-start;margin-top:0}
.setup-auth-card .pick svg{width:20px;height:20px;flex:none}
.setup-auth-card button.add{padding-left:8px}
-.setup-auth-card :is(.pick,.add){background:var(--ground);border:1px solid var(--button-border);color:var(--ink)}
-.setup-auth-card :is(.pick,.add):hover:not(:disabled):not([aria-disabled=true]){background:var(--button-hover);border-color:var(--button-border-hover)}
-.setup-auth-card :is(.pick,.add):active:not(:disabled):not([aria-disabled=true]){background:var(--button-active);border-color:var(--button-border-active)}
-/* 首启和登录的提交键跟错误页那颗、跟站内每一颗主按钮同一张面:三档渐变都是
- `--board-blue` `--board-blue-hover` `--board-blue-active`,由
- `routes_pages._board_button_rules()` 从 `board.css` 送进来。悬停那一档同样铺在
- `::before` 上淡入,不直接换 `background`。按下那一下照旧配 0.98 的缩放,那是上游
- `button-press-motion` 那一份。 */
+.setup-auth-card :is(.pick,.rm,.add){background:var(--ground);border:1px solid var(--button-border);color:var(--ink)}
+.setup-auth-card :is(.pick,.rm,.add):hover:not(:disabled):not([aria-disabled=true]){background:var(--button-hover);border-color:var(--button-border-hover)}
+.setup-auth-card :is(.pick,.rm,.add):active:not(:disabled):not([aria-disabled=true]){background:var(--button-active);border-color:var(--button-border-active)}
+.setup-auth-card .rm:hover:not(:disabled):not([aria-disabled=true]){background:var(--drop);color:#fff;border-color:var(--drop)}
+/* 首启和登录的主操作与站内 Board primary 共用三档渐变。 */
.setup-auth-card :is(button[type=submit],.setup-enter){position:relative;isolation:isolate;border:0;color:#fff;background:var(--board-blue)}
.setup-auth-card :is(button[type=submit],.setup-enter)::before{content:"";position:absolute;inset:0;z-index:-1;pointer-events:none;border-radius:inherit;background:var(--board-blue-hover);opacity:0;transition:opacity .15s ease}
.setup-auth-card :is(button[type=submit],.setup-enter):hover:not(:disabled):not([aria-disabled=true])::before{opacity:1}
.setup-auth-card :is(button[type=submit],.setup-enter):active:not(:disabled):not([aria-disabled=true]){background:var(--board-blue-active)}
.setup-auth-card :is(button[type=submit],.setup-enter):active:not(:disabled):not([aria-disabled=true])::before{opacity:0}
-.setup-auth-card :is(.pick,.add,button[type=submit],.setup-enter):active:not(:disabled):not([aria-disabled=true]){transform:scale(.98);transition-duration:.15s,.15s,.15s,.15s,.22s}
-.setup-auth-card :is(.pick,.add,button[type=submit],.setup-enter):is(:disabled,[aria-disabled=true]){cursor:not-allowed;color:var(--muted);box-shadow:none;transform:none;background:var(--surface);border-color:var(--button-border)}
+.setup-auth-card :is(.pick,.rm,.add,button[type=submit],.setup-enter):active:not(:disabled):not([aria-disabled=true]){transform:scale(.98);transition-duration:.15s,.15s,.15s,.15s,.22s}
+.setup-auth-card :is(.pick,.rm,.add,button[type=submit],.setup-enter):is(:disabled,[aria-disabled=true]){cursor:not-allowed;color:var(--muted);box-shadow:none;transform:none;background:var(--surface);border-color:var(--button-border)}
.setup-auth-card :is(button[type=submit],.setup-enter):is(:disabled,[aria-disabled=true]){background:var(--button-disabled)}
-@media(prefers-reduced-motion:reduce){.setup-auth-card :is(.pick,.add,button[type=submit],.setup-enter),.setup-auth-card :is(.pick,.add,button[type=submit],.setup-enter):active{transition:none;transform:none}}
+@media(prefers-reduced-motion:reduce){.setup-auth-card :is(.pick,.rm,.add,button[type=submit],.setup-enter),.setup-auth-card :is(.pick,.rm,.add,button[type=submit],.setup-enter):active{transition:none;transform:none}.setup-auth-card .ptoggle,.setup-auth-card .ptoggle::after,.setup-auth-card .ptoggle::before{transition:none}}
@media(max-width:600px){body:has(.setup-auth-card){padding:24px 16px}main:has(.setup-auth-card){padding:24px}.setup-auth-card input[type=password]{font-size:16px}}
diff --git a/web/dist/peach-react.js b/web/dist/peach-react.js
index 33a59df26..733fc5824 100644
--- a/web/dist/peach-react.js
+++ b/web/dist/peach-react.js
@@ -29362,7 +29362,7 @@ function Hw(e, t, n) {
if (e.job_id && localStorage.getItem(Bw) === e.job_id) return;
e.job_id && localStorage.setItem(Bw, e.job_id);
} catch {}
- t(`扫描与资料采集已完成:识别 ${e.identified || 0} 个番号,整理 ${e.candidates || 0} 组资料候选`);
+ t(`扫描与资料采集已完成:识别 ${e.identified || 0} 个番号,整理 ${e.candidates || 0} 组资料候选,自动落库 ${e.auto_applied || 0} 条`);
}
}
//#endregion
@@ -29399,7 +29399,7 @@ var Ww = [{
label: "只采集",
icon: Uf,
command: { stage: "collect" }
-}], Gw = Um(qx, Jx, "text-body-2-medium"), Kw = "扫描媒体文件夹,导入已有资料,采集缺失信息。两段也可以分开跑:新盘刚接上时先只扫描,几万个文件登记完就能用;采集被网络拖住时只重跑采集,不必再扫一遍磁盘。", qw = "这个项目处理时间较长,暂时没有新进展。可以继续等待,或在任务结束后重试未完成项。", Jw = (e) => `已扫描 ${e.scanned || 0} 个文件,识别 ${e.identified || 0} 个番号,整理 ${e.candidates || 0} 组资料候选。`;
+}], Gw = Um(qx, Jx, "text-body-2-medium"), Kw = "扫描媒体文件夹,导入已有资料,采集缺失信息。两段也可以分开跑:新盘刚接上时先只扫描,几万个文件登记完就能用;采集被网络拖住时只重跑采集,不必再扫一遍磁盘。", qw = "这个项目处理时间较长,暂时没有新进展。可以继续等待,或在任务结束后重试未完成项。", Jw = (e) => `已扫描 ${e.scanned || 0} 个文件,识别 ${e.identified || 0} 个番号,整理 ${e.candidates || 0} 组资料候选,自动落库 ${e.auto_applied || 0} 条。`;
function Yw({ busy: e, onRun: t }) {
let n = (0, S.useRef)(null), [r, i] = (0, S.useState)(!1), a = (n) => {
e || (i(!1), t(n));
@@ -29764,7 +29764,7 @@ function lT(e, t, n, r, i, a = i || !e.has(r)) {
}
//#endregion
//#region src/react/review/review.ts
-var uT = "/api/review", dT = "/api/review/auto-apply", fT = "/api/review/decision", pT = "/api/review/genre", mT = ["review"], hT = ["review", "auto-apply"], gT = {
+var uT = "/api/review", dT = "/api/review/decision", fT = "/api/review/genre", pT = ["review"], mT = {
metadata_fields: "元数据字段",
creator_tags: "创作者标签",
studio_logos: "厂牌 Logo",
@@ -29775,15 +29775,15 @@ var uT = "/api/review", dT = "/api/review/auto-apply", fT = "/api/review/decisio
fc2_similarity: "FC2 跨号相似",
video_endcards: "片尾/出处证据",
media_failure: "无法识别"
-}, _T = Object.keys(gT), vT = "metadata_fields", yT = (e) => typeof e == "string" && Object.hasOwn(gT, e), bT = {
+}, hT = Object.keys(mT), gT = "metadata_fields", _T = (e) => typeof e == "string" && Object.hasOwn(mT, e), vT = {
creator_tags: "creator",
western_identity: "creator"
};
-function xT(e, t) {
+function yT(e, t) {
let n = [["candidates", t ? "按候选数量" : "全部待复核"]];
return e.some((e) => e.source || e.candidates?.some((e) => e.source)) && n.push(["source", "按来源"]), e.some((e) => e.field) && n.push(["field", "按字段"]), n;
}
-function ST(e, t) {
+function bT(e, t) {
let n = /* @__PURE__ */ new Map();
for (let r of e) {
let e, i;
@@ -29800,10 +29800,10 @@ function ST(e, t) {
}
return [...n.values()];
}
-function CT(e, t, n) {
- return n && ST(e, t).find((e) => e.key === n)?.rows || e;
+function xT(e, t, n) {
+ return n && bT(e, t).find((e) => e.key === n)?.rows || e;
}
-function wT(e, t) {
+function ST(e, t) {
let n = pb(e.length, 20), r = mb(t, n);
return {
page: r,
@@ -29811,32 +29811,32 @@ function wT(e, t) {
rows: e.slice((r - 1) * 20, r * 20)
};
}
-function TT(e) {
+function CT(e) {
return e.length ? [...new Set(e.flatMap((e) => e.candidates?.map((e) => e.source || "") || []))].filter((t) => t && e.every((e) => e.candidates?.filter((e) => e.source === t).length === 1)) : [];
}
-function ET(e, t, n, r, i, a) {
+function wT(e, t, n, r, i, a) {
return lT(e, t, n, r, i, a);
}
-function DT(e, t) {
+function TT(e, t) {
return e === "metadata_fields" ? (t.candidates?.length || 0) > 0 : e !== "creator_tags" || String(t.status || "").trim() === "candidate";
}
-function OT(e, t) {
+function ET(e, t) {
return String(e === "metadata_fields" ? t.query || t.code || "" : t.creator || t.studio || t.current_name || t.name || t.item_key);
}
-var kT = (e, t) => e === "metadata_fields" ? String(t.field_label || t.field || "").trim() : "";
-function AT(e, t) {
- let n = OT(e, t), r = kT(e, t);
+var DT = (e, t) => e === "metadata_fields" ? String(t.field_label || t.field || "").trim() : "";
+function OT(e, t) {
+ let n = ET(e, t), r = DT(e, t);
return r ? `${n} · ${r}` : n;
}
-var jT = (e) => e.reason || e.evidence || e.note || e.decision_note || "", MT = (e) => String(e.tags || "").split("|").filter(Boolean), NT = (e) => [...new Set((e.candidates || []).flatMap((e) => e.unmapped_genres || []))];
-function PT(e) {
+var kT = (e) => e.reason || e.evidence || e.note || e.decision_note || "", AT = (e) => String(e.tags || "").split("|").filter(Boolean), jT = (e) => [...new Set((e.candidates || []).flatMap((e) => e.unmapped_genres || []))];
+function MT(e) {
let t = e.candidates || [];
return {
candidateKey: t.length === 1 ? t[0].candidate_key : "",
assets: (e.preview_assets || []).map((e) => e.id)
};
}
-function FT(e, t, n, r) {
+function NT(e, t, n, r) {
let i = !!t.asset_path && t.asset_mutation_revision != null;
return {
category: e,
@@ -29852,35 +29852,19 @@ function FT(e, t, n, r) {
...i ? { expected_revision: t.asset_mutation_revision } : {}
};
}
-var IT = (e) => e === "approved" ? "已通过候选" : e === "rejected" ? "已拒绝候选" : "已跳过候选", LT = (e) => Ym(uT, e), RT = (e) => Xm(fT, e), zT = (e, t) => Xm(pT, {
+var PT = (e) => e === "approved" ? "已通过候选" : e === "rejected" ? "已拒绝候选" : "已跳过候选", FT = (e) => Ym(uT, e), IT = (e) => Xm(dT, e), LT = (e, t) => Xm(fT, {
genre: e,
tag: t
});
-async function BT(e) {
- try {
- let t = await Xm(dT, {}, "POST", e);
- return {
- state: "applied",
- applied: Number(t?.applied || 0)
- };
- } catch (t) {
- if (e?.aborted) throw t;
- return {
- state: "failed",
- error: J(t)
- };
- }
-}
-async function VT(e, t) {
- let n = e ? { state: "skipped" } : await BT(t);
- dh.setQueryData(hT, n), await dh.fetchQuery({
- queryKey: mT,
- queryFn: () => LT(t)
+async function RT(e) {
+ await dh.fetchQuery({
+ queryKey: pT,
+ queryFn: () => FT(e)
});
}
-function HT(e, t) {
+function zT(e, t) {
let n = new Set(t);
- n.size && dh.setQueryData(mT, (t) => {
+ n.size && dh.setQueryData(pT, (t) => {
if (!t) return t;
let r = t.sections[e] || [], i = r.filter((e) => !n.has(String(e.item_key)));
return i.length === r.length ? t : {
@@ -29896,17 +29880,17 @@ function HT(e, t) {
};
});
}
-var UT = () => dh.invalidateQueries({
- queryKey: mT,
+var BT = () => dh.invalidateQueries({
+ queryKey: pT,
exact: !0
});
-function WT(e, t) {
+function VT(e, t) {
return e?.state === "live" ? "正在显示写入端的实时复核队列" : e?.state === "cached" ? `写入端暂时不可达,显示 ${hb(e.fetched_at)} 的缓存` : e?.error || t;
}
//#endregion
//#region src/react/review/bulk-toolbar.tsx
-function GT(e) {
- let { groupOptions: t, groupBy: n, onGroupBy: r, groups: i, filter: a, onFilter: o, pageKeys: s, selected: c, onSelected: l, selectedRows: u, metadata: d, approvable: f, busy: p, feedback: m, onUnifySource: h, onRun: g } = e, _ = s.filter((e) => c.has(e)), v = _.length > 0 && _.length === s.length, y = TT(u), b = d && u.some((e) => (e.candidates?.length || 0) > 1), x = y.length ? "统一选择来源" : "所选项目无共同来源";
+function HT(e) {
+ let { groupOptions: t, groupBy: n, onGroupBy: r, groups: i, filter: a, onFilter: o, pageKeys: s, selected: c, onSelected: l, selectedRows: u, metadata: d, approvable: f, busy: p, feedback: m, onUnifySource: h, onRun: g } = e, _ = s.filter((e) => c.has(e)), v = _.length > 0 && _.length === s.length, y = CT(u), b = d && u.some((e) => (e.candidates?.length || 0) > 1), x = y.length ? "统一选择来源" : "所选项目无共同来源";
return /* @__PURE__ */ (0, C.jsxs)("div", {
role: "group",
"aria-label": "复核批量操作",
@@ -30014,7 +29998,7 @@ function GT(e) {
}
//#endregion
//#region src/react/review/candidate-form.tsx
-var KT = {
+var UT = {
title: "标题",
original_title: "原标题",
runtime: "来源时长",
@@ -30024,14 +30008,14 @@ var KT = {
cover_url: "封面",
screenshot_urls: "截图",
trailer_url: "预告片"
-}, qT = "reviewgenretags";
-function JT({ tags: e }) {
+}, WT = "reviewgenretags";
+function GT({ tags: e }) {
return e.length ? /* @__PURE__ */ (0, C.jsx)("datalist", {
- id: qT,
+ id: WT,
children: e.map((e) => /* @__PURE__ */ (0, C.jsx)("option", { value: e }, e))
}) : null;
}
-function YT({ candidate: e }) {
+function KT({ candidate: e }) {
let t = Object.entries(e.catalog_evidence || {}).filter(([, e]) => e && e.display_value), n = e.content_id || e.provider_id;
return /* @__PURE__ */ (0, C.jsxs)("span", {
className: "flex min-w-0 flex-1 flex-col",
@@ -30062,7 +30046,7 @@ function YT({ candidate: e }) {
children: [
/* @__PURE__ */ (0, C.jsx)("dt", {
className: "text-body-2-regular text-text-secondary",
- children: KT[e] || e
+ children: UT[e] || e
}),
/* @__PURE__ */ (0, C.jsx)("dd", {
className: "min-w-0 text-body-2-regular break-words text-text-primary",
@@ -30077,11 +30061,11 @@ function YT({ candidate: e }) {
}) : null]
});
}
-function XT({ row: e, fieldName: t, value: n, onChange: r, locked: i }) {
+function qT({ row: e, fieldName: t, value: n, onChange: r, locked: i }) {
let a = e.candidates || [];
return a.length ? a.length === 1 ? /* @__PURE__ */ (0, C.jsx)("div", {
className: "flex overflow-hidden rounded-surface border border-separator-border bg-background-secondary-default",
- children: /* @__PURE__ */ (0, C.jsx)(YT, { candidate: a[0] })
+ children: /* @__PURE__ */ (0, C.jsx)(KT, { candidate: a[0] })
}) : /* @__PURE__ */ (0, C.jsx)(pv, {
"aria-label": `${t || "候选"}的来源`,
value: n,
@@ -30091,22 +30075,22 @@ function XT({ row: e, fieldName: t, value: n, onChange: r, locked: i }) {
children: a.map((e) => /* @__PURE__ */ (0, C.jsxs)(mv, {
value: e.candidate_key,
className: "group flex cursor-pointer items-center gap-2 overflow-hidden rounded-surface border border-separator-border bg-background-secondary-default outline-none focus-visible:ring-2 focus-visible:ring-border-focus-ring data-selected:border-border-button-active data-disabled:cursor-not-allowed",
- children: [/* @__PURE__ */ (0, C.jsx)(YT, { candidate: e }), /* @__PURE__ */ (0, C.jsx)("span", {
+ children: [/* @__PURE__ */ (0, C.jsx)(KT, { candidate: e }), /* @__PURE__ */ (0, C.jsx)("span", {
className: "mr-3 inline-grid size-4 shrink-0 place-items-center rounded-full border border-border-checkbox-default group-data-selected:border-accent-600",
children: /* @__PURE__ */ (0, C.jsx)("span", { className: "size-2 rounded-full bg-transparent group-data-selected:bg-accent-600" })
})]
}, e.candidate_key))
}) : null;
}
-function ZT({ genre: e, tags: t, locked: n, toast: r }) {
+function JT({ genre: e, tags: t, locked: n, toast: r }) {
let [i, a] = (0, S.useState)(""), [o, s] = (0, S.useState)(""), c = ut({
- mutationFn: (t) => zT(e, t),
+ mutationFn: (t) => LT(e, t),
onSuccess: async (t, n) => {
if (!t.ok) {
s(t.error || "服务端拒绝了这次收录");
return;
}
- r(n ? `已把「${e}」收录为标签「${n}」` : `已把「${e}」判为非内容标签`), await UT();
+ r(n ? `已把「${e}」收录为标签「${n}」` : `已把「${e}」判为非内容标签`), await BT();
},
onError: (e) => s(J(e))
}), l = () => {
@@ -30134,7 +30118,7 @@ function ZT({ genre: e, tags: t, locked: n, toast: r }) {
className: "min-w-40 flex-1",
children: /* @__PURE__ */ (0, C.jsx)(Yy, {
size: "small",
- list: t.length ? qT : void 0,
+ list: t.length ? WT : void 0,
autoComplete: "off",
placeholder: "中文标签",
onKeyDown: (e) => {
@@ -30166,8 +30150,8 @@ function ZT({ genre: e, tags: t, locked: n, toast: r }) {
]
});
}
-function QT({ row: e, tags: t, locked: n, toast: r }) {
- let i = NT(e);
+function YT({ row: e, tags: t, locked: n, toast: r }) {
+ let i = jT(e);
return i.length ? /* @__PURE__ */ (0, C.jsxs)("div", {
role: "group",
"aria-label": "未收录 genre",
@@ -30175,7 +30159,7 @@ function QT({ row: e, tags: t, locked: n, toast: r }) {
children: [/* @__PURE__ */ (0, C.jsx)("h5", {
className: "text-body-2-medium text-text-secondary",
children: `未收录 genre · ${i.length}`
- }), i.map((e) => /* @__PURE__ */ (0, C.jsx)(ZT, {
+ }), i.map((e) => /* @__PURE__ */ (0, C.jsx)(JT, {
genre: e,
tags: t,
locked: n,
@@ -30185,9 +30169,9 @@ function QT({ row: e, tags: t, locked: n, toast: r }) {
}
//#endregion
//#region src/react/review/review-evidence.tsx
-var $T = (e = "") => /^https?:\/\//i.test(e) ? e : "", eE = (e = "") => $T(e) || (e.startsWith("/") && !e.startsWith("//") ? e : "");
-function tE({ url: e }) {
- let t = eE(e || ""), [n, r] = (0, S.useState)(!1);
+var XT = (e = "") => /^https?:\/\//i.test(e) ? e : "", ZT = (e = "") => XT(e) || (e.startsWith("/") && !e.startsWith("//") ? e : "");
+function QT({ url: e }) {
+ let t = ZT(e || ""), [n, r] = (0, S.useState)(!1);
return /* @__PURE__ */ (0, C.jsx)("div", {
className: "flex h-review-image items-center justify-center overflow-hidden rounded-surface bg-background-secondary-default",
children: t && !n ? /* @__PURE__ */ (0, C.jsx)("img", {
@@ -30202,7 +30186,7 @@ function tE({ url: e }) {
})
});
}
-function nE({ asset: e, openItem: t }) {
+function $T({ asset: e, openItem: t }) {
let n = e.name || "";
return /* @__PURE__ */ (0, C.jsxs)("div", {
className: "flex min-w-0 items-center gap-2.5 rounded-surface bg-background-secondary-default p-2",
@@ -30235,7 +30219,7 @@ function nE({ asset: e, openItem: t }) {
})]
});
}
-function rE({ kind: e, name: t, works: n, avatar: r, openEntity: i }) {
+function eE({ kind: e, name: t, works: n, avatar: r, openEntity: i }) {
return /* @__PURE__ */ (0, C.jsxs)("div", {
className: "flex min-w-0 items-center gap-3",
children: [/* @__PURE__ */ (0, C.jsx)("button", {
@@ -30258,8 +30242,8 @@ function rE({ kind: e, name: t, works: n, avatar: r, openEntity: i }) {
})]
});
}
-function iE({ row: e, openItem: t, openEntity: n, onReveal: r, revealing: i, note: a }) {
- let o = $T(e.profile_url || ""), s = (e.preview_assets || []).slice(0, 6), c = Math.max(0, Number(e.video_count || e.videos || 0));
+function tE({ row: e, openItem: t, openEntity: n, onReveal: r, revealing: i, note: a }) {
+ let o = XT(e.profile_url || ""), s = (e.preview_assets || []).slice(0, 6), c = Math.max(0, Number(e.video_count || e.videos || 0));
return /* @__PURE__ */ (0, C.jsxs)("section", {
className: "flex flex-col gap-3",
children: [
@@ -30284,7 +30268,7 @@ function iE({ row: e, openItem: t, openEntity: n, onReveal: r, revealing: i, not
children: `查看全部 ${c.toLocaleString()} 部作品`
})]
}),
- /* @__PURE__ */ (0, C.jsx)(tE, { url: e.preview_url }),
+ /* @__PURE__ */ (0, C.jsx)(QT, { url: e.preview_url }),
/* @__PURE__ */ (0, C.jsx)("p", {
className: "text-body-2-regular text-text-secondary",
children: "通过后记录身份判断。"
@@ -30327,7 +30311,7 @@ function iE({ row: e, openItem: t, openEntity: n, onReveal: r, revealing: i, not
]
});
}
-function aE({ assets: e, picked: t, onPicked: n, locked: r }) {
+function nE({ assets: e, picked: t, onPicked: n, locked: r }) {
let [i, a] = (0, S.useState)(null), o = new Set(t), s = (t, s) => {
if (r) return;
let c = new Set(o);
@@ -30403,19 +30387,19 @@ function aE({ assets: e, picked: t, onPicked: n, locked: r }) {
}
//#endregion
//#region src/react/review/review-card.tsx
-var oE = ih({
+var rE = ih({
variant: "outlined",
padding: "none",
className: "flex flex-col gap-4 px-5 pt-4"
-}), sE = (e) => e === "western_identity" ? "h-review-card-tall" : "h-review-card";
-function cE(e) {
- let { category: t, row: n, choice: r, onChoice: i, selected: a, onSelect: o, locked: s, busy: c, problem: l, genreTags: u, onDecide: d, handlers: f } = e, p = (0, S.useRef)(!1), m = t === "metadata_fields", h = bT[t] || "", g = String(n.creator || "").trim(), _ = !!h && !!g, v = AT(t, n), y = kT(t, n), b = OT(t, n), x = jT(n), w = MT(n), T = DT(t, n), E = n.comparison_assets || [], D = n.preview_assets || [], O = String(n.decision || "pending") !== "pending", k = E.length > 1 ? /* @__PURE__ */ (0, C.jsx)("div", {
+}), iE = (e) => e === "western_identity" ? "h-review-card-tall" : "h-review-card";
+function aE(e) {
+ let { category: t, row: n, choice: r, onChoice: i, selected: a, onSelect: o, locked: s, busy: c, problem: l, genreTags: u, onDecide: d, handlers: f } = e, p = (0, S.useRef)(!1), m = t === "metadata_fields", h = vT[t] || "", g = String(n.creator || "").trim(), _ = !!h && !!g, v = OT(t, n), y = DT(t, n), b = ET(t, n), x = kT(n), w = AT(n), T = TT(t, n), E = n.comparison_assets || [], D = n.preview_assets || [], O = String(n.decision || "pending") !== "pending", k = E.length > 1 ? /* @__PURE__ */ (0, C.jsx)("div", {
className: "flex flex-col gap-3",
- children: E.map((e) => /* @__PURE__ */ (0, C.jsx)(nE, {
+ children: E.map((e) => /* @__PURE__ */ (0, C.jsx)($T, {
asset: e,
openItem: f.openItem
}, e.id))
- }) : _ ? /* @__PURE__ */ (0, C.jsx)(rE, {
+ }) : _ ? /* @__PURE__ */ (0, C.jsx)(eE, {
kind: h,
name: g,
works: Number(n.video_count || n.videos || 0),
@@ -30425,14 +30409,14 @@ function cE(e) {
has_image: !!n.has_image,
avatar_focus: n.avatar_focus
} : null, null, h)
- }) : n.asset_id ? /* @__PURE__ */ (0, C.jsx)(nE, {
+ }) : n.asset_id ? /* @__PURE__ */ (0, C.jsx)($T, {
openItem: f.openItem,
asset: {
id: n.asset_id,
name: n.asset_name,
preview_url: n.asset_preview_url
}
- }) : null, A = m ? /* @__PURE__ */ (0, C.jsx)(XT, {
+ }) : null, A = m ? /* @__PURE__ */ (0, C.jsx)(qT, {
row: n,
fieldName: y,
value: r.candidateKey,
@@ -30441,7 +30425,7 @@ function cE(e) {
candidateKey: e
}),
locked: s
- }) : t === "creator_tags" ? D.length ? /* @__PURE__ */ (0, C.jsx)(aE, {
+ }) : t === "creator_tags" ? D.length ? /* @__PURE__ */ (0, C.jsx)(nE, {
assets: D,
picked: r.assets,
locked: s,
@@ -30454,14 +30438,14 @@ function cE(e) {
icon: Kf,
title: "这批作品尚未抽帧",
children: `${n.video_count || ""} 条作品还没有可用预览;批准后仍会按候选写入标签。`
- }) : t === "fc2_similarity" ? null : t === "western_identity" ? /* @__PURE__ */ (0, C.jsx)(iE, {
+ }) : t === "fc2_similarity" ? null : t === "western_identity" ? /* @__PURE__ */ (0, C.jsx)(tE, {
row: n,
openItem: f.openItem,
openEntity: f.openEntity,
onReveal: f.onReveal,
revealing: f.revealing,
note: f.revealNote
- }) : /* @__PURE__ */ (0, C.jsx)(tE, { url: n.preview_url }), j = _ ? k : y ? /* @__PURE__ */ (0, C.jsxs)("h4", {
+ }) : /* @__PURE__ */ (0, C.jsx)(QT, { url: n.preview_url }), j = _ ? k : y ? /* @__PURE__ */ (0, C.jsxs)("h4", {
className: "flex min-w-0 flex-wrap items-center gap-2",
children: [/* @__PURE__ */ (0, C.jsx)(Km, {
variant: "caption",
@@ -30480,7 +30464,7 @@ function cE(e) {
return /* @__PURE__ */ (0, C.jsxs)("section", {
"aria-label": v,
"data-review-key": n.item_key,
- className: `${oE} ${sE(t)} overflow-hidden`,
+ className: `${rE} ${iE(t)} overflow-hidden`,
children: [
/* @__PURE__ */ (0, C.jsxs)("header", {
className: "flex min-w-0 shrink-0 items-start gap-2",
@@ -30533,7 +30517,7 @@ function cE(e) {
})
}) : null,
A,
- /* @__PURE__ */ (0, C.jsx)(QT, {
+ /* @__PURE__ */ (0, C.jsx)(YT, {
row: n,
tags: u,
locked: s,
@@ -30590,8 +30574,8 @@ function cE(e) {
}
//#endregion
//#region src/react/review/review-page.tsx
-var lE = "flex min-h-9 cursor-pointer items-center justify-between gap-2 rounded-2lg p-2 text-left text-body-regular text-text-secondary outline-none hover:text-text-primary focus-visible:ring-2 focus-visible:ring-border-focus-ring data-selected:bg-background-tertiary-default data-selected:text-text-primary review-tight:min-h-10 review-tight:px-3 review-tight:py-2.5";
-function uE({ page: e, pages: t, onPage: n }) {
+var oE = "flex min-h-9 cursor-pointer items-center justify-between gap-2 rounded-2lg p-2 text-left text-body-regular text-text-secondary outline-none hover:text-text-primary focus-visible:ring-2 focus-visible:ring-border-focus-ring data-selected:bg-background-tertiary-default data-selected:text-text-primary review-tight:min-h-10 review-tight:px-3 review-tight:py-2.5";
+function sE({ page: e, pages: t, onPage: n }) {
return t <= 1 ? null : /* @__PURE__ */ (0, C.jsxs)("nav", {
"aria-label": "复核分页",
className: "flex w-full flex-wrap items-center justify-between gap-2",
@@ -30628,58 +30612,43 @@ function uE({ page: e, pages: t, onPage: n }) {
]
});
}
-function dE({ receipt: e }) {
- return !e || e.state === "skipped" ? null : e.state === "failed" ? /* @__PURE__ */ (0, C.jsx)(ch, {
- tone: "warning",
- title: "自动落库",
- children: `自动落库这一步没能执行:${e.error}`
- }) : /* @__PURE__ */ (0, C.jsx)(ch, {
- tone: e.applied ? "success" : "neutral",
- title: "自动落库",
- children: e.applied ? `${e.applied} 条候选补进了空字段,已从下面的队列里移走。` : "这一批候选没有可以直接补空的:字段已有值、几家来源给的值不一样,或者番号和文件名对不上,都要人来判。"
- });
-}
-function fE(e) {
- let { route: t, openItem: n, openEntity: r, revealSource: i, avatarInner: a, toast: o, readOnly: s, readOnlyMessage: c, writerUrl: l } = e, [u, d] = (0, S.useState)(yT(e.category) ? e.category : vT), [f, p] = (0, S.useState)("candidates"), [m, h] = (0, S.useState)(""), [g, _] = (0, S.useState)(1), [v, y] = (0, S.useState)(/* @__PURE__ */ new Set()), [b, x] = (0, S.useState)(/* @__PURE__ */ new Map()), [w, T] = (0, S.useState)(/* @__PURE__ */ new Map()), [E, D] = (0, S.useState)(""), O = (0, S.useRef)(null), [k, A] = (0, S.useState)(0), [j, M] = (0, S.useState)(""), N = (0, S.useRef)(!0);
+function cE(e) {
+ let { route: t, openItem: n, openEntity: r, revealSource: i, avatarInner: a, toast: o, readOnly: s, readOnlyMessage: c, writerUrl: l } = e, [u, d] = (0, S.useState)(_T(e.category) ? e.category : gT), [f, p] = (0, S.useState)("candidates"), [m, h] = (0, S.useState)(""), [g, _] = (0, S.useState)(1), [v, y] = (0, S.useState)(/* @__PURE__ */ new Set()), [b, x] = (0, S.useState)(/* @__PURE__ */ new Map()), [w, T] = (0, S.useState)(/* @__PURE__ */ new Map()), [E, D] = (0, S.useState)(""), O = (0, S.useRef)(null), [k, A] = (0, S.useState)(0), [j, M] = (0, S.useState)(""), N = (0, S.useRef)(!0);
(0, S.useEffect)(() => () => {
N.current = !1;
}, []);
let ee = lt({
- queryKey: mT,
- queryFn: ({ signal: e }) => LT(e)
- }), P = lt({
- queryKey: hT,
- queryFn: () => BT(),
- enabled: !1
- }), F = ee.data || {
+ queryKey: pT,
+ queryFn: ({ signal: e }) => FT(e)
+ }).data || {
sections: {},
counts: {}
- }, te = F.sections[u] || [], ne = u === "metadata_fields", re = s, ie = xT(te, ne), ae = ie.some(([e]) => e === f) ? f : "candidates", oe = ST(te, ae), se = oe.some((e) => e.key === m) ? m : "", ce = wT(CT(te, ae, se), g), le = ce.rows.map((e) => e.item_key), ue = new Set(le), de = oe.map((e) => ({
+ }, P = ee.sections[u] || [], F = u === "metadata_fields", te = s, ne = yT(P, F), re = ne.some(([e]) => e === f) ? f : "candidates", ie = bT(P, re), ae = ie.some((e) => e.key === m) ? m : "", oe = ST(xT(P, re, ae), g), se = oe.rows.map((e) => e.item_key), ce = new Set(se), le = ie.map((e) => ({
...e,
- rows: e.rows.filter((e) => ue.has(e.item_key))
- })).filter((e) => e.rows.length), fe = (e) => b.get(e.item_key) || PT(e), I = te.filter((e) => v.has(e.item_key)), L = (e) => {
+ rows: e.rows.filter((e) => ce.has(e.item_key))
+ })).filter((e) => e.rows.length), ue = (e) => b.get(e.item_key) || MT(e), de = P.filter((e) => v.has(e.item_key)), fe = (e) => {
let t = new Set(e);
y((e) => new Set([...e].filter((e) => !t.has(e)))), x((e) => new Map([...e].filter(([e]) => !t.has(e)))), T((e) => new Map([...e].filter(([e]) => !t.has(e))));
- }, pe = (e, t) => T((n) => new Map(n).set(e, t)), me = (e) => {
+ }, I = (e, t) => T((n) => new Map(n).set(e, t)), L = (e) => {
d(e), p("candidates"), h(""), _(1), y(/* @__PURE__ */ new Set()), x(/* @__PURE__ */ new Map()), T(/* @__PURE__ */ new Map()), D(""), O.current = null, t({ category: e === "metadata_fields" ? "" : e });
- }, he = ut({
- mutationFn: ({ row: e, status: t }) => RT(FT(u, e, t, fe(e))),
+ }, pe = ut({
+ mutationFn: ({ row: e, status: t }) => IT(NT(u, e, t, ue(e))),
onSuccess: (e, { row: t, status: n }) => {
if (!e.ok) {
- pe(t.item_key, e.error || "服务端拒绝了这次判定");
+ I(t.item_key, e.error || "服务端拒绝了这次判定");
return;
}
- HT(u, [t.item_key]), L([t.item_key]), o(IT(n));
+ zT(u, [t.item_key]), fe([t.item_key]), o(PT(n));
},
- onError: (e, { row: t }) => pe(t.item_key, J(e))
- }), ge = ut({
+ onError: (e, { row: t }) => I(t.item_key, J(e))
+ }), me = ut({
mutationFn: async (e) => {
- let t = I, n = [], r = [];
+ let t = de, n = [], r = [];
for (let [i, a] of t.entries()) {
if (!N.current) break;
D(`正在处理 ${i} / ${t.length}`);
try {
- let t = await RT(FT(u, a, e, fe(a)));
+ let t = await IT(NT(u, a, e, ue(a)));
if (!t.ok) throw Error(t.error || "服务端未采用该项");
n.push(a.item_key);
} catch (e) {
@@ -30693,40 +30662,40 @@ function fE(e) {
};
},
onSuccess: ({ status: e, done: t, failures: n }) => {
- HT(u, t), L(t), n.forEach(([e, t]) => pe(e, t)), D(""), o(`已${e === "approved" ? "通过" : "拒绝"} ${t.length} 项` + (n.length ? `,${n.length} 项未完成` : ""));
+ zT(u, t), fe(t), n.forEach(([e, t]) => I(e, t)), D(""), o(`已${e === "approved" ? "通过" : "拒绝"} ${t.length} 项` + (n.length ? `,${n.length} 项未完成` : ""));
},
onError: (e) => {
D(J(e));
}
- }), _e = (e) => {
- if (!(ge.isPending || !I.length)) {
- if (e === "approved" && ne && I.some((e) => !fe(e).candidateKey)) {
+ }), he = (e) => {
+ if (!(me.isPending || !de.length)) {
+ if (e === "approved" && F && de.some((e) => !ue(e).candidateKey)) {
D("请先为所选的多来源候选选择来源。");
return;
}
- D(""), ge.mutate(e);
+ D(""), me.mutate(e);
}
- }, ve = (e) => {
+ }, ge = (e) => {
x((t) => {
let n = new Map(t);
- for (let t of I) {
+ for (let t of de) {
let r = t.candidates?.find((t) => t.source === e);
r && n.set(t.item_key, {
- ...fe(t),
+ ...ue(t),
candidateKey: r.candidate_key
});
}
return n;
}), D(`已选择 ${e},点击通过所选采用。`);
- }, ye = async (e) => {
+ }, _e = async (e) => {
if (k) return;
A(e), M("");
let t = await i(e);
N.current && (A(0), M(t));
- }, be = WT(F.mirror, c), xe = F.genre_tags || [], Se = {
+ }, ve = VT(ee.mirror, c), ye = ee.genre_tags || [], be = {
openItem: n,
openEntity: r,
- onReveal: ye,
+ onReveal: _e,
revealing: k,
revealNote: j,
avatarInner: a,
@@ -30735,7 +30704,7 @@ function fE(e) {
return /* @__PURE__ */ (0, C.jsx)(lh, { children: /* @__PURE__ */ (0, C.jsxs)("div", {
className: "flex flex-col gap-5 pb-10",
children: [
- re ? /* @__PURE__ */ (0, C.jsx)(ch, {
+ te ? /* @__PURE__ */ (0, C.jsx)(ch, {
tone: "warning",
title: "本机只能浏览",
extra: l ? /* @__PURE__ */ (0, C.jsx)("p", {
@@ -30746,15 +30715,14 @@ function fE(e) {
children: "前往写入端复核"
})
}) : void 0,
- children: be
+ children: ve
}) : null,
- /* @__PURE__ */ (0, C.jsx)(dE, { receipt: P.data }),
- /* @__PURE__ */ (0, C.jsx)(JT, { tags: xe }),
+ /* @__PURE__ */ (0, C.jsx)(GT, { tags: ye }),
/* @__PURE__ */ (0, C.jsxs)(Ay, {
selectedKey: u,
onSelectionChange: (e) => {
let t = String(e);
- yT(t) && me(t);
+ _T(t) && L(t);
},
className: "flex flex-col gap-5 review-split:flex-row-reverse review-split:items-start review-split:gap-6",
children: [/* @__PURE__ */ (0, C.jsxs)("div", {
@@ -30766,12 +30734,12 @@ function fE(e) {
}), /* @__PURE__ */ (0, C.jsx)(My, {
"aria-labelledby": "reviewcategories",
className: "flex flex-wrap gap-1 review-split:flex-col review-split:flex-nowrap review-split:items-stretch",
- children: _T.map((e) => {
- let t = Number(F.counts[e] || 0);
+ children: hT.map((e) => {
+ let t = Number(ee.counts[e] || 0);
return /* @__PURE__ */ (0, C.jsxs)(Py, {
id: e,
- className: lE,
- children: [gT[e], t ? /* @__PURE__ */ (0, C.jsx)("span", {
+ className: oE,
+ children: [mT[e], t ? /* @__PURE__ */ (0, C.jsx)("span", {
className: "tabular-nums text-caption-1-medium text-text-secondary",
children: t.toLocaleString()
}) : null]
@@ -30782,36 +30750,36 @@ function fE(e) {
id: u,
className: "flex min-w-0 flex-1 flex-col gap-5",
children: [
- te.length && !re ? /* @__PURE__ */ (0, C.jsx)(GT, {
- groupOptions: ie,
- groupBy: ae,
+ P.length && !te ? /* @__PURE__ */ (0, C.jsx)(HT, {
+ groupOptions: ne,
+ groupBy: re,
onGroupBy: (e) => {
p(e), h(""), _(1);
},
- groups: oe,
- filter: se,
+ groups: ie,
+ filter: ae,
onFilter: (e) => {
h(e), _(1);
},
- pageKeys: le,
+ pageKeys: se,
selected: v,
onSelected: y,
- selectedRows: I,
- metadata: ne,
- approvable: I.every((e) => DT(u, e)),
- busy: ge.isPending,
+ selectedRows: de,
+ metadata: F,
+ approvable: de.every((e) => TT(u, e)),
+ busy: me.isPending,
feedback: E,
- onUnifySource: ve,
- onRun: _e
+ onUnifySource: ge,
+ onRun: he
}) : null,
- ce.rows.length ? de.map((e) => /* @__PURE__ */ (0, C.jsxs)("section", {
+ oe.rows.length ? le.map((e) => /* @__PURE__ */ (0, C.jsxs)("section", {
className: "flex flex-col gap-3",
- children: [de.length > 1 || ae !== "candidates" ? /* @__PURE__ */ (0, C.jsxs)("div", {
+ children: [le.length > 1 || re !== "candidates" ? /* @__PURE__ */ (0, C.jsxs)("div", {
className: "flex flex-wrap items-center gap-2",
children: [/* @__PURE__ */ (0, C.jsx)("h3", {
className: "text-body-medium text-text-primary",
children: `${e.title} · ${e.rows.length}`
- }), re ? null : /* @__PURE__ */ (0, C.jsx)(X, {
+ }), te ? null : /* @__PURE__ */ (0, C.jsx)(X, {
variant: "ghost",
size: "small",
onClick: () => {
@@ -30823,27 +30791,27 @@ function fE(e) {
})]
}) : null, /* @__PURE__ */ (0, C.jsx)("div", {
className: "review-grid gap-5",
- children: e.rows.map((e) => /* @__PURE__ */ (0, C.jsx)(cE, {
+ children: e.rows.map((e) => /* @__PURE__ */ (0, C.jsx)(aE, {
category: u,
row: e,
- choice: fe(e),
+ choice: ue(e),
onChoice: (t) => x((n) => new Map(n).set(e.item_key, t)),
selected: v.has(e.item_key),
onSelect: (t, n) => y((r) => {
let i = new Set(r);
- return O.current = ET(i, le, O.current, e.item_key, t, n), i;
+ return O.current = wT(i, se, O.current, e.item_key, t, n), i;
}),
- locked: re,
- busy: he.isPending && he.variables?.row.item_key === e.item_key,
+ locked: te,
+ busy: pe.isPending && pe.variables?.row.item_key === e.item_key,
problem: w.get(e.item_key) || "",
- genreTags: xe,
+ genreTags: ye,
onDecide: (t) => {
- he.isPending || ge.isPending || (T((t) => new Map([...t].filter(([t]) => t !== e.item_key))), he.mutate({
+ pe.isPending || me.isPending || (T((t) => new Map([...t].filter(([t]) => t !== e.item_key))), pe.mutate({
row: e,
status: t
}));
},
- handlers: Se
+ handlers: be
}, e.item_key))
})]
}, e.key)) : /* @__PURE__ */ (0, C.jsx)(oh, {
@@ -30851,9 +30819,9 @@ function fE(e) {
title: "暂无候选",
children: "该分类当前没有待人工复核的项目。"
}),
- /* @__PURE__ */ (0, C.jsx)(uE, {
- page: ce.page,
- pages: ce.pages,
+ /* @__PURE__ */ (0, C.jsx)(sE, {
+ page: oe.page,
+ pages: oe.pages,
onPage: _
})
]
@@ -30864,23 +30832,23 @@ function fE(e) {
}
//#endregion
//#region src/react/scraping/scraping.ts
-var pE = "/api/scraping", mE = "/api/scraping/settings", hE = "/api/scraping/check", gE = "/api/scraping/cover", _E = ["scraping"], vE = ["scraping", "cover"], yE = 2e3, bE = (e) => Ym(pE, e), xE = (e) => Ym(gE, e);
-async function SE(e) {
+var lE = "/api/scraping", uE = "/api/scraping/settings", dE = "/api/scraping/check", fE = "/api/scraping/cover", pE = ["scraping"], mE = ["scraping", "cover"], hE = 2e3, gE = (e) => Ym(lE, e), _E = (e) => Ym(fE, e);
+async function vE(e) {
await Promise.all([dh.fetchQuery({
- queryKey: _E,
- queryFn: () => bE(e)
+ queryKey: pE,
+ queryFn: () => gE(e)
}), dh.fetchQuery({
- queryKey: vE,
- queryFn: () => xE(e)
+ queryKey: mE,
+ queryFn: () => _E(e)
})]);
}
-function CE(e, t) {
+function yE(e, t) {
return `${t}${e.label === "来源页面" ? "" : " 高清图片"}:${e.ok ? "可连接" : "不能连接"}` + (e.width ? ` · ${e.width} × ${e.height}` : "") + (e.message ? `。${e.message}` : "");
}
//#endregion
//#region src/react/scraping/scraping-page.tsx
-var wE = [["peach", "Peach 代理"], ["direct", "直接连接"]], TE = [["paste", "粘贴 Cookie"], ["file", "导入文件"]];
-function EE({ source: e }) {
+var bE = [["peach", "Peach 代理"], ["direct", "直接连接"]], xE = [["paste", "粘贴 Cookie"], ["file", "导入文件"]];
+function SE({ source: e }) {
return /* @__PURE__ */ (0, C.jsx)("img", {
src: a({ source: e }),
alt: "",
@@ -30891,13 +30859,13 @@ function EE({ source: e }) {
className: "size-4 shrink-0 rounded-sm object-contain"
});
}
-function DE({ source: e, toast: t }) {
- let [n, r] = (0, S.useState)(e.network), [i, a] = (0, S.useState)(""), [o, s] = (0, S.useState)(""), [c, l] = (0, S.useState)(TE[0][0]), [u, d] = (0, S.useState)(""), [f, p] = (0, S.useState)(""), m = (0, S.useRef)(null);
+function CE({ source: e, toast: t }) {
+ let [n, r] = (0, S.useState)(e.network), [i, a] = (0, S.useState)(""), [o, s] = (0, S.useState)(""), [c, l] = (0, S.useState)(xE[0][0]), [u, d] = (0, S.useState)(""), [f, p] = (0, S.useState)(""), m = (0, S.useRef)(null);
function h() {
a(""), s(""), d(""), p(""), m.current && (m.current.value = "");
}
let g = ut({
- mutationFn: (t) => Xm(mE, {
+ mutationFn: (t) => Xm(uE, {
source: e.source,
network: n,
cookie: i,
@@ -30905,12 +30873,12 @@ function DE({ source: e, toast: t }) {
revoke: t
}),
onSuccess: (e, n) => {
- dh.setQueryData(_E, (t) => t && {
+ dh.setQueryData(pE, (t) => t && {
...t,
sources: t.sources.map((t) => t.source === e.saved.source ? e.saved : t)
}), h(), t(n ? "Cookie 已撤销" : "来源设置已保存");
}
- }), _ = ut({ mutationFn: () => Xm(hE, { source: e.source }) }), v = g.isPending || _.isPending, y = (e) => {
+ }), _ = ut({ mutationFn: () => Xm(dE, { source: e.source }) }), v = g.isPending || _.isPending, y = (e) => {
e.preventDefault(), !v && (_.reset(), g.mutate(!1));
}, b = () => {
v || (_.reset(), g.mutate(!0));
@@ -30940,7 +30908,7 @@ function DE({ source: e, toast: t }) {
onSubmit: y,
aside: /* @__PURE__ */ (0, C.jsxs)("span", {
className: "flex min-w-0 items-center gap-1",
- children: [/* @__PURE__ */ (0, C.jsx)(EE, { source: e.source }), /* @__PURE__ */ (0, C.jsx)(sS, {
+ children: [/* @__PURE__ */ (0, C.jsx)(SE, { source: e.source }), /* @__PURE__ */ (0, C.jsx)(sS, {
href: e.login,
children: e.login
})]
@@ -30954,7 +30922,7 @@ function DE({ source: e, toast: t }) {
onSelectionChange: (e) => {
e !== null && r(String(e));
},
- children: wE.map(([e, t]) => /* @__PURE__ */ (0, C.jsx)(mw, {
+ children: bE.map(([e, t]) => /* @__PURE__ */ (0, C.jsx)(mw, {
id: e,
children: t
}, e))
@@ -30984,7 +30952,7 @@ function DE({ source: e, toast: t }) {
l(e), h();
},
className: Px,
- children: TE.map(([e, t]) => /* @__PURE__ */ (0, C.jsx)(mv, {
+ children: xE.map(([e, t]) => /* @__PURE__ */ (0, C.jsx)(mv, {
value: e,
className: Fx,
children: t
@@ -31028,7 +30996,7 @@ function DE({ source: e, toast: t }) {
T ? /* @__PURE__ */ (0, C.jsx)(aS, { children: T }) : null,
E.map((t) => /* @__PURE__ */ (0, C.jsx)(ch, {
tone: t.ok ? "success" : "error",
- children: CE(t, e.label)
+ children: yE(t, e.label)
}, t.label))
]
}) : null,
@@ -31054,15 +31022,15 @@ function DE({ source: e, toast: t }) {
]
});
}
-function OE({ toast: e }) {
+function wE({ toast: e }) {
let [t, n] = (0, S.useState)(""), [r, i] = (0, S.useState)(!1), [a, o] = (0, S.useState)(null), s = lt({
- queryKey: vE,
- queryFn: ({ signal: e }) => xE(e),
- refetchInterval: (e) => e.state.data?.status === "running" && yE
+ queryKey: mE,
+ queryFn: ({ signal: e }) => _E(e),
+ refetchInterval: (e) => e.state.data?.status === "running" && hE
}), c = ut({
- mutationFn: () => Xm(gE, { code: t }),
+ mutationFn: () => Xm(fE, { code: t }),
onSuccess: () => {
- i(!0), o(null), dh.invalidateQueries({ queryKey: vE });
+ i(!0), o(null), dh.invalidateQueries({ queryKey: mE });
}
}), l = (s.data?.status ?? "idle") === "running";
(0, S.useEffect)(() => {
@@ -31117,18 +31085,18 @@ function OE({ toast: e }) {
] })
});
}
-function kE({ toast: e }) {
+function TE({ toast: e }) {
let t = lt({
- queryKey: _E,
- queryFn: ({ signal: e }) => bE(e)
+ queryKey: pE,
+ queryFn: ({ signal: e }) => gE(e)
}), n = t.data;
return n ? /* @__PURE__ */ (0, C.jsxs)(lh, { children: [
/* @__PURE__ */ (0, C.jsx)("p", {
className: "text-body-2-regular text-text-secondary",
children: "高清图片可能需要代理才能下载,请先检查连接。"
}),
- /* @__PURE__ */ (0, C.jsx)(OE, { toast: e }),
- (n.sources || []).map((t) => /* @__PURE__ */ (0, C.jsx)(DE, {
+ /* @__PURE__ */ (0, C.jsx)(wE, { toast: e }),
+ (n.sources || []).map((t) => /* @__PURE__ */ (0, C.jsx)(CE, {
source: t,
toast: e
}, t.source))
@@ -31140,16 +31108,16 @@ function kE({ toast: e }) {
}
//#endregion
//#region src/configuration-endpoints.ts
-var AE = "/api/configuration", jE = "/api/pick-folder", ME = ["configuration"], NE = (e) => Ym(AE, e);
-async function PE(e) {
+var EE = "/api/configuration", DE = "/api/pick-folder", OE = ["configuration"], kE = (e) => Ym(EE, e);
+async function AE(e) {
await dh.fetchQuery({
- queryKey: ME,
- queryFn: () => NE(e)
+ queryKey: OE,
+ queryFn: () => kE(e)
});
}
//#endregion
//#region src/react/boardui/components/base/switch/switch.tsx
-var FE = Wm({
+var jE = Wm({
sm: {
track: "h-4 w-7",
trackRadius: {
@@ -31211,8 +31179,8 @@ var FE = Wm({
}
}
});
-function IE({ state: e, size: t = "md", shape: n = "pill" }) {
- let r = FE[t];
+function ME({ state: e, size: t = "md", shape: n = "pill" }) {
+ let r = jE[t];
return /* @__PURE__ */ (0, C.jsx)("span", {
"aria-hidden": !0,
className: Um("relative shrink-0 transition-colors duration-200 ease", r.track, r.trackRadius[n], e.isSelected ? Um("bg-linear-to-b from-accent-500 to-accent-600", r.onShadow) : "bg-background-tertiary-default", e.isDisabled && "opacity-50", e.isFocusVisible && "ring-2 ring-border-focus-ring ring-offset-2"),
@@ -31222,12 +31190,12 @@ function IE({ state: e, size: t = "md", shape: n = "pill" }) {
})
});
}
-function LE({ className: e, children: t, size: n = "md", shape: r = "pill", ref: i, ...a }) {
+function NE({ className: e, children: t, size: n = "md", shape: r = "pill", ref: i, ...a }) {
return /* @__PURE__ */ (0, C.jsx)(kv, {
ref: i,
...a,
className: (t) => Um("group inline-flex items-center gap-2 select-none", t.isDisabled ? "cursor-not-allowed" : "cursor-pointer", typeof e == "function" ? e(t) : e),
- children: (e) => /* @__PURE__ */ (0, C.jsxs)(C.Fragment, { children: [/* @__PURE__ */ (0, C.jsx)(IE, {
+ children: (e) => /* @__PURE__ */ (0, C.jsxs)(C.Fragment, { children: [/* @__PURE__ */ (0, C.jsx)(ME, {
state: e,
size: n,
shape: r
@@ -31239,13 +31207,13 @@ function LE({ className: e, children: t, size: n = "md", shape: r = "pill", ref:
}
//#endregion
//#region src/react/settings/general-settings.tsx
-function RE({ data: e, receipt: t }) {
- return e.startup ? /* @__PURE__ */ (0, C.jsx)(zE, {
+function PE({ data: e, receipt: t }) {
+ return e.startup ? /* @__PURE__ */ (0, C.jsx)(FE, {
startup: e.startup,
receipt: t
}) : null;
}
-function zE({ startup: e, receipt: t }) {
+function FE({ startup: e, receipt: t }) {
let [n, r] = (0, S.useState)(e.enabled), [i, a] = (0, S.useState)(e.silent), [o, s] = (0, S.useState)(e.desktop), c = Zy(), l = e.available && !e.desktop_message;
return /* @__PURE__ */ (0, C.jsxs)(eS, {
title: "开机自启",
@@ -31260,7 +31228,7 @@ function zE({ startup: e, receipt: t }) {
/* @__PURE__ */ (0, C.jsxs)(tS, { children: [
/* @__PURE__ */ (0, C.jsx)(Zx, {
label: "开机后启动 Peach",
- children: /* @__PURE__ */ (0, C.jsx)(LE, {
+ children: /* @__PURE__ */ (0, C.jsx)(NE, {
"aria-label": "开机后启动 Peach",
isSelected: n,
isDisabled: !e.available,
@@ -31270,7 +31238,7 @@ function zE({ startup: e, receipt: t }) {
/* @__PURE__ */ (0, C.jsx)(Zx, {
label: "静默启动",
description: "静默启动仅显示托盘,开机后启动 Peach 打开时生效。",
- children: /* @__PURE__ */ (0, C.jsx)(LE, {
+ children: /* @__PURE__ */ (0, C.jsx)(NE, {
"aria-label": "静默启动",
isSelected: i,
isDisabled: !e.available || !n,
@@ -31280,7 +31248,7 @@ function zE({ startup: e, receipt: t }) {
/* @__PURE__ */ (0, C.jsx)(Zx, {
label: "在桌面创建快捷方式",
description: e.desktop_message || "双击图标打开 Peach 网页;卸载时一并移除。",
- children: /* @__PURE__ */ (0, C.jsx)(LE, {
+ children: /* @__PURE__ */ (0, C.jsx)(NE, {
"aria-label": "在桌面创建快捷方式",
isSelected: o,
isDisabled: !l,
@@ -31303,7 +31271,7 @@ function zE({ startup: e, receipt: t }) {
}
//#endregion
//#region src/react/settings/media-repair.tsx
-var BE = {
+var IE = {
status: "idle",
stage: "",
checked: 0,
@@ -31313,16 +31281,16 @@ var BE = {
failed: 0,
skipped: 0,
message: ""
-}, VE = (e) => Number(e).toLocaleString();
-function HE(e) {
+}, LE = (e) => Number(e).toLocaleString();
+function RE(e) {
if (e.status === "running") {
- let t = e.total ? `${VE(e.checked)} / ${VE(e.total)}` : "准备中";
+ let t = e.total ? `${LE(e.checked)} / ${LE(e.total)}` : "准备中";
return e.stage === "修复" && e.message ? `修复 ${t} · ${e.message}` : `${e.stage || "扫描"} ${t}`;
}
- return e.status === "complete" && (e.repaired || e.failed) ? e.failed ? `修好 ${VE(e.repaired)} 部,${VE(e.failed)} 部修不了` : `修好 ${VE(e.repaired)} 部` : "";
+ return e.status === "complete" && (e.repaired || e.failed) ? e.failed ? `修好 ${LE(e.repaired)} 部,${LE(e.failed)} 部修不了` : `修好 ${LE(e.repaired)} 部` : "";
}
-function UE({ initial: e }) {
- let [t, n] = (0, S.useState)(e || BE), [r, i] = (0, S.useState)(!1), a = Zy(), o = t.status === "running";
+function zE({ initial: e }) {
+ let [t, n] = (0, S.useState)(e || IE), [r, i] = (0, S.useState)(!1), a = Zy(), o = t.status === "running";
(0, S.useEffect)(() => {
let e = new AbortController(), t, r = async () => {
try {
@@ -31360,9 +31328,9 @@ function UE({ initial: e }) {
}) : null,
a.error || t.error ? /* @__PURE__ */ (0, C.jsx)(aS, { children: a.error || t.error }) : null
] }), /* @__PURE__ */ (0, C.jsx)(rS, {
- status: HE(t) ? /* @__PURE__ */ (0, C.jsx)("p", {
+ status: RE(t) ? /* @__PURE__ */ (0, C.jsx)("p", {
role: "status",
- children: HE(t)
+ children: RE(t)
}) : null,
children: o ? /* @__PURE__ */ (0, C.jsx)(X, {
onClick: c,
@@ -31378,23 +31346,23 @@ function UE({ initial: e }) {
}
//#endregion
//#region src/react/settings/release-updates.tsx
-var WE = /* @__PURE__ */ new Set([
+var BE = /* @__PURE__ */ new Set([
"downloading",
"verifying",
"extracting",
"preparing",
"restarting",
"installing"
-]), GE = [
+]), VE = [
65,
67,
90
-], KE = 120;
-function qE({ initial: e, initialJob: t }) {
+], HE = 120;
+function UE({ initial: e, initialJob: t }) {
let [n, r] = (0, S.useState)(e), [i, a] = (0, S.useState)(t || {
state: "idle",
progress: 0
- }), [o, c] = (0, S.useState)(""), l = Zy(), u = (0, S.useRef)(!1), d = (0, S.useRef)(!0), f = WE.has(i.state);
+ }), [o, c] = (0, S.useState)(""), l = Zy(), u = (0, S.useRef)(!1), d = (0, S.useRef)(!0), f = BE.has(i.state);
(0, S.useEffect)(() => (d.current = !0, () => {
d.current = !1;
}), []);
@@ -31411,7 +31379,7 @@ function qE({ initial: e, initialJob: t }) {
(0, S.useEffect)(() => {
i.state !== "ready" || u.current || (u.current = !0, m());
}, [i.state]), (0, S.useEffect)(() => {
- let e = new AbortController(), t = WE.has(i.state) ? 1e3 : 3e4, n, o = 0, s = async () => {
+ let e = new AbortController(), t = BE.has(i.state) ? 1e3 : 3e4, n, o = 0, s = async () => {
try {
let t = await Ym("/api/configuration/update-status", e.signal);
if (e.signal.aborted) return;
@@ -31424,9 +31392,9 @@ function qE({ initial: e, initialJob: t }) {
let n = await Ym("/api/configuration/automatic-updates", e.signal);
!e.signal.aborted && n.result && r(n.result);
} catch {
- o += 1, o >= KE && !e.signal.aborted && c("尚未连接到 Peach,请检查托盘后刷新页面。");
+ o += 1, o >= HE && !e.signal.aborted && c("尚未连接到 Peach,请检查托盘后刷新页面。");
}
- !e.signal.aborted && o < KE && (n = setTimeout(s, t));
+ !e.signal.aborted && o < HE && (n = setTimeout(s, t));
};
return n = setTimeout(s, t), () => {
e.abort(), clearTimeout(n);
@@ -31481,7 +31449,7 @@ function qE({ initial: e, initialJob: t }) {
/* @__PURE__ */ (0, C.jsx)(uh, {
label: "更新准备进度:下载、校验、解压、准备安装",
value: i.progress,
- stops: GE
+ stops: VE
}),
/* @__PURE__ */ (0, C.jsxs)(iS, { children: ["下载 → 校验 → 解压 → 准备安装 · ", i.message] }),
/* @__PURE__ */ (0, C.jsx)(iS, { children: v })
@@ -31517,30 +31485,30 @@ function qE({ initial: e, initialJob: t }) {
}
//#endregion
//#region src/react/settings/maintenance-settings.tsx
-var JE = [
+var WE = [
["6", "每 6 小时"],
["24", "每天"],
["168", "每周"]
];
-function YE({ data: e, receipt: t }) {
+function GE({ data: e, receipt: t }) {
return /* @__PURE__ */ (0, C.jsxs)("div", {
className: "flex flex-col gap-6",
children: [
- e.automatic_updates ? /* @__PURE__ */ (0, C.jsx)(XE, {
+ e.automatic_updates ? /* @__PURE__ */ (0, C.jsx)(KE, {
initial: e.automatic_updates,
receipt: t
}) : null,
- e.updates ? /* @__PURE__ */ (0, C.jsx)(qE, {
+ e.updates ? /* @__PURE__ */ (0, C.jsx)(UE, {
initial: e.updates,
initialJob: e.update_job
}) : null,
- /* @__PURE__ */ (0, C.jsx)(UE, {}),
- /* @__PURE__ */ (0, C.jsx)(ZE, { facts: e.facts }),
- e.uninstall ? /* @__PURE__ */ (0, C.jsx)(QE, { uninstall: e.uninstall }) : null
+ /* @__PURE__ */ (0, C.jsx)(zE, {}),
+ /* @__PURE__ */ (0, C.jsx)(qE, { facts: e.facts }),
+ e.uninstall ? /* @__PURE__ */ (0, C.jsx)(JE, { uninstall: e.uninstall }) : null
]
});
}
-function XE({ initial: e, receipt: t }) {
+function KE({ initial: e, receipt: t }) {
let [n, r] = (0, S.useState)(e.mode), [i, a] = (0, S.useState)(e.interval_hours), o = Zy(e.error), s = (r) => {
r.preventDefault(), e.available && o.run("save", (e) => Xm("/api/configuration/automatic-updates", {
mode: n,
@@ -31554,7 +31522,7 @@ function XE({ initial: e, receipt: t }) {
/* @__PURE__ */ (0, C.jsxs)(tS, { children: [
/* @__PURE__ */ (0, C.jsx)(Zx, {
label: "自动检查新版本",
- children: /* @__PURE__ */ (0, C.jsx)(LE, {
+ children: /* @__PURE__ */ (0, C.jsx)(NE, {
"aria-label": "自动检查新版本",
isSelected: n !== "off",
isDisabled: !e.available,
@@ -31563,7 +31531,7 @@ function XE({ initial: e, receipt: t }) {
}),
/* @__PURE__ */ (0, C.jsx)(Zx, {
label: "自动下载更新",
- children: /* @__PURE__ */ (0, C.jsx)(LE, {
+ children: /* @__PURE__ */ (0, C.jsx)(NE, {
"aria-label": "自动下载更新",
isSelected: n === "download",
isDisabled: !e.available || !e.download_available || n === "off",
@@ -31580,7 +31548,7 @@ function XE({ initial: e, receipt: t }) {
onSelectionChange: (e) => {
e !== null && a(Number(e));
},
- children: JE.map(([e, t]) => /* @__PURE__ */ (0, C.jsx)(mw, {
+ children: WE.map(([e, t]) => /* @__PURE__ */ (0, C.jsx)(mw, {
id: e,
children: t
}, e))
@@ -31600,7 +31568,7 @@ function XE({ initial: e, receipt: t }) {
]
});
}
-function ZE({ facts: e }) {
+function qE({ facts: e }) {
return /* @__PURE__ */ (0, C.jsx)(eS, {
title: "运行信息",
children: /* @__PURE__ */ (0, C.jsx)(cS, { children: e.map((e) => /* @__PURE__ */ (0, C.jsxs)(lS, {
@@ -31612,7 +31580,7 @@ function ZE({ facts: e }) {
}, e.term)) })
});
}
-function QE({ uninstall: e }) {
+function JE({ uninstall: e }) {
let [t, n] = (0, S.useState)(!1), [r, i] = (0, S.useState)(""), a = () => void s({
title: "卸载 Peach",
danger: !0,
@@ -31660,7 +31628,7 @@ function QE({ uninstall: e }) {
}
//#endregion
//#region src/react/settings/clouddrive-guide.tsx
-var $E = [
+var YE = [
{
name: "机械硬盘,或内存 8 GB 以内",
cache: "10–20 GiB",
@@ -31679,12 +31647,12 @@ var $E = [
read: "256 / 128 KB",
task: "2 个起步"
}
-], eD = [
+], XE = [
["cache", "缓存上限"],
["read", "读取长度(默认 / 最小)"],
["task", "同时处理视频"]
];
-function tD() {
+function ZE() {
return /* @__PURE__ */ (0, C.jsxs)("div", {
className: "@container flex flex-col gap-3",
children: [/* @__PURE__ */ (0, C.jsxs)(iS, { children: ["先在 CloudDrive 登录网盘并挂载,开启「启动时自动挂载」。", /* @__PURE__ */ (0, C.jsx)(sS, {
@@ -31697,14 +31665,14 @@ function tD() {
/* @__PURE__ */ (0, C.jsx)("ul", {
"aria-label": "按缓存所在硬盘分档",
className: "flex flex-col gap-2",
- children: $E.map((e) => /* @__PURE__ */ (0, C.jsxs)("li", {
+ children: YE.map((e) => /* @__PURE__ */ (0, C.jsxs)("li", {
className: "flex flex-col gap-2 rounded-2lg border border-separator-border bg-background-primary-default p-3",
children: [/* @__PURE__ */ (0, C.jsx)("p", {
className: "text-body-medium text-text-primary",
children: e.name
}), /* @__PURE__ */ (0, C.jsx)("dl", {
className: "inline-grid grid-cols-1 gap-2 @md:grid-cols-3",
- children: eD.map(([t, n]) => /* @__PURE__ */ (0, C.jsxs)("div", {
+ children: XE.map(([t, n]) => /* @__PURE__ */ (0, C.jsxs)("div", {
className: "flex flex-col",
children: [/* @__PURE__ */ (0, C.jsx)("dt", {
className: "text-caption-1-regular text-text-secondary",
@@ -31739,7 +31707,7 @@ function tD() {
}
//#endregion
//#region src/react/settings/library-icon-picker.tsx
-var nD = [
+var QE = [
["", "自动识别"],
["hard-drive", "磁盘"],
["database", "资料库"],
@@ -31783,13 +31751,13 @@ var nD = [
["star", "收藏"],
["tags", "主题"]
];
-function rD(e) {
+function $E(e) {
let t = e === "local" ? "" : o[e];
return t ? [t, "自动识别"] : ["hard-drive", "默认"];
}
-var iD = "auto";
-function aD({ value: e, label: t, kind: n = "local", onChange: r }) {
- let i = (0, S.useRef)(null), [a, o] = (0, S.useState)(!1), [s, c] = (0, S.useState)(e), [l, u] = rD(n);
+var eD = "auto";
+function tD({ value: e, label: t, kind: n = "local", onChange: r }) {
+ let i = (0, S.useRef)(null), [a, o] = (0, S.useState)(!1), [s, c] = (0, S.useState)(e), [l, u] = $E(n);
return /* @__PURE__ */ (0, C.jsxs)(C.Fragment, { children: [/* @__PURE__ */ (0, C.jsx)(X, {
ref: i,
variant: "secondary",
@@ -31803,7 +31771,7 @@ function aD({ value: e, label: t, kind: n = "local", onChange: r }) {
children: /* @__PURE__ */ (0, C.jsxs)("span", {
"data-icon-choice": !0,
className: "flex items-center gap-2",
- children: [/* @__PURE__ */ (0, C.jsx)(fS, { mark: e || l }), ((e) => e && nD.find(([t]) => t === e)?.[1] || u)(e)]
+ children: [/* @__PURE__ */ (0, C.jsx)(fS, { mark: e || l }), ((e) => e && QE.find(([t]) => t === e)?.[1] || u)(e)]
})
}), /* @__PURE__ */ (0, C.jsx)(K_, {
triggerRef: i,
@@ -31823,15 +31791,15 @@ function aD({ value: e, label: t, kind: n = "local", onChange: r }) {
}),
/* @__PURE__ */ (0, C.jsx)(pv, {
"aria-label": "候选图标",
- value: s || iD,
- onChange: (e) => c(e === iD ? "" : e),
+ value: s || eD,
+ onChange: (e) => c(e === eD ? "" : e),
className: "inline-grid grid-cols-7 gap-1",
- children: nD.map(([e, t]) => /* @__PURE__ */ (0, C.jsx)(mv, {
- value: e || iD,
+ children: QE.map(([e, t]) => /* @__PURE__ */ (0, C.jsx)(mv, {
+ value: e || eD,
"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, C.jsx)(fS, { mark: e || l })
- }, e || iD))
+ }, e || eD))
}),
/* @__PURE__ */ (0, C.jsxs)("div", {
className: "flex justify-end gap-2 border-t border-separator-border pt-2.5",
@@ -31853,8 +31821,8 @@ function aD({ value: e, label: t, kind: n = "local", onChange: r }) {
}
//#endregion
//#region src/react/settings/media-settings.tsx
-var oD = 8e3;
-function sD({ className: e }) {
+var nD = 8e3;
+function rD({ className: e }) {
return /* @__PURE__ */ (0, C.jsx)("svg", {
"aria-hidden": !0,
viewBox: "0 0 24 24",
@@ -31867,48 +31835,48 @@ function sD({ className: e }) {
children: /* @__PURE__ */ (0, C.jsx)("use", { href: "#i-folder-search" })
});
}
-var cD = [
+var iD = [
["local", "本地磁盘"],
["115", "CloudDrive · 115"],
["pikpak", "CloudDrive · PikPak"]
-], lD = (e) => cD.find(([t]) => t === e)?.[1] ?? e, uD = (e) => o[e] || "database", dD = (e = "") => ({
+], aD = (e) => iD.find(([t]) => t === e)?.[1] ?? e, oD = (e) => o[e] || "database", sD = (e = "") => ({
path: e,
location: "local",
root: "",
library: "",
library_icon: ""
});
-function fD(e) {
- let t = e.media_sources?.filter((e) => cD.some(([t]) => t === e.location));
+function cD(e) {
+ let t = e.media_sources?.filter((e) => iD.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) => dD(e));
+ })) : (e.media_dirs.length ? e.media_dirs : [""]).map((e) => sD(e));
}
-var pD = (e) => !(e instanceof qm) || e.status !== 400 ? null : e.body?.errors ?? null;
-function mD({ data: e, receipt: t }) {
+var lD = (e) => !(e instanceof qm) || e.status !== 400 ? null : e.body?.errors ?? null;
+function uD({ data: e, receipt: t }) {
return /* @__PURE__ */ (0, C.jsxs)("div", {
className: "flex flex-col gap-6",
- children: [e.editable ? /* @__PURE__ */ (0, C.jsx)(hD, {
+ children: [e.editable ? /* @__PURE__ */ (0, C.jsx)(dD, {
data: e,
receipt: t
}) : /* @__PURE__ */ (0, C.jsx)(ch, {
tone: "neutral",
title: "只读",
children: e.notice
- }), /* @__PURE__ */ (0, C.jsx)(_D, { data: e })]
+ }), /* @__PURE__ */ (0, C.jsx)(pD, { data: e })]
});
}
-function hD({ data: e, receipt: t }) {
- let [n, r] = (0, S.useState)(() => fD(e)), [i, a] = (0, S.useState)(String(e.port)), [o, s] = (0, S.useState)(!1), [c, l] = (0, S.useState)([]), [u, d] = (0, S.useState)(""), [f, p] = (0, S.useState)(""), [m, h] = (0, S.useState)(null), [g, _] = (0, S.useState)(null), [v, y] = (0, S.useState)(null), b = (0, S.useRef)(!1), x = (0, S.useRef)(e.revision), w = (0, S.useRef)([]), T = Zy();
+function dD({ data: e, receipt: t }) {
+ let [n, r] = (0, S.useState)(() => cD(e)), [i, a] = (0, S.useState)(String(e.port)), [o, s] = (0, S.useState)(!1), [c, l] = (0, S.useState)([]), [u, d] = (0, S.useState)(""), [f, p] = (0, S.useState)(""), [m, h] = (0, S.useState)(null), [g, _] = (0, S.useState)(null), [v, y] = (0, S.useState)(null), b = (0, S.useRef)(!1), x = (0, S.useRef)(e.revision), w = (0, S.useRef)([]), T = Zy();
(0, S.useLayoutEffect)(() => {
g !== null && (w.current[g]?.focus(), _(null));
}, [g]), (0, S.useEffect)(() => {
if (!m) return;
- let e = setTimeout(() => location.assign(m.url), oD);
+ let e = setTimeout(() => location.assign(m.url), nD);
return () => clearTimeout(e);
}, [m]);
let E = (e, t) => r((n) => n.map((n, r) => r === e ? {
@@ -31919,14 +31887,14 @@ function hD({ data: e, receipt: t }) {
for (; r.length <= e;) r.push("");
return r[e] = t, r;
}), O = () => {
- _(n.length), r((e) => [...e, dD()]);
+ _(n.length), r((e) => [...e, sD()]);
}, k = (e) => {
r((t) => t.filter((t, n) => n !== e)), l((t) => t.filter((t, n) => n !== e));
}, A = async (e) => {
if (!b.current) {
b.current = !0, y(e);
try {
- let { path: t } = await Xm(jE, { initial: n[e]?.path ?? "" });
+ let { path: t } = await Xm(DE, { initial: n[e]?.path ?? "" });
t && (E(e, { path: t }), D(e, ""));
} catch (t) {
D(e, J(t));
@@ -31935,7 +31903,7 @@ function hD({ data: e, receipt: t }) {
}
}
}, j = (r) => {
- r.preventDefault(), p(""), T.run("save", (t) => Xm(AE, {
+ r.preventDefault(), p(""), T.run("save", (t) => Xm(EE, {
revision: x.current,
media_dirs: n.map((e) => e.path),
...e.media_sources ? { media_sources: n } : {},
@@ -31944,7 +31912,7 @@ function hD({ data: e, receipt: t }) {
}, "POST", t), (e) => {
x.current = e.revision, l([]), d(""), t("已保存配置"), h(e);
}, (e) => {
- let t = pD(e);
+ let t = lD(e);
l(t?.media_dirs ?? []), d(t?.port ?? ""), t || p(J(e));
});
};
@@ -31997,7 +31965,7 @@ function hD({ data: e, receipt: t }) {
hint: c[r] || void 0
}),
/* @__PURE__ */ (0, C.jsx)(Uy, {
- icon: sD,
+ icon: rD,
"aria-label": "选择文件夹",
onClick: () => void A(r),
...Z(v === r)
@@ -32020,7 +31988,7 @@ function hD({ data: e, receipt: t }) {
}),
/* @__PURE__ */ (0, C.jsxs)("div", {
className: "flex flex-col gap-1.5",
- children: [/* @__PURE__ */ (0, C.jsx)(oS, { children: "媒体库图标" }), /* @__PURE__ */ (0, C.jsx)(aD, {
+ children: [/* @__PURE__ */ (0, C.jsx)(oS, { children: "媒体库图标" }), /* @__PURE__ */ (0, C.jsx)(tD, {
label: `媒体库图标 ${r + 1}`,
value: t.library_icon,
kind: t.location,
@@ -32035,10 +32003,10 @@ function hD({ data: e, receipt: t }) {
onSelectionChange: (e) => {
e !== null && E(r, { location: String(e) });
},
- children: cD.map(([e, t]) => /* @__PURE__ */ (0, C.jsxs)(mw, {
+ children: iD.map(([e, t]) => /* @__PURE__ */ (0, C.jsxs)(mw, {
id: e,
textValue: t,
- children: [/* @__PURE__ */ (0, C.jsx)(fS, { mark: uD(e) }), t]
+ children: [/* @__PURE__ */ (0, C.jsx)(fS, { mark: oD(e) }), t]
}, e))
})]
}),
@@ -32059,7 +32027,7 @@ function hD({ data: e, receipt: t }) {
})
]
}),
- M ? /* @__PURE__ */ (0, C.jsx)(tD, {}) : null,
+ M ? /* @__PURE__ */ (0, C.jsx)(ZE, {}) : null,
N.map((e) => /* @__PURE__ */ (0, C.jsxs)(iS, { children: [
"未检测到 ",
e.name,
@@ -32100,7 +32068,7 @@ function hD({ data: e, receipt: t }) {
})]
});
}
-function gD({ online: e }) {
+function fD({ online: e }) {
return e === !0 ? /* @__PURE__ */ (0, C.jsxs)("span", {
"data-mount": "online",
className: "inline-flex items-center gap-1.5 text-body-2-medium text-notification-success-foreground",
@@ -32124,21 +32092,21 @@ function gD({ online: e }) {
}), "未检测"]
});
}
-function _D({ data: e }) {
+function pD({ data: e }) {
let t = e.media_sources, n = Zy();
return t ? /* @__PURE__ */ (0, C.jsxs)(eS, {
title: "挂载状态",
children: [
/* @__PURE__ */ (0, C.jsx)(cS, { children: t.map((e, t) => /* @__PURE__ */ (0, C.jsxs)(lS, {
- term: /* @__PURE__ */ (0, C.jsxs)(C.Fragment, { children: [/* @__PURE__ */ (0, C.jsx)(fS, { mark: uD(e.location) }), lD(e.location)] }),
- children: [e.path || "未配置挂载点", /* @__PURE__ */ (0, C.jsx)(gD, { online: e.online })]
+ term: /* @__PURE__ */ (0, C.jsxs)(C.Fragment, { children: [/* @__PURE__ */ (0, C.jsx)(fS, { mark: oD(e.location) }), aD(e.location)] }),
+ children: [e.path || "未配置挂载点", /* @__PURE__ */ (0, C.jsx)(fD, { online: e.online })]
}, t)) }),
n.error ? /* @__PURE__ */ (0, C.jsx)(nS, {
divided: !0,
children: /* @__PURE__ */ (0, C.jsx)(aS, { children: n.error })
}) : null,
/* @__PURE__ */ (0, C.jsx)(rS, { children: /* @__PURE__ */ (0, C.jsx)(X, {
- onClick: () => void n.run("refresh", (e) => NE(e), (e) => dh.setQueryData(ME, e)),
+ onClick: () => void n.run("refresh", (e) => kE(e), (e) => dh.setQueryData(OE, e)),
...Z(n.busy === "refresh"),
children: "刷新挂载状态"
}) })
@@ -32147,12 +32115,12 @@ function _D({ data: e }) {
}
//#endregion
//#region src/react/settings/access-settings.tsx
-var vD = {
+var mD = {
legacy: "当前使用系统生成的访问口令。你可以设置自己的密码,或关闭登录要求。",
locked: "访问设置无法读取,请在本机检查配置文件。",
password: "已设置密码。新设备需要登录,保持登录时间在登录页选择。"
};
-function yD({ initial: e, receipt: t }) {
+function hD({ initial: e, receipt: t }) {
let [n, r] = (0, S.useState)(e), [i, a] = (0, S.useState)(""), [o, s] = (0, S.useState)(""), [c, l] = (0, S.useState)(""), [u, d] = (0, S.useState)(!1), [f, p] = (0, S.useState)({}), m = (0, S.useRef)(null), h = Zy(), g = (e) => {
e.preventDefault();
let f = {};
@@ -32173,7 +32141,7 @@ function yD({ initial: e, receipt: t }) {
let t = e instanceof qm ? e.body : null, n = t?.errors || t?.detail?.errors;
n ? p(n) : h.setError(J(e));
});
- }, _ = vD[n.mode], v = n.mode !== "locked";
+ }, _ = mD[n.mode], v = n.mode !== "locked";
return /* @__PURE__ */ (0, C.jsxs)(eS, {
title: "访问密码",
onSubmit: g,
@@ -32250,24 +32218,24 @@ function yD({ initial: e, receipt: t }) {
}
//#endregion
//#region src/react/settings/network-settings.tsx
-var bD = [
+var gD = [
["environment", "系统代理"],
["direct", "直连"],
["proxy", "自定义"]
];
-function xD({ data: e, receipt: t }) {
+function _D({ data: e, receipt: t }) {
return /* @__PURE__ */ (0, C.jsxs)("div", {
className: "flex flex-col gap-6",
- children: [e.peach_proxy ? /* @__PURE__ */ (0, C.jsx)(SD, {
+ children: [e.peach_proxy ? /* @__PURE__ */ (0, C.jsx)(vD, {
initial: e.peach_proxy,
receipt: t
- }) : null, e.access ? /* @__PURE__ */ (0, C.jsx)(yD, {
+ }) : null, e.access ? /* @__PURE__ */ (0, C.jsx)(hD, {
initial: e.access,
receipt: t
}) : null]
});
}
-function SD({ initial: e, receipt: t }) {
+function vD({ initial: e, receipt: t }) {
let [n, r] = (0, S.useState)(e), [i, a] = (0, S.useState)(e.mode), [o, s] = (0, S.useState)(""), c = Zy();
return /* @__PURE__ */ (0, C.jsxs)(eS, {
id: "peachProxy",
@@ -32290,7 +32258,7 @@ function SD({ initial: e, receipt: t }) {
onSelectionChange: (e) => {
e !== null && a(String(e));
},
- children: bD.map(([e, t]) => /* @__PURE__ */ (0, C.jsx)(mw, {
+ children: gD.map(([e, t]) => /* @__PURE__ */ (0, C.jsx)(mw, {
id: e,
children: t
}, e))
@@ -32326,10 +32294,10 @@ function SD({ initial: e, receipt: t }) {
}
//#endregion
//#region src/react/settings/configuration-page.tsx
-function CD({ receipt: e }) {
+function yD({ receipt: e }) {
let t = lt({
- queryKey: ME,
- queryFn: ({ signal: e }) => NE(e)
+ queryKey: OE,
+ queryFn: ({ signal: e }) => kE(e)
}), n = t.data;
if (!n) return /* @__PURE__ */ (0, C.jsx)("div", {
className: "configpage",
@@ -32350,36 +32318,36 @@ function CD({ receipt: e }) {
className: "configgroup",
children: "通用"
}) : null,
- n.startup ? /* @__PURE__ */ (0, C.jsx)(RE, { ...r }) : null,
+ n.startup ? /* @__PURE__ */ (0, C.jsx)(PE, { ...r }) : null,
/* @__PURE__ */ (0, C.jsx)("h2", {
className: "configgroup",
children: "媒体"
}),
- /* @__PURE__ */ (0, C.jsx)(mD, { ...r }),
+ /* @__PURE__ */ (0, C.jsx)(uD, { ...r }),
i ? /* @__PURE__ */ (0, C.jsx)("h2", {
className: "configgroup",
children: "网络与访问"
}) : null,
- i ? /* @__PURE__ */ (0, C.jsx)(xD, { ...r }) : null,
+ i ? /* @__PURE__ */ (0, C.jsx)(_D, { ...r }) : null,
/* @__PURE__ */ (0, C.jsx)("h2", {
className: "configgroup",
children: "更新与维护"
}),
- /* @__PURE__ */ (0, C.jsx)(YE, { ...r })
+ /* @__PURE__ */ (0, C.jsx)(GE, { ...r })
]
});
}
//#endregion
//#region src/react/stats/stats.ts
-var wD = "/api/stats", TD = ["stats"], ED = (e) => Ym(wD, e);
-async function DD(e) {
+var bD = "/api/stats", xD = ["stats"], SD = (e) => Ym(bD, e);
+async function CD(e) {
await dh.fetchQuery({
- queryKey: TD,
- queryFn: () => ED(e)
+ queryKey: xD,
+ queryFn: () => SD(e)
});
}
-var OD = (e, t) => t ? Math.round(e / t * 100) : 0, kD = (e) => e >= 3600 ? `${(e / 3600).toFixed(1)} 小时` : `${Math.round(e / 60)} 分钟`, AD = (e) => e.duration ? Math.min(e.play_seconds / e.duration, 1) * 100 : 0, jD = (e) => (e.max_reached || 0) * 100, MD = (e) => e.kind === "online" ? "在线直接观看" : AD(e) < jD(e) - 25 ? "快进扫过" : e.o_count ? `高潮 ${e.o_count}` : "正常观看", ND = (e) => `${e.kind === "online" ? "/follow/item/" : "/item/"}${e.id}`;
-function PD(e) {
+var wD = (e, t) => t ? Math.round(e / t * 100) : 0, TD = (e) => e >= 3600 ? `${(e / 3600).toFixed(1)} 小时` : `${Math.round(e / 60)} 分钟`, ED = (e) => e.duration ? Math.min(e.play_seconds / e.duration, 1) * 100 : 0, DD = (e) => (e.max_reached || 0) * 100, OD = (e) => e.kind === "online" ? "在线直接观看" : ED(e) < DD(e) - 25 ? "快进扫过" : e.o_count ? `高潮 ${e.o_count}` : "正常观看", kD = (e) => `${e.kind === "online" ? "/follow/item/" : "/item/"}${e.id}`;
+function AD(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,
@@ -32389,21 +32357,21 @@ function PD(e) {
}
//#endregion
//#region src/react/stats/radial-card.tsx
-var FD = [
+var jD = [
"stroke-chart-1",
"stroke-chart-2",
"stroke-chart-3",
"stroke-chart-4",
"stroke-chart-5",
"stroke-chart-6"
-], ID = [
+], MD = [
"bg-chart-1",
"bg-chart-2",
"bg-chart-3",
"bg-chart-4",
"bg-chart-5",
"bg-chart-6"
-], LD = [
+], ND = [
"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",
@@ -32411,10 +32379,10 @@ var FD = [
"aria-pressed:bg-chart-5/10 aria-pressed:ring-chart-5",
"aria-pressed:bg-chart-6/10 aria-pressed:ring-chart-6"
];
-function RD({ title: e, rows: t, unit: n = "个视频" }) {
+function PD({ title: e, rows: t, unit: n = "个视频" }) {
let [r, i] = (0, S.useState)(-1), [a, o] = (0, S.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 = PD(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 = AD(s.map((e) => e.value)), d = s[c], f = (e) => i((t) => t === e ? -1 : e);
return /* @__PURE__ */ (0, C.jsxs)("section", {
className: `${ih({ radius: "chart" })} flex flex-col gap-4 max-sm:p-4`,
children: [
@@ -32463,7 +32431,7 @@ function RD({ 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 ${FD[t % 6]}` : `cursor-pointer transition-opacity ${FD[t % 6]}`
+ className: c >= 0 && c !== t ? `cursor-pointer opacity-30 transition-opacity ${jD[t % 6]}` : `cursor-pointer transition-opacity ${jD[t % 6]}`
})
]
}, e.name))
@@ -32478,13 +32446,13 @@ function RD({ 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 ${LD[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 ${ND[t % 6]}`,
children: [
/* @__PURE__ */ (0, C.jsxs)("span", {
className: "flex min-w-0 items-center gap-1.5 text-caption-1-regular text-text-secondary",
children: [/* @__PURE__ */ (0, C.jsx)("i", {
"aria-hidden": !0,
- className: `size-3 shrink-0 rounded-sm ${ID[t % 6]}`
+ className: `size-3 shrink-0 rounded-sm ${MD[t % 6]}`
}), e.name]
}),
/* @__PURE__ */ (0, C.jsx)("b", {
@@ -32503,8 +32471,8 @@ function RD({ title: e, rows: t, unit: n = "个视频" }) {
}
//#endregion
//#region src/react/stats/stats-page.tsx
-var zD = 10, BD = `${ih()} flex flex-col gap-4`, VD = "添加媒体文件夹或关注来源,开始建立你的馆藏。", HD = "补全资料或添加标签后,这里会显示馆藏中的内容标签。", UD = "开始播放后,这里会显示最近的真实观看证据。", WD = "刮削或手动打标之后,这里会显示每个来源覆盖了多少视频。", GD = "添加媒体文件夹后,这里会显示存储空间。";
-function KD({ term: e, value: t }) {
+var FD = 10, ID = `${ih()} flex flex-col gap-4`, LD = "添加媒体文件夹或关注来源,开始建立你的馆藏。", RD = "补全资料或添加标签后,这里会显示馆藏中的内容标签。", zD = "开始播放后,这里会显示最近的真实观看证据。", BD = "刮削或手动打标之后,这里会显示每个来源覆盖了多少视频。", VD = "添加媒体文件夹后,这里会显示存储空间。";
+function HD({ term: e, value: t }) {
return /* @__PURE__ */ (0, C.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, C.jsx)("span", {
@@ -32516,7 +32484,7 @@ function KD({ term: e, value: t }) {
})]
});
}
-function qD({ term: e, value: t, total: n }) {
+function UD({ term: e, value: t, total: n }) {
return /* @__PURE__ */ (0, C.jsxs)("div", {
className: "flex flex-col gap-1.5 border-b border-separator-border py-3 last:border-b-0",
children: [/* @__PURE__ */ (0, C.jsxs)("p", {
@@ -32525,7 +32493,7 @@ function qD({ term: e, value: t, total: n }) {
className: "tabular-nums",
children: [t.toLocaleString(), /* @__PURE__ */ (0, C.jsxs)("span", {
className: "ml-1.5 text-caption-1-regular text-text-secondary",
- children: [OD(t, n), "%"]
+ children: [wD(t, n), "%"]
})]
})]
}), /* @__PURE__ */ (0, C.jsx)(uh, {
@@ -32535,7 +32503,7 @@ function qD({ term: e, value: t, total: n }) {
})]
});
}
-function JD({ term: e, figure: t, unit: n }) {
+function WD({ term: e, figure: t, unit: n }) {
return /* @__PURE__ */ (0, C.jsxs)("div", {
className: "flex shrink-0 flex-col gap-0.5 pb-5 md:w-64 md:pr-6 md:pb-0",
children: [
@@ -32554,26 +32522,26 @@ function JD({ term: e, figure: t, unit: n }) {
]
});
}
-function YD({ headline: e, children: t }) {
+function GD({ headline: e, children: t }) {
return /* @__PURE__ */ (0, C.jsxs)("div", {
- className: `${BD} md:flex-row md:gap-6`,
+ className: `${ID} md:flex-row md:gap-6`,
children: [e, /* @__PURE__ */ (0, C.jsx)("div", {
className: "min-w-0 grow",
children: t
})]
});
}
-function XD({ data: t, configurable: r, openMediaSettings: i }) {
+function KD({ data: t, configurable: r, openMediaSettings: i }) {
return t.by_loc.reduce((e, t) => e + t.videos, 0) ? /* @__PURE__ */ (0, C.jsxs)("div", {
className: "inline-grid w-full gap-5 md:grid-cols-2",
- children: [/* @__PURE__ */ (0, C.jsx)(RD, {
+ children: [/* @__PURE__ */ (0, C.jsx)(PD, {
title: "网盘与本地",
rows: t.by_loc.map((t) => ({
name: e[t.k] ?? t.k,
value: t.videos,
detail: n(t.bytes)
}))
- }), /* @__PURE__ */ (0, C.jsx)(RD, {
+ }), /* @__PURE__ */ (0, C.jsx)(PD, {
title: "媒体库",
rows: t.by_library.map((e) => ({
name: e.name,
@@ -32594,35 +32562,35 @@ function XD({ data: t, configurable: r, openMediaSettings: i }) {
size: "small",
children: "添加关注"
})] }),
- children: VD
+ children: LD
});
}
-function ZD({ attribution: e }) {
+function qD({ attribution: e }) {
let t = e.videos;
return /* @__PURE__ */ (0, C.jsxs)("div", {
className: "flex flex-col",
children: [
- /* @__PURE__ */ (0, C.jsx)(qD, {
+ /* @__PURE__ */ (0, C.jsx)(UD, {
term: "有创作者",
value: e.creator,
total: t
}),
- /* @__PURE__ */ (0, C.jsx)(qD, {
+ /* @__PURE__ */ (0, C.jsx)(UD, {
term: "有番号",
value: e.code,
total: t
}),
- /* @__PURE__ */ (0, C.jsx)(qD, {
+ /* @__PURE__ */ (0, C.jsx)(UD, {
term: "有厂牌",
value: e.studio,
total: t
}),
- /* @__PURE__ */ (0, C.jsx)(qD, {
+ /* @__PURE__ */ (0, C.jsx)(UD, {
term: "已抽帧",
value: e.thumb,
total: t
}),
- /* @__PURE__ */ (0, C.jsx)(qD, {
+ /* @__PURE__ */ (0, C.jsx)(UD, {
term: "已探测时长",
value: e.duration,
total: t
@@ -32630,7 +32598,7 @@ function ZD({ attribution: e }) {
]
});
}
-function QD({ volume: e }) {
+function JD({ volume: e }) {
let t = e.total, r = e.used ?? 0;
return /* @__PURE__ */ (0, C.jsxs)("article", {
className: "flex min-w-0 flex-col gap-1.5",
@@ -32642,7 +32610,7 @@ function QD({ volume: e }) {
children: e.label
}), /* @__PURE__ */ (0, C.jsx)("b", {
className: "text-body-2-medium whitespace-nowrap text-text-primary",
- children: t == null ? e.online ? "容量未取得" : "离线" : `${OD(r, t)}%`
+ children: t == null ? e.online ? "容量未取得" : "离线" : `${wD(r, t)}%`
})]
}),
/* @__PURE__ */ (0, C.jsx)("small", {
@@ -32666,10 +32634,10 @@ function QD({ volume: e }) {
]
});
}
-function $D({ volumes: e, configurable: t, openMediaSettings: n }) {
+function YD({ volumes: e, configurable: t, openMediaSettings: n }) {
return e.length ? /* @__PURE__ */ (0, C.jsx)("div", {
className: "flex flex-col gap-5",
- children: e.map((e) => /* @__PURE__ */ (0, C.jsx)(QD, { volume: e }, `${e.kind}:${e.label}`))
+ children: e.map((e) => /* @__PURE__ */ (0, C.jsx)(JD, { volume: e }, `${e.kind}:${e.label}`))
}) : /* @__PURE__ */ (0, C.jsx)(oh, {
shell: "plain",
icon: Wf,
@@ -32679,10 +32647,10 @@ function $D({ volumes: e, configurable: t, openMediaSettings: n }) {
onClick: n,
children: "添加媒体文件夹"
}) : void 0,
- children: GD
+ children: VD
});
}
-function eO({ tags: e, tagLabel: t, onTag: n }) {
+function XD({ tags: e, tagLabel: t, onTag: n }) {
let [r, i] = (0, S.useState)(!1);
if (!e.length) return /* @__PURE__ */ (0, C.jsx)(oh, {
shell: "plain",
@@ -32693,9 +32661,9 @@ function eO({ tags: e, tagLabel: t, onTag: n }) {
size: "small",
children: "补全资料"
}),
- children: HD
+ children: RD
});
- let a = r ? e : e.slice(0, zD);
+ let a = r ? e : e.slice(0, FD);
return /* @__PURE__ */ (0, C.jsxs)("div", {
className: "flex flex-col gap-3",
children: [/* @__PURE__ */ (0, C.jsx)("ol", {
@@ -32722,7 +32690,7 @@ function eO({ tags: e, tagLabel: t, onTag: n }) {
]
})
}, e.k))
- }), e.length > zD ? /* @__PURE__ */ (0, C.jsx)("div", {
+ }), e.length > FD ? /* @__PURE__ */ (0, C.jsx)("div", {
className: "flex justify-center",
children: /* @__PURE__ */ (0, C.jsx)(X, {
variant: "secondary",
@@ -32733,11 +32701,11 @@ function eO({ tags: e, tagLabel: t, onTag: n }) {
}) : null]
});
}
-function tO({ rows: e }) {
+function ZD({ rows: e }) {
return e.length ? /* @__PURE__ */ (0, C.jsx)("div", {
className: "flex flex-col gap-5",
children: e.map((e) => {
- let t = AD(e);
+ let t = ED(e);
return /* @__PURE__ */ (0, C.jsxs)("article", {
className: "flex flex-wrap items-center gap-x-6 gap-y-2",
children: [/* @__PURE__ */ (0, C.jsxs)("div", {
@@ -32745,14 +32713,14 @@ function tO({ rows: e }) {
children: [/* @__PURE__ */ (0, C.jsx)("h3", {
className: "min-w-0 text-body-2-medium text-text-primary",
children: /* @__PURE__ */ (0, C.jsx)("a", {
- href: ND(e),
+ href: kD(e),
"data-middle-truncate": !0,
className: "block max-w-full overflow-hidden whitespace-nowrap hover:underline",
children: e.name
})
}), /* @__PURE__ */ (0, C.jsxs)("p", {
className: "flex flex-wrap gap-3 text-caption-1-regular text-text-secondary",
- children: [/* @__PURE__ */ (0, C.jsx)("span", { children: e.creator ?? "" }), /* @__PURE__ */ (0, C.jsx)("span", { children: MD(e) })]
+ children: [/* @__PURE__ */ (0, C.jsx)("span", { children: e.creator ?? "" }), /* @__PURE__ */ (0, C.jsx)("span", { children: OD(e) })]
})]
}), /* @__PURE__ */ (0, C.jsxs)("div", {
className: "min-w-0 basis-40",
@@ -32761,7 +32729,7 @@ function tO({ rows: e }) {
value: t
}), /* @__PURE__ */ (0, C.jsx)("small", {
className: "mt-1.5 block text-caption-1-regular text-text-secondary",
- children: `真实 ${t.toFixed(0)}% · 到达 ${jD(e).toFixed(0)}%`
+ children: `真实 ${t.toFixed(0)}% · 到达 ${DD(e).toFixed(0)}%`
})]
})]
}, `${e.kind}:${e.id}`);
@@ -32775,10 +32743,10 @@ function tO({ rows: e }) {
size: "small",
children: "浏览馆藏"
}),
- children: UD
+ children: zD
});
}
-function nO({ sources: e, videos: t }) {
+function QD({ sources: e, videos: t }) {
return e.length ? /* @__PURE__ */ (0, C.jsx)("div", {
className: "inline-grid w-full gap-x-8 gap-y-6 sm:grid-cols-2",
children: e.map((e) => /* @__PURE__ */ (0, C.jsxs)("article", {
@@ -32817,10 +32785,10 @@ function nO({ sources: e, videos: t }) {
size: "small",
children: "补全资料"
}),
- children: WD
+ children: BD
});
}
-function rO({ id: e, label: t, figure: n, detail: r, icon: i, accent: a }) {
+function $D({ id: e, label: t, figure: n, detail: r, icon: i, accent: a }) {
return /* @__PURE__ */ (0, C.jsx)(Py, {
id: e,
className: Rx({
@@ -32836,17 +32804,17 @@ function rO({ id: e, label: t, figure: n, detail: r, icon: i, accent: a }) {
})
});
}
-function iO(e) {
+function eO(e) {
let t = lt({
- queryKey: TD,
- queryFn: ({ signal: e }) => ED(e)
+ queryKey: xD,
+ queryFn: ({ signal: e }) => SD(e)
}), r = t.data;
if (!r) return /* @__PURE__ */ (0, C.jsx)(lh, { children: /* @__PURE__ */ (0, C.jsx)(ch, {
tone: "error",
title: "读取失败",
children: t.error ? J(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 = OD(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 = wD(r.tag_cov, r.attribution.videos);
return /* @__PURE__ */ (0, C.jsxs)(lh, { children: [
/* @__PURE__ */ (0, C.jsx)("p", {
className: "text-caption-1-regular text-text-secondary",
@@ -32859,7 +32827,7 @@ function iO(e) {
"aria-label": "统计视图",
className: zx,
children: [
- /* @__PURE__ */ (0, C.jsx)(rO, {
+ /* @__PURE__ */ (0, C.jsx)($D, {
id: "inventory",
label: "馆藏视频",
icon: Lf,
@@ -32867,15 +32835,15 @@ function iO(e) {
figure: o.toLocaleString(),
detail: n(s)
}),
- /* @__PURE__ */ (0, C.jsx)(rO, {
+ /* @__PURE__ */ (0, C.jsx)($D, {
id: "viewing",
label: "看过",
icon: Vf,
accent: 1,
figure: i.played.toLocaleString(),
- detail: kD(i.play_seconds)
+ detail: TD(i.play_seconds)
}),
- /* @__PURE__ */ (0, C.jsx)(rO, {
+ /* @__PURE__ */ (0, C.jsx)($D, {
id: "coverage",
label: "内容标签",
icon: Qf,
@@ -32883,7 +32851,7 @@ function iO(e) {
figure: `${c}%`,
detail: `${r.tag_cov.toLocaleString()} / ${r.attribution.videos.toLocaleString()}`
}),
- /* @__PURE__ */ (0, C.jsx)(rO, {
+ /* @__PURE__ */ (0, C.jsx)($D, {
id: "storage",
label: "使用空间",
icon: Wf,
@@ -32895,15 +32863,15 @@ function iO(e) {
}),
/* @__PURE__ */ (0, C.jsx)(Fy, {
id: "inventory",
- children: /* @__PURE__ */ (0, C.jsx)(XD, {
+ children: /* @__PURE__ */ (0, C.jsx)(KD, {
data: r,
...e
})
}),
/* @__PURE__ */ (0, C.jsx)(Fy, {
id: "viewing",
- children: /* @__PURE__ */ (0, C.jsx)(YD, {
- headline: /* @__PURE__ */ (0, C.jsx)(JD, {
+ children: /* @__PURE__ */ (0, C.jsx)(GD, {
+ headline: /* @__PURE__ */ (0, C.jsx)(WD, {
term: "观看",
figure: i.played.toLocaleString(),
unit: "个作品有播放记录"
@@ -32911,31 +32879,31 @@ function iO(e) {
children: /* @__PURE__ */ (0, C.jsxs)("div", {
className: "inline-grid w-full gap-3 sm:grid-cols-2",
children: [
- /* @__PURE__ */ (0, C.jsx)(KD, {
+ /* @__PURE__ */ (0, C.jsx)(HD, {
term: "馆藏观看",
value: i.library_played
}),
- /* @__PURE__ */ (0, C.jsx)(KD, {
+ /* @__PURE__ */ (0, C.jsx)(HD, {
term: "在线直接观看",
value: i.online_played
}),
- /* @__PURE__ */ (0, C.jsx)(KD, {
+ /* @__PURE__ */ (0, C.jsx)(HD, {
term: "高潮计数",
value: i.o_total
}),
- /* @__PURE__ */ (0, C.jsx)(KD, {
+ /* @__PURE__ */ (0, C.jsx)(HD, {
term: "快进扫过",
value: i.skimmed
}),
- /* @__PURE__ */ (0, C.jsx)(KD, {
+ /* @__PURE__ */ (0, C.jsx)(HD, {
term: "明确不喜欢",
value: i.dislike
}),
- /* @__PURE__ */ (0, C.jsx)(KD, {
+ /* @__PURE__ */ (0, C.jsx)(HD, {
term: "看过了",
value: i.seen
}),
- /* @__PURE__ */ (0, C.jsx)(KD, {
+ /* @__PURE__ */ (0, C.jsx)(HD, {
term: "回收站",
value: i.trash
})
@@ -32945,24 +32913,24 @@ function iO(e) {
}),
/* @__PURE__ */ (0, C.jsx)(Fy, {
id: "coverage",
- children: /* @__PURE__ */ (0, C.jsx)(YD, {
- headline: /* @__PURE__ */ (0, C.jsx)(JD, {
+ children: /* @__PURE__ */ (0, C.jsx)(GD, {
+ headline: /* @__PURE__ */ (0, C.jsx)(WD, {
term: "内容标签覆盖",
figure: `${c}%`,
unit: `${r.tag_cov.toLocaleString()} / ${r.attribution.videos.toLocaleString()}`
}),
- children: /* @__PURE__ */ (0, C.jsx)(ZD, { attribution: r.attribution })
+ children: /* @__PURE__ */ (0, C.jsx)(qD, { attribution: r.attribution })
})
}),
/* @__PURE__ */ (0, C.jsx)(Fy, {
id: "storage",
- children: /* @__PURE__ */ (0, C.jsx)(YD, {
- headline: /* @__PURE__ */ (0, C.jsx)(JD, {
+ children: /* @__PURE__ */ (0, C.jsx)(GD, {
+ headline: /* @__PURE__ */ (0, C.jsx)(WD, {
term: "使用空间",
figure: String(a.measured),
unit: "个卷已取得容量"
}),
- children: /* @__PURE__ */ (0, C.jsx)($D, {
+ children: /* @__PURE__ */ (0, C.jsx)(YD, {
volumes: r.storage_volumes,
...e
})
@@ -33000,7 +32968,7 @@ function iO(e) {
/* @__PURE__ */ (0, C.jsx)(Fy, {
id: "tags",
className: "px-4 pt-3.5 pb-4",
- children: /* @__PURE__ */ (0, C.jsx)(eO, {
+ children: /* @__PURE__ */ (0, C.jsx)(XD, {
tags: r.top_tags,
...e
})
@@ -33008,12 +32976,12 @@ function iO(e) {
/* @__PURE__ */ (0, C.jsx)(Fy, {
id: "recent",
className: "px-4 pt-3.5 pb-4",
- children: /* @__PURE__ */ (0, C.jsx)(tO, { rows: r.recent })
+ children: /* @__PURE__ */ (0, C.jsx)(ZD, { rows: r.recent })
}),
/* @__PURE__ */ (0, C.jsx)(Fy, {
id: "sources",
className: "px-4 pt-3.5 pb-4",
- children: /* @__PURE__ */ (0, C.jsx)(nO, {
+ children: /* @__PURE__ */ (0, C.jsx)(QD, {
sources: r.tag_source,
videos: r.attribution.videos
})
@@ -33024,7 +32992,7 @@ function iO(e) {
}
//#endregion
//#region node_modules/d3-array/src/max.js
-function aO(e, t) {
+function tO(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 {
@@ -33035,7 +33003,7 @@ function aO(e, t) {
}
//#endregion
//#region node_modules/d3-array/src/min.js
-function oO(e, t) {
+function nO(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 {
@@ -33046,7 +33014,7 @@ function oO(e, t) {
}
//#endregion
//#region node_modules/d3-array/src/sum.js
-function sO(e, t) {
+function rO(e, t) {
let n = 0;
if (t === void 0) for (let t of e) (t = +t) && (n += t);
else {
@@ -33057,66 +33025,66 @@ function sO(e, t) {
}
//#endregion
//#region node_modules/d3-sankey/src/align.js
-function cO(e, t) {
+function iO(e, t) {
return e.sourceLinks.length ? e.depth : t - 1;
}
//#endregion
//#region node_modules/d3-sankey/src/constant.js
-function lO(e) {
+function aO(e) {
return function() {
return e;
};
}
//#endregion
//#region node_modules/d3-sankey/src/sankey.js
-function uO(e, t) {
- return fO(e.source, t.source) || e.index - t.index;
+function oO(e, t) {
+ return cO(e.source, t.source) || e.index - t.index;
}
-function dO(e, t) {
- return fO(e.target, t.target) || e.index - t.index;
+function sO(e, t) {
+ return cO(e.target, t.target) || e.index - t.index;
}
-function fO(e, t) {
+function cO(e, t) {
return e.y0 - t.y0;
}
-function pO(e) {
+function lO(e) {
return e.value;
}
-function mO(e) {
+function uO(e) {
return e.index;
}
-function hO(e) {
+function dO(e) {
return e.nodes;
}
-function gO(e) {
+function fO(e) {
return e.links;
}
-function _O(e, t) {
+function pO(e, t) {
let n = e.get(t);
if (!n) throw Error("missing: " + t);
return n;
}
-function vO({ nodes: e }) {
+function mO({ 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 yO() {
- let e = 0, t = 0, n = 1, r = 1, i = 24, a = 8, o, s = mO, c = cO, l, u, d = hO, f = gO, p = 6;
+function hO() {
+ let e = 0, t = 0, n = 1, r = 1, i = 24, a = 8, o, s = uO, c = iO, l, u, d = dO, f = fO, 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), vO(e), e;
+ return h(e), g(e), _(e), v(e), x(e), mO(e), e;
}
m.update = function(e) {
- return vO(e), e;
+ return mO(e), e;
}, m.nodeId = function(e) {
- return arguments.length ? (s = typeof e == "function" ? e : lO(e), m) : s;
+ return arguments.length ? (s = typeof e == "function" ? e : aO(e), m) : s;
}, m.nodeAlign = function(e) {
- return arguments.length ? (c = typeof e == "function" ? e : lO(e), m) : c;
+ return arguments.length ? (c = typeof e == "function" ? e : aO(e), m) : c;
}, m.nodeSort = function(e) {
return arguments.length ? (l = e, m) : l;
}, m.nodeWidth = function(e) {
@@ -33124,9 +33092,9 @@ function yO() {
}, m.nodePadding = function(e) {
return arguments.length ? (a = o = +e, m) : a;
}, m.nodes = function(e) {
- return arguments.length ? (d = typeof e == "function" ? e : lO(e), m) : d;
+ return arguments.length ? (d = typeof e == "function" ? e : aO(e), m) : d;
}, m.links = function(e) {
- return arguments.length ? (f = typeof e == "function" ? e : lO(e), m) : f;
+ return arguments.length ? (f = typeof e == "function" ? e : aO(e), m) : f;
}, m.linkSort = function(e) {
return arguments.length ? (u = e, m) : u;
}, m.size = function(i) {
@@ -33142,12 +33110,12 @@ function yO() {
for (let [e, r] of t.entries()) {
r.index = e;
let { source: t, target: i } = r;
- typeof t != "object" && (t = r.source = _O(n, t)), typeof i != "object" && (i = r.target = _O(n, i)), t.sourceLinks.push(r), i.targetLinks.push(r);
+ typeof t != "object" && (t = r.source = pO(n, t)), typeof i != "object" && (i = r.target = pO(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(sO(t.sourceLinks, pO), sO(t.targetLinks, pO)) : t.fixedValue;
+ for (let t of e) t.value = t.fixedValue === void 0 ? Math.max(rO(t.sourceLinks, lO), rO(t.targetLinks, lO)) : t.fixedValue;
}
function _({ nodes: e }) {
let t = e.length, n = new Set(e), r = /* @__PURE__ */ new Set(), i = 0;
@@ -33172,7 +33140,7 @@ function yO() {
}
}
function y({ nodes: t }) {
- let r = aO(t, (e) => e.depth) + 1, a = (n - e - i) / (r - 1), o = Array(r);
+ let r = tO(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];
@@ -33181,7 +33149,7 @@ function yO() {
return o;
}
function b(e) {
- let n = oO(e, (e) => (r - t - (e.length - 1) * o) / sO(e, pO));
+ let n = nO(e, (e) => (r - t - (e.length - 1) * o) / rO(e, lO));
for (let i of e) {
let e = t;
for (let t of i) {
@@ -33198,7 +33166,7 @@ function yO() {
}
function x(e) {
let n = y(e);
- o = Math.min(a, (r - t) / (aO(n, (e) => e.length) - 1)), b(n);
+ o = Math.min(a, (r - t) / (tO(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);
@@ -33217,7 +33185,7 @@ function yO() {
let i = (n / r - e.y0) * t;
e.y0 += i, e.y1 += i, D(e);
}
- l === void 0 && i.sort(fO), w(i, n);
+ l === void 0 && i.sort(cO), w(i, n);
}
}
function C(e, t, n) {
@@ -33233,7 +33201,7 @@ function yO() {
let i = (n / r - e.y0) * t;
e.y0 += i, e.y1 += i, D(e);
}
- l === void 0 && i.sort(fO), w(i, n);
+ l === void 0 && i.sort(cO), w(i, n);
}
}
function w(e, n) {
@@ -33254,12 +33222,12 @@ function yO() {
}
function D({ sourceLinks: e, targetLinks: t }) {
if (u === void 0) {
- for (let { source: { sourceLinks: e } } of t) e.sort(dO);
- for (let { target: { targetLinks: t } } of e) t.sort(uO);
+ for (let { source: { sourceLinks: e } } of t) e.sort(sO);
+ for (let { target: { targetLinks: t } } of e) t.sort(oO);
}
}
function O(e) {
- if (u === void 0) for (let { sourceLinks: t, targetLinks: n } of e) t.sort(dO), n.sort(uO);
+ if (u === void 0) for (let { sourceLinks: t, targetLinks: n } of e) t.sort(sO), n.sort(oO);
}
function k(e, t) {
let n = e.y0 - (e.sourceLinks.length - 1) * o / 2;
@@ -33289,15 +33257,15 @@ function yO() {
}
//#endregion
//#region node_modules/d3-path/src/path.js
-var bO = Math.PI, xO = 2 * bO, SO = 1e-6, CO = xO - SO;
-function wO() {
+var gO = Math.PI, _O = 2 * gO, vO = 1e-6, yO = _O - vO;
+function bO() {
this._x0 = this._y0 = this._x1 = this._y1 = null, this._ = "";
}
-function TO() {
- return new wO();
+function xO() {
+ return new bO();
}
-wO.prototype = TO.prototype = {
- constructor: wO,
+bO.prototype = xO.prototype = {
+ constructor: bO,
moveTo: function(e, t) {
this._ += "M" + (this._x0 = this._x1 = +e) + "," + (this._y0 = this._y1 = +t);
},
@@ -33318,11 +33286,11 @@ wO.prototype = TO.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 > SO) {
- if (!(Math.abs(u * s - c * l) > SO) || !i) this._ += "L" + (this._x1 = e) + "," + (this._y1 = t);
+ else if (d > vO) {
+ if (!(Math.abs(u * s - c * l) > vO) || !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((bO - Math.acos((m + d - h) / (2 * g * _))) / 2), y = v / _, b = v / g;
- Math.abs(y - 1) > SO && (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((gO - Math.acos((m + d - h) / (2 * g * _))) / 2), y = v / _, b = v / g;
+ Math.abs(y - 1) > vO && (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);
}
}
},
@@ -33330,7 +33298,7 @@ wO.prototype = TO.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) > SO || Math.abs(this._y1 - l) > SO) && (this._ += "L" + c + "," + l), n && (d < 0 && (d = d % xO + xO), d > CO ? this._ += "A" + n + "," + n + ",0,1," + u + "," + (e - o) + "," + (t - s) + "A" + n + "," + n + ",0,1," + u + "," + (this._x1 = c) + "," + (this._y1 = l) : d > SO && (this._ += "A" + n + "," + n + ",0," + +(d >= bO) + "," + 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) > vO || Math.abs(this._y1 - l) > vO) && (this._ += "L" + c + "," + l), n && (d < 0 && (d = d % _O + _O), d > yO ? this._ += "A" + n + "," + n + ",0,1," + u + "," + (e - o) + "," + (t - s) + "A" + n + "," + n + ",0,1," + u + "," + (this._x1 = c) + "," + (this._y1 = l) : d > vO && (this._ += "A" + n + "," + n + ",0," + +(d >= gO) + "," + 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";
@@ -33341,90 +33309,90 @@ wO.prototype = TO.prototype = {
};
//#endregion
//#region node_modules/d3-shape/src/constant.js
-function EO(e) {
+function SO(e) {
return function() {
return e;
};
}
//#endregion
//#region node_modules/d3-shape/src/point.js
-function DO(e) {
+function CO(e) {
return e[0];
}
-function OO(e) {
+function wO(e) {
return e[1];
}
//#endregion
//#region node_modules/d3-shape/src/array.js
-var kO = Array.prototype.slice;
+var TO = Array.prototype.slice;
//#endregion
//#region node_modules/d3-shape/src/link/index.js
-function AO(e) {
+function EO(e) {
return e.source;
}
-function jO(e) {
+function DO(e) {
return e.target;
}
-function MO(e) {
- var t = AO, n = jO, r = DO, i = OO, a = null;
+function OO(e) {
+ var t = EO, n = DO, r = CO, i = wO, a = null;
function o() {
- var o, s = kO.call(arguments), c = t.apply(this, s), l = n.apply(this, s);
- if (a ||= o = TO(), 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 = TO.call(arguments), c = t.apply(this, s), l = n.apply(this, s);
+ if (a ||= o = xO(), 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 : EO(+e), o) : r;
+ return arguments.length ? (r = typeof e == "function" ? e : SO(+e), o) : r;
}, o.y = function(e) {
- return arguments.length ? (i = typeof e == "function" ? e : EO(+e), o) : i;
+ return arguments.length ? (i = typeof e == "function" ? e : SO(+e), o) : i;
}, o.context = function(e) {
return arguments.length ? (a = e ?? null, o) : a;
}, o;
}
-function NO(e, t, n, r, i) {
+function kO(e, t, n, r, i) {
e.moveTo(t, n), e.bezierCurveTo(t = (t + r) / 2, n, t, i, r, i);
}
-function PO() {
- return MO(NO);
+function AO() {
+ return OO(kO);
}
//#endregion
//#region node_modules/d3-sankey/src/sankeyLinkHorizontal.js
-function FO(e) {
+function jO(e) {
return [e.source.x1, e.y0];
}
-function IO(e) {
+function MO(e) {
return [e.target.x0, e.y1];
}
-function LO() {
- return PO().source(FO).target(IO);
+function NO() {
+ return AO().source(jO).target(MO);
}
//#endregion
//#region src/react/taste/taste.ts
-var RO = "/api/taste", zO = "/api/taste/refresh", BO = "/api/taste/import", VO = "/api/taste/source", HO = (e) => ["taste", e], UO = ["taste", "refresh"], WO = [
+var PO = "/api/taste", FO = "/api/taste/refresh", IO = "/api/taste/import", LO = "/api/taste/source", RO = (e) => ["taste", e], zO = ["taste", "refresh"], BO = [
["7d", "最近 7 天"],
["30d", "最近 30 天"],
["90d", "最近 90 天"],
["365d", "最近一年"],
["all", "全部时间"]
-], GO = (e, t) => Ym(`${RO}?window=${e}`, t), KO = (e) => Ym(zO, e);
-async function qO(e, t) {
+], VO = (e, t) => Ym(`${PO}?window=${e}`, t), HO = (e) => Ym(FO, e);
+async function UO(e, t) {
await dh.fetchQuery({
- queryKey: HO(e),
- queryFn: () => GO(e, t)
+ queryKey: RO(e),
+ queryFn: () => VO(e, t)
});
}
-var JO = (e) => Xm(zO, {
+var WO = (e) => Xm(FO, {
window: e,
background: !0
-}), YO = (e, t) => Xm(VO, {
+}), GO = (e, t) => Xm(LO, {
operation: "remove",
source_key: e,
window: t
});
-async function XO(e) {
- let t = await fetch(BO, {
+async function KO(e) {
+ let t = await fetch(IO, {
method: "POST",
credentials: "same-origin",
headers: {
@@ -33442,34 +33410,34 @@ async function XO(e) {
}
return n;
}
-var ZO = 2e3, QO = 1e4, $O = (e) => e?.status === "running" ? ZO : QO, ek = (e) => e ? new Date(e).toLocaleDateString("zh-CN") : "—", tk = (e) => e >= 3600 ? `${(e / 3600).toFixed(1)} 小时` : `${Math.round(e / 60)} 分钟`, nk = (e) => Number(e.web_visits ?? e.score ?? e.visits ?? e.peach_items ?? 0);
-function rk(e) {
+var qO = 2e3, JO = 1e4, YO = (e) => e?.status === "running" ? qO : JO, XO = (e) => e ? new Date(e).toLocaleDateString("zh-CN") : "—", ZO = (e) => e >= 3600 ? `${(e / 3600).toFixed(1)} 小时` : `${Math.round(e / 60)} 分钟`, QO = (e) => Number(e.web_visits ?? e.score ?? e.visits ?? e.peach_items ?? 0);
+function $O(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 ik(e) {
- let t = e.map(nk), n = Math.max(1, ...t);
+function ek(e) {
+ let t = e.map(QO), n = Math.max(1, ...t);
return t.map((e) => Math.max(0, Math.min(100, e / n * 100)));
}
-var ak = {
+var tk = {
x: 160,
y: 140
-}, ok = [
+}, nk = [
25,
50,
75,
100
-], sk = (e, t, n) => {
+], rk = (e, t, n) => {
let r = e / t * Math.PI * 2 - Math.PI / 2;
- return [ak.x + Math.cos(r) * n, ak.y + Math.sin(r) * n];
+ return [tk.x + Math.cos(r) * n, tk.y + Math.sin(r) * n];
};
-function ck(e) {
+function ik(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] = sk(r, t.length, Number(e.score) / n * 100), [o, s] = sk(r, t.length, 116);
+ let [i, a] = rk(r, t.length, Number(e.score) / n * 100), [o, s] = rk(r, t.length, 116);
return {
name: e.name,
x: i,
@@ -33479,7 +33447,7 @@ function ck(e) {
};
});
}
-var lk = (e, t) => Array.from({ length: t }, (n, r) => sk(r, t, e).map((e) => e.toFixed(2)).join(",")).join(" "), uk = (e) => e.map((e) => `${e.x.toFixed(2)},${e.y.toFixed(2)}`).join(" "), dk = [
+var ak = (e, t) => Array.from({ length: t }, (n, r) => rk(r, t, e).map((e) => e.toFixed(2)).join(",")).join(" "), ok = (e) => e.map((e) => `${e.x.toFixed(2)},${e.y.toFixed(2)}`).join(" "), sk = [
"周一",
"周二",
"周三",
@@ -33487,8 +33455,8 @@ var lk = (e, t) => Array.from({ length: t }, (n, r) => sk(r, t, e).map((e) => e.
"周五",
"周六",
"周日"
-], fk = (e, t) => e ? Math.max(.12, e / t) : 0;
-function pk(e) {
+], ck = (e, t) => e ? Math.max(.12, e / t) : 0;
+function lk(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;
@@ -33498,14 +33466,14 @@ function pk(e) {
return {
cells: t.flatMap((e, t) => e.map((e, n) => ({
key: `${t}-${n}`,
- label: `${dk[t]} ${n}:00`,
+ label: `${sk[t]} ${n}:00`,
count: e,
- share: fk(e, r)
+ share: ck(e, r)
}))),
total: n.reduce((e, t) => e + t, 0)
};
}
-function mk(e) {
+function uk(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,
@@ -33523,7 +33491,7 @@ function mk(e) {
key: r,
label: r,
count: s,
- share: fk(s, o)
+ share: ck(s, o)
};
});
return {
@@ -33533,17 +33501,17 @@ function mk(e) {
end: t.at(-1).date
};
}
-var hk = {
+var dk = {
width: 720,
height: 435
-}, gk = {
+}, fk = {
source: 145,
target: 545
};
-function _k(e = []) {
+function pk(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 = yO().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 = hO().nodeId((e) => e.id).nodeWidth(10).nodePadding(22).extent([[155, 16], [535, 404]])({
nodes: [...n.map((e) => ({
id: `source:${e}`,
name: e,
@@ -33558,7 +33526,7 @@ function _k(e = []) {
target: `target:${e.target}`,
value: e.value
}))
- }), a = t.reduce((e, t) => e + t.value, 0), o = LO();
+ }), a = t.reduce((e, t) => e + t.value, 0), o = NO();
return {
nodes: i.nodes.map((e) => ({
id: e.id,
@@ -33588,22 +33556,22 @@ function _k(e = []) {
total: a
};
}
-var vk = (e) => e.length > 18 ? `${e.slice(0, 16)}…` : e, yk = [
+var mk = (e) => e.length > 18 ? `${e.slice(0, 16)}…` : e, hk = [
"stroke-chart-1",
"stroke-chart-2",
"stroke-chart-3",
"stroke-chart-4",
"stroke-chart-5",
"stroke-chart-6"
-], bk = [
+], gk = [
"fill-chart-1",
"fill-chart-2",
"fill-chart-3",
"fill-chart-4",
"fill-chart-5",
"fill-chart-6"
-], xk = `${ih({ radius: "chart" })} flex flex-col gap-4 max-sm:p-4`;
-function Sk({ title: e, figure: t, note: n }) {
+], _k = `${ih({ radius: "chart" })} flex flex-col gap-4 max-sm:p-4`;
+function vk({ title: e, figure: t, note: n }) {
return /* @__PURE__ */ (0, C.jsxs)("header", {
className: "flex flex-wrap items-end justify-between gap-x-4 gap-y-1",
children: [/* @__PURE__ */ (0, C.jsxs)("span", {
@@ -33621,8 +33589,8 @@ function Sk({ title: e, figure: t, note: n }) {
})]
});
}
-function Ck({ rows: e, label: t }) {
- let n = ck(e);
+function yk({ rows: e, label: t }) {
+ let n = ik(e);
if (!n.length) return null;
let r = n.length;
return /* @__PURE__ */ (0, C.jsxs)("svg", {
@@ -33632,14 +33600,14 @@ function Ck({ rows: e, label: t }) {
className: "block w-full overflow-visible",
children: [
/* @__PURE__ */ (0, C.jsx)("title", { children: n.map((e) => e.name).join(",") }),
- ok.map((e) => /* @__PURE__ */ (0, C.jsx)("polygon", {
- points: lk(e, r),
+ nk.map((e) => /* @__PURE__ */ (0, C.jsx)("polygon", {
+ points: ak(e, r),
fill: "none",
className: "stroke-separator-border",
strokeWidth: 1
}, e)),
/* @__PURE__ */ (0, C.jsx)("polygon", {
- points: uk(n),
+ points: ok(n),
strokeWidth: 2,
strokeLinejoin: "round",
fillOpacity: .18,
@@ -33656,10 +33624,10 @@ function Ck({ rows: e, label: t }) {
]
});
}
-function wk({ rows: e, label: t }) {
+function bk({ 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 = ik(n);
+ let r = ek(n);
return /* @__PURE__ */ (0, C.jsx)("ol", {
"aria-label": t,
className: "flex flex-col gap-2",
@@ -33692,12 +33660,12 @@ function wk({ rows: e, label: t }) {
}, e.name))
});
}
-function Tk({ title: e, unit: t, cells: n, total: r, columns: i, rows: a, axis: o, footer: s }) {
+function xk({ title: e, unit: t, cells: n, total: r, columns: i, rows: a, axis: o, footer: s }) {
let [c, l] = (0, S.useState)(null), u = o ? 30 : 0, d = o ? 18 : 0;
return /* @__PURE__ */ (0, C.jsxs)("section", {
- className: xk,
+ className: _k,
children: [
- /* @__PURE__ */ (0, C.jsx)(Sk, {
+ /* @__PURE__ */ (0, C.jsx)(vk, {
title: e,
figure: (c ? c.count : r).toLocaleString(),
note: c ? c.label : t
@@ -33737,11 +33705,11 @@ function Tk({ title: e, unit: t, cells: n, total: r, columns: i, rows: a, axis:
]
});
}
-var Ek = "口味网站访问";
-function Dk({ activity: e }) {
- let t = pk(e), n = mk(e);
+var Sk = "口味网站访问";
+function Ck({ activity: e }) {
+ let t = lk(e), n = uk(e);
if (!n.cells.length) return /* @__PURE__ */ (0, C.jsxs)("section", {
- className: xk,
+ className: _k,
children: [/* @__PURE__ */ (0, C.jsx)("h3", {
className: "text-title-2-medium text-text-primary",
children: "浏览活跃时间"
@@ -33750,7 +33718,7 @@ function Dk({ activity: e }) {
children: "还没有可用于分析的口味网站访问记录。"
})]
});
- let r = /* @__PURE__ */ (0, C.jsxs)(C.Fragment, { children: [dk.map((e, t) => /* @__PURE__ */ (0, C.jsx)("text", {
+ let r = /* @__PURE__ */ (0, C.jsxs)(C.Fragment, { children: [sk.map((e, t) => /* @__PURE__ */ (0, C.jsx)("text", {
x: 0,
y: 18 + t * 17 + 7,
dominantBaseline: "middle",
@@ -33765,18 +33733,18 @@ function Dk({ activity: e }) {
}, t))] });
return /* @__PURE__ */ (0, C.jsxs)("div", {
className: "inline-grid w-full gap-5 lg:grid-cols-2",
- children: [/* @__PURE__ */ (0, C.jsx)(Tk, {
+ children: [/* @__PURE__ */ (0, C.jsx)(xk, {
title: "浏览活跃时间",
- unit: Ek,
+ unit: Sk,
cells: t.cells,
total: t.total,
columns: 24,
rows: 7,
axis: r,
footer: /* @__PURE__ */ (0, C.jsxs)(C.Fragment, { children: [/* @__PURE__ */ (0, C.jsx)("span", { children: "星期 × 小时" }), /* @__PURE__ */ (0, C.jsx)("span", { children: e?.timezone || "UTC+08:00" })] })
- }), /* @__PURE__ */ (0, C.jsx)(Tk, {
+ }), /* @__PURE__ */ (0, C.jsx)(xk, {
title: "每日活跃",
- unit: Ek,
+ unit: Sk,
cells: n.cells,
total: n.total,
columns: 13,
@@ -33785,14 +33753,14 @@ function Dk({ activity: e }) {
})]
});
}
-function Ok({ flows: e }) {
- let [t, n] = (0, S.useState)(null), r = _k(e);
+function wk({ flows: e }) {
+ let [t, n] = (0, S.useState)(null), r = pk(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, C.jsxs)("section", {
- className: xk,
+ className: _k,
children: [
- /* @__PURE__ */ (0, C.jsx)(Sk, {
+ /* @__PURE__ */ (0, C.jsx)(vk, {
title: "创作者线索来源",
figure: (t ? t.value : r.total).toLocaleString(),
note: t ? t.label : "条线索"
@@ -33800,7 +33768,7 @@ function Ok({ flows: e }) {
/* @__PURE__ */ (0, C.jsx)("div", {
className: "min-w-0 overflow-x-auto",
children: /* @__PURE__ */ (0, C.jsxs)("svg", {
- viewBox: `0 0 ${hk.width} ${hk.height}`,
+ viewBox: `0 0 ${dk.width} ${dk.height}`,
fill: "none",
role: "img",
"aria-label": "来源网站与创作者线索",
@@ -33814,7 +33782,7 @@ function Ok({ flows: e }) {
"aria-label": `${e.label}:${e.value} 条线索`,
fillOpacity: 0,
strokeOpacity: a(e, e.label) ? .55 : .08,
- className: `outline-none transition-opacity ${yk[e.color]}`,
+ className: `outline-none transition-opacity ${hk[e.color]}`,
onPointerEnter: () => n({
value: e.value,
label: e.label,
@@ -33848,15 +33816,15 @@ function Ok({ flows: e }) {
width: 10,
height: e.height,
rx: 5,
- className: e.side === "source" ? bk[e.color] : "fill-text-secondary"
+ className: e.side === "source" ? gk[e.color] : "fill-text-secondary"
}), /* @__PURE__ */ (0, C.jsxs)("text", {
- x: gk[e.side],
+ x: fk[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: [vk(e.name), /* @__PURE__ */ (0, C.jsx)("tspan", {
- x: gk[e.side],
+ children: [mk(e.name), /* @__PURE__ */ (0, C.jsx)("tspan", {
+ x: fk[e.side],
dy: 15,
children: e.side === "source" ? e.value.toLocaleString() : `${e.share.toFixed(1)}%`
})]
@@ -33873,8 +33841,8 @@ function Ok({ flows: e }) {
}
//#endregion
//#region src/react/taste/taste-page.tsx
-var kk = 10, Ak = Um(qx, Jx, "text-body-2-medium"), jk = `${ih()} flex flex-col gap-4`, Mk = "rounded-xl bg-background-primary-default p-3", Nk = "读取运行 Peach 的这台电脑上的浏览记录", Pk = "导入或读取浏览记录后,这里会列出已采集设备。", Fk = "馆藏里暂时没有对得上浏览信号的标签。", Ik = "采集浏览记录后,这里会显示聚合后的口味证据。", Lk = "这些词在浏览记录中出现,但 Peach 观看记录还没有对应证据", Rk = "在运行 Peach 的电脑上使用浏览器:点上面的「读取浏览器历史」。", zk = "记录在其他设备上:导出文件后,点上面的「导入历史文件」。多台设备的文件分别导入。", Bk = "需要刷新时再次读取或导入;数据源可在页面底部移除。", Vk = "这个数据源将不再用于口味分析。原始导出文件保留。", Hk = "peach-taste-guide-dismissed";
-function Uk({ icon: e, term: t, figure: n, detail: r, accent: i }) {
+var Tk = 10, Ek = Um(qx, Jx, "text-body-2-medium"), Dk = `${ih()} flex flex-col gap-4`, Ok = "rounded-xl bg-background-primary-default p-3", kk = "读取运行 Peach 的这台电脑上的浏览记录", Ak = "导入或读取浏览记录后,这里会列出已采集设备。", jk = "馆藏里暂时没有对得上浏览信号的标签。", Mk = "采集浏览记录后,这里会显示聚合后的口味证据。", Nk = "这些词在浏览记录中出现,但 Peach 观看记录还没有对应证据", Pk = "在运行 Peach 的电脑上使用浏览器:点上面的「读取浏览器历史」。", Fk = "记录在其他设备上:导出文件后,点上面的「导入历史文件」。多台设备的文件分别导入。", Ik = "需要刷新时再次读取或导入;数据源可在页面底部移除。", Lk = "这个数据源将不再用于口味分析。原始导出文件保留。", Rk = "peach-taste-guide-dismissed";
+function zk({ icon: e, term: t, figure: n, detail: r, accent: i }) {
return /* @__PURE__ */ (0, C.jsx)("div", {
className: Rx(),
children: /* @__PURE__ */ (0, C.jsx)(Bx, {
@@ -33886,7 +33854,7 @@ function Uk({ icon: e, term: t, figure: n, detail: r, accent: i }) {
})
});
}
-function Wk({ name: e, domain: t }) {
+function Bk({ name: e, domain: t }) {
return /* @__PURE__ */ (0, C.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, C.jsx)("img", {
@@ -33900,13 +33868,13 @@ function Wk({ name: e, domain: t }) {
})]
});
}
-function Gk({ html: e }) {
+function Vk({ html: e }) {
return /* @__PURE__ */ (0, C.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 Kk({ rows: e, kind: t, visual: n, empty: r, onSignal: i, avatarInner: a }) {
+function Hk({ rows: e, kind: t, visual: n, empty: r, onSignal: i, avatarInner: a }) {
let [o, s] = (0, S.useState)(!1);
if (!e.length) return /* @__PURE__ */ (0, C.jsx)(oh, {
shell: "plain",
@@ -33914,7 +33882,7 @@ function Kk({ rows: e, kind: t, visual: n, empty: r, onSignal: i, avatarInner: a
title: "暂无足够证据",
children: r
});
- let c = ik(e), l = o ? e : e.slice(0, kk);
+ let c = ek(e), l = o ? e : e.slice(0, Tk);
return /* @__PURE__ */ (0, C.jsxs)("div", {
className: "flex flex-col gap-3",
children: [/* @__PURE__ */ (0, C.jsx)("ol", {
@@ -33936,15 +33904,15 @@ function Kk({ rows: e, kind: t, visual: n, empty: r, onSignal: i, avatarInner: a
className: "w-6 shrink-0 text-caption-1-regular tabular-nums text-text-secondary",
children: r + 1
}),
- n === "domain" ? /* @__PURE__ */ (0, C.jsx)(Wk, {
+ n === "domain" ? /* @__PURE__ */ (0, C.jsx)(Bk, {
name: e.name,
domain: e.name
}) : null,
- n === "creator" && !e.entity_id && !e.has_avatar && s ? /* @__PURE__ */ (0, C.jsx)(Wk, {
+ n === "creator" && !e.entity_id && !e.has_avatar && s ? /* @__PURE__ */ (0, C.jsx)(Bk, {
name: e.name,
domain: s
}) : null,
- n !== "none" && n !== "domain" && (e.entity_id || e.has_avatar || !s) ? /* @__PURE__ */ (0, C.jsx)(Gk, { html: a(e.name, e.entity_id ? {
+ n !== "none" && n !== "domain" && (e.entity_id || e.has_avatar || !s) ? /* @__PURE__ */ (0, C.jsx)(Vk, { html: a(e.name, e.entity_id ? {
id: e.entity_id,
has_image: !!e.has_image,
avatar_focus: e.avatar_focus
@@ -33956,7 +33924,7 @@ function Kk({ rows: e, kind: t, visual: n, empty: r, onSignal: i, avatarInner: a
children: e.name
}), /* @__PURE__ */ (0, C.jsx)("small", {
className: "text-caption-1-regular text-text-secondary",
- children: rk(e)
+ children: $O(e)
})]
}),
o ? /* @__PURE__ */ (0, C.jsx)(Af, {
@@ -33977,7 +33945,7 @@ function Kk({ rows: e, kind: t, visual: n, empty: r, onSignal: i, avatarInner: a
})
}, e.name);
})
- }), e.length > kk ? /* @__PURE__ */ (0, C.jsx)("div", {
+ }), e.length > Tk ? /* @__PURE__ */ (0, C.jsx)("div", {
className: "flex justify-center",
children: /* @__PURE__ */ (0, C.jsx)(X, {
variant: "secondary",
@@ -33988,7 +33956,7 @@ function Kk({ rows: e, kind: t, visual: n, empty: r, onSignal: i, avatarInner: a
}) : null]
});
}
-function qk({ label: e, panels: t, onSignal: n, avatarInner: r }) {
+function Uk({ label: e, panels: t, onSignal: n, avatarInner: r }) {
return /* @__PURE__ */ (0, C.jsxs)(Ay, {
className: `${ih({ padding: "none" })} flex flex-col`,
children: [/* @__PURE__ */ (0, C.jsx)("div", {
@@ -34005,7 +33973,7 @@ function qk({ label: e, panels: t, onSignal: n, avatarInner: r }) {
}), t.map((e) => /* @__PURE__ */ (0, C.jsx)(Fy, {
id: e.id,
className: "px-4 pt-3.5 pb-4",
- children: /* @__PURE__ */ (0, C.jsx)(Kk, {
+ children: /* @__PURE__ */ (0, C.jsx)(Hk, {
...e.props,
onSignal: n,
avatarInner: r
@@ -34013,7 +33981,7 @@ function qk({ label: e, panels: t, onSignal: n, avatarInner: r }) {
}, e.id))]
});
}
-function Jk({ data: e, onSignal: t, navigate: n }) {
+function Wk({ data: e, onSignal: t, navigate: n }) {
let r = e.analysis;
if (!r?.headline) return null;
let i = r.confidence || {}, a = [...(r.explore || []).map((e) => ({
@@ -34028,7 +33996,7 @@ function Jk({ data: e, onSignal: t, navigate: n }) {
act: () => n(e.route)
}))];
return /* @__PURE__ */ (0, C.jsxs)("section", {
- className: jk,
+ className: Dk,
"aria-label": "口味总结",
children: [
/* @__PURE__ */ (0, C.jsxs)("header", {
@@ -34054,7 +34022,7 @@ function Jk({ data: e, onSignal: t, navigate: n }) {
r.points?.length ? /* @__PURE__ */ (0, C.jsx)("div", {
className: "inline-grid w-full gap-3 sm:grid-cols-2",
children: r.points.map((e) => /* @__PURE__ */ (0, C.jsxs)("div", {
- className: `flex min-w-0 flex-col gap-1 ${Mk}`,
+ className: `flex min-w-0 flex-col gap-1 ${Ok}`,
children: [/* @__PURE__ */ (0, C.jsx)("span", {
className: "text-caption-1-regular text-text-secondary",
children: e.label
@@ -34069,7 +34037,7 @@ function Jk({ data: e, onSignal: t, navigate: n }) {
children: a.map((e) => /* @__PURE__ */ (0, C.jsxs)("button", {
type: "button",
onClick: e.act,
- className: `flex w-full min-w-0 cursor-pointer items-center gap-3 ${Mk} 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 ${Ok} text-left outline-none hover:bg-background-primary-hover focus-visible:ring-2 focus-visible:ring-border-focus-ring`,
children: [/* @__PURE__ */ (0, C.jsxs)("span", {
className: "flex min-w-0 grow flex-col gap-1",
children: [/* @__PURE__ */ (0, C.jsx)("b", {
@@ -34088,15 +34056,15 @@ function Jk({ data: e, onSignal: t, navigate: n }) {
shell: "plain",
icon: tp,
title: "还没有可探索的入口",
- children: Fk
+ children: jk
})
]
});
}
-function Yk({ onboarding: e, done: t }) {
+function Gk({ onboarding: e, done: t }) {
let [n, r] = (0, S.useState)(() => {
try {
- return localStorage.getItem(Hk) === "1";
+ return localStorage.getItem(Rk) === "1";
} catch {
return !1;
}
@@ -34112,11 +34080,11 @@ function Yk({ onboarding: e, done: t }) {
children: [
/* @__PURE__ */ (0, C.jsx)("p", {
className: "text-body-2-regular text-text-secondary",
- children: Rk
+ children: Pk
}),
/* @__PURE__ */ (0, C.jsx)("p", {
className: "text-body-2-regular text-text-secondary",
- children: zk
+ children: Fk
}),
/* @__PURE__ */ (0, C.jsxs)("ul", {
className: "flex list-disc flex-col gap-1 pl-5 text-body-2-regular text-text-secondary",
@@ -34146,7 +34114,7 @@ function Yk({ onboarding: e, done: t }) {
}),
/* @__PURE__ */ (0, C.jsx)("p", {
className: "text-body-2-regular text-text-secondary",
- children: Bk
+ children: Ik
}),
/* @__PURE__ */ (0, C.jsx)("span", {
className: "self-start",
@@ -34155,7 +34123,7 @@ function Yk({ onboarding: e, done: t }) {
size: "small",
onClick: () => {
try {
- localStorage.setItem(Hk, "1");
+ localStorage.setItem(Rk, "1");
} catch {}
r(!0);
},
@@ -34166,7 +34134,7 @@ function Yk({ onboarding: e, done: t }) {
})
});
}
-function Xk({ busy: e, onRefresh: t, onImport: n }) {
+function Kk({ busy: e, onRefresh: t, onImport: n }) {
let r = (0, S.useRef)(null), [i, a] = (0, S.useState)(!1), o = (e) => {
a(!1), e();
};
@@ -34174,7 +34142,7 @@ function Xk({ busy: e, onRefresh: t, onImport: n }) {
className: "flex items-center gap-1",
children: [/* @__PURE__ */ (0, C.jsx)(X, {
leadingIcon: If,
- title: Nk,
+ title: kk,
onClick: t,
...Z(e),
children: "读取浏览器历史"
@@ -34199,7 +34167,7 @@ function Xk({ busy: e, onRefresh: t, onImport: n }) {
className: "flex w-52 flex-col gap-1 outline-none",
children: [/* @__PURE__ */ (0, C.jsxs)("button", {
type: "button",
- className: Ak,
+ className: Ek,
onClick: () => o(t),
children: [/* @__PURE__ */ (0, C.jsx)(If, {
"aria-hidden": !0,
@@ -34207,7 +34175,7 @@ function Xk({ busy: e, onRefresh: t, onImport: n }) {
}), "读取浏览器历史"]
}), /* @__PURE__ */ (0, C.jsxs)("button", {
type: "button",
- className: Ak,
+ className: Ek,
onClick: () => o(n),
children: [/* @__PURE__ */ (0, C.jsx)(ap, {
"aria-hidden": !0,
@@ -34217,15 +34185,15 @@ function Xk({ busy: e, onRefresh: t, onImport: n }) {
})
})] });
}
-function Zk({ sources: e, window: t, toast: n }) {
+function qk({ sources: e, window: t, toast: n }) {
let r = ut({
- mutationFn: (e) => YO(e, t),
+ mutationFn: (e) => GO(e, t),
onSuccess: (e) => {
- dh.setQueryData(HO(t), e.dashboard), n("已移除口味数据源");
+ dh.setQueryData(RO(t), e.dashboard), n("已移除口味数据源");
}
});
return /* @__PURE__ */ (0, C.jsxs)("section", {
- className: jk,
+ className: Dk,
"aria-label": "数据源",
children: [
/* @__PURE__ */ (0, C.jsx)("h3", {
@@ -34239,7 +34207,7 @@ function Zk({ sources: e, window: t, toast: n }) {
e.length ? /* @__PURE__ */ (0, C.jsx)("div", {
className: "inline-grid w-full gap-2 sm:grid-cols-2",
children: e.map((e) => /* @__PURE__ */ (0, C.jsxs)("div", {
- className: `flex min-w-0 items-center gap-3 ${Mk}`,
+ className: `flex min-w-0 items-center gap-3 ${Ok}`,
children: [
/* @__PURE__ */ (0, C.jsx)("span", {
className: "inline-grid size-8 shrink-0 place-items-center rounded-lg text-text-secondary",
@@ -34271,7 +34239,7 @@ function Zk({ sources: e, window: t, toast: n }) {
onClick: () => {
r.isPending || s({
title: "移除口味数据源",
- body: Vk,
+ body: Lk,
confirmLabel: "移除口味数据源",
onConfirm: () => r.mutateAsync(e.source_key)
});
@@ -34283,29 +34251,29 @@ function Zk({ sources: e, window: t, toast: n }) {
shell: "plain",
icon: Lf,
title: "还没有数据源",
- children: Pk
+ children: Ak
})
]
});
}
-function Qk(e) {
+function Jk(e) {
let { onSignal: t, navigate: r, toast: i, avatarInner: a, onboarding: o } = e, [s, c] = (0, S.useState)("all"), [l, u] = (0, S.useState)("browser"), [d, f] = (0, S.useState)(!1), [p, m] = (0, S.useState)(null), h = (0, S.useRef)(null), g = lt({
- queryKey: HO(s),
- queryFn: ({ signal: e }) => GO(s, e),
+ queryKey: RO(s),
+ queryFn: ({ signal: e }) => VO(s, e),
placeholderData: I
}), _ = lt({
- queryKey: UO,
- queryFn: ({ signal: e }) => KO(e),
- refetchInterval: (e) => $O(e.state.data)
+ queryKey: zO,
+ queryFn: ({ signal: e }) => HO(e),
+ refetchInterval: (e) => YO(e.state.data)
}), v = ut({
- mutationFn: () => JO(s),
+ mutationFn: () => WO(s),
onSuccess: () => {
- f(!0), m(null), dh.invalidateQueries({ queryKey: UO });
+ f(!0), m(null), dh.invalidateQueries({ queryKey: zO });
}
}), y = ut({
- mutationFn: (e) => XO(e),
+ mutationFn: (e) => KO(e),
onSuccess: (e) => {
- dh.setQueryData(HO("all"), e.dashboard), c("all"), i("已导入口味数据");
+ dh.setQueryData(RO("all"), e.dashboard), c("all"), i("已导入口味数据");
}
}), b = _.data?.status === "running";
(0, S.useEffect)(() => {
@@ -34363,12 +34331,12 @@ function Qk(e) {
onSelectionChange: (e) => {
e !== null && c(String(e));
},
- children: WO.map(([e, t]) => /* @__PURE__ */ (0, C.jsx)(mw, {
+ children: BO.map(([e, t]) => /* @__PURE__ */ (0, C.jsx)(mw, {
id: e,
children: t
}, e))
}),
- /* @__PURE__ */ (0, C.jsx)(Xk, {
+ /* @__PURE__ */ (0, C.jsx)(Kk, {
busy: b || v.isPending || y.isPending,
onRefresh: w,
onImport: () => h.current?.click()
@@ -34384,7 +34352,7 @@ function Qk(e) {
]
})]
}),
- /* @__PURE__ */ (0, C.jsx)(Yk, {
+ /* @__PURE__ */ (0, C.jsx)(Gk, {
onboarding: o,
done: !!(E.history_sources || T.updated_at)
}),
@@ -34417,27 +34385,27 @@ function Qk(e) {
/* @__PURE__ */ (0, C.jsxs)("div", {
className: zx,
children: [
- /* @__PURE__ */ (0, C.jsx)(Uk, {
+ /* @__PURE__ */ (0, C.jsx)(zk, {
accent: 0,
icon: Gf,
term: "浏览记录",
figure: Number(E.history_visits || 0).toLocaleString(),
- detail: `${E.history_sources || 0} 个数据源 · ${ek(E.range_start)}—${ek(E.range_end)}`
+ detail: `${E.history_sources || 0} 个数据源 · ${XO(E.range_start)}—${XO(E.range_end)}`
}),
- /* @__PURE__ */ (0, C.jsx)(Uk, {
+ /* @__PURE__ */ (0, C.jsx)(zk, {
accent: 1,
icon: Qf,
term: "口味维度",
figure: A.length.toLocaleString(),
detail: A[0]?.name || "尚无主维度"
}),
- /* @__PURE__ */ (0, C.jsx)(Uk, {
+ /* @__PURE__ */ (0, C.jsx)(zk, {
accent: 2,
icon: tp,
term: "浏览候选",
figure: j.length.toLocaleString()
}),
- /* @__PURE__ */ (0, C.jsx)(Uk, {
+ /* @__PURE__ */ (0, C.jsx)(zk, {
accent: 3,
icon: Lf,
term: "私有导出",
@@ -34447,7 +34415,7 @@ function Qk(e) {
]
}),
/* @__PURE__ */ (0, C.jsxs)("section", {
- className: `${jk} md:flex-row md:gap-6`,
+ className: `${Dk} md:flex-row md:gap-6`,
"aria-label": "浏览器画像",
children: [/* @__PURE__ */ (0, C.jsxs)("div", {
className: "flex shrink-0 flex-col gap-2 pb-5 md:w-72 md:pr-6 md:pb-0",
@@ -34456,31 +34424,31 @@ function Qk(e) {
className: "text-caption-1-regular text-text-secondary",
children: "浏览器画像"
}),
- /* @__PURE__ */ (0, C.jsx)(Ck, {
+ /* @__PURE__ */ (0, C.jsx)(yk, {
rows: A,
label: "主要口味维度"
}),
/* @__PURE__ */ (0, C.jsx)("small", {
className: "text-caption-1-regular text-text-secondary",
- children: T.updated_at ? `更新于 ${ek(T.updated_at)}` : "尚未采集浏览记录"
+ children: T.updated_at ? `更新于 ${XO(T.updated_at)}` : "尚未采集浏览记录"
})
]
}), /* @__PURE__ */ (0, C.jsx)("div", {
className: "min-w-0 grow",
- children: A.length ? /* @__PURE__ */ (0, C.jsx)(wk, {
+ children: A.length ? /* @__PURE__ */ (0, C.jsx)(bk, {
rows: A,
label: "口味维度排名"
}) : /* @__PURE__ */ (0, C.jsx)(oh, {
shell: "plain",
icon: tp,
title: "暂无口味维度",
- children: Ik
+ children: Mk
})
})]
}),
- /* @__PURE__ */ (0, C.jsx)(Dk, { activity: T.activity }),
- /* @__PURE__ */ (0, C.jsx)(Ok, { flows: T.creator_flows }),
- /* @__PURE__ */ (0, C.jsx)(qk, {
+ /* @__PURE__ */ (0, C.jsx)(Ck, { activity: T.activity }),
+ /* @__PURE__ */ (0, C.jsx)(wk, { flows: T.creator_flows }),
+ /* @__PURE__ */ (0, C.jsx)(Uk, {
label: "浏览器口味维度",
onSignal: t,
avatarInner: a,
@@ -34522,7 +34490,7 @@ function Qk(e) {
rows: j,
kind: "",
visual: "none",
- empty: Lk
+ empty: Nk
}
}
]
@@ -34536,26 +34504,26 @@ function Qk(e) {
/* @__PURE__ */ (0, C.jsxs)("div", {
className: zx,
children: [
- /* @__PURE__ */ (0, C.jsx)(Uk, {
+ /* @__PURE__ */ (0, C.jsx)(zk, {
accent: 0,
icon: Vf,
term: "Peach 看过",
figure: Number(E.peach_items || 0).toLocaleString(),
- detail: tk(E.peach_seconds || 0)
+ detail: ZO(E.peach_seconds || 0)
}),
- /* @__PURE__ */ (0, C.jsx)(Uk, {
+ /* @__PURE__ */ (0, C.jsx)(zk, {
accent: 1,
icon: ip,
term: "喜欢",
figure: Number(E.liked || 0).toLocaleString()
}),
- /* @__PURE__ */ (0, C.jsx)(Uk, {
+ /* @__PURE__ */ (0, C.jsx)(zk, {
accent: 2,
icon: rp,
term: "不合口味",
figure: Number(E.disliked || 0).toLocaleString()
}),
- /* @__PURE__ */ (0, C.jsx)(Uk, {
+ /* @__PURE__ */ (0, C.jsx)(zk, {
accent: 3,
icon: Qf,
term: "有标签",
@@ -34564,7 +34532,7 @@ function Qk(e) {
]
}),
/* @__PURE__ */ (0, C.jsxs)("section", {
- className: `${jk} md:flex-row md:gap-6`,
+ className: `${Dk} md:flex-row md:gap-6`,
"aria-label": "Peach 观看",
children: [/* @__PURE__ */ (0, C.jsxs)("div", {
className: "flex shrink-0 flex-col gap-0.5 pb-5 md:w-72 md:pr-6 md:pb-0",
@@ -34584,18 +34552,18 @@ function Qk(e) {
]
}), /* @__PURE__ */ (0, C.jsxs)("div", {
className: "flex min-w-0 grow flex-col",
- children: [/* @__PURE__ */ (0, C.jsx)($k, {
+ children: [/* @__PURE__ */ (0, C.jsx)(Yk, {
term: "有标签",
value: M,
rest: D.untagged || 0
- }), /* @__PURE__ */ (0, C.jsx)($k, {
+ }), /* @__PURE__ */ (0, C.jsx)(Yk, {
term: "有身份",
value: N,
rest: D.unidentified || 0
})]
})]
}),
- /* @__PURE__ */ (0, C.jsx)(qk, {
+ /* @__PURE__ */ (0, C.jsx)(Uk, {
label: "Peach 口味维度",
onSignal: t,
avatarInner: a,
@@ -34636,19 +34604,19 @@ function Qk(e) {
})
]
}),
- /* @__PURE__ */ (0, C.jsx)(Jk, {
+ /* @__PURE__ */ (0, C.jsx)(Wk, {
data: T,
onSignal: t,
navigate: r
}),
- /* @__PURE__ */ (0, C.jsx)(Zk, {
+ /* @__PURE__ */ (0, C.jsx)(qk, {
sources: T.sources || [],
window: s,
toast: i
})
] });
}
-function $k({ term: e, value: t, rest: n }) {
+function Yk({ term: e, value: t, rest: n }) {
let r = Math.max(t + n, 1);
return /* @__PURE__ */ (0, C.jsxs)("div", {
className: "flex flex-col gap-1.5 border-b border-separator-border py-3 last:border-b-0",
@@ -34670,16 +34638,16 @@ function $k({ term: e, value: t, rest: n }) {
}
//#endregion
//#region src/react/entry.tsx
-var eA = null;
-function tA() {
- return eA?.isConnected || (eA = document.createElement("div"), eA.className = "peach-react", eA.dataset.reactOverlays = "", document.body.append(eA)), eA;
+var Xk = null;
+function Zk() {
+ return Xk?.isConnected || (Xk = document.createElement("div"), Xk.className = "peach-react", Xk.dataset.reactOverlays = "", document.body.append(Xk)), Xk;
}
-function nA(e) {
+function Qk(e) {
return (t, n) => {
let r = (0, Tf.createRoot)(t), i = (t) => r.render(/* @__PURE__ */ (0, C.jsx)(E, {
client: dh,
children: /* @__PURE__ */ (0, C.jsx)(vc, {
- getContainer: tA,
+ getContainer: Zk,
children: /* @__PURE__ */ (0, C.jsx)(e, { ...t })
})
}));
@@ -34689,47 +34657,47 @@ function nA(e) {
};
};
}
-var rA = {
+var $k = {
activity: {
prefetch: (e, t) => vh(t),
- mount: nA(Nh)
+ mount: Qk(Nh)
},
"avatar-picker": {
prefetch: async () => {},
- mount: nA(ub)
+ mount: Qk(ub)
},
configuration: {
- prefetch: (e, t) => PE(t),
- mount: nA(CD)
+ prefetch: (e, t) => AE(t),
+ mount: Qk(yD)
},
"follow-manage": {
prefetch: (e, t) => bx(t),
- mount: nA(Ew)
+ mount: Qk(Ew)
},
"library-processing": {
prefetch: (e, t) => Aw(t),
- mount: nA((e) => e.mode === "notice" ? /* @__PURE__ */ (0, C.jsx)(tT, { ...e }) : /* @__PURE__ */ (0, C.jsx)(Zw, { ...e }))
+ mount: Qk((e) => e.mode === "notice" ? /* @__PURE__ */ (0, C.jsx)(tT, { ...e }) : /* @__PURE__ */ (0, C.jsx)(Zw, { ...e }))
},
"quality-goals": {
prefetch: (e, t) => aT(t),
- mount: nA(cT)
+ mount: Qk(cT)
},
review: {
- prefetch: (e, t) => VT(e.readOnly, t),
- mount: nA(fE)
+ prefetch: (e, t) => RT(t),
+ mount: Qk(cE)
},
scraping: {
- prefetch: (e, t) => SE(t),
- mount: nA(kE)
+ prefetch: (e, t) => vE(t),
+ mount: Qk(TE)
},
stats: {
- prefetch: (e, t) => DD(t),
- mount: nA(iO)
+ prefetch: (e, t) => CD(t),
+ mount: Qk(eO)
},
taste: {
- prefetch: (e, t) => qO("all", t),
- mount: nA(Qk)
+ prefetch: (e, t) => UO("all", t),
+ mount: Qk(Jk)
}
};
//#endregion
-export { rA as pages };
+export { $k as pages };