Skip to content

armgit / peach

Public Imported from GitHub
0

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

feat(review): 接通统一复核并完善空库布局

longmeidao188fef20e746
diff --git a/README.en.md b/README.en.md
index 753f29de3..9c9920eaf 100644
--- a/README.en.md
+++ b/README.en.md
@@ -47,7 +47,7 @@ Tray-managed services let you adjust media sources under Manage → Configuratio
In Configuration or Data Management, Scan and enrich scans folders, detects existing NFO files and local posters, and fetches missing metadata. While processing, the home page links to progress in Configuration. Same-name NFO files, `movie.nfo` in single-movie folders, and episode NFO files are supported. Metadata retains its original source and enters the review queue before updating the catalog. Local custom tags are preserved; folders containing multiple videos do not share `movie.nfo`.
-Review supports selecting and adopting items by group. Metadata groups separate single candidates from items requiring a source choice. Choose a source for each multi-source item before adopting the selection. Failed items retain their selection and error message for retry.
+Enter selection mode from the top-right toolbar to approve or reject items across groups, or choose a shared source. Metadata groups separate single candidates from items requiring a source choice. Choosing a source does not submit a decision; approve the selection to adopt it. Failed items retain their selection and error message for retry.
Follow sources include FANBOX, Patreon, SubscribeStar, Kemono, Pawchive, Coomer, the Rule34 family and F95zone. Availability depends on the site and your access rights. See [source collection](docs/SOURCING.md) for supported workflows and boundaries.
diff --git a/README.md b/README.md
index 115e83af8..4bac74e73 100644
--- a/README.md
+++ b/README.md
@@ -42,7 +42,7 @@ CloudDrive · 115 与 CloudDrive · PikPak 按本机文件夹接入;先在 Clo
在「配置」或「数据管理」点击「扫描并补全资料」,可统一扫描文件夹、识别已有 NFO 和本地海报,并采集缺失资料。首页在处理期间提供进度入口,配置页显示当前阶段。支持同名 NFO、单影片目录的 `movie.nfo` 和单集 NFO;资料保留原始出处,在「复核资料」确认后写入馆藏。已有本地标签会保留,目录中有多部影片时不会共用 `movie.nfo`。
「管理 → 配置 → 检查更新」显示当前版本与 GitHub 最新测试版。独立 Windows 包可直接下载并准备更新,进度实时显示;完成后选择「立即重启」或「稍后」,程序自动安装,失败时恢复旧版本。
-复核支持多选并按组采用。资料候选分为「单一候选」和「需选择来源」;多来源项目先选来源,再采用所选项目。失败项保留选择和错误提示,可再次采用。
+复核支持从右上角进入多选,跨组通过或拒绝所选项目,并统一选择共同来源。资料候选分为「单一候选」和「需选择来源」;选择来源后点击通过才会采用。失败项保留选择和错误提示,可重试。
首次设置可选择进入浏览器历史记录导入指南;完成导入后指南隐藏,点击「跳过」会在当前浏览器记住选择,折叠仍保留指南。需要补充记录时使用「口味」页的读取或导入按钮。设置中的「SFW 模式」会模糊、降低饱和度并压暗图片和视频,停止悬停预览,文字保持可见。数据管理中的「网盘与本地数据库」仅在配置网盘后显示;空文件夹清理也支持本地磁盘。
diff --git a/docs/HANDOFF.md b/docs/HANDOFF.md
index 0ca14edf7..fe892c07e 100644
--- a/docs/HANDOFF.md
+++ b/docs/HANDOFF.md
@@ -8,7 +8,7 @@
- 凭据焦点外扩 3px,正文左右留 4px;输入框可收缩,验收所有裁切祖先。
-页面密度、控件、提示与响应式的实现门槛见 `.claude/skills/peach-web-ui/SKILL.md`,这里只留代码看不出来的判据。
+界面门槛见 `.claude/skills/peach-web-ui/SKILL.md`,保留代码外的判据。
- 截图与视觉验收的画面保护:SFW 模式(设置面板「安全」组,`#censorSetting`,localStorage `peach-censor`)默认关闭、不在导航栏。只有当本轮截图会交给会审查内容的模型(自动视觉审查或外发工具)时才开启,开完记得关;普通个人浏览一律不遮挡。
- 卡片实体链接必须由同一个 `{kind,name}` 结构生成,不许先独立选显示名、再按别的字段推断类型;账本 `size` 为空或 0 时显示「大小未知」,不伪装成 `0 MB`。
@@ -75,7 +75,7 @@
## 参考产品证据登记
-- [Geist 控件](reference-snapshots/vercel-geist-controls-measured.md);[README 维护](README_MAINTENANCE.md)。
+- [Geist 控件](reference-snapshots/vercel-geist-controls-measured.md);[复核操作](reference-snapshots/vercel-review-actions.md);[README 维护](README_MAINTENANCE.md)。
- 设置:`reference-snapshots/geist-settings.md`。
diff --git a/docs/REUSE.md b/docs/REUSE.md
index c783571ae..9fe5a56dc 100644
--- a/docs/REUSE.md
+++ b/docs/REUSE.md
@@ -1,6 +1,7 @@
# 复用清单
-复核多选复用 `/api/review/decision`,按作品/字段显式选择候选,再逐项采用;成功移出、失败保留选择,页面离开后停止后续提交。分组只区分单一候选与需选择来源,不把来源数量等同于内容冲突。滚动正文复用 Scroller,完成结果复用成功 Note。
+复核多选共享顶栏模式、Select 与 `/api/review/decision`,支持跨组通过/拒绝与无歧义的共同来源选择;按作品/字段显式选择候选,再逐项采用;成功移出、失败保留选择,页面离开后停止后续提交。分组只区分单一候选与需选择来源,不把来源数量等同于内容冲突。滚动正文复用 Scroller,完成结果复用成功 Note。
+
## 本机设置与卸载
- Peach 代理复用 HTTPX 的 `trust_env`、`proxy` 与本机 CredentialStore;来源只选择公共策略或直接连接,地址不回传。单一旧代理可继承,多个地址需明确选择。
diff --git a/docs/reference-snapshots/vercel-review-actions.md b/docs/reference-snapshots/vercel-review-actions.md
new file mode 100644
index 000000000..22630de20
--- /dev/null
+++ b/docs/reference-snapshots/vercel-review-actions.md
@@ -0,0 +1,8 @@
+# 复核操作与折叠
+
+人工取证笔记,React 页面运行后的 DOM 与计算样式不能作为可重抓的源字节,不登记进 `docs/reference-sources.json`。核验于 2026-09-06。
+
+- 官方入口:https://vercel.com/geist/button 、https://vercel.com/geist/select 、https://vercel.com/geist/collapse 。
+- 本机 Chrome 取得三页 DOM 与控件计算样式;原始资料归档于 `attic/evidence/20260906-studio-monitor/`。
+- Button 示例高度 32/36/40px;默认主动作深底浅字,错误动作使用红色。Select 用于固定列表的单项选择,Collapse 用于展开正文。
+- Peach 复用已有 Button、Select 和 `wireCollapse`。批量操作独立于分类 Tabs,统一来源只选择候选,通过按钮提交;拒绝使用危险动作色,跳过使用已有提示色。
diff --git a/frontend/src/catalog-onboarding.ts b/frontend/src/catalog-onboarding.ts
index 642f25bc6..60fc92c50 100644
--- a/frontend/src/catalog-onboarding.ts
+++ b/frontend/src/catalog-onboarding.ts
@@ -3,13 +3,13 @@ import { emptyStateHtml } from '@peach/legacy/ui';
type Request = (url: string) => Promise<any>;
const FILTERS = ['loc', 'creator', 'performer', 'studio', 'series', 'agency', 'tag', 'tag_match', 'len', 'dur_min', 'dur_max', 'orient', 'state', 'jav', 'thumb'];
-/** 空馆藏保留三个静止的身份、厂牌和标签占位,不宣称正在加载。 */
+/** 空馆藏占位沿横向内容轨道铺开,由容器裁切到可用宽度。 */
export function emptyCatalogLayout(): { tiers: string; tags: string } {
- const three = (html: string) => Array(3).fill(html).join('');
+ const fill = (html: string) => Array(64).fill(html).join('');
return {
- tiers: '<div class="tier catalog-placeholder" aria-hidden="true">' + three('<span class="av"><span class="ring"></span><span class="nm">&nbsp;</span></span>')
- + '</div><div class="tier catalog-placeholder" aria-hidden="true">' + three('<span class="brandpill"><span class="mk"></span><span class="placeholder-name">&nbsp;</span></span>') + '</div>',
- tags: '<span class="catalog-placeholder placeholder-tags" aria-hidden="true">' + three('<span class="pill">&nbsp;</span>') + '</span>',
+ tiers: '<div class="tier catalog-placeholder" aria-hidden="true">' + fill('<span class="av"><span class="ring"></span><span class="nm">&nbsp;</span></span>')
+ + '</div><div class="tier catalog-placeholder" aria-hidden="true">' + fill('<span class="brandpill"><span class="mk"></span><span class="placeholder-name">&nbsp;</span></span>') + '</div>',
+ tags: '<span class="catalog-placeholder placeholder-tags" aria-hidden="true">' + fill('<span class="pill">&nbsp;</span>') + '</span>',
};
}
diff --git a/frontend/src/legacy/ui.d.ts b/frontend/src/legacy/ui.d.ts
index 09a66deb1..9124811ce 100644
--- a/frontend/src/legacy/ui.d.ts
+++ b/frontend/src/legacy/ui.d.ts
@@ -18,11 +18,11 @@ export declare function checkboxHtml(inputAttrs?: string): string;
export declare function loadingDotsHtml(label?: string, options?: { className?: string }): string;
export declare function progressHtml(label: string, value: number, max?: number): string;
export declare function confirmModal(options: {title: string; body: string; confirmLabel: string; cancelLabel?: string; danger?: boolean; onConfirm?: () => Promise<unknown>}): Promise<{confirmed: boolean; result?: unknown}>;
-export declare function wireCollapse(root: Element, selector: string, idPrefix: string): void;
export declare function selectFieldHtml(items: string[][], current: string,
options?: { label?: string; attr?: string; className?: string }): string;
export declare function wireSelectField(root: Element): HTMLElement & { value: string; disabled: boolean };
+export declare function wireCollapse(root: ParentNode, selector: string, idPrefix: string): void;
export declare const MEDIA_SOURCE_ICONS: Record<string, string>;
export declare function selectOptionIconHtml(mark?: string): string;
diff --git a/frontend/src/management.ts b/frontend/src/management.ts
index 90c898512..014f927c2 100644
--- a/frontend/src/management.ts
+++ b/frontend/src/management.ts
@@ -1,3 +1,5 @@
+import { wireCollapse } from '@peach/legacy/ui';
+
/** 管理页按已配置的来源显示能力;离线来源仍然属于已配置来源。 */
export interface MediaSource { location: string; roots?: unknown[]; online?: boolean }
@@ -47,6 +49,7 @@ export function tasteHistoryGuideHtml(onboarding: boolean, completed = false, sk
/** 跳过是当前浏览器的持久偏好;折叠只改变 details 的展开状态。 */
export const TASTE_GUIDE_KEY = 'peach-taste-guide-dismissed';
export function wireTasteHistoryGuide(root: ParentNode, storage: Storage): void {
+ wireCollapse(root, '.taste-history-guide', 'taste-guide-collapse');
const guide = root.querySelector<HTMLDetailsElement>('.taste-history-guide');
guide?.querySelector<HTMLButtonElement>('.taste-guide-skip')?.addEventListener('click', () => {
storage.setItem(TASTE_GUIDE_KEY, '1');
diff --git a/frontend/src/review-bulk.ts b/frontend/src/review-bulk.ts
index ff35e9e87..8c338fff5 100644
--- a/frontend/src/review-bulk.ts
+++ b/frontend/src/review-bulk.ts
@@ -1,7 +1,7 @@
-import { checkboxHtml, setActionBusy } from '@peach/legacy/ui';
+import { checkboxHtml, setActionBusy, selectFieldHtml, wireSelectField } from '@peach/legacy/ui';
import { errorMessage } from './api';
-export interface ReviewRow { item_key: string; candidates?: { candidate_key: string }[] }
+export interface ReviewRow { item_key: string; candidates?: { candidate_key: string; source?: string }[] }
export const createReviewSelection = () => ({ active: false, busy: false, selected: new Set<string>(), choices: new Map<string, string>(), assets: new Map<string, number[]>(), errors: new Map<string, string>() });
type Selection = ReturnType<typeof createReviewSelection>;
type Payload = Record<string, unknown>;
@@ -23,15 +23,25 @@ export function wireReviewSelection(root: HTMLElement, options: {
rows: ReviewRow[]; metadata: boolean; locked: boolean; state: Selection;
payload(item: HTMLElement): Payload;
submit(payload: Payload): Promise<{ ok: boolean; error?: string }>;
+ modeChanged?(active: boolean): void;
applied(key: string): void; active(): boolean; refresh(): void; notify(message: string): void;
}) {
const list = root.querySelector<HTMLElement>('.reviewlist');
if (!list || !options.rows.length || options.locked) return;
const state = options.state;
const cards = [...list.querySelectorAll<HTMLElement>('[data-review-key]')];
- const toolbar = document.createElement('div'); toolbar.className = 'reviewbulkbar';
+ const toolbar = document.createElement('div'); toolbar.className = 'reviewbulkbar reviewbulktoolbar'; toolbar.setAttribute('role', 'group'); toolbar.setAttribute('aria-label', '复核批量操作');
const toggle = document.createElement('button'); toggle.className = 'geist-button'; toggle.type = 'button';
- toolbar.append(toggle); list.before(toolbar);
+ const all = document.createElement('button'); all.className = 'geist-button'; all.type = 'button';
+ const approve = document.createElement('button'); approve.className = 'geist-button primary'; approve.type = 'button';
+ const reject = document.createElement('button'); reject.className = 'geist-button reviewbulkreject'; reject.type = 'button';
+ const source = document.createElement('div'); source.className = 'reviewbulksource';
+ const feedback = document.createElement('p'); feedback.className = 'reviewstate reviewbulkfeedback'; feedback.setAttribute('role', 'status');
+ toolbar.append(toggle, all, source, approve, reject); list.before(toolbar, feedback);
+ const selected = () => cards.filter(card => state.selected.has(card.dataset.reviewKey!));
+ all.onclick = () => { if (state.busy) return; const clear = selected().length === cards.length; cards.forEach(card => clear ? state.selected.delete(card.dataset.reviewKey!) : state.selected.add(card.dataset.reviewKey!)); update(); };
+ approve.onclick = () => run(selected, feedback, approve, 'approved');
+ reject.onclick = () => run(selected, feedback, reject, 'rejected');
const groups = options.metadata ? [
{ title: '单一候选', cards: cards.filter(card => (options.rows.find(row => row.item_key === card.dataset.reviewKey)?.candidates?.length || 0) === 1) },
{ title: '需选择来源', cards: cards.filter(card => (options.rows.find(row => row.item_key === card.dataset.reviewKey)?.candidates?.length || 0) !== 1) },
@@ -51,7 +61,6 @@ export function wireReviewSelection(root: HTMLElement, options: {
for (const card of group.cards) {
grid.append(card);
const key = card.dataset.reviewKey!;
- const canApprove = eligible(card);
if (state.errors.has(key)) card.querySelector<HTMLElement>('.reviewstate')!.textContent = state.errors.get(key)!;
const label = document.createElement('label'); label.className = 'reviewpickitem';
label.innerHTML = checkboxHtml('aria-label="选择此复核项"') + '<span>选择此项</span>';
@@ -70,10 +79,10 @@ export function wireReviewSelection(root: HTMLElement, options: {
});
for (const radio of card.querySelectorAll<HTMLInputElement>('input[type="radio"]')) {
if (state.choices.has(key)) radio.checked = state.choices.get(key) === radio.value;
- radio.addEventListener('change', () => { if (radio.checked) state.choices.set(key, radio.value); });
+ radio.addEventListener('change', () => { if (radio.checked) state.choices.set(key, radio.value); update(); });
}
input.onchange = () => { if (input.checked) state.selected.add(key); else state.selected.delete(key); update(); };
- controls.push(() => { label.hidden = !state.active; input.checked = state.selected.has(key); input.disabled = !canApprove; });
+ controls.push(() => { label.hidden = !state.active; input.checked = state.selected.has(key); input.disabled = false; });
}
const chosen = () => group.cards.filter(card => state.selected.has(card.dataset.reviewKey!) && eligible(card));
controls.push(() => {
@@ -83,15 +92,17 @@ export function wireReviewSelection(root: HTMLElement, options: {
apply.disabled = !chosen().length; select.disabled = !group.cards.some(eligible);
});
select.onclick = () => { if (state.busy) return; const available = group.cards.filter(eligible); const all = chosen().length === available.length; available.forEach(card => all ? state.selected.delete(card.dataset.reviewKey!) : state.selected.add(card.dataset.reviewKey!)); update(); };
- apply.onclick = async () => {
+ apply.onclick = () => run(chosen, feedback, apply, 'approved');
+ }
+ async function run(chosen: () => HTMLElement[], feedback: HTMLElement, apply: HTMLButtonElement, status: 'approved' | 'rejected') {
if (state.busy || !chosen().length) return;
- const items = chosen().map(card => ({ key: card.dataset.reviewKey!, payload: options.payload(card) }));
- if (options.metadata && items.some(item => !item.payload.candidate_key)) {
+ const items: { key: string; payload: Payload }[] = chosen().map(card => ({ key: card.dataset.reviewKey!, payload: { ...options.payload(card), status } }));
+ if (status === 'approved' && options.metadata && items.some(item => !item.payload.candidate_key)) {
feedback.textContent = '请先为所选的多来源候选选择来源。';
chosen().find(card => !card.querySelector('input[type="radio"]:checked'))?.querySelector<HTMLInputElement>('input[type="radio"]')?.focus();
return;
}
- state.busy = true; feedback.textContent = `正在采用 0 / ${items.length}`; update(); setActionBusy(apply, true);
+ state.busy = true; feedback.textContent = `正在处理 0 / ${items.length}`; update(); setActionBusy(apply, true);
const inputs = [...root.querySelectorAll<HTMLInputElement | HTMLButtonElement>('button,input')];
const disabled = inputs.map(input => input.getAttribute('aria-disabled')); inputs.forEach(input => { input.setAttribute('aria-disabled', 'true'); });
const block = (event: Event) => { if (event instanceof KeyboardEvent && event.key === 'Tab') return; event.preventDefault(); event.stopImmediatePropagation(); };
@@ -99,21 +110,50 @@ export function wireReviewSelection(root: HTMLElement, options: {
let checked = 0;
const result = await applyReviewSelection(items, async payload => {
try { return await options.submit(payload); }
- finally { checked++; if (options.active()) feedback.textContent = `正在采用 ${checked} / ${items.length}`; }
+ finally { checked++; if (options.active()) feedback.textContent = `正在处理 ${checked} / ${items.length}`; }
}, key => { state.selected.delete(key); state.errors.delete(key); options.applied(key); }, options.active);
state.busy = false;
root.removeEventListener('click', block, true); root.removeEventListener('keydown', block, true);
inputs.forEach((input, index) => { const value = disabled[index]; if (value === null) input.removeAttribute('aria-disabled'); else input.setAttribute('aria-disabled', value!); });
setActionBusy(apply, false);
if (!options.active()) return;
- options.notify(`已采用 ${result.completed} 项${result.failures.length ? `,${result.failures.length} 项未完成` : ''}`);
+ options.notify(`已处理 ${result.completed} 项${result.failures.length ? `,${result.failures.length} 项未完成` : ''}`);
result.failures.forEach(item => state.errors.set(item.key, item.message));
const host = root.parentElement;
options.refresh();
host?.querySelector<HTMLButtonElement>('.reviewbulkbar button')?.focus({ preventScroll: true });
- };
- }
- function update() { toggle.textContent = state.active ? '退出多选' : '多选'; toggle.setAttribute('aria-pressed', String(state.active)); controls.forEach(control => control()); }
- toggle.onclick = () => { if (state.busy) return; state.active = !state.active; if (!state.active) state.selected.clear(); update(); };
+ }
+ function update() {
+ all.hidden = source.hidden = approve.hidden = reject.hidden = !state.active;
+ source.hidden ||= !options.metadata;
+ const chosen = selected();
+ all.textContent = chosen.length === cards.length ? '清空选择' : '全选本页';
+ approve.textContent = `通过所选(${chosen.length})`; reject.textContent = `拒绝所选(${chosen.length})`;
+ approve.disabled = !chosen.length || chosen.some(card => !eligible(card)); reject.disabled = !chosen.length;
+ const rows = options.rows.filter(row => state.selected.has(row.item_key));
+ const sources = commonReviewSources(rows);
+ source.innerHTML = selectFieldHtml([['', rows.length && !sources.length ? '所选项目无共同来源' : '统一选择来源'], ...sources.map(value => [value, value])], '', {label: '统一选择来源'});
+ const field = wireSelectField(source.firstElementChild!); field.disabled = !sources.length;
+ field.addEventListener('change', () => {
+ if (state.busy || !sources.includes(field.value)) return;
+ for (const card of chosen) {
+ const row = rows.find(row => row.item_key === card.dataset.reviewKey)!;
+ const candidate = row.candidates!.find(candidate => candidate.source === field.value)!;
+ card.querySelectorAll<HTMLInputElement>('input[type="radio"]').forEach(radio => { radio.checked = radio.value === candidate.candidate_key; });
+ state.choices.set(row.item_key, candidate.candidate_key);
+ }
+ feedback.textContent = `已为 ${chosen.length} 项选择 ${field.value},点击通过所选采用。`;
+ });
+ toggle.textContent = state.active ? '退出多选' : '多选'; toggle.setAttribute('aria-pressed', String(state.active)); controls.forEach(control => control()); }
+ const setMode = (active: boolean) => { if (state.busy) return; state.active = active; if (!active) state.selected.clear(); update(); options.modeChanged?.(active); };
+ toggle.onclick = () => setMode(!state.active);
update();
+ return { setMode, get busy() { return state.busy; } };
+}
+
+/** 每个所选项目都只有一个同来源候选时,才允许统一选择该来源。 */
+export function commonReviewSources(rows: ReviewRow[]): string[] {
+ if (!rows.length) return [];
+ return [...new Set(rows.flatMap(row => row.candidates?.map(candidate => candidate.source || '') || []))]
+ .filter(source => source && rows.every(row => row.candidates?.filter(candidate => candidate.source === source).length === 1));
}
diff --git a/frontend/test/catalog-onboarding.test.ts b/frontend/test/catalog-onboarding.test.ts
index 4971456b4..d7c08730a 100644
--- a/frontend/test/catalog-onboarding.test.ts
+++ b/frontend/test/catalog-onboarding.test.ts
@@ -18,11 +18,11 @@ describe('当前馆藏推荐', () => {
});
describe('馆藏与资料空状态', () => {
- it('空首页保留三个头像、厂商和标签的静止布局', () => {
+ it('空首页保留横向头像、厂牌和标签的静止布局', () => {
const layout = emptyCatalogLayout();
- expect(layout.tiers.match(/class="av"/g)).toHaveLength(3);
- expect(layout.tiers.match(/class="brandpill"/g)).toHaveLength(3);
- expect(layout.tags.match(/class="pill"/g)).toHaveLength(3);
+ expect(layout.tiers.match(/class="av"/g)).toHaveLength(64);
+ expect(layout.tiers.match(/class="brandpill"/g)).toHaveLength(64);
+ expect(layout.tags.match(/class="pill"/g)).toHaveLength(64);
expect(layout.tiers).not.toContain('aria-busy');
expect(layout.tiers).toContain('aria-hidden="true"');
});
diff --git a/frontend/test/review-bulk.test.ts b/frontend/test/review-bulk.test.ts
index 43be8ef99..7b84b6887 100644
--- a/frontend/test/review-bulk.test.ts
+++ b/frontend/test/review-bulk.test.ts
@@ -1,5 +1,5 @@
import { afterEach, expect, it, vi } from 'vitest';
-import { applyReviewSelection, createReviewSelection, wireReviewSelection } from '../src/review-bulk';
+import { applyReviewSelection, commonReviewSources, createReviewSelection, wireReviewSelection } from '../src/review-bulk';
afterEach(() => { document.body.innerHTML = ''; });
it('逐项采用保留失败项,重试仅提交失败项', async () => {
@@ -26,7 +26,7 @@ it('离开页面后停止提交后续项', async () => {
function fixture(locked = false) {
const state = createReviewSelection();
const root = document.createElement('div'); document.body.append(root);
- const rows = [{ item_key: 'one', candidates: [{ candidate_key: 'one-nfo' }] }, { item_key: 'two', candidates: [{ candidate_key: 'two-nfo' }, { candidate_key: 'two-api' }] }];
+ const rows = [{ item_key: 'one', candidates: [{ candidate_key: 'one-nfo', source: 'local_nfo' }] }, { item_key: 'two', candidates: [{ candidate_key: 'two-nfo', source: 'local_nfo' }, { candidate_key: 'two-api', source: 'api' }] }];
const submit = vi.fn(async (_payload: Record<string, unknown>) => ({ ok: true }));
const notify = vi.fn();
const render = () => {
@@ -56,7 +56,7 @@ it('多来源先明确选择,失败后保持选择与错误,再次采用成
expect(f.root.textContent).toContain('服务端未采用该项');
f.button('采用所选(1)').click();
await vi.waitFor(() => expect(f.rows.map(row => row.item_key)).toEqual(['one']));
- expect(f.submit.mock.calls.map(call => call[0])).toEqual(Array(2).fill({ item_key: 'two', candidate_key: 'two-api' }));
+ expect(f.submit.mock.calls.map(call => call[0])).toEqual(Array(2).fill({ item_key: 'two', candidate_key: 'two-api', status: 'approved' }));
f.button('退出多选').click();
expect(f.state.active).toBe(false);
expect(f.state.selected.size).toBe(0);
@@ -68,7 +68,30 @@ it('单一候选可整组采用,只读端不提供批量操作', async () => {
const group = f.root.querySelector('.reviewgroup')!;
f.button('全选本组', group).click(); f.button('采用所选', group).click();
await vi.waitFor(() => expect(f.rows).toHaveLength(1));
- expect(f.submit).toHaveBeenCalledExactlyOnceWith({ item_key: 'one', candidate_key: 'one-nfo' });
+ expect(f.submit).toHaveBeenCalledExactlyOnceWith({ item_key: 'one', candidate_key: 'one-nfo', status: 'approved' });
const reader = fixture(true);
expect(reader.root.querySelector('.reviewbulkbar')).toBeNull();
});
+
+it('跨组统一来源只选择对应候选,统一通过才提交', async () => {
+ const f = fixture(); f.button('多选').click(); f.button('全选本页').click();
+ const source = f.root.querySelector('.reviewbulksource .gselect') as HTMLElement & {value: string};
+ source.value = 'local_nfo'; source.dispatchEvent(new Event('change'));
+ expect(f.submit).not.toHaveBeenCalled();
+ expect([...f.state.choices.values()]).toEqual(['one-nfo', 'two-nfo']);
+ f.button('通过所选').click();
+ await vi.waitFor(() => expect(f.rows).toHaveLength(0));
+ expect(f.submit.mock.calls.map(call => call[0].candidate_key)).toEqual(['one-nfo', 'two-nfo']);
+});
+
+it('统一拒绝不需要选择来源', async () => {
+ const f = fixture(); f.button('多选').click(); f.button('全选本页').click(); f.button('拒绝所选').click();
+ await vi.waitFor(() => expect(f.rows).toHaveLength(0));
+ expect(f.submit.mock.calls.map(call => call[0].status)).toEqual(['rejected', 'rejected']);
+});
+
+it('共同来源排除缺失与同来源多候选的歧义', () => {
+ expect(commonReviewSources([])).toEqual([]);
+ expect(commonReviewSources([{item_key:'a', candidates:[{candidate_key:'1',source:'nfo'}, {candidate_key:'2',source:'nfo'}]}])).toEqual([]);
+ expect(commonReviewSources([{item_key:'a', candidates:[{candidate_key:'1',source:'nfo'}]}, {item_key:'b',candidates:[]}])).toEqual([]);
+});
diff --git a/frontend/test/stubs/legacy-ui.ts b/frontend/test/stubs/legacy-ui.ts
index 4f1337987..4306b3562 100644
--- a/frontend/test/stubs/legacy-ui.ts
+++ b/frontend/test/stubs/legacy-ui.ts
@@ -29,6 +29,7 @@ export const wireSelectField = (root: HTMLElement) => {
Object.defineProperty(root, 'value', { get: () => root.dataset.value, set: (value: string) => { root.dataset.value = value; } });
return root as HTMLElement & { value: string; disabled: boolean };
};
+export const wireCollapse = (_root: ParentNode, _selector: string, _idPrefix: string): void => {};
export const setActionBusy = (control: Element | null, busy = true): void => {
if (!control) return;
diff --git a/scripts/vendor_web_dependencies.mjs b/scripts/vendor_web_dependencies.mjs
index ce448686d..6d872d16b 100644
--- a/scripts/vendor_web_dependencies.mjs
+++ b/scripts/vendor_web_dependencies.mjs
@@ -91,7 +91,7 @@ const lucideIcons = new Map([
["folder-cog", "folder-cog"],
// 配置页每行文件夹的「选择文件夹」:弹系统对话框去挑。`folder-open` 归「打开位置」,不兼任。
["folder-search", "folder-search"],
- ["ratio", "ratio"], ["sun", "sun"], ["moon", "moon"],
+ ["sun", "sun"], ["moon", "moon"],
]);
// 自绘 symbol:没有上游可对,所以在这里逐个点名。下面那道分区检查要求雪碧图里
diff --git a/tests/test_web_ui.py b/tests/test_web_ui.py
index af0c94306..6b96e2087 100644
--- a/tests/test_web_ui.py
+++ b/tests/test_web_ui.py
@@ -4015,6 +4015,18 @@ class WebUiSourceTests(unittest.TestCase):
self.assertPageContains("$('#tiers').hidden=!(emptyLayout||perfRow||studioRow);")
self.assertPageContains(".tiers[hidden]{display:none}")
+ def test_empty_home_places_tags_after_view_filters_and_clips_identity_tracks(self):
+ self.assertPageContains("$('#tiers').innerHTML=emptyLayout?emptyLayout.tiers:tier(perfRow)+tier(studioRow);")
+ self.assertPageContains("viewPillsHtml(filterState)+(emptyLayout?.tags||'')")
+ self.assertPageContains(".tier.catalog-placeholder{overflow:hidden}")
+ self.assertPageContains("flex:1 0 240px;min-width:240px;overflow:hidden")
+
+ def test_review_selection_shares_header_and_has_a_separate_toolbar(self):
+ self.assertPageContains("reviewSelectionController?.setMode(selectMode)")
+ self.assertPageContains("path==='/review'&&reviewRuntime&&!reviewRuntime.ledger_read_only")
+ self.assertPageContains(".reviewbulktoolbar{width:100%;padding-block:16px}")
+ self.assertPageContains(".taste-guide-skip{width:100%;height:var(--control-h);color:var(--meter)}")
+
def test_collapsed_rail_is_divided_from_the_content_beside_it(self):
"""窄栏和内容区背景接近,没有分割线就看不出左边那一条到哪里为止。
@@ -4670,7 +4682,7 @@ class WebUiSourceTests(unittest.TestCase):
self.assertPageContains("{match:'/studios',nav:'studios',title:'厂牌',")
self.assertPageContains("{match:'/agencies',title:'事务所',")
# 侧栏那一项进的是厂牌索引。
- self.assertPageContains("['studios','厂商','clapperboard'],")
+ self.assertPageContains("['studios','厂牌','clapperboard'],")
def test_the_studio_index_wears_the_same_logo_the_profile_does(self):
"""538 个标识在盘上,索引页却格格首字母的话,这一屏读不出是哪些牌子。"""
@@ -6066,10 +6078,10 @@ class WebUiSourceTests(unittest.TestCase):
self.assertPageContains(".detailtitle .stitle{min-width:0;margin:0;line-height:1.75}")
def test_detail_metadata_uses_icons_instead_of_release_copy(self):
- self.assertPageContains('<span class="detailmetaitem">${icon(\'ratio\')}')
+ self.assertPageContains('<span class="detailmetaitem">${icon(\'monitor\')}')
self.assertPageContains('<span class="detailmetaitem">${icon(\'hard-drive\')}')
self.assertPageContains('<span class="detailmetaitem">${icon(\'calendar\')}')
- self.assertPageContains('id="i-ratio"')
+ self.assertPageContains('id="i-monitor"')
self.assertPageContains('id="i-calendar"')
self.assertPageLacks("发行 ${esc(it.release_date)}")
@@ -6453,15 +6465,15 @@ class WebUiSourceTests(unittest.TestCase):
.read_text(encoding="utf-8"))
# 主题三档各归各的:太阳是浅色、月亮是深色;跟随系统那档说的是「照这台设备走」,
# 讲的是设备不是明暗,所以跟 vercel.com 后台一样用显示器。画面尺寸量的是画幅本身,
- # 归 `ratio`。
+ # 分辨率同样使用显示器。
self.assertPageContains(
"[['system','跟随系统','monitor'],['light','浅色','sun'],['dark','深色','moon']]")
- self.assertPageContains("${icon('ratio')}<span>${it.width||'?'}×${it.height||'?'}</span>")
+ self.assertPageContains("${icon('monitor')}<span>${it.width||'?'}×${it.height||'?'}</span>")
# 换下来的这几枚没有别的使用者,雪碧图里也不留。星是有使用者的那一枚:
# 详情页的五星评分,写进 `asset.rating`,不与任何别的意思共用。
- # 厂商索引进去是出片的那些牌子,字形因此说「拍片」而不是说「一栋楼」;
+ # 厂牌索引进去是出片的那些牌子,字形因此说「拍片」而不是说「一栋楼」;
# 名下带人的事务所在同一个开关的另一半,走公文包。
- self.assertPageContains("['studios','厂商','clapperboard'],")
+ self.assertPageContains("['studios','厂牌','clapperboard'],")
self.assertPageContains('<symbol id="i-clapperboard" viewBox="0 0 24 24">')
for gone in ("i-monitor-cog", "i-volume-2", "i-sun-moon", "i-building",
"i-sliders-horizontal", "i-computer"):
diff --git a/web/app.js b/web/app.js
index a42c43605..3eba7059b 100644
--- a/web/app.js
+++ b/web/app.js
@@ -124,7 +124,7 @@ const ROUTES=[
{match:'/creators',title:'创作者',
open:(params,push)=>openIndexRoute('creators',push),
reload:()=>openIndexRoute('creators',false,indexQuery())},
- /* 厂商索引的两半。厂牌出片、事务所出人,是两种实体,所以是两条路径;页内那个
+ /* 厂牌出片、事务所出人,是两种实体,所以是两条路径;页内那个
开关只是在两条路径之间走,不是同一份数据的两种筛选。 */
{match:'/studios',nav:'studios',title:'厂牌',
open:(params,push)=>openIndexRoute('studios',push),
@@ -372,7 +372,7 @@ async function loadSourceStatus(){
const DURATION_TAGS=new Set(['短片-2分内','中片-10分内','长片-30分内','超长片-30分上']);
const SETTINGS_KEY='peach.settings.v1';
/* 侧栏默认给的那八个入口和它们的次序。首页之后先是关注——它是每天有新东西的那一屏;
- JAV 是主库最常用的浏览模式,排在三个索引(艺人、标签、厂商)前面;已标记是回头找,
+ JAV 是主库最常用的浏览模式,排在三个索引(艺人、标签、厂牌)前面;已标记是回头找,
管理垫底。播放列表和沉浸模式默认不在:两者都是从一条作品或一个索引里发起的动作,
常驻一格换来的是每次都要跳过它。要它们的人在设置里加回来,键仍在 NAV_CATALOG 里。
这份清单与 `src/peach/web_settings.py` 的同名常量逐字比对(test_web_settings.py)。 */
@@ -398,9 +398,7 @@ const defaultSortDir=key=>SORT_DIR_WORDS[key]?'desc':'';
跟随系统是默认档,选它等于不写属性。 */
const THEME_CHOICES=['system','light','dark'];
const JAV_LAYOUTS=[['big','大图','maximize'],['small','小图','layout-grid']];
-/* 跟随系统那一档跟 vercel.com 后台一样用显示器:这一档说的是「照这台设备的设定走」,
- 讲的是设备而不是明暗,日月合体的那枚反而在说明暗。`monitor` 因此归给它,详情页的
- 画面尺寸改用 `ratio`——那里量的是画幅本身,不是放画幅的那台机器。 */
+/* 显示器用于跟随系统主题和详情页的画面分辨率。 */
const THEME_OPTIONS=[['system','跟随系统','monitor'],['light','浅色','sun'],['dark','深色','moon']];
const DEFAULT_SETTINGS={batchSize:60,defaultSort:'seed',sortDefaultsVersion:3,hoverDelaySeconds:5,seekSeconds:10,searchHistoryLimit:10,relatedLimit:20,javLayout:'big',javImage:'cover',followLayout:'cozy',peopleLayout:'big',ambientMode:true,theaterMode:false,theme:'system',groupCollapse:true,sidebarOrder:DEFAULT_SIDEBAR_ORDER};
let appSettings={...DEFAULT_SETTINGS};
@@ -1617,7 +1615,8 @@ async function mountDetailPlayer(it,video,autoplay,options={}){
}
const selected=new Set(),followSelected=new Set();
let selectMode=false,lastSelectedId=null,followLastSelectedId=null,selectSurface='';
-const currentSelectSurface=()=>location.pathname==='/follow'?'follow':location.pathname==='/junk-files'?'junk':'catalog';
+let reviewSelectionController=null;
+const currentSelectSurface=()=>location.pathname==='/review'?'review':location.pathname==='/follow'?'follow':location.pathname==='/junk-files'?'junk':'catalog';
function paintSelection(){
document.querySelectorAll('.card[data-id]').forEach(card=>card.classList.toggle('selected',selected.has(+card.dataset.id)));
document.querySelectorAll('.followitem[data-follow-item]').forEach(card=>
@@ -1637,9 +1636,11 @@ function paintSelection(){
paintTagIndexSelection();
}
function setSelectMode(on,clear=false){
+ if(location.pathname==='/review'&&reviewSelectionController?.busy)return;
if(on&&!selectMode)selectSurface=currentSelectSurface();
selectMode=!!on;if(!selectMode)selectSurface='';document.body.classList.toggle('select-mode',selectMode);
if(selectMode)releaseHoverPreviews();
+ if(location.pathname==='/review')reviewSelectionController?.setMode(selectMode);
$('#selectMode').setAttribute('aria-pressed',selectMode);if(clear){selected.clear();followSelected.clear();selectedIndexTags.clear();lastSelectedId=null;followLastSelectedId=null}paintSelection()}
/* 只取网格直属卡片:竖屏条是嵌在网格里的横向滚动条,不该被 Shift 范围选中顺带框进来。 */
function visibleCardIds(){return [...gridCards()].map(card=>+card.dataset.id)}
@@ -2677,7 +2678,7 @@ async function buildBars(){
const tier=html=>html?`<div class="tier">${html}</div>`:'';
const emptyHome=context.type==='home'&&!javActive()&&!state.state&&!state.q&&!facetData.locations.some(row=>row.n>0);
const emptyLayout=emptyHome?emptyCatalogLayout():null;
- $('#tiers').innerHTML=emptyLayout?emptyLayout.tiers+tier(emptyLayout.tags):tier(perfRow)+tier(studioRow);
+ $('#tiers').innerHTML=emptyLayout?emptyLayout.tiers:tier(perfRow)+tier(studioRow);
$('#tiers').hidden=!(emptyLayout||perfRow||studioRow);
$('#tiers').removeAttribute('aria-busy');
$('#tiers').querySelectorAll('[data-entity-kind]').forEach(b=>b.onclick=()=>
@@ -2691,7 +2692,7 @@ async function buildBars(){
});
$('#tagbar').removeAttribute('aria-busy');
- $('#tagbar').innerHTML=viewPillsHtml(filterState)
+ $('#tagbar').innerHTML=viewPillsHtml(filterState)+(emptyLayout?.tags||'')
+seededSample(topTags,26,`tags:${state.seed||''}`).map(t=>
`<button class="pill" data-tag="${esc(t.k)}" aria-pressed="${
tagPressed(filterState.tag,t.k)}">${esc(tagLabel(t.k))}</button>`).join('');
@@ -3706,7 +3707,7 @@ async function openReview(push=true){
const next=await surfaceApi(surface,'/api/review');
if(!surfaceCurrent(surface))return;
reviewRuntime=runtime;reviewData=next;
- const selection=createReviewSelection();
+ const selection=createReviewSelection(); selection.active=selectMode; reviewSelectionController=null;
const render=()=>{
const category=reviewCategory;
const rows=reviewData.sections[reviewCategory]||[];
@@ -3828,9 +3829,11 @@ async function openReview(push=true){
selection.selected.delete(key);selection.choices.delete(key);selection.assets.delete(key);selection.errors.delete(key);
};
const current=()=>surfaceCurrent(surface)&&category===reviewCategory;
- wireReviewSelection($('#stats').querySelector('.review'),{rows,metadata:category==='metadata_fields',locked,state:selection,
+ reviewSelectionController=wireReviewSelection($('#stats').querySelector('.review'),{rows,metadata:category==='metadata_fields',locked,state:selection,
+ modeChanged:active=>{if(selectMode!==active)setSelectMode(active)},
payload:decisionPayload,submit:payload=>api('/api/review/decision',{method:'POST',body:JSON.stringify(payload)}),
applied:removeReviewed,active:current,refresh:render,notify:actionReceipt});
+ syncHeaderActions();
$('#stats').querySelectorAll('[data-review-status]').forEach(button=>button.onclick=async()=>{
if(selection.busy)return;
const item=button.closest('[data-review-key]');button.disabled=true;selection.busy=true;
@@ -6525,7 +6528,7 @@ $('#filterBtn').onclick=()=>openDrawer(!$('#drawer').classList.contains('open'))
const EDGE_ICONS=[
['','首页','home'],
['performers','艺人','user-round'],
- ['studios','厂商','clapperboard'],
+ ['studios','厂牌','clapperboard'],
['tags','标签','tags'],
['jav','JAV','jav'],
['flagged','已标记','bookmark'],
@@ -6959,7 +6962,7 @@ function syncHeaderActions(){
setSelectMode(false,true);
const entity=parts.length>1&&Object.prototype.hasOwnProperty.call(ROUTE_ENTITIES,parts[0]);
const catalog=isCatalogPath(path)||path==='/trash';
- const canSelect=catalog||entity||path==='/tags'||path==='/follow';
+ const canSelect=catalog||entity||path==='/tags'||path==='/follow'||(path==='/review'&&reviewRuntime&&!reviewRuntime.ledger_read_only);
const canDensity=catalog||entity||path==='/follow';
$('#selectMode').hidden=!canSelect;$('#density').hidden=!canDensity;
if(!canSelect&&selectMode)setSelectMode(false,true);
@@ -7480,7 +7483,7 @@ async function openItem(id,push=true,queueContext=null,anchor=null){
${it.location==='online'?'':`<span class="srcstate detailtitlestate" aria-live="polite"></span>`}
${ratingHtml(it.rating)}
<div class="smeta mono">
- <span class="detailmetaitem">${icon('ratio')}<span>${it.width||'?'}×${it.height||'?'}</span></span>
+ <span class="detailmetaitem">${icon('monitor')}<span>${it.width||'?'}×${it.height||'?'}</span></span>
<span class="detailmetaitem">${icon('hard-drive')}<span>${fmtSize(it.size||0)}</span></span>
${it.release_date?`<span class="detailmetaitem">${icon('calendar')}<span>${esc(it.release_date)}</span></span>`:''}</div>
<div class="detailidentity">${identityRows||`<div class="identityrow"><span></span><span class="ilabel">归属</span><span>${esc(who)}</span></div>`}</div>
diff --git a/web/css/04-manage.css b/web/css/04-manage.css
index 639727d37..6e576b9e9 100644
--- a/web/css/04-manage.css
+++ b/web/css/04-manage.css
@@ -88,7 +88,7 @@
.taste-history-guide-content{display:grid;gap:12px;padding-top:16px;color:var(--muted);font-size:var(--fs-md);line-height:1.5}
.taste-history-guide-content p,.taste-history-guide-content ul{margin:0}
.taste-history-guide-content ul{padding-left:20px}
-.taste-history-guide-content .taste-guide-skip{width:100%;height:var(--control-h);color:var(--ink)}
+.taste-history-guide-content .taste-guide-skip{width:100%;height:var(--control-h);color:var(--meter)}
.fsrcoption{display:flex;align-items:center;gap:8px;justify-content:space-between}
.fsrcoption label{flex:1;min-width:0}
.fsrcoption .geist-button{font-size:var(--fs-sm);white-space:nowrap}
@@ -128,3 +128,10 @@
.library-processing-banner{--control-h:32px;display:flex;align-items:center;justify-content:center;gap:12px;padding:16px;margin-bottom:16px;background:var(--hover);color:var(--ink);font-size:var(--fs-lg);flex-wrap:wrap}
.library-processing-banner .geist-button{border-radius:var(--pill-radius);font-size:var(--fs-md)}
#libraryProcessing{scroll-margin-top:80px}
+
+.reviewbulktoolbar{width:100%;padding-block:16px}
+.reviewbulkfeedback{color:var(--muted)}
+.reviewbulksource{min-width:180px;max-width:100%}
+.reviewbulkreject{color:var(--drop)}
+.reviewbulkreject:hover{background:var(--drop);color:#fff}
+.taste-history-guide-content .taste-guide-skip:hover{color:var(--meter)}
diff --git a/web/css/09-skeleton.css b/web/css/09-skeleton.css
index 140aafbec..c289437d7 100644
--- a/web/css/09-skeleton.css
+++ b/web/css/09-skeleton.css
@@ -38,7 +38,8 @@
.catalog-placeholder .ring,.catalog-placeholder .nm,.catalog-placeholder .mk,.catalog-placeholder .placeholder-name,.catalog-placeholder .pill{background:var(--hover)}
.catalog-placeholder .nm{width:60%;margin-inline:auto;border-radius:var(--badge-radius)}
.catalog-placeholder .placeholder-name{width:48px;border-radius:var(--badge-radius)}
-.placeholder-tags{display:inline-flex;gap:8px}
+.tier.catalog-placeholder{overflow:hidden}
+.placeholder-tags{display:inline-flex;gap:8px;flex:1 0 240px;min-width:240px;overflow:hidden}
.placeholder-tags .pill{width:64px;border-color:transparent}
.postercard-skeleton .skeletoncard b,
.postercard-skeleton .skeletoncard em,
diff --git a/web/dist/peach-ui.js b/web/dist/peach-ui.js
index b1b3ed6ee..8077936be 100644
--- a/web/dist/peach-ui.js
+++ b/web/dist/peach-ui.js
@@ -36,59 +36,59 @@ function oe(e, t, n, r, i) {
function N(e) {
return e.children;
}
-function se(e, t) {
+function P(e, t) {
this.props = e, this.context = t;
}
-function P(e, t) {
- if (t == null) return e.__ ? P(e.__, e.__i + 1) : null;
+function F(e, t) {
+ if (t == null) return e.__ ? F(e.__, e.__i + 1) : null;
for (var n; t < e.__k.length; t++) if ((n = e.__k[t]) != null && n.__e != null) return n.__e;
- return typeof e.type == "function" ? P(e) : null;
+ return typeof e.type == "function" ? F(e) : null;
}
-function ce(e) {
+function se(e) {
if (e.__P && e.__d) {
var t = e.__v, n = t.__e, r = [], i = [], a = M({}, t);
- a.__v = t.__v + 1, v.vnode && v.vnode(a), ye(e.__P, a, t, e.__n, e.__P.namespaceURI, 32 & t.__u ? [n] : null, r, n ?? P(t), !!(32 & t.__u), i), a.__v = t.__v, a.__.__k[a.__i] = a, xe(r, a, i), t.__e = t.__ = null, a.__e != n && le(a);
+ a.__v = t.__v + 1, v.vnode && v.vnode(a), ve(e.__P, a, t, e.__n, e.__P.namespaceURI, 32 & t.__u ? [n] : null, r, n ?? F(t), !!(32 & t.__u), i), a.__v = t.__v, a.__.__k[a.__i] = a, be(r, a, i), t.__e = t.__ = null, a.__e != n && ce(a);
}
}
-function le(e) {
+function ce(e) {
if ((e = e.__) != null && e.__c != null) return e.__e = e.__c.base = null, e.__k.some(function(t) {
if (t != null && t.__e != null) return e.__e = e.__c.base = t.__e;
- }), le(e);
+ }), ce(e);
}
-function ue(e) {
- (!e.__d && (e.__d = !0) && x.push(e) && !de.__r++ || S != v.debounceRendering) && ((S = v.debounceRendering) || C)(de);
+function le(e) {
+ (!e.__d && (e.__d = !0) && x.push(e) && !ue.__r++ || S != v.debounceRendering) && ((S = v.debounceRendering) || C)(ue);
}
-function de() {
+function ue() {
try {
- for (var e, t = 1; x.length;) x.length > t && x.sort(w), e = x.shift(), t = x.length, ce(e);
+ for (var e, t = 1; x.length;) x.length > t && x.sort(w), e = x.shift(), t = x.length, se(e);
} finally {
- x.length = de.__r = 0;
+ x.length = ue.__r = 0;
}
}
-function fe(e, t, n, r, i, a, o, s, c, l, u) {
+function de(e, t, n, r, i, a, o, s, c, l, u) {
var d, f, p, m, h, g, _ = r && r.__k || j, v = t.length;
- for (c = pe(n, t, _, c, v), d = 0; d < v; d++) (p = n.__k[d]) != null && (f = p.__i != -1 && _[p.__i] || A, p.__i = d, g = ye(e, p, f, i, a, o, s, c, l, u), m = p.__e, p.ref && f.ref != p.ref && (f.ref && we(f.ref, null, p), u.push(p.ref, p.__c || m, p)), h == null && m != null && (h = m), 4 & p.__u ? (c = me(p, c, e), f.__e && (f.__e = null)) : typeof p.type == "function" && g !== void 0 ? c = g : m && (c = m.nextSibling), p.__u &= -7);
+ for (c = fe(n, t, _, c, v), d = 0; d < v; d++) (p = n.__k[d]) != null && (f = p.__i != -1 && _[p.__i] || A, p.__i = d, g = ve(e, p, f, i, a, o, s, c, l, u), m = p.__e, p.ref && f.ref != p.ref && (f.ref && Ce(f.ref, null, p), u.push(p.ref, p.__c || m, p)), h == null && m != null && (h = m), 4 & p.__u ? (c = pe(p, c, e), f.__e && (f.__e = null)) : typeof p.type == "function" && g !== void 0 ? c = g : m && (c = m.nextSibling), p.__u &= -7);
return n.__e = h, c;
}
-function pe(e, t, n, r, i) {
+function fe(e, t, n, r, i) {
var a, o, s, c, l, u = n.length, d = u, f = 0;
- for (e.__k = Array(i), a = 0; a < i; a++) (o = t[a]) != null && typeof o != "boolean" && typeof o != "function" ? (typeof o == "string" || typeof o == "number" || typeof o == "bigint" || o.constructor == String ? o = e.__k[a] = oe(null, o, null, null, null) : re(o) ? o = e.__k[a] = oe(N, { children: o }, null, null, null) : o.constructor === void 0 && o.__b > 0 ? o = e.__k[a] = oe(o.type, o.props, o.key, o.ref ? o.ref : null, o.__v) : e.__k[a] = o, c = a + f, o.__ = e, o.__b = e.__b + 1, s = null, (l = o.__i = he(o, n, c, d)) != -1 && (d--, (s = n[l]) && (s.__u |= 2)), s == null || s.__v == null ? (l == -1 && (i > u ? f-- : i < u && f++), typeof o.type != "function" && (o.__u |= 4)) : l != c && (l == c - 1 ? f-- : l == c + 1 ? f++ : (l > c ? f-- : f++, o.__u |= 4))) : e.__k[a] = null;
- if (d) for (a = 0; a < u; a++) (s = n[a]) != null && !(2 & s.__u) && (s.__e == r && (r = P(s)), Te(s, s));
+ for (e.__k = Array(i), a = 0; a < i; a++) (o = t[a]) != null && typeof o != "boolean" && typeof o != "function" ? (typeof o == "string" || typeof o == "number" || typeof o == "bigint" || o.constructor == String ? o = e.__k[a] = oe(null, o, null, null, null) : re(o) ? o = e.__k[a] = oe(N, { children: o }, null, null, null) : o.constructor === void 0 && o.__b > 0 ? o = e.__k[a] = oe(o.type, o.props, o.key, o.ref ? o.ref : null, o.__v) : e.__k[a] = o, c = a + f, o.__ = e, o.__b = e.__b + 1, s = null, (l = o.__i = me(o, n, c, d)) != -1 && (d--, (s = n[l]) && (s.__u |= 2)), s == null || s.__v == null ? (l == -1 && (i > u ? f-- : i < u && f++), typeof o.type != "function" && (o.__u |= 4)) : l != c && (l == c - 1 ? f-- : l == c + 1 ? f++ : (l > c ? f-- : f++, o.__u |= 4))) : e.__k[a] = null;
+ if (d) for (a = 0; a < u; a++) (s = n[a]) != null && !(2 & s.__u) && (s.__e == r && (r = F(s)), we(s, s));
return r;
}
-function me(e, t, n) {
+function pe(e, t, n) {
var r, i;
if (typeof e.type == "function") {
- for (r = e.__k, i = 0; r && i < r.length; i++) r[i] && (r[i].__ = e, t = me(r[i], t, n));
+ for (r = e.__k, i = 0; r && i < r.length; i++) r[i] && (r[i].__ = e, t = pe(r[i], t, n));
return t;
}
- e.__e != t && (t && e.type && !t.parentNode && (t = P(e)), t = n.insertBefore(e.__e, t || null));
+ e.__e != t && (t && e.type && !t.parentNode && (t = F(e)), t = n.insertBefore(e.__e, t || null));
do
t &&= t.nextSibling;
while (t != null && t.nodeType == 8);
return t;
}
-function he(e, t, n, r) {
+function me(e, t, n, r) {
var i, a, o, s = e.key, c = e.type, l = t[n], u = l != null && !(2 & l.__u);
if (l === null && s == null || u && s == l.key && c == l.type) return n;
if (r > +!!u) {
@@ -96,16 +96,16 @@ function he(e, t, n, r) {
}
return -1;
}
-function ge(e, t, n) {
+function he(e, t, n) {
t[0] == "-" ? e.setProperty(t, n ?? "") : e[t] = n == null ? "" : typeof n != "number" || ne.test(t) ? n : n + "px";
}
-function _e(e, t, n, r, i) {
+function ge(e, t, n, r, i) {
var a, o;
n: if (t == "style") {
if (typeof n == "string") e.style.cssText = n;
else {
- if (typeof r == "string" && (e.style.cssText = r = ""), r) for (t in r) n && t in n || ge(e.style, t, "");
- if (n) for (t in n) r && n[t] == r[t] || ge(e.style, t, n[t]);
+ if (typeof r == "string" && (e.style.cssText = r = ""), r) for (t in r) n && t in n || he(e.style, t, "");
+ if (n) for (t in n) r && n[t] == r[t] || he(e.style, t, n[t]);
}
} else if (t[0] == "o" && t[1] == "n") a = t != (t = t.replace(ee, "$1")), o = t.toLowerCase(), t = o in e || t == "onFocusOut" || t == "onFocusIn" ? o.slice(2) : t.slice(2), e.l ||= {}, e.l[t + a] = n, n ? r ? n[D] = r[D] : (n[D] = O, e.addEventListener(t, a ? te : k, a)) : e.removeEventListener(t, a ? te : k, a);
else {
@@ -117,7 +117,7 @@ function _e(e, t, n, r, i) {
typeof n == "function" || (n == null || !1 === n && t[4] != "-" ? e.removeAttribute(t) : e.setAttribute(t, t == "popover" && n == 1 ? "" : n));
}
}
-function ve(e) {
+function _e(e) {
return function(t) {
if (this.l) {
var n = this.l[t.type + e];
@@ -127,19 +127,19 @@ function ve(e) {
}
};
}
-function ye(e, t, n, r, i, a, o, s, c, l) {
+function ve(e, t, n, r, i, a, o, s, c, l) {
var u, d, f, p, m, h, g, _, y, b, x, S, C, w, T, E, D = t.type;
if (t.constructor !== void 0) return null;
128 & n.__u && (c = !!(32 & n.__u), a = [s = t.__e = n.__e]), (u = v.__b) && u(t);
n: if (typeof D == "function") {
d = o.length;
try {
- if (y = t.props, b = D.prototype && D.prototype.render, x = (u = D.contextType) && r[u.__c], S = u ? x ? x.props.value : u.__ : r, n.__c ? _ = (f = t.__c = n.__c).__ = f.__E : (b ? t.__c = f = new D(y, S) : (t.__c = f = new se(y, S), f.constructor = D, f.render = Ee), x && x.sub(f), f.state || (f.state = {}), f.__n = r, p = f.__d = !0, f.__h = [], f._sb = []), b && f.__s == null && (f.__s = f.state), b && D.getDerivedStateFromProps != null && (f.__s == f.state && (f.__s = M({}, f.__s)), M(f.__s, D.getDerivedStateFromProps(y, f.__s))), m = f.props, h = f.state, f.__v = t, p) b && D.getDerivedStateFromProps == null && f.componentWillMount != null && f.componentWillMount(), b && f.componentDidMount != null && f.__h.push(f.componentDidMount);
+ if (y = t.props, b = D.prototype && D.prototype.render, x = (u = D.contextType) && r[u.__c], S = u ? x ? x.props.value : u.__ : r, n.__c ? _ = (f = t.__c = n.__c).__ = f.__E : (b ? t.__c = f = new D(y, S) : (t.__c = f = new P(y, S), f.constructor = D, f.render = Te), x && x.sub(f), f.state || (f.state = {}), f.__n = r, p = f.__d = !0, f.__h = [], f._sb = []), b && f.__s == null && (f.__s = f.state), b && D.getDerivedStateFromProps != null && (f.__s == f.state && (f.__s = M({}, f.__s)), M(f.__s, D.getDerivedStateFromProps(y, f.__s))), m = f.props, h = f.state, f.__v = t, p) b && D.getDerivedStateFromProps == null && f.componentWillMount != null && f.componentWillMount(), b && f.componentDidMount != null && f.__h.push(f.componentDidMount);
else {
if (b && D.getDerivedStateFromProps == null && y !== m && f.componentWillReceiveProps != null && f.componentWillReceiveProps(y, S), t.__v == n.__v || !f.__e && f.shouldComponentUpdate != null && !1 === f.shouldComponentUpdate(y, f.__s, S)) {
t.__v != n.__v && (f.props = y, f.state = f.__s, f.__d = !1), t.__e = n.__e, t.__k = n.__k, t.__k.some(function(e) {
e && (e.__ = t);
- }), j.push.apply(f.__h, f._sb), f._sb = [], f.__h.length && o.push(f), s = P(n);
+ }), j.push.apply(f.__h, f._sb), f._sb = [], f.__h.length && o.push(f), s = F(n);
break n;
}
f.componentWillUpdate != null && f.componentWillUpdate(y, f.__s, S), b && f.componentDidUpdate != null && f.__h.push(function() {
@@ -150,7 +150,7 @@ function ye(e, t, n, r, i, a, o, s, c, l) {
else do
f.__d = !1, C && C(t), u = f.render(f.props, f.state, f.context), f.state = f.__s;
while (f.__d && ++w < 25);
- f.state = f.__s, f.getChildContext != null && (r = M(M({}, r), f.getChildContext())), b && !p && f.getSnapshotBeforeUpdate != null && (g = f.getSnapshotBeforeUpdate(m, h)), T = u != null && u.type === N && u.key == null ? Se(u.props.children) : u, s = fe(e, re(T) ? T : [T], t, n, r, i, a, o, s, c, l), f.base = t.__e, t.__u &= -161, f.__h.length && o.push(f), _ && (f.__E = f.__ = null);
+ f.state = f.__s, f.getChildContext != null && (r = M(M({}, r), f.getChildContext())), b && !p && f.getSnapshotBeforeUpdate != null && (g = f.getSnapshotBeforeUpdate(m, h)), T = u != null && u.type === N && u.key == null ? xe(u.props.children) : u, s = de(e, re(T) ? T : [T], t, n, r, i, a, o, s, c, l), f.base = t.__e, t.__u &= -161, f.__h.length && o.push(f), _ && (f.__E = f.__ = null);
} catch (e) {
if (o.length = d, t.__v = null, c || a != null) {
if (e.then) {
@@ -158,16 +158,16 @@ function ye(e, t, n, r, i, a, o, s, c, l) {
a != null && (a[a.indexOf(s)] = null), t.__e = s;
} else if (a != null) for (E = a.length; E--;) ie(a[E]);
} else t.__e = n.__e;
- t.__k ??= n.__k || [], e.then || be(t), v.__e(e, t, n);
+ t.__k ??= n.__k || [], e.then || ye(t), v.__e(e, t, n);
}
- } else a == null && t.__v == n.__v ? (t.__k = n.__k, t.__e = n.__e) : s = t.__e = Ce(n.__e, t, n, r, i, a, o, c, l);
+ } else a == null && t.__v == n.__v ? (t.__k = n.__k, t.__e = n.__e) : s = t.__e = Se(n.__e, t, n, r, i, a, o, c, l);
return (u = v.diffed) && u(t), 128 & t.__u ? void 0 : s;
}
-function be(e) {
- e && (e.__c && (e.__c.__e = !0), e.__k && e.__k.some(be));
+function ye(e) {
+ e && (e.__c && (e.__c.__e = !0), e.__k && e.__k.some(ye));
}
-function xe(e, t, n) {
- for (var r = 0; r < n.length; r++) we(n[r], n[++r], n[++r]);
+function be(e, t, n) {
+ for (var r = 0; r < n.length; r++) Ce(n[r], n[++r], n[++r]);
v.__c && v.__c(t, e), e.some(function(t) {
try {
e = t.__h, t.__h = [], e.some(function(e) {
@@ -178,10 +178,10 @@ function xe(e, t, n) {
}
});
}
-function Se(e) {
- return typeof e != "object" || !e || e.__b > 0 ? e : re(e) ? e.map(Se) : e.constructor === void 0 ? M({}, e) : null;
+function xe(e) {
+ return typeof e != "object" || !e || e.__b > 0 ? e : re(e) ? e.map(xe) : e.constructor === void 0 ? M({}, e) : null;
}
-function Ce(e, t, n, r, i, a, o, s, c) {
+function Se(e, t, n, r, i, a, o, s, c) {
var l, u, d, f, p, m, h, g = n.props || A, y = t.props, b = t.type;
if (b == "svg" ? i = "http://www.w3.org/2000/svg" : b == "math" ? i = "http://www.w3.org/1998/Math/MathML" : i ||= "http://www.w3.org/1999/xhtml", a != null) {
for (l = 0; l < a.length; l++) if ((p = a[l]) && "setAttribute" in p == !!b && (b ? p.localName == b : p.nodeType == 3)) {
@@ -196,15 +196,15 @@ function Ce(e, t, n, r, i, a, o, s, c) {
if (b == null) g === y || s && e.data == y || (e.data = y);
else {
if (a = b == "textarea" && y.defaultValue != null ? null : a && _.call(e.childNodes), !s && a != null) for (g = {}, l = 0; l < e.attributes.length; l++) g[(p = e.attributes[l]).name] = p.value;
- for (l in g) p = g[l], l == "dangerouslySetInnerHTML" ? d = p : l == "children" || l in y || l == "value" && "defaultValue" in y || l == "checked" && "defaultChecked" in y || _e(e, l, null, p, i);
- for (l in y) p = y[l], l == "children" ? f = p : l == "dangerouslySetInnerHTML" ? u = p : l == "value" ? m = p : l == "checked" ? h = p : s && typeof p != "function" || g[l] === p || _e(e, l, p, g[l], i);
+ for (l in g) p = g[l], l == "dangerouslySetInnerHTML" ? d = p : l == "children" || l in y || l == "value" && "defaultValue" in y || l == "checked" && "defaultChecked" in y || ge(e, l, null, p, i);
+ for (l in y) p = y[l], l == "children" ? f = p : l == "dangerouslySetInnerHTML" ? u = p : l == "value" ? m = p : l == "checked" ? h = p : s && typeof p != "function" || g[l] === p || ge(e, l, p, g[l], i);
if (u) s || d && (u.__html == d.__html || u.__html == e.innerHTML) || (e.innerHTML = u.__html), t.__k = [];
- else if (d && (e.innerHTML = ""), fe(t.type == "template" ? e.content : e, re(f) ? f : [f], t, n, r, b == "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, a, o, a ? a[0] : n.__k && P(n, 0), s, c), a != null) for (l = a.length; l--;) ie(a[l]);
- s && b != "textarea" || (l = "value", b == "progress" && m == null ? e.removeAttribute("value") : m != null && (m !== e[l] || b == "progress" && !m || b == "option" && m != g[l]) && _e(e, l, m, g[l], i), l = "checked", h != null && h != e[l] && _e(e, l, h, g[l], i));
+ else if (d && (e.innerHTML = ""), de(t.type == "template" ? e.content : e, re(f) ? f : [f], t, n, r, b == "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, a, o, a ? a[0] : n.__k && F(n, 0), s, c), a != null) for (l = a.length; l--;) ie(a[l]);
+ s && b != "textarea" || (l = "value", b == "progress" && m == null ? e.removeAttribute("value") : m != null && (m !== e[l] || b == "progress" && !m || b == "option" && m != g[l]) && ge(e, l, m, g[l], i), l = "checked", h != null && h != e[l] && ge(e, l, h, g[l], i));
}
return e;
}
-function we(e, t, n) {
+function Ce(e, t, n) {
try {
if (typeof e == "function") {
var r = typeof e.__u == "function";
@@ -214,9 +214,9 @@ function we(e, t, n) {
v.__e(e, n);
}
}
-function Te(e, t, n) {
+function we(e, t, n) {
var r, i;
- if (v.unmount && v.unmount(e), (r = e.ref) && (r.current && r.current != e.__e || we(r, null, t)), (r = e.__c) != null) {
+ if (v.unmount && v.unmount(e), (r = e.ref) && (r.current && r.current != e.__e || Ce(r, null, t)), (r = e.__c) != null) {
if (r.componentWillUnmount) try {
r.componentWillUnmount();
} catch (e) {
@@ -224,15 +224,15 @@ function Te(e, t, n) {
}
r.base = r.__P = r.__n = null;
}
- if (r = e.__k) for (i = 0; i < r.length; i++) r[i] && Te(r[i], t, n || typeof e.type != "function");
+ if (r = e.__k) for (i = 0; i < r.length; i++) r[i] && we(r[i], t, n || typeof e.type != "function");
n || ie(e.__e), e.__c = e.__ = e.__e = void 0;
}
-function Ee(e, t, n) {
+function Te(e, t, n) {
return this.constructor(e, n);
}
-function De(e, t, n) {
+function Ee(e, t, n) {
var r, i, a, o;
- t == document && (t = document.documentElement), v.__ && v.__(e, t), i = (r = typeof n == "function") ? null : n && n.__k || t.__k, a = [], o = [], ye(t, e = (!r && n || t).__k = ae(N, null, [e]), i || A, A, t.namespaceURI, !r && n ? [n] : i ? null : t.firstChild ? _.call(t.childNodes) : null, a, !r && n ? n : i ? i.__e : t.firstChild, r, o), xe(a, e, o), e.props.children = null;
+ t == document && (t = document.documentElement), v.__ && v.__(e, t), i = (r = typeof n == "function") ? null : n && n.__k || t.__k, a = [], o = [], ve(t, e = (!r && n || t).__k = ae(N, null, [e]), i || A, A, t.namespaceURI, !r && n ? [n] : i ? null : t.firstChild ? _.call(t.childNodes) : null, a, !r && n ? n : i ? i.__e : t.firstChild, r, o), be(a, e, o), e.props.children = null;
}
_ = j.slice, v = { __e: function(e, t, n, r) {
for (var i, a, o; t = t.__;) if ((i = t.__c) && !i.__) try {
@@ -243,28 +243,28 @@ _ = j.slice, v = { __e: function(e, t, n, r) {
throw e;
} }, y = 0, b = function(e) {
return e != null && e.constructor === void 0;
-}, se.prototype.setState = function(e, t) {
+}, P.prototype.setState = function(e, t) {
var n = this.__s != null && this.__s != this.state ? this.__s : this.__s = M({}, this.state);
- typeof e == "function" && (e = e(M({}, n), this.props)), e && M(n, e), e != null && this.__v && (t && this._sb.push(t), ue(this));
-}, se.prototype.forceUpdate = function(e) {
- this.__v && (this.__e = !0, e && this.__h.push(e), ue(this));
-}, se.prototype.render = N, x = [], C = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, w = function(e, t) {
+ typeof e == "function" && (e = e(M({}, n), this.props)), e && M(n, e), e != null && this.__v && (t && this._sb.push(t), le(this));
+}, P.prototype.forceUpdate = function(e) {
+ this.__v && (this.__e = !0, e && this.__h.push(e), le(this));
+}, P.prototype.render = N, x = [], C = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, w = function(e, t) {
return e.__v.__b - t.__v.__b;
-}, de.__r = 0, T = Math.random().toString(8), E = "__d" + T, D = "__a" + T, ee = /(PointerCapture)$|Capture$/i, O = 0, k = ve(!1), te = ve(!0);
+}, ue.__r = 0, T = Math.random().toString(8), E = "__d" + T, D = "__a" + T, ee = /(PointerCapture)$|Capture$/i, O = 0, k = _e(!1), te = _e(!0);
//#endregion
//#region src/sort-preferences.ts
-function Oe(e, t, n) {
+function De(e, t, n) {
return e === "seed" ? "" : e === t && n === "asc" ? "asc" : "desc";
}
//#endregion
//#region src/api.ts
-var ke = class extends Error {
+var Oe = class extends Error {
status;
body;
constructor(e, t, n = null) {
super(e), this.name = "ApiError", this.status = t, this.body = n;
}
-}, Ae = (e) => {
+}, ke = (e) => {
if (!e || typeof e != "object") return "";
let t = e;
for (let e of [
@@ -276,8 +276,8 @@ var ke = class extends Error {
if (typeof n == "string" && n) return n;
}
return "";
-}, F = (e) => e instanceof Error ? e.message : String(e);
-async function I(e, t) {
+}, I = (e) => e instanceof Error ? e.message : String(e);
+async function L(e, t) {
let n = await fetch(e, {
headers: { Accept: "application/json" },
credentials: "same-origin",
@@ -286,10 +286,10 @@ async function I(e, t) {
try {
r = await n.json();
} catch {}
- if (!n.ok) throw new ke(Ae(r) || `请求失败(${n.status})`, n.status);
+ if (!n.ok) throw new Oe(ke(r) || `请求失败(${n.status})`, n.status);
return r;
}
-async function L(e, t, n = "POST", r) {
+async function R(e, t, n = "POST", r) {
let i = await fetch(e, {
method: n,
...r ? { signal: r } : {},
@@ -303,29 +303,29 @@ async function L(e, t, n = "POST", r) {
try {
a = await i.json();
} catch {}
- if (!i.ok) throw new ke(Ae(a) || `请求失败(${i.status})`, i.status, a);
+ if (!i.ok) throw new Oe(ke(a) || `请求失败(${i.status})`, i.status, a);
return a;
}
//#endregion
//#region node_modules/preact/hooks/dist/hooks.module.js
-var R, z, je, Me, Ne = 0, Pe = [], B = v, Fe = B.__b, Ie = B.__r, Le = B.diffed, Re = B.__c, ze = B.unmount, Be = B.__;
-function Ve(e, t) {
- B.__h && B.__h(z, e, Ne || t), Ne = 0;
- var n = z.__H || (z.__H = {
+var z, B, Ae, je, Me = 0, Ne = [], V = v, Pe = V.__b, Fe = V.__r, Ie = V.diffed, Le = V.__c, Re = V.unmount, ze = V.__;
+function Be(e, t) {
+ V.__h && V.__h(B, e, Me || t), Me = 0;
+ var n = B.__H || (B.__H = {
__: [],
__h: []
});
return e >= n.__.length && n.__.push({}), n.__[e];
}
-function V(e) {
- return Ne = 1, He(Xe, e);
+function H(e) {
+ return Me = 1, Ve(Ye, e);
}
-function He(e, t, n) {
- var r = Ve(R++, 2);
- if (r.t = e, !r.__c && (r.__ = [n ? n(t) : Xe(void 0, t), function(e) {
+function Ve(e, t, n) {
+ var r = Be(z++, 2);
+ if (r.t = e, !r.__c && (r.__ = [n ? n(t) : Ye(void 0, t), function(e) {
var t = r.__N ? r.__N[0] : r.__[0], n = r.t(t, e);
t !== n && (r.__N = [n, r.__[1]], r.__c.setState({}));
- }], r.__c = z, !z.__f)) {
+ }], r.__c = B, !B.__f)) {
var i = function(e, t, n) {
if (!r.__c.__H) return !0;
var i = !1, o = r.__c.props !== e;
@@ -341,112 +341,112 @@ function He(e, t, n) {
}
return !i || o;
};
- z.__f = !0;
- var a = z.shouldComponentUpdate, o = z.componentWillUpdate;
- z.componentWillUpdate = function(e, t, n) {
+ B.__f = !0;
+ var a = B.shouldComponentUpdate, o = B.componentWillUpdate;
+ B.componentWillUpdate = function(e, t, n) {
if (this.__e) {
var r = a;
a = void 0, i(e, t, n), a = r;
}
o && o.call(this, e, t, n);
- }, z.shouldComponentUpdate = i;
+ }, B.shouldComponentUpdate = i;
}
return r.__N || r.__;
}
-function H(e, t) {
- var n = Ve(R++, 3);
- !B.__s && Ye(n.__H, t) && (n.__ = e, n.u = t, z.__H.__h.push(n));
-}
function U(e, t) {
- var n = Ve(R++, 4);
- !B.__s && Ye(n.__H, t) && (n.__ = e, n.u = t, z.__h.push(n));
+ var n = Be(z++, 3);
+ !V.__s && Je(n.__H, t) && (n.__ = e, n.u = t, B.__H.__h.push(n));
+}
+function W(e, t) {
+ var n = Be(z++, 4);
+ !V.__s && Je(n.__H, t) && (n.__ = e, n.u = t, B.__h.push(n));
}
-function W(e) {
- return Ne = 5, Ue(function() {
+function G(e) {
+ return Me = 5, He(function() {
return { current: e };
}, []);
}
-function Ue(e, t) {
- var n = Ve(R++, 7);
- return Ye(n.__H, t) && (n.__ = e(), n.__H = t, n.__h = e), n.__;
+function He(e, t) {
+ var n = Be(z++, 7);
+ return Je(n.__H, t) && (n.__ = e(), n.__H = t, n.__h = e), n.__;
}
-function We() {
- for (var e; e = Pe.shift();) {
+function Ue() {
+ for (var e; e = Ne.shift();) {
var t = e.__H;
if (e.__P && t) try {
- t.__h.some(qe), t.__h.some(Je), t.__h = [];
+ t.__h.some(Ke), t.__h.some(qe), t.__h = [];
} catch (n) {
- t.__h = [], B.__e(n, e.__v);
+ t.__h = [], V.__e(n, e.__v);
}
}
}
-B.__b = function(e) {
- z = null, Fe && Fe(e);
-}, B.__ = function(e, t) {
- e && t.__k && t.__k.__m && (e.__m = t.__k.__m), Be && Be(e, t);
-}, B.__r = function(e) {
- Ie && Ie(e), R = 0;
- var t = (z = e.__c).__H;
- t && (je === z ? (t.__h = [], z.__h = [], t.__.some(function(e) {
+V.__b = function(e) {
+ B = null, Pe && Pe(e);
+}, V.__ = function(e, t) {
+ e && t.__k && t.__k.__m && (e.__m = t.__k.__m), ze && ze(e, t);
+}, V.__r = function(e) {
+ Fe && Fe(e), z = 0;
+ var t = (B = e.__c).__H;
+ t && (Ae === B ? (t.__h = [], B.__h = [], t.__.some(function(e) {
e.__N && (e.__ = e.__N), e.u = e.__N = void 0;
- })) : (t.__h.some(qe), t.__h.some(Je), t.__h = [], R = 0)), je = z;
-}, B.diffed = function(e) {
- Le && Le(e);
+ })) : (t.__h.some(Ke), t.__h.some(qe), t.__h = [], z = 0)), Ae = B;
+}, V.diffed = function(e) {
+ Ie && Ie(e);
var t = e.__c;
- t && t.__H && (t.__H.__h.length && (Pe.push(t) !== 1 && Me === B.requestAnimationFrame || ((Me = B.requestAnimationFrame) || Ke)(We)), t.__H.__.some(function(e) {
+ t && t.__H && (t.__H.__h.length && (Ne.push(t) !== 1 && je === V.requestAnimationFrame || ((je = V.requestAnimationFrame) || Ge)(Ue)), t.__H.__.some(function(e) {
e.u &&= (e.__H = e.u, void 0);
- })), je = z = null;
-}, B.__c = function(e, t) {
+ })), Ae = B = null;
+}, V.__c = function(e, t) {
t.some(function(e) {
try {
- e.__h.some(qe), e.__h = e.__h.filter(function(e) {
- return !e.__ || Je(e);
+ e.__h.some(Ke), e.__h = e.__h.filter(function(e) {
+ return !e.__ || qe(e);
});
} catch (n) {
t.some(function(e) {
e.__h &&= [];
- }), t = [], B.__e(n, e.__v);
+ }), t = [], V.__e(n, e.__v);
}
- }), Re && Re(e, t);
-}, B.unmount = function(e) {
- ze && ze(e);
+ }), Le && Le(e, t);
+}, V.unmount = function(e) {
+ Re && Re(e);
var t, n = e.__c;
n && n.__H && (n.__H.__.some(function(e) {
try {
- qe(e);
+ Ke(e);
} catch (e) {
t = e;
}
- }), n.__H = void 0, t && B.__e(t, n.__v));
+ }), n.__H = void 0, t && V.__e(t, n.__v));
};
-var Ge = typeof requestAnimationFrame == "function";
-function Ke(e) {
+var We = typeof requestAnimationFrame == "function";
+function Ge(e) {
var t, n = function() {
- clearTimeout(r), Ge && cancelAnimationFrame(t), setTimeout(e);
+ clearTimeout(r), We && cancelAnimationFrame(t), setTimeout(e);
}, r = setTimeout(n, 35);
- Ge && (t = requestAnimationFrame(n));
+ We && (t = requestAnimationFrame(n));
}
-function qe(e) {
- var t = z, n = e.__c;
- typeof n == "function" && (e.__c = void 0, n()), z = t;
+function Ke(e) {
+ var t = B, n = e.__c;
+ typeof n == "function" && (e.__c = void 0, n()), B = t;
}
-function Je(e) {
- var t = z;
- e.__c = e.__(), z = t;
+function qe(e) {
+ var t = B;
+ e.__c = e.__(), B = t;
}
-function Ye(e, t) {
+function Je(e, t) {
return !e || e.length !== t.length || t.some(function(t, n) {
return t !== e[n];
});
}
-function Xe(e, t) {
+function Ye(e, t) {
return typeof t == "function" ? t(e) : t;
}
//#endregion
//#region node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js
-var Ze = 0;
+var Xe = 0;
Array.isArray;
-function G(e, t, n, r, i, a) {
+function K(e, t, n, r, i, a) {
t ||= {};
var o, s, c = t;
if ("ref" in c) for (s in c = {}, t) s == "ref" ? o = t[s] : c[s] = t[s];
@@ -461,7 +461,7 @@ function G(e, t, n, r, i, a) {
__e: null,
__c: null,
constructor: void 0,
- __v: --Ze,
+ __v: --Xe,
__i: -1,
__u: 0,
__source: i,
@@ -472,15 +472,15 @@ function G(e, t, n, r, i, a) {
}
//#endregion
//#region src/islands/access-settings.tsx
-function Qe({ id: e, label: t, value: n, onInput: r, error: i, help: a, current: o = !1 }) {
- return /* @__PURE__ */ G("div", {
+function Ze({ id: e, label: t, value: n, onInput: r, error: i, help: a, current: o = !1 }) {
+ return /* @__PURE__ */ K("div", {
class: "configfield",
children: [
- /* @__PURE__ */ G("label", {
+ /* @__PURE__ */ K("label", {
for: e,
children: t
}),
- /* @__PURE__ */ G("input", {
+ /* @__PURE__ */ K("input", {
id: e,
class: "geist-input",
type: "password",
@@ -492,7 +492,7 @@ function Qe({ id: e, label: t, value: n, onInput: r, error: i, help: a, current:
"aria-invalid": !!i,
"aria-describedby": i || a ? `${e}-hint` : void 0
}),
- i || a ? /* @__PURE__ */ G("p", {
+ i || a ? /* @__PURE__ */ K("p", {
id: `${e}-hint`,
class: i ? "configbad" : "confighelp",
role: i ? "alert" : void 0,
@@ -501,9 +501,9 @@ function Qe({ id: e, label: t, value: n, onInput: r, error: i, help: a, current:
]
});
}
-function $e({ initial: e, receipt: t }) {
- let [n, r] = V(e), [a, o] = V(""), [s, c] = V(""), [l, d] = V(""), [f, p] = V(!1), [m, h] = V(""), [g, _] = V({}), v = W(null), y = W(!1), b = W(null);
- return /* @__PURE__ */ G("form", {
+function Qe({ initial: e, receipt: t }) {
+ let [n, r] = H(e), [a, o] = H(""), [s, c] = H(""), [l, d] = H(""), [f, p] = H(!1), [m, h] = H(""), [g, _] = H({}), v = G(null), y = G(!1), b = G(null);
+ return /* @__PURE__ */ K("form", {
class: "configfieldset",
onSubmit: async (e) => {
if (e.preventDefault(), y.current) return;
@@ -515,7 +515,7 @@ function $e({ initial: e, receipt: t }) {
}
y.current = !0, u(b.current, !0);
try {
- let e = await L("/api/configuration/access", {
+ let e = await R("/api/configuration/access", {
revision: n.revision,
action: f ? "disable" : "set",
confirm_disable: f,
@@ -525,8 +525,8 @@ function $e({ initial: e, receipt: t }) {
});
r(e), o(""), c(""), d(""), p(!1), _({}), t(e.mode === "open" ? "已关闭访问密码" : "已保存访问密码");
} catch (e) {
- let t = e instanceof ke ? e.body : null, n = t?.errors || t?.detail?.errors;
- n ? _(n) : h(F(e));
+ let t = e instanceof Oe ? e.body : null, n = t?.errors || t?.detail?.errors;
+ n ? _(n) : h(I(e));
} finally {
y.current = !1, u(b.current, !1);
}
@@ -534,17 +534,17 @@ function $e({ initial: e, receipt: t }) {
"aria-labelledby": "accessTitle",
noValidate: !0,
ref: v,
- children: [/* @__PURE__ */ G("div", {
+ children: [/* @__PURE__ */ K("div", {
class: "geist-fieldset-content",
children: [
- /* @__PURE__ */ G("div", {
+ /* @__PURE__ */ K("div", {
class: "configfieldset-heading",
- children: [/* @__PURE__ */ G("div", { dangerouslySetInnerHTML: { __html: i("accessTitle", "访问密码") } }), /* @__PURE__ */ G("p", {
+ children: [/* @__PURE__ */ K("div", { dangerouslySetInnerHTML: { __html: i("accessTitle", "访问密码") } }), /* @__PURE__ */ K("p", {
class: "confighelp",
children: n.mode === "open" ? "未设置密码,能连接到 Peach 的设备可直接访问。" : n.mode === "legacy" ? "当前使用系统生成的访问口令。你可以设置自己的密码,或关闭登录要求。" : n.mode === "locked" ? "访问设置无法读取,请在本机检查配置文件。" : "已设置密码。新设备需要登录,保持登录时间在登录页选择。"
})]
}),
- n.mode === "password" ? /* @__PURE__ */ G(Qe, {
+ n.mode === "password" ? /* @__PURE__ */ K(Ze, {
id: "access-current",
label: "当前访问密码",
value: a,
@@ -552,46 +552,46 @@ function $e({ initial: e, receipt: t }) {
error: g.current_password,
current: !0
}) : null,
- !f && n.mode !== "locked" ? /* @__PURE__ */ G(N, { children: [/* @__PURE__ */ G(Qe, {
+ !f && n.mode !== "locked" ? /* @__PURE__ */ K(N, { children: [/* @__PURE__ */ K(Ze, {
id: "access-password",
label: n.mode === "password" ? "新访问密码" : "设置访问密码",
value: s,
onInput: c,
error: g.password,
help: "至少 8 个字符。保存后其他设备需要重新登录。"
- }), /* @__PURE__ */ G(Qe, {
+ }), /* @__PURE__ */ K(Ze, {
id: "access-confirm",
label: "确认访问密码",
value: l,
onInput: d,
error: g.confirmation
})] }) : null,
- n.mode === "password" || n.mode === "legacy" ? /* @__PURE__ */ G("label", {
+ n.mode === "password" || n.mode === "legacy" ? /* @__PURE__ */ K("label", {
class: "configcheck",
- children: [/* @__PURE__ */ G("span", {
+ children: [/* @__PURE__ */ K("span", {
class: "pcheck",
- children: [/* @__PURE__ */ G("input", {
+ children: [/* @__PURE__ */ K("input", {
type: "checkbox",
checked: f,
onChange: (e) => p(e.currentTarget.checked)
- }), /* @__PURE__ */ G("span", {
+ }), /* @__PURE__ */ K("span", {
"aria-hidden": "true",
- children: /* @__PURE__ */ G("svg", {
+ children: /* @__PURE__ */ K("svg", {
viewBox: "0 0 24 24",
- children: /* @__PURE__ */ G("use", { href: "#i-check" })
+ children: /* @__PURE__ */ K("use", { href: "#i-check" })
})
})]
- }), /* @__PURE__ */ G("span", { children: "关闭访问密码,允许能连接到 Peach 的设备直接访问" })]
+ }), /* @__PURE__ */ K("span", { children: "关闭访问密码,允许能连接到 Peach 的设备直接访问" })]
}) : null,
- m ? /* @__PURE__ */ G("p", {
+ m ? /* @__PURE__ */ K("p", {
class: "configbad",
role: "alert",
children: m
}) : null
]
- }), n.mode === "locked" ? null : /* @__PURE__ */ G("div", {
+ }), n.mode === "locked" ? null : /* @__PURE__ */ K("div", {
class: "geist-fieldset-footer",
- children: [/* @__PURE__ */ G("p", { children: "保存后立即生效。" }), /* @__PURE__ */ G("button", {
+ children: [/* @__PURE__ */ K("p", { children: "保存后立即生效。" }), /* @__PURE__ */ K("button", {
class: "geist-button primary",
type: "submit",
ref: b,
@@ -602,7 +602,7 @@ function $e({ initial: e, receipt: t }) {
}
//#endregion
//#region src/islands/release-updates.tsx
-var et = /* @__PURE__ */ new Set([
+var $e = /* @__PURE__ */ new Set([
"downloading",
"verifying",
"extracting",
@@ -610,21 +610,21 @@ var et = /* @__PURE__ */ new Set([
"restarting",
"installing"
]);
-function tt({ initial: e, initialJob: t }) {
- let [r, a] = V(e), [o, c] = V(t || {
+function et({ initial: e, initialJob: t }) {
+ let [r, a] = H(e), [o, c] = H(t || {
state: "idle",
progress: 0
- }), [l, d] = V(""), f = W(null), p = W(!0), m = W(!1), h = W(null);
- H(() => {
- u(h.current, et.has(o.state));
- }, [o.state]), H(() => () => {
+ }), [l, d] = H(""), f = G(null), p = G(!0), m = G(!1), h = G(null);
+ U(() => {
+ u(h.current, $e.has(o.state));
+ }, [o.state]), U(() => () => {
p.current = !1, f.current?.abort();
}, []);
let g = async () => {
- let e = await L("/api/configuration/update-restart", {});
+ let e = await R("/api/configuration/update-restart", {});
p.current && c(e);
};
- H(() => {
+ U(() => {
o.state !== "ready" || m.current || (m.current = !0, n({
title: "更新已准备好",
body: `Peach ${o.version || ""} 将在重启后安装。`,
@@ -632,11 +632,11 @@ function tt({ initial: e, initialJob: t }) {
cancelLabel: "稍后",
onConfirm: g
}));
- }, [o.state]), H(() => {
- if (!et.has(o.state)) return;
+ }, [o.state]), U(() => {
+ if (!$e.has(o.state)) return;
let e = new AbortController(), t, n = 0, r = async () => {
try {
- let t = await I("/api/configuration/update-status", e.signal);
+ let t = await L("/api/configuration/update-status", e.signal);
e.signal.aborted || (c(t), n = 0, t.state === "complete" && a((e) => ({
...e,
current_version: t.version || e.current_version,
@@ -653,14 +653,14 @@ function tt({ initial: e, initialJob: t }) {
};
}, [o.state]);
let _ = async (e) => {
- if (f.current || et.has(o.state)) return;
+ if (f.current || $e.has(o.state)) return;
let t = new AbortController();
f.current = t, m.current = !1, d(""), u(e, !0);
try {
- let e = await L("/api/configuration/update", {}, "POST", t.signal);
+ let e = await R("/api/configuration/update", {}, "POST", t.signal);
t.signal.aborted || c(e);
} catch (e) {
- t.signal.aborted || d(F(e));
+ t.signal.aborted || d(I(e));
} finally {
f.current = null, u(e, !1);
}
@@ -669,66 +669,66 @@ function tt({ initial: e, initialJob: t }) {
let n = new AbortController();
f.current = n, u(t, !0), d("");
try {
- let e = await I("/api/configuration/updates", n.signal);
+ let e = await L("/api/configuration/updates", n.signal);
n.signal.aborted || a(e);
} catch (t) {
n.signal.aborted || (a({
...e,
state: "error"
- }), d(F(t)));
+ }), d(I(t)));
} finally {
f.current = null, u(t, !1);
}
};
- return /* @__PURE__ */ G("section", {
+ return /* @__PURE__ */ K("section", {
class: "configfieldset",
"data-geist-fieldset": !0,
"aria-labelledby": "configUpdatesTitle",
- children: [/* @__PURE__ */ G("div", {
+ children: [/* @__PURE__ */ K("div", {
class: "geist-fieldset-content",
children: [
- /* @__PURE__ */ G("div", { dangerouslySetInnerHTML: { __html: i("configUpdatesTitle", "检查更新") } }),
- /* @__PURE__ */ G("dl", {
+ /* @__PURE__ */ K("div", { dangerouslySetInnerHTML: { __html: i("configUpdatesTitle", "检查更新") } }),
+ /* @__PURE__ */ K("dl", {
class: "configfacts",
children: [
- /* @__PURE__ */ G("dt", { children: "当前版本" }),
- /* @__PURE__ */ G("dd", { children: r.current_version }),
- /* @__PURE__ */ G("dt", { children: "安装方式" }),
- /* @__PURE__ */ G("dd", { children: r.installation }),
- /* @__PURE__ */ G("dt", { children: "更新通道" }),
- /* @__PURE__ */ G("dd", { children: r.channel }),
- /* @__PURE__ */ G("dt", { children: "最新版本" }),
- /* @__PURE__ */ G("dd", { children: r.latest_version || (r.state === "unchecked" ? "尚未检查" : "未取得") })
+ /* @__PURE__ */ K("dt", { children: "当前版本" }),
+ /* @__PURE__ */ K("dd", { children: r.current_version }),
+ /* @__PURE__ */ K("dt", { children: "安装方式" }),
+ /* @__PURE__ */ K("dd", { children: r.installation }),
+ /* @__PURE__ */ K("dt", { children: "更新通道" }),
+ /* @__PURE__ */ K("dd", { children: r.channel }),
+ /* @__PURE__ */ K("dt", { children: "最新版本" }),
+ /* @__PURE__ */ K("dd", { children: r.latest_version || (r.state === "unchecked" ? "尚未检查" : "未取得") })
]
}),
- /* @__PURE__ */ G("p", {
+ /* @__PURE__ */ K("p", {
class: l || r.state === "error" ? "configbad" : "confighelp",
role: l || r.state === "error" ? "alert" : "status",
children: l || r.message
}),
- o.state === "idle" ? null : /* @__PURE__ */ G("div", {
+ o.state === "idle" ? null : /* @__PURE__ */ K("div", {
"aria-live": "polite",
- children: [/* @__PURE__ */ G("p", {
+ children: [/* @__PURE__ */ K("p", {
class: o.state === "error" ? "configbad" : "confighelp",
children: o.message
- }), o.state === "error" ? null : /* @__PURE__ */ G(N, { children: [/* @__PURE__ */ G("div", { dangerouslySetInnerHTML: { __html: s(o.state === "downloading" ? "下载进度" : "安装进度", o.state === "downloading" ? o.downloaded || 0 : o.progress, o.state === "downloading" ? o.total || 1 : 100) } }), /* @__PURE__ */ G("p", {
+ }), o.state === "error" ? null : /* @__PURE__ */ K(N, { children: [/* @__PURE__ */ K("div", { dangerouslySetInnerHTML: { __html: s(o.state === "downloading" ? "下载进度" : "安装进度", o.state === "downloading" ? o.downloaded || 0 : o.progress, o.state === "downloading" ? o.total || 1 : 100) } }), /* @__PURE__ */ K("p", {
class: "confighelp",
children: o.state === "downloading" && o.total ? `${((o.downloaded || 0) / 1048576).toFixed(1)} / ${(o.total / 1048576).toFixed(1)} MB` : `${o.progress}%`
})] })]
})
]
- }), /* @__PURE__ */ G("div", {
+ }), /* @__PURE__ */ K("div", {
class: "geist-fieldset-footer",
"data-geist-fieldset-footer": !0,
children: [
- /* @__PURE__ */ G("a", {
+ /* @__PURE__ */ K("a", {
class: "geist-button",
href: r.release_url,
target: "_blank",
rel: "noreferrer",
children: "查看发布页"
}),
- o.state === "ready" ? /* @__PURE__ */ G("button", {
+ o.state === "ready" ? /* @__PURE__ */ K("button", {
type: "button",
class: "geist-button primary",
onClick: () => {
@@ -742,17 +742,17 @@ function tt({ initial: e, initialJob: t }) {
},
children: "重启安装"
}) : null,
- r.state === "available" && r.installation === "独立测试包" && o.state !== "ready" ? /* @__PURE__ */ G("button", {
+ r.state === "available" && r.installation === "独立测试包" && o.state !== "ready" ? /* @__PURE__ */ K("button", {
ref: h,
type: "button",
class: "geist-button primary",
onClick: (e) => _(e.currentTarget),
children: "下载并安装"
}) : null,
- /* @__PURE__ */ G("button", {
+ /* @__PURE__ */ K("button", {
type: "button",
class: "geist-button",
- disabled: et.has(o.state),
+ disabled: $e.has(o.state),
onClick: (e) => v(e.currentTarget),
children: "检查更新"
})
@@ -762,9 +762,9 @@ function tt({ initial: e, initialJob: t }) {
}
//#endregion
//#region src/islands/peach-proxy.tsx
-function nt({ initial: e, receipt: t }) {
- let [n, r] = V(e), [a, o] = V(e.mode), [s, l] = V(""), [d, p] = V(""), m = W(!1), h = W(null), g = W(null), _ = W(new AbortController());
- H(() => () => _.current.abort(), []), U(() => {
+function tt({ initial: e, receipt: t }) {
+ let [n, r] = H(e), [a, o] = H(e.mode), [s, l] = H(""), [d, p] = H(""), m = G(!1), h = G(null), g = G(null), _ = G(new AbortController());
+ U(() => () => _.current.abort(), []), W(() => {
let t = h.current;
t.innerHTML = c([
["environment", "系统代理"],
@@ -784,40 +784,40 @@ function nt({ initial: e, receipt: t }) {
if (!m.current) {
m.current = !0, u(g.current, !0), p("");
try {
- let e = await L("/api/configuration/peach-proxy", {
+ let e = await R("/api/configuration/peach-proxy", {
mode: a,
proxy: s
}, "POST", _.current.signal);
_.current.signal.aborted || (r(e), l(""), t("已保存 Peach 代理"));
} catch (e) {
- _.current.signal.aborted || p(F(e));
+ _.current.signal.aborted || p(I(e));
} finally {
m.current = !1, u(g.current, !1);
}
}
}
- return /* @__PURE__ */ G("form", {
+ return /* @__PURE__ */ K("form", {
id: "peachProxy",
class: "configfieldset",
"data-geist-fieldset": !0,
onSubmit: (e) => {
e.preventDefault(), v();
},
- children: [/* @__PURE__ */ G("div", {
+ children: [/* @__PURE__ */ K("div", {
class: "geist-fieldset-content",
children: [
- /* @__PURE__ */ G("div", { dangerouslySetInnerHTML: { __html: i("peachProxyTitle", "Peach 代理") } }),
- /* @__PURE__ */ G("p", {
+ /* @__PURE__ */ K("div", { dangerouslySetInnerHTML: { __html: i("peachProxyTitle", "Peach 代理") } }),
+ /* @__PURE__ */ K("p", {
class: "confighelp",
children: "采集来源选择“Peach 代理”时共用此设置。"
}),
- /* @__PURE__ */ G("div", { ref: h }),
- a === "proxy" && /* @__PURE__ */ G("div", {
+ /* @__PURE__ */ K("div", { ref: h }),
+ a === "proxy" && /* @__PURE__ */ K("div", {
class: "configfield",
- children: [/* @__PURE__ */ G("label", {
+ children: [/* @__PURE__ */ K("label", {
htmlFor: "peachProxyAddress",
children: "代理地址"
- }), /* @__PURE__ */ G("input", {
+ }), /* @__PURE__ */ K("input", {
id: "peachProxyAddress",
class: "geist-input",
type: "password",
@@ -827,20 +827,20 @@ function nt({ initial: e, receipt: t }) {
onInput: (e) => l(e.currentTarget.value)
})]
}),
- n.needs_selection && /* @__PURE__ */ G("p", {
+ n.needs_selection && /* @__PURE__ */ K("p", {
class: "configbad",
children: "已有来源的代理地址不同,请选择公共连接方式。"
}),
- d && /* @__PURE__ */ G("p", {
+ d && /* @__PURE__ */ K("p", {
class: "configbad",
role: "alert",
children: d
})
]
- }), /* @__PURE__ */ G("footer", {
+ }), /* @__PURE__ */ K("footer", {
class: "geist-fieldset-footer",
"data-geist-fieldset-footer": !0,
- children: /* @__PURE__ */ G("button", {
+ children: /* @__PURE__ */ K("button", {
ref: g,
class: "geist-button primary",
type: "submit",
@@ -851,83 +851,83 @@ function nt({ initial: e, receipt: t }) {
}
//#endregion
//#region src/islands/desktop-settings.tsx
-function rt({ label: e, checked: t, disabled: n, change: r }) {
- return /* @__PURE__ */ G("label", {
+function nt({ label: e, checked: t, disabled: n, change: r }) {
+ return /* @__PURE__ */ K("label", {
class: "configcheck",
- children: [/* @__PURE__ */ G("span", {
+ children: [/* @__PURE__ */ K("span", {
class: "pcheck",
- children: [/* @__PURE__ */ G("input", {
+ children: [/* @__PURE__ */ K("input", {
type: "checkbox",
checked: t,
disabled: n,
onChange: (e) => r(e.currentTarget.checked)
- }), /* @__PURE__ */ G("span", {
+ }), /* @__PURE__ */ K("span", {
"aria-hidden": "true",
- children: /* @__PURE__ */ G("svg", {
+ children: /* @__PURE__ */ K("svg", {
viewBox: "0 0 24 24",
- children: /* @__PURE__ */ G("use", { href: "#i-check" })
+ children: /* @__PURE__ */ K("use", { href: "#i-check" })
})
})]
- }), /* @__PURE__ */ G("span", { children: e })]
+ }), /* @__PURE__ */ K("span", { children: e })]
});
}
-function it({ startup: e, receipt: t }) {
- let [n, r] = V(e.enabled), [a, o] = V(e.silent), [s, c] = V(""), l = W(!1), d = W(null);
+function rt({ startup: e, receipt: t }) {
+ let [n, r] = H(e.enabled), [a, o] = H(e.silent), [s, c] = H(""), l = G(!1), d = G(null);
async function f() {
if (!l.current) {
l.current = !0, u(d.current, !0), c("");
try {
- await L("/api/configuration/startup", {
+ await R("/api/configuration/startup", {
enabled: n,
silent: a
}), t("已保存开机自启");
} catch (e) {
- c(F(e));
+ c(I(e));
} finally {
l.current = !1, u(d.current, !1);
}
}
}
- return /* @__PURE__ */ G("form", {
+ return /* @__PURE__ */ K("form", {
class: "configfieldset",
"data-geist-fieldset": !0,
onSubmit: (e) => {
e.preventDefault(), f();
},
- children: [/* @__PURE__ */ G("div", {
+ children: [/* @__PURE__ */ K("div", {
class: "geist-fieldset-content",
children: [
- /* @__PURE__ */ G("div", { dangerouslySetInnerHTML: { __html: i("startupTitle", "开机自启") } }),
- /* @__PURE__ */ G(rt, {
+ /* @__PURE__ */ K("div", { dangerouslySetInnerHTML: { __html: i("startupTitle", "开机自启") } }),
+ /* @__PURE__ */ K(nt, {
label: "开机后启动 Peach",
checked: n,
disabled: !e.available,
change: r
}),
- /* @__PURE__ */ G(rt, {
+ /* @__PURE__ */ K(nt, {
label: "静默启动",
checked: a,
disabled: !e.available,
change: o
}),
- /* @__PURE__ */ G("p", {
+ /* @__PURE__ */ K("p", {
class: "confighelp",
children: "静默启动仅显示托盘;关闭后自动打开浏览器。"
}),
- e.message && /* @__PURE__ */ G("p", {
+ e.message && /* @__PURE__ */ K("p", {
class: "confighelp",
children: e.message
}),
- s && /* @__PURE__ */ G("p", {
+ s && /* @__PURE__ */ K("p", {
class: "configbad",
role: "alert",
children: s
})
]
- }), /* @__PURE__ */ G("footer", {
+ }), /* @__PURE__ */ K("footer", {
class: "geist-fieldset-footer",
"data-geist-fieldset-footer": !0,
- children: /* @__PURE__ */ G("button", {
+ children: /* @__PURE__ */ K("button", {
ref: d,
type: "submit",
class: "geist-button primary",
@@ -937,9 +937,9 @@ function it({ startup: e, receipt: t }) {
})]
});
}
-function at({ data: e }) {
- let t = W(null);
- return U(() => {
+function it({ data: e }) {
+ let t = G(null);
+ return W(() => {
let n = t.current, r = document.createElement("details");
r.className = "configdirectories";
let i = document.createElement("summary");
@@ -949,10 +949,10 @@ function at({ data: e }) {
e.className = "confighelp", e.textContent = t, r.append(e);
}
return n.replaceChildren(r), d(n, "details", "uninstall-data"), () => n.replaceChildren();
- }, [e]), /* @__PURE__ */ G("div", { ref: t });
+ }, [e]), /* @__PURE__ */ K("div", { ref: t });
}
-function ot({ uninstall: e }) {
- let [t, r] = V(!1), [a, o] = V("");
+function at({ uninstall: e }) {
+ let [t, r] = H(!1), [a, o] = H("");
async function s() {
await n({
title: "卸载 Peach",
@@ -960,7 +960,7 @@ function ot({ uninstall: e }) {
body: t ? "将退出 Peach,移除程序、开机自启、设置、本地数据库、观看记录、凭据和缓存。原始媒体文件保留。" : "将退出 Peach 并移除程序和开机自启。设置、本地数据库、观看记录与缓存保留。",
confirmLabel: "卸载 Peach",
onConfirm: async () => {
- let e = await L("/api/configuration/uninstall", {
+ let e = await R("/api/configuration/uninstall", {
delete_data: t,
confirmation: "卸载 Peach"
});
@@ -968,40 +968,40 @@ function ot({ uninstall: e }) {
}
});
}
- return /* @__PURE__ */ G("section", {
+ return /* @__PURE__ */ K("section", {
id: "uninstallPeach",
class: "configfieldset configdanger",
"data-geist-fieldset": !0,
"data-fieldset-type": "error",
- children: [/* @__PURE__ */ G("div", {
+ children: [/* @__PURE__ */ K("div", {
class: "geist-fieldset-content",
children: [
- /* @__PURE__ */ G("div", { dangerouslySetInnerHTML: { __html: i("uninstallTitle", "卸载 Peach") } }),
- e.available && /* @__PURE__ */ G("p", {
+ /* @__PURE__ */ K("div", { dangerouslySetInnerHTML: { __html: i("uninstallTitle", "卸载 Peach") } }),
+ e.available && /* @__PURE__ */ K("p", {
class: "confighelp",
children: "卸载会退出 Peach、移除程序和开机自启。原始媒体文件保留。"
}),
- /* @__PURE__ */ G(rt, {
+ /* @__PURE__ */ K(nt, {
label: "完全卸载:同时删除设置、本地数据库、观看记录、凭据和缓存",
checked: t,
disabled: !e.full_available || !!a,
change: r
}),
- /* @__PURE__ */ G(at, { data: e }),
- e.message && /* @__PURE__ */ G("p", {
+ /* @__PURE__ */ K(it, { data: e }),
+ e.message && /* @__PURE__ */ K("p", {
class: "confighelp",
children: e.message
}),
- a && /* @__PURE__ */ G("p", {
+ a && /* @__PURE__ */ K("p", {
class: "confighelp",
role: "status",
children: a
})
]
- }), /* @__PURE__ */ G("footer", {
+ }), /* @__PURE__ */ K("footer", {
class: "geist-fieldset-footer",
"data-geist-fieldset-footer": !0,
- children: /* @__PURE__ */ G("button", {
+ children: /* @__PURE__ */ K("button", {
type: "button",
class: "geist-button danger",
disabled: !e.available || !!a,
@@ -1013,29 +1013,29 @@ function ot({ uninstall: e }) {
}
//#endregion
//#region src/islands/configuration.tsx
-var st = "/api/configuration", ct = "/api/pick-folder", lt = 8e3, ut = (e, t) => I(st, t), K = ({ html: e, class: t }) => /* @__PURE__ */ G("div", {
+var ot = "/api/configuration", st = "/api/pick-folder", ct = 8e3, lt = (e, t) => L(ot, t), q = ({ html: e, class: t }) => /* @__PURE__ */ K("div", {
class: t,
dangerouslySetInnerHTML: { __html: e }
-}), dt = (e) => !(e instanceof ke) || e.status !== 400 ? null : e.body?.errors ?? null;
-function ft({ facts: e }) {
- return /* @__PURE__ */ G("section", {
+}), ut = (e) => !(e instanceof Oe) || e.status !== 400 ? null : e.body?.errors ?? null;
+function dt({ facts: e }) {
+ return /* @__PURE__ */ K("section", {
class: "configfieldset",
"data-geist-fieldset": !0,
"aria-labelledby": "configFactsTitle",
- children: /* @__PURE__ */ G("div", {
+ children: /* @__PURE__ */ K("div", {
class: "geist-fieldset-content",
- children: [/* @__PURE__ */ G(K, { html: i("configFactsTitle", "运行信息") }), /* @__PURE__ */ G("dl", {
+ children: [/* @__PURE__ */ K(q, { html: i("configFactsTitle", "运行信息") }), /* @__PURE__ */ K("dl", {
class: "configfacts",
- children: e.map((e) => /* @__PURE__ */ G(N, { children: [/* @__PURE__ */ G("dt", { children: e.term }), /* @__PURE__ */ G("dd", { children: [e.value, e.download_url ? /* @__PURE__ */ G("span", {
+ children: e.map((e) => /* @__PURE__ */ K(N, { children: [/* @__PURE__ */ K("dt", { children: e.term }), /* @__PURE__ */ K("dd", { children: [e.value, e.download_url ? /* @__PURE__ */ K("span", {
class: "confighelp",
- children: [" ", /* @__PURE__ */ G("a", {
+ children: [" ", /* @__PURE__ */ K("a", {
href: e.download_url,
target: "_blank",
rel: "noreferrer",
- children: [e.download_label, /* @__PURE__ */ G("svg", {
+ children: [e.download_label, /* @__PURE__ */ K("svg", {
"aria-hidden": "true",
viewBox: "0 0 24 24",
- children: /* @__PURE__ */ G("use", { href: "#i-external-link" })
+ children: /* @__PURE__ */ K("use", { href: "#i-external-link" })
})]
})]
}) : null] })] }))
@@ -1043,57 +1043,57 @@ function ft({ facts: e }) {
})
});
}
-function pt({ data: t }) {
- let [n, r] = V(t.media_sources), [a, o] = V(""), s = W(null);
- H(() => () => s.current?.abort(), []);
+function ft({ data: t }) {
+ let [n, r] = H(t.media_sources), [a, o] = H(""), s = G(null);
+ U(() => () => s.current?.abort(), []);
let c = async (e) => {
if (s.current) return;
let t = new AbortController();
s.current = t, u(e, !0), o("");
try {
- let e = await I(st, t.signal);
+ let e = await L(ot, t.signal);
t.signal.aborted || r(e.media_sources);
} catch (e) {
- t.signal.aborted || o(F(e));
+ t.signal.aborted || o(I(e));
} finally {
s.current = null, u(e, !1);
}
};
- return n ? /* @__PURE__ */ G("section", {
+ return n ? /* @__PURE__ */ K("section", {
class: "configfieldset",
"aria-labelledby": "configMountsTitle",
- children: [/* @__PURE__ */ G("div", {
+ children: [/* @__PURE__ */ K("div", {
class: "geist-fieldset-content",
children: [
- /* @__PURE__ */ G(K, { html: i("configMountsTitle", "挂载状态") }),
- /* @__PURE__ */ G("dl", {
+ /* @__PURE__ */ K(q, { html: i("configMountsTitle", "挂载状态") }),
+ /* @__PURE__ */ K("dl", {
class: "configfacts",
- children: n.map((t) => /* @__PURE__ */ G(N, { children: [/* @__PURE__ */ G("dt", { children: [/* @__PURE__ */ G("span", {
+ children: n.map((t) => /* @__PURE__ */ K(N, { children: [/* @__PURE__ */ K("dt", { children: [/* @__PURE__ */ K("span", {
"aria-hidden": "true",
dangerouslySetInnerHTML: { __html: l(e[t.location]) }
}), {
local: "本地磁盘",
115: "CloudDrive · 115",
pikpak: "CloudDrive · PikPak"
- }[t.location] || t.location] }), /* @__PURE__ */ G("dd", { children: [
+ }[t.location] || t.location] }), /* @__PURE__ */ K("dd", { children: [
t.path || "未配置挂载点",
" ",
- /* @__PURE__ */ G("span", {
+ /* @__PURE__ */ K("span", {
class: `configstatus ${t.online === !0 ? "online" : t.online === !1 ? "offline" : "unknown"}`,
children: t.online === !0 ? "在线" : t.online === !1 ? "离线" : "未检测"
})
] })] }))
}),
- a ? /* @__PURE__ */ G("p", {
+ a ? /* @__PURE__ */ K("p", {
class: "configbad",
role: "alert",
children: a
}) : null
]
- }), /* @__PURE__ */ G("div", {
+ }), /* @__PURE__ */ K("div", {
class: "geist-fieldset-footer",
"data-geist-fieldset-footer": !0,
- children: /* @__PURE__ */ G("button", {
+ children: /* @__PURE__ */ K("button", {
type: "button",
class: "geist-button",
onClick: (e) => c(e.currentTarget),
@@ -1102,9 +1102,9 @@ function pt({ data: t }) {
})]
}) : null;
}
-function mt({ value: t, label: n, onChange: r }) {
- let i = W(null), a = W(null), o = W(r);
- return o.current = r, U(() => {
+function pt({ value: t, label: n, onChange: r }) {
+ let i = G(null), a = G(null), o = G(r);
+ return o.current = r, W(() => {
let r = i.current;
r.innerHTML = c([
["local", "本地磁盘"],
@@ -1121,24 +1121,24 @@ function mt({ value: t, label: n, onChange: r }) {
return s.addEventListener("change", l), () => {
a.current = null, s.disabled = !0, s.removeEventListener("change", l), r.replaceChildren();
};
- }, [n]), U(() => {
+ }, [n]), W(() => {
a.current && (a.current.value = t);
- }, [t]), /* @__PURE__ */ G("div", {
+ }, [t]), /* @__PURE__ */ K("div", {
ref: i,
class: "configsourcecontrol"
});
}
-function ht({ data: e, receipt: t }) {
+function mt({ data: e, receipt: t }) {
let n = e.media_sources?.filter((e) => [
"local",
"115",
"pikpak"
- ].includes(e.location)), [r, a] = V(n?.length ? n.map((e) => e.path) : e.media_dirs.length ? e.media_dirs : [""]), [s, c] = V(n?.map((e) => e.location) ?? []), [l, d] = V(n?.map((e) => e.root) ?? []), [f, p] = V(String(e.port)), [m, h] = V(!1), [g, _] = V([]), [v, y] = V(""), [b, x] = V(""), [S, C] = V(null), [w, T] = V(null), E = W(!1), D = W(e.revision), ee = W([]), O = W(null);
- U(() => {
+ ].includes(e.location)), [r, a] = H(n?.length ? n.map((e) => e.path) : e.media_dirs.length ? e.media_dirs : [""]), [s, c] = H(n?.map((e) => e.location) ?? []), [l, d] = H(n?.map((e) => e.root) ?? []), [f, p] = H(String(e.port)), [m, h] = H(!1), [g, _] = H([]), [v, y] = H(""), [b, x] = H(""), [S, C] = H(null), [w, T] = H(null), E = G(!1), D = G(e.revision), ee = G([]), O = G(null);
+ W(() => {
w !== null && (ee.current[w]?.focus(), T(null));
- }, [w]), H(() => {
+ }, [w]), U(() => {
if (!S) return;
- let e = setTimeout(() => location.assign(S.url), lt);
+ let e = setTimeout(() => location.assign(S.url), ct);
return () => clearTimeout(e);
}, [S]);
let k = (e, t) => {
@@ -1157,35 +1157,35 @@ function ht({ data: e, receipt: t }) {
if (t.getAttribute("aria-busy") !== "true") {
u(t, !0);
try {
- let { path: t } = await L(ct, { initial: r[e] ?? "" });
+ let { path: t } = await R(st, { initial: r[e] ?? "" });
t && (k(e, t), j(e, ""));
} catch (t) {
- j(e, F(t));
+ j(e, I(t));
} finally {
u(t, !1);
}
}
};
- return S ? /* @__PURE__ */ G("div", {
+ return S ? /* @__PURE__ */ K("div", {
class: "configsaved",
role: "status",
- children: /* @__PURE__ */ G("div", {
+ children: /* @__PURE__ */ K("div", {
class: "geist-note geist-note-success",
role: "note",
- children: [/* @__PURE__ */ G("svg", {
+ children: [/* @__PURE__ */ K("svg", {
"aria-hidden": "true",
viewBox: "0 0 24 24",
- children: /* @__PURE__ */ G("use", { href: "#i-check" })
- }), /* @__PURE__ */ G("p", { children: /* @__PURE__ */ G("span", { children: [
+ children: /* @__PURE__ */ K("use", { href: "#i-check" })
+ }), /* @__PURE__ */ K("p", { children: /* @__PURE__ */ K("span", { children: [
"配置已保存,Peach 正在重新启动。稍后自动跳转,或点击",
- /* @__PURE__ */ G("a", {
+ /* @__PURE__ */ K("a", {
href: S.url,
children: "进入馆藏"
}),
"。"
] }) })]
})
- }) : /* @__PURE__ */ G("form", {
+ }) : /* @__PURE__ */ K("form", {
class: "configfieldset",
"data-geist-fieldset": !0,
"aria-labelledby": "configTitle",
@@ -1193,7 +1193,7 @@ function ht({ data: e, receipt: t }) {
if (n.preventDefault(), !E.current) {
E.current = !0, u(O.current, !0), x("");
try {
- let n = await L(st, {
+ let n = await R(ot, {
revision: D.current,
media_dirs: r,
...e.media_sources ? { media_sources: r.map((e, t) => ({
@@ -1206,38 +1206,38 @@ function ht({ data: e, receipt: t }) {
});
D.current = n.revision, _([]), y(""), t("已保存配置"), C(n);
} catch (e) {
- let t = dt(e);
- t ? (_(t.media_dirs ?? []), y(t.port ?? "")) : (_([]), y(""), x(F(e)));
+ let t = ut(e);
+ t ? (_(t.media_dirs ?? []), y(t.port ?? "")) : (_([]), y(""), x(I(e)));
} finally {
E.current = !1, u(O.current, !1);
}
}
},
noValidate: !0,
- children: [/* @__PURE__ */ G("div", {
+ children: [/* @__PURE__ */ K("div", {
class: "geist-fieldset-content",
children: [
- /* @__PURE__ */ G(K, { html: i("configTitle", "这台电脑") }),
- /* @__PURE__ */ G("div", {
+ /* @__PURE__ */ K(q, { html: i("configTitle", "这台电脑") }),
+ /* @__PURE__ */ K("div", {
class: "configfield",
children: [
- /* @__PURE__ */ G("span", {
+ /* @__PURE__ */ K("span", {
class: "configlabel",
id: "configDirsLabel",
children: "媒体文件夹"
}),
- /* @__PURE__ */ G("div", {
+ /* @__PURE__ */ K("div", {
class: "configdirs",
role: "group",
"aria-labelledby": "configDirsLabel",
- children: r.map((t, n) => /* @__PURE__ */ G("div", {
+ children: r.map((t, n) => /* @__PURE__ */ K("div", {
class: "configdir",
children: [
- /* @__PURE__ */ G("span", {
+ /* @__PURE__ */ K("span", {
class: "configpathlabel",
children: ["本机文件夹 ", n + 1]
}),
- /* @__PURE__ */ G("input", {
+ /* @__PURE__ */ K("input", {
class: "geist-input",
type: "text",
value: t,
@@ -1248,33 +1248,33 @@ function ht({ data: e, receipt: t }) {
ee.current[n] = e;
}
}),
- /* @__PURE__ */ G("button", {
+ /* @__PURE__ */ K("button", {
type: "button",
class: "geist-button configpick",
"aria-label": "选择文件夹",
onClick: (e) => ne(n, e.currentTarget),
- children: /* @__PURE__ */ G("svg", {
+ children: /* @__PURE__ */ K("svg", {
viewBox: "0 0 24 24",
"aria-hidden": "true",
- children: /* @__PURE__ */ G("use", { href: "#i-folder-search" })
+ children: /* @__PURE__ */ K("use", { href: "#i-folder-search" })
})
}),
- r.length > 1 ? /* @__PURE__ */ G("button", {
+ r.length > 1 ? /* @__PURE__ */ K("button", {
type: "button",
class: "geist-button configrm",
"aria-label": "移除这个文件夹",
onClick: () => A(n),
- children: /* @__PURE__ */ G("svg", {
+ children: /* @__PURE__ */ K("svg", {
viewBox: "0 0 24 24",
"aria-hidden": "true",
- children: /* @__PURE__ */ G("use", { href: "#i-x" })
+ children: /* @__PURE__ */ K("use", { href: "#i-x" })
})
}) : null,
- /* @__PURE__ */ G("div", {
+ /* @__PURE__ */ K("div", {
class: "configsource",
- children: [/* @__PURE__ */ G("div", {
+ children: [/* @__PURE__ */ K("div", {
class: "configsourcelabel",
- children: ["媒体来源", /* @__PURE__ */ G(mt, {
+ children: ["媒体来源", /* @__PURE__ */ K(pt, {
label: `媒体来源 ${n + 1}`,
value: s[n] || "local",
onChange: (e) => {
@@ -1282,7 +1282,7 @@ function ht({ data: e, receipt: t }) {
t[n] = e, c(t);
}
})]
- }), e.windows === !1 ? /* @__PURE__ */ G("label", { children: ["Windows 中的对应路径", /* @__PURE__ */ G("input", {
+ }), e.windows === !1 ? /* @__PURE__ */ K("label", { children: ["Windows 中的对应路径", /* @__PURE__ */ K("input", {
class: "geist-input",
"aria-label": `Windows 中的对应路径 ${n + 1}`,
value: l[n] || "",
@@ -1293,7 +1293,7 @@ function ht({ data: e, receipt: t }) {
}
})] }) : null]
}),
- g[n] ? /* @__PURE__ */ G("p", {
+ g[n] ? /* @__PURE__ */ K("p", {
class: "configbad",
role: "alert",
children: g[n]
@@ -1301,61 +1301,61 @@ function ht({ data: e, receipt: t }) {
]
}, n))
}),
- /* @__PURE__ */ G("button", {
+ /* @__PURE__ */ K("button", {
type: "button",
class: "geist-button configadd",
onClick: te,
children: "添加文件夹"
}),
- s.some((e) => e === "115" || e === "pikpak") ? /* @__PURE__ */ G("p", {
+ s.some((e) => e === "115" || e === "pikpak") ? /* @__PURE__ */ K("p", {
class: "confighelp",
- children: ["先在 CloudDrive 登录网盘并完成挂载。", /* @__PURE__ */ G("a", {
+ children: ["先在 CloudDrive 登录网盘并完成挂载。", /* @__PURE__ */ K("a", {
href: "https://www.clouddrive2.com/help.html",
target: "_blank",
rel: "noreferrer",
- children: ["挂载帮助", /* @__PURE__ */ G("svg", {
+ children: ["挂载帮助", /* @__PURE__ */ K("svg", {
"aria-hidden": "true",
viewBox: "0 0 24 24",
- children: /* @__PURE__ */ G("use", { href: "#i-external-link" })
+ children: /* @__PURE__ */ K("use", { href: "#i-external-link" })
})]
})]
}) : null,
- s.some((e) => e === "115" || e === "pikpak") ? e.mount_dependencies?.filter((e) => !e.available).map((e) => /* @__PURE__ */ G("p", {
+ s.some((e) => e === "115" || e === "pikpak") ? e.mount_dependencies?.filter((e) => !e.available).map((e) => /* @__PURE__ */ K("p", {
class: "confighelp",
children: [
"未检测到 ",
e.name,
"。",
- /* @__PURE__ */ G("a", {
+ /* @__PURE__ */ K("a", {
href: e.download_url,
target: "_blank",
rel: "noreferrer",
children: [
"下载 ",
e.name,
- /* @__PURE__ */ G("svg", {
+ /* @__PURE__ */ K("svg", {
"aria-hidden": "true",
viewBox: "0 0 24 24",
- children: /* @__PURE__ */ G("use", { href: "#i-external-link" })
+ children: /* @__PURE__ */ K("use", { href: "#i-external-link" })
})
]
})
]
})) : null,
- e.windows === !1 ? /* @__PURE__ */ G("p", {
+ e.windows === !1 ? /* @__PURE__ */ K("p", {
class: "confighelp",
children: "本机文件夹是这台电脑读取媒体的位置。Windows 中的对应路径用于匹配馆藏中已有的路径,例如 B:\\ 对应本机挂载文件夹。"
}) : null
]
}),
- e.port_editable === !1 ? null : /* @__PURE__ */ G("div", {
+ e.port_editable === !1 ? null : /* @__PURE__ */ K("div", {
class: "configfield",
children: [
- /* @__PURE__ */ G("label", {
+ /* @__PURE__ */ K("label", {
for: "configPort",
children: "本机访问端口"
}),
- /* @__PURE__ */ G("input", {
+ /* @__PURE__ */ K("input", {
id: "configPort",
class: "geist-input",
type: "text",
@@ -1364,43 +1364,43 @@ function ht({ data: e, receipt: t }) {
"aria-invalid": v ? "true" : void 0,
onInput: (e) => p(e.currentTarget.value)
}),
- v ? /* @__PURE__ */ G("p", {
+ v ? /* @__PURE__ */ K("p", {
class: "configbad",
role: "alert",
children: v
}) : null,
- /* @__PURE__ */ G("p", {
+ /* @__PURE__ */ K("p", {
class: "confighelp",
children: "浏览器地址里冒号后面的数字,一般不用改。"
})
]
}),
- /* @__PURE__ */ G("label", {
+ /* @__PURE__ */ K("label", {
class: "configcheck",
- children: [/* @__PURE__ */ G("span", {
+ children: [/* @__PURE__ */ K("span", {
class: "pcheck",
- children: [/* @__PURE__ */ G("input", {
+ children: [/* @__PURE__ */ K("input", {
type: "checkbox",
checked: m,
onChange: (e) => h(e.currentTarget.checked)
- }), /* @__PURE__ */ G("span", {
+ }), /* @__PURE__ */ K("span", {
"aria-hidden": "true",
- children: /* @__PURE__ */ G("svg", {
+ children: /* @__PURE__ */ K("svg", {
viewBox: "0 0 24 24",
- children: /* @__PURE__ */ G("use", { href: "#i-check" })
+ children: /* @__PURE__ */ K("use", { href: "#i-check" })
})
})]
- }), /* @__PURE__ */ G("span", { children: "保存后扫描并补全资料" })]
+ }), /* @__PURE__ */ K("span", { children: "保存后扫描并补全资料" })]
}),
- b ? /* @__PURE__ */ G(K, { html: o(b, {
+ b ? /* @__PURE__ */ K(q, { html: o(b, {
variant: "error",
label: "没有保存"
}) }) : null
]
- }), /* @__PURE__ */ G("div", {
+ }), /* @__PURE__ */ K("div", {
class: "geist-fieldset-footer",
"data-geist-fieldset-footer": !0,
- children: [/* @__PURE__ */ G("p", { children: e.port_editable === !1 ? "保存后 Peach 会重新载入配置。" : "保存后 Peach 会重新启动,端口改了就用新地址打开。" }), /* @__PURE__ */ G("button", {
+ children: [/* @__PURE__ */ K("p", { children: e.port_editable === !1 ? "保存后 Peach 会重新载入配置。" : "保存后 Peach 会重新启动,端口改了就用新地址打开。" }), /* @__PURE__ */ K("button", {
type: "submit",
class: "geist-button primary",
ref: O,
@@ -1409,49 +1409,49 @@ function ht({ data: e, receipt: t }) {
})]
});
}
-function gt({ receipt: e, data: t, error: n }) {
- return n || !t ? /* @__PURE__ */ G(K, {
+function ht({ receipt: e, data: t, error: n }) {
+ return n || !t ? /* @__PURE__ */ K(q, {
class: "configpage",
html: o(n || "没有读到配置", {
variant: "error",
label: "打不开配置"
})
- }) : /* @__PURE__ */ G("div", {
+ }) : /* @__PURE__ */ K("div", {
class: "configpage",
children: [
- t.startup ? /* @__PURE__ */ G(it, {
+ t.startup ? /* @__PURE__ */ K(rt, {
startup: t.startup,
receipt: e
}) : null,
- t.editable ? /* @__PURE__ */ G(ht, {
+ t.editable ? /* @__PURE__ */ K(mt, {
data: t,
receipt: e
- }) : /* @__PURE__ */ G(K, { html: o(t.notice, {
+ }) : /* @__PURE__ */ K(q, { html: o(t.notice, {
variant: "secondary",
label: "只读"
}) }),
- /* @__PURE__ */ G(pt, { data: t }),
- t.peach_proxy ? /* @__PURE__ */ G(nt, {
+ /* @__PURE__ */ K(ft, { data: t }),
+ t.peach_proxy ? /* @__PURE__ */ K(tt, {
initial: t.peach_proxy,
receipt: e
}) : null,
- t.access ? /* @__PURE__ */ G($e, {
+ t.access ? /* @__PURE__ */ K(Qe, {
initial: t.access,
receipt: e
}) : null,
- t.updates ? /* @__PURE__ */ G(tt, {
+ t.updates ? /* @__PURE__ */ K(et, {
initial: t.updates,
initialJob: t.update_job
}) : null,
- /* @__PURE__ */ G(ft, { facts: t.facts }),
- t.uninstall ? /* @__PURE__ */ G(ot, { uninstall: t.uninstall }) : null
+ /* @__PURE__ */ K(dt, { facts: t.facts }),
+ t.uninstall ? /* @__PURE__ */ K(at, { uninstall: t.uninstall }) : null
]
});
}
//#endregion
//#region node_modules/@preact/signals-core/dist/signals-core.module.js
-var _t = Symbol.for("preact-signals");
-function vt() {
+var gt = Symbol.for("preact-signals");
+function _t() {
if (Y > 1) Y--;
else {
var e, t = !1;
@@ -1477,23 +1477,23 @@ function vt() {
if (St = 0, Y--, t) throw e;
}
}
-function yt(e) {
+function vt(e) {
if (Y > 0) return e();
wt = ++Ct, Y++;
try {
return e();
} finally {
- vt();
+ _t();
}
}
-var q, J = void 0;
+var yt, J = void 0;
function bt(e) {
- var t = J, n = q;
- J = void 0, q = void 0;
+ var t = J, n = yt;
+ J = void 0, yt = void 0;
try {
return e();
} finally {
- J = t, q = n;
+ J = t, yt = n;
}
}
var xt = void 0, Y = 0, St = 0, Ct = 0, wt = 0, Tt = void 0, Et = 0;
@@ -1516,7 +1516,7 @@ function Dt(e) {
function X(e, t) {
this.v = e, this.i = 0, this.n = void 0, this.t = void 0, this.l = 0, this.W = t?.watched, this.Z = t?.unwatched, this.name = t?.name;
}
-X.prototype.brand = _t, X.prototype.h = function() {
+X.prototype.brand = gt, X.prototype.h = function() {
return !0;
}, X.prototype.S = function(e) {
var t = this, n = this.t;
@@ -1571,7 +1571,7 @@ X.prototype.brand = _t, X.prototype.h = function() {
try {
for (var t = this.t; t !== void 0; t = t.x) t.t.N();
} finally {
- vt();
+ _t();
}
}
}
@@ -1651,7 +1651,7 @@ function Nt(e) {
} catch (t) {
throw e.f &= -2, e.f |= 8, Pt(e), t;
} finally {
- J = n, vt();
+ J = n, _t();
}
}
}
@@ -1661,10 +1661,10 @@ function Pt(e) {
}
function Ft(e) {
if (J !== this) throw Error("Out-of-order effect");
- jt(this), J = e, this.f &= -2, 8 & this.f && Pt(this), vt();
+ jt(this), J = e, this.f &= -2, 8 & this.f && Pt(this), _t();
}
function Q(e, t) {
- this.x = e, this.m = void 0, this.s = void 0, this.u = void 0, this.f = 32, this.name = t?.name, q && q.push(this);
+ this.x = e, this.m = void 0, this.s = void 0, this.u = void 0, this.f = 32, this.name = t?.name, yt && yt.push(this);
}
Q.prototype.c = function() {
var e = this.S();
@@ -1716,7 +1716,7 @@ function Vt(e) {
function Ht(e) {
var t = this, n = e.data, r = Wt(n);
r.name = "ReactiveDom", r.value = n;
- var i = Ue(function() {
+ var i = He(function() {
for (var e = t, n = t.__v; n = n.__;) if (n.__c) {
n.__c.__$f |= 4;
break;
@@ -1842,7 +1842,7 @@ $("unmount", function(e, t) {
e(t);
}), $("__h", function(e, t, n, r) {
r < 3 && (t.__$f |= 2), e(t, n, r);
-}), se.prototype.shouldComponentUpdate = function(e, t) {
+}), P.prototype.shouldComponentUpdate = function(e, t) {
if (this.__R) return !0;
var n = this.__$u, r = n && n.s !== void 0;
for (var i in t) return !0;
@@ -1855,7 +1855,7 @@ $("unmount", function(e, t) {
return !1;
};
function Wt(e, t) {
- return Ue(function() {
+ return He(function() {
return Ot(e, t);
}, []);
}
@@ -1865,7 +1865,7 @@ var Gt = function(e) {
});
};
function Kt() {
- yt(function() {
+ vt(function() {
for (var e; e = Bt.shift();) Lt.call(e);
});
}
@@ -1885,7 +1885,7 @@ function $t() {
async function en(e) {
let t = Zt += 1;
try {
- let n = await I(Jt, e);
+ let n = await L(Jt, e);
return t === Zt && (Xt.value = {
data: n,
error: ""
@@ -1893,7 +1893,7 @@ async function en(e) {
} catch (n) {
throw !e?.aborted && t === Zt && (Xt.value = {
data: null,
- error: F(n)
+ error: I(n)
}), n;
}
}
@@ -1902,7 +1902,7 @@ async function en(e) {
var tn = (e, t) => en(t), nn = (e) => e.has_cover ? `/cover?code=${encodeURIComponent(e.code ?? "")}` : `/poster?id=${e.id}&c=4`;
function rn({ openItem: e, javTitleHtml: t, javDisplayName: n, srcBadge: i }) {
let { data: a, error: s } = Qt.value;
- if (s) return /* @__PURE__ */ G("div", {
+ if (s) return /* @__PURE__ */ K("div", {
class: "qualitylist",
dangerouslySetInnerHTML: { __html: o(s, {
variant: "error",
@@ -1910,44 +1910,44 @@ function rn({ openItem: e, javTitleHtml: t, javDisplayName: n, srcBadge: i }) {
}) }
});
let c = a?.items ?? [];
- return c.length ? /* @__PURE__ */ G("div", {
+ return c.length ? /* @__PURE__ */ K("div", {
class: "qualitylist",
- children: c.map((r) => /* @__PURE__ */ G("article", {
+ children: c.map((r) => /* @__PURE__ */ K("article", {
class: "qualityitem",
- children: [/* @__PURE__ */ G("button", {
+ children: [/* @__PURE__ */ K("button", {
class: "qualitycover",
type: "button",
"aria-label": `打开 ${n(r)}`,
onClick: () => e(r.id),
- children: /* @__PURE__ */ G("img", {
+ children: /* @__PURE__ */ K("img", {
src: nn(r),
alt: "",
loading: "lazy",
onError: (e) => e.currentTarget.remove()
})
- }), /* @__PURE__ */ G("div", { children: [
- /* @__PURE__ */ G("h3", { children: /* @__PURE__ */ G("button", {
+ }), /* @__PURE__ */ K("div", { children: [
+ /* @__PURE__ */ K("h3", { children: /* @__PURE__ */ K("button", {
type: "button",
"data-middle-truncate": !0,
onClick: () => e(r.id),
dangerouslySetInnerHTML: { __html: t(r) }
}) }),
- /* @__PURE__ */ G("p", {
+ /* @__PURE__ */ K("p", {
class: "mono",
children: [
- /* @__PURE__ */ G("span", {
+ /* @__PURE__ */ K("span", {
style: "display:contents",
dangerouslySetInnerHTML: { __html: i(r.location, r.cost) }
}),
- /* @__PURE__ */ G("span", { children: p[r.location] ?? r.location }),
- /* @__PURE__ */ G("span", { children: m(r.duration) }),
- /* @__PURE__ */ G("span", { children: h(r.size ?? 0) })
+ /* @__PURE__ */ K("span", { children: p[r.location] ?? r.location }),
+ /* @__PURE__ */ K("span", { children: m(r.duration) }),
+ /* @__PURE__ */ K("span", { children: h(r.size ?? 0) })
]
}),
- r.reason ? /* @__PURE__ */ G("p", { children: r.reason }) : null
+ r.reason ? /* @__PURE__ */ K("p", { children: r.reason }) : null
] })]
}, r.id))
- }) : /* @__PURE__ */ G("div", {
+ }) : /* @__PURE__ */ K("div", {
class: "qualitylist",
dangerouslySetInnerHTML: { __html: r("sparkles", "没有标记中的高清版目标", "现有版本都已满足条件,或还没有加入追踪。") }
});
@@ -1999,37 +1999,37 @@ function on(e) {
}
//#endregion
//#region src/islands/scraping.tsx
-var sn = (e, t) => I("/api/scraping", t);
+var sn = (e, t) => L("/api/scraping", t);
function cn({ value: e, onChange: t }) {
- let n = W(null), r = W(t);
- return r.current = t, U(() => {
+ let n = G(null), r = G(t);
+ return r.current = t, W(() => {
let t = n.current;
t.innerHTML = c([["peach", "Peach 代理"], ["direct", "直接连接"]], e, { label: "连接方式" });
let i = f(t.firstElementChild), a = () => r.current(i.value);
return i.addEventListener("change", a), () => {
i.disabled = !0, i.removeEventListener("change", a), t.replaceChildren();
};
- }, []), /* @__PURE__ */ G("div", {
+ }, []), /* @__PURE__ */ K("div", {
ref: n,
class: "scraping-network"
});
}
function ln({ source: e, toast: t }) {
- let [n, r] = V(e), [a, s] = V(e.network), [c, l] = V(""), [d, f] = V(""), [p, m] = V("paste"), [h, g] = V(""), [_, v] = V(!1), [y, b] = V(""), [x, S] = V([]), C = W(null), w = W(null);
- U(() => {
+ let [n, r] = H(e), [a, s] = H(e.network), [c, l] = H(""), [d, f] = H(""), [p, m] = H("paste"), [h, g] = H(""), [_, v] = H(!1), [y, b] = H(""), [x, S] = H([]), C = G(null), w = G(null);
+ W(() => {
w.current?.querySelectorAll("footer button").forEach((e) => u(e, _));
}, [_]);
- let T = W(new AbortController());
- H(() => () => T.current.abort(), []);
+ let T = G(new AbortController());
+ U(() => () => T.current.abort(), []);
async function E(n) {
if (!_) {
v(!0), b(""), S([]);
try {
if (n === "check") {
- let t = await L("/api/scraping/check", { source: e.source }, "POST", T.current.signal);
+ let t = await R("/api/scraping/check", { source: e.source }, "POST", T.current.signal);
T.current.signal.aborted || S(t.results);
} else {
- let i = await L("/api/scraping/settings", {
+ let i = await R("/api/scraping/settings", {
source: e.source,
network: a,
cookie: c,
@@ -2039,50 +2039,50 @@ function ln({ source: e, toast: t }) {
T.current.signal.aborted || (r(i.saved), l(""), f(""), g(""), C.current && (C.current.value = ""), t(n === "revoke" ? "Cookie 已撤销" : "来源设置已保存"));
}
} catch (e) {
- T.current.signal.aborted || b(F(e));
+ T.current.signal.aborted || b(I(e));
} finally {
T.current.signal.aborted || v(!1);
}
}
}
- return /* @__PURE__ */ G("section", {
+ return /* @__PURE__ */ K("section", {
class: "scraping-source",
- children: /* @__PURE__ */ G("form", {
+ children: /* @__PURE__ */ K("form", {
ref: w,
class: "cleanupfieldset",
"data-geist-fieldset": !0,
onSubmit: (e) => {
e.preventDefault(), E("save");
},
- children: [/* @__PURE__ */ G("div", {
+ children: [/* @__PURE__ */ K("div", {
class: "geist-fieldset-content scraping-fields",
children: [
- /* @__PURE__ */ G("div", { dangerouslySetInnerHTML: { __html: i(`scraping-${e.source}`, e.label) } }),
- /* @__PURE__ */ G("a", {
+ /* @__PURE__ */ K("div", { dangerouslySetInnerHTML: { __html: i(`scraping-${e.source}`, e.label) } }),
+ /* @__PURE__ */ K("a", {
class: "scraping-url",
href: e.login,
target: "_blank",
rel: "noopener noreferrer",
children: e.login
}),
- /* @__PURE__ */ G("div", {
+ /* @__PURE__ */ K("div", {
class: "scraping-label",
- children: ["连接方式", /* @__PURE__ */ G(cn, {
+ children: ["连接方式", /* @__PURE__ */ K(cn, {
value: a,
onChange: s
})]
}),
- a === "peach" && /* @__PURE__ */ G("a", {
+ a === "peach" && /* @__PURE__ */ K("a", {
href: "/configuration#peachProxy",
children: "配置 Peach 代理"
}),
- e.accepts_cookie && /* @__PURE__ */ G(N, { children: [
- /* @__PURE__ */ G("p", { children: n.cookie_saved ? "Cookie 已保存,登录是否有效请在抓取时确认。" : "需要登录时,任选一种方式提供 Cookie。" }),
- /* @__PURE__ */ G("div", {
+ e.accepts_cookie && /* @__PURE__ */ K(N, { children: [
+ /* @__PURE__ */ K("p", { children: n.cookie_saved ? "Cookie 已保存,登录是否有效请在抓取时确认。" : "需要登录时,任选一种方式提供 Cookie。" }),
+ /* @__PURE__ */ K("div", {
class: "insightswitch scraping-cookie-method",
role: "radiogroup",
"aria-label": "提供 Cookie 的方式(二选一)",
- children: [["paste", "粘贴 Cookie"], ["file", "导入文件"]].map(([t, n]) => /* @__PURE__ */ G("label", { children: [/* @__PURE__ */ G("input", {
+ children: [["paste", "粘贴 Cookie"], ["file", "导入文件"]].map(([t, n]) => /* @__PURE__ */ K("label", { children: [/* @__PURE__ */ K("input", {
type: "radio",
name: `cookie-method-${e.source}`,
value: t,
@@ -2090,29 +2090,29 @@ function ln({ source: e, toast: t }) {
onChange: () => {
m(t), l(""), f(""), g("");
}
- }), /* @__PURE__ */ G("span", { children: n })] }, t))
+ }), /* @__PURE__ */ K("span", { children: n })] }, t))
}),
- p === "paste" ? /* @__PURE__ */ G("label", { children: ["Cookie", /* @__PURE__ */ G("input", {
+ p === "paste" ? /* @__PURE__ */ K("label", { children: ["Cookie", /* @__PURE__ */ K("input", {
class: "geist-input",
type: "password",
autoComplete: "off",
value: c,
disabled: _,
onInput: (e) => l(e.currentTarget.value)
- })] }) : /* @__PURE__ */ G("label", {
+ })] }) : /* @__PURE__ */ K("label", {
class: "scraping-file",
- children: ["Netscape Cookie 文件(.txt)", /* @__PURE__ */ G("span", {
+ children: ["Netscape Cookie 文件(.txt)", /* @__PURE__ */ K("span", {
class: "scraping-file-control",
children: [
- /* @__PURE__ */ G("span", {
+ /* @__PURE__ */ K("span", {
class: "geist-button",
children: "选择文件"
}),
- /* @__PURE__ */ G("span", {
+ /* @__PURE__ */ K("span", {
class: "scraping-file-name",
children: h || "未选择文件"
}),
- /* @__PURE__ */ G("input", {
+ /* @__PURE__ */ K("input", {
ref: C,
type: "file",
accept: ".txt",
@@ -2142,31 +2142,31 @@ function ln({ source: e, toast: t }) {
})]
})
] }),
- y && /* @__PURE__ */ G("div", {
+ y && /* @__PURE__ */ K("div", {
role: "alert",
dangerouslySetInnerHTML: { __html: o(y, { variant: "error" }) }
}),
- x.map((t) => /* @__PURE__ */ G("div", {
+ x.map((t) => /* @__PURE__ */ K("div", {
role: "status",
dangerouslySetInnerHTML: { __html: o(`${e.label}${t.label === "来源页面" ? "" : " 高清图片"}:${t.ok ? "可连接" : "不能连接"}` + (t.width ? ` · ${t.width} × ${t.height}` : "") + (t.message ? `。${t.message}` : ""), { variant: t.ok ? "success" : "error" }) }
}, t.label))
]
- }), /* @__PURE__ */ G("footer", {
+ }), /* @__PURE__ */ K("footer", {
class: "geist-fieldset-footer",
"data-geist-fieldset-footer": !0,
children: [
- /* @__PURE__ */ G("button", {
+ /* @__PURE__ */ K("button", {
class: "geist-button primary",
type: "submit",
children: "保存"
}),
- /* @__PURE__ */ G("button", {
+ /* @__PURE__ */ K("button", {
class: "geist-button",
type: "button",
onClick: () => void E("check"),
children: "检查连接"
}),
- e.accepts_cookie && n.cookie_saved && /* @__PURE__ */ G("button", {
+ e.accepts_cookie && n.cookie_saved && /* @__PURE__ */ K("button", {
class: "geist-button",
type: "button",
onClick: () => void E("revoke"),
@@ -2178,13 +2178,13 @@ function ln({ source: e, toast: t }) {
});
}
function un({ data: e, error: t, toast: n }) {
- let [r, a] = V(""), [s, c] = V(!1), [l, d] = V(""), f = W(null);
- U(() => u(f.current, s), [s]);
- let p = W(new AbortController()), m = W(0);
+ let [r, a] = H(""), [s, c] = H(!1), [l, d] = H(""), f = G(null);
+ W(() => u(f.current, s), [s]);
+ let p = G(new AbortController()), m = G(0);
async function h(e = !1) {
let t = ++m.current;
await an({
- read: (e) => I("/api/scraping/cover", e),
+ read: (e) => L("/api/scraping/cover", e),
active: () => !p.current.signal.aborted && t === m.current,
render: (t) => {
c(t.status === "running"), t.status === "running" && (e = !1), t.status === "failed" && !e && d(t.error || "采集未取得"), t.status === "complete" && !e && n(t.result || "封面采集完成");
@@ -2192,37 +2192,37 @@ function un({ data: e, error: t, toast: n }) {
disconnected: () => d("连接中断,正在重新读取后台进度")
});
}
- H(() => (h(!0), () => p.current.abort()), []);
+ U(() => (h(!0), () => p.current.abort()), []);
async function g() {
if (!s) {
m.current++, c(!0), d("");
try {
- await L("/api/scraping/cover", { code: r }, "POST", p.current.signal), await h();
+ await R("/api/scraping/cover", { code: r }, "POST", p.current.signal), await h();
} catch (e) {
- p.current.signal.aborted || (c(!1), d(F(e)));
+ p.current.signal.aborted || (c(!1), d(I(e)));
}
}
}
- return t ? /* @__PURE__ */ G("div", {
+ return t ? /* @__PURE__ */ K("div", {
role: "alert",
dangerouslySetInnerHTML: { __html: o(t, { variant: "error" }) }
- }) : /* @__PURE__ */ G("div", {
+ }) : /* @__PURE__ */ K("div", {
class: "scraping-page",
children: [
- /* @__PURE__ */ G("p", { children: "高清图片可能需要代理才能下载,请先检查连接。" }),
- /* @__PURE__ */ G("section", {
+ /* @__PURE__ */ K("p", { children: "高清图片可能需要代理才能下载,请先检查连接。" }),
+ /* @__PURE__ */ K("section", {
class: "cleanupfieldset scraping-source",
"data-geist-fieldset": !0,
- children: /* @__PURE__ */ G("div", {
+ children: /* @__PURE__ */ K("div", {
class: "geist-fieldset-content scraping-fields",
children: [
- /* @__PURE__ */ G("div", { dangerouslySetInnerHTML: { __html: i("scraping-cover", "高清封面") } }),
- /* @__PURE__ */ G("form", {
+ /* @__PURE__ */ K("div", { dangerouslySetInnerHTML: { __html: i("scraping-cover", "高清封面") } }),
+ /* @__PURE__ */ K("form", {
class: "scraping-cover-form",
onSubmit: (e) => {
e.preventDefault(), g();
},
- children: [/* @__PURE__ */ G("input", {
+ children: [/* @__PURE__ */ K("input", {
class: "geist-input",
"aria-label": "馆藏番号",
required: !0,
@@ -2230,21 +2230,21 @@ function un({ data: e, error: t, toast: n }) {
disabled: s,
placeholder: "输入馆藏番号,如 ABW-232",
onInput: (e) => a(e.currentTarget.value)
- }), /* @__PURE__ */ G("button", {
+ }), /* @__PURE__ */ K("button", {
ref: f,
class: "geist-button primary",
type: "submit",
children: "抓取封面"
})]
}),
- l && /* @__PURE__ */ G("div", {
+ l && /* @__PURE__ */ K("div", {
role: "alert",
dangerouslySetInnerHTML: { __html: o(l, { variant: "error" }) }
})
]
})
}),
- e?.sources.map((e) => /* @__PURE__ */ G(ln, {
+ e?.sources.map((e) => /* @__PURE__ */ K(ln, {
source: e,
toast: n
}, e.source))
@@ -2253,14 +2253,14 @@ function un({ data: e, error: t, toast: n }) {
}
//#endregion
//#region src/islands/library-processing.tsx
-var dn = (e, t) => I("/api/library-processing", t);
+var dn = (e, t) => L("/api/library-processing", t);
function fn({ data: e, error: t, toast: n, onComplete: r, mode: c, monitor: l }) {
- let [d, f] = V(e || { status: "idle" }), [p, m] = V(t), [h, g] = V(!1), [_, v] = V(!1), y = W(new AbortController()), b = W(0), x = W(d.status), S = W(null), C = h || d.status === "running";
- U(() => u(S.current, C), [C]);
+ let [d, f] = H(e || { status: "idle" }), [p, m] = H(t), [h, g] = H(!1), [_, v] = H(!1), y = G(new AbortController()), b = G(0), x = G(d.status), S = G(null), C = h || d.status === "running";
+ W(() => u(S.current, C), [C]);
async function w() {
let e = ++b.current;
await an({
- read: (e) => I("/api/library-processing", e),
+ read: (e) => L("/api/library-processing", e),
active: () => !y.current.signal.aborted && b.current === e,
keepWatching: c === "notice" || !!l,
render: (e) => {
@@ -2269,49 +2269,49 @@ function fn({ data: e, error: t, toast: n, onComplete: r, mode: c, monitor: l })
disconnected: () => m("连接中断,正在重新读取处理进度")
});
}
- H(() => ((d.status === "running" || c === "notice" || l) && w(), () => y.current.abort()), []);
+ U(() => ((d.status === "running" || c === "notice" || l) && w(), () => y.current.abort()), []);
async function T() {
if (!C) {
g(!0), m(""), v(!1);
try {
- let e = await L("/api/library-processing", {}, "POST", y.current.signal);
+ let e = await R("/api/library-processing", {}, "POST", y.current.signal);
if (y.current.signal.aborted) return;
x.current = e.status, f(e), g(!1), await w();
} catch (e) {
- y.current.signal.aborted || (m(F(e)), g(!1));
+ y.current.signal.aborted || (m(I(e)), g(!1));
}
}
}
- return c === "notice" ? !p && d.status !== "running" && d.status !== "failed" ? null : /* @__PURE__ */ G("div", {
+ return c === "notice" ? !p && d.status !== "running" && d.status !== "failed" ? null : /* @__PURE__ */ K("div", {
class: "library-processing-banner",
role: "status",
- children: [/* @__PURE__ */ G("span", { children: p || (d.status === "failed" ? "扫描与资料采集未完成" : `${d.stage || "正在整理馆藏"}${d.total ? ` · ${d.checked || 0} / ${d.total}` : ""}`) }), /* @__PURE__ */ G("a", {
+ children: [/* @__PURE__ */ K("span", { children: p || (d.status === "failed" ? "扫描与资料采集未完成" : `${d.stage || "正在整理馆藏"}${d.total ? ` · ${d.checked || 0} / ${d.total}` : ""}`) }), /* @__PURE__ */ K("a", {
class: "geist-button",
href: "/data-cleanup#libraryProcessing",
children: p || d.status === "failed" ? "查看并处理" : "查看进度"
})]
- }) : /* @__PURE__ */ G(N, { children: [/* @__PURE__ */ G("div", {
+ }) : /* @__PURE__ */ K(N, { children: [/* @__PURE__ */ K("div", {
class: "geist-fieldset-content library-processing",
children: [
- /* @__PURE__ */ G("div", { dangerouslySetInnerHTML: { __html: i("cleanupScrapingTitle", "扫描与采集") } }),
- /* @__PURE__ */ G("p", { children: "扫描媒体文件夹,导入已有资料,采集缺失信息。" }),
- /* @__PURE__ */ G("div", {
+ /* @__PURE__ */ K("div", { dangerouslySetInnerHTML: { __html: i("cleanupScrapingTitle", "扫描与采集") } }),
+ /* @__PURE__ */ K("p", { children: "扫描媒体文件夹,导入已有资料,采集缺失信息。" }),
+ /* @__PURE__ */ K("div", {
"aria-live": "polite",
children: [
- d.status === "running" && /* @__PURE__ */ G(N, { children: [/* @__PURE__ */ G("div", { dangerouslySetInnerHTML: { __html: a(`${d.stage || "正在处理"}${d.total ? ` · ${d.checked || 0} / ${d.total}` : ""}`) } }), !!d.total && /* @__PURE__ */ G("div", { dangerouslySetInnerHTML: { __html: s(`已处理 ${d.checked || 0} / ${d.total} 个视频`, d.checked || 0, d.total) } })] }),
- (p || d.status === "failed") && /* @__PURE__ */ G("div", {
+ d.status === "running" && /* @__PURE__ */ K(N, { children: [/* @__PURE__ */ K("div", { dangerouslySetInnerHTML: { __html: a(`${d.stage || "正在处理"}${d.total ? ` · ${d.checked || 0} / ${d.total}` : ""}`) } }), !!d.total && /* @__PURE__ */ K("div", { dangerouslySetInnerHTML: { __html: s(`已处理 ${d.checked || 0} / ${d.total} 个视频`, d.checked || 0, d.total) } })] }),
+ (p || d.status === "failed") && /* @__PURE__ */ K("div", {
role: "alert",
dangerouslySetInnerHTML: { __html: o(p || d.error || "处理未完成,请重试", { variant: "error" }) }
}),
- d.status === "failed" && !!d.issues?.length && /* @__PURE__ */ G("ul", { children: d.issues.slice(0, 20).map((e) => /* @__PURE__ */ G("li", { children: [
- e.asset_id ? /* @__PURE__ */ G("a", {
+ d.status === "failed" && !!d.issues?.length && /* @__PURE__ */ K("ul", { children: d.issues.slice(0, 20).map((e) => /* @__PURE__ */ K("li", { children: [
+ e.asset_id ? /* @__PURE__ */ K("a", {
href: `/item/${e.asset_id}`,
children: "查看视频"
}) : null,
e.asset_id ? ":" : "",
e.message
] })) }),
- _ && /* @__PURE__ */ G("div", {
+ _ && /* @__PURE__ */ K("div", {
class: "library-processing-result",
dangerouslySetInnerHTML: { __html: o(`已扫描 ${d.scanned || 0} 个文件,识别 ${d.identified || 0} 个番号,整理 ${d.candidates || 0} 组资料候选。`, {
variant: "success",
@@ -2321,21 +2321,21 @@ function fn({ data: e, error: t, toast: n, onComplete: r, mode: c, monitor: l })
]
})
]
- }), /* @__PURE__ */ G("footer", {
+ }), /* @__PURE__ */ K("footer", {
class: "geist-fieldset-footer",
"data-geist-fieldset-footer": !0,
children: [
- /* @__PURE__ */ G("a", {
+ /* @__PURE__ */ K("a", {
class: "geist-button",
href: "/scraping",
children: "采集来源"
}),
- !!d.candidates && /* @__PURE__ */ G("a", {
+ !!d.candidates && /* @__PURE__ */ K("a", {
class: "geist-button",
href: "/review",
children: "复核资料"
}),
- /* @__PURE__ */ G("button", {
+ /* @__PURE__ */ K("button", {
ref: S,
type: "button",
class: "geist-button primary",
@@ -2381,7 +2381,7 @@ async function _n(e, t, n, r) {
} catch (e) {
i.push({
key: o.key,
- message: F(e)
+ message: I(e)
});
}
}
@@ -2394,10 +2394,26 @@ function vn(e, n) {
let r = e.querySelector(".reviewlist");
if (!r || !n.rows.length || n.locked) return;
let i = n.state, a = [...r.querySelectorAll("[data-review-key]")], o = document.createElement("div");
- o.className = "reviewbulkbar";
+ o.className = "reviewbulkbar reviewbulktoolbar", o.setAttribute("role", "group"), o.setAttribute("aria-label", "复核批量操作");
let s = document.createElement("button");
- s.className = "geist-button", s.type = "button", o.append(s), r.before(o);
- let c = n.metadata ? [{
+ s.className = "geist-button", s.type = "button";
+ let l = document.createElement("button");
+ l.className = "geist-button", l.type = "button";
+ let d = document.createElement("button");
+ d.className = "geist-button primary", d.type = "button";
+ let p = document.createElement("button");
+ p.className = "geist-button reviewbulkreject", p.type = "button";
+ let m = document.createElement("div");
+ m.className = "reviewbulksource";
+ let h = document.createElement("p");
+ h.className = "reviewstate reviewbulkfeedback", h.setAttribute("role", "status"), o.append(s, l, m, d, p), r.before(o, h);
+ let g = () => a.filter((e) => i.selected.has(e.dataset.reviewKey));
+ l.onclick = () => {
+ if (i.busy) return;
+ let e = g().length === a.length;
+ a.forEach((t) => e ? i.selected.delete(t.dataset.reviewKey) : i.selected.add(t.dataset.reviewKey)), x();
+ }, d.onclick = () => b(g, h, d, "approved"), p.onclick = () => b(g, h, p, "rejected");
+ let _ = n.metadata ? [{
title: "单一候选",
cards: a.filter((e) => (n.rows.find((t) => t.item_key === e.dataset.reviewKey)?.candidates?.length || 0) === 1)
}, {
@@ -2408,107 +2424,136 @@ function vn(e, n) {
cards: a
}];
r.classList.add("reviewgroups");
- let l = (e) => !e.querySelector("[data-review-status=\"approved\"]")?.disabled, d = [];
- for (let a of c.filter((e) => e.cards.length)) {
- let o = document.createElement("section");
- o.className = "reviewgroup";
- let s = document.createElement("div");
- s.className = "reviewbulkbar";
- let c = document.createElement("h3");
- c.textContent = `${a.title} · ${a.cards.length}`;
- let p = document.createElement("button");
- p.className = "geist-button", p.type = "button";
- let m = document.createElement("button");
- m.className = "geist-button", m.type = "button";
- let h = document.createElement("p");
- h.className = "reviewstate", h.setAttribute("role", "status");
- let g = document.createElement("div");
- g.className = "reviewlist", s.append(c, p, m), o.append(s, h, g), r.append(o);
- for (let e of a.cards) {
- g.append(e);
- let n = e.dataset.reviewKey, r = l(e);
- i.errors.has(n) && (e.querySelector(".reviewstate").textContent = i.errors.get(n));
- let a = document.createElement("label");
- a.className = "reviewpickitem", a.innerHTML = t("aria-label=\"选择此复核项\"") + "<span>选择此项</span>";
- let o = a.querySelector("input");
- if (e.prepend(a), i.assets.has(n)) {
- let t = i.assets.get(n), r = [...e.querySelectorAll("[data-review-asset]")];
+ let v = (e) => !e.querySelector("[data-review-status=\"approved\"]")?.disabled, y = [];
+ for (let e of _.filter((e) => e.cards.length)) {
+ let n = document.createElement("section");
+ n.className = "reviewgroup";
+ let a = document.createElement("div");
+ a.className = "reviewbulkbar";
+ let o = document.createElement("h3");
+ o.textContent = `${e.title} · ${e.cards.length}`;
+ let s = document.createElement("button");
+ s.className = "geist-button", s.type = "button";
+ let c = document.createElement("button");
+ c.className = "geist-button", c.type = "button";
+ let l = document.createElement("p");
+ l.className = "reviewstate", l.setAttribute("role", "status");
+ let u = document.createElement("div");
+ u.className = "reviewlist", a.append(o, s, c), n.append(a, l, u), r.append(n);
+ for (let n of e.cards) {
+ u.append(n);
+ let e = n.dataset.reviewKey;
+ i.errors.has(e) && (n.querySelector(".reviewstate").textContent = i.errors.get(e));
+ let r = document.createElement("label");
+ r.className = "reviewpickitem", r.innerHTML = t("aria-label=\"选择此复核项\"") + "<span>选择此项</span>";
+ let a = r.querySelector("input");
+ if (n.prepend(r), i.assets.has(e)) {
+ let t = i.assets.get(e), r = [...n.querySelectorAll("[data-review-asset]")];
r.forEach((e) => {
let n = t.includes(Number(e.dataset.reviewAsset));
e.setAttribute("aria-pressed", String(n)), e.classList.toggle("picked", n);
});
- let a = e.querySelector("[data-picked-count]");
+ let a = n.querySelector("[data-picked-count]");
a && (a.textContent = `已选 ${t.length} / ${r.length}`);
}
- e.addEventListener("click", (t) => {
- t.target.closest("[data-review-asset],[data-pick-all],[data-pick-none]") && i.assets.set(n, [...e.querySelectorAll("[data-review-asset][aria-pressed=\"true\"]")].map((e) => Number(e.dataset.reviewAsset)));
+ n.addEventListener("click", (t) => {
+ t.target.closest("[data-review-asset],[data-pick-all],[data-pick-none]") && i.assets.set(e, [...n.querySelectorAll("[data-review-asset][aria-pressed=\"true\"]")].map((e) => Number(e.dataset.reviewAsset)));
});
- for (let t of e.querySelectorAll("input[type=\"radio\"]")) i.choices.has(n) && (t.checked = i.choices.get(n) === t.value), t.addEventListener("change", () => {
- t.checked && i.choices.set(n, t.value);
+ for (let t of n.querySelectorAll("input[type=\"radio\"]")) i.choices.has(e) && (t.checked = i.choices.get(e) === t.value), t.addEventListener("change", () => {
+ t.checked && i.choices.set(e, t.value), x();
});
- o.onchange = () => {
- o.checked ? i.selected.add(n) : i.selected.delete(n), f();
- }, d.push(() => {
- a.hidden = !i.active, o.checked = i.selected.has(n), o.disabled = !r;
+ a.onchange = () => {
+ a.checked ? i.selected.add(e) : i.selected.delete(e), x();
+ }, y.push(() => {
+ r.hidden = !i.active, a.checked = i.selected.has(e), a.disabled = !1;
});
}
- let _ = () => a.cards.filter((e) => i.selected.has(e.dataset.reviewKey) && l(e));
- d.push(() => {
- p.hidden = m.hidden = !i.active, p.textContent = _().length && _().length === a.cards.filter(l).length ? "清空本组" : "全选本组", m.textContent = `采用所选${_().length ? `(${_().length})` : ""}`, m.disabled = !_().length, p.disabled = !a.cards.some(l);
- }), p.onclick = () => {
+ let d = () => e.cards.filter((e) => i.selected.has(e.dataset.reviewKey) && v(e));
+ y.push(() => {
+ s.hidden = c.hidden = !i.active, s.textContent = d().length && d().length === e.cards.filter(v).length ? "清空本组" : "全选本组", c.textContent = `采用所选${d().length ? `(${d().length})` : ""}`, c.disabled = !d().length, s.disabled = !e.cards.some(v);
+ }), s.onclick = () => {
if (i.busy) return;
- let e = a.cards.filter(l), t = _().length === e.length;
- e.forEach((e) => t ? i.selected.delete(e.dataset.reviewKey) : i.selected.add(e.dataset.reviewKey)), f();
- }, m.onclick = async () => {
- if (i.busy || !_().length) return;
- let t = _().map((e) => ({
- key: e.dataset.reviewKey,
- payload: n.payload(e)
- }));
- if (n.metadata && t.some((e) => !e.payload.candidate_key)) {
- h.textContent = "请先为所选的多来源候选选择来源。", _().find((e) => !e.querySelector("input[type=\"radio\"]:checked"))?.querySelector("input[type=\"radio\"]")?.focus();
- return;
+ let t = e.cards.filter(v), n = d().length === t.length;
+ t.forEach((e) => n ? i.selected.delete(e.dataset.reviewKey) : i.selected.add(e.dataset.reviewKey)), x();
+ }, c.onclick = () => b(d, l, c, "approved");
+ }
+ async function b(t, r, a, o) {
+ if (i.busy || !t().length) return;
+ let s = t().map((e) => ({
+ key: e.dataset.reviewKey,
+ payload: {
+ ...n.payload(e),
+ status: o
}
- i.busy = !0, h.textContent = `正在采用 0 / ${t.length}`, f(), u(m, !0);
- let r = [...e.querySelectorAll("button,input")], a = r.map((e) => e.getAttribute("aria-disabled"));
- r.forEach((e) => {
- e.setAttribute("aria-disabled", "true");
- });
- let o = (e) => {
- e instanceof KeyboardEvent && e.key === "Tab" || (e.preventDefault(), e.stopImmediatePropagation());
- };
- e.addEventListener("click", o, !0), e.addEventListener("keydown", o, !0);
- let s = 0, c = await _n(t, async (e) => {
- try {
- return await n.submit(e);
- } finally {
- s++, n.active() && (h.textContent = `正在采用 ${s} / ${t.length}`);
- }
- }, (e) => {
- i.selected.delete(e), i.errors.delete(e), n.applied(e);
- }, n.active);
- if (i.busy = !1, e.removeEventListener("click", o, !0), e.removeEventListener("keydown", o, !0), r.forEach((e, t) => {
- let n = a[t];
- n === null ? e.removeAttribute("aria-disabled") : e.setAttribute("aria-disabled", n);
- }), u(m, !1), !n.active()) return;
- n.notify(`已采用 ${c.completed} 项${c.failures.length ? `,${c.failures.length} 项未完成` : ""}`), c.failures.forEach((e) => i.errors.set(e.key, e.message));
- let l = e.parentElement;
- n.refresh(), l?.querySelector(".reviewbulkbar button")?.focus({ preventScroll: !0 });
+ }));
+ if (o === "approved" && n.metadata && s.some((e) => !e.payload.candidate_key)) {
+ r.textContent = "请先为所选的多来源候选选择来源。", t().find((e) => !e.querySelector("input[type=\"radio\"]:checked"))?.querySelector("input[type=\"radio\"]")?.focus();
+ return;
+ }
+ i.busy = !0, r.textContent = `正在处理 0 / ${s.length}`, x(), u(a, !0);
+ let c = [...e.querySelectorAll("button,input")], l = c.map((e) => e.getAttribute("aria-disabled"));
+ c.forEach((e) => {
+ e.setAttribute("aria-disabled", "true");
+ });
+ let d = (e) => {
+ e instanceof KeyboardEvent && e.key === "Tab" || (e.preventDefault(), e.stopImmediatePropagation());
};
+ e.addEventListener("click", d, !0), e.addEventListener("keydown", d, !0);
+ let f = 0, p = await _n(s, async (e) => {
+ try {
+ return await n.submit(e);
+ } finally {
+ f++, n.active() && (r.textContent = `正在处理 ${f} / ${s.length}`);
+ }
+ }, (e) => {
+ i.selected.delete(e), i.errors.delete(e), n.applied(e);
+ }, n.active);
+ if (i.busy = !1, e.removeEventListener("click", d, !0), e.removeEventListener("keydown", d, !0), c.forEach((e, t) => {
+ let n = l[t];
+ n === null ? e.removeAttribute("aria-disabled") : e.setAttribute("aria-disabled", n);
+ }), u(a, !1), !n.active()) return;
+ n.notify(`已处理 ${p.completed} 项${p.failures.length ? `,${p.failures.length} 项未完成` : ""}`), p.failures.forEach((e) => i.errors.set(e.key, e.message));
+ let m = e.parentElement;
+ n.refresh(), m?.querySelector(".reviewbulkbar button")?.focus({ preventScroll: !0 });
}
- function f() {
- s.textContent = i.active ? "退出多选" : "多选", s.setAttribute("aria-pressed", String(i.active)), d.forEach((e) => e());
+ function x() {
+ l.hidden = m.hidden = d.hidden = p.hidden = !i.active, m.hidden ||= !n.metadata;
+ let e = g();
+ l.textContent = e.length === a.length ? "清空选择" : "全选本页", d.textContent = `通过所选(${e.length})`, p.textContent = `拒绝所选(${e.length})`, d.disabled = !e.length || e.some((e) => !v(e)), p.disabled = !e.length;
+ let t = n.rows.filter((e) => i.selected.has(e.item_key)), r = yn(t);
+ m.innerHTML = c([["", t.length && !r.length ? "所选项目无共同来源" : "统一选择来源"], ...r.map((e) => [e, e])], "", { label: "统一选择来源" });
+ let o = f(m.firstElementChild);
+ o.disabled = !r.length, o.addEventListener("change", () => {
+ if (!(i.busy || !r.includes(o.value))) {
+ for (let n of e) {
+ let e = t.find((e) => e.item_key === n.dataset.reviewKey), r = e.candidates.find((e) => e.source === o.value);
+ n.querySelectorAll("input[type=\"radio\"]").forEach((e) => {
+ e.checked = e.value === r.candidate_key;
+ }), i.choices.set(e.item_key, r.candidate_key);
+ }
+ h.textContent = `已为 ${e.length} 项选择 ${o.value},点击通过所选采用。`;
+ }
+ }), s.textContent = i.active ? "退出多选" : "多选", s.setAttribute("aria-pressed", String(i.active)), y.forEach((e) => e());
}
- s.onclick = () => {
- i.busy || (i.active = !i.active, i.active || i.selected.clear(), f());
- }, f();
+ let S = (e) => {
+ i.busy || (i.active = e, e || i.selected.clear(), x(), n.modeChanged?.(e));
+ };
+ return s.onclick = () => S(!i.active), x(), {
+ setMode: S,
+ get busy() {
+ return i.busy;
+ }
+ };
+}
+function yn(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)) : [];
}
//#endregion
//#region src/native-image.ts
-function yn(e, t, n, r) {
+function bn(e, t, n, r) {
return e > 0 && t > 0 && e === n && t === r;
}
-function bn(e, t, n, r, i = 1) {
+function xn(e, t, n, r, i = 1) {
let a = Number.isFinite(i) && i > 0 ? i : 1;
e /= a, t /= a;
let o = [
@@ -2525,7 +2570,7 @@ function bn(e, t, n, r, i = 1) {
}
//#endregion
//#region src/entity-skeleton.ts
-function xn(e, t) {
+function Sn(e, t) {
return `<section data-skeleton="entity/${e}" role="status" aria-label="正在读取资料">
<span class="sr-only">正在读取资料</span><div aria-hidden="true">
<div class="entityhero"><div class="entityportrait ${e === "studio" || e === "agency" ? "square " : ""}skeleton"></div>
@@ -2537,7 +2582,7 @@ function xn(e, t) {
}
//#endregion
//#region src/catalog-onboarding.ts
-var Sn = [
+var Cn = [
"loc",
"creator",
"performer",
@@ -2554,20 +2599,16 @@ var Sn = [
"jav",
"thumb"
];
-function Cn() {
- let e = (e) => [
- ,
- ,
- ,
- ].fill(e).join("");
+function wn() {
+ let e = (e) => Array(64).fill(e).join("");
return {
tiers: "<div class=\"tier catalog-placeholder\" aria-hidden=\"true\">" + e("<span class=\"av\"><span class=\"ring\"></span><span class=\"nm\">&nbsp;</span></span>") + "</div><div class=\"tier catalog-placeholder\" aria-hidden=\"true\">" + e("<span class=\"brandpill\"><span class=\"mk\"></span><span class=\"placeholder-name\">&nbsp;</span></span>") + "</div>",
tags: "<span class=\"catalog-placeholder placeholder-tags\" aria-hidden=\"true\">" + e("<span class=\"pill\">&nbsp;</span>") + "</span>"
};
}
-async function wn(e, t) {
+async function Tn(e, t) {
let n = new URLSearchParams();
- for (let t of Sn) e[t] && n.set(t, e[t]);
+ for (let t of Cn) e[t] && n.set(t, e[t]);
let [r, i] = await Promise.all([t("/api/facets?" + n), t("/api/items?" + n + "&limit=5")]), a = [...new Set([
...r.creators || [],
...r.tagperformers || [],
@@ -2578,7 +2619,7 @@ async function wn(e, t) {
return r.set("q", e), r.set("limit", "1"), (await t("/api/items?" + r)).total > 0 ? e : "";
}))).filter(Boolean);
}
-function Tn({ kind: e = "catalog", filtered: t = !1, jav: n = !1, configurable: i = !1, online: a = !1 } = {}) {
+function En({ kind: e = "catalog", filtered: t = !1, jav: n = !1, configurable: i = !1, online: a = !1 } = {}) {
let o = i ? "<a class=\"geist-button primary\" href=\"/configuration\">添加内容</a>" : "", s = "<a class=\"geist-button\" href=\"/follow-manage\">添加来源</a>";
return t || n ? r("search", n ? "还没有符合条件的 JAV 作品" : "没有符合条件的内容", n ? "已扫描但尚未补充发行资料的视频可在全部内容中查看。" : "清除筛选或搜索条件后查看全部内容。", { actions: "<a class=\"geist-button primary\" href=\"/?loc=&thumb=0\">查看全部内容</a>" }) : e === "catalog" ? r("play", "还没有视频", "添加媒体文件夹或关注来源,开始建立你的馆藏。", { actions: o + s }) : r(e === "tags" ? "tags" : "user-round", "还没有" + ({
tags: "标签",
@@ -2591,7 +2632,7 @@ function Tn({ kind: e = "catalog", filtered: t = !1, jav: n = !1, configurable:
}
//#endregion
//#region src/sidebar.ts
-function En(e) {
+function Dn(e) {
return [
"/",
"/unseen",
@@ -2601,23 +2642,23 @@ function En(e) {
"/junk-files"
].includes(e) || /^\/(item|mix|parts|editions)\//.test(e) || /^\/playlists\/\d+\/\d+$/.test(e) || /^\/(performers|studios|creators|series|agencies)\/.+/.test(e);
}
-function Dn(e, t) {
+function On(e, t) {
return e.dataset.surface === t && e.querySelector(".dnav") ? !1 : (e.dataset.surface = t, e.replaceChildren(), !0);
}
-function On(e) {
+function kn(e) {
let t = /* @__PURE__ */ new Map();
for (let n of e) for (let e of new Set(n.tags || [])) t.set(e, (t.get(e) || 0) + 1);
return [...t].sort((e, t) => t[1] - e[1]).slice(0, 30);
}
//#endregion
//#region src/management.ts
-function kn(e) {
+function An(e) {
return e.filter((e) => ["115", "pikpak"].includes(e.location) && (e.roots === void 0 || e.roots.length > 0)).map((e) => e.location);
}
-function An(e, t) {
+function jn(e, t) {
return t.filter((t) => e.some((e) => e.location === t));
}
-function jn() {
+function Mn() {
return `<div class="cleanuppage" data-skeleton="cleanup" aria-busy="true" aria-label="正在读取数据管理状态">
<div class="cleanupgrid">${[
[
@@ -2663,7 +2704,7 @@ function jn() {
<footer class="geist-fieldset-footer" data-geist-fieldset-footer><button type="button"${r === 3 ? " class=\"danger\"" : ""} disabled>${r === 3 ? "<svg aria-hidden=\"true\"><use href=\"#i-trash\"></use></svg><span>" + t + "</span>" : t}</button></footer>
</section>`).join("")}</div></div>`;
}
-function Mn(e, t = !1, n = !1) {
+function Nn(e, t = !1, n = !1) {
if (t || n) return "";
let r = "<svg aria-hidden=\"true\"><use href=\"#i-external-link\"></use></svg>";
return `<details class="taste-history-guide"${e ? " open" : ""}>
@@ -2677,43 +2718,44 @@ function Mn(e, t = !1, n = !1) {
<button type="button" class="geist-button taste-guide-skip">跳过</button>
</div></details>`;
}
-var Nn = "peach-taste-guide-dismissed";
-function Pn(e, t) {
+var Pn = "peach-taste-guide-dismissed";
+function Fn(e, t) {
+ d(e, ".taste-history-guide", "taste-guide-collapse");
let n = e.querySelector(".taste-history-guide");
n?.querySelector(".taste-guide-skip")?.addEventListener("click", () => {
- t.setItem(Nn, "1"), n.remove();
+ t.setItem(Pn, "1"), n.remove();
});
}
//#endregion
//#region src/jav-artwork.ts
-function Fn(e) {
+function In(e) {
return [
"small",
"sleeve",
"preview"
].includes(String(e)) ? "small" : "big";
}
-function In(e) {
+function Ln(e) {
return {
- javLayout: Fn(e.javLayout),
- javImage: Ln(e.javLayout === "preview" ? "thumbnail" : e.javImage)
+ javLayout: In(e.javLayout),
+ javImage: Rn(e.javLayout === "preview" ? "thumbnail" : e.javImage)
};
}
-function Ln(e) {
+function Rn(e) {
return e === "thumbnail" ? "thumbnail" : "cover";
}
-function Rn(e, t) {
- return e.is_jav && e.code && e.has_cover && (Ln(t) === "cover" || !e.has_thumb) ? "cover" : e.has_thumb ? "thumbnail" : "";
-}
function zn(e, t) {
+ return e.is_jav && e.code && e.has_cover && (Rn(t) === "cover" || !e.has_thumb) ? "cover" : e.has_thumb ? "thumbnail" : "";
+}
+function Bn(e, t) {
e.querySelectorAll("img[data-jav-image]").forEach((e) => {
- let n = e.dataset.javCover || "", r = e.dataset.javThumb || "", i = !!(n && (Ln(t) === "cover" || !r)), a = i ? n : r;
+ let n = e.dataset.javCover || "", r = e.dataset.javThumb || "", i = !!(n && (Rn(t) === "cover" || !r)), a = i ? n : r;
e.classList.toggle("cover", i), e.classList.toggle("whole", i && e.dataset.javImageLayout !== "big"), e.classList.toggle("front", i && e.dataset.javImageLayout === "big"), e.removeAttribute("style"), a && e.getAttribute("src") !== a && (e.src = a);
});
}
//#endregion
//#region src/islands.ts
-var Bn = {
+var Vn = {
"library-processing": {
load: dn,
component: fn
@@ -2727,19 +2769,19 @@ var Bn = {
component: rn
},
configuration: {
- load: ut,
- component: gt
+ load: lt,
+ component: ht
}
-}, Vn = () => Object.keys(Bn), Hn = /* @__PURE__ */ new Map();
-async function Un(e, t, n, r = {}) {
- let i = Bn[e];
+}, Hn = () => Object.keys(Vn), Un = /* @__PURE__ */ new Map();
+async function Wn(e, t, n, r = {}) {
+ let i = Vn[e];
if (!i) throw Error(`未注册的 island:${String(e)}`);
- Wn(t);
+ Gn(t);
let a = {
controller: new AbortController(),
painted: !1
};
- Hn.set(t, a);
+ Un.set(t, a);
let o;
try {
o = {
@@ -2750,12 +2792,12 @@ async function Un(e, t, n, r = {}) {
if (a.controller.signal.aborted) return;
o = {
data: null,
- error: F(e)
+ error: I(e)
};
}
- if (Hn.get(t) !== a) return;
+ if (Un.get(t) !== a) return;
if (r.isCurrent && !r.isCurrent()) {
- Hn.delete(t);
+ Un.delete(t);
return;
}
t.textContent = "", a.painted = !0;
@@ -2763,11 +2805,11 @@ async function Un(e, t, n, r = {}) {
...n,
...o
};
- De(ae(i.component, s), t);
+ Ee(ae(i.component, s), t);
}
-function Wn(e) {
- let t = Hn.get(e);
- t && (t.controller.abort(), Hn.delete(e), t.painted && De(null, e));
+function Gn(e) {
+ let t = Un.get(e);
+ t && (t.controller.abort(), Un.delete(e), t.painted && Ee(null, e));
}
//#endregion
-export { Nn as TASTE_GUIDE_KEY, Tn as catalogEmptyHtml, wn as catalogSuggestions, jn as cleanupSkeletonHtml, kn as cloudLocations, An as cloudPreferenceLocations, gn as createReviewSelection, Cn as emptyCatalogLayout, xn as entitySkeletonHtml, on as followJobProgress, Vn as islandNames, Rn as javImageKind, yn as matchesFaceSource, Un as mountIsland, bn as nativeImageFit, Ln as normalizeJavImage, Fn as normalizeJavLayout, In as normalizeJavPreferences, Oe as preferredDirection, hn as refreshStore, En as sidebarHasCatalogContent, On as sidebarTagCounts, mn as storeNames, zn as syncJavImages, Dn as syncSidebarSurface, Mn as tasteHistoryGuideHtml, Wn as unmountIsland, an as watchJob, vn as wireReviewSelection, Pn as wireTasteHistoryGuide };
+export { Pn as TASTE_GUIDE_KEY, En as catalogEmptyHtml, Tn as catalogSuggestions, Mn as cleanupSkeletonHtml, An as cloudLocations, jn as cloudPreferenceLocations, gn as createReviewSelection, wn as emptyCatalogLayout, Sn as entitySkeletonHtml, on as followJobProgress, Hn as islandNames, zn as javImageKind, bn as matchesFaceSource, Wn as mountIsland, xn as nativeImageFit, Rn as normalizeJavImage, In as normalizeJavLayout, Ln as normalizeJavPreferences, De as preferredDirection, hn as refreshStore, Dn as sidebarHasCatalogContent, kn as sidebarTagCounts, mn as storeNames, Bn as syncJavImages, On as syncSidebarSurface, Nn as tasteHistoryGuideHtml, Gn as unmountIsland, an as watchJob, vn as wireReviewSelection, Fn as wireTasteHistoryGuide };
diff --git a/web/index.html b/web/index.html
index a233b5f7d..6f240324f 100644
--- a/web/index.html
+++ b/web/index.html
@@ -51,7 +51,6 @@
<symbol id="i-chart" viewBox="0 0 24 24"><path d="M5 21v-6" /><path d="M12 21V3" /><path d="M19 21V9" /></symbol>
<symbol id="i-settings" viewBox="0 0 24 24"><path d="M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915" /><circle cx="12" cy="12" r="3" /></symbol>
<symbol id="i-monitor" viewBox="0 0 24 24"><rect width="20" height="14" x="2" y="3" rx="2" /><line x1="8" x2="16" y1="21" y2="21" /><line x1="12" x2="12" y1="17" y2="21" /></symbol><symbol id="i-wrench" viewBox="0 0 24 24"><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z" /></symbol><symbol id="i-folder-search" viewBox="0 0 24 24"><path d="M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1" /><path d="m21 21-1.9-1.9" /><circle cx="17" cy="17" r="3" /></symbol><symbol id="i-folder-cog" viewBox="0 0 24 24"><path d="M10.3 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.98a2 2 0 0 1 1.69.9l.66 1.2A2 2 0 0 0 12 6h8a2 2 0 0 1 2 2v3.3" /><path d="m14.305 19.53.923-.382" /><path d="m15.228 16.852-.923-.383" /><path d="m16.852 15.228-.383-.923" /><path d="m16.852 20.772-.383.924" /><path d="m19.148 15.228.383-.923" /><path d="m19.53 21.696-.382-.924" /><path d="m20.772 16.852.924-.383" /><path d="m20.772 19.148.924.383" /><circle cx="18" cy="18" r="3" /></symbol>
- <symbol id="i-ratio" viewBox="0 0 24 24"><rect width="12" height="20" x="6" y="2" rx="2" /><rect width="20" height="12" x="2" y="6" rx="2" /></symbol>
<symbol id="i-sun" viewBox="0 0 24 24"><circle cx="12" cy="12" r="4" /><path d="M12 2v2" /><path d="M12 20v2" /><path d="m4.93 4.93 1.41 1.41" /><path d="m17.66 17.66 1.41 1.41" /><path d="M2 12h2" /><path d="M20 12h2" /><path d="m6.34 17.66-1.41 1.41" /><path d="m19.07 4.93-1.41 1.41" /></symbol>
<symbol id="i-moon" viewBox="0 0 24 24"><path d="M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401" /></symbol>
<symbol id="i-gauge" viewBox="0 0 24 24"><path d="m12 14 4-4" /><path d="M3.34 19a10 10 0 1 1 17.32 0" /></symbol>