Peach: Local-first video metadata scraper and media manager.
fix: 统一采集设置控件与站点连接提示
longmeidaodef51f924e9c
diff --git a/docs/SOURCING.md b/docs/SOURCING.mdindex b17147699..249347e9f 100644--- a/docs/SOURCING.md+++ b/docs/SOURCING.md@@ -2,11 +2,11 @@## 本机采集入口-「数据管理」→「采集来源与 Cookie 设置」(`/scraping`)提供官方高清封面定点抓取和来源连接设置。+「数据管理」→「设置采集来源」(`/scraping`)提供官方高清封面定点抓取和来源连接设置。界面与 `scripts/fetch_jav_covers.py` 共用 `peach.jav_cover_fetch`;不需要把开发者的映射文件或Cookie 复制到新用户电脑。已有成功元数据快照优先,缺快照的公开来源可联网查询。-- R18、DMM、Prestige、MGStage 的封面 HTTP 路径使用按来源的环境/应用直连/指定代理配置。+- R18、DMM、Prestige、MGStage 的封面 HTTP 路径使用按来源的系统代理/应用直连/自定义代理配置。DMM 连接检查分别报告页面与高清 CDN;HTTPX 环境代理不等于系统 PAC,应用直连也不能排除 TUN。- FC2 的 Cookie 粘贴与 Netscape 文件导入复用 CredentialStore;仅保存当前来源域内未过期项目。`fetch_fc2_metadata.py` 默认读取这份配置,`--cookies` 可显式指定文件。保存不代表登录会话有效。diff --git a/docs/TESTING_DESKTOP.md b/docs/TESTING_DESKTOP.mdindex 712bde3c6..9b048e4ae 100644--- a/docs/TESTING_DESKTOP.md+++ b/docs/TESTING_DESKTOP.md@@ -17,13 +17,13 @@## 采集测试-1. 完成媒体扫描后,进入「数据管理」→「采集来源与 Cookie 设置」。-2. 高清来源可能需要代理。在对应来源选「指定代理」,填写该电脑可用的代理地址并保存;- 「环境代理」读取 Peach 启动环境,「应用直连」不使用应用代理,但仍可能经过系统隧道。-3. 点击「检查已保存的连接」。DMM 分别检查页面与高清 CDN,图片检查会显示实际像素尺寸。-4. 在「高清封面」填入馆藏番号,点击「抓取或升级封面」。任务只处理该番号;只有完整解码且+1. 完成媒体扫描后,进入「数据管理」→「设置采集来源」。+2. 高清来源可能需要代理。在对应来源选「自定义代理」,填写该电脑可用的代理地址并保存;+ 「系统代理」沿用电脑的代理设置(不支持 PAC),「应用直连」不使用应用代理。+3. 点击「检查连接」。DMM 分别检查页面与高清 CDN,图片检查会显示实际像素尺寸。+4. 在「高清封面」填入馆藏番号,点击「抓取封面」。任务只处理该番号;只有完整解码且像素面积更大的封面才替换,失败保留已有图片。相同成功结果在 24 小时内复用本机文件。-5. FC2 CLI 用户可在同页粘贴 Cookie 请求头或导入 Netscape `.txt`。凭据保存于本机,+5. FC2 CLI 用户可在同页选择「粘贴 Cookie」或「导入文件」,二选一。文件支持 Netscape `.txt`。凭据保存于本机,「已保存」不表示会话有效;撤销后该来源的登录采集需重新提供 Cookie。当前测试入口覆盖官方高清封面与 FC2 凭据配置。FC2 元数据批量采集、Javinizer-Go 的工具安装和diff --git a/frontend/src/islands/scraping.tsx b/frontend/src/islands/scraping.tsxindex 5240ebfee..8477dc4ad 100644--- a/frontend/src/islands/scraping.tsx+++ b/frontend/src/islands/scraping.tsx@@ -1,6 +1,6 @@import { useEffect, useLayoutEffect, useRef, useState } from 'preact/hooks';import { apiGet, apiSend, errorMessage } from '../api';-import { noteHtml, fieldsetTitle, setActionBusy } from '@peach/legacy/ui';+import { noteHtml, fieldsetTitle, setActionBusy, selectFieldHtml, wireSelectField } from '@peach/legacy/ui';import type { IslandState } from '../islands';import { watchJob } from '../jobs';import type { JobState } from '../jobs';@@ -14,19 +14,37 @@ export interface ScrapingProps { toast(message: string): void }interface Check { label: string; ok: boolean; status?: number; message?: string; width?: number; height?: number }export const loadScraping = (_props: ScrapingProps, signal: AbortSignal) => apiGet<ScrapingData>('/api/scraping', signal);+function NetworkSelect({ value, onChange }: { value: string; onChange(value: string): void }) {+ const mount = useRef<HTMLDivElement>(null);+ const callback = useRef(onChange);+ callback.current = onChange;+ useLayoutEffect(() => {+ const root = mount.current!;+ root.innerHTML = selectFieldHtml([['environment', '系统代理'], ['direct', '应用直连'], ['proxy', '自定义代理']],+ value, { label: '连接方式' });+ const field = wireSelectField(root.firstElementChild!);+ const change = () => callback.current(field.value);+ field.addEventListener('change', change);+ return () => { field.disabled = true; field.removeEventListener('change', change); root.replaceChildren(); };+ }, []);+ return <div ref={mount} class="scraping-network" />;+}+function SourceForm({ source, toast }: { source: Source } & ScrapingProps) {const [saved, setSaved] = useState(source);const [network, setNetwork] = useState(source.network);const [proxy, setProxy] = useState('');const [cookie, setCookie] = useState('');const [cookieText, setCookieText] = useState('');+ const [cookieMethod, setCookieMethod] = useState('paste');+ const [fileName, setFileName] = useState('');const [busy, setBusy] = useState(false);const [error, setError] = useState('');const [checks, setChecks] = useState<Check[]>([]);const file = useRef<HTMLInputElement>(null);const form = useRef<HTMLFormElement>(null);useLayoutEffect(() => {- form.current?.querySelectorAll('button').forEach(button => setActionBusy(button, busy));+ form.current?.querySelectorAll('footer button').forEach(button => setActionBusy(button, busy));}, [busy]);const lifetime = useRef(new AbortController());useEffect(() => () => lifetime.current.abort(), []);@@ -42,7 +60,7 @@ function SourceForm({ source, toast }: { source: Source } & ScrapingProps) {source: source.source, network, proxy, cookie, cookies_text: cookieText, revoke: kind === 'revoke',}, 'POST', lifetime.current.signal);if (!lifetime.current.signal.aborted) {- setSaved(result.saved); setProxy(''); setCookie(''); setCookieText('');+ setSaved(result.saved); setProxy(''); setCookie(''); setCookieText(''); setFileName('');if (file.current) file.current.value = '';toast(kind === 'revoke' ? 'Cookie 已撤销' : '来源设置已保存');}@@ -57,35 +75,46 @@ function SourceForm({ source, toast }: { source: Source } & ScrapingProps) {<form ref={form} class="cleanupfieldset" data-geist-fieldset onSubmit={event => { event.preventDefault(); void action('save'); }}><div class="geist-fieldset-content scraping-fields"><div dangerouslySetInnerHTML={{ __html: fieldsetTitle(`scraping-${source.source}`, source.label) }} />- <label>连接方式<select class="geist-input" value={network} disabled={busy} onChange={event => setNetwork(event.currentTarget.value)}>- <option value="environment">环境代理</option><option value="direct">应用直连</option><option value="proxy">指定代理</option>- </select></label>+ <a class="scraping-url" href={source.login} target="_blank" rel="noopener noreferrer">{source.login}</a>+ <div class="scraping-label">连接方式<NetworkSelect value={network} onChange={setNetwork} /></div>{network === 'proxy' && <label>代理地址<input class="geist-input" type="password" autoComplete="off" value={proxy}placeholder={saved.proxy_saved ? '已保存,留空保留' : 'http://127.0.0.1:7890'} disabled={busy}onInput={event => setProxy(event.currentTarget.value)} /></label>}{source.accepts_cookie && <>- <p><a href={source.login} target="_blank" rel="noopener noreferrer">打开官网登录</a> · {saved.cookie_saved ? 'Cookie 已保存,尚未验证会话' : '尚未提供 Cookie'}</p>- <label>Cookie 请求头<input class="geist-input" type="password" autoComplete="off" value={cookie} disabled={busy || !!cookieText}+ <p>{saved.cookie_saved ? 'Cookie 已保存,登录是否有效请在抓取时确认。' : '需要登录时,任选一种方式提供 Cookie。'}</p>+ <div class="insightswitch scraping-cookie-method" role="radiogroup" aria-label="提供 Cookie 的方式(二选一)">+ {([['paste', '粘贴 Cookie'], ['file', '导入文件']] as const).map(([value, label]) => <label key={value}>+ <input type="radio" name={`cookie-method-${source.source}`} value={value} checked={cookieMethod === value}+ onChange={() => { setCookieMethod(value); setCookie(''); setCookieText(''); setFileName(''); }} />+ <span>{label}</span>+ </label>)}+ </div>+ {cookieMethod === 'paste' ? <label>Cookie<input class="geist-input" type="password" autoComplete="off" value={cookie} disabled={busy}onInput={event => setCookie(event.currentTarget.value)} /></label>- <label>Netscape Cookie 文件<input class="geist-input" ref={file} type="file" accept=".txt" disabled={busy || !!cookie}+ : <label class="scraping-file">Netscape Cookie 文件(.txt)<span class="scraping-file-control">+ <span class="geist-button">选择文件</span><span class="scraping-file-name">{fileName || '未选择文件'}</span>+ <input ref={file} type="file" accept=".txt" disabled={busy}onChange={async event => {const selected = event.currentTarget.files?.[0];- if (!selected) { setCookieText(''); return; }+ if (!selected) { setCookieText(''); setFileName(''); return; }setCookieText('');if (selected.size > 256 * 1024) { setError('Cookie 文本超过 256 KiB'); event.currentTarget.value = ''; return; }setBusy(true);- try { const text = await selected.text(); if (!lifetime.current.signal.aborted) setCookieText(text); }+ try { const text = await selected.text(); if (!lifetime.current.signal.aborted) { setCookieText(text); setFileName(selected.name); } }catch { if (!lifetime.current.signal.aborted) setError('Cookie 文件未读取,请重新选择'); }finally { if (!lifetime.current.signal.aborted) setBusy(false); }- }} /></label>+ }} /></span></label>}</>}{error && <div role="alert" dangerouslySetInnerHTML={{ __html: noteHtml(error, { variant: 'error' }) }} />}- {checks.map(check => <p role="status" key={check.label}>{check.label}:{check.ok ? '可连接' : '未取得'}- {check.width ? ` · ${check.width} × ${check.height}` : ''}{check.message ? ` · ${check.message}` : ''}</p>)}+ {checks.map(check => <div role="status" key={check.label} dangerouslySetInnerHTML={{ __html: noteHtml(+ `${source.label}${check.label === '来源页面' ? '' : ' 高清图片'}:${check.ok ? '可连接' : '不能连接'}`+ + (check.width ? ` · ${check.width} × ${check.height}` : '')+ + (check.message ? `。${check.message}` : ''), { variant: check.ok ? 'success' : 'error' },+ ) }} />)}</div><footer class="geist-fieldset-footer" data-geist-fieldset-footer><button class="geist-button primary" type="submit">保存</button>- <button class="geist-button" type="button" onClick={() => void action('check')}>检查已保存的连接</button>+ <button class="geist-button" type="button" onClick={() => void action('check')}>检查连接</button>{source.accepts_cookie && saved.cookie_saved && <button class="geist-button" type="button" onClick={() => void action('revoke')}>撤销 Cookie</button>}</footer></form>@@ -128,15 +157,14 @@ export function Scraping({ data, error, toast }: ScrapingProps & IslandState<Scr}if (error) return <div role="alert" dangerouslySetInnerHTML={{ __html: noteHtml(error, { variant: 'error' }) }} />;return <div class="scraping-page">- <p>高清来源可能需要代理。环境代理读取服务进程的代理环境变量;应用直连仍可能经过系统隧道。</p>- <p>封面采集保留最高可得画质,失败保留已有图片。连接检查不验证登录会话。</p>+ <p>高清图片可能需要代理才能下载,请先检查连接。</p><section class="cleanupfieldset scraping-source" data-geist-fieldset><div class="geist-fieldset-content scraping-fields"><div dangerouslySetInnerHTML={{ __html: fieldsetTitle('scraping-cover', '高清封面') }} />- <form onSubmit={event => { event.preventDefault(); void fetchCover(); }}>- <label>馆藏番号<input class="geist-input" required value={code} disabled={running} placeholder="ABW-232"- onInput={event => setCode(event.currentTarget.value)} /></label>- <button ref={submit} class="geist-button primary" type="submit">抓取或升级封面</button>+ <form class="scraping-cover-form" onSubmit={event => { event.preventDefault(); void fetchCover(); }}>+ <input class="geist-input" aria-label="馆藏番号" required value={code} disabled={running} placeholder="输入馆藏番号,如 ABW-232"+ onInput={event => setCode(event.currentTarget.value)} />+ <button ref={submit} class="geist-button primary" type="submit">抓取封面</button></form>{problem && <div role="alert" dangerouslySetInnerHTML={{ __html: noteHtml(problem, { variant: 'error' }) }} />}</div>diff --git a/frontend/src/legacy/ui.d.ts b/frontend/src/legacy/ui.d.tsindex 97772cf08..294520304 100644--- a/frontend/src/legacy/ui.d.ts+++ b/frontend/src/legacy/ui.d.ts@@ -15,6 +15,10 @@ export declare function emptyStateHtml(/** Geist Fieldset 的标题:放在框体里的 h3,不用原生 legend。 */export declare function fieldsetTitle(id: string, title: string): string;+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 };+/** 用户触发的动作等待结果时的忙态:`aria-busy` 与 `aria-disabled` 一起写,控件仍可聚焦,* 重复触发由遗留层的 `wireBusyActions` 拦住。请求等待期不许改用原生 `disabled`。 */export declare function setActionBusy(control: Element | null, busy?: boolean): void;diff --git a/frontend/test/scraping.test.tsx b/frontend/test/scraping.test.tsxindex 69701bc6c..d3013a989 100644--- a/frontend/test/scraping.test.tsx+++ b/frontend/test/scraping.test.tsx@@ -3,7 +3,7 @@ import { act } from 'preact/test-utils';import { afterEach, expect, it, vi } from 'vitest';import { Scraping } from '../src/islands/scraping';-const source = { source: 'fc2cmadb', label: 'FC2 CMADB', login: 'https://fc2cmadb.com/',+const source = { source: 'fc2cmadb', label: 'FC2CMADB', login: 'https://fc2cmadb.com/',accepts_cookie: true, network: 'environment', cookie_saved: false, proxy_saved: false };let host: HTMLDivElement;afterEach(() => { if (host) render(null, host); document.body.innerHTML = ''; vi.unstubAllGlobals(); });@@ -30,7 +30,7 @@ it('保存后清空秘密输入,状态只表示保存且撤销可操作', asynsource: 'fc2cmadb', network: 'environment', proxy: '', cookie: 'session=fixture', cookies_text: '', revoke: false,} });expect(host.querySelector<HTMLInputElement>('input[type=password]')!.value).toBe('');- expect(host.textContent).toContain('尚未验证会话');+ expect(host.textContent).toContain('登录是否有效请在抓取时确认');expect(host.textContent).toContain('撤销 Cookie');expect(toast).toHaveBeenCalledWith('来源设置已保存');});@@ -44,3 +44,37 @@ it('已有后台结果不在首屏冒充新结果', async () => {expect(host.textContent).not.toContain('old result');expect(host.querySelector('input[required]')).not.toBeNull();});++it('连接结果用站点名称与共享状态组件呈现', async () => {+ let connected = true;+ vi.stubGlobal('fetch', vi.fn(async (path: string) => ({ ok: true, json: async () =>+ path.endsWith('/check') ? { results: [{ label: '来源页面', ok: connected }] } : { status: 'idle' },+ })));+ host = document.createElement('div'); document.body.append(host);+ await act(async () => render(h(Scraping, { data: { sources: [source] }, error: '', toast: vi.fn() }), host));+ const check = [...host.querySelectorAll('button')].find(button => button.textContent === '检查连接')!;+ await act(async () => { check.click(); await new Promise(resolve => setTimeout(resolve, 0)); });+ expect(host.querySelector('.geist-note-success')?.textContent).toBe('FC2CMADB:可连接');+ connected = false;+ await act(async () => { check.click(); await new Promise(resolve => setTimeout(resolve, 0)); });+ expect(host.querySelector('.geist-note-error')?.textContent).toBe('FC2CMADB:不能连接');+});++it('代理复用重绘下拉,Cookie 二选一且切换后不携带隐藏输入', async () => {+ vi.stubGlobal('fetch', vi.fn(async () => ({ ok: true, json: async () => ({ status: 'idle' }) })));+ host = document.createElement('div'); document.body.append(host);+ await act(async () => render(h(Scraping, { data: { sources: [source] }, error: '', toast: vi.fn() }), host));+ expect(host.querySelector('select')).toBeNull();+ expect(host.querySelector('.gselect [aria-haspopup=listbox]')?.textContent).toBe('系统代理');+ expect(host.querySelector('.scraping-url')?.textContent).toBe(source.login);+ expect(host.querySelector('input[type=file]')).toBeNull();+ const input = host.querySelector<HTMLInputElement>('input[type=password]')!;+ await act(async () => { input.value = 'private'; input.dispatchEvent(new Event('input', { bubbles: true })); });+ const choose = (value: string) => host.querySelector<HTMLInputElement>(`input[type=radio][value=${value}]`)!.dispatchEvent(new Event('change', { bubbles: true }));+ await act(async () => { choose('file'); });+ expect(host.querySelector('input[type=password]')).toBeNull();+ expect(host.querySelector('input[type=file]')).not.toBeNull();+ await act(async () => { choose('paste'); });+ expect(host.querySelector<HTMLInputElement>('input[type=password]')!.value).toBe('');+ expect(host.querySelector('.scraping-cover-form')?.children).toHaveLength(2);+});diff --git a/frontend/test/stubs/legacy-ui.ts b/frontend/test/stubs/legacy-ui.tsindex 81398f892..db496c9f4 100644--- a/frontend/test/stubs/legacy-ui.ts+++ b/frontend/test/stubs/legacy-ui.ts@@ -14,6 +14,13 @@ export const emptyStateHtml = (export const fieldsetTitle = (id: string, title: string): string =>`<h3 class="geist-fieldset-title" id="${id}">${title}</h3>`;+export const selectFieldHtml = (items: string[][], value: string, options: { label?: string } = {}): string =>+ `<div class="gselect" data-value="${value}"><button type="button" aria-haspopup="listbox" aria-label="${options.label}">${items.find(item => item[0] === value)?.[1]}</button></div>`;+export const wireSelectField = (root: HTMLElement) => {+ Object.defineProperty(root, 'value', { get: () => root.dataset.value });+ return root as HTMLElement & { value: string; disabled: boolean };+};+export const setActionBusy = (control: Element | null, busy = true): void => {if (!control) return;if (busy) {diff --git a/src/peach/scraping_access.py b/src/peach/scraping_access.pyindex f79cf28e5..2d55ff8f7 100644--- a/src/peach/scraping_access.py+++ b/src/peach/scraping_access.py@@ -25,7 +25,7 @@ SOURCES = {"dmm": {"label": "DMM / FANZA", "domains": ("dmm.co.jp", "dmm.com"), "login": "https://www.dmm.co.jp/"},"prestige": {"label": "Prestige", "domains": ("prestige-av.com",), "login": "https://www.prestige-av.com/"},"mgstage": {"label": "MGStage", "domains": ("mgstage.com",), "login": "https://www.mgstage.com/"},- "fc2cmadb": {"label": "FC2 CMADB", "domains": ("fc2cmadb.com",), "login": "https://fc2cmadb.com/", "cookie": True},+ "fc2cmadb": {"label": "FC2CMADB", "domains": ("fc2cmadb.com",), "login": "https://fc2cmadb.com/", "cookie": True},"instagram": {"label": "Instagram", "domains": ("instagram.com", "cdninstagram.com"), "login": "https://www.instagram.com/accounts/login/", "cookie": True},}_LOCK = threading.RLock()diff --git a/tests/test_scraping_access.py b/tests/test_scraping_access.pyindex dff783738..04de2db39 100644--- a/tests/test_scraping_access.py+++ b/tests/test_scraping_access.py@@ -26,6 +26,7 @@ class ScrapingAccessTests(unittest.TestCase):save(self.root, "fc2cmadb", {"cookie": "session=private-cookie", "network": "proxy","proxy": "http://user:[email protected]:7890"})public = q_scraping(SimpleNamespace(follow_secrets_root=self.root), {})+ self.assertEqual(next(item['label'] for item in public['sources'] if item['source'] == 'fc2cmadb'), 'FC2CMADB')self.assertNotIn("private-cookie", json.dumps(public))self.assertNotIn("private-proxy", json.dumps(public))self.assertFalse(describe(self.root / "other-user", "fc2cmadb")["cookie_saved"])diff --git a/tests/test_web_ui.py b/tests/test_web_ui.pyindex 16fbd4ac8..1cd101656 100644--- a/tests/test_web_ui.py+++ b/tests/test_web_ui.py@@ -3298,6 +3298,19 @@ class WebUiSourceTests(unittest.TestCase):"统计页只讲库里现在有多少,不该再挂对齐外部现实的面板")self.assertNotIn("resourceSyncMarkup()", stats)+ def test_scraping_uses_shared_controls_and_source_links(self):+ self.assertPageContains("'/scraping':'采集来源'")+ self.assertPageContains('data-cleanup-open="scraping"')+ self.assertPageContains('.scraping-fields .gselectfield{justify-content:space-between;padding-right:16px;')+ self.assertPageContains('.scraping-fields .scraping-url{text-decoration:none;')+ self.assertPageContains('.scraping-fields .scraping-url:hover{color:var(--ink);text-decoration:none}')+ self.assertPageContains('.scraping-fields .scraping-cover-form{display:flex;align-items:center;')+ source = (Path(__file__).resolve().parents[1] / 'frontend/src/islands/scraping.tsx').read_text(encoding='utf-8')+ self.assertIn('wireSelectField(root.firstElementChild!)', source)+ self.assertNotIn('<select', source)+ self.assertIn('提供 Cookie 的方式(二选一)', source)+ self.assertIn('class="scraping-url" href={source.login}', source)+def test_data_management_subpages_carry_geist_breadcrumbs(self):"""数据管理五张卡进的是它的子页,得有回去的路和自己的名字。diff --git a/web/app.js b/web/app.jsindex 19acbb567..1e410ec18 100644--- a/web/app.js+++ b/web/app.js@@ -3355,7 +3355,12 @@ async function openDataCleanup(push=true){const junkBreakdown=[...JUNK_KIND_OPTIONS.filter(([key])=>key&&Number(junkCounts[key])>0).map(([key,label])=>`${esc(label)} ${Number(junkCounts[key]).toLocaleString()}`),...(Number(junk.dismissed_total)>0?[`已忽略 ${Number(junk.dismissed_total).toLocaleString()}`]:[])].join(' · ');- $('#stats').innerHTML=`<div class="cleanuppage"><p><a href="/scraping">采集来源与 Cookie 设置</a></p><div class="cleanupgrid">+ $('#stats').innerHTML=`<div class="cleanuppage"><div class="cleanupgrid">+ <section class="cleanupfieldset" data-geist-fieldset aria-labelledby="cleanupScrapingTitle">+ <div class="geist-fieldset-content">${fieldsetTitle('cleanupScrapingTitle','采集来源')}+ <p>下载高清封面,设置代理和 Cookie。</p></div>+ <footer class="geist-fieldset-footer" data-geist-fieldset-footer><button type="button" data-cleanup-open="scraping">设置采集来源</button></footer>+ </section><section class="cleanupfieldset" data-geist-fieldset aria-labelledby="cleanupJunkTitle"><div class="geist-fieldset-content">${fieldsetTitle('cleanupJunkTitle','垃圾文件')}<strong>${Number(junk.pending_total||0).toLocaleString()} 个待判断</strong>@@ -3387,6 +3392,7 @@ async function openDataCleanup(push=true){${linkManagerMarkup()}${resourceSyncMarkup()}</div>`;$('#stats').querySelector('[data-cleanup-open="junk"]').onclick=()=>openManage('ads');+ $('#stats').querySelector('[data-cleanup-open="scraping"]').onclick=()=>openScraping();$('#stats').querySelector('[data-cleanup-open="duplicates"]').onclick=()=>openDuplicates();$('#stats').querySelectorAll('[data-cleanup-go]').forEach(button=>button.onclick=()=>openManage(button.dataset.cleanupGo));@@ -6497,6 +6503,7 @@ const MANAGE_CRUMB_PAGES={'/review':'人工复核','/trash':'回收站','/quality-goals':'高清版',+ '/scraping':'采集来源',};function paintManageTitle(){const current=manageSection(),el=$('#manageTitle');diff --git a/web/css/04-manage.css b/web/css/04-manage.cssindex 263a53b96..6e389773c 100644--- a/web/css/04-manage.css+++ b/web/css/04-manage.css@@ -78,13 +78,28 @@.stats h2{margin:0 0 4px;font-size:var(--fs-2xl)}.stats .sub{color:var(--muted);margin:0}/* 采集来源表单复用管理页 Fieldset。 */-.scraping-page{max-width:960px;margin:0 auto;display:grid;gap:16px}+.scraping-page{width:min(812px,100%);margin:0 auto;display:grid;gap:16px}.scraping-page>h1,.scraping-page p{margin:0}-.scraping-fields form{display:grid;gap:12px;justify-items:start}-.scraping-fields form label{width:100%}+.scraping-fields .scraping-cover-form{display:flex;align-items:center;gap:8px;min-width:0}+.scraping-cover-form>input{flex:1}+.scraping-cover-form>button{height:var(--control-h);white-space:nowrap}.scraping-fields{padding:20px;display:grid;gap:16px;min-width:0}-.scraping-fields label{display:grid;gap:8px;min-width:0}-.scraping-fields input,.scraping-fields select{width:100%;min-width:0;min-height:var(--control-h);box-sizing:border-box}+.scraping-fields label,.scraping-label{display:grid;gap:8px;min-width:0}+.scraping-fields input:not([type=radio]):not([type=file]){width:100%;min-width:0;min-height:var(--control-h);box-sizing:border-box}+.scraping-fields .scraping-url{text-decoration:none;color:var(--muted);overflow-wrap:anywhere;margin-top:-12px;font-size:var(--fs-md)}+.scraping-fields .scraping-url:hover{color:var(--ink);text-decoration:none}+.scraping-network,.scraping-network .gselect{width:100%;min-width:0}+.scraping-fields .gselectfield{justify-content:space-between;padding-right:16px;border-color:var(--field-ring)}+.scraping-fields .gselectmenu button{border:0;justify-content:flex-start;padding:0 8px;background:transparent}+.scraping-fields .gselectmenu button:hover,.scraping-fields .gselectmenu button[aria-selected=true]{background:var(--hover)}+.scraping-cookie-method{justify-self:start}+.scraping-cookie-method label{display:block}+.scraping-cookie-method input:checked+span{font-weight:400}+.scraping-file-control{position:relative;display:flex;align-items:center;gap:12px;min-width:0;min-height:var(--control-h)}+.scraping-file-control>.geist-button{flex:none;height:var(--control-h)}+.scraping-file-name{min-width:0;overflow-wrap:anywhere;color:var(--muted)}+.scraping-file-control>input{position:absolute;inset:0;opacity:0;width:100%;height:100%;cursor:pointer}+.scraping-file-control:focus-within{outline:2px solid var(--tungsten);outline-offset:2px;border-radius:var(--control-radius)}.scraping-source{min-width:0}-.scraping-source .geist-fieldset-footer{display:flex;gap:8px;flex-wrap:wrap;height:auto;min-height:52px;padding:12px 16px}-@media(max-width:600px){.scraping-page{--control-h:44px}.scraping-source button{min-height:44px}.scraping-fields{padding:16px}}+.scraping-source .geist-fieldset-footer{flex-wrap:wrap}+@media(max-width:600px){.scraping-page{--control-h:44px}.scraping-source button{min-height:44px}.scraping-cookie-method span{height:44px}}diff --git a/web/dist/peach-ui.js b/web/dist/peach-ui.jsindex 4a1e8d3ea..022e3c569 100644--- a/web/dist/peach-ui.js+++ b/web/dist/peach-ui.js@@ -1,21 +1,21 @@-import { emptyStateHtml as e, fieldsetTitle as t, noteHtml as n, setActionBusy as r } from "/js/ui-components.js";-import { LOC as i, fmtDur as a, fmtSize as o } from "/js/core.js";+import { emptyStateHtml as e, fieldsetTitle as t, noteHtml as n, selectFieldHtml as r, setActionBusy as i, wireSelectField as a } from "/js/ui-components.js";+import { LOC as o, fmtDur as s, fmtSize as c } from "/js/core.js";//#region node_modules/preact/dist/preact.module.js-var s, c, l, u, d, f, p, m, h, g, _, v, y, b, x, S = {}, C = [], w = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, T = Array.isArray;-function E(e, t) {+var l, u, d, f, p, m, h, g, _, v, y, b, x, S, C, w = {}, T = [], E = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, D = Array.isArray;+function O(e, t) {for (var n in t) e[n] = t[n];return e;}function ee(e) {e && e.parentNode && e.parentNode.removeChild(e);}-function D(e, t, n) {+function k(e, t, n) {var r, i, a, o = {};for (a in t) a == "key" ? r = t[a] : a == "ref" ? i = t[a] : o[a] = t[a];- if (arguments.length > 2 && (o.children = arguments.length > 3 ? s.call(arguments, 2) : n), typeof e == "function" && e.defaultProps != null) for (a in e.defaultProps) o[a] === void 0 && (o[a] = e.defaultProps[a]);- return O(e, o, r, i, null);+ if (arguments.length > 2 && (o.children = arguments.length > 3 ? l.call(arguments, 2) : n), typeof e == "function" && e.defaultProps != null) for (a in e.defaultProps) o[a] === void 0 && (o[a] = e.defaultProps[a]);+ return A(e, o, r, i, null);}-function O(e, t, n, r, i) {+function A(e, t, n, r, i) {var a = {type: e,props: t,@@ -27,68 +27,68 @@ function O(e, t, n, r, i) {__e: null,__c: null,constructor: void 0,- __v: i ?? ++l,+ __v: i ?? ++d,__i: -1,__u: 0};- return i == null && c.vnode != null && c.vnode(a), a;+ return i == null && u.vnode != null && u.vnode(a), a;}-function k(e) {+function j(e) {return e.children;}-function A(e, t) {+function M(e, t) {this.props = e, this.context = t;}-function j(e, t) {- if (t == null) return e.__ ? j(e.__, e.__i + 1) : null;+function N(e, t) {+ if (t == null) return e.__ ? N(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" ? j(e) : null;+ return typeof e.type == "function" ? N(e) : null;}function te(e) {if (e.__P && e.__d) {- var t = e.__v, n = t.__e, r = [], i = [], a = E({}, t);- a.__v = t.__v + 1, c.vnode && c.vnode(a), de(e.__P, a, t, e.__n, e.__P.namespaceURI, 32 & t.__u ? [n] : null, r, n ?? j(t), !!(32 & t.__u), i), a.__v = t.__v, a.__.__k[a.__i] = a, pe(r, a, i), t.__e = t.__ = null, a.__e != n && M(a);+ var t = e.__v, n = t.__e, r = [], i = [], a = O({}, t);+ a.__v = t.__v + 1, u.vnode && u.vnode(a), fe(e.__P, a, t, e.__n, e.__P.namespaceURI, 32 & t.__u ? [n] : null, r, n ?? N(t), !!(32 & t.__u), i), a.__v = t.__v, a.__.__k[a.__i] = a, me(r, a, i), t.__e = t.__ = null, a.__e != n && ne(a);}}-function M(e) {+function ne(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;- }), M(e);+ }), ne(e);}-function ne(e) {- (!e.__d && (e.__d = !0) && d.push(e) && !re.__r++ || f != c.debounceRendering) && ((f = c.debounceRendering) || p)(re);+function re(e) {+ (!e.__d && (e.__d = !0) && p.push(e) && !ie.__r++ || m != u.debounceRendering) && ((m = u.debounceRendering) || h)(ie);}-function re() {+function ie() {try {- for (var e, t = 1; d.length;) d.length > t && d.sort(m), e = d.shift(), t = d.length, te(e);+ for (var e, t = 1; p.length;) p.length > t && p.sort(g), e = p.shift(), t = p.length, te(e);} finally {- d.length = re.__r = 0;+ p.length = ie.__r = 0;}}-function ie(e, t, n, r, i, a, o, s, c, l, u) {- var d, f, p, m, h, g, _ = r && r.__k || C, v = t.length;- for (c = ae(n, t, _, c, v), d = 0; d < v; d++) (p = n.__k[d]) != null && (f = p.__i != -1 && _[p.__i] || S, p.__i = d, g = de(e, p, f, i, a, o, s, c, l, u), m = p.__e, p.ref && f.ref != p.ref && (f.ref && ge(f.ref, null, p), u.push(p.ref, p.__c || m, p)), h == null && m != null && (h = m), 4 & p.__u ? (c = oe(p, c, e), f.__e && (f.__e = null)) : typeof p.type == "function" && g !== void 0 ? c = g : m && (c = m.nextSibling), p.__u &= -7);+function ae(e, t, n, r, i, a, o, s, c, l, u) {+ var d, f, p, m, h, g, _ = r && r.__k || T, v = t.length;+ for (c = oe(n, t, _, c, v), d = 0; d < v; d++) (p = n.__k[d]) != null && (f = p.__i != -1 && _[p.__i] || w, p.__i = d, g = fe(e, p, f, i, a, o, s, c, l, u), m = p.__e, p.ref && f.ref != p.ref && (f.ref && _e(f.ref, null, p), u.push(p.ref, p.__c || m, p)), h == null && m != null && (h = m), 4 & p.__u ? (c = se(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 ae(e, t, n, r, i) {+function oe(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] = O(null, o, null, null, null) : T(o) ? o = e.__k[a] = O(k, { children: o }, null, null, null) : o.constructor === void 0 && o.__b > 0 ? o = e.__k[a] = O(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 = se(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 = j(s)), _e(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] = A(null, o, null, null, null) : D(o) ? o = e.__k[a] = A(j, { children: o }, null, null, null) : o.constructor === void 0 && o.__b > 0 ? o = e.__k[a] = A(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 = ce(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 = N(s)), ve(s, s));return r;}-function oe(e, t, n) {+function se(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 = oe(r[i], t, n));+ for (r = e.__k, i = 0; r && i < r.length; i++) r[i] && (r[i].__ = e, t = se(r[i], t, n));return t;}- e.__e != t && (t && e.type && !t.parentNode && (t = j(e)), t = n.insertBefore(e.__e, t || null));+ e.__e != t && (t && e.type && !t.parentNode && (t = N(e)), t = n.insertBefore(e.__e, t || null));dot &&= t.nextSibling;while (t != null && t.nodeType == 8);return t;}-function se(e, t, n, r) {+function ce(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,18 +96,18 @@ function se(e, t, n, r) {}return -1;}-function ce(e, t, n) {- t[0] == "-" ? e.setProperty(t, n ?? "") : e[t] = n == null ? "" : typeof n != "number" || w.test(t) ? n : n + "px";+function le(e, t, n) {+ t[0] == "-" ? e.setProperty(t, n ?? "") : e[t] = n == null ? "" : typeof n != "number" || E.test(t) ? n : n + "px";}-function le(e, t, n, r, i) {+function ue(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 || ce(e.style, t, "");- if (n) for (t in n) r && n[t] == r[t] || ce(e.style, t, n[t]);+ if (typeof r == "string" && (e.style.cssText = r = ""), r) for (t in r) n && t in n || le(e.style, t, "");+ if (n) for (t in n) r && n[t] == r[t] || le(e.style, t, n[t]);}- } else if (t[0] == "o" && t[1] == "n") a = t != (t = t.replace(v, "$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[_] = r[_] : (n[_] = y, e.addEventListener(t, a ? x : b, a)) : e.removeEventListener(t, a ? x : b, a);+ } else if (t[0] == "o" && t[1] == "n") a = t != (t = t.replace(b, "$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[y] = r[y] : (n[y] = x, e.addEventListener(t, a ? C : S, a)) : e.removeEventListener(t, a ? C : S, a);else {if (i == "http://www.w3.org/2000/svg") t = t.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");else if (t != "width" && t != "height" && t != "href" && t != "list" && t != "form" && t != "tabIndex" && t != "download" && t != "rowSpan" && t != "colSpan" && t != "role" && t != "popover" && t in e) try {@@ -117,72 +117,72 @@ function le(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 ue(e) {+function de(e) {return function(t) {if (this.l) {var n = this.l[t.type + e];- if (t[g] == null) t[g] = y++;- else if (t[g] < n[_]) return;- return n(c.event ? c.event(t) : t);+ if (t[v] == null) t[v] = x++;+ else if (t[v] < n[y]) return;+ return n(u.event ? u.event(t) : t);}};}-function de(e, t, n, r, i, a, o, s, l, u) {- var d, f, p, m, h, g, _, v, y, b, x, S, w, D, O, te, M = t.type;+function fe(e, t, n, r, i, a, o, s, c, l) {+ var d, f, p, m, h, g, _, v, y, b, x, S, C, w, E, k, A = t.type;if (t.constructor !== void 0) return null;- 128 & n.__u && (l = !!(32 & n.__u), a = [s = t.__e = n.__e]), (d = c.__b) && d(t);- n: if (typeof M == "function") {+ 128 & n.__u && (c = !!(32 & n.__u), a = [s = t.__e = n.__e]), (d = u.__b) && d(t);+ n: if (typeof A == "function") {f = o.length;try {- if (y = t.props, b = M.prototype && M.prototype.render, x = (d = M.contextType) && r[d.__c], S = d ? x ? x.props.value : d.__ : r, n.__c ? v = (p = t.__c = n.__c).__ = p.__E : (b ? t.__c = p = new M(y, S) : (t.__c = p = new A(y, S), p.constructor = M, p.render = ve), x && x.sub(p), p.state || (p.state = {}), p.__n = r, m = p.__d = !0, p.__h = [], p._sb = []), b && p.__s == null && (p.__s = p.state), b && M.getDerivedStateFromProps != null && (p.__s == p.state && (p.__s = E({}, p.__s)), E(p.__s, M.getDerivedStateFromProps(y, p.__s))), h = p.props, g = p.state, p.__v = t, m) b && M.getDerivedStateFromProps == null && p.componentWillMount != null && p.componentWillMount(), b && p.componentDidMount != null && p.__h.push(p.componentDidMount);+ if (y = t.props, b = A.prototype && A.prototype.render, x = (d = A.contextType) && r[d.__c], S = d ? x ? x.props.value : d.__ : r, n.__c ? v = (p = t.__c = n.__c).__ = p.__E : (b ? t.__c = p = new A(y, S) : (t.__c = p = new M(y, S), p.constructor = A, p.render = ye), x && x.sub(p), p.state || (p.state = {}), p.__n = r, m = p.__d = !0, p.__h = [], p._sb = []), b && p.__s == null && (p.__s = p.state), b && A.getDerivedStateFromProps != null && (p.__s == p.state && (p.__s = O({}, p.__s)), O(p.__s, A.getDerivedStateFromProps(y, p.__s))), h = p.props, g = p.state, p.__v = t, m) b && A.getDerivedStateFromProps == null && p.componentWillMount != null && p.componentWillMount(), b && p.componentDidMount != null && p.__h.push(p.componentDidMount);else {- if (b && M.getDerivedStateFromProps == null && y !== h && p.componentWillReceiveProps != null && p.componentWillReceiveProps(y, S), t.__v == n.__v || !p.__e && p.shouldComponentUpdate != null && !1 === p.shouldComponentUpdate(y, p.__s, S)) {+ if (b && A.getDerivedStateFromProps == null && y !== h && p.componentWillReceiveProps != null && p.componentWillReceiveProps(y, S), t.__v == n.__v || !p.__e && p.shouldComponentUpdate != null && !1 === p.shouldComponentUpdate(y, p.__s, S)) {t.__v != n.__v && (p.props = y, p.state = p.__s, p.__d = !1), t.__e = n.__e, t.__k = n.__k, t.__k.some(function(e) {e && (e.__ = t);- }), C.push.apply(p.__h, p._sb), p._sb = [], p.__h.length && o.push(p), s = j(n);+ }), T.push.apply(p.__h, p._sb), p._sb = [], p.__h.length && o.push(p), s = N(n);break n;}p.componentWillUpdate != null && p.componentWillUpdate(y, p.__s, S), b && p.componentDidUpdate != null && p.__h.push(function() {p.componentDidUpdate(h, g, _);});}- if (p.context = S, p.props = y, p.__P = e, p.__e = !1, w = c.__r, D = 0, b) p.state = p.__s, p.__d = !1, w && w(t), d = p.render(p.props, p.state, p.context), C.push.apply(p.__h, p._sb), p._sb = [];+ if (p.context = S, p.props = y, p.__P = e, p.__e = !1, C = u.__r, w = 0, b) p.state = p.__s, p.__d = !1, C && C(t), d = p.render(p.props, p.state, p.context), T.push.apply(p.__h, p._sb), p._sb = [];else do- p.__d = !1, w && w(t), d = p.render(p.props, p.state, p.context), p.state = p.__s;- while (p.__d && ++D < 25);- p.state = p.__s, p.getChildContext != null && (r = E(E({}, r), p.getChildContext())), b && !m && p.getSnapshotBeforeUpdate != null && (_ = p.getSnapshotBeforeUpdate(h, g)), O = d != null && d.type === k && d.key == null ? me(d.props.children) : d, s = ie(e, T(O) ? O : [O], t, n, r, i, a, o, s, l, u), p.base = t.__e, t.__u &= -161, p.__h.length && o.push(p), v && (p.__E = p.__ = null);+ p.__d = !1, C && C(t), d = p.render(p.props, p.state, p.context), p.state = p.__s;+ while (p.__d && ++w < 25);+ p.state = p.__s, p.getChildContext != null && (r = O(O({}, r), p.getChildContext())), b && !m && p.getSnapshotBeforeUpdate != null && (_ = p.getSnapshotBeforeUpdate(h, g)), E = d != null && d.type === j && d.key == null ? he(d.props.children) : d, s = ae(e, D(E) ? E : [E], t, n, r, i, a, o, s, c, l), p.base = t.__e, t.__u &= -161, p.__h.length && o.push(p), v && (p.__E = p.__ = null);} catch (e) {- if (o.length = f, t.__v = null, l || a != null) {+ if (o.length = f, t.__v = null, c || a != null) {if (e.then) {- for (t.__u |= l ? 160 : 128; s && s.nodeType == 8 && s.nextSibling;) s = s.nextSibling;+ for (t.__u |= c ? 160 : 128; s && s.nodeType == 8 && s.nextSibling;) s = s.nextSibling;a != null && (a[a.indexOf(s)] = null), t.__e = s;- } else if (a != null) for (te = a.length; te--;) ee(a[te]);+ } else if (a != null) for (k = a.length; k--;) ee(a[k]);} else t.__e = n.__e;- t.__k ??= n.__k || [], e.then || fe(t), c.__e(e, t, n);+ t.__k ??= n.__k || [], e.then || pe(t), u.__e(e, t, n);}- } else a == null && t.__v == n.__v ? (t.__k = n.__k, t.__e = n.__e) : s = t.__e = he(n.__e, t, n, r, i, a, o, l, u);- return (d = c.diffed) && d(t), 128 & t.__u ? void 0 : s;+ } else a == null && t.__v == n.__v ? (t.__k = n.__k, t.__e = n.__e) : s = t.__e = ge(n.__e, t, n, r, i, a, o, c, l);+ return (d = u.diffed) && d(t), 128 & t.__u ? void 0 : s;}-function fe(e) {- e && (e.__c && (e.__c.__e = !0), e.__k && e.__k.some(fe));+function pe(e) {+ e && (e.__c && (e.__c.__e = !0), e.__k && e.__k.some(pe));}-function pe(e, t, n) {- for (var r = 0; r < n.length; r++) ge(n[r], n[++r], n[++r]);- c.__c && c.__c(t, e), e.some(function(t) {+function me(e, t, n) {+ for (var r = 0; r < n.length; r++) _e(n[r], n[++r], n[++r]);+ u.__c && u.__c(t, e), e.some(function(t) {try {e = t.__h, t.__h = [], e.some(function(e) {e.call(t);});} catch (e) {- c.__e(e, t.__v);+ u.__e(e, t.__v);}});}-function me(e) {- return typeof e != "object" || !e || e.__b > 0 ? e : T(e) ? e.map(me) : e.constructor === void 0 ? E({}, e) : null;+function he(e) {+ return typeof e != "object" || !e || e.__b > 0 ? e : D(e) ? e.map(he) : e.constructor === void 0 ? O({}, e) : null;}-function he(e, t, n, r, i, a, o, l, u) {- var d, f, p, m, h, g, _, v = n.props || S, y = t.props, b = t.type;+function ge(e, t, n, r, i, a, o, s, c) {+ var d, f, p, m, h, g, _, v = n.props || w, 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 (d = 0; d < a.length; d++) if ((h = a[d]) && "setAttribute" in h == !!b && (b ? h.localName == b : h.nodeType == 3)) {e = h, a[d] = null;@@ -191,75 +191,75 @@ function he(e, t, n, r, i, a, o, l, u) {}if (e == null) {if (b == null) return document.createTextNode(y);- e = document.createElementNS(i, b, y.is && y), l &&= (c.__m && c.__m(t, a), !1), a = null;+ e = document.createElementNS(i, b, y.is && y), s &&= (u.__m && u.__m(t, a), !1), a = null;}- if (b == null) v === y || l && e.data == y || (e.data = y);+ if (b == null) v === y || s && e.data == y || (e.data = y);else {- if (a = b == "textarea" && y.defaultValue != null ? null : a && s.call(e.childNodes), !l && a != null) for (v = {}, d = 0; d < e.attributes.length; d++) v[(h = e.attributes[d]).name] = h.value;- for (d in v) h = v[d], d == "dangerouslySetInnerHTML" ? p = h : d == "children" || d in y || d == "value" && "defaultValue" in y || d == "checked" && "defaultChecked" in y || le(e, d, null, h, i);- for (d in y) h = y[d], d == "children" ? m = h : d == "dangerouslySetInnerHTML" ? f = h : d == "value" ? g = h : d == "checked" ? _ = h : l && typeof h != "function" || v[d] === h || le(e, d, h, v[d], i);- if (f) l || p && (f.__html == p.__html || f.__html == e.innerHTML) || (e.innerHTML = f.__html), t.__k = [];- else if (p && (e.innerHTML = ""), ie(t.type == "template" ? e.content : e, T(m) ? m : [m], t, n, r, b == "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, a, o, a ? a[0] : n.__k && j(n, 0), l, u), a != null) for (d = a.length; d--;) ee(a[d]);- l && b != "textarea" || (d = "value", b == "progress" && g == null ? e.removeAttribute("value") : g != null && (g !== e[d] || b == "progress" && !g || b == "option" && g != v[d]) && le(e, d, g, v[d], i), d = "checked", _ != null && _ != e[d] && le(e, d, _, v[d], i));+ if (a = b == "textarea" && y.defaultValue != null ? null : a && l.call(e.childNodes), !s && a != null) for (v = {}, d = 0; d < e.attributes.length; d++) v[(h = e.attributes[d]).name] = h.value;+ for (d in v) h = v[d], d == "dangerouslySetInnerHTML" ? p = h : d == "children" || d in y || d == "value" && "defaultValue" in y || d == "checked" && "defaultChecked" in y || ue(e, d, null, h, i);+ for (d in y) h = y[d], d == "children" ? m = h : d == "dangerouslySetInnerHTML" ? f = h : d == "value" ? g = h : d == "checked" ? _ = h : s && typeof h != "function" || v[d] === h || ue(e, d, h, v[d], i);+ if (f) s || p && (f.__html == p.__html || f.__html == e.innerHTML) || (e.innerHTML = f.__html), t.__k = [];+ else if (p && (e.innerHTML = ""), ae(t.type == "template" ? e.content : e, D(m) ? m : [m], t, n, r, b == "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, a, o, a ? a[0] : n.__k && N(n, 0), s, c), a != null) for (d = a.length; d--;) ee(a[d]);+ s && b != "textarea" || (d = "value", b == "progress" && g == null ? e.removeAttribute("value") : g != null && (g !== e[d] || b == "progress" && !g || b == "option" && g != v[d]) && ue(e, d, g, v[d], i), d = "checked", _ != null && _ != e[d] && ue(e, d, _, v[d], i));}return e;}-function ge(e, t, n) {+function _e(e, t, n) {try {if (typeof e == "function") {var r = typeof e.__u == "function";r && e.__u(), r && t == null || (e.__u = e(t));} else e.current = t;} catch (e) {- c.__e(e, n);+ u.__e(e, n);}}-function _e(e, t, n) {+function ve(e, t, n) {var r, i;- if (c.unmount && c.unmount(e), (r = e.ref) && (r.current && r.current != e.__e || ge(r, null, t)), (r = e.__c) != null) {+ if (u.unmount && u.unmount(e), (r = e.ref) && (r.current && r.current != e.__e || _e(r, null, t)), (r = e.__c) != null) {if (r.componentWillUnmount) try {r.componentWillUnmount();} catch (e) {- c.__e(e, t);+ u.__e(e, t);}r.base = r.__P = r.__n = null;}- if (r = e.__k) for (i = 0; i < r.length; i++) r[i] && _e(r[i], t, n || typeof e.type != "function");+ if (r = e.__k) for (i = 0; i < r.length; i++) r[i] && ve(r[i], t, n || typeof e.type != "function");n || ee(e.__e), e.__c = e.__ = e.__e = void 0;}-function ve(e, t, n) {+function ye(e, t, n) {return this.constructor(e, n);}-function ye(e, t, n) {+function be(e, t, n) {var r, i, a, o;- t == document && (t = document.documentElement), c.__ && c.__(e, t), i = (r = typeof n == "function") ? null : n && n.__k || t.__k, a = [], o = [], de(t, e = (!r && n || t).__k = D(k, null, [e]), i || S, S, t.namespaceURI, !r && n ? [n] : i ? null : t.firstChild ? s.call(t.childNodes) : null, a, !r && n ? n : i ? i.__e : t.firstChild, r, o), pe(a, e, o), e.props.children = null;+ t == document && (t = document.documentElement), u.__ && u.__(e, t), i = (r = typeof n == "function") ? null : n && n.__k || t.__k, a = [], o = [], fe(t, e = (!r && n || t).__k = k(j, null, [e]), i || w, w, t.namespaceURI, !r && n ? [n] : i ? null : t.firstChild ? l.call(t.childNodes) : null, a, !r && n ? n : i ? i.__e : t.firstChild, r, o), me(a, e, o), e.props.children = null;}-s = C.slice, c = { __e: function(e, t, n, r) {+l = T.slice, u = { __e: function(e, t, n, r) {for (var i, a, o; t = t.__;) if ((i = t.__c) && !i.__) try {if ((a = i.constructor) && a.getDerivedStateFromError != null && (i.setState(a.getDerivedStateFromError(e)), o = i.__d), i.componentDidCatch != null && (i.componentDidCatch(e, r || {}), o = i.__d), o) return i.__E = i;} catch (t) {e = t;}throw e;-} }, l = 0, u = function(e) {+} }, d = 0, f = function(e) {return e != null && e.constructor === void 0;-}, A.prototype.setState = function(e, t) {- var n = this.__s != null && this.__s != this.state ? this.__s : this.__s = E({}, this.state);- typeof e == "function" && (e = e(E({}, n), this.props)), e && E(n, e), e != null && this.__v && (t && this._sb.push(t), ne(this));-}, A.prototype.forceUpdate = function(e) {- this.__v && (this.__e = !0, e && this.__h.push(e), ne(this));-}, A.prototype.render = k, d = [], p = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, m = function(e, t) {+}, M.prototype.setState = function(e, t) {+ var n = this.__s != null && this.__s != this.state ? this.__s : this.__s = O({}, this.state);+ typeof e == "function" && (e = e(O({}, n), this.props)), e && O(n, e), e != null && this.__v && (t && this._sb.push(t), re(this));+}, M.prototype.forceUpdate = function(e) {+ this.__v && (this.__e = !0, e && this.__h.push(e), re(this));+}, M.prototype.render = j, p = [], h = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, g = function(e, t) {return e.__v.__b - t.__v.__b;-}, re.__r = 0, h = Math.random().toString(8), g = "__d" + h, _ = "__a" + h, v = /(PointerCapture)$|Capture$/i, y = 0, b = ue(!1), x = ue(!0);+}, ie.__r = 0, _ = Math.random().toString(8), v = "__d" + _, y = "__a" + _, b = /(PointerCapture)$|Capture$/i, x = 0, S = de(!1), C = de(!0);//#endregion//#region src/api.ts-var be = class extends Error {+var xe = class extends Error {status;body;constructor(e, t, n = null) {super(e), this.name = "ApiError", this.status = t, this.body = n;}-}, xe = (e) => {+}, Se = (e) => {if (!e || typeof e != "object") return "";let t = e;for (let e of [@@ -271,8 +271,8 @@ var be = class extends Error {if (typeof n == "string" && n) return n;}return "";-}, N = (e) => e instanceof Error ? e.message : String(e);-async function Se(e, t) {+}, P = (e) => e instanceof Error ? e.message : String(e);+async function Ce(e, t) {let n = await fetch(e, {headers: { Accept: "application/json" },credentials: "same-origin",@@ -281,10 +281,10 @@ async function Se(e, t) {try {r = await n.json();} catch {}- if (!n.ok) throw new be(xe(r) || `请求失败(${n.status})`, n.status);+ if (!n.ok) throw new xe(Se(r) || `请求失败(${n.status})`, n.status);return r;}-async function P(e, t, n = "POST", r) {+async function F(e, t, n = "POST", r) {let i = await fetch(e, {method: n,...r ? { signal: r } : {},@@ -298,29 +298,29 @@ async function P(e, t, n = "POST", r) {try {a = await i.json();} catch {}- if (!i.ok) throw new be(xe(a) || `请求失败(${i.status})`, i.status, a);+ if (!i.ok) throw new xe(Se(a) || `请求失败(${i.status})`, i.status, a);return a;}//#endregion//#region node_modules/preact/hooks/dist/hooks.module.js-var F, I, Ce, we, Te = 0, Ee = [], L = c, De = L.__b, Oe = L.__r, ke = L.diffed, Ae = L.__c, je = L.unmount, Me = L.__;-function Ne(e, t) {- L.__h && L.__h(I, e, Te || t), Te = 0;- var n = I.__H || (I.__H = {+var I, L, we, Te, Ee = 0, De = [], R = u, Oe = R.__b, ke = R.__r, Ae = R.diffed, je = R.__c, Me = R.unmount, Ne = R.__;+function Pe(e, t) {+ R.__h && R.__h(L, e, Ee || t), Ee = 0;+ var n = L.__H || (L.__H = {__: [],__h: []});return e >= n.__.length && n.__.push({}), n.__[e];}-function R(e) {- return Te = 1, Pe(We, e);+function z(e) {+ return Ee = 1, Fe(Ge, e);}-function Pe(e, t, n) {- var r = Ne(F++, 2);- if (r.t = e, !r.__c && (r.__ = [n ? n(t) : We(void 0, t), function(e) {+function Fe(e, t, n) {+ var r = Pe(I++, 2);+ if (r.t = e, !r.__c && (r.__ = [n ? n(t) : Ge(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 = I, !I.__f)) {+ }], r.__c = L, !L.__f)) {var i = function(e, t, n) {if (!r.__c.__H) return !0;var i = !1, o = r.__c.props !== e;@@ -336,118 +336,118 @@ function Pe(e, t, n) {}return !i || o;};- I.__f = !0;- var a = I.shouldComponentUpdate, o = I.componentWillUpdate;- I.componentWillUpdate = function(e, t, n) {+ L.__f = !0;+ var a = L.shouldComponentUpdate, o = L.componentWillUpdate;+ L.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);- }, I.shouldComponentUpdate = i;+ }, L.shouldComponentUpdate = i;}return r.__N || r.__;}-function Fe(e, t) {- var n = Ne(F++, 3);- !L.__s && Ue(n.__H, t) && (n.__ = e, n.u = t, I.__H.__h.push(n));-}function Ie(e, t) {- var n = Ne(F++, 4);- !L.__s && Ue(n.__H, t) && (n.__ = e, n.u = t, I.__h.push(n));+ var n = Pe(I++, 3);+ !R.__s && We(n.__H, t) && (n.__ = e, n.u = t, L.__H.__h.push(n));}-function z(e) {- return Te = 5, Le(function() {+function Le(e, t) {+ var n = Pe(I++, 4);+ !R.__s && We(n.__H, t) && (n.__ = e, n.u = t, L.__h.push(n));+}+function B(e) {+ return Ee = 5, Re(function() {return { current: e };}, []);}-function Le(e, t) {- var n = Ne(F++, 7);- return Ue(n.__H, t) && (n.__ = e(), n.__H = t, n.__h = e), n.__;+function Re(e, t) {+ var n = Pe(I++, 7);+ return We(n.__H, t) && (n.__ = e(), n.__H = t, n.__h = e), n.__;}-function Re() {- for (var e; e = Ee.shift();) {+function ze() {+ for (var e; e = De.shift();) {var t = e.__H;if (e.__P && t) try {- t.__h.some(Ve), t.__h.some(He), t.__h = [];+ t.__h.some(He), t.__h.some(Ue), t.__h = [];} catch (n) {- t.__h = [], L.__e(n, e.__v);+ t.__h = [], R.__e(n, e.__v);}}}-L.__b = function(e) {- I = null, De && De(e);-}, L.__ = function(e, t) {- e && t.__k && t.__k.__m && (e.__m = t.__k.__m), Me && Me(e, t);-}, L.__r = function(e) {- Oe && Oe(e), F = 0;- var t = (I = e.__c).__H;- t && (Ce === I ? (t.__h = [], I.__h = [], t.__.some(function(e) {+R.__b = function(e) {+ L = null, Oe && Oe(e);+}, R.__ = function(e, t) {+ e && t.__k && t.__k.__m && (e.__m = t.__k.__m), Ne && Ne(e, t);+}, R.__r = function(e) {+ ke && ke(e), I = 0;+ var t = (L = e.__c).__H;+ t && (we === L ? (t.__h = [], L.__h = [], t.__.some(function(e) {e.__N && (e.__ = e.__N), e.u = e.__N = void 0;- })) : (t.__h.some(Ve), t.__h.some(He), t.__h = [], F = 0)), Ce = I;-}, L.diffed = function(e) {- ke && ke(e);+ })) : (t.__h.some(He), t.__h.some(Ue), t.__h = [], I = 0)), we = L;+}, R.diffed = function(e) {+ Ae && Ae(e);var t = e.__c;- t && t.__H && (t.__H.__h.length && (Ee.push(t) !== 1 && we === L.requestAnimationFrame || ((we = L.requestAnimationFrame) || Be)(Re)), t.__H.__.some(function(e) {+ t && t.__H && (t.__H.__h.length && (De.push(t) !== 1 && Te === R.requestAnimationFrame || ((Te = R.requestAnimationFrame) || Ve)(ze)), t.__H.__.some(function(e) {e.u &&= (e.__H = e.u, void 0);- })), Ce = I = null;-}, L.__c = function(e, t) {+ })), we = L = null;+}, R.__c = function(e, t) {t.some(function(e) {try {- e.__h.some(Ve), e.__h = e.__h.filter(function(e) {- return !e.__ || He(e);+ e.__h.some(He), e.__h = e.__h.filter(function(e) {+ return !e.__ || Ue(e);});} catch (n) {t.some(function(e) {e.__h &&= [];- }), t = [], L.__e(n, e.__v);+ }), t = [], R.__e(n, e.__v);}- }), Ae && Ae(e, t);-}, L.unmount = function(e) {- je && je(e);+ }), je && je(e, t);+}, R.unmount = function(e) {+ Me && Me(e);var t, n = e.__c;n && n.__H && (n.__H.__.some(function(e) {try {- Ve(e);+ He(e);} catch (e) {t = e;}- }), n.__H = void 0, t && L.__e(t, n.__v));+ }), n.__H = void 0, t && R.__e(t, n.__v));};-var ze = typeof requestAnimationFrame == "function";-function Be(e) {+var Be = typeof requestAnimationFrame == "function";+function Ve(e) {var t, n = function() {- clearTimeout(r), ze && cancelAnimationFrame(t), setTimeout(e);+ clearTimeout(r), Be && cancelAnimationFrame(t), setTimeout(e);}, r = setTimeout(n, 35);- ze && (t = requestAnimationFrame(n));-}-function Ve(e) {- var t = I, n = e.__c;- typeof n == "function" && (e.__c = void 0, n()), I = t;+ Be && (t = requestAnimationFrame(n));}function He(e) {- var t = I;- e.__c = e.__(), I = t;+ var t = L, n = e.__c;+ typeof n == "function" && (e.__c = void 0, n()), L = t;+}+function Ue(e) {+ var t = L;+ e.__c = e.__(), L = t;}-function Ue(e, t) {+function We(e, t) {return !e || e.length !== t.length || t.some(function(t, n) {return t !== e[n];});}-function We(e, t) {+function Ge(e, t) {return typeof t == "function" ? t(e) : t;}//#endregion//#region node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js-var Ge = 0;+var Ke = 0;Array.isArray;-function B(e, t, n, r, i, a) {+function V(e, t, n, r, i, a) {t ||= {};- var o, s, l = t;- if ("ref" in l) for (s in l = {}, t) s == "ref" ? o = t[s] : l[s] = t[s];- var u = {+ var o, s, c = t;+ if ("ref" in c) for (s in c = {}, t) s == "ref" ? o = t[s] : c[s] = t[s];+ var l = {type: e,- props: l,+ props: c,key: n,ref: o,__k: null,@@ -456,130 +456,130 @@ function B(e, t, n, r, i, a) {__e: null,__c: null,constructor: void 0,- __v: --Ge,+ __v: --Ke,__i: -1,__u: 0,__source: i,__self: a};- if (typeof e == "function" && (o = e.defaultProps)) for (s in o) l[s] === void 0 && (l[s] = o[s]);- return c.vnode && c.vnode(u), u;+ if (typeof e == "function" && (o = e.defaultProps)) for (s in o) c[s] === void 0 && (c[s] = o[s]);+ return u.vnode && u.vnode(l), l;}//#endregion//#region src/islands/configuration.tsx-var Ke = "/api/configuration", qe = "/api/pick-folder", Je = 8e3, Ye = (e, t) => Se(Ke, t), V = ({ html: e, class: t }) => /* @__PURE__ */ B("div", {+var qe = "/api/configuration", Je = "/api/pick-folder", Ye = 8e3, Xe = (e, t) => Ce(qe, t), H = ({ html: e, class: t }) => /* @__PURE__ */ V("div", {class: t,dangerouslySetInnerHTML: { __html: e }-}), Xe = (e) => !(e instanceof be) || e.status !== 400 ? null : e.body?.errors ?? null;-function Ze({ facts: e }) {- return /* @__PURE__ */ B("section", {+}), Ze = (e) => !(e instanceof xe) || e.status !== 400 ? null : e.body?.errors ?? null;+function Qe({ facts: e }) {+ return /* @__PURE__ */ V("section", {class: "configfieldset","data-geist-fieldset": !0,"aria-labelledby": "configFactsTitle",- children: /* @__PURE__ */ B("div", {+ children: /* @__PURE__ */ V("div", {class: "geist-fieldset-content",- children: [/* @__PURE__ */ B(V, { html: t("configFactsTitle", "运行信息") }), /* @__PURE__ */ B("dl", {+ children: [/* @__PURE__ */ V(H, { html: t("configFactsTitle", "运行信息") }), /* @__PURE__ */ V("dl", {class: "configfacts",- children: e.map((e) => /* @__PURE__ */ B(k, { children: [/* @__PURE__ */ B("dt", { children: e.term }), /* @__PURE__ */ B("dd", { children: e.value })] }))+ children: e.map((e) => /* @__PURE__ */ V(j, { children: [/* @__PURE__ */ V("dt", { children: e.term }), /* @__PURE__ */ V("dd", { children: e.value })] }))})]})});}-function Qe({ data: e, receipt: i }) {- let [a, o] = R(e.media_dirs.length ? e.media_dirs : [""]), [s, c] = R(String(e.port)), [l, u] = R(!1), [d, f] = R([]), [p, m] = R(""), [h, g] = R(""), [_, v] = R(null), [y, b] = R(null), x = z(!1), S = z(e.revision), C = z([]), w = z(null);- Ie(() => {+function $e({ data: e, receipt: r }) {+ let [a, o] = z(e.media_dirs.length ? e.media_dirs : [""]), [s, c] = z(String(e.port)), [l, u] = z(!1), [d, f] = z([]), [p, m] = z(""), [h, g] = z(""), [_, v] = z(null), [y, b] = z(null), x = B(!1), S = B(e.revision), C = B([]), w = B(null);+ Le(() => {y !== null && (C.current[y]?.focus(), b(null));- }, [y]), Fe(() => {+ }, [y]), Ie(() => {if (!_) return;- let e = setTimeout(() => location.assign(_.url), Je);+ let e = setTimeout(() => location.assign(_.url), Ye);return () => clearTimeout(e);}, [_]);let T = (e, t) => {o((n) => n.map((n, r) => r === e ? t : n));}, E = () => {b(a.length), o((e) => [...e, ""]);- }, ee = (e) => {+ }, D = (e) => {o((t) => t.filter((t, n) => n !== e)), f((t) => t.filter((t, n) => n !== e));- }, D = (e, t) => {+ }, O = (e, t) => {f((n) => {let r = [...n];for (; r.length <= e;) r.push("");return r[e] = t, r;});- }, O = async (e, t) => {+ }, ee = async (e, t) => {if (t.getAttribute("aria-busy") !== "true") {- r(t, !0);+ i(t, !0);try {- let { path: t } = await P(qe, { initial: a[e] ?? "" });- t && (T(e, t), D(e, ""));+ let { path: t } = await F(Je, { initial: a[e] ?? "" });+ t && (T(e, t), O(e, ""));} catch (t) {- D(e, N(t));+ O(e, P(t));} finally {- r(t, !1);+ i(t, !1);}}};- return _ ? /* @__PURE__ */ B("div", {+ return _ ? /* @__PURE__ */ V("div", {class: "configsaved",role: "status",- children: [/* @__PURE__ */ B(V, { html: n("配置已保存,Peach 正在重新启动。", {+ children: [/* @__PURE__ */ V(H, { html: n("配置已保存,Peach 正在重新启动。", {variant: "success",label: "已保存"- }) }), /* @__PURE__ */ B("p", {+ }) }), /* @__PURE__ */ V("p", {class: "confighelp",children: ["几秒后自动打开新地址;没跳转就点 ",- /* @__PURE__ */ B("a", {+ /* @__PURE__ */ V("a", {href: _.url,children: "进入馆藏"}),"。"]})]- }) : /* @__PURE__ */ B("form", {+ }) : /* @__PURE__ */ V("form", {class: "configfieldset","data-geist-fieldset": !0,"aria-labelledby": "configTitle",onSubmit: async (e) => {if (e.preventDefault(), !x.current) {- x.current = !0, r(w.current, !0), g("");+ x.current = !0, i(w.current, !0), g("");try {- let e = await P(Ke, {+ let e = await F(qe, {revision: S.current,media_dirs: a,port: s,scan_now: l});- S.current = e.revision, f([]), m(""), i("已保存配置"), v(e);+ S.current = e.revision, f([]), m(""), r("已保存配置"), v(e);} catch (e) {- let t = Xe(e);- t ? (f(t.media_dirs ?? []), m(t.port ?? "")) : (f([]), m(""), g(N(e)));+ let t = Ze(e);+ t ? (f(t.media_dirs ?? []), m(t.port ?? "")) : (f([]), m(""), g(P(e)));} finally {- x.current = !1, r(w.current, !1);+ x.current = !1, i(w.current, !1);}}},noValidate: !0,- children: [/* @__PURE__ */ B("div", {+ children: [/* @__PURE__ */ V("div", {class: "geist-fieldset-content",children: [- /* @__PURE__ */ B(V, { html: t("configTitle", "这台电脑") }),- /* @__PURE__ */ B("div", {+ /* @__PURE__ */ V(H, { html: t("configTitle", "这台电脑") }),+ /* @__PURE__ */ V("div", {class: "configfield",children: [- /* @__PURE__ */ B("span", {+ /* @__PURE__ */ V("span", {class: "configlabel",id: "configDirsLabel",children: "媒体文件夹"}),- /* @__PURE__ */ B("div", {+ /* @__PURE__ */ V("div", {class: "configdirs",role: "group","aria-labelledby": "configDirsLabel",- children: a.map((e, t) => /* @__PURE__ */ B("div", {+ children: a.map((e, t) => /* @__PURE__ */ V("div", {class: "configdir",children: [- /* @__PURE__ */ B("input", {+ /* @__PURE__ */ V("input", {class: "geist-input",type: "text",value: e,@@ -590,29 +590,29 @@ function Qe({ data: e, receipt: i }) {C.current[t] = e;}}),- /* @__PURE__ */ B("button", {+ /* @__PURE__ */ V("button", {type: "button",class: "geist-button configpick","aria-label": "选择文件夹",- onClick: (e) => O(t, e.currentTarget),- children: /* @__PURE__ */ B("svg", {+ onClick: (e) => ee(t, e.currentTarget),+ children: /* @__PURE__ */ V("svg", {viewBox: "0 0 24 24","aria-hidden": "true",- children: /* @__PURE__ */ B("use", { href: "#i-folder-search" })+ children: /* @__PURE__ */ V("use", { href: "#i-folder-search" })})}),- a.length > 1 ? /* @__PURE__ */ B("button", {+ a.length > 1 ? /* @__PURE__ */ V("button", {type: "button",class: "geist-button configrm","aria-label": "移除这个文件夹",- onClick: () => ee(t),- children: /* @__PURE__ */ B("svg", {+ onClick: () => D(t),+ children: /* @__PURE__ */ V("svg", {viewBox: "0 0 24 24","aria-hidden": "true",- children: /* @__PURE__ */ B("use", { href: "#i-x" })+ children: /* @__PURE__ */ V("use", { href: "#i-x" })})}) : null,- d[t] ? /* @__PURE__ */ B("p", {+ d[t] ? /* @__PURE__ */ V("p", {class: "configbad",role: "alert",children: d[t]@@ -620,26 +620,26 @@ function Qe({ data: e, receipt: i }) {]}, t))}),- /* @__PURE__ */ B("button", {+ /* @__PURE__ */ V("button", {type: "button",class: "geist-button configadd",onClick: E,children: "添加文件夹"}),- /* @__PURE__ */ B("p", {+ /* @__PURE__ */ V("p", {class: "confighelp",children: "Peach 从这些文件夹读取视频和图片。可以是外置硬盘上的文件夹,但必须已经存在。"})]}),- /* @__PURE__ */ B("div", {+ /* @__PURE__ */ V("div", {class: "configfield",children: [- /* @__PURE__ */ B("label", {+ /* @__PURE__ */ V("label", {for: "configPort",children: "本机访问端口"}),- /* @__PURE__ */ B("input", {+ /* @__PURE__ */ V("input", {id: "configPort",class: "geist-input",type: "text",@@ -648,43 +648,43 @@ function Qe({ data: e, receipt: i }) {"aria-invalid": p ? "true" : void 0,onInput: (e) => c(e.currentTarget.value)}),- p ? /* @__PURE__ */ B("p", {+ p ? /* @__PURE__ */ V("p", {class: "configbad",role: "alert",children: p}) : null,- /* @__PURE__ */ B("p", {+ /* @__PURE__ */ V("p", {class: "confighelp",children: "浏览器地址里冒号后面的数字,一般不用改。"})]}),- /* @__PURE__ */ B("label", {+ /* @__PURE__ */ V("label", {class: "configcheck",- children: [/* @__PURE__ */ B("span", {+ children: [/* @__PURE__ */ V("span", {class: "pcheck",- children: [/* @__PURE__ */ B("input", {+ children: [/* @__PURE__ */ V("input", {type: "checkbox",checked: l,onChange: (e) => u(e.currentTarget.checked)- }), /* @__PURE__ */ B("span", {+ }), /* @__PURE__ */ V("span", {"aria-hidden": "true",- children: /* @__PURE__ */ B("svg", {+ children: /* @__PURE__ */ V("svg", {viewBox: "0 0 24 24",- children: /* @__PURE__ */ B("use", { href: "#i-check" })+ children: /* @__PURE__ */ V("use", { href: "#i-check" })})})]- }), /* @__PURE__ */ B("span", { children: "保存后扫描媒体文件夹" })]+ }), /* @__PURE__ */ V("span", { children: "保存后扫描媒体文件夹" })]}),- h ? /* @__PURE__ */ B(V, { html: n(h, {+ h ? /* @__PURE__ */ V(H, { html: n(h, {variant: "error",label: "没有保存"}) }) : null]- }), /* @__PURE__ */ B("div", {+ }), /* @__PURE__ */ V("div", {class: "geist-fieldset-footer","data-geist-fieldset-footer": !0,- children: [/* @__PURE__ */ B("p", { children: "保存后 Peach 会重新启动,端口改了就用新地址打开。" }), /* @__PURE__ */ B("button", {+ children: [/* @__PURE__ */ V("p", { children: "保存后 Peach 会重新启动,端口改了就用新地址打开。" }), /* @__PURE__ */ V("button", {type: "submit",class: "geist-button primary",ref: w,@@ -693,43 +693,43 @@ function Qe({ data: e, receipt: i }) {})]});}-function $e({ receipt: e, data: t, error: r }) {- return r || !t ? /* @__PURE__ */ B(V, {+function et({ receipt: e, data: t, error: r }) {+ return r || !t ? /* @__PURE__ */ V(H, {class: "configpage",html: n(r || "没有读到配置", {variant: "error",label: "打不开配置"})- }) : /* @__PURE__ */ B("div", {+ }) : /* @__PURE__ */ V("div", {class: "configpage",- children: [t.editable ? /* @__PURE__ */ B(Qe, {+ children: [t.editable ? /* @__PURE__ */ V($e, {data: t,receipt: e- }) : /* @__PURE__ */ B(V, { html: n(t.notice, {+ }) : /* @__PURE__ */ V(H, { html: n(t.notice, {variant: "secondary",label: "只读"- }) }), /* @__PURE__ */ B(Ze, { facts: t.facts })]+ }) }), /* @__PURE__ */ V(Qe, { facts: t.facts })]});}//#endregion//#region node_modules/@preact/signals-core/dist/signals-core.module.js-var et = Symbol.for("preact-signals");-function tt() {- if (G > 1) G--;+var tt = Symbol.for("preact-signals");+function nt() {+ if (K > 1) K--;else {var e, t = !1;for ((function() {- var e = ot;- for (ot = void 0; e !== void 0;) {+ var e = ct;+ for (ct = void 0; e !== void 0;) {var t = e.S;if (t.v === e.v) for (var n = t.t; n !== void 0; n = n.x) n.i === e.i && (n.i = t.i);e = e.o;}- })(); W !== void 0;) {- var n = W;- for (W = void 0, K++; n !== void 0;) {+ })(); G !== void 0;) {+ var n = G;+ for (G = void 0, at++; n !== void 0;) {var r = n.u;- if (n.u = void 0, n.f &= -3, !(8 & n.f) && ut(n)) try {+ if (n.u = void 0, n.f &= -3, !(8 & n.f) && ft(n)) try {n.c();} catch (n) {t ||= (e = n, !0);@@ -737,53 +737,53 @@ function tt() {n = r;}}- if (K = 0, G--, t) throw e;+ if (at = 0, K--, t) throw e;}}-function nt(e) {- if (G > 0) return e();- at = ++it, G++;+function rt(e) {+ if (K > 0) return e();+ st = ++ot, K++;try {return e();} finally {- tt();+ nt();}}-var H, U = void 0;-function rt(e) {- var t = U, n = H;- U = void 0, H = void 0;+var U, W = void 0;+function it(e) {+ var t = W, n = U;+ W = void 0, U = void 0;try {return e();} finally {- U = t, H = n;+ W = t, U = n;}}-var W = void 0, G = 0, K = 0, it = 0, at = 0, ot = void 0, st = 0;-function ct(e) {- if (U !== void 0) {+var G = void 0, K = 0, at = 0, ot = 0, st = 0, ct = void 0, lt = 0;+function ut(e) {+ if (W !== void 0) {var t = e.n;- if (t === void 0 || t.t !== U) return t = {+ if (t === void 0 || t.t !== W) return t = {i: 0,S: e,- p: U.s,+ p: W.s,n: void 0,- t: U,+ t: W,e: void 0,x: void 0,r: t- }, U.s !== void 0 && (U.s.n = t), U.s = t, e.n = t, 32 & U.f && e.S(t), t;- if (t.i === -1) return t.i = 0, t.n !== void 0 && (t.n.p = t.p, t.p !== void 0 && (t.p.n = t.n), t.p = U.s, t.n = void 0, U.s.n = t, U.s = t), t;+ }, W.s !== void 0 && (W.s.n = t), W.s = t, e.n = t, 32 & W.f && e.S(t), t;+ if (t.i === -1) return t.i = 0, t.n !== void 0 && (t.n.p = t.p, t.p !== void 0 && (t.p.n = t.n), t.p = W.s, t.n = void 0, W.s.n = t, W.s = t), t;}}function q(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;}-q.prototype.brand = et, q.prototype.h = function() {+q.prototype.brand = tt, q.prototype.h = function() {return !0;}, q.prototype.S = function(e) {var t = this, n = this.t;- n !== e && e.e === void 0 && (e.x = n, this.t = e, n === void 0 ? rt(function() {+ n !== e && e.e === void 0 && (e.x = n, this.t = e, n === void 0 ? it(function() {var e;(e = t.W) == null || e.call(t);}) : n.e = e);@@ -791,7 +791,7 @@ q.prototype.brand = et, q.prototype.h = function() {var t = this;if (this.t !== void 0) {var n = e.e, r = e.x;- n !== void 0 && (n.x = r, e.e = void 0), r !== void 0 && (r.e = n, e.x = void 0), e === this.t && (this.t = r, r === void 0 && rt(function() {+ n !== void 0 && (n.x = r, e.e = void 0), r !== void 0 && (r.e = n, e.x = void 0), e === this.t && (this.t = r, r === void 0 && it(function() {var e;(e = t.Z) == null || e.call(t);}));@@ -800,7 +800,7 @@ q.prototype.brand = et, q.prototype.h = function() {var t = this;return X(function() {var n = t.value;- rt(function() {+ it(function() {return e(n);});}, { name: "sub" });@@ -812,41 +812,41 @@ q.prototype.brand = et, q.prototype.h = function() {return this.value;}, q.prototype.peek = function() {var e = this;- return rt(function() {+ return it(function() {return e.value;});}, Object.defineProperty(q.prototype, "value", {get: function() {- var e = ct(this);+ var e = ut(this);return e !== void 0 && (e.i = this.i), this.v;},set: function(e) {if (e !== this.v) {- if (K > 100) throw Error("Cycle detected");+ if (at > 100) throw Error("Cycle detected");(function(e) {- G !== 0 && K === 0 && e.l !== at && (e.l = at, ot = {+ K !== 0 && at === 0 && e.l !== st && (e.l = st, ct = {S: e,v: e.v,i: e.i,- o: ot+ o: ct});- })(this), this.v = e, this.i++, st++, G++;+ })(this), this.v = e, this.i++, lt++, K++;try {for (var t = this.t; t !== void 0; t = t.x) t.t.N();} finally {- tt();+ nt();}}}});-function lt(e, t) {+function dt(e, t) {return new q(e, t);}-function ut(e) {+function ft(e) {for (var t = e.s; t !== void 0; t = t.n) if (t.S.i !== t.i || !t.S.h() || t.S.i !== t.i) return !0;return !1;}-function dt(e) {+function pt(e) {for (var t = e.s; t !== void 0; t = t.n) {var n = t.S.n;if (n !== void 0 && (t.r = n), t.S.n = t, t.i = -1, t.n === void 0) {@@ -855,7 +855,7 @@ function dt(e) {}}}-function ft(e) {+function mt(e) {for (var t = e.s, n = void 0; t !== void 0;) {var r = t.p;t.i === -1 ? (t.S.U(t), r !== void 0 && (r.n = t.n), t.n !== void 0 && (t.n.p = r)) : n = t, t.S.n = t.r, t.r !== void 0 && (t.r = void 0), t = r;@@ -863,21 +863,21 @@ function ft(e) {e.s = n;}function J(e, t) {- q.call(this, void 0, t), this.x = e, this.s = void 0, this.g = st - 1, this.f = 4;+ q.call(this, void 0, t), this.x = e, this.s = void 0, this.g = lt - 1, this.f = 4;}J.prototype = new q(), J.prototype.h = function() {if (this.f &= -3, 1 & this.f) return !1;- if ((36 & this.f) == 32 || (this.f &= -5, this.g === st)) return !0;- if (this.g = st, this.f |= 1, this.i > 0 && !ut(this)) return this.f &= -2, !0;- var e = U;+ if ((36 & this.f) == 32 || (this.f &= -5, this.g === lt)) return !0;+ if (this.g = lt, this.f |= 1, this.i > 0 && !ft(this)) return this.f &= -2, !0;+ var e = W;try {- dt(this), U = this;+ pt(this), W = this;var t = this.x();(16 & this.f || this.v !== t || this.i === 0) && (this.v = t, this.f &= -17, this.i++);} catch (e) {this.v = e, this.f |= 16, this.i++;}- return U = e, ft(this), this.f &= -2, !0;+ return W = e, mt(this), this.f &= -2, !0;}, J.prototype.S = function(e) {if (this.t === void 0) {this.f |= 36;@@ -896,38 +896,38 @@ J.prototype = new q(), J.prototype.h = function() {}}, Object.defineProperty(J.prototype, "value", { get: function() {if (1 & this.f) throw Error("Cycle detected");- var e = ct(this);+ var e = ut(this);if (this.h(), e !== void 0 && (e.i = this.i), 16 & this.f) throw this.v;return this.v;} });-function pt(e, t) {+function ht(e, t) {return new J(e, t);}-function mt(e) {+function gt(e) {var t = e.m;if (e.m = void 0, typeof t == "function") {- G++;- var n = U;- U = void 0;+ K++;+ var n = W;+ W = void 0;try {t();} catch (t) {- throw e.f &= -2, e.f |= 8, ht(e), t;+ throw e.f &= -2, e.f |= 8, _t(e), t;} finally {- U = n, tt();+ W = n, nt();}}}-function ht(e) {+function _t(e) {for (var t = e.s; t !== void 0; t = t.n) t.S.U(t);- e.x = void 0, e.s = void 0, mt(e);+ e.x = void 0, e.s = void 0, gt(e);}-function gt(e) {- if (U !== this) throw Error("Out-of-order effect");- ft(this), U = e, this.f &= -2, 8 & this.f && ht(this), tt();+function vt(e) {+ if (W !== this) throw Error("Out-of-order effect");+ mt(this), W = e, this.f &= -2, 8 & this.f && _t(this), nt();}function Y(e, t) {- this.x = e, this.m = void 0, this.s = void 0, this.u = void 0, this.f = 32, this.name = t?.name, H && H.push(this);+ this.x = e, this.m = void 0, this.s = void 0, this.u = void 0, this.f = 32, this.name = t?.name, U && U.push(this);}Y.prototype.c = function() {var e = this.S();@@ -940,13 +940,13 @@ Y.prototype.c = function() {}}, Y.prototype.S = function() {if (1 & this.f) throw Error("Cycle detected");- this.f |= 1, this.f &= -9, mt(this), dt(this), G++;- var e = U;- return U = this, gt.bind(this, e);+ this.f |= 1, this.f &= -9, gt(this), pt(this), K++;+ var e = W;+ return W = this, vt.bind(this, e);}, Y.prototype.N = function() {- 2 & this.f || (this.f |= 2, this.u = W, W = this);+ 2 & this.f || (this.f |= 2, this.u = G, G = this);}, Y.prototype.d = function() {- this.f |= 8, 1 & this.f || ht(this);+ this.f |= 8, 1 & this.f || _t(this);}, Y.prototype.dispose = function() {this.d();};@@ -962,35 +962,35 @@ function X(e, t) {}//#endregion//#region node_modules/@preact/signals/dist/signals.module.js-var _t, vt, yt = typeof window < "u" && !!window.__PREACT_SIGNALS_DEVTOOLS__, bt = [];+var yt, bt, xt = typeof window < "u" && !!window.__PREACT_SIGNALS_DEVTOOLS__, St = [];X(function() {- _t = this.N;+ yt = this.N;})();function Z(e, t) {- c[e] = t.bind(null, c[e] || function() {});+ u[e] = t.bind(null, u[e] || function() {});}-function xt(e) {- if (vt) {- var t = vt;- vt = void 0, t();+function Ct(e) {+ if (bt) {+ var t = bt;+ bt = void 0, t();}- vt = e && e.S();+ bt = e && e.S();}-function St(e) {- var t = this, n = e.data, r = wt(n);+function wt(e) {+ var t = this, n = e.data, r = Et(n);r.name = "ReactiveDom", r.value = n;- var i = Le(function() {+ var i = Re(function() {for (var e = t, n = t.__v; n = n.__;) if (n.__c) {n.__c.__$f |= 4;break;}- var i = pt(function() {+ var i = ht(function() {var e = r.value.value;return e === 0 ? 0 : !0 === e ? "" : e || "";- }), a = pt(function() {- return !Array.isArray(i.value) && !u(i.value);+ }), a = ht(function() {+ return !Array.isArray(i.value) && !f(i.value);}), o = X(function() {- if (this.N = Dt, a.value) {+ if (this.N = kt, a.value) {var t = i.value;e.__v && e.__v.__e && e.__v.__e.nodeType === 3 && (e.__v.__e.data = t);}@@ -1001,14 +1001,14 @@ function St(e) {}, []), a = i[0], o = i[1];return a.value ? o.peek() : o.value;}-St.displayName = "ReactiveTextNode", Object.defineProperties(q.prototype, {+wt.displayName = "ReactiveTextNode", Object.defineProperties(q.prototype, {constructor: {configurable: !0,value: void 0},type: {configurable: !0,- value: St+ value: wt},props: {configurable: !0,@@ -1033,8 +1033,8 @@ St.displayName = "ReactiveTextNode", Object.defineProperties(q.prototype, {}e(t);}), Z("__r", function(e, t) {- if (e(t), t.type !== k) {- xt();+ if (e(t), t.type !== j) {+ Ct();var n, r = t.__c;r && (r.__$f &= -2, (n = r.__$u) === void 0 && (r.__$u = n = function(e, t) {var n;@@ -1044,14 +1044,14 @@ St.displayName = "ReactiveTextNode", Object.defineProperties(q.prototype, {}(function(e) {return function() {var t;- yt && ((t = this.y) == null || t.call(this)), e.__$f |= 1, e.setState({});+ xt && ((t = this.y) == null || t.call(this)), e.__$f |= 1, e.setState({});};- }(r), typeof t.type == "function" ? t.type.displayName || t.type.name : ""))), xt(n);+ }(r), typeof t.type == "function" ? t.type.displayName || t.type.name : ""))), Ct(n);}}), Z("__e", function(e, t, n, r) {- xt(), e(t, n, r);+ Ct(), e(t, n, r);}), Z("diffed", function(e, t) {- xt();+ Ct();var n;if (typeof t.type == "string" && (n = t.__e)) {var r = t.__np, i = t.props, a = n.U;@@ -1061,19 +1061,19 @@ St.displayName = "ReactiveTextNode", Object.defineProperties(q.prototype, {}if (r) for (var c in a || (a = {}, n.U = a), r) {var l = a[c], u = r[c];- l === void 0 ? (l = Ct(n, c, u, i), a[c] = l) : l.o(u, i);+ l === void 0 ? (l = Tt(n, c, u, i), a[c] = l) : l.o(u, i);}}e(t);});-function Ct(e, t, n, r) {- var i = t in e && e.ownerSVGElement === void 0, a = lt(n);+function Tt(e, t, n, r) {+ var i = t in e && e.ownerSVGElement === void 0, a = dt(n);return {o: function(e, t) {a.value = e, r = t;},d: X(function() {- this.N = Dt;+ this.N = kt;var n = a.value.value;r[t] !== n && (r[t] = n, i ? e[t] = n : n != null && (!1 !== n || t[4] === "-") ? e.setAttribute(t, n) : e.removeAttribute(t));})@@ -1105,7 +1105,7 @@ Z("unmount", function(e, t) {e(t);}), Z("__h", function(e, t, n, r) {r < 3 && (t.__$f |= 2), e(t, n, r);-}), A.prototype.shouldComponentUpdate = function(e, t) {+}), M.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;@@ -1117,55 +1117,55 @@ Z("unmount", function(e, t) {for (var s in this.props) if (!(s in e)) return !0;return !1;};-function wt(e, t) {- return Le(function() {- return lt(e, t);+function Et(e, t) {+ return Re(function() {+ return dt(e, t);}, []);}-var Tt = function(e) {+var Dt = function(e) {queueMicrotask(function() {queueMicrotask(e);});};-function Et() {- nt(function() {- for (var e; e = bt.shift();) _t.call(e);+function Ot() {+ rt(function() {+ for (var e; e = St.shift();) yt.call(e);});}-function Dt() {- bt.push(this) === 1 && (c.requestAnimationFrame || Tt)(Et);+function kt() {+ St.push(this) === 1 && (u.requestAnimationFrame || Dt)(Ot);}//#endregion//#region src/state/quality-goals.ts-var Ot = "/api/quality-goals?limit=200", kt = {+var At = "/api/quality-goals?limit=200", jt = {data: null,error: ""-}, Q = lt(kt), At = 0, jt = pt(() => Q.value);-pt(() => Q.value.data?.total ?? null);-function Mt() {- At += 1, Q.value = kt;+}, Q = dt(jt), Mt = 0, Nt = ht(() => Q.value);+ht(() => Q.value.data?.total ?? null);+function Pt() {+ Mt += 1, Q.value = jt;}-async function Nt(e) {- let t = At += 1;+async function Ft(e) {+ let t = Mt += 1;try {- let n = await Se(Ot, e);- return t === At && (Q.value = {+ let n = await Ce(At, e);+ return t === Mt && (Q.value = {data: n,error: ""}), n;} catch (n) {- throw !e?.aborted && t === At && (Q.value = {+ throw !e?.aborted && t === Mt && (Q.value = {data: null,- error: N(n)+ error: P(n)}), n;}}//#endregion//#region src/islands/quality-goals.tsx-var Pt = (e, t) => Nt(t), Ft = (e) => e.has_cover ? `/cover?code=${encodeURIComponent(e.code ?? "")}` : `/poster?id=${e.id}&c=4`;-function It({ openItem: t, javTitleHtml: r, javDisplayName: s, srcBadge: c }) {- let { data: l, error: u } = jt.value;- if (u) return /* @__PURE__ */ B("div", {+var It = (e, t) => Ft(t), Lt = (e) => e.has_cover ? `/cover?code=${encodeURIComponent(e.code ?? "")}` : `/poster?id=${e.id}&c=4`;+function Rt({ openItem: t, javTitleHtml: r, javDisplayName: i, srcBadge: a }) {+ let { data: l, error: u } = Nt.value;+ if (u) return /* @__PURE__ */ V("div", {class: "qualitylist",dangerouslySetInnerHTML: { __html: n(u, {variant: "error",@@ -1173,51 +1173,51 @@ function It({ openItem: t, javTitleHtml: r, javDisplayName: s, srcBadge: c }) {}) }});let d = l?.items ?? [];- return d.length ? /* @__PURE__ */ B("div", {+ return d.length ? /* @__PURE__ */ V("div", {class: "qualitylist",- children: d.map((e) => /* @__PURE__ */ B("article", {+ children: d.map((e) => /* @__PURE__ */ V("article", {class: "qualityitem",- children: [/* @__PURE__ */ B("button", {+ children: [/* @__PURE__ */ V("button", {class: "qualitycover",type: "button",- "aria-label": `打开 ${s(e)}`,+ "aria-label": `打开 ${i(e)}`,onClick: () => t(e.id),- children: /* @__PURE__ */ B("img", {- src: Ft(e),+ children: /* @__PURE__ */ V("img", {+ src: Lt(e),alt: "",loading: "lazy",onError: (e) => e.currentTarget.remove()})- }), /* @__PURE__ */ B("div", { children: [- /* @__PURE__ */ B("h3", { children: /* @__PURE__ */ B("button", {+ }), /* @__PURE__ */ V("div", { children: [+ /* @__PURE__ */ V("h3", { children: /* @__PURE__ */ V("button", {type: "button","data-middle-truncate": !0,onClick: () => t(e.id),dangerouslySetInnerHTML: { __html: r(e) }}) }),- /* @__PURE__ */ B("p", {+ /* @__PURE__ */ V("p", {class: "mono",children: [- /* @__PURE__ */ B("span", {+ /* @__PURE__ */ V("span", {style: "display:contents",- dangerouslySetInnerHTML: { __html: c(e.location, e.cost) }+ dangerouslySetInnerHTML: { __html: a(e.location, e.cost) }}),- /* @__PURE__ */ B("span", { children: i[e.location] ?? e.location }),- /* @__PURE__ */ B("span", { children: a(e.duration) }),- /* @__PURE__ */ B("span", { children: o(e.size ?? 0) })+ /* @__PURE__ */ V("span", { children: o[e.location] ?? e.location }),+ /* @__PURE__ */ V("span", { children: s(e.duration) }),+ /* @__PURE__ */ V("span", { children: c(e.size ?? 0) })]}),- e.reason ? /* @__PURE__ */ B("p", { children: e.reason }) : null+ e.reason ? /* @__PURE__ */ V("p", { children: e.reason }) : null] })]}, e.id))- }) : /* @__PURE__ */ B("div", {+ }) : /* @__PURE__ */ V("div", {class: "qualitylist",dangerouslySetInnerHTML: { __html: e("sparkles", "没有标记中的高清版目标", "现有版本都已满足条件,或还没有加入追踪。") }});}//#endregion//#region src/jobs.ts-async function Lt(e) {+async function zt(e) {let t = e.pause || ((e) => new Promise((t) => setTimeout(t, e))), n = 0;for (; e.active();) {let r;@@ -1232,11 +1232,11 @@ async function Lt(e) {await t(2e3);}}-function Rt(e) {+function Bt(e) {let t = document.createElement("div");e.host.hidden = !0, t.dataset.followJob = "", t.setAttribute("aria-live", "polite"), e.host.prepend(t);let n = e.storageKey || "peach-follow-job", r = sessionStorage.getItem(n) || void 0, i = !1;- Lt({+ zt({read: e.read,active: () => !i && e.active() && t.isConnected,keepWatching: e.watchIdle !== !1,@@ -1262,162 +1262,187 @@ function Rt(e) {}//#endregion//#region src/islands/scraping.tsx-var zt = (e, t) => Se("/api/scraping", t);-function Bt({ source: e, toast: i }) {- let [a, o] = R(e), [s, c] = R(e.network), [l, u] = R(""), [d, f] = R(""), [p, m] = R(""), [h, g] = R(!1), [_, v] = R(""), [y, b] = R([]), x = z(null), S = z(null);- Ie(() => {- S.current?.querySelectorAll("button").forEach((e) => r(e, h));- }, [h]);- let C = z(new AbortController());- Fe(() => () => C.current.abort(), []);- async function w(t) {- if (!h) {- g(!0), v(""), b([]);+var Vt = (e, t) => Ce("/api/scraping", t);+function Ht({ value: e, onChange: t }) {+ let n = B(null), i = B(t);+ return i.current = t, Le(() => {+ let t = n.current;+ t.innerHTML = r([+ ["environment", "系统代理"],+ ["direct", "应用直连"],+ ["proxy", "自定义代理"]+ ], e, { label: "连接方式" });+ let o = a(t.firstElementChild), s = () => i.current(o.value);+ return o.addEventListener("change", s), () => {+ o.disabled = !0, o.removeEventListener("change", s), t.replaceChildren();+ };+ }, []), /* @__PURE__ */ V("div", {+ ref: n,+ class: "scraping-network"+ });+}+function Ut({ source: e, toast: r }) {+ let [a, o] = z(e), [s, c] = z(e.network), [l, u] = z(""), [d, f] = z(""), [p, m] = z(""), [h, g] = z("paste"), [_, v] = z(""), [y, b] = z(!1), [x, S] = z(""), [C, w] = z([]), T = B(null), E = B(null);+ Le(() => {+ E.current?.querySelectorAll("footer button").forEach((e) => i(e, y));+ }, [y]);+ let D = B(new AbortController());+ Ie(() => () => D.current.abort(), []);+ async function O(t) {+ if (!y) {+ b(!0), S(""), w([]);try {if (t === "check") {- let t = await P("/api/scraping/check", { source: e.source }, "POST", C.current.signal);- C.current.signal.aborted || b(t.results);+ let t = await F("/api/scraping/check", { source: e.source }, "POST", D.current.signal);+ D.current.signal.aborted || w(t.results);} else {- let n = await P("/api/scraping/settings", {+ let n = await F("/api/scraping/settings", {source: e.source,network: s,proxy: l,cookie: d,cookies_text: p,revoke: t === "revoke"- }, "POST", C.current.signal);- C.current.signal.aborted || (o(n.saved), u(""), f(""), m(""), x.current && (x.current.value = ""), i(t === "revoke" ? "Cookie 已撤销" : "来源设置已保存"));+ }, "POST", D.current.signal);+ D.current.signal.aborted || (o(n.saved), u(""), f(""), m(""), v(""), T.current && (T.current.value = ""), r(t === "revoke" ? "Cookie 已撤销" : "来源设置已保存"));}} catch (e) {- C.current.signal.aborted || v(N(e));+ D.current.signal.aborted || S(P(e));} finally {- C.current.signal.aborted || g(!1);+ D.current.signal.aborted || b(!1);}}}- return /* @__PURE__ */ B("section", {+ return /* @__PURE__ */ V("section", {class: "scraping-source",- children: /* @__PURE__ */ B("form", {- ref: S,+ children: /* @__PURE__ */ V("form", {+ ref: E,class: "cleanupfieldset","data-geist-fieldset": !0,onSubmit: (e) => {- e.preventDefault(), w("save");+ e.preventDefault(), O("save");},- children: [/* @__PURE__ */ B("div", {+ children: [/* @__PURE__ */ V("div", {class: "geist-fieldset-content scraping-fields",children: [- /* @__PURE__ */ B("div", { dangerouslySetInnerHTML: { __html: t(`scraping-${e.source}`, e.label) } }),- /* @__PURE__ */ B("label", { children: ["连接方式", /* @__PURE__ */ B("select", {- class: "geist-input",- value: s,- disabled: h,- onChange: (e) => c(e.currentTarget.value),- children: [- /* @__PURE__ */ B("option", {- value: "environment",- children: "环境代理"- }),- /* @__PURE__ */ B("option", {- value: "direct",- children: "应用直连"- }),- /* @__PURE__ */ B("option", {- value: "proxy",- children: "指定代理"- })- ]- })] }),- s === "proxy" && /* @__PURE__ */ B("label", { children: ["代理地址", /* @__PURE__ */ B("input", {+ /* @__PURE__ */ V("div", { dangerouslySetInnerHTML: { __html: t(`scraping-${e.source}`, e.label) } }),+ /* @__PURE__ */ V("a", {+ class: "scraping-url",+ href: e.login,+ target: "_blank",+ rel: "noopener noreferrer",+ children: e.login+ }),+ /* @__PURE__ */ V("div", {+ class: "scraping-label",+ children: ["连接方式", /* @__PURE__ */ V(Ht, {+ value: s,+ onChange: c+ })]+ }),+ s === "proxy" && /* @__PURE__ */ V("label", { children: ["代理地址", /* @__PURE__ */ V("input", {class: "geist-input",type: "password",autoComplete: "off",value: l,placeholder: a.proxy_saved ? "已保存,留空保留" : "http://127.0.0.1:7890",- disabled: h,+ disabled: y,onInput: (e) => u(e.currentTarget.value)})] }),- e.accepts_cookie && /* @__PURE__ */ B(k, { children: [- /* @__PURE__ */ B("p", { children: [- /* @__PURE__ */ B("a", {- href: e.login,- target: "_blank",- rel: "noopener noreferrer",- children: "打开官网登录"- }),- " · ",- a.cookie_saved ? "Cookie 已保存,尚未验证会话" : "尚未提供 Cookie"- ] }),- /* @__PURE__ */ B("label", { children: ["Cookie 请求头", /* @__PURE__ */ B("input", {+ e.accepts_cookie && /* @__PURE__ */ V(j, { children: [+ /* @__PURE__ */ V("p", { children: a.cookie_saved ? "Cookie 已保存,登录是否有效请在抓取时确认。" : "需要登录时,任选一种方式提供 Cookie。" }),+ /* @__PURE__ */ V("div", {+ class: "insightswitch scraping-cookie-method",+ role: "radiogroup",+ "aria-label": "提供 Cookie 的方式(二选一)",+ children: [["paste", "粘贴 Cookie"], ["file", "导入文件"]].map(([t, n]) => /* @__PURE__ */ V("label", { children: [/* @__PURE__ */ V("input", {+ type: "radio",+ name: `cookie-method-${e.source}`,+ value: t,+ checked: h === t,+ onChange: () => {+ g(t), f(""), m(""), v("");+ }+ }), /* @__PURE__ */ V("span", { children: n })] }, t))+ }),+ h === "paste" ? /* @__PURE__ */ V("label", { children: ["Cookie", /* @__PURE__ */ V("input", {class: "geist-input",type: "password",autoComplete: "off",value: d,- disabled: h || !!p,+ disabled: y,onInput: (e) => f(e.currentTarget.value)- })] }),- /* @__PURE__ */ B("label", { children: ["Netscape Cookie 文件", /* @__PURE__ */ B("input", {- class: "geist-input",- ref: x,- type: "file",- accept: ".txt",- disabled: h || !!d,- onChange: async (e) => {- let t = e.currentTarget.files?.[0];- if (!t) {- m("");- return;- }- if (m(""), t.size > 262144) {- v("Cookie 文本超过 256 KiB"), e.currentTarget.value = "";- return;- }- g(!0);- try {- let e = await t.text();- C.current.signal.aborted || m(e);- } catch {- C.current.signal.aborted || v("Cookie 文件未读取,请重新选择");- } finally {- C.current.signal.aborted || g(!1);- }- }- })] })+ })] }) : /* @__PURE__ */ V("label", {+ class: "scraping-file",+ children: ["Netscape Cookie 文件(.txt)", /* @__PURE__ */ V("span", {+ class: "scraping-file-control",+ children: [+ /* @__PURE__ */ V("span", {+ class: "geist-button",+ children: "选择文件"+ }),+ /* @__PURE__ */ V("span", {+ class: "scraping-file-name",+ children: _ || "未选择文件"+ }),+ /* @__PURE__ */ V("input", {+ ref: T,+ type: "file",+ accept: ".txt",+ disabled: y,+ onChange: async (e) => {+ let t = e.currentTarget.files?.[0];+ if (!t) {+ m(""), v("");+ return;+ }+ if (m(""), t.size > 262144) {+ S("Cookie 文本超过 256 KiB"), e.currentTarget.value = "";+ return;+ }+ b(!0);+ try {+ let e = await t.text();+ D.current.signal.aborted || (m(e), v(t.name));+ } catch {+ D.current.signal.aborted || S("Cookie 文件未读取,请重新选择");+ } finally {+ D.current.signal.aborted || b(!1);+ }+ }+ })+ ]+ })]+ })] }),- _ && /* @__PURE__ */ B("div", {+ x && /* @__PURE__ */ V("div", {role: "alert",- dangerouslySetInnerHTML: { __html: n(_, { variant: "error" }) }+ dangerouslySetInnerHTML: { __html: n(x, { variant: "error" }) }}),- y.map((e) => /* @__PURE__ */ B("p", {+ C.map((t) => /* @__PURE__ */ V("div", {role: "status",- children: [- e.label,- ":",- e.ok ? "可连接" : "未取得",- e.width ? ` · ${e.width} × ${e.height}` : "",- e.message ? ` · ${e.message}` : ""- ]- }, e.label))+ dangerouslySetInnerHTML: { __html: n(`${e.label}${t.label === "来源页面" ? "" : " 高清图片"}:${t.ok ? "可连接" : "不能连接"}` + (t.width ? ` · ${t.width} × ${t.height}` : "") + (t.message ? `。${t.message}` : ""), { variant: t.ok ? "success" : "error" }) }+ }, t.label))]- }), /* @__PURE__ */ B("footer", {+ }), /* @__PURE__ */ V("footer", {class: "geist-fieldset-footer","data-geist-fieldset-footer": !0,children: [- /* @__PURE__ */ B("button", {+ /* @__PURE__ */ V("button", {class: "geist-button primary",type: "submit",children: "保存"}),- /* @__PURE__ */ B("button", {+ /* @__PURE__ */ V("button", {class: "geist-button",type: "button",- onClick: () => void w("check"),- children: "检查已保存的连接"+ onClick: () => void O("check"),+ children: "检查连接"}),- e.accepts_cookie && a.cookie_saved && /* @__PURE__ */ B("button", {+ e.accepts_cookie && a.cookie_saved && /* @__PURE__ */ V("button", {class: "geist-button",type: "button",- onClick: () => void w("revoke"),+ onClick: () => void O("revoke"),children: "撤销 Cookie"})]@@ -1425,14 +1450,14 @@ function Bt({ source: e, toast: i }) {})});}-function Vt({ data: e, error: i, toast: a }) {- let [o, s] = R(""), [c, l] = R(!1), [u, d] = R(""), f = z(null);- Ie(() => r(f.current, c), [c]);- let p = z(new AbortController()), m = z(0);+function Wt({ data: e, error: r, toast: a }) {+ let [o, s] = z(""), [c, l] = z(!1), [u, d] = z(""), f = B(null);+ Le(() => i(f.current, c), [c]);+ let p = B(new AbortController()), m = B(0);async function h(e = !1) {let t = ++m.current;- await Lt({- read: (e) => Se("/api/scraping/cover", e),+ await zt({+ read: (e) => Ce("/api/scraping/cover", e),active: () => !p.current.signal.aborted && t === m.current,render: (t) => {l(t.status === "running"), t.status === "running" && (e = !1), t.status === "failed" && !e && d(t.error || "采集未取得"), t.status === "complete" && !e && a(t.result || "封面采集完成");@@ -1440,58 +1465,59 @@ function Vt({ data: e, error: i, toast: a }) {disconnected: () => d("连接中断,正在重新读取后台进度")});}- Fe(() => (h(!0), () => p.current.abort()), []);+ Ie(() => (h(!0), () => p.current.abort()), []);async function g() {if (!c) {m.current++, l(!0), d("");try {- await P("/api/scraping/cover", { code: o }, "POST", p.current.signal), await h();+ await F("/api/scraping/cover", { code: o }, "POST", p.current.signal), await h();} catch (e) {- p.current.signal.aborted || (l(!1), d(N(e)));+ p.current.signal.aborted || (l(!1), d(P(e)));}}}- return i ? /* @__PURE__ */ B("div", {+ return r ? /* @__PURE__ */ V("div", {role: "alert",- dangerouslySetInnerHTML: { __html: n(i, { variant: "error" }) }- }) : /* @__PURE__ */ B("div", {+ dangerouslySetInnerHTML: { __html: n(r, { variant: "error" }) }+ }) : /* @__PURE__ */ V("div", {class: "scraping-page",children: [- /* @__PURE__ */ B("p", { children: "高清来源可能需要代理。环境代理读取服务进程的代理环境变量;应用直连仍可能经过系统隧道。" }),- /* @__PURE__ */ B("p", { children: "封面采集保留最高可得画质,失败保留已有图片。连接检查不验证登录会话。" }),- /* @__PURE__ */ B("section", {+ /* @__PURE__ */ V("p", { children: "高清图片可能需要代理才能下载,请先检查连接。" }),+ /* @__PURE__ */ V("section", {class: "cleanupfieldset scraping-source","data-geist-fieldset": !0,- children: /* @__PURE__ */ B("div", {+ children: /* @__PURE__ */ V("div", {class: "geist-fieldset-content scraping-fields",children: [- /* @__PURE__ */ B("div", { dangerouslySetInnerHTML: { __html: t("scraping-cover", "高清封面") } }),- /* @__PURE__ */ B("form", {+ /* @__PURE__ */ V("div", { dangerouslySetInnerHTML: { __html: t("scraping-cover", "高清封面") } }),+ /* @__PURE__ */ V("form", {+ class: "scraping-cover-form",onSubmit: (e) => {e.preventDefault(), g();},- children: [/* @__PURE__ */ B("label", { children: ["馆藏番号", /* @__PURE__ */ B("input", {+ children: [/* @__PURE__ */ V("input", {class: "geist-input",+ "aria-label": "馆藏番号",required: !0,value: o,disabled: c,- placeholder: "ABW-232",+ placeholder: "输入馆藏番号,如 ABW-232",onInput: (e) => s(e.currentTarget.value)- })] }), /* @__PURE__ */ B("button", {+ }), /* @__PURE__ */ V("button", {ref: f,class: "geist-button primary",type: "submit",- children: "抓取或升级封面"+ children: "抓取封面"})]}),- u && /* @__PURE__ */ B("div", {+ u && /* @__PURE__ */ V("div", {role: "alert",dangerouslySetInnerHTML: { __html: n(u, { variant: "error" }) }})]})}),- e?.sources.map((e) => /* @__PURE__ */ B(Bt, {+ e?.sources.map((e) => /* @__PURE__ */ V(Ut, {source: e,toast: a}, e.source))@@ -1500,12 +1526,12 @@ function Vt({ data: e, error: i, toast: a }) {}//#endregion//#region src/state/index.ts-var Ht = { "quality-goals": {- refresh: Nt,- reset: Mt-} }, Ut = () => Object.keys(Ht);-async function Wt(e) {- let t = Ht[e];+var Gt = { "quality-goals": {+ refresh: Ft,+ reset: Pt+} }, Kt = () => Object.keys(Gt);+async function qt(e) {+ let t = Gt[e];if (!t) throw Error(`未登记的共享 store:${String(e)}`);try {return await t.refresh(), !0;@@ -1515,7 +1541,7 @@ async function Wt(e) {}//#endregion//#region src/sidebar.ts-function Gt(e) {+function Jt(e) {return ["/","/unseen",@@ -1525,34 +1551,34 @@ function Gt(e) {"/junk-files"].includes(e) || /^\/(item|mix|parts|editions)\//.test(e) || /^\/playlists\/\d+\/\d+$/.test(e) || /^\/(performers|studios|creators|series|agencies)\/.+/.test(e);}-function Kt(e, t) {+function Yt(e, t) {return e.dataset.surface === t && e.querySelector(".dnav") ? !1 : (e.dataset.surface = t, e.replaceChildren(), !0);}-function qt(e) {+function Xt(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/islands.ts-var Jt = {+var Zt = {scraping: {- load: zt,- component: Vt+ load: Vt,+ component: Wt},"quality-goals": {- load: Pt,- component: It+ load: It,+ component: Rt},configuration: {- load: Ye,- component: $e+ load: Xe,+ component: et}-}, Yt = () => Object.keys(Jt), $ = /* @__PURE__ */ new Map();-async function Xt(e, t, n, r = {}) {- let i = Jt[e];+}, Qt = () => Object.keys(Zt), $ = /* @__PURE__ */ new Map();+async function $t(e, t, n, r = {}) {+ let i = Zt[e];if (!i) throw Error(`未注册的 island:${String(e)}`);- Zt(t);+ en(t);let a = {controller: new AbortController(),painted: !1@@ -1568,7 +1594,7 @@ async function Xt(e, t, n, r = {}) {if (a.controller.signal.aborted) return;o = {data: null,- error: N(e)+ error: P(e)};}if ($.get(t) !== a) return;@@ -1581,11 +1607,11 @@ async function Xt(e, t, n, r = {}) {...n,...o};- ye(D(i.component, s), t);+ be(k(i.component, s), t);}-function Zt(e) {+function en(e) {let t = $.get(e);- t && (t.controller.abort(), $.delete(e), t.painted && ye(null, e));+ t && (t.controller.abort(), $.delete(e), t.painted && be(null, e));}//#endregion-export { Rt as followJobProgress, Yt as islandNames, Xt as mountIsland, Wt as refreshStore, Gt as sidebarHasCatalogContent, qt as sidebarTagCounts, Ut as storeNames, Kt as syncSidebarSurface, Zt as unmountIsland, Lt as watchJob };+export { Bt as followJobProgress, Qt as islandNames, $t as mountIsland, qt as refreshStore, Jt as sidebarHasCatalogContent, Xt as sidebarTagCounts, Kt as storeNames, Yt as syncSidebarSurface, en as unmountIsland, zt as watchJob };