Skip to content

armgit / peach

Public Imported from GitHub
0

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

fix(web): 统一设置控件与危险操作提示

longmeidao4dfb7751f7b0
diff --git a/docs/reference-snapshots/geist-settings.md b/docs/reference-snapshots/geist-settings.md
index 3f3988587..4c83b2ea7 100644
--- a/docs/reference-snapshots/geist-settings.md
+++ b/docs/reference-snapshots/geist-settings.md
@@ -18,3 +18,25 @@
## Peach 采用与差异
配置顺序为自启、媒体与挂载、网络代理、访问控制、检查更新、运行信息、卸载。代理容器选用 `min(320px,100%)`,这是 Peach 布局决定;菜单固定与触发器等宽并复用已有键盘及视口定位。代理地址标签使用既有 8px 间距。卸载区与确认按钮使用项目危险色;目录明细复用已有 Collapse,不使用原生瞬间展开。
+
+## 设置控件与风险审查
+
+2026-09-06 通过 HTTPX 读取官方页面。HTML SHA-256:
+
+- [Checkbox](https://vercel.com/geist/checkbox):`f72fd80f1e22766a824d1c42b5accbd42da73b144584b670074c700ee6ddee55`。
+- [Toggle](https://vercel.com/geist/toggle):`87efc6d9ccc986f5c3e4d3140e8cd9105d274a3a7c04f9bb870da694cbf737f4`。
+- [Note](https://vercel.com/geist/note):`f3471155164c8e0085419ce04e15928463cb526b4a52b51483c214fd84b645dc`。
+
+自启与静默启动复用共用 Toggle(36×20),保留显式「保存配置」。确认删除数据、关闭密码和附带扫描使用 Checkbox;框体 16px,几何依据 `vercel-geist-semantics-measured.md`。Peach 选项间距 16px、说明间距 8px,文字随窄屏换行。
+
+| 操作 | 风险呈现 | 依据 |
+| --- | --- | --- |
+| 卸载、删除空文件夹、删除已失效链接 | 红色区域及按钮 | 删除程序、目录或记录,应用内无完整恢复入口 |
+| 永久删除、清空回收站 | 保持已有红色按钮 | 永久删除媒体与账本记录 |
+| 网盘差异同步、清理孤立缓存 | 黄色区域与后果 Note,动作按钮中性 | 缺失条目进入回收站;缓存可重建 |
+| 关闭访问密码 | 选中后黄色区域与访问范围 Note | 改变访问条件,保存前说明后果 |
+| 扫描、检查、挂载、浏览、恢复、选择媒体路径 | 中性 | 读取、导航、恢复或可撤销配置 |
+| 垃圾与重复文件移入回收站 | 保持可恢复操作及确认 | 不等同永久删除 |
+| 删除播放列表、取消关注、清除来源凭据 | 保持既有危险按钮和作用范围确认 | 删除所选集合、订阅或凭据,不按存储来源着色 |
+
+危险区域共用 `data-fieldset-type` 选择器,置于基础 Fieldset 规则之后;浏览器验收须检查实际底栏颜色,源代码包含红色声明不能证明层叠结果。
diff --git a/frontend/src/islands/access-settings.tsx b/frontend/src/islands/access-settings.tsx
index 31e861761..74a591316 100644
--- a/frontend/src/islands/access-settings.tsx
+++ b/frontend/src/islands/access-settings.tsx
@@ -1,7 +1,7 @@
/** 本机访问密码;表单值只留在提交期间的组件内存中。 */
import { useRef, useState } from 'preact/hooks';
import type { JSX } from 'preact';
-import { fieldsetTitle, setActionBusy } from '@peach/legacy/ui';
+import { fieldsetTitle, setActionBusy, noteHtml } from '@peach/legacy/ui';
import { ApiError, apiSend, errorMessage } from '../api';
export interface AccessState { mode: 'open' | 'password' | 'legacy' | 'locked'; revision: string }
@@ -60,7 +60,7 @@ export function AccessSettings({ initial, receipt }: { initial: AccessState; rec
}
finally { busy.current = false; setActionBusy(button.current, false); }
};
- return <form class="configfieldset" onSubmit={submit} aria-labelledby="accessTitle" noValidate ref={form}>
+ return <form class="configfieldset" data-fieldset-type={disable ? 'warning' : undefined} onSubmit={submit} aria-labelledby="accessTitle" noValidate ref={form}>
<div class="geist-fieldset-content">
<div class="configfieldset-heading">
<div dangerouslySetInnerHTML={{ __html: fieldsetTitle('accessTitle', '访问密码') }} />
@@ -72,6 +72,7 @@ export function AccessSettings({ initial, receipt }: { initial: AccessState; rec
<PasswordField id="access-confirm" label="确认访问密码" value={confirmation} onInput={setConfirmation} error={fields.confirmation} />
</> : null}
{state.mode === 'password' || state.mode === 'legacy' ? <label class="configcheck"><span class="pcheck"><input type="checkbox" checked={disable} onChange={(event) => setDisable(event.currentTarget.checked)} /><span aria-hidden="true"><svg viewBox="0 0 24 24"><use href="#i-check" /></svg></span></span><span>关闭访问密码,允许能连接到 Peach 的设备直接访问</span></label> : null}
+ {disable && <div dangerouslySetInnerHTML={{__html:noteHtml('保存后,能连接到 Peach 的设备将直接访问馆藏。',{variant:'warning',label:'访问范围'})}} />}
{error ? <p class="configbad" role="alert">{error}</p> : null}
</div>
{state.mode !== 'locked' ? <div class="geist-fieldset-footer"><p>保存后立即生效。</p><button class="geist-button primary" type="submit" ref={button}>保存配置</button></div> : null}
diff --git a/frontend/src/islands/desktop-settings.tsx b/frontend/src/islands/desktop-settings.tsx
index 487dc953e..a9ca95e49 100644
--- a/frontend/src/islands/desktop-settings.tsx
+++ b/frontend/src/islands/desktop-settings.tsx
@@ -11,6 +11,10 @@ function SettingCheck({ label, checked, disabled, change }: { label:string; chec
<span aria-hidden="true"><svg viewBox="0 0 24 24"><use href="#i-check" /></svg></span></span><span>{label}</span></label>;
}
+function SettingToggle({ label, checked, disabled, change }: { label:string; checked:boolean; disabled:boolean; change(value:boolean):void }) {
+ return <label class="configtoggle"><span>{label}</span><input class="ptoggle" type="checkbox" role="switch" checked={checked} disabled={disabled} onChange={event=>change(event.currentTarget.checked)} /></label>;
+}
+
export function StartupSettings({ startup, receipt }: { startup: StartupState; receipt(message: string): void }) {
const [enabled,setEnabled] = useState(startup.enabled);
const [silent,setSilent] = useState(startup.silent);
@@ -28,13 +32,15 @@ export function StartupSettings({ startup, receipt }: { startup: StartupState; r
<form class="configfieldset" data-geist-fieldset onSubmit={event=>{event.preventDefault();void save();}}>
<div class="geist-fieldset-content">
<div dangerouslySetInnerHTML={{__html:fieldsetTitle('startupTitle','开机自启')}} />
- <SettingCheck label="开机后启动 Peach" checked={enabled} disabled={!startup.available} change={setEnabled} />
- <SettingCheck label="静默启动" checked={silent} disabled={!startup.available} change={setSilent} />
- <p class="confighelp">静默启动仅显示托盘;关闭后自动打开浏览器。</p>
+ <div class="configoptions" role="group" aria-labelledby="startupTitle">
+ <SettingToggle label="开机后启动 Peach" checked={enabled} disabled={!startup.available} change={setEnabled} />
+ <div class="configoption"><SettingToggle label="静默启动" checked={silent} disabled={!startup.available} change={setSilent} />
+ <p class="confighelp">静默启动仅显示托盘。</p></div>
+ </div>
{startup.message && <p class="confighelp">{startup.message}</p>}
{error && <p class="configbad" role="alert">{error}</p>}
</div>
- <footer class="geist-fieldset-footer" data-geist-fieldset-footer><button ref={button} type="submit" class="geist-button primary" disabled={!startup.available}>保存自启</button></footer>
+ <footer class="geist-fieldset-footer" data-geist-fieldset-footer><button ref={button} type="submit" class="geist-button primary" disabled={!startup.available}>保存配置</button></footer>
</form>
);
}
diff --git a/frontend/test/access-settings.test.tsx b/frontend/test/access-settings.test.tsx
index 0c3dd9e96..87eea34e7 100644
--- a/frontend/test/access-settings.test.tsx
+++ b/frontend/test/access-settings.test.tsx
@@ -16,6 +16,8 @@ it('系统口令可直接转为可选密码且关闭需要明确提交', async (
const toggle = host.querySelector<HTMLInputElement>('[type="checkbox"]')!;
toggle.checked = true; toggle.dispatchEvent(new Event('change', { bubbles: true })); await settle();
expect(host.querySelector('[autocomplete="new-password"]')).toBeNull();
+ expect(host.querySelector('form')?.getAttribute('data-fieldset-type')).toBe('warning');
+ expect(host.querySelector('.geist-note-warning')?.textContent).toContain('直接访问馆藏');
expect(fetcher).not.toHaveBeenCalled();
host.querySelector('form')!.dispatchEvent(new Event('submit', { cancelable: true })); await settle();
expect(JSON.parse((fetcher.mock.calls[0] as unknown as [string, RequestInit])[1].body as string)).toMatchObject({ action: 'disable', confirm_disable: true });
diff --git a/frontend/test/desktop-settings.test.tsx b/frontend/test/desktop-settings.test.tsx
index a3bd24f5b..d34bfbef5 100644
--- a/frontend/test/desktop-settings.test.tsx
+++ b/frontend/test/desktop-settings.test.tsx
@@ -17,6 +17,9 @@ it('自启保存实际选项,卸载默认保留数据',async()=>{
await act(async()=>render(<><StartupSettings startup={{available:true,enabled:false,silent:true,message:''}} receipt={()=>{}} />
<UninstallSettings uninstall={{available:true,full_available:true,message:'',data_root:'fixture',directories:[]}} /></>,host));
const boxes=host.querySelectorAll<HTMLInputElement>('input');
+ expect(host.querySelectorAll('[role="switch"]')).toHaveLength(2);
+ expect(host.querySelector('form button')?.textContent).toBe('保存配置');
+ expect(fetch).not.toHaveBeenCalled();
expect(boxes[2]!.checked).toBe(false);
expect(host.querySelector('[data-fieldset-type=error]')).not.toBeNull();
const summary=host.querySelector('summary')!;
diff --git a/tests/test_desktop_settings.py b/tests/test_desktop_settings.py
index 90c0ee9ce..58f316656 100644
--- a/tests/test_desktop_settings.py
+++ b/tests/test_desktop_settings.py
@@ -21,11 +21,23 @@ class DesktopSettingsTests(unittest.TestCase):
page = configuration[configuration.index('export function Configuration('):]
self.assertEqual(sorted(names, key=page.index), names)
css = (root / 'web/css/23-configuration.css').read_text(encoding='utf-8')
- self.assertIn('.configdanger{border-color:var(--drop)}', css)
- self.assertIn('.configdanger>.geist-fieldset-footer', css)
+ self.assertIn('[data-fieldset-type="error"]{border-color:var(--drop)}', css)
+ self.assertGreater(css.index('[data-fieldset-type="error"]>:is('), css.index('.configfieldset>.geist-fieldset-footer{'))
self.assertIn('.configselect{width:min(320px,100%)}', css)
self.assertIn('.configdirectories .fcollapsebody{padding:12px 4px 4px}', css)
+ def test_cleanup_risk_colors_follow_the_operation_effect(self):
+ root = Path(__file__).resolve().parents[1]
+ app = (root / 'web/app.js').read_text(encoding='utf-8')
+ links = app[app.index('function linkManagerMarkup'):app.index('function resourceSyncMarkup')]
+ sync = app[app.index('function resourceSyncMarkup'):app.index('async function openTaste')]
+ self.assertIn('data-fieldset-type="error"', links)
+ self.assertIn('data-fieldset-type="warning"', sync)
+ self.assertIn("variant:'warning',label:'同步影响'", sync)
+ self.assertIn('class="resourceaction" type="button" id="resourceApply"', sync)
+ self.assertNotIn('class="resourceaction resourcedanger" type="button" id="resourceApply"', sync)
+ self.assertIn('cleanupemptyfolders" data-geist-fieldset data-fieldset-type="error"', app)
+
def setUp(self):
temporary = tempfile.TemporaryDirectory()
self.addCleanup(temporary.cleanup)
diff --git a/tests/test_web_ui.py b/tests/test_web_ui.py
index 088dc60d4..efea567be 100644
--- a/tests/test_web_ui.py
+++ b/tests/test_web_ui.py
@@ -351,7 +351,7 @@ class WebUiSourceTests(unittest.TestCase):
":focus", # 焦点环::focus / :focus-visible / :focus-within
".geist-progress", ".watchprogress", ".vjs-play-progress", ".vjs-progress-holder",
".trace .bar", ".tokbar", # 进度与数据
- ":is(#censorSetting,#detailAutoplaySetting):checked", # Toggle 开态:Geist Toggle 实测轨道 rgb(0,112,243)
+ ":is(#censorSetting,#detailAutoplaySetting,.ptoggle):checked", # Toggle 开态:Geist Toggle 实测轨道 rgb(0,112,243)
".entitylink", ".flink", ".fsourcelink", ".fcred a", ".tokauthor>a", ".confighelp a", ".taste-history-guide-content a", # 真正的链接
)
@@ -5784,8 +5784,8 @@ class WebUiSourceTests(unittest.TestCase):
self.assertNotIn("box-shadow:0 8px 32px -12px", self.css, "浮层靠发丝线不靠投影")
# 布尔开关是 Geist 中号 Toggle(36×20 轨道 + 17px 圆点),不是原生复选框;
# Geist 的 Switch 是分段选择器,别用错控件。
- self.assertPageContains(":is(#censorSetting,#detailAutoplaySetting){appearance:none;-webkit-appearance:none;width:36px;height:20px;flex:none;")
- self.assertPageContains(":is(#censorSetting,#detailAutoplaySetting):checked{background:var(--tungsten)}")
+ self.assertPageContains(":is(#censorSetting,#detailAutoplaySetting,.ptoggle){appearance:none;-webkit-appearance:none;width:36px;height:20px;flex:none;")
+ self.assertPageContains(":is(#censorSetting,#detailAutoplaySetting,.ptoggle):checked{background:var(--tungsten)}")
# 没有直接证据的 command-menu 入场动画与无有效高度约束的复核卡
# Scroller 不应继续作为「Vercel 对齐」进入产品。
self.assertPageLacks("animation:panel-in")
diff --git a/web/app.js b/web/app.js
index e66733ea6..be4ae5547 100644
--- a/web/app.js
+++ b/web/app.js
@@ -3057,7 +3057,7 @@ async function wireLinkManager(){
const apply=(done&&(payload.gone||[]).length)?`<div class="resourceapplyrow"><p>删除前会逐条重验一次;此操作不可撤销。</p>
<button class="resourceaction resourcedanger" type="button" id="linkPrune">删除 ${payload.gone.length} 条失效链接</button></div>`:'';
const clean=(done&&!(payload.gone||[]).length&&!(payload.unclear||[]).length)?'<p class="resourcesyncok">全部链接都能打开。</p>':'';
- result.innerHTML=`<div class="resourcepanel">${progress}${gone}${unclear}${apply}${clean}</div>`;
+ result.innerHTML=`<div class="resourcepanel"${apply?' data-fieldset-type="error"':''}>${progress}${gone}${unclear}${apply}${clean}</div>`;
$('#linkPrune')?.addEventListener('click',async event=>{
const control=event.currentTarget;
if(!confirm(`删除 ${payload.gone.length} 条已失效链接?删除前会逐条重验,但删除本身不可撤销。`))return;
@@ -3114,13 +3114,14 @@ async function wireResourceSync(){
const sources=payload.sources||[];
const cache=payload.cache||{files:0,bytes:0};
const hasChanges=Boolean(payload.missing||cache.files);
- result.innerHTML=`<div class="resourcepanel"><div class="resourcesources">${sources.map(source=>`<article>
+ result.innerHTML=`<div class="resourcepanel"${hasChanges?' data-fieldset-type="warning"':''}><div class="resourcesources">${sources.map(source=>`<article>
<div class="resourcesourcetitle"><b>${esc(LOC[source.location]||source.location)}</b><span class="${source.online?'online':'offline'}">${source.online?'已挂载':'离线,已跳过'}</span></div>
<strong>${source.online?source.missing.toLocaleString():'—'}</strong>
<small>${source.online?`项已从网盘删除 · 已核对 ${source.checked.toLocaleString()} 项${source.unreadable?` · ${source.unreadable.toLocaleString()} 项暂时无法读取`:''}`:`本地数据库有 ${source.total.toLocaleString()} 项`}</small></article>`).join('')}</div>
<div class="resourcecache"><div><span>孤立缓存</span><b>${cache.files.toLocaleString()}</b><small>${fmtSize(cache.bytes||0)}</small></div>
<div><span>待同步</span><b>${Number(payload.missing||0).toLocaleString()} 项</b></div></div>
- <div class="resourceapplyrow">${hasChanges?`<button class="resourceaction resourcedanger" type="button" id="resourceApply">同步并清理</button>`:
+ ${hasChanges?noteHtml(`将把 ${payload.missing||0} 项移入回收站,并删除 ${cache.files||0} 个可重建缓存。`,{variant:'warning',label:'同步影响'}):''}
+ <div class="resourceapplyrow">${hasChanges?`<button class="resourceaction" type="button" id="resourceApply">同步并清理</button>`:
'<p class="resourcesyncok">本地数据库与已挂载网盘一致,没有孤立缓存。</p>'}</div></div>`;
$('#resourceApply')?.addEventListener('click',async event=>{
const button=event.currentTarget;
@@ -3526,7 +3527,7 @@ async function openDataCleanup(push=true){
<p class="cleanupmeta">${Number(duplicates.total||0)?`可回收 ${fmtSize(duplicates.reclaimable||0)}`:''}</p></div>
<footer class="geist-fieldset-footer" data-geist-fieldset-footer><button type="button" data-cleanup-open="duplicates">查看重复文件</button></footer>
</section>
- <section class="cleanupfieldset cleanupemptyfolders" data-geist-fieldset aria-labelledby="cleanupEmptyTitle">
+ <section class="cleanupfieldset cleanupemptyfolders" data-geist-fieldset data-fieldset-type="error" aria-labelledby="cleanupEmptyTitle">
<div class="geist-fieldset-content">${fieldsetTitle('cleanupEmptyTitle','空文件夹')}
<strong>${online.length.toLocaleString()} 个来源可扫描</strong>
<p class="cleanupmeta">${sourceLine}</p><p class="cleanupstate" aria-live="polite"></p></div>
diff --git a/web/css/16-settings.css b/web/css/16-settings.css
index 803f1ecf6..970730f2a 100644
--- a/web/css/16-settings.css
+++ b/web/css/16-settings.css
@@ -40,14 +40,14 @@ body.settings-open{overflow:hidden}
/* 布尔开关用 Geist Toggle 而不是原生复选框(取证 vercel-geist-semantics-measured.md):
中号 36×20 轨道 + 17px 圆点,关 = 灰轨道圆点靠左,开 = 主题蓝圆点靠右;
Geist 的「Switch」是分段选择器(radio 语义),布尔开关的正确控件叫 Toggle。 */
-:is(#censorSetting,#detailAutoplaySetting){appearance:none;-webkit-appearance:none;width:36px;height:20px;flex:none;
+:is(#censorSetting,#detailAutoplaySetting,.ptoggle){appearance:none;-webkit-appearance:none;width:36px;height:20px;flex:none;
border-radius:var(--pill-radius);background:var(--line);position:relative;cursor:pointer;margin:0;
transition:background-color .15s ease}
-:is(#censorSetting,#detailAutoplaySetting)::after{content:'';position:absolute;top:1.5px;left:2px;width:17px;height:17px;
+:is(#censorSetting,#detailAutoplaySetting,.ptoggle)::after{content:'';position:absolute;top:1.5px;left:2px;width:17px;height:17px;
border-radius:50%;background:rgba(237,237,237,.84);transition:left .15s ease}
-:is(#censorSetting,#detailAutoplaySetting):checked{background:var(--tungsten)}
-:is(#censorSetting,#detailAutoplaySetting):checked::after{left:17px}
-:is(#censorSetting,#detailAutoplaySetting):focus-visible{outline:2px solid var(--tungsten);outline-offset:2px}
+:is(#censorSetting,#detailAutoplaySetting,.ptoggle):checked{background:var(--tungsten)}
+:is(#censorSetting,#detailAutoplaySetting,.ptoggle):checked::after{left:17px}
+:is(#censorSetting,#detailAutoplaySetting,.ptoggle):focus-visible{outline:2px solid var(--tungsten);outline-offset:2px}
/* 主题选择器是 Geist 里唯一给选中项加环的控件:三档的底色和它坐着的面板同色,
光靠填充分不出当前是哪一档。几何按 2026-09-04 实测 vercel.com 的 system/light/dark
三枚圆形按钮:外框是 32px 高、无填充的胶囊加一圈 1px 环,每档 32×32 正圆、图标 16px,
@@ -77,3 +77,6 @@ body.settings-open{overflow:hidden}
.settingrow:has(input[type="checkbox"]){grid-template-columns:minmax(0,1fr) auto;gap:12px}
.settingrow .gselect{width:100%;min-width:0}.settingrow .pcheck{justify-self:start}}
.sidebaradd .sidebaraddmenu button{justify-items:start}
+
+.ptoggle:disabled{background:var(--surface);cursor:not-allowed}
+.ptoggle:disabled::after{background:var(--muted)}
diff --git a/web/css/19-immersive.css b/web/css/19-immersive.css
index 40d8b23ae..0a8cf5986 100644
--- a/web/css/19-immersive.css
+++ b/web/css/19-immersive.css
@@ -232,13 +232,14 @@
悬停只抬填充不提边,与按钮同口径。 */
.pcheck{position:relative;display:grid;place-items:center;width:20px;height:20px;flex:none;cursor:pointer}
.pcheck input{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none}
-.pcheck>span{width:18px;height:18px;border:1px solid var(--border-15);border-radius:var(--badge-radius);
+.pcheck>span{box-sizing:border-box;width:16px;height:16px;border:1px solid var(--border-15);border-radius:var(--badge-radius);
display:grid;place-items:center;background:var(--ground);color:transparent;transition:.14s ease}
.pcheck>span svg{display:block;width:13px;height:13px;stroke:currentColor;fill:none;stroke-width:2.5}
.pcheck:hover>span,label:hover>.pcheck>span{background:var(--hover)}
.pcheck input:checked+span{border-color:var(--ink-2);color:var(--ink)}
.pcheck input:focus-visible+span{outline:2px solid var(--tungsten);outline-offset:2px}
-.pcheck input:disabled+span{cursor:not-allowed;opacity:.55}
+.pcheck input:disabled+span{cursor:not-allowed;border-color:var(--line)}
+.pcheck input:disabled:checked+span{color:var(--muted)}
.pcheck:has(input:disabled){cursor:not-allowed}
.pcheck:has(input:disabled)>span{background:var(--ground)}
/* 取景:正封模式下,整张封套要把镜头推到右半边;本身就是竖版正封的则整张用;
@@ -264,4 +265,3 @@
还压住旁边的「发行时间」。`.sorts button` 早就有 `flex:0 0 auto`,但 fieldset 不是
button,那条规则选不到它。 */
.sorts .javlayout{display:inline-flex;gap:2px;margin:0 6px;flex:none}
-
diff --git a/web/css/22-followmanage.css b/web/css/22-followmanage.css
index b01487840..fc5fee0b6 100644
--- a/web/css/22-followmanage.css
+++ b/web/css/22-followmanage.css
@@ -292,9 +292,9 @@ details.fcred{display:block;min-width:0}
.fcredactions button:hover:not(:disabled){background:color-mix(in srgb,var(--ink) 88%,var(--ground));
border-color:color-mix(in srgb,var(--ink) 88%,var(--ground));color:var(--ground)}
.fcredactions button:disabled{background:var(--sunk);border-color:var(--line-soft);color:var(--muted);cursor:default}
-.fcredactions button.fquiet{background:transparent;border-color:var(--border-15);
- color:var(--muted)}
+.fcredactions button.fquiet{background:var(--drop);border-color:var(--drop);color:#fff}
.fcredactions button.fquiet:hover{background:var(--drop);border-color:var(--drop);color:#fff}
+.fcredactions button.fquiet:disabled{background:var(--surface);border-color:var(--line);color:var(--muted)}
.fcredactions [data-cred-state]{font-size:var(--fs-xs);color:var(--muted)}
@media (max-width:640px){
diff --git a/web/css/23-configuration.css b/web/css/23-configuration.css
index 4a38ef5b7..177222dfa 100644
--- a/web/css/23-configuration.css
+++ b/web/css/23-configuration.css
@@ -8,8 +8,6 @@
border:1px solid var(--line);border-radius:var(--control-radius);background:var(--ground)}
.configfieldset>.geist-fieldset-content{flex:1;min-height:0;padding:20px;display:grid;gap:20px}
.configfieldset .geist-fieldset-title{margin:0}
-.configdanger{border-color:var(--drop)}
-.configdanger>.geist-fieldset-footer{border-top-color:var(--drop);background:color-mix(in srgb,var(--drop) 7%,var(--ground))}
.configfieldset button.danger,.geist-modal button.danger{background:var(--drop);border-color:var(--drop);color:#fff}
.configfieldset button.danger:hover:not(:disabled),.geist-modal button.danger:hover:not(:disabled){background:color-mix(in srgb,var(--drop) 88%,#000);border-color:var(--drop);color:#fff}
.configfieldset button.danger:disabled{background:var(--surface);border-color:var(--line);color:var(--muted)}
@@ -57,7 +55,21 @@
.configsourcecontrol .gselectfield{padding-inline:14px}
.configsource .geist-input{width:100%;box-sizing:border-box}
.configsource select.geist-input{appearance:none;padding-right:42px;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%23888' stroke-width='1.5'/%3E%3C/svg%3E");background-repeat:no-repeat;background-size:16px;background-position:right 14px center}
-.configcheck{display:flex;align-items:center;gap:12px;min-height:32px;cursor:pointer;color:var(--ink)}
+.configcheck{display:flex;align-items:flex-start;gap:8px;min-height:32px;cursor:pointer;color:var(--ink);font-size:var(--fs-sm);line-height:20px}
+.configoptions{display:grid;gap:16px}
+.configoption{display:grid;gap:8px}
+.configoption>.confighelp{margin:0}
+.configtoggle{display:flex;align-items:center;justify-content:space-between;gap:16px;min-height:32px;font-size:var(--fs-sm);cursor:pointer}
+.configtoggle:has(:disabled),.configcheck:has(:disabled){cursor:not-allowed;color:var(--muted)}
+.configtoggle>span{min-width:0}
+[data-fieldset-type="error"]{border-color:var(--drop)}
+[data-fieldset-type="warning"]{border-color:var(--meter)}
+.resourcepanel>.geist-note{margin:16px 20px}
+[data-fieldset-type="error"]>:is(.geist-fieldset-footer,.resourceapplyrow){border-top-color:var(--drop);background:color-mix(in srgb,var(--drop) 7%,var(--ground))}
+[data-fieldset-type="warning"]>:is(.geist-fieldset-footer,.resourceapplyrow){border-top-color:var(--meter);background:color-mix(in srgb,var(--meter) 7%,var(--ground))}
+[data-fieldset-type="error"] button:is(.danger,.resourcedanger){background:var(--drop);border-color:var(--drop);color:#fff}
+[data-fieldset-type="error"] button:is(.danger,.resourcedanger):hover:not(:disabled){background:color-mix(in srgb,var(--drop) 88%,#000);border-color:var(--drop);color:#fff}
+[data-fieldset-type="error"] button:is(.danger,.resourcedanger):disabled{background:var(--surface);border-color:var(--line);color:var(--muted)}
.configfacts{margin:0;display:grid;grid-template-columns:max-content minmax(0,1fr);gap:10px 24px;align-items:baseline}
.configfacts dt{color:var(--muted);font-size:var(--fs-sm)}.configfacts dd{margin:0;overflow-wrap:anywhere}
.configfacts dt .gselectmark{vertical-align:-3px;margin-inline-end:8px}
diff --git a/web/dist/peach-ui.js b/web/dist/peach-ui.js
index 99ca27573..44df4eb84 100644
--- a/web/dist/peach-ui.js
+++ b/web/dist/peach-ui.js
@@ -1,21 +1,21 @@
import { MEDIA_SOURCE_ICONS as e, badgeHtml as t, checkboxHtml as n, confirmModal as r, emptyStateHtml as i, fieldsetTitle as a, loadingDotsHtml as o, noteHtml as s, progressHtml as c, selectFieldHtml as l, selectOptionIconHtml as u, setActionBusy as d, wireCollapse as f, wireSelectField as p } from "/js/ui-components.js";
import { LOC as m, fmtDur as h, fmtSize as g, icon as _ } from "/js/core.js";
//#region node_modules/preact/dist/preact.module.js
-var v, y, b, x, S, C, w, T, E, D, O, k, A, ee, te, j = {}, ne = [], re = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, ie = Array.isArray;
-function M(e, t) {
+var v, y, b, x, S, C, w, T, E, D, O, k, A, ee, te, j = {}, M = [], ne = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, re = Array.isArray;
+function N(e, t) {
for (var n in t) e[n] = t[n];
return e;
}
-function ae(e) {
+function ie(e) {
e && e.parentNode && e.parentNode.removeChild(e);
}
-function oe(e, t, n) {
+function ae(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 ? v.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 se(e, o, r, i, null);
+ return oe(e, o, r, i, null);
}
-function se(e, t, n, r, i) {
+function oe(e, t, n, r, i) {
var a = {
type: e,
props: t,
@@ -33,62 +33,62 @@ function se(e, t, n, r, i) {
};
return i == null && y.vnode != null && y.vnode(a), a;
}
-function N(e) {
+function P(e) {
return e.children;
}
-function ce(e, t) {
+function se(e, t) {
this.props = e, this.context = t;
}
-function P(e, t) {
- if (t == null) return e.__ ? P(e.__, e.__i + 1) : null;
+function F(e, t) {
+ if (t == null) return e.__ ? F(e.__, e.__i + 1) : null;
for (var n; t < e.__k.length; t++) if ((n = e.__k[t]) != null && n.__e != null) return n.__e;
- return typeof e.type == "function" ? P(e) : null;
+ return typeof e.type == "function" ? F(e) : null;
}
-function le(e) {
+function ce(e) {
if (e.__P && e.__d) {
- var t = e.__v, n = t.__e, r = [], i = [], a = M({}, t);
- a.__v = t.__v + 1, y.vnode && y.vnode(a), be(e.__P, a, t, e.__n, e.__P.namespaceURI, 32 & t.__u ? [n] : null, r, n ?? P(t), !!(32 & t.__u), i), a.__v = t.__v, a.__.__k[a.__i] = a, Se(r, a, i), t.__e = t.__ = null, a.__e != n && ue(a);
+ var t = e.__v, n = t.__e, r = [], i = [], a = N({}, t);
+ a.__v = t.__v + 1, y.vnode && y.vnode(a), ye(e.__P, a, t, e.__n, e.__P.namespaceURI, 32 & t.__u ? [n] : null, r, n ?? F(t), !!(32 & t.__u), i), a.__v = t.__v, a.__.__k[a.__i] = a, xe(r, a, i), t.__e = t.__ = null, a.__e != n && le(a);
}
}
-function ue(e) {
+function le(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;
- }), ue(e);
+ }), le(e);
}
-function de(e) {
- (!e.__d && (e.__d = !0) && S.push(e) && !fe.__r++ || C != y.debounceRendering) && ((C = y.debounceRendering) || w)(fe);
+function ue(e) {
+ (!e.__d && (e.__d = !0) && S.push(e) && !de.__r++ || C != y.debounceRendering) && ((C = y.debounceRendering) || w)(de);
}
-function fe() {
+function de() {
try {
- for (var e, t = 1; S.length;) S.length > t && S.sort(T), e = S.shift(), t = S.length, le(e);
+ for (var e, t = 1; S.length;) S.length > t && S.sort(T), e = S.shift(), t = S.length, ce(e);
} finally {
- S.length = fe.__r = 0;
+ S.length = de.__r = 0;
}
}
-function pe(e, t, n, r, i, a, o, s, c, l, u) {
- var d, f, p, m, h, g, _ = r && r.__k || ne, v = t.length;
- for (c = me(n, t, _, c, v), d = 0; d < v; d++) (p = n.__k[d]) != null && (f = p.__i != -1 && _[p.__i] || j, p.__i = d, g = be(e, p, f, i, a, o, s, c, l, u), m = p.__e, p.ref && f.ref != p.ref && (f.ref && Te(f.ref, null, p), u.push(p.ref, p.__c || m, p)), h == null && m != null && (h = m), 4 & p.__u ? (c = he(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 fe(e, t, n, r, i, a, o, s, c, l, u) {
+ var d, f, p, m, h, g, _ = r && r.__k || M, v = t.length;
+ for (c = pe(n, t, _, c, v), d = 0; d < v; d++) (p = n.__k[d]) != null && (f = p.__i != -1 && _[p.__i] || j, p.__i = d, g = ye(e, p, f, i, a, o, s, c, l, u), m = p.__e, p.ref && f.ref != p.ref && (f.ref && we(f.ref, null, p), u.push(p.ref, p.__c || m, p)), h == null && m != null && (h = m), 4 & p.__u ? (c = me(p, c, e), f.__e && (f.__e = null)) : typeof p.type == "function" && g !== void 0 ? c = g : m && (c = m.nextSibling), p.__u &= -7);
return n.__e = h, c;
}
-function me(e, t, n, r, i) {
+function pe(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] = se(null, o, null, null, null) : ie(o) ? o = e.__k[a] = se(N, { children: o }, null, null, null) : o.constructor === void 0 && o.__b > 0 ? o = e.__k[a] = se(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 = ge(o, n, c, d)) != -1 && (d--, (s = n[l]) && (s.__u |= 2)), s == null || s.__v == null ? (l == -1 && (i > u ? f-- : i < u && f++), typeof o.type != "function" && (o.__u |= 4)) : l != c && (l == c - 1 ? f-- : l == c + 1 ? f++ : (l > c ? f-- : f++, o.__u |= 4))) : e.__k[a] = null;
- if (d) for (a = 0; a < u; a++) (s = n[a]) != null && !(2 & s.__u) && (s.__e == r && (r = P(s)), Ee(s, s));
+ for (e.__k = Array(i), a = 0; a < i; a++) (o = t[a]) != null && typeof o != "boolean" && typeof o != "function" ? (typeof o == "string" || typeof o == "number" || typeof o == "bigint" || o.constructor == String ? o = e.__k[a] = oe(null, o, null, null, null) : re(o) ? o = e.__k[a] = oe(P, { children: o }, null, null, null) : o.constructor === void 0 && o.__b > 0 ? o = e.__k[a] = oe(o.type, o.props, o.key, o.ref ? o.ref : null, o.__v) : e.__k[a] = o, c = a + f, o.__ = e, o.__b = e.__b + 1, s = null, (l = o.__i = he(o, n, c, d)) != -1 && (d--, (s = n[l]) && (s.__u |= 2)), s == null || s.__v == null ? (l == -1 && (i > u ? f-- : i < u && f++), typeof o.type != "function" && (o.__u |= 4)) : l != c && (l == c - 1 ? f-- : l == c + 1 ? f++ : (l > c ? f-- : f++, o.__u |= 4))) : e.__k[a] = null;
+ if (d) for (a = 0; a < u; a++) (s = n[a]) != null && !(2 & s.__u) && (s.__e == r && (r = F(s)), Te(s, s));
return r;
}
-function he(e, t, n) {
+function me(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 = he(r[i], t, n));
+ for (r = e.__k, i = 0; r && i < r.length; i++) r[i] && (r[i].__ = e, t = me(r[i], t, n));
return t;
}
- e.__e != t && (t && e.type && !t.parentNode && (t = P(e)), t = n.insertBefore(e.__e, t || null));
+ e.__e != t && (t && e.type && !t.parentNode && (t = F(e)), t = n.insertBefore(e.__e, t || null));
do
t &&= t.nextSibling;
while (t != null && t.nodeType == 8);
return t;
}
-function ge(e, t, n, r) {
+function he(e, t, n, r) {
var i, a, o, s = e.key, c = e.type, l = t[n], u = l != null && !(2 & l.__u);
if (l === null && s == null || u && s == l.key && c == l.type) return n;
if (r > +!!u) {
@@ -96,16 +96,16 @@ function ge(e, t, n, r) {
}
return -1;
}
-function _e(e, t, n) {
- t[0] == "-" ? e.setProperty(t, n ?? "") : e[t] = n == null ? "" : typeof n != "number" || re.test(t) ? n : n + "px";
+function ge(e, t, n) {
+ t[0] == "-" ? e.setProperty(t, n ?? "") : e[t] = n == null ? "" : typeof n != "number" || ne.test(t) ? n : n + "px";
}
-function ve(e, t, n, r, i) {
+function _e(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 || _e(e.style, t, "");
- if (n) for (t in n) r && n[t] == r[t] || _e(e.style, t, n[t]);
+ if (typeof r == "string" && (e.style.cssText = r = ""), r) for (t in r) n && t in n || ge(e.style, t, "");
+ if (n) for (t in n) r && n[t] == r[t] || ge(e.style, t, n[t]);
}
} else if (t[0] == "o" && t[1] == "n") a = t != (t = t.replace(k, "$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[O] = r[O] : (n[O] = A, e.addEventListener(t, a ? te : ee, a)) : e.removeEventListener(t, a ? te : ee, a);
else {
@@ -117,7 +117,7 @@ function ve(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 ye(e) {
+function ve(e) {
return function(t) {
if (this.l) {
var n = this.l[t.type + e];
@@ -127,47 +127,47 @@ function ye(e) {
}
};
}
-function be(e, t, n, r, i, a, o, s, c, l) {
+function ye(e, t, n, r, i, a, o, s, c, l) {
var u, d, f, p, m, h, g, _, v, b, x, S, C, w, T, E, D = t.type;
if (t.constructor !== void 0) return null;
128 & n.__u && (c = !!(32 & n.__u), a = [s = t.__e = n.__e]), (u = y.__b) && u(t);
n: if (typeof D == "function") {
d = o.length;
try {
- if (v = t.props, b = D.prototype && D.prototype.render, x = (u = D.contextType) && r[u.__c], S = u ? x ? x.props.value : u.__ : r, n.__c ? _ = (f = t.__c = n.__c).__ = f.__E : (b ? t.__c = f = new D(v, S) : (t.__c = f = new ce(v, S), f.constructor = D, f.render = De), x && x.sub(f), f.state || (f.state = {}), f.__n = r, p = f.__d = !0, f.__h = [], f._sb = []), b && f.__s == null && (f.__s = f.state), b && D.getDerivedStateFromProps != null && (f.__s == f.state && (f.__s = M({}, f.__s)), M(f.__s, D.getDerivedStateFromProps(v, f.__s))), m = f.props, h = f.state, f.__v = t, p) b && D.getDerivedStateFromProps == null && f.componentWillMount != null && f.componentWillMount(), b && f.componentDidMount != null && f.__h.push(f.componentDidMount);
+ if (v = t.props, b = D.prototype && D.prototype.render, x = (u = D.contextType) && r[u.__c], S = u ? x ? x.props.value : u.__ : r, n.__c ? _ = (f = t.__c = n.__c).__ = f.__E : (b ? t.__c = f = new D(v, S) : (t.__c = f = new se(v, S), f.constructor = D, f.render = Ee), x && x.sub(f), f.state || (f.state = {}), f.__n = r, p = f.__d = !0, f.__h = [], f._sb = []), b && f.__s == null && (f.__s = f.state), b && D.getDerivedStateFromProps != null && (f.__s == f.state && (f.__s = N({}, f.__s)), N(f.__s, D.getDerivedStateFromProps(v, f.__s))), m = f.props, h = f.state, f.__v = t, p) b && D.getDerivedStateFromProps == null && f.componentWillMount != null && f.componentWillMount(), b && f.componentDidMount != null && f.__h.push(f.componentDidMount);
else {
if (b && D.getDerivedStateFromProps == null && v !== m && f.componentWillReceiveProps != null && f.componentWillReceiveProps(v, S), t.__v == n.__v || !f.__e && f.shouldComponentUpdate != null && !1 === f.shouldComponentUpdate(v, f.__s, S)) {
t.__v != n.__v && (f.props = v, f.state = f.__s, f.__d = !1), t.__e = n.__e, t.__k = n.__k, t.__k.some(function(e) {
e && (e.__ = t);
- }), ne.push.apply(f.__h, f._sb), f._sb = [], f.__h.length && o.push(f), s = P(n);
+ }), M.push.apply(f.__h, f._sb), f._sb = [], f.__h.length && o.push(f), s = F(n);
break n;
}
f.componentWillUpdate != null && f.componentWillUpdate(v, f.__s, S), b && f.componentDidUpdate != null && f.__h.push(function() {
f.componentDidUpdate(m, h, g);
});
}
- if (f.context = S, f.props = v, f.__P = e, f.__e = !1, C = y.__r, w = 0, b) f.state = f.__s, f.__d = !1, C && C(t), u = f.render(f.props, f.state, f.context), ne.push.apply(f.__h, f._sb), f._sb = [];
+ if (f.context = S, f.props = v, f.__P = e, f.__e = !1, C = y.__r, w = 0, b) f.state = f.__s, f.__d = !1, C && C(t), u = f.render(f.props, f.state, f.context), M.push.apply(f.__h, f._sb), f._sb = [];
else do
f.__d = !1, C && C(t), u = f.render(f.props, f.state, f.context), f.state = f.__s;
while (f.__d && ++w < 25);
- f.state = f.__s, f.getChildContext != null && (r = M(M({}, r), f.getChildContext())), b && !p && f.getSnapshotBeforeUpdate != null && (g = f.getSnapshotBeforeUpdate(m, h)), T = u != null && u.type === N && u.key == null ? Ce(u.props.children) : u, s = pe(e, ie(T) ? T : [T], t, n, r, i, a, o, s, c, l), f.base = t.__e, t.__u &= -161, f.__h.length && o.push(f), _ && (f.__E = f.__ = null);
+ f.state = f.__s, f.getChildContext != null && (r = N(N({}, r), f.getChildContext())), b && !p && f.getSnapshotBeforeUpdate != null && (g = f.getSnapshotBeforeUpdate(m, h)), T = u != null && u.type === P && u.key == null ? Se(u.props.children) : u, s = fe(e, re(T) ? T : [T], t, n, r, i, a, o, s, c, l), f.base = t.__e, t.__u &= -161, f.__h.length && o.push(f), _ && (f.__E = f.__ = null);
} catch (e) {
if (o.length = d, t.__v = null, c || a != null) {
if (e.then) {
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 (E = a.length; E--;) ae(a[E]);
+ } else if (a != null) for (E = a.length; E--;) ie(a[E]);
} else t.__e = n.__e;
- t.__k ??= n.__k || [], e.then || xe(t), y.__e(e, t, n);
+ t.__k ??= n.__k || [], e.then || be(t), y.__e(e, t, n);
}
- } else a == null && t.__v == n.__v ? (t.__k = n.__k, t.__e = n.__e) : s = t.__e = we(n.__e, t, n, r, i, a, o, c, l);
+ } else a == null && t.__v == n.__v ? (t.__k = n.__k, t.__e = n.__e) : s = t.__e = Ce(n.__e, t, n, r, i, a, o, c, l);
return (u = y.diffed) && u(t), 128 & t.__u ? void 0 : s;
}
-function xe(e) {
- e && (e.__c && (e.__c.__e = !0), e.__k && e.__k.some(xe));
+function be(e) {
+ e && (e.__c && (e.__c.__e = !0), e.__k && e.__k.some(be));
}
-function Se(e, t, n) {
- for (var r = 0; r < n.length; r++) Te(n[r], n[++r], n[++r]);
+function xe(e, t, n) {
+ for (var r = 0; r < n.length; r++) we(n[r], n[++r], n[++r]);
y.__c && y.__c(t, e), e.some(function(t) {
try {
e = t.__h, t.__h = [], e.some(function(e) {
@@ -178,10 +178,10 @@ function Se(e, t, n) {
}
});
}
-function Ce(e) {
- return typeof e != "object" || !e || e.__b > 0 ? e : ie(e) ? e.map(Ce) : e.constructor === void 0 ? M({}, e) : null;
+function Se(e) {
+ return typeof e != "object" || !e || e.__b > 0 ? e : re(e) ? e.map(Se) : e.constructor === void 0 ? N({}, e) : null;
}
-function we(e, t, n, r, i, a, o, s, c) {
+function Ce(e, t, n, r, i, a, o, s, c) {
var l, u, d, f, p, m, h, g = n.props || j, _ = t.props, b = t.type;
if (b == "svg" ? i = "http://www.w3.org/2000/svg" : b == "math" ? i = "http://www.w3.org/1998/Math/MathML" : i ||= "http://www.w3.org/1999/xhtml", a != null) {
for (l = 0; l < a.length; l++) if ((p = a[l]) && "setAttribute" in p == !!b && (b ? p.localName == b : p.nodeType == 3)) {
@@ -196,15 +196,15 @@ function we(e, t, n, r, i, a, o, s, c) {
if (b == null) g === _ || s && e.data == _ || (e.data = _);
else {
if (a = b == "textarea" && _.defaultValue != null ? null : a && v.call(e.childNodes), !s && a != null) for (g = {}, l = 0; l < e.attributes.length; l++) g[(p = e.attributes[l]).name] = p.value;
- for (l in g) p = g[l], l == "dangerouslySetInnerHTML" ? d = p : l == "children" || l in _ || l == "value" && "defaultValue" in _ || l == "checked" && "defaultChecked" in _ || ve(e, l, null, p, i);
- for (l in _) p = _[l], l == "children" ? f = p : l == "dangerouslySetInnerHTML" ? u = p : l == "value" ? m = p : l == "checked" ? h = p : s && typeof p != "function" || g[l] === p || ve(e, l, p, g[l], i);
+ for (l in g) p = g[l], l == "dangerouslySetInnerHTML" ? d = p : l == "children" || l in _ || l == "value" && "defaultValue" in _ || l == "checked" && "defaultChecked" in _ || _e(e, l, null, p, i);
+ for (l in _) p = _[l], l == "children" ? f = p : l == "dangerouslySetInnerHTML" ? u = p : l == "value" ? m = p : l == "checked" ? h = p : s && typeof p != "function" || g[l] === p || _e(e, l, p, g[l], i);
if (u) s || d && (u.__html == d.__html || u.__html == e.innerHTML) || (e.innerHTML = u.__html), t.__k = [];
- else if (d && (e.innerHTML = ""), pe(t.type == "template" ? e.content : e, ie(f) ? f : [f], t, n, r, b == "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, a, o, a ? a[0] : n.__k && P(n, 0), s, c), a != null) for (l = a.length; l--;) ae(a[l]);
- s && b != "textarea" || (l = "value", b == "progress" && m == null ? e.removeAttribute("value") : m != null && (m !== e[l] || b == "progress" && !m || b == "option" && m != g[l]) && ve(e, l, m, g[l], i), l = "checked", h != null && h != e[l] && ve(e, l, h, g[l], i));
+ else if (d && (e.innerHTML = ""), fe(t.type == "template" ? e.content : e, re(f) ? f : [f], t, n, r, b == "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, a, o, a ? a[0] : n.__k && F(n, 0), s, c), a != null) for (l = a.length; l--;) ie(a[l]);
+ s && b != "textarea" || (l = "value", b == "progress" && m == null ? e.removeAttribute("value") : m != null && (m !== e[l] || b == "progress" && !m || b == "option" && m != g[l]) && _e(e, l, m, g[l], i), l = "checked", h != null && h != e[l] && _e(e, l, h, g[l], i));
}
return e;
}
-function Te(e, t, n) {
+function we(e, t, n) {
try {
if (typeof e == "function") {
var r = typeof e.__u == "function";
@@ -214,9 +214,9 @@ function Te(e, t, n) {
y.__e(e, n);
}
}
-function Ee(e, t, n) {
+function Te(e, t, n) {
var r, i;
- if (y.unmount && y.unmount(e), (r = e.ref) && (r.current && r.current != e.__e || Te(r, null, t)), (r = e.__c) != null) {
+ if (y.unmount && y.unmount(e), (r = e.ref) && (r.current && r.current != e.__e || we(r, null, t)), (r = e.__c) != null) {
if (r.componentWillUnmount) try {
r.componentWillUnmount();
} catch (e) {
@@ -224,17 +224,17 @@ function Ee(e, t, n) {
}
r.base = r.__P = r.__n = null;
}
- if (r = e.__k) for (i = 0; i < r.length; i++) r[i] && Ee(r[i], t, n || typeof e.type != "function");
- n || ae(e.__e), e.__c = e.__ = e.__e = void 0;
+ if (r = e.__k) for (i = 0; i < r.length; i++) r[i] && Te(r[i], t, n || typeof e.type != "function");
+ n || ie(e.__e), e.__c = e.__ = e.__e = void 0;
}
-function De(e, t, n) {
+function Ee(e, t, n) {
return this.constructor(e, n);
}
-function Oe(e, t, n) {
+function De(e, t, n) {
var r, i, a, o;
- t == document && (t = document.documentElement), y.__ && y.__(e, t), i = (r = typeof n == "function") ? null : n && n.__k || t.__k, a = [], o = [], be(t, e = (!r && n || t).__k = oe(N, null, [e]), i || j, j, t.namespaceURI, !r && n ? [n] : i ? null : t.firstChild ? v.call(t.childNodes) : null, a, !r && n ? n : i ? i.__e : t.firstChild, r, o), Se(a, e, o), e.props.children = null;
+ t == document && (t = document.documentElement), y.__ && y.__(e, t), i = (r = typeof n == "function") ? null : n && n.__k || t.__k, a = [], o = [], ye(t, e = (!r && n || t).__k = ae(P, null, [e]), i || j, j, t.namespaceURI, !r && n ? [n] : i ? null : t.firstChild ? v.call(t.childNodes) : null, a, !r && n ? n : i ? i.__e : t.firstChild, r, o), xe(a, e, o), e.props.children = null;
}
-v = ne.slice, y = { __e: function(e, t, n, r) {
+v = M.slice, y = { __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) {
@@ -243,28 +243,28 @@ v = ne.slice, y = { __e: function(e, t, n, r) {
throw e;
} }, b = 0, x = function(e) {
return e != null && e.constructor === void 0;
-}, ce.prototype.setState = function(e, t) {
- var n = this.__s != null && this.__s != this.state ? this.__s : this.__s = M({}, this.state);
- typeof e == "function" && (e = e(M({}, n), this.props)), e && M(n, e), e != null && this.__v && (t && this._sb.push(t), de(this));
-}, ce.prototype.forceUpdate = function(e) {
- this.__v && (this.__e = !0, e && this.__h.push(e), de(this));
-}, ce.prototype.render = N, S = [], w = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, T = function(e, t) {
+}, se.prototype.setState = function(e, t) {
+ var n = this.__s != null && this.__s != this.state ? this.__s : this.__s = N({}, this.state);
+ typeof e == "function" && (e = e(N({}, n), this.props)), e && N(n, e), e != null && this.__v && (t && this._sb.push(t), ue(this));
+}, se.prototype.forceUpdate = function(e) {
+ this.__v && (this.__e = !0, e && this.__h.push(e), ue(this));
+}, se.prototype.render = P, S = [], w = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, T = function(e, t) {
return e.__v.__b - t.__v.__b;
-}, fe.__r = 0, E = Math.random().toString(8), D = "__d" + E, O = "__a" + E, k = /(PointerCapture)$|Capture$/i, A = 0, ee = ye(!1), te = ye(!0);
+}, de.__r = 0, E = Math.random().toString(8), D = "__d" + E, O = "__a" + E, k = /(PointerCapture)$|Capture$/i, A = 0, ee = ve(!1), te = ve(!0);
//#endregion
//#region src/sort-preferences.ts
-function ke(e, t, n) {
+function Oe(e, t, n) {
return e === "seed" ? "" : e === t && n === "asc" ? "asc" : "desc";
}
//#endregion
//#region src/api.ts
-var Ae = class extends Error {
+var ke = class extends Error {
status;
body;
constructor(e, t, n = null) {
super(e), this.name = "ApiError", this.status = t, this.body = n;
}
-}, je = (e) => {
+}, Ae = (e) => {
if (!e || typeof e != "object") return "";
let t = e;
for (let e of [
@@ -276,8 +276,8 @@ var Ae = class extends Error {
if (typeof n == "string" && n) return n;
}
return "";
-}, F = (e) => e instanceof Error ? e.message : String(e);
-async function I(e, t) {
+}, I = (e) => e instanceof Error ? e.message : String(e);
+async function L(e, t) {
let n = await fetch(e, {
headers: { Accept: "application/json" },
credentials: "same-origin",
@@ -286,10 +286,10 @@ async function I(e, t) {
try {
r = await n.json();
} catch {}
- if (!n.ok) throw new Ae(je(r) || `请求失败(${n.status})`, n.status);
+ if (!n.ok) throw new ke(Ae(r) || `请求失败(${n.status})`, n.status);
return r;
}
-async function L(e, t, n = "POST", r) {
+async function R(e, t, n = "POST", r) {
let i = await fetch(e, {
method: n,
...r ? { signal: r } : {},
@@ -303,29 +303,29 @@ async function L(e, t, n = "POST", r) {
try {
a = await i.json();
} catch {}
- if (!i.ok) throw new Ae(je(a) || `请求失败(${i.status})`, i.status, a);
+ if (!i.ok) throw new ke(Ae(a) || `请求失败(${i.status})`, i.status, a);
return a;
}
//#endregion
//#region node_modules/preact/hooks/dist/hooks.module.js
-var R, z, Me, Ne, Pe = 0, Fe = [], B = y, Ie = B.__b, Le = B.__r, Re = B.diffed, ze = B.__c, Be = B.unmount, Ve = B.__;
-function He(e, t) {
- B.__h && B.__h(z, e, Pe || t), Pe = 0;
- var n = z.__H || (z.__H = {
+var z, B, je, Me, Ne = 0, Pe = [], V = y, Fe = V.__b, Ie = V.__r, Le = V.diffed, Re = V.__c, ze = V.unmount, Be = V.__;
+function Ve(e, t) {
+ V.__h && V.__h(B, e, Ne || t), Ne = 0;
+ var n = B.__H || (B.__H = {
__: [],
__h: []
});
return e >= n.__.length && n.__.push({}), n.__[e];
}
-function V(e) {
- return Pe = 1, Ue(Ze, e);
+function H(e) {
+ return Ne = 1, He(Xe, e);
}
-function Ue(e, t, n) {
- var r = He(R++, 2);
- if (r.t = e, !r.__c && (r.__ = [n ? n(t) : Ze(void 0, t), function(e) {
+function He(e, t, n) {
+ var r = Ve(z++, 2);
+ if (r.t = e, !r.__c && (r.__ = [n ? n(t) : Xe(void 0, t), function(e) {
var t = r.__N ? r.__N[0] : r.__[0], n = r.t(t, e);
t !== n && (r.__N = [n, r.__[1]], r.__c.setState({}));
- }], r.__c = z, !z.__f)) {
+ }], r.__c = B, !B.__f)) {
var i = function(e, t, n) {
if (!r.__c.__H) return !0;
var i = !1, o = r.__c.props !== e;
@@ -341,112 +341,112 @@ function Ue(e, t, n) {
}
return !i || o;
};
- z.__f = !0;
- var a = z.shouldComponentUpdate, o = z.componentWillUpdate;
- z.componentWillUpdate = function(e, t, n) {
+ B.__f = !0;
+ var a = B.shouldComponentUpdate, o = B.componentWillUpdate;
+ B.componentWillUpdate = function(e, t, n) {
if (this.__e) {
var r = a;
a = void 0, i(e, t, n), a = r;
}
o && o.call(this, e, t, n);
- }, z.shouldComponentUpdate = i;
+ }, B.shouldComponentUpdate = i;
}
return r.__N || r.__;
}
-function H(e, t) {
- var n = He(R++, 3);
- !B.__s && Xe(n.__H, t) && (n.__ = e, n.u = t, z.__H.__h.push(n));
-}
function U(e, t) {
- var n = He(R++, 4);
- !B.__s && Xe(n.__H, t) && (n.__ = e, n.u = t, z.__h.push(n));
+ var n = Ve(z++, 3);
+ !V.__s && Ye(n.__H, t) && (n.__ = e, n.u = t, B.__H.__h.push(n));
}
-function W(e) {
- return Pe = 5, We(function() {
+function W(e, t) {
+ var n = Ve(z++, 4);
+ !V.__s && Ye(n.__H, t) && (n.__ = e, n.u = t, B.__h.push(n));
+}
+function G(e) {
+ return Ne = 5, Ue(function() {
return { current: e };
}, []);
}
-function We(e, t) {
- var n = He(R++, 7);
- return Xe(n.__H, t) && (n.__ = e(), n.__H = t, n.__h = e), n.__;
+function Ue(e, t) {
+ var n = Ve(z++, 7);
+ return Ye(n.__H, t) && (n.__ = e(), n.__H = t, n.__h = e), n.__;
}
-function Ge() {
- for (var e; e = Fe.shift();) {
+function We() {
+ for (var e; e = Pe.shift();) {
var t = e.__H;
if (e.__P && t) try {
- t.__h.some(Je), t.__h.some(Ye), t.__h = [];
+ t.__h.some(qe), t.__h.some(Je), t.__h = [];
} catch (n) {
- t.__h = [], B.__e(n, e.__v);
+ t.__h = [], V.__e(n, e.__v);
}
}
}
-B.__b = function(e) {
- z = null, Ie && Ie(e);
-}, B.__ = function(e, t) {
- e && t.__k && t.__k.__m && (e.__m = t.__k.__m), Ve && Ve(e, t);
-}, B.__r = function(e) {
- Le && Le(e), R = 0;
- var t = (z = e.__c).__H;
- t && (Me === z ? (t.__h = [], z.__h = [], t.__.some(function(e) {
+V.__b = function(e) {
+ B = null, Fe && Fe(e);
+}, V.__ = function(e, t) {
+ e && t.__k && t.__k.__m && (e.__m = t.__k.__m), Be && Be(e, t);
+}, V.__r = function(e) {
+ Ie && Ie(e), z = 0;
+ var t = (B = e.__c).__H;
+ t && (je === B ? (t.__h = [], B.__h = [], t.__.some(function(e) {
e.__N && (e.__ = e.__N), e.u = e.__N = void 0;
- })) : (t.__h.some(Je), t.__h.some(Ye), t.__h = [], R = 0)), Me = z;
-}, B.diffed = function(e) {
- Re && Re(e);
+ })) : (t.__h.some(qe), t.__h.some(Je), t.__h = [], z = 0)), je = B;
+}, V.diffed = function(e) {
+ Le && Le(e);
var t = e.__c;
- t && t.__H && (t.__H.__h.length && (Fe.push(t) !== 1 && Ne === B.requestAnimationFrame || ((Ne = B.requestAnimationFrame) || qe)(Ge)), t.__H.__.some(function(e) {
+ t && t.__H && (t.__H.__h.length && (Pe.push(t) !== 1 && Me === V.requestAnimationFrame || ((Me = V.requestAnimationFrame) || Ke)(We)), t.__H.__.some(function(e) {
e.u &&= (e.__H = e.u, void 0);
- })), Me = z = null;
-}, B.__c = function(e, t) {
+ })), je = B = null;
+}, V.__c = function(e, t) {
t.some(function(e) {
try {
- e.__h.some(Je), e.__h = e.__h.filter(function(e) {
- return !e.__ || Ye(e);
+ e.__h.some(qe), e.__h = e.__h.filter(function(e) {
+ return !e.__ || Je(e);
});
} catch (n) {
t.some(function(e) {
e.__h &&= [];
- }), t = [], B.__e(n, e.__v);
+ }), t = [], V.__e(n, e.__v);
}
- }), ze && ze(e, t);
-}, B.unmount = function(e) {
- Be && Be(e);
+ }), Re && Re(e, t);
+}, V.unmount = function(e) {
+ ze && ze(e);
var t, n = e.__c;
n && n.__H && (n.__H.__.some(function(e) {
try {
- Je(e);
+ qe(e);
} catch (e) {
t = e;
}
- }), n.__H = void 0, t && B.__e(t, n.__v));
+ }), n.__H = void 0, t && V.__e(t, n.__v));
};
-var Ke = typeof requestAnimationFrame == "function";
-function qe(e) {
+var Ge = typeof requestAnimationFrame == "function";
+function Ke(e) {
var t, n = function() {
- clearTimeout(r), Ke && cancelAnimationFrame(t), setTimeout(e);
+ clearTimeout(r), Ge && cancelAnimationFrame(t), setTimeout(e);
}, r = setTimeout(n, 35);
- Ke && (t = requestAnimationFrame(n));
+ Ge && (t = requestAnimationFrame(n));
}
-function Je(e) {
- var t = z, n = e.__c;
- typeof n == "function" && (e.__c = void 0, n()), z = t;
+function qe(e) {
+ var t = B, n = e.__c;
+ typeof n == "function" && (e.__c = void 0, n()), B = t;
}
-function Ye(e) {
- var t = z;
- e.__c = e.__(), z = t;
+function Je(e) {
+ var t = B;
+ e.__c = e.__(), B = t;
}
-function Xe(e, t) {
+function Ye(e, t) {
return !e || e.length !== t.length || t.some(function(t, n) {
return t !== e[n];
});
}
-function Ze(e, t) {
+function Xe(e, t) {
return typeof t == "function" ? t(e) : t;
}
//#endregion
//#region node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js
-var Qe = 0;
+var Ze = 0;
Array.isArray;
-function G(e, t, n, r, i, a) {
+function K(e, t, n, r, i, a) {
t ||= {};
var o, s, c = t;
if ("ref" in c) for (s in c = {}, t) s == "ref" ? o = t[s] : c[s] = t[s];
@@ -461,7 +461,7 @@ function G(e, t, n, r, i, a) {
__e: null,
__c: null,
constructor: void 0,
- __v: --Qe,
+ __v: --Ze,
__i: -1,
__u: 0,
__source: i,
@@ -472,15 +472,15 @@ function G(e, t, n, r, i, a) {
}
//#endregion
//#region src/islands/access-settings.tsx
-function $e({ id: e, label: t, value: n, onInput: r, error: i, help: a, current: o = !1 }) {
- return /* @__PURE__ */ G("div", {
+function Qe({ id: e, label: t, value: n, onInput: r, error: i, help: a, current: o = !1 }) {
+ return /* @__PURE__ */ K("div", {
class: "configfield",
children: [
- /* @__PURE__ */ G("label", {
+ /* @__PURE__ */ K("label", {
for: e,
children: t
}),
- /* @__PURE__ */ G("input", {
+ /* @__PURE__ */ K("input", {
id: e,
class: "geist-input",
type: "password",
@@ -492,7 +492,7 @@ function $e({ id: e, label: t, value: n, onInput: r, error: i, help: a, current:
"aria-invalid": !!i,
"aria-describedby": i || a ? `${e}-hint` : void 0
}),
- i || a ? /* @__PURE__ */ G("p", {
+ i || a ? /* @__PURE__ */ K("p", {
id: `${e}-hint`,
class: i ? "configbad" : "confighelp",
role: i ? "alert" : void 0,
@@ -501,100 +501,105 @@ function $e({ id: e, label: t, value: n, onInput: r, error: i, help: a, current:
]
});
}
-function et({ initial: e, receipt: t }) {
- let [n, r] = V(e), [i, o] = V(""), [s, c] = V(""), [l, u] = V(""), [f, p] = V(!1), [m, h] = V(""), [g, _] = V({}), v = W(null), y = W(!1), b = W(null);
- return /* @__PURE__ */ G("form", {
+function $e({ initial: e, receipt: t }) {
+ let [n, r] = H(e), [i, o] = H(""), [c, l] = H(""), [u, f] = H(""), [p, m] = H(!1), [h, g] = H(""), [_, v] = H({}), y = G(null), b = G(!1), x = G(null);
+ return /* @__PURE__ */ K("form", {
class: "configfieldset",
+ "data-fieldset-type": p ? "warning" : void 0,
onSubmit: async (e) => {
- if (e.preventDefault(), y.current) return;
- h("");
+ if (e.preventDefault(), b.current) return;
+ g("");
let a = {};
- if (n.mode === "password" && !i && (a.current_password = "请输入当前访问密码"), f || ((s.length < 8 || s.length > 256) && (a.password = "访问密码需为 8–256 个字符"), s !== l && (a.confirmation = "两次输入的密码不一致")), _(a), Object.keys(a).length) {
- requestAnimationFrame(() => v.current?.querySelector("[aria-invalid=\"true\"]")?.focus());
+ if (n.mode === "password" && !i && (a.current_password = "请输入当前访问密码"), p || ((c.length < 8 || c.length > 256) && (a.password = "访问密码需为 8–256 个字符"), c !== u && (a.confirmation = "两次输入的密码不一致")), v(a), Object.keys(a).length) {
+ requestAnimationFrame(() => y.current?.querySelector("[aria-invalid=\"true\"]")?.focus());
return;
}
- y.current = !0, d(b.current, !0);
+ b.current = !0, d(x.current, !0);
try {
- let e = await L("/api/configuration/access", {
+ let e = await R("/api/configuration/access", {
revision: n.revision,
- action: f ? "disable" : "set",
- confirm_disable: f,
+ action: p ? "disable" : "set",
+ confirm_disable: p,
current_password: i,
- password: f ? "" : s,
- confirmation: f ? "" : l
+ password: p ? "" : c,
+ confirmation: p ? "" : u
});
- r(e), o(""), c(""), u(""), p(!1), _({}), t(e.mode === "open" ? "已关闭访问密码" : "已保存访问密码");
+ r(e), o(""), l(""), f(""), m(!1), v({}), t(e.mode === "open" ? "已关闭访问密码" : "已保存访问密码");
} catch (e) {
- let t = e instanceof Ae ? e.body : null, n = t?.errors || t?.detail?.errors;
- n ? _(n) : h(F(e));
+ let t = e instanceof ke ? e.body : null, n = t?.errors || t?.detail?.errors;
+ n ? v(n) : g(I(e));
} finally {
- y.current = !1, d(b.current, !1);
+ b.current = !1, d(x.current, !1);
}
},
"aria-labelledby": "accessTitle",
noValidate: !0,
- ref: v,
- children: [/* @__PURE__ */ G("div", {
+ ref: y,
+ children: [/* @__PURE__ */ K("div", {
class: "geist-fieldset-content",
children: [
- /* @__PURE__ */ G("div", {
+ /* @__PURE__ */ K("div", {
class: "configfieldset-heading",
- children: [/* @__PURE__ */ G("div", { dangerouslySetInnerHTML: { __html: a("accessTitle", "访问密码") } }), /* @__PURE__ */ G("p", {
+ children: [/* @__PURE__ */ K("div", { dangerouslySetInnerHTML: { __html: a("accessTitle", "访问密码") } }), /* @__PURE__ */ K("p", {
class: "confighelp",
children: n.mode === "open" ? "未设置密码,能连接到 Peach 的设备可直接访问。" : n.mode === "legacy" ? "当前使用系统生成的访问口令。你可以设置自己的密码,或关闭登录要求。" : n.mode === "locked" ? "访问设置无法读取,请在本机检查配置文件。" : "已设置密码。新设备需要登录,保持登录时间在登录页选择。"
})]
}),
- n.mode === "password" ? /* @__PURE__ */ G($e, {
+ n.mode === "password" ? /* @__PURE__ */ K(Qe, {
id: "access-current",
label: "当前访问密码",
value: i,
onInput: o,
- error: g.current_password,
+ error: _.current_password,
current: !0
}) : null,
- !f && n.mode !== "locked" ? /* @__PURE__ */ G(N, { children: [/* @__PURE__ */ G($e, {
+ !p && n.mode !== "locked" ? /* @__PURE__ */ K(P, { children: [/* @__PURE__ */ K(Qe, {
id: "access-password",
label: n.mode === "password" ? "新访问密码" : "设置访问密码",
- value: s,
- onInput: c,
- error: g.password,
+ value: c,
+ onInput: l,
+ error: _.password,
help: "至少 8 个字符。保存后其他设备需要重新登录。"
- }), /* @__PURE__ */ G($e, {
+ }), /* @__PURE__ */ K(Qe, {
id: "access-confirm",
label: "确认访问密码",
- value: l,
- onInput: u,
- error: g.confirmation
+ value: u,
+ onInput: f,
+ error: _.confirmation
})] }) : null,
- n.mode === "password" || n.mode === "legacy" ? /* @__PURE__ */ G("label", {
+ n.mode === "password" || n.mode === "legacy" ? /* @__PURE__ */ K("label", {
class: "configcheck",
- children: [/* @__PURE__ */ G("span", {
+ children: [/* @__PURE__ */ K("span", {
class: "pcheck",
- children: [/* @__PURE__ */ G("input", {
+ children: [/* @__PURE__ */ K("input", {
type: "checkbox",
- checked: f,
- onChange: (e) => p(e.currentTarget.checked)
- }), /* @__PURE__ */ G("span", {
+ checked: p,
+ onChange: (e) => m(e.currentTarget.checked)
+ }), /* @__PURE__ */ K("span", {
"aria-hidden": "true",
- children: /* @__PURE__ */ G("svg", {
+ children: /* @__PURE__ */ K("svg", {
viewBox: "0 0 24 24",
- children: /* @__PURE__ */ G("use", { href: "#i-check" })
+ children: /* @__PURE__ */ K("use", { href: "#i-check" })
})
})]
- }), /* @__PURE__ */ G("span", { children: "关闭访问密码,允许能连接到 Peach 的设备直接访问" })]
+ }), /* @__PURE__ */ K("span", { children: "关闭访问密码,允许能连接到 Peach 的设备直接访问" })]
}) : null,
- m ? /* @__PURE__ */ G("p", {
+ p && /* @__PURE__ */ K("div", { dangerouslySetInnerHTML: { __html: s("保存后,能连接到 Peach 的设备将直接访问馆藏。", {
+ variant: "warning",
+ label: "访问范围"
+ }) } }),
+ h ? /* @__PURE__ */ K("p", {
class: "configbad",
role: "alert",
- children: m
+ children: h
}) : null
]
- }), n.mode === "locked" ? null : /* @__PURE__ */ G("div", {
+ }), n.mode === "locked" ? null : /* @__PURE__ */ K("div", {
class: "geist-fieldset-footer",
- children: [/* @__PURE__ */ G("p", { children: "保存后立即生效。" }), /* @__PURE__ */ G("button", {
+ children: [/* @__PURE__ */ K("p", { children: "保存后立即生效。" }), /* @__PURE__ */ K("button", {
class: "geist-button primary",
type: "submit",
- ref: b,
+ ref: x,
children: "保存配置"
})]
})]
@@ -602,7 +607,7 @@ function et({ initial: e, receipt: t }) {
}
//#endregion
//#region src/islands/release-updates.tsx
-var tt = /* @__PURE__ */ new Set([
+var et = /* @__PURE__ */ new Set([
"downloading",
"verifying",
"extracting",
@@ -610,21 +615,21 @@ var tt = /* @__PURE__ */ new Set([
"restarting",
"installing"
]);
-function nt({ initial: e, initialJob: t }) {
- let [n, i] = V(e), [o, s] = V(t || {
+function tt({ initial: e, initialJob: t }) {
+ let [n, i] = H(e), [o, s] = H(t || {
state: "idle",
progress: 0
- }), [l, u] = V(""), f = W(null), p = W(!0), m = W(!1), h = W(null);
- H(() => {
- d(h.current, tt.has(o.state));
- }, [o.state]), H(() => () => {
+ }), [l, u] = H(""), f = G(null), p = G(!0), m = G(!1), h = G(null);
+ U(() => {
+ d(h.current, et.has(o.state));
+ }, [o.state]), U(() => () => {
p.current = !1, f.current?.abort();
}, []);
let g = async () => {
- let e = await L("/api/configuration/update-restart", {});
+ let e = await R("/api/configuration/update-restart", {});
p.current && s(e);
};
- H(() => {
+ U(() => {
o.state !== "ready" || m.current || (m.current = !0, r({
title: "更新已准备好",
body: `Peach ${o.version || ""} 将在重启后安装。`,
@@ -632,11 +637,11 @@ function nt({ initial: e, initialJob: t }) {
cancelLabel: "稍后",
onConfirm: g
}));
- }, [o.state]), H(() => {
- if (!tt.has(o.state)) return;
+ }, [o.state]), U(() => {
+ if (!et.has(o.state)) return;
let e = new AbortController(), t, n = 0, r = async () => {
try {
- let t = await I("/api/configuration/update-status", e.signal);
+ let t = await L("/api/configuration/update-status", e.signal);
e.signal.aborted || (s(t), n = 0, t.state === "complete" && i((e) => ({
...e,
current_version: t.version || e.current_version,
@@ -653,14 +658,14 @@ function nt({ initial: e, initialJob: t }) {
};
}, [o.state]);
let _ = async (e) => {
- if (f.current || tt.has(o.state)) return;
+ if (f.current || et.has(o.state)) return;
let t = new AbortController();
f.current = t, m.current = !1, u(""), d(e, !0);
try {
- let e = await L("/api/configuration/update", {}, "POST", t.signal);
+ let e = await R("/api/configuration/update", {}, "POST", t.signal);
t.signal.aborted || s(e);
} catch (e) {
- t.signal.aborted || u(F(e));
+ t.signal.aborted || u(I(e));
} finally {
f.current = null, d(e, !1);
}
@@ -669,66 +674,66 @@ function nt({ initial: e, initialJob: t }) {
let n = new AbortController();
f.current = n, d(t, !0), u("");
try {
- let e = await I("/api/configuration/updates", n.signal);
+ let e = await L("/api/configuration/updates", n.signal);
n.signal.aborted || i(e);
} catch (t) {
n.signal.aborted || (i({
...e,
state: "error"
- }), u(F(t)));
+ }), u(I(t)));
} finally {
f.current = null, d(t, !1);
}
};
- return /* @__PURE__ */ G("section", {
+ return /* @__PURE__ */ K("section", {
class: "configfieldset",
"data-geist-fieldset": !0,
"aria-labelledby": "configUpdatesTitle",
- children: [/* @__PURE__ */ G("div", {
+ children: [/* @__PURE__ */ K("div", {
class: "geist-fieldset-content",
children: [
- /* @__PURE__ */ G("div", { dangerouslySetInnerHTML: { __html: a("configUpdatesTitle", "检查更新") } }),
- /* @__PURE__ */ G("dl", {
+ /* @__PURE__ */ K("div", { dangerouslySetInnerHTML: { __html: a("configUpdatesTitle", "检查更新") } }),
+ /* @__PURE__ */ K("dl", {
class: "configfacts",
children: [
- /* @__PURE__ */ G("dt", { children: "当前版本" }),
- /* @__PURE__ */ G("dd", { children: n.current_version }),
- /* @__PURE__ */ G("dt", { children: "安装方式" }),
- /* @__PURE__ */ G("dd", { children: n.installation }),
- /* @__PURE__ */ G("dt", { children: "更新通道" }),
- /* @__PURE__ */ G("dd", { children: n.channel }),
- /* @__PURE__ */ G("dt", { children: "最新版本" }),
- /* @__PURE__ */ G("dd", { children: n.latest_version || (n.state === "unchecked" ? "尚未检查" : "未取得") })
+ /* @__PURE__ */ K("dt", { children: "当前版本" }),
+ /* @__PURE__ */ K("dd", { children: n.current_version }),
+ /* @__PURE__ */ K("dt", { children: "安装方式" }),
+ /* @__PURE__ */ K("dd", { children: n.installation }),
+ /* @__PURE__ */ K("dt", { children: "更新通道" }),
+ /* @__PURE__ */ K("dd", { children: n.channel }),
+ /* @__PURE__ */ K("dt", { children: "最新版本" }),
+ /* @__PURE__ */ K("dd", { children: n.latest_version || (n.state === "unchecked" ? "尚未检查" : "未取得") })
]
}),
- /* @__PURE__ */ G("p", {
+ /* @__PURE__ */ K("p", {
class: l || n.state === "error" ? "configbad" : "confighelp",
role: l || n.state === "error" ? "alert" : "status",
children: l || n.message
}),
- o.state === "idle" ? null : /* @__PURE__ */ G("div", {
+ o.state === "idle" ? null : /* @__PURE__ */ K("div", {
"aria-live": "polite",
- children: [/* @__PURE__ */ G("p", {
+ children: [/* @__PURE__ */ K("p", {
class: o.state === "error" ? "configbad" : "confighelp",
children: o.message
- }), o.state === "error" ? null : /* @__PURE__ */ G(N, { children: [/* @__PURE__ */ G("div", { dangerouslySetInnerHTML: { __html: c(o.state === "downloading" ? "下载进度" : "安装进度", o.state === "downloading" ? o.downloaded || 0 : o.progress, o.state === "downloading" ? o.total || 1 : 100) } }), /* @__PURE__ */ G("p", {
+ }), o.state === "error" ? null : /* @__PURE__ */ K(P, { children: [/* @__PURE__ */ K("div", { dangerouslySetInnerHTML: { __html: c(o.state === "downloading" ? "下载进度" : "安装进度", o.state === "downloading" ? o.downloaded || 0 : o.progress, o.state === "downloading" ? o.total || 1 : 100) } }), /* @__PURE__ */ K("p", {
class: "confighelp",
children: o.state === "downloading" && o.total ? `${((o.downloaded || 0) / 1048576).toFixed(1)} / ${(o.total / 1048576).toFixed(1)} MB` : `${o.progress}%`
})] })]
})
]
- }), /* @__PURE__ */ G("div", {
+ }), /* @__PURE__ */ K("div", {
class: "geist-fieldset-footer",
"data-geist-fieldset-footer": !0,
children: [
- /* @__PURE__ */ G("a", {
+ /* @__PURE__ */ K("a", {
class: "geist-button",
href: n.release_url,
target: "_blank",
rel: "noreferrer",
children: "查看发布页"
}),
- o.state === "ready" ? /* @__PURE__ */ G("button", {
+ o.state === "ready" ? /* @__PURE__ */ K("button", {
type: "button",
class: "geist-button primary",
onClick: () => {
@@ -742,17 +747,17 @@ function nt({ initial: e, initialJob: t }) {
},
children: "重启安装"
}) : null,
- n.state === "available" && n.installation === "独立测试包" && o.state !== "ready" ? /* @__PURE__ */ G("button", {
+ n.state === "available" && n.installation === "独立测试包" && o.state !== "ready" ? /* @__PURE__ */ K("button", {
ref: h,
type: "button",
class: "geist-button primary",
onClick: (e) => _(e.currentTarget),
children: "下载并安装"
}) : null,
- /* @__PURE__ */ G("button", {
+ /* @__PURE__ */ K("button", {
type: "button",
class: "geist-button",
- disabled: tt.has(o.state),
+ disabled: et.has(o.state),
onClick: (e) => v(e.currentTarget),
children: "检查更新"
})
@@ -762,9 +767,9 @@ function nt({ initial: e, initialJob: t }) {
}
//#endregion
//#region src/islands/peach-proxy.tsx
-function rt({ initial: e, receipt: t }) {
- let [n, r] = V(e), [i, o] = V(e.mode), [s, c] = V(""), [u, f] = V(""), m = W(!1), h = W(null), g = W(null), _ = W(new AbortController());
- H(() => () => _.current.abort(), []), U(() => {
+function nt({ initial: e, receipt: t }) {
+ let [n, r] = H(e), [i, o] = H(e.mode), [s, c] = H(""), [u, f] = H(""), m = G(!1), h = G(null), g = G(null), _ = G(new AbortController());
+ U(() => () => _.current.abort(), []), W(() => {
let t = h.current;
t.innerHTML = l([
["environment", "系统代理"],
@@ -784,40 +789,40 @@ function rt({ initial: e, receipt: t }) {
if (!m.current) {
m.current = !0, d(g.current, !0), f("");
try {
- let e = await L("/api/configuration/peach-proxy", {
+ let e = await R("/api/configuration/peach-proxy", {
mode: i,
proxy: s
}, "POST", _.current.signal);
_.current.signal.aborted || (r(e), c(""), t("已保存 Peach 代理"));
} catch (e) {
- _.current.signal.aborted || f(F(e));
+ _.current.signal.aborted || f(I(e));
} finally {
m.current = !1, d(g.current, !1);
}
}
}
- return /* @__PURE__ */ G("form", {
+ return /* @__PURE__ */ K("form", {
id: "peachProxy",
class: "configfieldset",
"data-geist-fieldset": !0,
onSubmit: (e) => {
e.preventDefault(), v();
},
- children: [/* @__PURE__ */ G("div", {
+ children: [/* @__PURE__ */ K("div", {
class: "geist-fieldset-content",
children: [
- /* @__PURE__ */ G("div", { dangerouslySetInnerHTML: { __html: a("peachProxyTitle", "Peach 代理") } }),
- /* @__PURE__ */ G("p", {
+ /* @__PURE__ */ K("div", { dangerouslySetInnerHTML: { __html: a("peachProxyTitle", "Peach 代理") } }),
+ /* @__PURE__ */ K("p", {
class: "confighelp",
children: "采集来源选择“Peach 代理”时共用此设置。"
}),
- /* @__PURE__ */ G("div", { ref: h }),
- i === "proxy" && /* @__PURE__ */ G("div", {
+ /* @__PURE__ */ K("div", { ref: h }),
+ i === "proxy" && /* @__PURE__ */ K("div", {
class: "configfield",
- children: [/* @__PURE__ */ G("label", {
+ children: [/* @__PURE__ */ K("label", {
htmlFor: "peachProxyAddress",
children: "代理地址"
- }), /* @__PURE__ */ G("input", {
+ }), /* @__PURE__ */ K("input", {
id: "peachProxyAddress",
class: "geist-input",
type: "password",
@@ -827,20 +832,20 @@ function rt({ initial: e, receipt: t }) {
onInput: (e) => c(e.currentTarget.value)
})]
}),
- n.needs_selection && /* @__PURE__ */ G("p", {
+ n.needs_selection && /* @__PURE__ */ K("p", {
class: "configbad",
children: "已有来源的代理地址不同,请选择公共连接方式。"
}),
- u && /* @__PURE__ */ G("p", {
+ u && /* @__PURE__ */ K("p", {
class: "configbad",
role: "alert",
children: u
})
]
- }), /* @__PURE__ */ G("footer", {
+ }), /* @__PURE__ */ K("footer", {
class: "geist-fieldset-footer",
"data-geist-fieldset-footer": !0,
- children: /* @__PURE__ */ G("button", {
+ children: /* @__PURE__ */ K("button", {
ref: g,
class: "geist-button primary",
type: "submit",
@@ -851,95 +856,114 @@ function rt({ initial: e, receipt: t }) {
}
//#endregion
//#region src/islands/desktop-settings.tsx
-function it({ label: e, checked: t, disabled: n, change: r }) {
- return /* @__PURE__ */ G("label", {
+function rt({ label: e, checked: t, disabled: n, change: r }) {
+ return /* @__PURE__ */ K("label", {
class: "configcheck",
- children: [/* @__PURE__ */ G("span", {
+ children: [/* @__PURE__ */ K("span", {
class: "pcheck",
- children: [/* @__PURE__ */ G("input", {
+ children: [/* @__PURE__ */ K("input", {
type: "checkbox",
checked: t,
disabled: n,
onChange: (e) => r(e.currentTarget.checked)
- }), /* @__PURE__ */ G("span", {
+ }), /* @__PURE__ */ K("span", {
"aria-hidden": "true",
- children: /* @__PURE__ */ G("svg", {
+ children: /* @__PURE__ */ K("svg", {
viewBox: "0 0 24 24",
- children: /* @__PURE__ */ G("use", { href: "#i-check" })
+ children: /* @__PURE__ */ K("use", { href: "#i-check" })
})
})]
- }), /* @__PURE__ */ G("span", { children: e })]
+ }), /* @__PURE__ */ K("span", { children: e })]
+ });
+}
+function it({ label: e, checked: t, disabled: n, change: r }) {
+ return /* @__PURE__ */ K("label", {
+ class: "configtoggle",
+ children: [/* @__PURE__ */ K("span", { children: e }), /* @__PURE__ */ K("input", {
+ class: "ptoggle",
+ type: "checkbox",
+ role: "switch",
+ checked: t,
+ disabled: n,
+ onChange: (e) => r(e.currentTarget.checked)
+ })]
});
}
function at({ startup: e, receipt: t }) {
- let [n, r] = V(e.enabled), [i, o] = V(e.silent), [s, c] = V(""), l = W(!1), u = W(null);
+ let [n, r] = H(e.enabled), [i, o] = H(e.silent), [s, c] = H(""), l = G(!1), u = G(null);
async function f() {
if (!l.current) {
l.current = !0, d(u.current, !0), c("");
try {
- await L("/api/configuration/startup", {
+ await R("/api/configuration/startup", {
enabled: n,
silent: i
}), t("已保存开机自启");
} catch (e) {
- c(F(e));
+ c(I(e));
} finally {
l.current = !1, d(u.current, !1);
}
}
}
- return /* @__PURE__ */ G("form", {
+ return /* @__PURE__ */ K("form", {
class: "configfieldset",
"data-geist-fieldset": !0,
onSubmit: (e) => {
e.preventDefault(), f();
},
- children: [/* @__PURE__ */ G("div", {
+ children: [/* @__PURE__ */ K("div", {
class: "geist-fieldset-content",
children: [
- /* @__PURE__ */ G("div", { dangerouslySetInnerHTML: { __html: a("startupTitle", "开机自启") } }),
- /* @__PURE__ */ G(it, {
- label: "开机后启动 Peach",
- checked: n,
- disabled: !e.available,
- change: r
- }),
- /* @__PURE__ */ G(it, {
- label: "静默启动",
- checked: i,
- disabled: !e.available,
- change: o
- }),
- /* @__PURE__ */ G("p", {
- class: "confighelp",
- children: "静默启动仅显示托盘;关闭后自动打开浏览器。"
+ /* @__PURE__ */ K("div", { dangerouslySetInnerHTML: { __html: a("startupTitle", "开机自启") } }),
+ /* @__PURE__ */ K("div", {
+ class: "configoptions",
+ role: "group",
+ "aria-labelledby": "startupTitle",
+ children: [/* @__PURE__ */ K(it, {
+ label: "开机后启动 Peach",
+ checked: n,
+ disabled: !e.available,
+ change: r
+ }), /* @__PURE__ */ K("div", {
+ class: "configoption",
+ children: [/* @__PURE__ */ K(it, {
+ label: "静默启动",
+ checked: i,
+ disabled: !e.available,
+ change: o
+ }), /* @__PURE__ */ K("p", {
+ class: "confighelp",
+ children: "静默启动仅显示托盘。"
+ })]
+ })]
}),
- e.message && /* @__PURE__ */ G("p", {
+ e.message && /* @__PURE__ */ K("p", {
class: "confighelp",
children: e.message
}),
- s && /* @__PURE__ */ G("p", {
+ s && /* @__PURE__ */ K("p", {
class: "configbad",
role: "alert",
children: s
})
]
- }), /* @__PURE__ */ G("footer", {
+ }), /* @__PURE__ */ K("footer", {
class: "geist-fieldset-footer",
"data-geist-fieldset-footer": !0,
- children: /* @__PURE__ */ G("button", {
+ children: /* @__PURE__ */ K("button", {
ref: u,
type: "submit",
class: "geist-button primary",
disabled: !e.available,
- children: "保存自启"
+ children: "保存配置"
})
})]
});
}
function ot({ data: e }) {
- let t = W(null);
- return U(() => {
+ let t = G(null);
+ return W(() => {
let n = t.current, r = document.createElement("details");
r.className = "configdirectories";
let i = document.createElement("summary");
@@ -949,10 +973,10 @@ function ot({ data: e }) {
e.className = "confighelp", e.textContent = t, r.append(e);
}
return n.replaceChildren(r), f(n, "details", "uninstall-data"), () => n.replaceChildren();
- }, [e]), /* @__PURE__ */ G("div", { ref: t });
+ }, [e]), /* @__PURE__ */ K("div", { ref: t });
}
function st({ uninstall: e }) {
- let [t, n] = V(!1), [i, o] = V("");
+ let [t, n] = H(!1), [i, o] = H("");
async function s() {
await r({
title: "卸载 Peach",
@@ -960,7 +984,7 @@ function st({ uninstall: e }) {
body: t ? "将退出 Peach,移除程序、开机自启、设置、本地数据库、观看记录、凭据和缓存。原始媒体文件保留。" : "将退出 Peach 并移除程序和开机自启。设置、本地数据库、观看记录与缓存保留。",
confirmLabel: "卸载 Peach",
onConfirm: async () => {
- let e = await L("/api/configuration/uninstall", {
+ let e = await R("/api/configuration/uninstall", {
delete_data: t,
confirmation: "卸载 Peach"
});
@@ -968,40 +992,40 @@ function st({ uninstall: e }) {
}
});
}
- return /* @__PURE__ */ G("section", {
+ return /* @__PURE__ */ K("section", {
id: "uninstallPeach",
class: "configfieldset configdanger",
"data-geist-fieldset": !0,
"data-fieldset-type": "error",
- children: [/* @__PURE__ */ G("div", {
+ children: [/* @__PURE__ */ K("div", {
class: "geist-fieldset-content",
children: [
- /* @__PURE__ */ G("div", { dangerouslySetInnerHTML: { __html: a("uninstallTitle", "卸载 Peach") } }),
- e.available && /* @__PURE__ */ G("p", {
+ /* @__PURE__ */ K("div", { dangerouslySetInnerHTML: { __html: a("uninstallTitle", "卸载 Peach") } }),
+ e.available && /* @__PURE__ */ K("p", {
class: "confighelp",
children: "卸载会退出 Peach、移除程序和开机自启。原始媒体文件保留。"
}),
- /* @__PURE__ */ G(it, {
+ /* @__PURE__ */ K(rt, {
label: "完全卸载:同时删除设置、本地数据库、观看记录、凭据和缓存",
checked: t,
disabled: !e.full_available || !!i,
change: n
}),
- /* @__PURE__ */ G(ot, { data: e }),
- e.message && /* @__PURE__ */ G("p", {
+ /* @__PURE__ */ K(ot, { data: e }),
+ e.message && /* @__PURE__ */ K("p", {
class: "confighelp",
children: e.message
}),
- i && /* @__PURE__ */ G("p", {
+ i && /* @__PURE__ */ K("p", {
class: "confighelp",
role: "status",
children: i
})
]
- }), /* @__PURE__ */ G("footer", {
+ }), /* @__PURE__ */ K("footer", {
class: "geist-fieldset-footer",
"data-geist-fieldset-footer": !0,
- children: /* @__PURE__ */ G("button", {
+ children: /* @__PURE__ */ K("button", {
type: "button",
class: "geist-button danger",
disabled: !e.available || !!i,
@@ -1013,29 +1037,29 @@ function st({ uninstall: e }) {
}
//#endregion
//#region src/islands/configuration.tsx
-var ct = "/api/configuration", lt = "/api/pick-folder", ut = 8e3, dt = (e, t) => I(ct, t), K = ({ html: e, class: t }) => /* @__PURE__ */ G("div", {
+var ct = "/api/configuration", lt = "/api/pick-folder", ut = 8e3, dt = (e, t) => L(ct, t), q = ({ html: e, class: t }) => /* @__PURE__ */ K("div", {
class: t,
dangerouslySetInnerHTML: { __html: e }
-}), ft = (e) => !(e instanceof Ae) || e.status !== 400 ? null : e.body?.errors ?? null;
+}), ft = (e) => !(e instanceof ke) || e.status !== 400 ? null : e.body?.errors ?? null;
function pt({ facts: e }) {
- return /* @__PURE__ */ G("section", {
+ return /* @__PURE__ */ K("section", {
class: "configfieldset",
"data-geist-fieldset": !0,
"aria-labelledby": "configFactsTitle",
- children: /* @__PURE__ */ G("div", {
+ children: /* @__PURE__ */ K("div", {
class: "geist-fieldset-content",
- children: [/* @__PURE__ */ G(K, { html: a("configFactsTitle", "运行信息") }), /* @__PURE__ */ G("dl", {
+ children: [/* @__PURE__ */ K(q, { html: a("configFactsTitle", "运行信息") }), /* @__PURE__ */ K("dl", {
class: "configfacts",
- children: e.map((e) => /* @__PURE__ */ G(N, { children: [/* @__PURE__ */ G("dt", { children: e.term }), /* @__PURE__ */ G("dd", { children: [e.value, e.download_url ? /* @__PURE__ */ G("span", {
+ children: e.map((e) => /* @__PURE__ */ K(P, { children: [/* @__PURE__ */ K("dt", { children: e.term }), /* @__PURE__ */ K("dd", { children: [e.value, e.download_url ? /* @__PURE__ */ K("span", {
class: "confighelp",
- children: [" ", /* @__PURE__ */ G("a", {
+ children: [" ", /* @__PURE__ */ K("a", {
href: e.download_url,
target: "_blank",
rel: "noreferrer",
- children: [e.download_label, /* @__PURE__ */ G("svg", {
+ children: [e.download_label, /* @__PURE__ */ K("svg", {
"aria-hidden": "true",
viewBox: "0 0 24 24",
- children: /* @__PURE__ */ G("use", { href: "#i-external-link" })
+ children: /* @__PURE__ */ K("use", { href: "#i-external-link" })
})]
})]
}) : null] })] }))
@@ -1044,56 +1068,56 @@ function pt({ facts: e }) {
});
}
function mt({ data: t }) {
- let [n, r] = V(t.media_sources), [i, o] = V(""), s = W(null);
- H(() => () => s.current?.abort(), []);
+ let [n, r] = H(t.media_sources), [i, o] = H(""), s = G(null);
+ U(() => () => s.current?.abort(), []);
let c = async (e) => {
if (s.current) return;
let t = new AbortController();
s.current = t, d(e, !0), o("");
try {
- let e = await I(ct, t.signal);
+ let e = await L(ct, t.signal);
t.signal.aborted || r(e.media_sources);
} catch (e) {
- t.signal.aborted || o(F(e));
+ t.signal.aborted || o(I(e));
} finally {
s.current = null, d(e, !1);
}
};
- return n ? /* @__PURE__ */ G("section", {
+ return n ? /* @__PURE__ */ K("section", {
class: "configfieldset",
"aria-labelledby": "configMountsTitle",
- children: [/* @__PURE__ */ G("div", {
+ children: [/* @__PURE__ */ K("div", {
class: "geist-fieldset-content",
children: [
- /* @__PURE__ */ G(K, { html: a("configMountsTitle", "挂载状态") }),
- /* @__PURE__ */ G("dl", {
+ /* @__PURE__ */ K(q, { html: a("configMountsTitle", "挂载状态") }),
+ /* @__PURE__ */ K("dl", {
class: "configfacts",
- children: n.map((t) => /* @__PURE__ */ G(N, { children: [/* @__PURE__ */ G("dt", { children: [/* @__PURE__ */ G("span", {
+ children: n.map((t) => /* @__PURE__ */ K(P, { children: [/* @__PURE__ */ K("dt", { children: [/* @__PURE__ */ K("span", {
"aria-hidden": "true",
dangerouslySetInnerHTML: { __html: u(e[t.location]) }
}), {
local: "本地磁盘",
115: "CloudDrive · 115",
pikpak: "CloudDrive · PikPak"
- }[t.location] || t.location] }), /* @__PURE__ */ G("dd", { children: [
+ }[t.location] || t.location] }), /* @__PURE__ */ K("dd", { children: [
t.path || "未配置挂载点",
" ",
- /* @__PURE__ */ G("span", {
+ /* @__PURE__ */ K("span", {
class: `configstatus ${t.online === !0 ? "online" : t.online === !1 ? "offline" : "unknown"}`,
children: t.online === !0 ? "在线" : t.online === !1 ? "离线" : "未检测"
})
] })] }))
}),
- i ? /* @__PURE__ */ G("p", {
+ i ? /* @__PURE__ */ K("p", {
class: "configbad",
role: "alert",
children: i
}) : null
]
- }), /* @__PURE__ */ G("div", {
+ }), /* @__PURE__ */ K("div", {
class: "geist-fieldset-footer",
"data-geist-fieldset-footer": !0,
- children: /* @__PURE__ */ G("button", {
+ children: /* @__PURE__ */ K("button", {
type: "button",
class: "geist-button",
onClick: (e) => c(e.currentTarget),
@@ -1103,8 +1127,8 @@ function mt({ data: t }) {
}) : null;
}
function ht({ value: t, label: n, onChange: r }) {
- let i = W(null), a = W(null), o = W(r);
- return o.current = r, U(() => {
+ let i = G(null), a = G(null), o = G(r);
+ return o.current = r, W(() => {
let r = i.current;
r.innerHTML = l([
["local", "本地磁盘"],
@@ -1121,9 +1145,9 @@ function ht({ value: t, label: n, onChange: r }) {
return s.addEventListener("change", c), () => {
a.current = null, s.disabled = !0, s.removeEventListener("change", c), r.replaceChildren();
};
- }, [n]), U(() => {
+ }, [n]), W(() => {
a.current && (a.current.value = t);
- }, [t]), /* @__PURE__ */ G("div", {
+ }, [t]), /* @__PURE__ */ K("div", {
ref: i,
class: "configsourcecontrol"
});
@@ -1133,10 +1157,10 @@ function gt({ data: e, receipt: t }) {
"local",
"115",
"pikpak"
- ].includes(e.location)), [r, i] = V(n?.length ? n.map((e) => e.path) : e.media_dirs.length ? e.media_dirs : [""]), [o, c] = V(n?.map((e) => e.location) ?? []), [l, u] = V(n?.map((e) => e.root) ?? []), [f, p] = V(String(e.port)), [m, h] = V(!1), [g, _] = V([]), [v, y] = V(""), [b, x] = V(""), [S, C] = V(null), [w, T] = V(null), E = W(!1), D = W(e.revision), O = W([]), k = W(null);
- U(() => {
+ ].includes(e.location)), [r, i] = H(n?.length ? n.map((e) => e.path) : e.media_dirs.length ? e.media_dirs : [""]), [o, c] = H(n?.map((e) => e.location) ?? []), [l, u] = H(n?.map((e) => e.root) ?? []), [f, p] = H(String(e.port)), [m, h] = H(!1), [g, _] = H([]), [v, y] = H(""), [b, x] = H(""), [S, C] = H(null), [w, T] = H(null), E = G(!1), D = G(e.revision), O = G([]), k = G(null);
+ W(() => {
w !== null && (O.current[w]?.focus(), T(null));
- }, [w]), H(() => {
+ }, [w]), U(() => {
if (!S) return;
let e = setTimeout(() => location.assign(S.url), ut);
return () => clearTimeout(e);
@@ -1153,39 +1177,39 @@ function gt({ data: e, receipt: t }) {
for (; r.length <= e;) r.push("");
return r[e] = t, r;
});
- }, ne = async (e, t) => {
+ }, M = async (e, t) => {
if (t.getAttribute("aria-busy") !== "true") {
d(t, !0);
try {
- let { path: t } = await L(lt, { initial: r[e] ?? "" });
+ let { path: t } = await R(lt, { initial: r[e] ?? "" });
t && (A(e, t), j(e, ""));
} catch (t) {
- j(e, F(t));
+ j(e, I(t));
} finally {
d(t, !1);
}
}
};
- return S ? /* @__PURE__ */ G("div", {
+ return S ? /* @__PURE__ */ K("div", {
class: "configsaved",
role: "status",
- children: /* @__PURE__ */ G("div", {
+ children: /* @__PURE__ */ K("div", {
class: "geist-note geist-note-success",
role: "note",
- children: [/* @__PURE__ */ G("svg", {
+ children: [/* @__PURE__ */ K("svg", {
"aria-hidden": "true",
viewBox: "0 0 24 24",
- children: /* @__PURE__ */ G("use", { href: "#i-check" })
- }), /* @__PURE__ */ G("p", { children: /* @__PURE__ */ G("span", { children: [
+ children: /* @__PURE__ */ K("use", { href: "#i-check" })
+ }), /* @__PURE__ */ K("p", { children: /* @__PURE__ */ K("span", { children: [
"配置已保存,Peach 正在重新启动。稍后自动跳转,或点击",
- /* @__PURE__ */ G("a", {
+ /* @__PURE__ */ K("a", {
href: S.url,
children: "进入馆藏"
}),
"。"
] }) })]
})
- }) : /* @__PURE__ */ G("form", {
+ }) : /* @__PURE__ */ K("form", {
class: "configfieldset",
"data-geist-fieldset": !0,
"aria-labelledby": "configTitle",
@@ -1193,7 +1217,7 @@ function gt({ data: e, receipt: t }) {
if (n.preventDefault(), !E.current) {
E.current = !0, d(k.current, !0), x("");
try {
- let n = await L(ct, {
+ let n = await R(ct, {
revision: D.current,
media_dirs: r,
...e.media_sources ? { media_sources: r.map((e, t) => ({
@@ -1207,37 +1231,37 @@ function gt({ data: e, receipt: t }) {
D.current = n.revision, _([]), y(""), t("已保存配置"), C(n);
} catch (e) {
let t = ft(e);
- t ? (_(t.media_dirs ?? []), y(t.port ?? "")) : (_([]), y(""), x(F(e)));
+ t ? (_(t.media_dirs ?? []), y(t.port ?? "")) : (_([]), y(""), x(I(e)));
} finally {
E.current = !1, d(k.current, !1);
}
}
},
noValidate: !0,
- children: [/* @__PURE__ */ G("div", {
+ children: [/* @__PURE__ */ K("div", {
class: "geist-fieldset-content",
children: [
- /* @__PURE__ */ G(K, { html: a("configTitle", "这台电脑") }),
- /* @__PURE__ */ G("div", {
+ /* @__PURE__ */ K(q, { html: a("configTitle", "这台电脑") }),
+ /* @__PURE__ */ K("div", {
class: "configfield",
children: [
- /* @__PURE__ */ G("span", {
+ /* @__PURE__ */ K("span", {
class: "configlabel",
id: "configDirsLabel",
children: "媒体文件夹"
}),
- /* @__PURE__ */ G("div", {
+ /* @__PURE__ */ K("div", {
class: "configdirs",
role: "group",
"aria-labelledby": "configDirsLabel",
- children: r.map((t, n) => /* @__PURE__ */ G("div", {
+ children: r.map((t, n) => /* @__PURE__ */ K("div", {
class: "configdir",
children: [
- /* @__PURE__ */ G("span", {
+ /* @__PURE__ */ K("span", {
class: "configpathlabel",
children: ["本机文件夹 ", n + 1]
}),
- /* @__PURE__ */ G("input", {
+ /* @__PURE__ */ K("input", {
class: "geist-input",
type: "text",
value: t,
@@ -1248,33 +1272,33 @@ function gt({ data: e, receipt: t }) {
O.current[n] = e;
}
}),
- /* @__PURE__ */ G("button", {
+ /* @__PURE__ */ K("button", {
type: "button",
class: "geist-button configpick",
"aria-label": "选择文件夹",
- onClick: (e) => ne(n, e.currentTarget),
- children: /* @__PURE__ */ G("svg", {
+ onClick: (e) => M(n, e.currentTarget),
+ children: /* @__PURE__ */ K("svg", {
viewBox: "0 0 24 24",
"aria-hidden": "true",
- children: /* @__PURE__ */ G("use", { href: "#i-folder-search" })
+ children: /* @__PURE__ */ K("use", { href: "#i-folder-search" })
})
}),
- r.length > 1 ? /* @__PURE__ */ G("button", {
+ r.length > 1 ? /* @__PURE__ */ K("button", {
type: "button",
class: "geist-button configrm",
"aria-label": "移除这个文件夹",
onClick: () => te(n),
- children: /* @__PURE__ */ G("svg", {
+ children: /* @__PURE__ */ K("svg", {
viewBox: "0 0 24 24",
"aria-hidden": "true",
- children: /* @__PURE__ */ G("use", { href: "#i-x" })
+ children: /* @__PURE__ */ K("use", { href: "#i-x" })
})
}) : null,
- /* @__PURE__ */ G("div", {
+ /* @__PURE__ */ K("div", {
class: "configsource",
- children: [/* @__PURE__ */ G("div", {
+ children: [/* @__PURE__ */ K("div", {
class: "configsourcelabel",
- children: ["媒体来源", /* @__PURE__ */ G(ht, {
+ children: ["媒体来源", /* @__PURE__ */ K(ht, {
label: `媒体来源 ${n + 1}`,
value: o[n] || "local",
onChange: (e) => {
@@ -1282,7 +1306,7 @@ function gt({ data: e, receipt: t }) {
t[n] = e, c(t);
}
})]
- }), e.windows === !1 ? /* @__PURE__ */ G("label", { children: ["Windows 中的对应路径", /* @__PURE__ */ G("input", {
+ }), e.windows === !1 ? /* @__PURE__ */ K("label", { children: ["Windows 中的对应路径", /* @__PURE__ */ K("input", {
class: "geist-input",
"aria-label": `Windows 中的对应路径 ${n + 1}`,
value: l[n] || "",
@@ -1293,7 +1317,7 @@ function gt({ data: e, receipt: t }) {
}
})] }) : null]
}),
- g[n] ? /* @__PURE__ */ G("p", {
+ g[n] ? /* @__PURE__ */ K("p", {
class: "configbad",
role: "alert",
children: g[n]
@@ -1301,61 +1325,61 @@ function gt({ data: e, receipt: t }) {
]
}, n))
}),
- /* @__PURE__ */ G("button", {
+ /* @__PURE__ */ K("button", {
type: "button",
class: "geist-button configadd",
onClick: ee,
children: "添加文件夹"
}),
- o.some((e) => e === "115" || e === "pikpak") ? /* @__PURE__ */ G("p", {
+ o.some((e) => e === "115" || e === "pikpak") ? /* @__PURE__ */ K("p", {
class: "confighelp",
- children: ["先在 CloudDrive 登录网盘并完成挂载。", /* @__PURE__ */ G("a", {
+ children: ["先在 CloudDrive 登录网盘并完成挂载。", /* @__PURE__ */ K("a", {
href: "https://www.clouddrive2.com/help.html",
target: "_blank",
rel: "noreferrer",
- children: ["挂载帮助", /* @__PURE__ */ G("svg", {
+ children: ["挂载帮助", /* @__PURE__ */ K("svg", {
"aria-hidden": "true",
viewBox: "0 0 24 24",
- children: /* @__PURE__ */ G("use", { href: "#i-external-link" })
+ children: /* @__PURE__ */ K("use", { href: "#i-external-link" })
})]
})]
}) : null,
- o.some((e) => e === "115" || e === "pikpak") ? e.mount_dependencies?.filter((e) => !e.available).map((e) => /* @__PURE__ */ G("p", {
+ o.some((e) => e === "115" || e === "pikpak") ? e.mount_dependencies?.filter((e) => !e.available).map((e) => /* @__PURE__ */ K("p", {
class: "confighelp",
children: [
"未检测到 ",
e.name,
"。",
- /* @__PURE__ */ G("a", {
+ /* @__PURE__ */ K("a", {
href: e.download_url,
target: "_blank",
rel: "noreferrer",
children: [
"下载 ",
e.name,
- /* @__PURE__ */ G("svg", {
+ /* @__PURE__ */ K("svg", {
"aria-hidden": "true",
viewBox: "0 0 24 24",
- children: /* @__PURE__ */ G("use", { href: "#i-external-link" })
+ children: /* @__PURE__ */ K("use", { href: "#i-external-link" })
})
]
})
]
})) : null,
- e.windows === !1 ? /* @__PURE__ */ G("p", {
+ e.windows === !1 ? /* @__PURE__ */ K("p", {
class: "confighelp",
children: "本机文件夹是这台电脑读取媒体的位置。Windows 中的对应路径用于匹配馆藏中已有的路径,例如 B:\\ 对应本机挂载文件夹。"
}) : null
]
}),
- e.port_editable === !1 ? null : /* @__PURE__ */ G("div", {
+ e.port_editable === !1 ? null : /* @__PURE__ */ K("div", {
class: "configfield",
children: [
- /* @__PURE__ */ G("label", {
+ /* @__PURE__ */ K("label", {
for: "configPort",
children: "本机访问端口"
}),
- /* @__PURE__ */ G("input", {
+ /* @__PURE__ */ K("input", {
id: "configPort",
class: "geist-input",
type: "text",
@@ -1364,43 +1388,43 @@ function gt({ data: e, receipt: t }) {
"aria-invalid": v ? "true" : void 0,
onInput: (e) => p(e.currentTarget.value)
}),
- v ? /* @__PURE__ */ G("p", {
+ v ? /* @__PURE__ */ K("p", {
class: "configbad",
role: "alert",
children: v
}) : null,
- /* @__PURE__ */ G("p", {
+ /* @__PURE__ */ K("p", {
class: "confighelp",
children: "浏览器地址里冒号后面的数字,一般不用改。"
})
]
}),
- /* @__PURE__ */ G("label", {
+ /* @__PURE__ */ K("label", {
class: "configcheck",
- children: [/* @__PURE__ */ G("span", {
+ children: [/* @__PURE__ */ K("span", {
class: "pcheck",
- children: [/* @__PURE__ */ G("input", {
+ children: [/* @__PURE__ */ K("input", {
type: "checkbox",
checked: m,
onChange: (e) => h(e.currentTarget.checked)
- }), /* @__PURE__ */ G("span", {
+ }), /* @__PURE__ */ K("span", {
"aria-hidden": "true",
- children: /* @__PURE__ */ G("svg", {
+ children: /* @__PURE__ */ K("svg", {
viewBox: "0 0 24 24",
- children: /* @__PURE__ */ G("use", { href: "#i-check" })
+ children: /* @__PURE__ */ K("use", { href: "#i-check" })
})
})]
- }), /* @__PURE__ */ G("span", { children: "保存后扫描并补全资料" })]
+ }), /* @__PURE__ */ K("span", { children: "保存后扫描并补全资料" })]
}),
- b ? /* @__PURE__ */ G(K, { html: s(b, {
+ b ? /* @__PURE__ */ K(q, { html: s(b, {
variant: "error",
label: "没有保存"
}) }) : null
]
- }), /* @__PURE__ */ G("div", {
+ }), /* @__PURE__ */ K("div", {
class: "geist-fieldset-footer",
"data-geist-fieldset-footer": !0,
- children: [/* @__PURE__ */ G("p", { children: e.port_editable === !1 ? "保存后 Peach 会重新载入配置。" : "保存后 Peach 会重新启动,端口改了就用新地址打开。" }), /* @__PURE__ */ G("button", {
+ children: [/* @__PURE__ */ K("p", { children: e.port_editable === !1 ? "保存后 Peach 会重新载入配置。" : "保存后 Peach 会重新启动,端口改了就用新地址打开。" }), /* @__PURE__ */ K("button", {
type: "submit",
class: "geist-button primary",
ref: k,
@@ -1410,41 +1434,41 @@ function gt({ data: e, receipt: t }) {
});
}
function _t({ receipt: e, data: t, error: n }) {
- return n || !t ? /* @__PURE__ */ G(K, {
+ return n || !t ? /* @__PURE__ */ K(q, {
class: "configpage",
html: s(n || "没有读到配置", {
variant: "error",
label: "打不开配置"
})
- }) : /* @__PURE__ */ G("div", {
+ }) : /* @__PURE__ */ K("div", {
class: "configpage",
children: [
- t.startup ? /* @__PURE__ */ G(at, {
+ t.startup ? /* @__PURE__ */ K(at, {
startup: t.startup,
receipt: e
}) : null,
- t.editable ? /* @__PURE__ */ G(gt, {
+ t.editable ? /* @__PURE__ */ K(gt, {
data: t,
receipt: e
- }) : /* @__PURE__ */ G(K, { html: s(t.notice, {
+ }) : /* @__PURE__ */ K(q, { html: s(t.notice, {
variant: "secondary",
label: "只读"
}) }),
- /* @__PURE__ */ G(mt, { data: t }),
- t.peach_proxy ? /* @__PURE__ */ G(rt, {
+ /* @__PURE__ */ K(mt, { data: t }),
+ t.peach_proxy ? /* @__PURE__ */ K(nt, {
initial: t.peach_proxy,
receipt: e
}) : null,
- t.access ? /* @__PURE__ */ G(et, {
+ t.access ? /* @__PURE__ */ K($e, {
initial: t.access,
receipt: e
}) : null,
- t.updates ? /* @__PURE__ */ G(nt, {
+ t.updates ? /* @__PURE__ */ K(tt, {
initial: t.updates,
initialJob: t.update_job
}) : null,
- /* @__PURE__ */ G(pt, { facts: t.facts }),
- t.uninstall ? /* @__PURE__ */ G(st, { uninstall: t.uninstall }) : null
+ /* @__PURE__ */ K(pt, { facts: t.facts }),
+ t.uninstall ? /* @__PURE__ */ K(st, { uninstall: t.uninstall }) : null
]
});
}
@@ -1452,7 +1476,7 @@ function _t({ receipt: e, data: t, error: n }) {
//#region node_modules/@preact/signals-core/dist/signals-core.module.js
var vt = Symbol.for("preact-signals");
function yt() {
- if (J > 1) J--;
+ if (Y > 1) Y--;
else {
var e, t = !1;
for ((function() {
@@ -1474,57 +1498,57 @@ function yt() {
n = r;
}
}
- if (wt = 0, J--, t) throw e;
+ if (wt = 0, Y--, t) throw e;
}
}
function bt(e) {
- if (J > 0) return e();
- Et = ++Tt, J++;
+ if (Y > 0) return e();
+ Et = ++Tt, Y++;
try {
return e();
} finally {
yt();
}
}
-var xt, q = void 0;
+var xt, J = void 0;
function St(e) {
- var t = q, n = xt;
- q = void 0, xt = void 0;
+ var t = J, n = xt;
+ J = void 0, xt = void 0;
try {
return e();
} finally {
- q = t, xt = n;
+ J = t, xt = n;
}
}
-var Ct = void 0, J = 0, wt = 0, Tt = 0, Et = 0, Dt = void 0, Ot = 0;
+var Ct = void 0, Y = 0, wt = 0, Tt = 0, Et = 0, Dt = void 0, Ot = 0;
function kt(e) {
- if (q !== void 0) {
+ if (J !== void 0) {
var t = e.n;
- if (t === void 0 || t.t !== q) return t = {
+ if (t === void 0 || t.t !== J) return t = {
i: 0,
S: e,
- p: q.s,
+ p: J.s,
n: void 0,
- t: q,
+ t: J,
e: void 0,
x: void 0,
r: t
- }, q.s !== void 0 && (q.s.n = t), q.s = t, e.n = t, 32 & q.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 = q.s, t.n = void 0, q.s.n = t, q.s = t), t;
+ }, J.s !== void 0 && (J.s.n = t), J.s = t, e.n = t, 32 & J.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 = J.s, t.n = void 0, J.s.n = t, J.s = t), t;
}
}
-function Y(e, t) {
+function X(e, t) {
this.v = e, this.i = 0, this.n = void 0, this.t = void 0, this.l = 0, this.W = t?.watched, this.Z = t?.unwatched, this.name = t?.name;
}
-Y.prototype.brand = vt, Y.prototype.h = function() {
+X.prototype.brand = vt, X.prototype.h = function() {
return !0;
-}, Y.prototype.S = function(e) {
+}, X.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 ? St(function() {
var e;
(e = t.W) == null || e.call(t);
}) : n.e = e);
-}, Y.prototype.U = function(e) {
+}, X.prototype.U = function(e) {
var t = this;
if (this.t !== void 0) {
var n = e.e, r = e.x;
@@ -1533,7 +1557,7 @@ Y.prototype.brand = vt, Y.prototype.h = function() {
(e = t.Z) == null || e.call(t);
}));
}
-}, Y.prototype.subscribe = function(e) {
+}, X.prototype.subscribe = function(e) {
var t = this;
return Rt(function() {
var n = t.value;
@@ -1541,18 +1565,18 @@ Y.prototype.brand = vt, Y.prototype.h = function() {
return e(n);
});
}, { name: "sub" });
-}, Y.prototype.valueOf = function() {
+}, X.prototype.valueOf = function() {
return this.value;
-}, Y.prototype.toString = function() {
+}, X.prototype.toString = function() {
return this.value + "";
-}, Y.prototype.toJSON = function() {
+}, X.prototype.toJSON = function() {
return this.value;
-}, Y.prototype.peek = function() {
+}, X.prototype.peek = function() {
var e = this;
return St(function() {
return e.value;
});
-}, Object.defineProperty(Y.prototype, "value", {
+}, Object.defineProperty(X.prototype, "value", {
get: function() {
var e = kt(this);
return e !== void 0 && (e.i = this.i), this.v;
@@ -1561,13 +1585,13 @@ Y.prototype.brand = vt, Y.prototype.h = function() {
if (e !== this.v) {
if (wt > 100) throw Error("Cycle detected");
(function(e) {
- J !== 0 && wt === 0 && e.l !== Et && (e.l = Et, Dt = {
+ Y !== 0 && wt === 0 && e.l !== Et && (e.l = Et, Dt = {
S: e,
v: e.v,
i: e.i,
o: Dt
});
- })(this), this.v = e, this.i++, Ot++, J++;
+ })(this), this.v = e, this.i++, Ot++, Y++;
try {
for (var t = this.t; t !== void 0; t = t.x) t.t.N();
} finally {
@@ -1577,7 +1601,7 @@ Y.prototype.brand = vt, Y.prototype.h = function() {
}
});
function At(e, t) {
- return new Y(e, t);
+ return new X(e, t);
}
function jt(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;
@@ -1599,59 +1623,59 @@ function Nt(e) {
}
e.s = n;
}
-function X(e, t) {
- Y.call(this, void 0, t), this.x = e, this.s = void 0, this.g = Ot - 1, this.f = 4;
+function Z(e, t) {
+ X.call(this, void 0, t), this.x = e, this.s = void 0, this.g = Ot - 1, this.f = 4;
}
-X.prototype = new Y(), X.prototype.h = function() {
+Z.prototype = new X(), Z.prototype.h = function() {
if (this.f &= -3, 1 & this.f) return !1;
if ((36 & this.f) == 32 || (this.f &= -5, this.g === Ot)) return !0;
if (this.g = Ot, this.f |= 1, this.i > 0 && !jt(this)) return this.f &= -2, !0;
- var e = q;
+ var e = J;
try {
- Mt(this), q = this;
+ Mt(this), J = 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 q = e, Nt(this), this.f &= -2, !0;
-}, X.prototype.S = function(e) {
+ return J = e, Nt(this), this.f &= -2, !0;
+}, Z.prototype.S = function(e) {
if (this.t === void 0) {
this.f |= 36;
for (var t = this.s; t !== void 0; t = t.n) t.S.S(t);
}
- Y.prototype.S.call(this, e);
-}, X.prototype.U = function(e) {
- if (this.t !== void 0 && (Y.prototype.U.call(this, e), this.t === void 0)) {
+ X.prototype.S.call(this, e);
+}, Z.prototype.U = function(e) {
+ if (this.t !== void 0 && (X.prototype.U.call(this, e), this.t === void 0)) {
this.f &= -33;
for (var t = this.s; t !== void 0; t = t.n) t.S.U(t);
}
-}, X.prototype.N = function() {
+}, Z.prototype.N = function() {
if (!(2 & this.f)) {
this.f |= 6;
for (var e = this.t; e !== void 0; e = e.x) e.t.N();
}
-}, Object.defineProperty(X.prototype, "value", { get: function() {
+}, Object.defineProperty(Z.prototype, "value", { get: function() {
if (1 & this.f) throw Error("Cycle detected");
var e = kt(this);
if (this.h(), e !== void 0 && (e.i = this.i), 16 & this.f) throw this.v;
return this.v;
} });
function Pt(e, t) {
- return new X(e, t);
+ return new Z(e, t);
}
function Ft(e) {
var t = e.m;
if (e.m = void 0, typeof t == "function") {
- J++;
- var n = q;
- q = void 0;
+ Y++;
+ var n = J;
+ J = void 0;
try {
t();
} catch (t) {
throw e.f &= -2, e.f |= 8, It(e), t;
} finally {
- q = n, yt();
+ J = n, yt();
}
}
}
@@ -1660,13 +1684,13 @@ function It(e) {
e.x = void 0, e.s = void 0, Ft(e);
}
function Lt(e) {
- if (q !== this) throw Error("Out-of-order effect");
- Nt(this), q = e, this.f &= -2, 8 & this.f && It(this), yt();
+ if (J !== this) throw Error("Out-of-order effect");
+ Nt(this), J = e, this.f &= -2, 8 & this.f && It(this), yt();
}
-function Z(e, t) {
+function Q(e, t) {
this.x = e, this.m = void 0, this.s = void 0, this.u = void 0, this.f = 32, this.name = t?.name, xt && xt.push(this);
}
-Z.prototype.c = function() {
+Q.prototype.c = function() {
var e = this.S();
try {
if (8 & this.f || this.x === void 0) return;
@@ -1675,20 +1699,20 @@ Z.prototype.c = function() {
} finally {
e();
}
-}, Z.prototype.S = function() {
+}, Q.prototype.S = function() {
if (1 & this.f) throw Error("Cycle detected");
- this.f |= 1, this.f &= -9, Ft(this), Mt(this), J++;
- var e = q;
- return q = this, Lt.bind(this, e);
-}, Z.prototype.N = function() {
+ this.f |= 1, this.f &= -9, Ft(this), Mt(this), Y++;
+ var e = J;
+ return J = this, Lt.bind(this, e);
+}, Q.prototype.N = function() {
2 & this.f || (this.f |= 2, this.u = Ct, Ct = this);
-}, Z.prototype.d = function() {
+}, Q.prototype.d = function() {
this.f |= 8, 1 & this.f || It(this);
-}, Z.prototype.dispose = function() {
+}, Q.prototype.dispose = function() {
this.d();
};
function Rt(e, t) {
- var n = new Z(e, t);
+ var n = new Q(e, t);
try {
n.c();
} catch (e) {
@@ -1703,7 +1727,7 @@ var zt, Bt, Vt = typeof window < "u" && !!window.__PREACT_SIGNALS_DEVTOOLS__, Ht
Rt(function() {
zt = this.N;
})();
-function Q(e, t) {
+function $(e, t) {
y[e] = t.bind(null, y[e] || function() {});
}
function Ut(e) {
@@ -1716,7 +1740,7 @@ function Ut(e) {
function Wt(e) {
var t = this, n = e.data, r = Kt(n);
r.name = "ReactiveDom", r.value = n;
- var i = We(function() {
+ var i = Ue(function() {
for (var e = t, n = t.__v; n = n.__;) if (n.__c) {
n.__c.__$f |= 4;
break;
@@ -1738,7 +1762,7 @@ function Wt(e) {
}, []), a = i[0], o = i[1];
return a.value ? o.peek() : o.value;
}
-Wt.displayName = "ReactiveTextNode", Object.defineProperties(Y.prototype, {
+Wt.displayName = "ReactiveTextNode", Object.defineProperties(X.prototype, {
constructor: {
configurable: !0,
value: void 0
@@ -1760,17 +1784,17 @@ Wt.displayName = "ReactiveTextNode", Object.defineProperties(Y.prototype, {
configurable: !0,
value: 1
}
-}), Q("__b", function(e, t) {
+}), $("__b", function(e, t) {
if (typeof t.type == "string") {
var n, r = t.props;
for (var i in r) if (i !== "children") {
var a = r[i];
- a instanceof Y && (n || (t.__np = n = {}), n[i] = a, r[i] = a.peek());
+ a instanceof X && (n || (t.__np = n = {}), n[i] = a, r[i] = a.peek());
}
}
e(t);
-}), Q("__r", function(e, t) {
- if (e(t), t.type !== N) {
+}), $("__r", function(e, t) {
+ if (e(t), t.type !== P) {
Ut();
var n, r = t.__c;
r && (r.__$f &= -2, (n = r.__$u) === void 0 && (r.__$u = n = function(e, t) {
@@ -1785,9 +1809,9 @@ Wt.displayName = "ReactiveTextNode", Object.defineProperties(Y.prototype, {
};
}(r), typeof t.type == "function" ? t.type.displayName || t.type.name : ""))), Ut(n);
}
-}), Q("__e", function(e, t, n, r) {
+}), $("__e", function(e, t, n, r) {
Ut(), e(t, n, r);
-}), Q("diffed", function(e, t) {
+}), $("diffed", function(e, t) {
Ut();
var n;
if (typeof t.type == "string" && (n = t.__e)) {
@@ -1816,7 +1840,7 @@ function Gt(e, t, n, r) {
})
};
}
-Q("unmount", function(e, t) {
+$("unmount", function(e, t) {
if (typeof t.type == "string") {
var n = t.__e;
if (n) {
@@ -1840,9 +1864,9 @@ Q("unmount", function(e, t) {
}
}
e(t);
-}), Q("__h", function(e, t, n, r) {
+}), $("__h", function(e, t, n, r) {
r < 3 && (t.__$f |= 2), e(t, n, r);
-}), ce.prototype.shouldComponentUpdate = function(e, t) {
+}), se.prototype.shouldComponentUpdate = function(e, t) {
if (this.__R) return !0;
var n = this.__$u, r = n && n.s !== void 0;
for (var i in t) return !0;
@@ -1855,7 +1879,7 @@ Q("unmount", function(e, t) {
return !1;
};
function Kt(e, t) {
- return We(function() {
+ return Ue(function() {
return At(e, t);
}, []);
}
@@ -1885,7 +1909,7 @@ function tn() {
async function nn(e) {
let t = $t += 1;
try {
- let n = await I(Xt, e);
+ let n = await L(Xt, e);
return t === $t && (Qt.value = {
data: n,
error: ""
@@ -1893,7 +1917,7 @@ async function nn(e) {
} catch (n) {
throw !e?.aborted && t === $t && (Qt.value = {
data: null,
- error: F(n)
+ error: I(n)
}), n;
}
}
@@ -1902,7 +1926,7 @@ async function nn(e) {
var rn = (e, t) => nn(t), an = (e) => e.has_cover ? `/cover?code=${encodeURIComponent(e.code ?? "")}` : `/poster?id=${e.id}&c=4`;
function on({ openItem: e, javTitleHtml: t, javDisplayName: n, srcBadge: r }) {
let { data: a, error: o } = en.value;
- if (o) return /* @__PURE__ */ G("div", {
+ if (o) return /* @__PURE__ */ K("div", {
class: "qualitylist",
dangerouslySetInnerHTML: { __html: s(o, {
variant: "error",
@@ -1910,44 +1934,44 @@ function on({ openItem: e, javTitleHtml: t, javDisplayName: n, srcBadge: r }) {
}) }
});
let c = a?.items ?? [];
- return c.length ? /* @__PURE__ */ G("div", {
+ return c.length ? /* @__PURE__ */ K("div", {
class: "qualitylist",
- children: c.map((i) => /* @__PURE__ */ G("article", {
+ children: c.map((i) => /* @__PURE__ */ K("article", {
class: "qualityitem",
- children: [/* @__PURE__ */ G("button", {
+ children: [/* @__PURE__ */ K("button", {
class: "qualitycover",
type: "button",
"aria-label": `打开 ${n(i)}`,
onClick: () => e(i.id),
- children: /* @__PURE__ */ G("img", {
+ children: /* @__PURE__ */ K("img", {
src: an(i),
alt: "",
loading: "lazy",
onError: (e) => e.currentTarget.remove()
})
- }), /* @__PURE__ */ G("div", { children: [
- /* @__PURE__ */ G("h3", { children: /* @__PURE__ */ G("button", {
+ }), /* @__PURE__ */ K("div", { children: [
+ /* @__PURE__ */ K("h3", { children: /* @__PURE__ */ K("button", {
type: "button",
"data-middle-truncate": !0,
onClick: () => e(i.id),
dangerouslySetInnerHTML: { __html: t(i) }
}) }),
- /* @__PURE__ */ G("p", {
+ /* @__PURE__ */ K("p", {
class: "mono",
children: [
- /* @__PURE__ */ G("span", {
+ /* @__PURE__ */ K("span", {
style: "display:contents",
dangerouslySetInnerHTML: { __html: r(i.location, i.cost) }
}),
- /* @__PURE__ */ G("span", { children: m[i.location] ?? i.location }),
- /* @__PURE__ */ G("span", { children: h(i.duration) }),
- /* @__PURE__ */ G("span", { children: g(i.size ?? 0) })
+ /* @__PURE__ */ K("span", { children: m[i.location] ?? i.location }),
+ /* @__PURE__ */ K("span", { children: h(i.duration) }),
+ /* @__PURE__ */ K("span", { children: g(i.size ?? 0) })
]
}),
- i.reason ? /* @__PURE__ */ G("p", { children: i.reason }) : null
+ i.reason ? /* @__PURE__ */ K("p", { children: i.reason }) : null
] })]
}, i.id))
- }) : /* @__PURE__ */ G("div", {
+ }) : /* @__PURE__ */ K("div", {
class: "qualitylist",
dangerouslySetInnerHTML: { __html: i("sparkles", "没有标记中的高清版目标", "现有版本都已满足条件,或还没有加入追踪。") }
});
@@ -1999,37 +2023,37 @@ function cn(e) {
}
//#endregion
//#region src/islands/scraping.tsx
-var ln = (e, t) => I("/api/scraping", t);
+var ln = (e, t) => L("/api/scraping", t);
function un({ value: e, onChange: t }) {
- let n = W(null), r = W(t);
- return r.current = t, U(() => {
+ let n = G(null), r = G(t);
+ return r.current = t, W(() => {
let t = n.current;
t.innerHTML = l([["peach", "Peach 代理"], ["direct", "直接连接"]], e, { label: "连接方式" });
let i = p(t.firstElementChild), a = () => r.current(i.value);
return i.addEventListener("change", a), () => {
i.disabled = !0, i.removeEventListener("change", a), t.replaceChildren();
};
- }, []), /* @__PURE__ */ G("div", {
+ }, []), /* @__PURE__ */ K("div", {
ref: n,
class: "scraping-network"
});
}
function dn({ source: e, toast: t }) {
- let [n, r] = V(e), [i, o] = V(e.network), [c, l] = V(""), [u, f] = V(""), [p, m] = V("paste"), [h, g] = V(""), [_, v] = V(!1), [y, b] = V(""), [x, S] = V([]), C = W(null), w = W(null);
- U(() => {
+ let [n, r] = H(e), [i, o] = H(e.network), [c, l] = H(""), [u, f] = H(""), [p, m] = H("paste"), [h, g] = H(""), [_, v] = H(!1), [y, b] = H(""), [x, S] = H([]), C = G(null), w = G(null);
+ W(() => {
w.current?.querySelectorAll("footer button").forEach((e) => d(e, _));
}, [_]);
- let T = W(new AbortController());
- H(() => () => T.current.abort(), []);
+ let T = G(new AbortController());
+ U(() => () => T.current.abort(), []);
async function E(n) {
if (!_) {
v(!0), b(""), S([]);
try {
if (n === "check") {
- let t = await L("/api/scraping/check", { source: e.source }, "POST", T.current.signal);
+ let t = await R("/api/scraping/check", { source: e.source }, "POST", T.current.signal);
T.current.signal.aborted || S(t.results);
} else {
- let a = await L("/api/scraping/settings", {
+ let a = await R("/api/scraping/settings", {
source: e.source,
network: i,
cookie: c,
@@ -2039,50 +2063,50 @@ function dn({ source: e, toast: t }) {
T.current.signal.aborted || (r(a.saved), l(""), f(""), g(""), C.current && (C.current.value = ""), t(n === "revoke" ? "Cookie 已撤销" : "来源设置已保存"));
}
} catch (e) {
- T.current.signal.aborted || b(F(e));
+ T.current.signal.aborted || b(I(e));
} finally {
T.current.signal.aborted || v(!1);
}
}
}
- return /* @__PURE__ */ G("section", {
+ return /* @__PURE__ */ K("section", {
class: "scraping-source",
- children: /* @__PURE__ */ G("form", {
+ children: /* @__PURE__ */ K("form", {
ref: w,
class: "cleanupfieldset",
"data-geist-fieldset": !0,
onSubmit: (e) => {
e.preventDefault(), E("save");
},
- children: [/* @__PURE__ */ G("div", {
+ children: [/* @__PURE__ */ K("div", {
class: "geist-fieldset-content scraping-fields",
children: [
- /* @__PURE__ */ G("div", { dangerouslySetInnerHTML: { __html: a(`scraping-${e.source}`, e.label) } }),
- /* @__PURE__ */ G("a", {
+ /* @__PURE__ */ K("div", { dangerouslySetInnerHTML: { __html: a(`scraping-${e.source}`, e.label) } }),
+ /* @__PURE__ */ K("a", {
class: "scraping-url",
href: e.login,
target: "_blank",
rel: "noopener noreferrer",
children: e.login
}),
- /* @__PURE__ */ G("div", {
+ /* @__PURE__ */ K("div", {
class: "scraping-label",
- children: ["连接方式", /* @__PURE__ */ G(un, {
+ children: ["连接方式", /* @__PURE__ */ K(un, {
value: i,
onChange: o
})]
}),
- i === "peach" && /* @__PURE__ */ G("a", {
+ i === "peach" && /* @__PURE__ */ K("a", {
href: "/configuration#peachProxy",
children: "配置 Peach 代理"
}),
- e.accepts_cookie && /* @__PURE__ */ G(N, { children: [
- /* @__PURE__ */ G("p", { children: n.cookie_saved ? "Cookie 已保存,登录是否有效请在抓取时确认。" : "需要登录时,任选一种方式提供 Cookie。" }),
- /* @__PURE__ */ G("div", {
+ e.accepts_cookie && /* @__PURE__ */ K(P, { children: [
+ /* @__PURE__ */ K("p", { children: n.cookie_saved ? "Cookie 已保存,登录是否有效请在抓取时确认。" : "需要登录时,任选一种方式提供 Cookie。" }),
+ /* @__PURE__ */ K("div", {
class: "insightswitch scraping-cookie-method",
role: "radiogroup",
"aria-label": "提供 Cookie 的方式(二选一)",
- children: [["paste", "粘贴 Cookie"], ["file", "导入文件"]].map(([t, n]) => /* @__PURE__ */ G("label", { children: [/* @__PURE__ */ G("input", {
+ children: [["paste", "粘贴 Cookie"], ["file", "导入文件"]].map(([t, n]) => /* @__PURE__ */ K("label", { children: [/* @__PURE__ */ K("input", {
type: "radio",
name: `cookie-method-${e.source}`,
value: t,
@@ -2090,29 +2114,29 @@ function dn({ source: e, toast: t }) {
onChange: () => {
m(t), l(""), f(""), g("");
}
- }), /* @__PURE__ */ G("span", { children: n })] }, t))
+ }), /* @__PURE__ */ K("span", { children: n })] }, t))
}),
- p === "paste" ? /* @__PURE__ */ G("label", { children: ["Cookie", /* @__PURE__ */ G("input", {
+ p === "paste" ? /* @__PURE__ */ K("label", { children: ["Cookie", /* @__PURE__ */ K("input", {
class: "geist-input",
type: "password",
autoComplete: "off",
value: c,
disabled: _,
onInput: (e) => l(e.currentTarget.value)
- })] }) : /* @__PURE__ */ G("label", {
+ })] }) : /* @__PURE__ */ K("label", {
class: "scraping-file",
- children: ["Netscape Cookie 文件(.txt)", /* @__PURE__ */ G("span", {
+ children: ["Netscape Cookie 文件(.txt)", /* @__PURE__ */ K("span", {
class: "scraping-file-control",
children: [
- /* @__PURE__ */ G("span", {
+ /* @__PURE__ */ K("span", {
class: "geist-button",
children: "选择文件"
}),
- /* @__PURE__ */ G("span", {
+ /* @__PURE__ */ K("span", {
class: "scraping-file-name",
children: h || "未选择文件"
}),
- /* @__PURE__ */ G("input", {
+ /* @__PURE__ */ K("input", {
ref: C,
type: "file",
accept: ".txt",
@@ -2142,31 +2166,31 @@ function dn({ source: e, toast: t }) {
})]
})
] }),
- y && /* @__PURE__ */ G("div", {
+ y && /* @__PURE__ */ K("div", {
role: "alert",
dangerouslySetInnerHTML: { __html: s(y, { variant: "error" }) }
}),
- x.map((t) => /* @__PURE__ */ G("div", {
+ x.map((t) => /* @__PURE__ */ K("div", {
role: "status",
dangerouslySetInnerHTML: { __html: s(`${e.label}${t.label === "来源页面" ? "" : " 高清图片"}:${t.ok ? "可连接" : "不能连接"}` + (t.width ? ` · ${t.width} × ${t.height}` : "") + (t.message ? `。${t.message}` : ""), { variant: t.ok ? "success" : "error" }) }
}, t.label))
]
- }), /* @__PURE__ */ G("footer", {
+ }), /* @__PURE__ */ K("footer", {
class: "geist-fieldset-footer",
"data-geist-fieldset-footer": !0,
children: [
- /* @__PURE__ */ G("button", {
+ /* @__PURE__ */ K("button", {
class: "geist-button primary",
type: "submit",
children: "保存"
}),
- /* @__PURE__ */ G("button", {
+ /* @__PURE__ */ K("button", {
class: "geist-button",
type: "button",
onClick: () => void E("check"),
children: "检查连接"
}),
- e.accepts_cookie && n.cookie_saved && /* @__PURE__ */ G("button", {
+ e.accepts_cookie && n.cookie_saved && /* @__PURE__ */ K("button", {
class: "geist-button",
type: "button",
onClick: () => void E("revoke"),
@@ -2178,13 +2202,13 @@ function dn({ source: e, toast: t }) {
});
}
function fn({ data: e, error: t, toast: n }) {
- let [r, i] = V(""), [o, c] = V(!1), [l, u] = V(""), f = W(null);
- U(() => d(f.current, o), [o]);
- let p = W(new AbortController()), m = W(0);
+ let [r, i] = H(""), [o, c] = H(!1), [l, u] = H(""), f = G(null);
+ W(() => d(f.current, o), [o]);
+ let p = G(new AbortController()), m = G(0);
async function h(e = !1) {
let t = ++m.current;
await sn({
- read: (e) => I("/api/scraping/cover", e),
+ read: (e) => L("/api/scraping/cover", e),
active: () => !p.current.signal.aborted && t === m.current,
render: (t) => {
c(t.status === "running"), t.status === "running" && (e = !1), t.status === "failed" && !e && u(t.error || "采集未取得"), t.status === "complete" && !e && n(t.result || "封面采集完成");
@@ -2192,37 +2216,37 @@ function fn({ data: e, error: t, toast: n }) {
disconnected: () => u("连接中断,正在重新读取后台进度")
});
}
- H(() => (h(!0), () => p.current.abort()), []);
+ U(() => (h(!0), () => p.current.abort()), []);
async function g() {
if (!o) {
m.current++, c(!0), u("");
try {
- await L("/api/scraping/cover", { code: r }, "POST", p.current.signal), await h();
+ await R("/api/scraping/cover", { code: r }, "POST", p.current.signal), await h();
} catch (e) {
- p.current.signal.aborted || (c(!1), u(F(e)));
+ p.current.signal.aborted || (c(!1), u(I(e)));
}
}
}
- return t ? /* @__PURE__ */ G("div", {
+ return t ? /* @__PURE__ */ K("div", {
role: "alert",
dangerouslySetInnerHTML: { __html: s(t, { variant: "error" }) }
- }) : /* @__PURE__ */ G("div", {
+ }) : /* @__PURE__ */ K("div", {
class: "scraping-page",
children: [
- /* @__PURE__ */ G("p", { children: "高清图片可能需要代理才能下载,请先检查连接。" }),
- /* @__PURE__ */ G("section", {
+ /* @__PURE__ */ K("p", { children: "高清图片可能需要代理才能下载,请先检查连接。" }),
+ /* @__PURE__ */ K("section", {
class: "cleanupfieldset scraping-source",
"data-geist-fieldset": !0,
- children: /* @__PURE__ */ G("div", {
+ children: /* @__PURE__ */ K("div", {
class: "geist-fieldset-content scraping-fields",
children: [
- /* @__PURE__ */ G("div", { dangerouslySetInnerHTML: { __html: a("scraping-cover", "高清封面") } }),
- /* @__PURE__ */ G("form", {
+ /* @__PURE__ */ K("div", { dangerouslySetInnerHTML: { __html: a("scraping-cover", "高清封面") } }),
+ /* @__PURE__ */ K("form", {
class: "scraping-cover-form",
onSubmit: (e) => {
e.preventDefault(), g();
},
- children: [/* @__PURE__ */ G("input", {
+ children: [/* @__PURE__ */ K("input", {
class: "geist-input",
"aria-label": "馆藏番号",
required: !0,
@@ -2230,21 +2254,21 @@ function fn({ data: e, error: t, toast: n }) {
disabled: o,
placeholder: "输入馆藏番号,如 ABW-232",
onInput: (e) => i(e.currentTarget.value)
- }), /* @__PURE__ */ G("button", {
+ }), /* @__PURE__ */ K("button", {
ref: f,
class: "geist-button primary",
type: "submit",
children: "抓取封面"
})]
}),
- l && /* @__PURE__ */ G("div", {
+ l && /* @__PURE__ */ K("div", {
role: "alert",
dangerouslySetInnerHTML: { __html: s(l, { variant: "error" }) }
})
]
})
}),
- e?.sources.map((e) => /* @__PURE__ */ G(dn, {
+ e?.sources.map((e) => /* @__PURE__ */ K(dn, {
source: e,
toast: n
}, e.source))
@@ -2253,14 +2277,14 @@ function fn({ data: e, error: t, toast: n }) {
}
//#endregion
//#region src/islands/library-processing.tsx
-var pn = (e, t) => I("/api/library-processing", t);
+var pn = (e, t) => L("/api/library-processing", t);
function mn({ data: e, error: t, toast: n, onComplete: r, mode: i, monitor: l }) {
- let [u, f] = V(e || { status: "idle" }), [p, m] = V(t), [h, g] = V(!1), [_, v] = V(!1), y = W(new AbortController()), b = W(0), x = W(u.status), S = W(null), C = h || u.status === "running";
- U(() => d(S.current, C), [C]);
+ let [u, f] = H(e || { status: "idle" }), [p, m] = H(t), [h, g] = H(!1), [_, v] = H(!1), y = G(new AbortController()), b = G(0), x = G(u.status), S = G(null), C = h || u.status === "running";
+ W(() => d(S.current, C), [C]);
async function w() {
let e = ++b.current;
await sn({
- read: (e) => I("/api/library-processing", e),
+ read: (e) => L("/api/library-processing", e),
active: () => !y.current.signal.aborted && b.current === e,
keepWatching: i === "notice" || !!l,
render: (e) => {
@@ -2269,49 +2293,49 @@ function mn({ data: e, error: t, toast: n, onComplete: r, mode: i, monitor: l })
disconnected: () => m("连接中断,正在重新读取处理进度")
});
}
- H(() => ((u.status === "running" || i === "notice" || l) && w(), () => y.current.abort()), []);
+ U(() => ((u.status === "running" || i === "notice" || l) && w(), () => y.current.abort()), []);
async function T() {
if (!C) {
g(!0), m(""), v(!1);
try {
- let e = await L("/api/library-processing", {}, "POST", y.current.signal);
+ let e = await R("/api/library-processing", {}, "POST", y.current.signal);
if (y.current.signal.aborted) return;
x.current = e.status, f(e), g(!1), await w();
} catch (e) {
- y.current.signal.aborted || (m(F(e)), g(!1));
+ y.current.signal.aborted || (m(I(e)), g(!1));
}
}
}
- return i === "notice" ? !p && u.status !== "running" && u.status !== "failed" ? null : /* @__PURE__ */ G("div", {
+ return i === "notice" ? !p && u.status !== "running" && u.status !== "failed" ? null : /* @__PURE__ */ K("div", {
class: "library-processing-banner",
role: "status",
- children: [/* @__PURE__ */ G("span", { children: p || (u.status === "failed" ? "扫描与资料采集未完成" : `${u.stage || "正在整理馆藏"}${u.total ? ` · ${u.checked || 0} / ${u.total}` : ""}`) }), /* @__PURE__ */ G("a", {
+ children: [/* @__PURE__ */ K("span", { children: p || (u.status === "failed" ? "扫描与资料采集未完成" : `${u.stage || "正在整理馆藏"}${u.total ? ` · ${u.checked || 0} / ${u.total}` : ""}`) }), /* @__PURE__ */ K("a", {
class: "geist-button",
href: "/data-cleanup#libraryProcessing",
children: p || u.status === "failed" ? "查看并处理" : "查看进度"
})]
- }) : /* @__PURE__ */ G(N, { children: [/* @__PURE__ */ G("div", {
+ }) : /* @__PURE__ */ K(P, { children: [/* @__PURE__ */ K("div", {
class: "geist-fieldset-content library-processing",
children: [
- /* @__PURE__ */ G("div", { dangerouslySetInnerHTML: { __html: a("cleanupScrapingTitle", "扫描与采集") } }),
- /* @__PURE__ */ G("p", { children: "扫描媒体文件夹,导入已有资料,采集缺失信息。" }),
- /* @__PURE__ */ G("div", {
+ /* @__PURE__ */ K("div", { dangerouslySetInnerHTML: { __html: a("cleanupScrapingTitle", "扫描与采集") } }),
+ /* @__PURE__ */ K("p", { children: "扫描媒体文件夹,导入已有资料,采集缺失信息。" }),
+ /* @__PURE__ */ K("div", {
"aria-live": "polite",
children: [
- u.status === "running" && /* @__PURE__ */ G(N, { children: [/* @__PURE__ */ G("div", { dangerouslySetInnerHTML: { __html: o(`${u.stage || "正在处理"}${u.total ? ` · ${u.checked || 0} / ${u.total}` : ""}`) } }), !!u.total && /* @__PURE__ */ G("div", { dangerouslySetInnerHTML: { __html: c(`已处理 ${u.checked || 0} / ${u.total} 个视频`, u.checked || 0, u.total) } })] }),
- (p || u.status === "failed") && /* @__PURE__ */ G("div", {
+ u.status === "running" && /* @__PURE__ */ K(P, { children: [/* @__PURE__ */ K("div", { dangerouslySetInnerHTML: { __html: o(`${u.stage || "正在处理"}${u.total ? ` · ${u.checked || 0} / ${u.total}` : ""}`) } }), !!u.total && /* @__PURE__ */ K("div", { dangerouslySetInnerHTML: { __html: c(`已处理 ${u.checked || 0} / ${u.total} 个视频`, u.checked || 0, u.total) } })] }),
+ (p || u.status === "failed") && /* @__PURE__ */ K("div", {
role: "alert",
dangerouslySetInnerHTML: { __html: s(p || u.error || "处理未完成,请重试", { variant: "error" }) }
}),
- u.status === "failed" && !!u.issues?.length && /* @__PURE__ */ G("ul", { children: u.issues.slice(0, 20).map((e) => /* @__PURE__ */ G("li", { children: [
- e.asset_id ? /* @__PURE__ */ G("a", {
+ u.status === "failed" && !!u.issues?.length && /* @__PURE__ */ K("ul", { children: u.issues.slice(0, 20).map((e) => /* @__PURE__ */ K("li", { children: [
+ e.asset_id ? /* @__PURE__ */ K("a", {
href: `/item/${e.asset_id}`,
children: "查看视频"
}) : null,
e.asset_id ? ":" : "",
e.message
] })) }),
- _ && /* @__PURE__ */ G("div", {
+ _ && /* @__PURE__ */ K("div", {
class: "library-processing-result",
dangerouslySetInnerHTML: { __html: s(`已扫描 ${u.scanned || 0} 个文件,识别 ${u.identified || 0} 个番号,整理 ${u.candidates || 0} 组资料候选。`, {
variant: "success",
@@ -2321,21 +2345,21 @@ function mn({ data: e, error: t, toast: n, onComplete: r, mode: i, monitor: l })
]
})
]
- }), /* @__PURE__ */ G("footer", {
+ }), /* @__PURE__ */ K("footer", {
class: "geist-fieldset-footer",
"data-geist-fieldset-footer": !0,
children: [
- /* @__PURE__ */ G("a", {
+ /* @__PURE__ */ K("a", {
class: "geist-button",
href: "/scraping",
children: "采集来源"
}),
- !!u.candidates && /* @__PURE__ */ G("a", {
+ !!u.candidates && /* @__PURE__ */ K("a", {
class: "geist-button",
href: "/review",
children: "复核资料"
}),
- /* @__PURE__ */ G("button", {
+ /* @__PURE__ */ K("button", {
ref: S,
type: "button",
class: "geist-button primary",
@@ -2403,7 +2427,7 @@ async function xn(e, t, n, r) {
} catch (e) {
i.push({
key: o.key,
- message: F(e)
+ message: I(e)
});
}
}
@@ -2804,16 +2828,16 @@ var Gn = {
load: dt,
component: _t
}
-}, Kn = () => Object.keys(Gn), $ = /* @__PURE__ */ new Map();
-async function qn(e, t, n, r = {}) {
+}, Kn = () => Object.keys(Gn), qn = /* @__PURE__ */ new Map();
+async function Jn(e, t, n, r = {}) {
let i = Gn[e];
if (!i) throw Error(`未注册的 island:${String(e)}`);
- Jn(t);
+ Yn(t);
let a = {
controller: new AbortController(),
painted: !1
};
- $.set(t, a);
+ qn.set(t, a);
let o;
try {
o = {
@@ -2824,12 +2848,12 @@ async function qn(e, t, n, r = {}) {
if (a.controller.signal.aborted) return;
o = {
data: null,
- error: F(e)
+ error: I(e)
};
}
- if ($.get(t) !== a) return;
+ if (qn.get(t) !== a) return;
if (r.isCurrent && !r.isCurrent()) {
- $.delete(t);
+ qn.delete(t);
return;
}
t.textContent = "", a.painted = !0;
@@ -2837,11 +2861,11 @@ async function qn(e, t, n, r = {}) {
...n,
...o
};
- Oe(oe(i.component, s), t);
+ De(ae(i.component, s), t);
}
-function Jn(e) {
- let t = $.get(e);
- t && (t.controller.abort(), $.delete(e), t.painted && Oe(null, e));
+function Yn(e) {
+ let t = qn.get(e);
+ t && (t.controller.abort(), qn.delete(e), t.painted && De(null, e));
}
//#endregion
-export { Rn as TASTE_GUIDE_KEY, An as catalogEmptyHtml, kn as catalogSuggestions, In as cleanupSkeletonHtml, Pn as cloudLocations, Fn as cloudPreferenceLocations, vn as createReviewSelection, On as emptyCatalogLayout, En as entitySkeletonHtml, cn as followJobProgress, Kn as islandNames, Un as javImageKind, wn as matchesFaceSource, qn as mountIsland, Tn as nativeImageFit, Hn as normalizeJavImage, Bn as normalizeJavLayout, Vn as normalizeJavPreferences, ke as preferredDirection, _n as refreshStore, jn as sidebarHasCatalogContent, Nn as sidebarTagCounts, gn as storeNames, Wn as syncJavImages, Mn as syncSidebarSurface, Ln as tasteHistoryGuideHtml, Jn as unmountIsland, sn as watchJob, Cn as wireReviewSelection, zn as wireTasteHistoryGuide };
+export { Rn as TASTE_GUIDE_KEY, An as catalogEmptyHtml, kn as catalogSuggestions, In as cleanupSkeletonHtml, Pn as cloudLocations, Fn as cloudPreferenceLocations, vn as createReviewSelection, On as emptyCatalogLayout, En as entitySkeletonHtml, cn as followJobProgress, Kn as islandNames, Un as javImageKind, wn as matchesFaceSource, Jn as mountIsland, Tn as nativeImageFit, Hn as normalizeJavImage, Bn as normalizeJavLayout, Vn as normalizeJavPreferences, Oe as preferredDirection, _n as refreshStore, jn as sidebarHasCatalogContent, Nn as sidebarTagCounts, gn as storeNames, Wn as syncJavImages, Mn as syncSidebarSurface, Ln as tasteHistoryGuideHtml, Yn as unmountIsland, sn as watchJob, Cn as wireReviewSelection, zn as wireTasteHistoryGuide };