Skip to content

armgit / peach

Public Imported from GitHub
0

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

feat(ui): 统一导航排版与统计口味卡片

longmeidao87d2419f584c
diff --git a/README.en.md b/README.en.md
index b58e5d08b..e0267be2d 100644
--- a/README.en.md
+++ b/README.en.md
@@ -42,6 +42,8 @@ Interface preferences are saved in the current browser and live under Settings:
The interface uses Board styling. Select “Use classic UI” in Settings and apply with a refresh to use the classic interface. “Increase contrast” disables navigation transparency and refraction. Numeric preferences accept custom values within their supported ranges, with switches for optional features.
+“Remember me” uses this browser’s Security preference (1–365 days, default 30). Leaving it unchecked creates a browser session lasting at most 12 hours.
+
## Quick start
Peach is **pre-1.0**. The application interface is currently Chinese only.
diff --git a/README.md b/README.md
index 1303edb9b..f7c9f83aa 100644
--- a/README.md
+++ b/README.md
@@ -42,6 +42,8 @@ Peach 是单用户、本地优先的个人媒体系统。在自己的电脑上
界面采用 Board 风格。设置中可选择「使用旧版 UI」并应用刷新;「增加对比度」关闭导航玻璃的透明与折射。数量和时间支持范围内自定义,可关闭的功能使用开关控制。
+登录页勾选「保持登录」时,使用此浏览器安全设置里的保持时间(1–365 天,默认 30 天)。不勾选时使用最长 12 小时的浏览器会话。
+
## 快速开始
Peach 处于 **pre-1.0** 阶段,界面目前只有中文。
diff --git a/docs/BOARD_UI.md b/docs/BOARD_UI.md
index e3655ffe3..cb0116e0f 100644
--- a/docs/BOARD_UI.md
+++ b/docs/BOARD_UI.md
@@ -22,6 +22,9 @@ Peach 使用 Board 的视觉与组件语义,保留 Vite、Preact、FastAPI 和
| Table | Table / Data Table | 保留选择、排序、批处理和实际数据 |
| Tag / Badge | Chip / Badge | 标签与状态语义分开,保留可操作范围 |
| Sidebar / Drawer | Sidebar 的收起与展开 | 一个按钮控制同一导航,移动端使用遮罩 |
+| 指标带 | Stat Cards | 图标、主读数、色阶底栏;保留统计视图切换,无历史对比时不显示涨跌 |
+| 口味排名 / 维度 | Bar List / Radar Chart | 独立 SVG 与排名条,至少三个有效维度才绘制雷达 |
+| 来源数量分布 | Radial Chart | 独立分布环,与来源明细共用当前查询结果 |
| Spinner / Skeleton / Progress | 原有等价反馈 | 不虚构进度,保持业务请求时机 |
| Scroller / Collapse | 溢出滚动 / 展开分组 | 保留键盘、溢出和展开行为 |
| 视频播放器、照片灯箱、沉浸队列 | 无直接替代 | 保留专用交互,仅统一外围卡片与控件 |
@@ -48,9 +51,42 @@ Peach 使用 Board 的视觉与组件语义,保留 Vite、Preact、FastAPI 和
Input 的上游错误信息位于字段下方,并通过 `errorMessage` 关联;锚定的小提示是用户指定的 Peach 差异。设置布局来自公开 `settings-modal.json`:871×614、274px 导航、32px 内容边距、24px 外圆角。原始设置参考保存在同目录下 `boardui-full/settings-reference.json`。
-## 验收边界
+## 排版、动画与进度
-- 数值设置的 155 项前端测试通过,包含非法值不保存、关闭恢复、异步读取值恢复;构建与类型检查通过。
+正文 14/20、次要文字 13/18、说明 12/16,标题按 24/34、20/26、18/26 分层;手机可编辑输入 16px、40px 控件,避免输入缩放。输入焦点环占用的外侧空间计入索引标题行留白。
+
+桌面侧栏宽 60/260px,按钮与导航共用同一容器;宽度与标签透明/模糊使用 300ms `cubic-bezier(.4,0,.2,1)`。设置面板使用 300ms `cubic-bezier(.32,.72,0,1)`,缩放 .85→1、模糊 4→0;手机抽屉沿水平方向滑入。设置标题下方为 40px 渐隐,滚动后以 200ms 显示。保留分组内行分隔,不给每张统计卡套线。播放器拖拽、时间进度、沉浸切片等没有 Board 等价物,维持媒体语义;系统减少动态效果时关闭装饰动画。
+
+Agent Progress 的公开演示使用定时步骤。Peach 的作业由服务端状态推进,采用自有圆形数量进度,不把计时当作完成,也不把逐作品循环的阶段假装成整批已完成步骤。共核对 9 类入口:
+
+| 入口 | 本次处理 |
+| --- | --- |
+| 扫描与采集 | 当前阶段文字 + 已处理视频数 |
+| 链接检测 | 已检查 / 总数 |
+| 失效链接清理 | 共享后台作业数量进度 |
+| 资源扫描 | 已完成来源 / 总来源 |
+| 资源清理 | 共享后台作业数量进度 |
+| 关注更新 | 已完成来源 / 总来源 |
+| 口味采集 | 共享后台作业数量进度 |
+| 添加关注 | 共享后台作业数量进度 |
+| 版本更新 | 已有下载、校验与安装阶段;由版本分支负责 |
+
+Charts 已核对 Stat Cards、Bar List、Radar、Radial,以及 Orders、Revenue、Contributions、Heatmap、Funnel、Sankey 的数据需求。当前统计查询是快照,`last_played` 不是完整播放事件序列,因此不据此伪造时间热图或月度涨跌;非互斥口味标签不进入漏斗或流向图。
+
+补充公开参考文件 SHA-256:
+
+| 注册表 | SHA-256 |
+| --- | --- |
+| sidebar.json | b3fb5a01f2b334062a0645b71a6c55eec6874da90842270259ff0b1cdc67e42b |
+| auth-card.json | cf4159a700769519867f150acbfafd6f3345b9990fd5b6b76c7609407f413cf2 |
+| settings-modal.json | eb01742ca56daa473f042244176cd697fc20010ab18f680e3a3a8012d69f6c5b |
+| typography.json | 5b7eca25350829755eb15cb474ab009fd1f8b929e62d54182f648b4f2e97bf8e |
+| stat-cards.json | 3a140eeb9ab4ebc327e0e585f6cd6e4331be3e68694e72ec6aab80fd5adf705c |
+
+## 验证记录
+
+- 160 项前端测试通过,包含非法值不保存、关闭恢复、异步读取值恢复、图表数值与可访问语义;构建与类型检查通过。
- 18984 直接服务正式工作树。桌面已检查设置、首页、详情、统计、口味、数据管理、关注管理、配置与复核;390×844 已检查设置、详情、标签与事务所索引,没有页面横向溢出。
- 设置关闭图标中心偏差为 0;纯图标控件不覆盖工具栏业务显隐。旧版模式关闭 Board 样式,增加对比度时导航 `backdrop-filter` 为 `none`,退出两种状态均已核对。
- 预览只读,未写真实 ledger、配置或凭据;脱盘状态下真实播放未验证。生产入口与版本号未改。
+- 390×844 实测索引页无横向溢出、输入 16px;设置数值控件 40px 高。侧栏收起后容器与内容均为 60px,横向滚动轨道隐藏。手机展开按钮位于抽屉内部,抽屉距顶部 12px。
diff --git a/docs/HANDOFF.md b/docs/HANDOFF.md
index 547cfa21e..5b84b78a2 100644
--- a/docs/HANDOFF.md
+++ b/docs/HANDOFF.md
@@ -72,7 +72,7 @@
## 参考产品证据登记
-- [BoardUI 适配与控件对应](BOARD_UI.md):2026-09-08 的公开注册表证据、固定哈希、Switch 与 Segmented Control 的语义区别。用户指定 Board 视觉,旧版样式通过设置保留;字段错误锚定提示和媒体播放器是 Peach 差异。
+- [Board 适配、控件映射与取证](BOARD_UI.md)。
- [Geist 控件](reference-snapshots/vercel-geist-controls-measured.md);[复核操作](reference-snapshots/vercel-review-actions.md);[README 维护](README_MAINTENANCE.md)。
diff --git a/docs/PRODUCT_BACKLOG.md b/docs/PRODUCT_BACKLOG.md
index aedd5d2ef..a9257eca4 100644
--- a/docs/PRODUCT_BACKLOG.md
+++ b/docs/PRODUCT_BACKLOG.md
@@ -8,6 +8,8 @@
正式工作树已实现共享视觉层、管理与详情卡片、设置布局、数值输入和旧版隔离;18984 直接读取该工作树用于只读验收。生产尚未切换。Remix Icon 候选审查在预览 `/icon-review.html`,现有已选图标保留至用户筛选。迁移不包含版本号或其他分支发布工作。
+统计与口味已接入 Stat Cards、独立实现的排名条、雷达与分布环;侧栏使用同一导航的 60/260px 宽窄态,手机从左侧滑入。设置滚动渐隐、手机输入字号、焦点环留白及登录保持时长已接入。业务进度的适配范围与不适用图表见 [Board 适配](BOARD_UI.md)。
+
## 已有骨架、尚未完成(6 项)
- Windows 独立测试包的局域网访问与 mDNS:按用户要求先恢复本机访问,后续加入此功能;测试域名与开发环境隔离。首启页的局域网选项与当前测试包限制不一致,也在此项闭环。
diff --git a/frontend/src/board-metrics.ts b/frontend/src/board-metrics.ts
new file mode 100644
index 000000000..c58bfeead
--- /dev/null
+++ b/frontend/src/board-metrics.ts
@@ -0,0 +1,36 @@
+/** 指标卡与排名图:使用服务端读数,不推导不存在的环比。 */
+const escape=(value:unknown)=>String(value??'').replace(/[&<>"']/g,char=>({'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;',"'":'&#39;'}[char]!));
+export function statCardBody(label:string,value:string,detail:string,icon='chart-no-axes-combined'):string {
+ const glyph=/^[a-z0-9-]+$/.test(icon)?icon:'database';
+ return `<span class="board-stat-label"><span class="board-stat-icon" aria-hidden="true"><svg viewBox="0 0 24 24"><use href="#i-${glyph}"/></svg></span>${escape(label)}</span><b class="board-stat-value">${escape(value)}</b><small class="board-stat-footer">${escape(detail||'当前记录')}</small>`;
+}
+export interface RankedMetric { name:string; score:number }
+export function jobProgressHtml(label:string,value:number,max:number):string {
+ if(!Number.isFinite(max)||max<=0)return '';
+ const done=Math.max(0,Math.min(max,Number.isFinite(value)?value:0)),percent=done/max*100;
+ return `<div class="board-job-progress" role="progressbar" aria-label="${escape(label)}" aria-valuemin="0" aria-valuemax="${max}" aria-valuenow="${done}"><svg width="36" height="36" viewBox="0 0 36 36" aria-hidden="true"><circle class="board-job-track" cx="18" cy="18" r="15"/><circle class="board-job-fill" cx="18" cy="18" r="15" pathLength="100" stroke-dasharray="${percent} ${100-percent}" transform="rotate(-90 18 18)"/></svg><span>${escape(label)}<small>${Math.round(percent)}%</small></span></div>`;
+}
+export function distributionChart(rows:RankedMetric[],label:string):string {
+ const values=rows.filter(row=>Number.isFinite(row.score)&&row.score>0),total=values.reduce((sum,row)=>sum+row.score,0);
+ if(!total)return '';
+ let offset=0;
+ const sectors=values.map((row,i)=>{const length=row.score/total*100;const circle=`<circle cx="100" cy="100" r="72" pathLength="100" fill="none" stroke="var(--chart-${i%4})" stroke-width="22" stroke-dasharray="${length} ${100-length}" stroke-dashoffset="${-offset}"><title>${escape(row.name)}:${row.score.toLocaleString()}</title></circle>`;offset+=length;return circle}).join('');
+ return `<svg class="board-distribution" viewBox="0 0 200 200" role="img" aria-label="${escape(label)}"><g transform="rotate(-90 100 100)">${sectors}</g><text x="100" y="100" text-anchor="middle" dominant-baseline="middle">${escape(label)}</text></svg>`;
+}
+export function rankedChart(rows:RankedMetric[],label:string):string {
+ const values=rows.filter(row=>Number.isFinite(row.score)&&row.score>0).slice().sort((a,b)=>b.score-a.score).slice(0,8);
+ if(!values.length)return '';
+ const max=values[0]!.score;
+ const bars=values.map(row=>`<li><span class="board-rank-fill" style="width:${(row.score/max*100).toFixed(2)}%"></span><span>${escape(row.name)}</span><b>${row.score.toLocaleString()}</b></li>`).join('');
+ return `<ol class="board-ranked-chart" aria-label="${escape(label)}">${bars}</ol>`;
+}
+export function radarChart(rows:RankedMetric[],label:string):string {
+ const values=rows.filter(row=>Number.isFinite(row.score)&&row.score>0).slice().sort((a,b)=>b.score-a.score).slice(0,6);
+ if(values.length<3)return '';
+ const max=Math.max(...values.map(row=>row.score)),n=values.length;
+ const point=(i:number,r:number):[number,number]=>{const a=i/n*Math.PI*2-Math.PI/2;return [160+Math.cos(a)*r,140+Math.sin(a)*r]};
+ const polygon=(radius:(i:number)=>number)=>values.map((_,i)=>point(i,radius(i)).map(v=>v.toFixed(2)).join(',')).join(' ');
+ const grid=[25,50,75,100].map(r=>`<polygon points="${polygon(()=>r)}" class="board-radar-grid"/>`).join('');
+ const axes=values.map((row,i)=>{const [x,y]=point(i,116);return `<text x="${x}" y="${y}" text-anchor="${x<145?'end':x>175?'start':'middle'}">${escape(row.name)}</text>`}).join('');
+ return `<svg class="board-radar" viewBox="0 0 320 280" role="img" aria-label="${escape(label)}"><title>${escape(values.map(row=>`${row.name} ${row.score}`).join(','))}</title>${grid}<polygon points="${polygon(i=>values[i]!.score/max*100)}" class="board-radar-value"/>${axes}</svg>`;
+}
diff --git a/frontend/src/islands.ts b/frontend/src/islands.ts
index 8f5b30b99..9ebce3c3a 100644
--- a/frontend/src/islands.ts
+++ b/frontend/src/islands.ts
@@ -15,6 +15,7 @@
import { h, render } from 'preact';
export { preferredDirection } from './sort-preferences';
export { boundedPreference, mountNumberSetting, syncNumberSetting } from './number-setting';
+export { statCardBody, rankedChart, radarChart, distributionChart, jobProgressHtml } from './board-metrics';
import type { Attributes, ComponentType } from 'preact';
import { errorMessage } from './api';
diff --git a/frontend/src/islands/library-processing.tsx b/frontend/src/islands/library-processing.tsx
index e7e3f6cc8..f0b72e5c7 100644
--- a/frontend/src/islands/library-processing.tsx
+++ b/frontend/src/islands/library-processing.tsx
@@ -1,6 +1,7 @@
import { useEffect, useLayoutEffect, useRef, useState } from 'preact/hooks';
import { apiGet, apiSend, errorMessage } from '../api';
-import { fieldsetTitle, loadingDotsHtml, noteHtml, progressHtml, projectBannerHtml, setActionBusy } from '@peach/legacy/ui';
+import { fieldsetTitle, loadingDotsHtml, noteHtml, projectBannerHtml, setActionBusy } from '@peach/legacy/ui';
+import { jobProgressHtml } from '../board-metrics';
import { watchJob } from '../jobs';
import type { JobState } from '../jobs';
import type { IslandState } from '../islands';
@@ -71,7 +72,7 @@ export function LibraryProcessing({ data, error, toast, onComplete, mode, monito
<div aria-live="polite">
{state.status === 'running' && <>
<div dangerouslySetInnerHTML={{ __html: loadingDotsHtml(`${state.stage || '正在处理'}${state.total ? ` · ${state.checked || 0} / ${state.total}` : ''}`) }} />
- {!!state.total && <div dangerouslySetInnerHTML={{ __html: progressHtml(`已处理 ${state.checked || 0} / ${state.total} 个视频`, state.checked || 0, state.total) }} />}
+ {!!state.total && <div dangerouslySetInnerHTML={{ __html: jobProgressHtml(`已处理 ${state.checked || 0} / ${state.total} 个视频`, state.checked || 0, state.total) }} />}
</>}
{(problem || state.status === 'failed') && <div role="alert" onClick={event=>{if((event.target as HTMLElement).closest('[data-note-action]'))void start();}} dangerouslySetInnerHTML={{ __html: noteHtml(problem || state.error || '处理未完成,请重试', { variant: 'error',filled:true,actionLabel:state.status==='failed'?'重试未完成项':'' }) }} />}
{state.status === 'failed' && !!state.issues?.length && <ul>{state.issues.slice(0, 20).map(issue =>
diff --git a/frontend/src/number-setting.ts b/frontend/src/number-setting.ts
index f7596e2da..06436ef46 100644
--- a/frontend/src/number-setting.ts
+++ b/frontend/src/number-setting.ts
@@ -1,6 +1,7 @@
/** 带单位、可选开关及字段错误反馈的数值设置。 */
export interface NumberSettingSpec { min: number; max: number; unit: string; optional?: boolean; fallback: number }
const specs: Record<string, NumberSettingSpec> = {
+ loginDaysSetting: { min: 1, max: 365, unit: '天', fallback: 30 },
batchSizeSetting: { min: 1, max: 200, unit: '个', fallback: 60 },
hoverDelaySetting: { min: 1, max: 60, unit: '秒', optional: true, fallback: 5 },
seekSecondsSetting: { min: 1, max: 300, unit: '秒', fallback: 10 },
diff --git a/frontend/test/board-metrics.test.ts b/frontend/test/board-metrics.test.ts
new file mode 100644
index 000000000..54fffc9d1
--- /dev/null
+++ b/frontend/test/board-metrics.test.ts
@@ -0,0 +1,28 @@
+import { describe, expect, it } from 'vitest';
+import { radarChart, rankedChart, statCardBody, distributionChart, jobProgressHtml } from '../src/board-metrics';
+describe('指标与图表',()=>{
+ it('分布图忽略空值且扇区以总量归一',()=>{
+ expect(distributionChart([],'分布')).toBe('');
+ const html=distributionChart([{name:'甲',score:1},{name:'乙',score:3}],'分布');
+ expect(html).toContain('stroke-dasharray="25 75"');expect(html).toContain('stroke-dashoffset="-25"');
+ });
+ it('任务进度不虚构未知总量,并限制服务端瞬时越界值',()=>{
+ expect(jobProgressHtml('扫描',1,0)).toBe('');
+ expect(jobProgressHtml('扫描',11,10)).toContain('aria-valuenow="10"');
+ expect(jobProgressHtml('扫描',-1,10)).toContain('aria-valuenow="0"');
+ });
+ it('指标保留读数和来源且转义外部标签',()=>{
+ const html=statCardBody('<来源>','12','当前记录','database');
+ expect(html).toContain('&lt;来源&gt;');expect(html).toContain('>12</b>');expect(html).not.toContain('arrow-up');
+ });
+ it('排名排除无效读数,按强弱排列且不修改原数组',()=>{
+ const rows=[{name:'少',score:2},{name:'<多>',score:10},{name:'未知',score:NaN}];
+ const html=rankedChart(rows,'排名');expect(html.indexOf('&lt;多&gt;')).toBeLessThan(html.indexOf('少'));
+ expect(html).toContain('width:20.00%');expect(html).not.toContain('NaN');expect(rows[0]!.name).toBe('少');
+ });
+ it('雷达图只在至少三个真实维度时出现,并保留可访问读数',()=>{
+ expect(radarChart([{name:'单一',score:1}],'口味')).toBe('');
+ const html=radarChart([{name:'甲',score:1},{name:'乙',score:2},{name:'丙',score:3}],'口味');
+ expect(html).toContain('role="img"');expect(html).toContain('丙 3');expect(html).not.toContain('NaN');
+ });
+});
diff --git a/src/peach/access.py b/src/peach/access.py
index 9372fe683..a3a8c6da2 100644
--- a/src/peach/access.py
+++ b/src/peach/access.py
@@ -12,7 +12,6 @@ import time
from itsdangerous import BadData, URLSafeSerializer
-DURATIONS = {0: "本次浏览器会话", 1: "1 天", 7: "7 天", 30: "30 天", 365: "1 年"}
COOKIE = "peach_session"
@@ -86,7 +85,7 @@ def public(policy: dict) -> dict:
def issue(policy: dict, days: int) -> tuple[str, int | None]:
- if days not in DURATIONS:
+ if type(days) is not int or not 0 <= days <= 365:
raise ValueError("请选择有效的保持登录时间")
seconds = days * 86400 if days else 43200
value = URLSafeSerializer(policy["key"], salt="peach-browser-access").dumps(
diff --git a/src/peach/routes_auth.py b/src/peach/routes_auth.py
index dfd1d64fd..980855464 100644
--- a/src/peach/routes_auth.py
+++ b/src/peach/routes_auth.py
@@ -156,9 +156,8 @@ def login_html(next_path: str, *, invalid: bool = False) -> str:
'background:var(--field);color:var(--ink);padding:0 13px;font:inherit;outline:none}'
'input:focus,select:focus{outline:2px solid var(--ink);outline-offset:2px}'
'form{display:grid;gap:16px}form p{font-size:13px;color:var(--ink-2);margin:0}'
- '.duration{border:0;padding:0;margin:0;display:grid;grid-template-columns:1fr 1fr;gap:8px}'
- '.duration legend{margin-bottom:8px}.duration label{display:flex;align-items:center;gap:8px}'
- '.duration input{width:16px;height:16px;margin:0;accent-color:var(--ink)}'
+ '.remember{display:flex;align-items:center;gap:8px;font-size:14px;line-height:20px}'
+ '.remember input{width:16px;height:16px;margin:0;accent-color:var(--ink);flex:none}'
'button{width:100%;height:44px;margin-top:16px;border:0;border-radius:11px;cursor:pointer;'
'background:var(--ink);color:var(--bg);font:500 15px system-ui,sans-serif}'
'button:hover{background:color-mix(in srgb,var(--ink) 88%,var(--bg));color:var(--bg)}p[role=alert]{margin:0 0 14px;color:var(--alert)}'
@@ -167,11 +166,11 @@ def login_html(next_path: str, *, invalid: bool = False) -> str:
'<label>访问密码 <input name="token" type="password" maxlength="256" '
'autocomplete="current-password" required></label>'
f'<input name="next" type="hidden" value="{safe_next}">'
- '<fieldset class="duration"><legend>在此设备保持登录</legend>'
- + ''.join(f'<label><input type="radio" name="days" value="{days}"{" checked" if days == 30 else ""}>{label}</label>'
- for days, label in access.DURATIONS.items())
- + '</fieldset><p>本次浏览器会话最长 12 小时。清除浏览器数据后需要重新登录。</p>'
- '<button type="submit">登录</button></form></main></body></html>'
+ '<label class="remember"><input type="checkbox" name="days" value="30" checked>保持登录</label>'
+ '<button type="submit">登录</button></form></main><script>'
+ 'try{const d=JSON.parse(localStorage.getItem("peach.settings.v1")||"{}").loginDays;'
+ 'if(Number.isInteger(d)&&d>=1&&d<=365)document.querySelector("[name=days]").value=String(d)}catch{}'
+ '</script></body></html>'
)
@@ -201,8 +200,8 @@ async def login_submit(request: Request):
if token and policy["mode"] != "open" and not await run_in_threadpool(access.verify, policy, supplied, token):
return HTMLResponse(login_html(next_path, invalid=True), status_code=401)
try:
- days = int((form.get("days") or ["30"])[0])
- if days not in access.DURATIONS:
+ days = int((form.get("days") or ["0"])[0])
+ if not 0 <= days <= 365:
raise ValueError
except ValueError:
raise HTTPException(400, "请选择有效的保持登录时间") from None
diff --git a/tests/test_access.py b/tests/test_access.py
index 86fa7646f..e7291cffd 100644
--- a/tests/test_access.py
+++ b/tests/test_access.py
@@ -64,6 +64,19 @@ class AccessTests(unittest.IsolatedAsyncioTestCase):
with patch.object(access.time, "time", return_value=access.time.time() + 43201):
self.assertFalse(access.valid_session(policy, session))
+ async def test_custom_duration_and_unchecked_remember_control(self):
+ access.save(self.path, "correct-password")
+ response = await self.login(days=17)
+ self.assertIn("Max-Age=1468800", response.headers["set-cookie"])
+ self.client.cookies.clear()
+ response = await self.client.post("/login", data={"token": "correct-password"})
+ session_header = next(header for header in response.headers.get_list("set-cookie") if header.startswith(access.COOKIE))
+ self.assertNotIn("Max-Age", session_header)
+ self.assertEqual((await self.login(days=366)).status_code, 400)
+ html = routes_auth.login_html("/")
+ self.assertIn('type="checkbox" name="days"', html)
+ self.assertNotIn('type="radio"', html)
+
async def test_password_change_revokes_sessions_and_disable_is_explicit(self):
policy = access.save(self.path, "correct-password")
await self.login()
diff --git a/web/app.js b/web/app.js
index 2a93c0c90..20a960d06 100644
--- a/web/app.js
+++ b/web/app.js
@@ -1,4 +1,4 @@
-import { resourceScanHtml, boundedPreference, mountNumberSetting, syncNumberSetting } from './dist/peach-ui.js';
+import { resourceScanHtml, boundedPreference, mountNumberSetting, syncNumberSetting, statCardBody, rankedChart, radarChart, distributionChart, jobProgressHtml } from './dist/peach-ui.js';
import {$, ENTITY_ROUTES, LOC, ROUTE_ENTITIES, ROUTE_STATES, SITE_FAVICONS, STATE_LABELS, STATE_ROUTES, api, isAbort, mapLimit, brandIcon, entityPath, esc, faviconFallbackUrl, faviconUrl, linkHost, linkMarkUrl, fmtClock, fmtDur, fmtSize, foldName, icon, isCatalogPath, realDuration} from './js/core.js';
import { faceFrame } from './js/face-frame.js';
import { imageFallbackAttrs, wireImageFallbacks } from './js/image-fallback.js';
@@ -425,6 +425,7 @@ appSettings.batchSize=boundedPreference(+appSettings.batchSize,1,200,60);
appSettings.defaultSort=allowedSetting(appSettings.defaultSort,SORT_KEYS,'seed');
appSettings.hoverDelaySeconds=boundedPreference(+appSettings.hoverDelaySeconds,0,60,5);
appSettings.seekSeconds=boundedPreference(+appSettings.seekSeconds,1,300,10);
+appSettings.loginDays=boundedPreference(+appSettings.loginDays,1,365,30);
appSettings.ambientMode=appSettings.ambientMode!==false;
appSettings.theaterMode=appSettings.theaterMode===true;
appSettings.groupCollapse=appSettings.groupCollapse!==false;
@@ -483,6 +484,8 @@ function renderThemeSetting(){
一处写它们的地方,面板每次打开重画一遍。关注自动更新那一档也在表里,它的应用是
一次网络写入,所以额外报告状态并在往返期间禁用自己。 */
const SETTING_SELECTS=[
+ ['loginDaysSetting','保持登录时间',[['30','30 天']],()=>appSettings.loginDays,
+ value=>{appSettings.loginDays=+value;saveSettings()}],
['batchSizeSetting','每批作品',[['30','30 个'],['60','60 个'],['90','90 个']],
()=>appSettings.batchSize,
value=>{appSettings.batchSize=+value||60;saveSettings();if(location.pathname==='/')load(true)}],
@@ -589,6 +592,7 @@ $('#detailAutoplaySetting').onchange=e=>{appSettings.detailAutoplay=e.target.che
已经进去的反而像没生效。 */
$('#miniplayerSetting').onchange=e=>{appSettings.miniplayer=e.target.checked;saveSettings();if(!appSettings.miniplayer)closeMiniplayer()};
let followScheduleRequest=0;
+let followScheduleStatus=null;
const followScheduleCopy=status=>{
if(!status.available)return '只在账本写入端运行';
if(status.running)return '正在检查全部来源…';
@@ -603,7 +607,7 @@ async function loadFollowScheduleSetting(){
syncNumberSetting($('#followScheduleSetting'),null,true);state.innerHTML=loadingDotsHtml('正在读取状态');
try{
const status=await api('/api/follow/schedule');if(request!==followScheduleRequest)return;
- field.value=status.enabled?String(status.interval_minutes):'0';
+ followScheduleStatus=status;field.value=String(status.interval_minutes);
syncNumberSetting($('#followScheduleSetting'),status.enabled?status.interval_minutes:0,!status.available);
field.disabled=!status.available;state.textContent=followScheduleCopy(status);
}catch(error){if(request===followScheduleRequest)state.textContent=`状态未取得:${error.message||error}`}
@@ -613,9 +617,10 @@ async function saveFollowSchedule(minutes){
state.innerHTML=`${spinnerHtml('保存中')}<span>正在保存…</span>`;
try{
const status=await api('/api/follow/schedule',{method:'POST',body:JSON.stringify({enabled:minutes>0,interval_minutes:minutes||60})});
+ followScheduleStatus=status;
state.textContent=followScheduleCopy(status);
}catch(error){state.textContent=error.message||'保存失败'}
- finally{syncNumberSetting($('#followScheduleSetting'),null,false)}
+ finally{const status=followScheduleStatus;syncNumberSetting($('#followScheduleSetting'),status?(status.enabled?status.interval_minutes:0):null,status?!status.available:false)}
}
/* 来源图标:品牌使用已缓存的官方资产;通用操作图标统一使用本地 Lucide 子集。 */
const SRCICON={
@@ -3354,7 +3359,7 @@ async function openStats(push=true){
const metric=(k,v,max)=>`<div class="statmetric">${kv(k,v.toLocaleString(),pct(v,max)+'%')}${progressHtml(`${k}:${v.toLocaleString()} / ${max.toLocaleString()}`,v,max)}</div>`;
const metricTab=(key,label,value,detail,selected=false)=>`<button type="button" role="tab" data-stats-metric="${key}"
aria-selected="${selected}" aria-controls="stats-detail-${key}" tabindex="${selected?'0':'-1'}">
- <span>${label}</span><b>${value}</b><small>${detail}</small></button>`;
+ ${statCardBody(label,value,detail,{inventory:'database',viewing:'eye',coverage:'tags',storage:'hard-drive'}[key])}</button>`;
const locationRows=d.by_loc.map(row=>{const label=row.k==='online'?'已保存在线':(LOC[row.k]||row.k);return `<div class="insightbarrow"><div><span>${label}</span><b>${row.videos.toLocaleString()}</b></div>
${progressHtml(`${label}:${row.videos.toLocaleString()} / ${totalVideos.toLocaleString()}`,row.videos,totalVideos)}
<small>${gb(row.bytes)} · ${pct(row.videos,totalVideos)}%</small></div>`}).join('');
@@ -3389,8 +3394,7 @@ async function openStats(push=true){
</div>
<section class="insightdetail">
<div id="stats-detail-inventory" role="tabpanel" data-stats-detail="inventory" class="insightdetailbody">
- <div class="insightcopy"><span>库存</span><h2>${totalVideos.toLocaleString()}</h2><b>个视频</b>
- </div>
+ <div class="insightcopy"><span>库存</span>${distributionChart(d.by_loc.map(row=>({name:LOC[row.k]||row.k,score:row.videos})),'视频分布')}</div>
<div class="insightvisual">${totalVideos?locationRows:catalogEmptyHtml({configurable:runtimeConfigurable})}</div></div>
<div id="stats-detail-viewing" role="tabpanel" data-stats-detail="viewing" class="insightdetailbody" hidden>
<div class="insightcopy"><span>观看</span><h2>${cs.played.toLocaleString()}</h2><b>个作品有播放记录</b>
@@ -3492,7 +3496,7 @@ async function wireLinkManager(){
if(payload.status==='idle'){result.innerHTML='';return}
if(payload.status==='failed'){result.innerHTML=noteHtml(payload.error||'检查失败',{variant:'error',label:'检查失败'});return}
const progress=running?loadingDotsHtml(`已检查 ${payload.checked.toLocaleString()} / ${(payload.total||0).toLocaleString()} 条`)
- +(payload.total?progressHtml('已检查链接',payload.checked,payload.total):''):'';
+ +(payload.total?jobProgressHtml('已检查链接',payload.checked,payload.total):''):'';
/* gone 和 unclear 必须分开摆:`linktr.ee` 回 403 是挡爬虫、`x.com` 回 500 是临时错误,
链接本身好好的。混成一张表会让人顺手把好链接一起删掉。 */
const gone=table('已失效',payload.gone||[],'上游明确回 404/410,页面确实没了。');
@@ -3583,7 +3587,7 @@ async function wireResourceSync(){
read:signal=>api('/api/resource-sync/scan',{signal,method:'POST',body:JSON.stringify({background:true,status_only:true})}),
render:state=>{payload=state;if(state.status==='running'){
result.innerHTML=loadingDotsHtml(`后台扫描中:已完成 ${state.completed_sources||0}/${state.total_sources||0} 个来源`)
- +(state.total_sources?progressHtml('已扫描来源',state.completed_sources||0,state.total_sources):'')}},
+ +(state.total_sources?jobProgressHtml('已扫描来源',state.completed_sources||0,state.total_sources):'')}},
disconnected:()=>{result.innerHTML=noteHtml('暂时无法读取进度,正在重新连接…',{label:'任务状态'})}});
if(payload.status==='failed')throw new Error(payload.error||'后台扫描失败');
if(payload.status==='idle')throw new Error('任务尚未启动,请重试扫描');
@@ -3694,7 +3698,7 @@ function tasteAnalysisSection(analysis){
}
function renderTaste(d){
const s=d.summary||{},coverage=d.coverage||{},rank=d.rankings||{},storage=d.storage||{};
- const summary=(label,value,sub='')=>`<div class="tastesummary"><span>${label}</span><b>${value}</b>${sub?`<small>${sub}</small>`:''}</div>`;
+ const summary=(label,value,sub='')=>`<div class="tastesummary">${statCardBody(label,value,sub,{'浏览记录':'history','口味维度':'tags','浏览候选':'search','私有导出':'database','Peach 看过':'eye','喜欢':'thumbs-up','不合口味':'thumbs-down','有标签':'tags'}[label])}</div>`;
const coverageMetric=(label,value,sub,done,total)=>`<div class="tastecovermetric"><span>${label}</span><b>${value}</b><small>${sub}</small>${progressHtml(`${label}:${done} / ${total}`,done,total)}</div>`;
const sourceRows=(d.sources||[]).map(source=>`<div class="tastesource">
<span class="tastebrowser">${icon(source.browser==='browserexport'?'upload':'database')}</span>
@@ -3703,9 +3707,7 @@ function renderTaste(d){
const gapRows=(d.gaps||[]).map(row=>({...row,evidence:['浏览记录']}));
const domainRows=(rank.domains||[]).map(row=>({name:row.name,score:row.visits}));
const categoryRows=(rank.categories||[]).map(row=>({name:row.name,score:row.score}));
- const categoryMax=Math.max(1,...categoryRows.map(row=>Number(row.score||0)));
- const categoryBars=categoryRows.length?categoryRows.map(row=>`<div class="tastebar"><div><span>${esc(row.name)}</span><b>${Number(row.score||0).toLocaleString()}</b></div>
- ${progressHtml(`${row.name}:${Number(row.score||0).toLocaleString()} / ${categoryMax.toLocaleString()}`,row.score||0,categoryMax)}</div>`).join(''):
+ const categoryBars=categoryRows.length?rankedChart(categoryRows,'口味维度排名'):
emptyStateHtml('search','暂无口味维度','采集浏览记录后,这里会显示聚合后的口味证据。');
const rankPanel=(source,key,rows,kind='',empty='暂无足够证据',visual='')=>`<div id="taste-${source}-${key}" role="tabpanel"
data-taste-dimension-panel="${source}:${key}"${tasteDimension[source]===key?'':' hidden'}>
@@ -3740,7 +3742,7 @@ function renderTaste(d){
${summary('不合口味',Number(s.disliked||0).toLocaleString())}
${summary('有标签',Number(coverage.tagged||0).toLocaleString())}</div>
<section class="tastehero" data-taste-evidence-panel="browser"${tasteEvidence==='browser'?'':' hidden'}>
- <div class="insightcopy"><span>浏览器画像</span><h2>${Number(s.history_visits||0).toLocaleString()}</h2><b>条聚合访问证据</b>
+ <div class="insightcopy"><span>浏览器画像</span>${radarChart(categoryRows,'主要口味维度')||'<h2>口味分布</h2>'}
<small>${d.updated_at?`更新于 ${tasteDate(d.updated_at)}`:'尚未采集浏览记录'}</small></div>
<div class="tastebars">${categoryBars}</div></section>
<section class="tastehero" data-taste-evidence-panel="peach"${tasteEvidence==='peach'?'':' hidden'}>
@@ -5308,7 +5310,7 @@ async function wireFollowProgress(){
if(surfaceCurrent(surface))void refreshFollowSurface(surface)},
note:text=>noteHtml(text,{label:'任务状态'}),loading:text=>loadingDotsHtml(text),
container:content=>`<section class="followtask" data-geist-fieldset aria-label="检查更新进度"><div class="geist-fieldset-content">${content}</div></section>`,
- progress:(value,max)=>progressHtml(`已完成 ${value}/${max} 个来源`,value,max)});
+ progress:(value,max)=>jobProgressHtml(`已完成 ${value}/${max} 个来源`,value,max)});
}
async function refreshFollowSurface(surface){
try{
@@ -5333,7 +5335,7 @@ async function wireOperationProgress({host,path,key,title,busy,complete}){
complete(report)},note:text=>noteHtml(text,{label:'任务状态'}),
loading:text=>loadingDotsHtml(text),
container:content=>`<section class="followtask" data-geist-fieldset aria-label="任务进度"><div class="geist-fieldset-content">${content}</div></section>`,
- progress:(value,max)=>progressHtml(`已处理 ${value} / ${max}`,value,max)});
+ progress:(value,max)=>jobProgressHtml(`已处理 ${value} / ${max}`,value,max)});
}
function wireTasteProgress(){
const button=$('#stats').querySelector('[data-taste-refresh]');
@@ -7127,8 +7129,12 @@ function renderFollowDrawer(items){
followTags=new Set([b.dataset.followDrawerTag]);
openDrawer(false);route(followViewPath());openFollow(false)});
}
-function openDrawer(v){const drawer=$('#drawer');if(!v&&drawer.contains(document.activeElement))$('#filterBtn').focus();drawer.inert=!v;drawer.classList.toggle('open',v);$('#scrim').classList.toggle('on',v);
- document.body.classList.toggle('drawer-open',!!v);$('#filterBtn').setAttribute('aria-expanded',String(!!v));$('#filterBtn').setAttribute('aria-controls','drawer');$('#filterBtn').setAttribute('aria-label',v?'收起侧栏':'展开侧栏');sessionStorage.setItem('board.sidebar',v?'open':'closed')}
+function openDrawer(v){const drawer=$('#drawer'),restore=!v&&drawer.contains(document.activeElement);
+ drawer.inert=!v&&(innerWidth<=760||document.documentElement.classList.contains('original-design'));
+ drawer.classList.toggle('open',v);$('#scrim').classList.toggle('on',v);
+ document.body.classList.toggle('drawer-open',!!v);document.dispatchEvent(new Event('board:sidebar'));
+ $('#filterBtn').setAttribute('aria-expanded',String(!!v));$('#filterBtn').setAttribute('aria-controls','drawer');$('#filterBtn').setAttribute('aria-label',v?'收起侧栏':'展开侧栏');
+ if(restore)$('#filterBtn').focus();sessionStorage.setItem('board.sidebar',v?'open':'closed')}
function closeDrawerAfterNav(){drawerSuppressUntil=Date.now()+650;if(innerWidth<=760||document.documentElement.classList.contains('original-design'))openDrawer(false)}
$('#filterBtn').onclick=()=>openDrawer(!$('#drawer').classList.contains('open'));
/* 常驻窄图标条:点即切视图,鼠标停留 180ms 展开完整抽屉 */
@@ -9075,7 +9081,8 @@ function decorate(){
localTabs(config,groups,titles);
}
const settings=document.querySelector('.settingsscroll');
- if(settings){const groups=[...settings.querySelectorAll(':scope > .settinggroup')];localTabs(settings,groups.map(x=>[x]),groups.map(x=>x.querySelector('h3').textContent),settings.parentElement)}
+ if(settings){const groups=[...settings.querySelectorAll(':scope > .settinggroup')];localTabs(settings,groups.map(x=>[x]),groups.map(x=>x.querySelector('h3').textContent),settings.parentElement);
+ if(!settings.dataset.boardScroll){settings.dataset.boardScroll='true';const fade=()=>settings.parentElement.classList.toggle('board-settings-scrolled',settings.scrollTop>0);settings.addEventListener('scroll',fade,{passive:true});fade()}}
const icons={'人工复核':'square-check-big','高清版':'sparkles','重复文件':'file-stack','垃圾文件':'file-archive','空文件夹':'folder','回收站':'trash','扫描与采集':'hard-drive'};
document.querySelectorAll('.cleanupfieldset h2,.cleanupfieldset h3').forEach(heading=>{
if(heading.querySelector('.board-card-icon'))return;
@@ -9084,27 +9091,27 @@ function decorate(){
});
document.querySelectorAll('#managebar [data-manage]').forEach(button=>{if(button.getAttribute('aria-pressed')==='true')button.setAttribute('aria-current','page');else button.removeAttribute('aria-current')});
}
-function syncSortVisibility(){
- const direction=document.querySelector('#defaultSortDirectionSetting');
- const field=direction?.querySelector('.gselect');
- if(direction&&field)direction.hidden=field.disabled;
-}
-const sortDirection=document.querySelector('#defaultSortDirectionSetting');
-if(sortDirection){
- new MutationObserver(syncSortVisibility).observe(sortDirection,{childList:true,subtree:true,attributes:true,attributeFilter:['disabled']});
- syncSortVisibility();
-}
let filterFrame;
const boardBrand=document.querySelector('#brandHome');
+boardBrand.setAttribute('aria-label','Peach 首页');
+const boardToggle=document.querySelector('#filterBtn'),toggleHome=document.createComment('sidebar toggle');boardToggle.before(toggleHome);
function placeBrand(){
if(legacyUI)return;
const close=document.querySelector('#drawerClose');
+ if(close){const head=close.parentElement;head.classList.add('board-sidebar-head');
+ const expanded=document.querySelector('#drawer').classList.contains('open'),desktop=innerWidth>760;
+ if(desktop||expanded){if(boardToggle.parentElement!==head)head.append(boardToggle)}else if(boardToggle.parentElement!==toggleHome.parentElement)toggleHome.after(boardToggle);
+ document.querySelector('#drawer').inert=!desktop&&!expanded;
+ document.querySelectorAll('#drawer .dnav button').forEach(button=>button.setAttribute('aria-label',button.textContent.trim()));
+ }
if(close&&boardBrand.parentElement!==close.parentElement){
const heading=close.parentElement.querySelector('h2,h3,strong,b');if(heading)heading.hidden=true;
close.before(boardBrand);
}
}
placeBrand();
+document.addEventListener('board:sidebar',placeBrand);
+addEventListener('resize',placeBrand);
new MutationObserver(placeBrand).observe(document.querySelector('#drawer'),{childList:true,subtree:true});
const overflowObservers=new WeakMap();
const boardTagbar=document.querySelector('#tagbar'),countbar=document.querySelector('#count');
diff --git a/web/board-entry.css b/web/board-entry.css
index 460f15376..52682c818 100644
--- a/web/board-entry.css
+++ b/web/board-entry.css
@@ -10,3 +10,6 @@ button[type=submit],form>button,.geist-button.primary{background:linear-gradient
button[type=submit]:hover,form>button:hover,.geist-button.primary:hover{background:linear-gradient(#2879fa,#1459df);color:#fff}
.switch label:has(input:checked){background:var(--ground);box-shadow:0 1px 3px #0002}
@media(max-width:480px){main{padding:20px}}
+/* Auth Card:单行登录偏好。 */
+.remember{display:flex;align-items:center;gap:8px;font-size:14px;line-height:20px}
+.remember input{appearance:auto;width:16px;height:16px;margin:0;accent-color:#2473fe;flex:none}
diff --git a/web/board.css b/web/board.css
index 353e89d0c..bd0548b93 100644
--- a/web/board.css
+++ b/web/board.css
@@ -1,8 +1,5 @@
-/* BoardUI surface tokens; Peach retains its layouts and specialized media UI. */
.settingscard .settingsscroll .sidebarsetting{padding:16px 12px 12px 0!important;margin:0!important}
-.settingscard .settingsscroll .settingrow.settingsortrow{grid-template-columns:1fr;gap:12px;padding-block:12px 16px;align-items:start}
.settingscard .settingsscroll .settingsortcontrols>[hidden]{display:none}
-.settingscard .settingsscroll .settingsortcontrols{display:flex;gap:8px;justify-content:flex-end}.settingscard .settingsscroll .settingsortcontrols>div{flex:1}
.board-optional-number{display:flex;align-items:center;gap:12px;flex-direction:row-reverse}.board-number-fields[hidden]{display:none}
.board-number-control input::-webkit-inner-spin-button,.board-number-control input::-webkit-outer-spin-button{appearance:none;margin:0}.board-number-control input{appearance:textfield;-moz-appearance:textfield}
.settingspanel.settingspanel{background:rgba(0,0,0,.7);backdrop-filter:none}
@@ -78,13 +75,6 @@ body{background:var(--page)}
.top{background:var(--page);backdrop-filter:none;border-bottom:0;height:64px}
:root{--topH:64px}
.top .search{background:var(--ground);border:1px solid var(--line);border-radius:var(--control-radius)}
-.edge{left:12px;top:12px;bottom:12px;width:248px;border:1px solid var(--line);border-radius:24px;padding:14px 12px;gap:4px;background:var(--ground);overflow-y:auto;align-items:stretch}
-.edge::before{content:'Peach';font-size:21px;font-weight:600;padding:8px 12px 22px;letter-spacing:.02em}
-.edge button{flex:none;width:100%;height:40px;justify-content:flex-start;padding:0 12px;gap:12px;border-radius:10px;font-size:14px}
-.edge button::after{content:attr(title);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
-.edge button svg{width:19px;height:19px;flex:none}
-.edge button[aria-pressed="true"],.dnav button[aria-pressed="true"]{background:var(--board-blue);color:white;box-shadow:inset 0 1px 1px #ffffff50,0 1px 2px #00000016}
-.edge button:hover:not([aria-pressed="true"]){background:var(--surface)}
.tiers,.tagbar,.javbar{background:var(--page)}
.managebar{background:var(--ground);border:1px solid var(--line);border-radius:14px;padding:6px}
.stats>section,.stats>.fieldset,.fieldset{border-radius:var(--surface-radius)}
@@ -96,7 +86,6 @@ body{background:var(--page)}
.geist-input,.geist-select,.configfield input,.search{box-shadow:0 1px 2px #00000004}
.configfieldset,[data-geist-fieldset]{border-radius:var(--surface-radius);overflow:hidden}
@media(prefers-color-scheme:dark){:root:not([data-theme]){--page:#111;--ground:#1c1c1c;--surface:#232323;--sunk:#171717;--ink:#fafafa;--ink-2:#d4d4d4;--muted:#a3a3a3;--line:#383838;--line-soft:#303030;--inset:#303030;--picked:#303030;--hover:rgba(255,255,255,.07)}}
-.edge{padding-bottom:72px}
/* One sidebar, two states. Navigation and filters share the expanded panel. */
.followmanage .fmain>.fsec{padding:0}
@@ -108,11 +97,6 @@ body{background:var(--page)}
@media(max-width:760px){.followmanage .fsec>.faddform,.followmanage .fsec>.fguess,.followmanage .fsec>#followPicks:not(:empty),.followmanage .fsec>.fnote:not(:empty){margin:16px}.followmanage .faliasmanager>summary{padding:14px 16px}}
:root{--railW:88px;--board-content:1120px}
body.drawer-open{--railW:296px}
-.edge{left:12px;top:12px;bottom:12px;width:64px;padding:16px 7px;align-items:center;gap:6px;border-radius:20px}
-.edge::before{content:'P';font-size:20px;padding:4px 0 16px}
-.edge button{width:48px;height:40px;padding:0;justify-content:center}
-.edge button::after{display:none}
-body.drawer-open .edge{display:none}
.drawer{left:12px;top:12px;bottom:12px;width:272px;background:var(--ground);backdrop-filter:none;border:1px solid var(--line);border-radius:24px;transform:translateX(calc(-100% - 16px));box-shadow:0 2px 4px #00000003;transition:none}
.drawer.open{transform:none;box-shadow:0 2px 4px #00000003}
.drawerscroll{padding:20px 12px 24px}
@@ -163,17 +147,11 @@ body.cleanup-layout #manageTitle,body.cleanup-layout #manageCrumb,body.cleanup-l
.board-local-nav button[aria-selected="true"]{border-bottom-color:var(--tungsten);color:var(--tungsten);font-weight:500}
.board-local-nav button:focus-visible{outline:2px solid var(--tungsten);outline-offset:-3px}
[data-board-group]:not(.board-group-active){display:none!important}
-.settingscard{width:min(900px,calc(100vw - 40px));max-width:900px;border-radius:24px;display:grid;grid-template-columns:180px minmax(0,1fr);grid-template-rows:auto minmax(0,1fr);overflow:hidden}
-.settingshead{grid-column:1/-1;padding:20px 24px;background:var(--ground)}
-.settingscard>.board-local-nav{grid-column:1;grid-row:2;flex-direction:column;gap:4px;padding:16px 12px;margin:0;background:var(--surface);border:0;border-right:1px solid var(--line);overflow-y:auto}
-.settingscard>.board-local-nav button{border:0;border-radius:10px;text-align:left;padding:10px 12px}
-.settingscard>.board-local-nav button[aria-selected="true"]{background:var(--ground);color:var(--ink);box-shadow:0 1px 3px #0000000a}
-.settingsscroll{grid-column:2;grid-row:2;min-height:320px;padding:24px}
-.settingsscroll>.settinggroup{border:0;background:none;border-radius:0;margin:0;padding:0}
-.settingsscroll>.settinggroup>h3{font-size:18px;margin:0 0 20px}
-.settingsscroll .settingrow{padding:18px 0}
-.settingsscroll .settingrow small{max-width:none;line-height:1.5}
-.settingsscroll .settingrow{grid-template-columns:minmax(0,1fr) auto;column-gap:32px}
+.settingscard{display:grid}
+.settingscard>.board-local-nav{margin:0;border:0;border-right:1px solid var(--line-soft);overflow-y:auto}
+.settingsscroll{grid-column:2;grid-row:2}
+.settingsscroll>.settinggroup{border:0;margin:0}
+.settingsscroll .settingrow{grid-template-columns:minmax(0,1fr) auto}
.board-number-control{display:flex;align-items:center;gap:8px}.board-number-control input{width:96px;padding:8px 10px}.board-number-help{font-size:11px!important}.board-number-error{color:#ef6868!important;font-size:12px!important}.board-number-error:empty{display:none}
@media(max-width:600px){.settingsscroll .settingrow{grid-template-columns:1fr;gap:12px}.settingsscroll .settingrow:has(input[type=checkbox]){grid-template-columns:minmax(0,1fr) auto}.board-number-control input{width:110px}}
.pselect,.popmenu{border-radius:12px;border-color:var(--line);box-shadow:0 8px 24px #00000012}
@@ -208,7 +186,6 @@ body::before{display:none}
@media(pointer:coarse){.board-filter-frame #tagbar .pill{height:36px}.board-filter-frame #tagbar{height:52px}.board-filter-frame .sorts button{height:36px}}
#applyUISetting{padding:8px 12px;border:1px solid var(--line);border-radius:8px;cursor:pointer}
#applyUISetting[hidden]{display:none}
-.settingspanel{background:rgba(0,0,0,.38);backdrop-filter:blur(4px)}
@media(max-width:1000px){.cleanupgrid>#libraryProcessing{display:flex}.cleanupgrid>#libraryProcessing>.geist-fieldset-footer{padding:12px 20px;border-top:1px solid var(--line-soft)}.settingscard{width:calc(100vw - 32px)}}
@media(max-width:760px){
@@ -231,7 +208,7 @@ body::before{display:none}
/* Settings rows use a shared baseline; controls wrap only on narrow screens. */
.settingscard .settingsscroll .settingrow.settingsortrow{grid-template-columns:minmax(0,1fr) auto;gap:16px;align-items:center;padding-block:12px}
-.settingscard .settingsscroll .settingsortcontrols{gap:8px;justify-content:end}
+.settingscard .settingsscroll .settingsortcontrols{display:flex;gap:8px;justify-content:end}
.settingscard .settingsscroll .settingsortcontrols>div{flex:0 1 112px;min-width:0}
.settingscard .settingsscroll .settingsortcontrols .gselect{width:112px;min-width:0;padding:0}
.settingscard .settingsscroll .gselectfield{height:32px;padding:0 8px;border-radius:8px;font-size:13px;gap:6px}
@@ -284,3 +261,87 @@ body::before{display:none}
.closestage{padding:0;display:grid;place-items:center;line-height:1;border-radius:50%;background:var(--surface);color:var(--ink)}
.closestage svg{display:block;margin:0;justify-self:center;align-self:center}
+/* BoardUI surface tokens; Peach retains its layouts and specialized media UI. */
+:root{--board-motion:.3s cubic-bezier(.4,0,.2,1);--board-dialog-motion:.3s cubic-bezier(.32,.72,0,1);--fs-lg:16px;--fs-xl:20px;--fs-2xl:24px;--control-h:36px}
+body{font-size:14px;line-height:20px}
+button,input,select,textarea{font-family:inherit}
+.index .ihead{padding:4px;gap:12px;min-width:0;flex-wrap:wrap}
+.index .ihead .geist-search{min-width:140px;margin-right:0}
+.index .ihead h2,#manageTitle{font-size:24px;line-height:34px;font-weight:500}
+.indexheading{font-size:24px;line-height:34px}.indexheading svg{width:24px;height:24px}
+.index .ihead .geist-search input{font-size:14px;line-height:20px}
+.insighttoolbar,.tastehead{gap:16px}
+.settingscard.settingscard{border:0;animation:board-dialog-in var(--board-dialog-motion) both}
+.settingspanel.closing .settingscard.settingscard{animation:board-dialog-out var(--board-dialog-motion) both}
+@keyframes board-dialog-in{from{opacity:0;transform:scale(.85);filter:blur(4px)}to{opacity:1;transform:scale(1);filter:blur(0)}}
+@keyframes board-dialog-out{from{opacity:1;transform:scale(1);filter:blur(0)}to{opacity:0;transform:scale(.85);filter:blur(4px)}}
+.settingscard .settingshead{position:relative;z-index:2}
+.settingscard .settingshead::after{content:'';position:absolute;top:100%;left:0;right:0;height:40px;background:linear-gradient(var(--page),transparent);pointer-events:none;opacity:0;transition:opacity .2s ease-out}
+.settingscard.board-settings-scrolled .settingshead::after{opacity:1}
+.settingscard .settingshead h2{line-height:26px}
+.drawer .board-sidebar-head #drawerClose{display:none}
+.drawer .board-sidebar-head #filterBtn{display:grid;place-items:center;padding:0;width:36px;height:36px;flex:none;border-radius:8px;background:transparent}
+.drawer .board-sidebar-head #filterBtn svg{width:20px;height:20px;margin:0}
+.drawer .board-sidebar-head{gap:8px;min-height:36px}
+.drawer .dnav button span{white-space:nowrap;min-width:0;max-width:190px;overflow:hidden;opacity:1;filter:blur(0);transition:max-width var(--board-motion),opacity var(--board-motion),filter var(--board-motion)}
+@media(min-width:761px){
+ .edge.edge{display:none}body{transition:padding-left var(--board-motion)}
+ .drawer.drawer{width:60px;transform:none;transition:width var(--board-motion);border-radius:24px}
+ .drawer.drawer.open{width:260px}body.drawer-open{--railW:284px}
+ .drawer .drawerscroll{padding:12px}
+ .drawer .dnav button{padding:8px;gap:8px;min-width:36px}
+ .drawer .dnav button svg{width:20px;height:20px;flex:none}
+ .drawer:not(.open) .dnav button span{max-width:0;opacity:0;filter:blur(4px)}
+ .drawer:not(.open) .dnav button{gap:0}
+ .drawer:not(.open) .sec{display:none}
+ .drawer:not(.open) .board-sidebar-head{flex-direction:column-reverse}
+ .drawer:not(.open) #brandHome{margin:0}
+ .drawer:not(.open) #brandHome h1{display:none}
+ .drawer:not(.open) .board-sidebar-head #filterBtn{height:20px}
+}
+@media(max-width:760px){
+ .drawer.drawer{top:12px;bottom:12px;z-index:102;transform:translateX(calc(-100% - 16px));transition:transform var(--board-dialog-motion)}
+ .drawer.drawer.open{transform:translateX(0)}
+ .scrim.scrim.on{top:0;z-index:101;background:#0007}
+ .index .ihead .geist-search{flex-basis:160px}
+ .index .ihead .geist-search input,.geist-input,.configfield input,.settingscard .board-number-control input{font-size:16px}
+ .settingscard .board-number-control{height:40px}.settingscard .board-number-control input{height:38px}
+ .settingscard .settingsscroll .gselect,.settingscard .settingsscroll .gselectfield{height:40px;font-size:14px}
+ .settingscard .settingsscroll .board-number-control>span{font-size:14px}
+}
+@media(prefers-reduced-motion:reduce){:root{--board-motion:0s;--board-dialog-motion:0s}.settingscard .settingshead::after{transition:none}}
+/* Stat Cards 的内层读数与底栏;统计卡仍是可键盘切换的视图入口。 */
+:root{--chart-0:#60a5fa;--chart-1:#a78bfa;--chart-2:#34d399;--chart-3:#fbbf24}
+.board-distribution{width:100%;max-width:240px;align-self:center;margin:auto;min-height:200px}
+.board-distribution text{fill:var(--ink-2);font-family:inherit;font-size:12px}
+.board-job-progress{display:flex;align-items:center;gap:12px;padding:12px 0;font-size:14px;line-height:20px}
+.board-job-progress svg{flex:none}.board-job-progress circle{fill:none;stroke-width:2.5;stroke-linecap:round}
+.board-job-track{stroke:var(--line-soft)}.board-job-fill{stroke:var(--tungsten);transition:stroke-dasharray .3s ease-out}
+.board-job-progress small{display:block;color:var(--muted);font-size:12px;line-height:16px;font-variant-numeric:tabular-nums}
+@media(prefers-reduced-motion:reduce){.board-job-fill{transition:none}}
+.metricstrip,.tastesummaries{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));grid-auto-flow:row;gap:16px;overflow:visible;border:0;background:none}
+.metricstrip>button,.tastesummary{display:flex;flex-direction:column;min-width:0;padding:16px 0 0;border:0;border-radius:16px;background:var(--ground);overflow:hidden;text-align:left;box-shadow:0 1px 2px #00000008}
+.metricstrip>button[aria-selected=true]{background:var(--ground);box-shadow:inset 0 0 0 2px var(--tungsten)}
+.metricstrip>button:hover{background:var(--surface)}
+.metricstrip>button[aria-selected=true]::after{display:none}
+.metricstrip>button:focus-visible{outline:2px solid var(--tungsten);outline-offset:3px}
+.metricstrip .board-stat-label,.tastesummary>.board-stat-label{display:flex;align-items:center;gap:8px;padding:0 16px;color:var(--ink-2);font-size:14px;line-height:20px}
+.board-stat-icon{display:grid;place-items:center;width:28px;height:28px;border-radius:8px;background:linear-gradient(135deg,#3986ff25,#1760ef08);color:var(--tungsten);flex:none}
+.board-stat-icon svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
+.metricstrip>button:nth-child(2) .board-stat-icon,.tastesummary:nth-child(2) .board-stat-icon{color:#a78bfa;background:#a78bfa18}
+.metricstrip>button:nth-child(3) .board-stat-icon,.tastesummary:nth-child(3) .board-stat-icon{color:#34d399;background:#34d39918}
+.metricstrip>button:nth-child(4) .board-stat-icon,.tastesummary:nth-child(4) .board-stat-icon{color:#f59e0b;background:#f59e0b18}
+.metricstrip>button .board-stat-value,.tastesummary>.board-stat-value{padding:12px 16px 16px;font-size:28px;line-height:34px;font-weight:500;color:var(--ink);font-variant-numeric:tabular-nums;letter-spacing:-.02em}
+.metricstrip>button .board-stat-footer,.tastesummary>.board-stat-footer{display:block;padding:10px 16px;background:var(--board-card-foot);margin:auto 0 0;font-size:12px;line-height:18px;color:var(--muted);min-height:38px}
+.insightdetail,.insightpanel,.tastehero,.tasteanalysis,.tasteleads{border:0;border-radius:16px;background:var(--ground);overflow:clip}
+.insightcopy{border:0}.insightpanel>header{border:0;padding-top:8px}
+.board-ranked-chart{list-style:none;margin:0;padding:0;display:grid;gap:8px}
+.board-ranked-chart li{position:relative;isolation:isolate;display:flex;justify-content:space-between;gap:12px;padding:10px 12px;min-height:40px;border-radius:8px;overflow:hidden;font-size:14px;line-height:20px}
+.board-ranked-chart b{font-weight:500;font-variant-numeric:tabular-nums}
+.board-rank-fill{position:absolute;inset:0 auto 0 0;background:color-mix(in srgb,var(--tungsten) 15%,transparent);border-radius:8px;z-index:-1}
+.board-radar{display:block;width:100%;max-height:280px;overflow:visible;margin:8px auto}
+.board-radar-grid{fill:none;stroke:var(--line-soft);stroke-width:1}
+.board-radar-value{fill:color-mix(in srgb,var(--tungsten) 18%,transparent);stroke:var(--tungsten);stroke-width:2;stroke-linejoin:round}
+.board-radar text{font-family:inherit;font-size:12px;fill:var(--muted);dominant-baseline:middle}
+@media(max-width:1000px){.metricstrip,.tastesummaries{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}}
+@media(max-width:480px){.board-stat-label{padding-inline:12px;font-size:13px;gap:6px}.metricstrip>button .board-stat-value,.tastesummary>.board-stat-value{padding:12px;font-size:24px;line-height:34px}.metricstrip>button .board-stat-footer,.tastesummary>.board-stat-footer{padding:8px 12px}.board-stat-icon{width:24px;height:24px}}
diff --git a/web/dist/peach-ui.js b/web/dist/peach-ui.js
index 7b66231b0..34ee5f22e 100644
--- a/web/dist/peach-ui.js
+++ b/web/dist/peach-ui.js
@@ -259,6 +259,12 @@ function ke(e, t, n) {
//#endregion
//#region src/number-setting.ts
var Ae = {
+ loginDaysSetting: {
+ min: 1,
+ max: 365,
+ unit: "天",
+ fallback: 30
+ },
batchSizeSetting: {
min: 1,
max: 200,
@@ -344,14 +350,63 @@ function Ne(e, t, n, r, i) {
return !0;
}
//#endregion
+//#region src/board-metrics.ts
+var R = (e) => String(e ?? "").replace(/[&<>"']/g, (e) => ({
+ "&": "&amp;",
+ "<": "&lt;",
+ ">": "&gt;",
+ "\"": "&quot;",
+ "'": "&#39;"
+})[e]);
+function Pe(e, t, n, r = "chart-no-axes-combined") {
+ return `<span class="board-stat-label"><span class="board-stat-icon" aria-hidden="true"><svg viewBox="0 0 24 24"><use href="#i-${/^[a-z0-9-]+$/.test(r) ? r : "database"}"/></svg></span>${R(e)}</span><b class="board-stat-value">${R(t)}</b><small class="board-stat-footer">${R(n || "当前记录")}</small>`;
+}
+function Fe(e, t, n) {
+ if (!Number.isFinite(n) || n <= 0) return "";
+ let r = Math.max(0, Math.min(n, Number.isFinite(t) ? t : 0)), i = r / n * 100;
+ return `<div class="board-job-progress" role="progressbar" aria-label="${R(e)}" aria-valuemin="0" aria-valuemax="${n}" aria-valuenow="${r}"><svg width="36" height="36" viewBox="0 0 36 36" aria-hidden="true"><circle class="board-job-track" cx="18" cy="18" r="15"/><circle class="board-job-fill" cx="18" cy="18" r="15" pathLength="100" stroke-dasharray="${i} ${100 - i}" transform="rotate(-90 18 18)"/></svg><span>${R(e)}<small>${Math.round(i)}%</small></span></div>`;
+}
+function Ie(e, t) {
+ let n = e.filter((e) => Number.isFinite(e.score) && e.score > 0), r = n.reduce((e, t) => e + t.score, 0);
+ if (!r) return "";
+ let i = 0, a = n.map((e, t) => {
+ let n = e.score / r * 100, a = `<circle cx="100" cy="100" r="72" pathLength="100" fill="none" stroke="var(--chart-${t % 4})" stroke-width="22" stroke-dasharray="${n} ${100 - n}" stroke-dashoffset="${-i}"><title>${R(e.name)}:${e.score.toLocaleString()}</title></circle>`;
+ return i += n, a;
+ }).join("");
+ return `<svg class="board-distribution" viewBox="0 0 200 200" role="img" aria-label="${R(t)}"><g transform="rotate(-90 100 100)">${a}</g><text x="100" y="100" text-anchor="middle" dominant-baseline="middle">${R(t)}</text></svg>`;
+}
+function Le(e, t) {
+ let n = e.filter((e) => Number.isFinite(e.score) && e.score > 0).slice().sort((e, t) => t.score - e.score).slice(0, 8);
+ if (!n.length) return "";
+ let r = n[0].score, i = n.map((e) => `<li><span class="board-rank-fill" style="width:${(e.score / r * 100).toFixed(2)}%"></span><span>${R(e.name)}</span><b>${e.score.toLocaleString()}</b></li>`).join("");
+ return `<ol class="board-ranked-chart" aria-label="${R(t)}">${i}</ol>`;
+}
+function Re(e, t) {
+ let n = e.filter((e) => Number.isFinite(e.score) && e.score > 0).slice().sort((e, t) => t.score - e.score).slice(0, 6);
+ if (n.length < 3) return "";
+ let r = Math.max(...n.map((e) => e.score)), i = n.length, a = (e, t) => {
+ let n = e / i * Math.PI * 2 - Math.PI / 2;
+ return [160 + Math.cos(n) * t, 140 + Math.sin(n) * t];
+ }, o = (e) => n.map((t, n) => a(n, e(n)).map((e) => e.toFixed(2)).join(",")).join(" "), s = [
+ 25,
+ 50,
+ 75,
+ 100
+ ].map((e) => `<polygon points="${o(() => e)}" class="board-radar-grid"/>`).join(""), c = n.map((e, t) => {
+ let [n, r] = a(t, 116);
+ return `<text x="${n}" y="${r}" text-anchor="${n < 145 ? "end" : n > 175 ? "start" : "middle"}">${R(e.name)}</text>`;
+ }).join("");
+ return `<svg class="board-radar" viewBox="0 0 320 280" role="img" aria-label="${R(t)}"><title>${R(n.map((e) => `${e.name} ${e.score}`).join(","))}</title>${s}<polygon points="${o((e) => n[e].score / r * 100)}" class="board-radar-value"/>${c}</svg>`;
+}
+//#endregion
//#region src/api.ts
-var Pe = class extends Error {
+var ze = class extends Error {
status;
body;
constructor(e, t, n = null) {
super(o(e, t)), this.name = "ApiError", this.status = t, this.body = n;
}
-}, Fe = (e) => {
+}, Be = (e) => {
if (!e || typeof e != "object") return "";
let t = e;
for (let e of [
@@ -363,8 +418,8 @@ var Pe = class extends Error {
if (typeof n == "string" && n) return n;
}
return "";
-}, R = (e) => o(e);
-async function z(e, t) {
+}, z = (e) => o(e);
+async function B(e, t) {
let n = await fetch(e, {
headers: { Accept: "application/json" },
credentials: "same-origin",
@@ -373,10 +428,10 @@ async function z(e, t) {
try {
r = await n.json();
} catch {}
- if (!n.ok) throw new Pe(Fe(r) || `请求失败(${n.status})`, n.status);
+ if (!n.ok) throw new ze(Be(r) || `请求失败(${n.status})`, n.status);
return r;
}
-async function B(e, t, n = "POST", r) {
+async function V(e, t, n = "POST", r) {
let i = await fetch(e, {
method: n,
...r ? { signal: r } : {},
@@ -390,14 +445,14 @@ async function B(e, t, n = "POST", r) {
try {
a = await i.json();
} catch {}
- if (!i.ok) throw new Pe(Fe(a) || `请求失败(${i.status})`, i.status, a);
+ if (!i.ok) throw new ze(Be(a) || `请求失败(${i.status})`, i.status, a);
return a;
}
//#endregion
//#region node_modules/preact/hooks/dist/hooks.module.js
-var V, H, Ie, Le, Re = 0, ze = [], U = S, Be = U.__b, Ve = U.__r, He = U.diffed, Ue = U.__c, We = U.unmount, Ge = U.__;
-function Ke(e, t) {
- U.__h && U.__h(H, e, Re || t), Re = 0;
+var Ve, H, He, Ue, We = 0, Ge = [], U = S, Ke = U.__b, qe = U.__r, Je = U.diffed, Ye = U.__c, Xe = U.unmount, Ze = U.__;
+function Qe(e, t) {
+ U.__h && U.__h(H, e, We || t), We = 0;
var n = H.__H || (H.__H = {
__: [],
__h: []
@@ -405,11 +460,11 @@ function Ke(e, t) {
return e >= n.__.length && n.__.push({}), n.__[e];
}
function W(e) {
- return Re = 1, qe(tt, e);
+ return We = 1, $e(st, e);
}
-function qe(e, t, n) {
- var r = Ke(V++, 2);
- if (r.t = e, !r.__c && (r.__ = [n ? n(t) : tt(void 0, t), function(e) {
+function $e(e, t, n) {
+ var r = Qe(Ve++, 2);
+ if (r.t = e, !r.__c && (r.__ = [n ? n(t) : st(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 = H, !H.__f)) {
@@ -441,97 +496,97 @@ function qe(e, t, n) {
return r.__N || r.__;
}
function G(e, t) {
- var n = Ke(V++, 3);
- !U.__s && et(n.__H, t) && (n.__ = e, n.u = t, H.__H.__h.push(n));
+ var n = Qe(Ve++, 3);
+ !U.__s && ot(n.__H, t) && (n.__ = e, n.u = t, H.__H.__h.push(n));
}
function K(e, t) {
- var n = Ke(V++, 4);
- !U.__s && et(n.__H, t) && (n.__ = e, n.u = t, H.__h.push(n));
+ var n = Qe(Ve++, 4);
+ !U.__s && ot(n.__H, t) && (n.__ = e, n.u = t, H.__h.push(n));
}
function q(e) {
- return Re = 5, Je(function() {
+ return We = 5, et(function() {
return { current: e };
}, []);
}
-function Je(e, t) {
- var n = Ke(V++, 7);
- return et(n.__H, t) && (n.__ = e(), n.__H = t, n.__h = e), n.__;
+function et(e, t) {
+ var n = Qe(Ve++, 7);
+ return ot(n.__H, t) && (n.__ = e(), n.__H = t, n.__h = e), n.__;
}
-function Ye() {
- for (var e; e = ze.shift();) {
+function tt() {
+ for (var e; e = Ge.shift();) {
var t = e.__H;
if (e.__P && t) try {
- t.__h.some(Qe), t.__h.some($e), t.__h = [];
+ t.__h.some(it), t.__h.some(at), t.__h = [];
} catch (n) {
t.__h = [], U.__e(n, e.__v);
}
}
}
U.__b = function(e) {
- H = null, Be && Be(e);
+ H = null, Ke && Ke(e);
}, U.__ = function(e, t) {
- e && t.__k && t.__k.__m && (e.__m = t.__k.__m), Ge && Ge(e, t);
+ e && t.__k && t.__k.__m && (e.__m = t.__k.__m), Ze && Ze(e, t);
}, U.__r = function(e) {
- Ve && Ve(e), V = 0;
+ qe && qe(e), Ve = 0;
var t = (H = e.__c).__H;
- t && (Ie === H ? (t.__h = [], H.__h = [], t.__.some(function(e) {
+ t && (He === H ? (t.__h = [], H.__h = [], t.__.some(function(e) {
e.__N && (e.__ = e.__N), e.u = e.__N = void 0;
- })) : (t.__h.some(Qe), t.__h.some($e), t.__h = [], V = 0)), Ie = H;
+ })) : (t.__h.some(it), t.__h.some(at), t.__h = [], Ve = 0)), He = H;
}, U.diffed = function(e) {
- He && He(e);
+ Je && Je(e);
var t = e.__c;
- t && t.__H && (t.__H.__h.length && (ze.push(t) !== 1 && Le === U.requestAnimationFrame || ((Le = U.requestAnimationFrame) || Ze)(Ye)), t.__H.__.some(function(e) {
+ t && t.__H && (t.__H.__h.length && (Ge.push(t) !== 1 && Ue === U.requestAnimationFrame || ((Ue = U.requestAnimationFrame) || rt)(tt)), t.__H.__.some(function(e) {
e.u &&= (e.__H = e.u, void 0);
- })), Ie = H = null;
+ })), He = H = null;
}, U.__c = function(e, t) {
t.some(function(e) {
try {
- e.__h.some(Qe), e.__h = e.__h.filter(function(e) {
- return !e.__ || $e(e);
+ e.__h.some(it), e.__h = e.__h.filter(function(e) {
+ return !e.__ || at(e);
});
} catch (n) {
t.some(function(e) {
e.__h &&= [];
}), t = [], U.__e(n, e.__v);
}
- }), Ue && Ue(e, t);
+ }), Ye && Ye(e, t);
}, U.unmount = function(e) {
- We && We(e);
+ Xe && Xe(e);
var t, n = e.__c;
n && n.__H && (n.__H.__.some(function(e) {
try {
- Qe(e);
+ it(e);
} catch (e) {
t = e;
}
}), n.__H = void 0, t && U.__e(t, n.__v));
};
-var Xe = typeof requestAnimationFrame == "function";
-function Ze(e) {
+var nt = typeof requestAnimationFrame == "function";
+function rt(e) {
var t, n = function() {
- clearTimeout(r), Xe && cancelAnimationFrame(t), setTimeout(e);
+ clearTimeout(r), nt && cancelAnimationFrame(t), setTimeout(e);
}, r = setTimeout(n, 35);
- Xe && (t = requestAnimationFrame(n));
+ nt && (t = requestAnimationFrame(n));
}
-function Qe(e) {
+function it(e) {
var t = H, n = e.__c;
typeof n == "function" && (e.__c = void 0, n()), H = t;
}
-function $e(e) {
+function at(e) {
var t = H;
e.__c = e.__(), H = t;
}
-function et(e, t) {
+function ot(e, t) {
return !e || e.length !== t.length || t.some(function(t, n) {
return t !== e[n];
});
}
-function tt(e, t) {
+function st(e, t) {
return typeof t == "function" ? t(e) : t;
}
//#endregion
//#region node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js
-var nt = 0;
+var ct = 0;
Array.isArray;
function J(e, t, n, r, i, a) {
t ||= {};
@@ -548,7 +603,7 @@ function J(e, t, n, r, i, a) {
__e: null,
__c: null,
constructor: void 0,
- __v: --nt,
+ __v: --ct,
__i: -1,
__u: 0,
__source: i,
@@ -559,7 +614,7 @@ function J(e, t, n, r, i, a) {
}
//#endregion
//#region src/islands/access-settings.tsx
-function rt({ id: e, label: t, value: n, onInput: r, error: i, help: a, current: o = !1, disabled: s = !1 }) {
+function lt({ id: e, label: t, value: n, onInput: r, error: i, help: a, current: o = !1, disabled: s = !1 }) {
return /* @__PURE__ */ J("div", {
class: "configfield",
children: [
@@ -589,7 +644,7 @@ function rt({ id: e, label: t, value: n, onInput: r, error: i, help: a, current:
]
});
}
-function it({ initial: e, receipt: t }) {
+function ut({ initial: e, receipt: t }) {
let [n, r] = W(e), [i, a] = W(""), [o, s] = W(""), [c, l] = W(""), [u, f] = W(!1), [m, h] = W(""), [g, _] = W({}), y = q(null), b = q(!1), x = q(null);
return /* @__PURE__ */ J("form", {
class: "configfieldset",
@@ -604,7 +659,7 @@ function it({ initial: e, receipt: t }) {
}
b.current = !0, v(x.current, !0);
try {
- let e = await B("/api/configuration/access", {
+ let e = await V("/api/configuration/access", {
revision: n.revision,
action: u ? "disable" : "set",
confirm_disable: u,
@@ -614,8 +669,8 @@ function it({ initial: e, receipt: t }) {
});
r(e), a(""), s(""), l(""), f(!1), _({}), t(e.mode === "open" ? "已关闭访问密码" : "已保存访问密码");
} catch (e) {
- let t = e instanceof Pe ? e.body : null, n = t?.errors || t?.detail?.errors;
- n ? _(n) : h(R(e));
+ let t = e instanceof ze ? e.body : null, n = t?.errors || t?.detail?.errors;
+ n ? _(n) : h(z(e));
} finally {
b.current = !1, v(x.current, !1);
}
@@ -650,7 +705,7 @@ function it({ initial: e, receipt: t }) {
})]
}), /* @__PURE__ */ J("span", { children: "关闭访问密码,允许能连接到 Peach 的设备直接访问" })]
}) : null,
- n.mode === "password" ? /* @__PURE__ */ J(rt, {
+ n.mode === "password" ? /* @__PURE__ */ J(lt, {
id: "access-current",
label: "当前访问密码",
value: i,
@@ -658,7 +713,7 @@ function it({ initial: e, receipt: t }) {
error: g.current_password,
current: !0
}) : null,
- n.mode === "locked" ? null : /* @__PURE__ */ J(I, { children: [/* @__PURE__ */ J(rt, {
+ n.mode === "locked" ? null : /* @__PURE__ */ J(I, { children: [/* @__PURE__ */ J(lt, {
id: "access-password",
label: n.mode === "password" ? "新访问密码" : "设置访问密码",
value: o,
@@ -666,7 +721,7 @@ function it({ initial: e, receipt: t }) {
disabled: u,
error: u ? void 0 : g.password,
help: u ? "关闭访问密码时无需填写。" : "至少 8 个字符。保存后其他设备需要重新登录。"
- }), /* @__PURE__ */ J(rt, {
+ }), /* @__PURE__ */ J(lt, {
id: "access-confirm",
label: "确认访问密码",
value: c,
@@ -697,7 +752,7 @@ function it({ initial: e, receipt: t }) {
}
//#endregion
//#region src/islands/release-updates.tsx
-var at = /* @__PURE__ */ new Set([
+var dt = /* @__PURE__ */ new Set([
"downloading",
"verifying",
"extracting",
@@ -705,18 +760,18 @@ var at = /* @__PURE__ */ new Set([
"restarting",
"installing"
]);
-function ot({ initial: e, initialJob: t }) {
+function ft({ initial: e, initialJob: t }) {
let [n, r] = W(e), [i, a] = W(t || {
state: "idle",
progress: 0
}), [o, s] = W(""), c = q(null), u = q(!0), f = q(!1), h = q(null);
G(() => {
- v(h.current, at.has(i.state));
+ v(h.current, dt.has(i.state));
}, [i.state]), G(() => () => {
u.current = !1, c.current?.abort();
}, []);
let g = async () => {
- let e = await B("/api/configuration/update-restart", {});
+ let e = await V("/api/configuration/update-restart", {});
u.current && a(e);
};
G(() => {
@@ -728,10 +783,10 @@ function ot({ initial: e, initialJob: t }) {
onConfirm: g
}));
}, [i.state]), G(() => {
- if (!at.has(i.state)) return;
+ if (!dt.has(i.state)) return;
let e = new AbortController(), t, n = 0, o = async () => {
try {
- let t = await z("/api/configuration/update-status", e.signal);
+ let t = await B("/api/configuration/update-status", e.signal);
e.signal.aborted || (a(t), n = 0, t.state === "complete" && r((e) => ({
...e,
current_version: t.version || e.current_version,
@@ -748,14 +803,14 @@ function ot({ initial: e, initialJob: t }) {
};
}, [i.state]);
let _ = async (e) => {
- if (c.current || at.has(i.state)) return;
+ if (c.current || dt.has(i.state)) return;
let t = new AbortController();
c.current = t, f.current = !1, s(""), v(e, !0);
try {
- let e = await B("/api/configuration/update", {}, "POST", t.signal);
+ let e = await V("/api/configuration/update", {}, "POST", t.signal);
t.signal.aborted || a(e);
} catch (e) {
- t.signal.aborted || s(R(e));
+ t.signal.aborted || s(z(e));
} finally {
c.current = null, v(e, !1);
}
@@ -764,13 +819,13 @@ function ot({ initial: e, initialJob: t }) {
let n = new AbortController();
c.current = n, v(t, !0), s("");
try {
- let e = await z("/api/configuration/updates", n.signal);
+ let e = await B("/api/configuration/updates", n.signal);
n.signal.aborted || r(e);
} catch (t) {
n.signal.aborted || (r({
...e,
state: "error"
- }), s(R(t)));
+ }), s(z(t)));
} finally {
c.current = null, v(t, !1);
}
@@ -875,7 +930,7 @@ function ot({ initial: e, initialJob: t }) {
/* @__PURE__ */ J("button", {
type: "button",
class: "geist-button",
- disabled: at.has(i.state),
+ disabled: dt.has(i.state),
onClick: (e) => y(e.currentTarget),
children: "检查更新"
})
@@ -885,7 +940,7 @@ function ot({ initial: e, initialJob: t }) {
}
//#endregion
//#region src/islands/peach-proxy.tsx
-function st({ initial: e, receipt: t }) {
+function pt({ initial: e, receipt: t }) {
let [n, r] = W(e), [i, a] = W(e.mode), [o, s] = W(""), [c, l] = W(""), u = q(!1), f = q(null), p = q(null), m = q(new AbortController());
G(() => () => m.current.abort(), []), K(() => {
let t = f.current;
@@ -907,13 +962,13 @@ function st({ initial: e, receipt: t }) {
if (!u.current) {
u.current = !0, v(p.current, !0), l("");
try {
- let e = await B("/api/configuration/peach-proxy", {
+ let e = await V("/api/configuration/peach-proxy", {
mode: i,
proxy: o
}, "POST", m.current.signal);
m.current.signal.aborted || (r(e), s(""), t("已保存 Peach 代理"));
} catch (e) {
- m.current.signal.aborted || l(R(e));
+ m.current.signal.aborted || l(z(e));
} finally {
u.current = !1, v(p.current, !1);
}
@@ -976,7 +1031,7 @@ function st({ initial: e, receipt: t }) {
}
//#endregion
//#region src/islands/desktop-settings.tsx
-function ct({ label: e, checked: t, disabled: n, change: r }) {
+function mt({ label: e, checked: t, disabled: n, change: r }) {
return /* @__PURE__ */ J("label", {
class: "configcheck",
children: [/* @__PURE__ */ J("span", {
@@ -996,7 +1051,7 @@ function ct({ label: e, checked: t, disabled: n, change: r }) {
}), /* @__PURE__ */ J("span", { children: e })]
});
}
-function lt({ label: e, checked: t, disabled: n, change: r }) {
+function ht({ label: e, checked: t, disabled: n, change: r }) {
return /* @__PURE__ */ J("label", {
class: "configtoggle",
children: [/* @__PURE__ */ J("span", { children: e }), /* @__PURE__ */ J("input", {
@@ -1009,19 +1064,19 @@ function lt({ label: e, checked: t, disabled: n, change: r }) {
})]
});
}
-function ut({ startup: e, receipt: t }) {
+function gt({ startup: e, receipt: t }) {
let [n, r] = W(e.enabled), [i, a] = W(e.silent), [o, s] = W(e.desktop), [c, l] = W(""), u = q(!1), f = q(null), p = e.available && !e.desktop_message;
async function m() {
if (!u.current) {
u.current = !0, v(f.current, !0), l("");
try {
- await B("/api/configuration/startup", {
+ await V("/api/configuration/startup", {
enabled: n,
silent: i,
desktop: o
}), t("已保存开机自启");
} catch (e) {
- l(R(e));
+ l(z(e));
} finally {
u.current = !1, v(f.current, !1);
}
@@ -1042,7 +1097,7 @@ function ut({ startup: e, receipt: t }) {
role: "group",
"aria-labelledby": "startupTitle",
children: [
- /* @__PURE__ */ J(lt, {
+ /* @__PURE__ */ J(ht, {
label: "开机后启动 Peach",
checked: n,
disabled: !e.available,
@@ -1050,7 +1105,7 @@ function ut({ startup: e, receipt: t }) {
}),
/* @__PURE__ */ J("div", {
class: "configoption",
- children: [/* @__PURE__ */ J(lt, {
+ children: [/* @__PURE__ */ J(ht, {
label: "静默启动",
checked: i,
disabled: !e.available || !n,
@@ -1062,7 +1117,7 @@ function ut({ startup: e, receipt: t }) {
}),
/* @__PURE__ */ J("div", {
class: "configoption",
- children: [/* @__PURE__ */ J(lt, {
+ children: [/* @__PURE__ */ J(ht, {
label: "在桌面创建快捷方式",
checked: o,
disabled: !p,
@@ -1097,7 +1152,7 @@ function ut({ startup: e, receipt: t }) {
})]
});
}
-function dt({ data: e }) {
+function _t({ data: e }) {
let t = q(null);
return K(() => {
let n = t.current, r = document.createElement("details");
@@ -1111,7 +1166,7 @@ function dt({ data: e }) {
return n.replaceChildren(r), y(n, "details", "uninstall-data"), () => n.replaceChildren();
}, [e]), /* @__PURE__ */ J("div", { ref: t });
}
-function ft({ uninstall: e }) {
+function vt({ uninstall: e }) {
let [t, n] = W(!1), [r, i] = W("");
async function a() {
await l({
@@ -1120,7 +1175,7 @@ function ft({ uninstall: e }) {
body: t ? "将退出 Peach,移除程序、开机自启、桌面图标、设置、本地数据库、观看记录、凭据和缓存。原始媒体文件保留。" : "将退出 Peach 并移除程序、开机自启和桌面图标。设置、本地数据库、观看记录与缓存保留。",
confirmLabel: "卸载 Peach",
onConfirm: async () => {
- let e = await B("/api/configuration/uninstall", {
+ let e = await V("/api/configuration/uninstall", {
delete_data: t,
confirmation: "卸载 Peach"
});
@@ -1143,13 +1198,13 @@ function ft({ uninstall: e }) {
children: "卸载会退出 Peach、移除程序、开机自启和桌面图标。原始媒体文件保留。"
})]
}),
- /* @__PURE__ */ J(ct, {
+ /* @__PURE__ */ J(mt, {
label: "完全卸载:同时删除设置、本地数据库、观看记录、凭据和缓存",
checked: t,
disabled: !e.full_available || !!r,
change: n
}),
- /* @__PURE__ */ J(dt, { data: e }),
+ /* @__PURE__ */ J(_t, { data: e }),
e.message && /* @__PURE__ */ J("p", {
class: "confighelp",
children: e.message
@@ -1175,7 +1230,7 @@ function ft({ uninstall: e }) {
}
//#endregion
//#region src/islands/clouddrive-guide.tsx
-var pt = [
+var yt = [
{
name: "机械硬盘,或内存 8 GB 以内",
cache: "10–20 GiB",
@@ -1195,7 +1250,7 @@ var pt = [
task: "2 个起步"
}
];
-function mt() {
+function bt() {
let e = q(null);
return K(() => {
e.current && y(e.current, "details", "clouddrive-guide");
@@ -1247,7 +1302,7 @@ function mt() {
scope: "col",
children: "同时处理视频"
})
- ] }) }), /* @__PURE__ */ J("tbody", { children: pt.map((e) => /* @__PURE__ */ J("tr", { children: [
+ ] }) }), /* @__PURE__ */ J("tbody", { children: yt.map((e) => /* @__PURE__ */ J("tr", { children: [
/* @__PURE__ */ J("th", {
scope: "row",
children: e.name
@@ -1291,18 +1346,18 @@ function mt() {
}
//#endregion
//#region src/islands/configuration.tsx
-var ht = "/api/configuration", gt = "/api/pick-folder", _t = 8e3, vt = (e, t) => z(ht, t), yt = ({ html: e, class: t }) => /* @__PURE__ */ J("div", {
+var xt = "/api/configuration", St = "/api/pick-folder", Ct = 8e3, wt = (e, t) => B(xt, t), Tt = ({ html: e, class: t }) => /* @__PURE__ */ J("div", {
class: t,
dangerouslySetInnerHTML: { __html: e }
-}), bt = (e) => !(e instanceof Pe) || e.status !== 400 ? null : e.body?.errors ?? null;
-function xt({ facts: e }) {
+}), Et = (e) => !(e instanceof ze) || e.status !== 400 ? null : e.body?.errors ?? null;
+function Dt({ facts: e }) {
return /* @__PURE__ */ J("section", {
class: "configfieldset",
"data-geist-fieldset": !0,
"aria-labelledby": "configFactsTitle",
children: /* @__PURE__ */ J("div", {
class: "geist-fieldset-content",
- children: [/* @__PURE__ */ J(yt, { html: d("configFactsTitle", "运行信息") }), /* @__PURE__ */ J("dl", {
+ children: [/* @__PURE__ */ J(Tt, { html: d("configFactsTitle", "运行信息") }), /* @__PURE__ */ J("dl", {
class: "configfacts",
children: e.map((e) => /* @__PURE__ */ J(I, { children: [/* @__PURE__ */ J("dt", { children: e.term }), /* @__PURE__ */ J("dd", { children: [e.value, e.download_url ? /* @__PURE__ */ J("span", {
class: "confighelp",
@@ -1323,7 +1378,7 @@ function xt({ facts: e }) {
})
});
}
-function St({ data: e }) {
+function Ot({ data: e }) {
let [t, n] = W(e.media_sources), [r, i] = W(""), a = q(null);
G(() => () => a.current?.abort(), []);
let o = async (e) => {
@@ -1331,10 +1386,10 @@ function St({ data: e }) {
let t = new AbortController();
a.current = t, v(e, !0), i("");
try {
- let e = await z(ht, t.signal);
+ let e = await B(xt, t.signal);
t.signal.aborted || n(e.media_sources);
} catch (e) {
- t.signal.aborted || i(R(e));
+ t.signal.aborted || i(z(e));
} finally {
a.current = null, v(e, !1);
}
@@ -1345,7 +1400,7 @@ function St({ data: e }) {
children: [/* @__PURE__ */ J("div", {
class: "geist-fieldset-content",
children: [
- /* @__PURE__ */ J(yt, { html: d("configMountsTitle", "挂载状态") }),
+ /* @__PURE__ */ J(Tt, { html: d("configMountsTitle", "挂载状态") }),
/* @__PURE__ */ J("dl", {
class: "configfacts",
children: t.map((e) => /* @__PURE__ */ J(I, { children: [/* @__PURE__ */ J("dt", { children: [/* @__PURE__ */ J("span", {
@@ -1382,7 +1437,7 @@ function St({ data: e }) {
})]
}) : null;
}
-function Ct({ value: e, label: t, onChange: n }) {
+function kt({ value: e, label: t, onChange: n }) {
let r = q(null), i = q(null), a = q(n);
return a.current = n, K(() => {
let n = r.current;
@@ -1408,7 +1463,7 @@ function Ct({ value: e, label: t, onChange: n }) {
class: "configsourcecontrol"
});
}
-function wt({ data: e, receipt: t }) {
+function At({ data: e, receipt: t }) {
let n = e.media_sources?.filter((e) => [
"local",
"115",
@@ -1418,7 +1473,7 @@ function wt({ data: e, receipt: t }) {
w !== null && (O.current[w]?.focus(), T(null));
}, [w]), G(() => {
if (!S) return;
- let e = setTimeout(() => location.assign(S.url), _t);
+ let e = setTimeout(() => location.assign(S.url), Ct);
return () => clearTimeout(e);
}, [S]);
let A = (e, t) => {
@@ -1437,10 +1492,10 @@ function wt({ data: e, receipt: t }) {
if (t.getAttribute("aria-busy") !== "true") {
v(t, !0);
try {
- let { path: t } = await B(gt, { initial: r[e] ?? "" });
+ let { path: t } = await V(St, { initial: r[e] ?? "" });
t && (A(e, t), M(e, ""));
} catch (t) {
- M(e, R(t));
+ M(e, z(t));
} finally {
v(t, !1);
}
@@ -1473,7 +1528,7 @@ function wt({ data: e, receipt: t }) {
if (n.preventDefault(), !E.current) {
E.current = !0, v(k.current, !0), x("");
try {
- let n = await B(ht, {
+ let n = await V(xt, {
revision: D.current,
media_dirs: r,
...e.media_sources ? { media_sources: r.map((e, t) => ({
@@ -1486,8 +1541,8 @@ function wt({ data: e, receipt: t }) {
});
D.current = n.revision, g([]), y(""), t("已保存配置"), C(n);
} catch (e) {
- let t = bt(e);
- t ? (g(t.media_dirs ?? []), y(t.port ?? "")) : (g([]), y(""), x(R(e)));
+ let t = Et(e);
+ t ? (g(t.media_dirs ?? []), y(t.port ?? "")) : (g([]), y(""), x(z(e)));
} finally {
E.current = !1, v(k.current, !1);
}
@@ -1497,7 +1552,7 @@ function wt({ data: e, receipt: t }) {
children: [/* @__PURE__ */ J("div", {
class: "geist-fieldset-content",
children: [
- /* @__PURE__ */ J(yt, { html: d("configTitle", "这台电脑") }),
+ /* @__PURE__ */ J(Tt, { html: d("configTitle", "这台电脑") }),
/* @__PURE__ */ J("div", {
class: "configfield",
children: [
@@ -1554,7 +1609,7 @@ function wt({ data: e, receipt: t }) {
class: "configsource",
children: [/* @__PURE__ */ J("div", {
class: "configsourcelabel",
- children: ["媒体来源", /* @__PURE__ */ J(Ct, {
+ children: ["媒体来源", /* @__PURE__ */ J(kt, {
label: `媒体来源 ${n + 1}`,
value: a[n] || "local",
onChange: (e) => {
@@ -1587,7 +1642,7 @@ function wt({ data: e, receipt: t }) {
onClick: j,
children: "添加文件夹"
}),
- a.some((e) => e === "115" || e === "pikpak") ? /* @__PURE__ */ J(mt, {}) : null,
+ a.some((e) => e === "115" || e === "pikpak") ? /* @__PURE__ */ J(bt, {}) : null,
a.some((e) => e === "115" || e === "pikpak") ? e.mount_dependencies?.filter((e) => !e.available).map((e) => /* @__PURE__ */ J("p", {
class: "confighelp",
children: [
@@ -1662,7 +1717,7 @@ function wt({ data: e, receipt: t }) {
})]
}), /* @__PURE__ */ J("span", { children: "保存后扫描并补全资料" })]
}),
- b ? /* @__PURE__ */ J(yt, { html: p(b, {
+ b ? /* @__PURE__ */ J(Tt, { html: p(b, {
variant: "error",
label: "没有保存"
}) }) : null
@@ -1679,8 +1734,8 @@ function wt({ data: e, receipt: t }) {
})]
});
}
-function Tt({ receipt: e, data: t, error: n }) {
- return n || !t ? /* @__PURE__ */ J(yt, {
+function jt({ receipt: e, data: t, error: n }) {
+ return n || !t ? /* @__PURE__ */ J(Tt, {
class: "configpage",
html: p(n || "没有读到配置", {
variant: "error",
@@ -1693,7 +1748,7 @@ function Tt({ receipt: e, data: t, error: n }) {
class: "configgroup",
children: "通用"
}) : null,
- t.startup ? /* @__PURE__ */ J(ut, {
+ t.startup ? /* @__PURE__ */ J(gt, {
startup: t.startup,
receipt: e
}) : null,
@@ -1701,23 +1756,23 @@ function Tt({ receipt: e, data: t, error: n }) {
class: "configgroup",
children: "媒体"
}),
- t.editable ? /* @__PURE__ */ J(wt, {
+ t.editable ? /* @__PURE__ */ J(At, {
data: t,
receipt: e
- }) : /* @__PURE__ */ J(yt, { html: p(t.notice, {
+ }) : /* @__PURE__ */ J(Tt, { html: p(t.notice, {
variant: "secondary",
label: "只读"
}) }),
- /* @__PURE__ */ J(St, { data: t }),
+ /* @__PURE__ */ J(Ot, { data: t }),
t.peach_proxy || t.access ? /* @__PURE__ */ J("h2", {
class: "configgroup",
children: "网络与访问"
}) : null,
- t.peach_proxy ? /* @__PURE__ */ J(st, {
+ t.peach_proxy ? /* @__PURE__ */ J(pt, {
initial: t.peach_proxy,
receipt: e
}) : null,
- t.access ? /* @__PURE__ */ J(it, {
+ t.access ? /* @__PURE__ */ J(ut, {
initial: t.access,
receipt: e
}) : null,
@@ -1725,34 +1780,34 @@ function Tt({ receipt: e, data: t, error: n }) {
class: "configgroup",
children: "更新与维护"
}),
- t.updates ? /* @__PURE__ */ J(ot, {
+ t.updates ? /* @__PURE__ */ J(ft, {
initial: t.updates,
initialJob: t.update_job
}) : null,
- /* @__PURE__ */ J(xt, { facts: t.facts }),
- t.uninstall ? /* @__PURE__ */ J(ft, { uninstall: t.uninstall }) : null
+ /* @__PURE__ */ J(Dt, { facts: t.facts }),
+ t.uninstall ? /* @__PURE__ */ J(vt, { uninstall: t.uninstall }) : null
]
});
}
//#endregion
//#region node_modules/@preact/signals-core/dist/signals-core.module.js
-var Et = Symbol.for("preact-signals");
-function Dt() {
+var Mt = Symbol.for("preact-signals");
+function Nt() {
if (X > 1) X--;
else {
var e, t = !1;
for ((function() {
- var e = Ft;
- for (Ft = void 0; e !== void 0;) {
+ var e = Vt;
+ for (Vt = void 0; e !== void 0;) {
var t = e.S;
if (t.v === e.v) for (var n = t.t; n !== void 0; n = n.x) n.i === e.i && (n.i = t.i);
e = e.o;
}
- })(); jt !== void 0;) {
- var n = jt;
- for (jt = void 0, Mt++; n !== void 0;) {
+ })(); Lt !== void 0;) {
+ var n = Lt;
+ for (Lt = void 0, Rt++; n !== void 0;) {
var r = n.u;
- if (n.u = void 0, n.f &= -3, !(8 & n.f) && zt(n)) try {
+ if (n.u = void 0, n.f &= -3, !(8 & n.f) && Gt(n)) try {
n.c();
} catch (n) {
t ||= (e = n, !0);
@@ -1760,30 +1815,30 @@ function Dt() {
n = r;
}
}
- if (Mt = 0, X--, t) throw e;
+ if (Rt = 0, X--, t) throw e;
}
}
-function Ot(e) {
+function Pt(e) {
if (X > 0) return e();
- Pt = ++Nt, X++;
+ Bt = ++zt, X++;
try {
return e();
} finally {
- Dt();
+ Nt();
}
}
-var kt, Y = void 0;
-function At(e) {
- var t = Y, n = kt;
- Y = void 0, kt = void 0;
+var Ft, Y = void 0;
+function It(e) {
+ var t = Y, n = Ft;
+ Y = void 0, Ft = void 0;
try {
return e();
} finally {
- Y = t, kt = n;
+ Y = t, Ft = n;
}
}
-var jt = void 0, X = 0, Mt = 0, Nt = 0, Pt = 0, Ft = void 0, It = 0;
-function Lt(e) {
+var Lt = void 0, X = 0, Rt = 0, zt = 0, Bt = 0, Vt = void 0, Ht = 0;
+function Ut(e) {
if (Y !== void 0) {
var t = e.n;
if (t === void 0 || t.t !== Y) return t = {
@@ -1802,11 +1857,11 @@ function Lt(e) {
function Z(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;
}
-Z.prototype.brand = Et, Z.prototype.h = function() {
+Z.prototype.brand = Mt, Z.prototype.h = function() {
return !0;
}, Z.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 ? At(function() {
+ n !== e && e.e === void 0 && (e.x = n, this.t = e, n === void 0 ? It(function() {
var e;
(e = t.W) == null || e.call(t);
}) : n.e = e);
@@ -1814,16 +1869,16 @@ Z.prototype.brand = Et, Z.prototype.h = function() {
var t = this;
if (this.t !== void 0) {
var n = e.e, r = e.x;
- n !== void 0 && (n.x = r, e.e = void 0), r !== void 0 && (r.e = n, e.x = void 0), e === this.t && (this.t = r, r === void 0 && At(function() {
+ n !== void 0 && (n.x = r, e.e = void 0), r !== void 0 && (r.e = n, e.x = void 0), e === this.t && (this.t = r, r === void 0 && It(function() {
var e;
(e = t.Z) == null || e.call(t);
}));
}
}, Z.prototype.subscribe = function(e) {
var t = this;
- return qt(function() {
+ return $t(function() {
var n = t.value;
- At(function() {
+ It(function() {
return e(n);
});
}, { name: "sub" });
@@ -1835,41 +1890,41 @@ Z.prototype.brand = Et, Z.prototype.h = function() {
return this.value;
}, Z.prototype.peek = function() {
var e = this;
- return At(function() {
+ return It(function() {
return e.value;
});
}, Object.defineProperty(Z.prototype, "value", {
get: function() {
- var e = Lt(this);
+ var e = Ut(this);
return e !== void 0 && (e.i = this.i), this.v;
},
set: function(e) {
if (e !== this.v) {
- if (Mt > 100) throw Error("Cycle detected");
+ if (Rt > 100) throw Error("Cycle detected");
(function(e) {
- X !== 0 && Mt === 0 && e.l !== Pt && (e.l = Pt, Ft = {
+ X !== 0 && Rt === 0 && e.l !== Bt && (e.l = Bt, Vt = {
S: e,
v: e.v,
i: e.i,
- o: Ft
+ o: Vt
});
- })(this), this.v = e, this.i++, It++, X++;
+ })(this), this.v = e, this.i++, Ht++, X++;
try {
for (var t = this.t; t !== void 0; t = t.x) t.t.N();
} finally {
- Dt();
+ Nt();
}
}
}
});
-function Rt(e, t) {
+function Wt(e, t) {
return new Z(e, t);
}
-function zt(e) {
+function Gt(e) {
for (var t = e.s; t !== void 0; t = t.n) if (t.S.i !== t.i || !t.S.h() || t.S.i !== t.i) return !0;
return !1;
}
-function Bt(e) {
+function Kt(e) {
for (var t = e.s; t !== void 0; t = t.n) {
var n = t.S.n;
if (n !== void 0 && (t.r = n), t.S.n = t, t.i = -1, t.n === void 0) {
@@ -1878,7 +1933,7 @@ function Bt(e) {
}
}
}
-function Vt(e) {
+function qt(e) {
for (var t = e.s, n = void 0; t !== void 0;) {
var r = t.p;
t.i === -1 ? (t.S.U(t), r !== void 0 && (r.n = t.n), t.n !== void 0 && (t.n.p = r)) : n = t, t.S.n = t.r, t.r !== void 0 && (t.r = void 0), t = r;
@@ -1886,21 +1941,21 @@ function Vt(e) {
e.s = n;
}
function Q(e, t) {
- Z.call(this, void 0, t), this.x = e, this.s = void 0, this.g = It - 1, this.f = 4;
+ Z.call(this, void 0, t), this.x = e, this.s = void 0, this.g = Ht - 1, this.f = 4;
}
Q.prototype = new Z(), Q.prototype.h = function() {
if (this.f &= -3, 1 & this.f) return !1;
- if ((36 & this.f) == 32 || (this.f &= -5, this.g === It)) return !0;
- if (this.g = It, this.f |= 1, this.i > 0 && !zt(this)) return this.f &= -2, !0;
+ if ((36 & this.f) == 32 || (this.f &= -5, this.g === Ht)) return !0;
+ if (this.g = Ht, this.f |= 1, this.i > 0 && !Gt(this)) return this.f &= -2, !0;
var e = Y;
try {
- Bt(this), Y = this;
+ Kt(this), Y = 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 Y = e, Vt(this), this.f &= -2, !0;
+ return Y = e, qt(this), this.f &= -2, !0;
}, Q.prototype.S = function(e) {
if (this.t === void 0) {
this.f |= 36;
@@ -1919,14 +1974,14 @@ Q.prototype = new Z(), Q.prototype.h = function() {
}
}, Object.defineProperty(Q.prototype, "value", { get: function() {
if (1 & this.f) throw Error("Cycle detected");
- var e = Lt(this);
+ var e = Ut(this);
if (this.h(), e !== void 0 && (e.i = this.i), 16 & this.f) throw this.v;
return this.v;
} });
-function Ht(e, t) {
+function Jt(e, t) {
return new Q(e, t);
}
-function Ut(e) {
+function Yt(e) {
var t = e.m;
if (e.m = void 0, typeof t == "function") {
X++;
@@ -1935,24 +1990,24 @@ function Ut(e) {
try {
t();
} catch (t) {
- throw e.f &= -2, e.f |= 8, Wt(e), t;
+ throw e.f &= -2, e.f |= 8, Xt(e), t;
} finally {
- Y = n, Dt();
+ Y = n, Nt();
}
}
}
-function Wt(e) {
+function Xt(e) {
for (var t = e.s; t !== void 0; t = t.n) t.S.U(t);
- e.x = void 0, e.s = void 0, Ut(e);
+ e.x = void 0, e.s = void 0, Yt(e);
}
-function Gt(e) {
+function Zt(e) {
if (Y !== this) throw Error("Out-of-order effect");
- Vt(this), Y = e, this.f &= -2, 8 & this.f && Wt(this), Dt();
+ qt(this), Y = e, this.f &= -2, 8 & this.f && Xt(this), Nt();
}
-function Kt(e, t) {
- this.x = e, this.m = void 0, this.s = void 0, this.u = void 0, this.f = 32, this.name = t?.name, kt && kt.push(this);
+function Qt(e, t) {
+ this.x = e, this.m = void 0, this.s = void 0, this.u = void 0, this.f = 32, this.name = t?.name, Ft && Ft.push(this);
}
-Kt.prototype.c = function() {
+Qt.prototype.c = function() {
var e = this.S();
try {
if (8 & this.f || this.x === void 0) return;
@@ -1961,20 +2016,20 @@ Kt.prototype.c = function() {
} finally {
e();
}
-}, Kt.prototype.S = function() {
+}, Qt.prototype.S = function() {
if (1 & this.f) throw Error("Cycle detected");
- this.f |= 1, this.f &= -9, Ut(this), Bt(this), X++;
+ this.f |= 1, this.f &= -9, Yt(this), Kt(this), X++;
var e = Y;
- return Y = this, Gt.bind(this, e);
-}, Kt.prototype.N = function() {
- 2 & this.f || (this.f |= 2, this.u = jt, jt = this);
-}, Kt.prototype.d = function() {
- this.f |= 8, 1 & this.f || Wt(this);
-}, Kt.prototype.dispose = function() {
+ return Y = this, Zt.bind(this, e);
+}, Qt.prototype.N = function() {
+ 2 & this.f || (this.f |= 2, this.u = Lt, Lt = this);
+}, Qt.prototype.d = function() {
+ this.f |= 8, 1 & this.f || Xt(this);
+}, Qt.prototype.dispose = function() {
this.d();
};
-function qt(e, t) {
- var n = new Kt(e, t);
+function $t(e, t) {
+ var n = new Qt(e, t);
try {
n.c();
} catch (e) {
@@ -1985,35 +2040,35 @@ function qt(e, t) {
}
//#endregion
//#region node_modules/@preact/signals/dist/signals.module.js
-var Jt, Yt, Xt = typeof window < "u" && !!window.__PREACT_SIGNALS_DEVTOOLS__, Zt = [];
-qt(function() {
- Jt = this.N;
+var en, tn, nn = typeof window < "u" && !!window.__PREACT_SIGNALS_DEVTOOLS__, rn = [];
+$t(function() {
+ en = this.N;
})();
-function Qt(e, t) {
+function an(e, t) {
S[e] = t.bind(null, S[e] || function() {});
}
-function $t(e) {
- if (Yt) {
- var t = Yt;
- Yt = void 0, t();
+function on(e) {
+ if (tn) {
+ var t = tn;
+ tn = void 0, t();
}
- Yt = e && e.S();
+ tn = e && e.S();
}
-function en(e) {
- var t = this, n = e.data, r = nn(n);
+function sn(e) {
+ var t = this, n = e.data, r = ln(n);
r.name = "ReactiveDom", r.value = n;
- var i = Je(function() {
+ var i = et(function() {
for (var e = t, n = t.__v; n = n.__;) if (n.__c) {
n.__c.__$f |= 4;
break;
}
- var i = Ht(function() {
+ var i = Jt(function() {
var e = r.value.value;
return e === 0 ? 0 : !0 === e ? "" : e || "";
- }), a = Ht(function() {
+ }), a = Jt(function() {
return !Array.isArray(i.value) && !w(i.value);
- }), o = qt(function() {
- if (this.N = on, a.value) {
+ }), o = $t(function() {
+ if (this.N = fn, a.value) {
var t = i.value;
e.__v && e.__v.__e && e.__v.__e.nodeType === 3 && (e.__v.__e.data = t);
}
@@ -2024,14 +2079,14 @@ function en(e) {
}, []), a = i[0], o = i[1];
return a.value ? o.peek() : o.value;
}
-en.displayName = "ReactiveTextNode", Object.defineProperties(Z.prototype, {
+sn.displayName = "ReactiveTextNode", Object.defineProperties(Z.prototype, {
constructor: {
configurable: !0,
value: void 0
},
type: {
configurable: !0,
- value: en
+ value: sn
},
props: {
configurable: !0,
@@ -2046,7 +2101,7 @@ en.displayName = "ReactiveTextNode", Object.defineProperties(Z.prototype, {
configurable: !0,
value: 1
}
-}), Qt("__b", function(e, t) {
+}), an("__b", function(e, t) {
if (typeof t.type == "string") {
var n, r = t.props;
for (var i in r) if (i !== "children") {
@@ -2055,26 +2110,26 @@ en.displayName = "ReactiveTextNode", Object.defineProperties(Z.prototype, {
}
}
e(t);
-}), Qt("__r", function(e, t) {
+}), an("__r", function(e, t) {
if (e(t), t.type !== I) {
- $t();
+ on();
var n, r = t.__c;
r && (r.__$f &= -2, (n = r.__$u) === void 0 && (r.__$u = n = function(e, t) {
var n;
- return qt(function() {
+ return $t(function() {
n = this;
}, { name: t }), n.c = e, n;
}(function(e) {
return function() {
var t;
- Xt && ((t = this.y) == null || t.call(this)), e.__$f |= 1, e.setState({});
+ nn && ((t = this.y) == null || t.call(this)), e.__$f |= 1, e.setState({});
};
- }(r), typeof t.type == "function" ? t.type.displayName || t.type.name : ""))), $t(n);
+ }(r), typeof t.type == "function" ? t.type.displayName || t.type.name : ""))), on(n);
}
-}), Qt("__e", function(e, t, n, r) {
- $t(), e(t, n, r);
-}), Qt("diffed", function(e, t) {
- $t();
+}), an("__e", function(e, t, n, r) {
+ on(), e(t, n, r);
+}), an("diffed", function(e, t) {
+ on();
var n;
if (typeof t.type == "string" && (n = t.__e)) {
var r = t.__np, i = t.props, a = n.U;
@@ -2084,25 +2139,25 @@ en.displayName = "ReactiveTextNode", Object.defineProperties(Z.prototype, {
}
if (r) for (var c in a || (a = {}, n.U = a), r) {
var l = a[c], u = r[c];
- l === void 0 ? (l = tn(n, c, u, i), a[c] = l) : l.o(u, i);
+ l === void 0 ? (l = cn(n, c, u, i), a[c] = l) : l.o(u, i);
}
}
e(t);
});
-function tn(e, t, n, r) {
- var i = t in e && e.ownerSVGElement === void 0, a = Rt(n);
+function cn(e, t, n, r) {
+ var i = t in e && e.ownerSVGElement === void 0, a = Wt(n);
return {
o: function(e, t) {
a.value = e, r = t;
},
- d: qt(function() {
- this.N = on;
+ d: $t(function() {
+ this.N = fn;
var n = a.value.value;
r[t] !== n && (r[t] = n, i ? e[t] = n : n != null && (!1 !== n || t[4] === "-") ? e.setAttribute(t, n) : e.removeAttribute(t));
})
};
}
-Qt("unmount", function(e, t) {
+an("unmount", function(e, t) {
if (typeof t.type == "string") {
var n = t.__e;
if (n) {
@@ -2126,7 +2181,7 @@ Qt("unmount", function(e, t) {
}
}
e(t);
-}), Qt("__h", function(e, t, n, r) {
+}), an("__h", function(e, t, n, r) {
r < 3 && (t.__$f |= 2), e(t, n, r);
}), ce.prototype.shouldComponentUpdate = function(e, t) {
if (this.__R) return !0;
@@ -2140,54 +2195,54 @@ Qt("unmount", function(e, t) {
for (var s in this.props) if (!(s in e)) return !0;
return !1;
};
-function nn(e, t) {
- return Je(function() {
- return Rt(e, t);
+function ln(e, t) {
+ return et(function() {
+ return Wt(e, t);
}, []);
}
-var rn = function(e) {
+var un = function(e) {
queueMicrotask(function() {
queueMicrotask(e);
});
};
-function an() {
- Ot(function() {
- for (var e; e = Zt.shift();) Jt.call(e);
+function dn() {
+ Pt(function() {
+ for (var e; e = rn.shift();) en.call(e);
});
}
-function on() {
- Zt.push(this) === 1 && (S.requestAnimationFrame || rn)(an);
+function fn() {
+ rn.push(this) === 1 && (S.requestAnimationFrame || un)(dn);
}
//#endregion
//#region src/state/quality-goals.ts
-var sn = "/api/quality-goals?limit=200", cn = {
+var pn = "/api/quality-goals?limit=200", mn = {
data: null,
error: ""
-}, ln = Rt(cn), un = 0, dn = Ht(() => ln.value);
-Ht(() => ln.value.data?.total ?? null);
-function fn() {
- un += 1, ln.value = cn;
+}, hn = Wt(mn), gn = 0, _n = Jt(() => hn.value);
+Jt(() => hn.value.data?.total ?? null);
+function vn() {
+ gn += 1, hn.value = mn;
}
-async function pn(e) {
- let t = un += 1;
+async function yn(e) {
+ let t = gn += 1;
try {
- let n = await z(sn, e);
- return t === un && (ln.value = {
+ let n = await B(pn, e);
+ return t === gn && (hn.value = {
data: n,
error: ""
}), n;
} catch (n) {
- throw !e?.aborted && t === un && (ln.value = {
+ throw !e?.aborted && t === gn && (hn.value = {
data: null,
- error: R(n)
+ error: z(n)
}), n;
}
}
//#endregion
//#region src/islands/quality-goals.tsx
-var mn = (e, t) => pn(t), hn = (e) => e.has_cover ? `/cover?code=${encodeURIComponent(e.code ?? "")}` : `/poster?id=${e.id}&c=4`;
-function gn({ openItem: t, javTitleHtml: n, javDisplayName: a, srcBadge: o }) {
- let { data: s, error: c } = dn.value;
+var bn = (e, t) => yn(t), xn = (e) => e.has_cover ? `/cover?code=${encodeURIComponent(e.code ?? "")}` : `/poster?id=${e.id}&c=4`;
+function Sn({ openItem: t, javTitleHtml: n, javDisplayName: a, srcBadge: o }) {
+ let { data: s, error: c } = _n.value;
if (c) return /* @__PURE__ */ J("div", {
class: "qualitylist",
dangerouslySetInnerHTML: { __html: p(c, {
@@ -2206,7 +2261,7 @@ function gn({ openItem: t, javTitleHtml: n, javDisplayName: a, srcBadge: o }) {
"aria-label": `打开 ${a(s)}`,
onClick: () => t(s.id),
children: /* @__PURE__ */ J("img", {
- src: hn(s),
+ src: xn(s),
alt: "",
loading: "lazy",
onError: (e) => e.currentTarget.remove()
@@ -2240,7 +2295,7 @@ function gn({ openItem: t, javTitleHtml: n, javDisplayName: a, srcBadge: o }) {
}
//#endregion
//#region src/jobs.ts
-async function _n(e) {
+async function Cn(e) {
let t = e.pause || ((e) => new Promise((t) => setTimeout(t, e))), n = 0;
for (; e.active();) {
let r;
@@ -2255,11 +2310,11 @@ async function _n(e) {
await t(2e3);
}
}
-function vn(e) {
+function wn(e) {
let t = document.createElement("div");
e.host.hidden = !0, t.dataset.followJob = "", t.setAttribute("aria-live", "polite"), e.host.prepend(t);
let n = e.storageKey || "peach-follow-job", r = sessionStorage.getItem(n) || void 0, i = !1;
- _n({
+ Cn({
read: e.read,
active: () => !i && e.active() && t.isConnected,
keepWatching: e.watchIdle !== !1,
@@ -2285,8 +2340,8 @@ function vn(e) {
}
//#endregion
//#region src/islands/scraping.tsx
-var yn = (e, t) => z("/api/scraping", t);
-function bn({ value: e, onChange: t }) {
+var Tn = (e, t) => B("/api/scraping", t);
+function En({ value: e, onChange: t }) {
let n = q(null), r = q(t);
return r.current = t, K(() => {
let t = n.current;
@@ -2300,7 +2355,7 @@ function bn({ value: e, onChange: t }) {
class: "scraping-network"
});
}
-function xn({ source: e, toast: t }) {
+function Dn({ source: e, toast: t }) {
let [r, i] = W(e), [a, o] = W(e.network), [s, c] = W(""), [l, u] = W(""), [f, m] = W("paste"), [h, g] = W(""), [_, y] = W(!1), [b, x] = W(""), [S, C] = W([]), w = q(null), T = q(null);
K(() => {
T.current?.querySelectorAll("footer button").forEach((e) => v(e, _));
@@ -2312,10 +2367,10 @@ function xn({ source: e, toast: t }) {
y(!0), x(""), C([]);
try {
if (n === "check") {
- let t = await B("/api/scraping/check", { source: e.source }, "POST", E.current.signal);
+ let t = await V("/api/scraping/check", { source: e.source }, "POST", E.current.signal);
E.current.signal.aborted || C(t.results);
} else {
- let r = await B("/api/scraping/settings", {
+ let r = await V("/api/scraping/settings", {
source: e.source,
network: a,
cookie: s,
@@ -2325,7 +2380,7 @@ function xn({ source: e, toast: t }) {
E.current.signal.aborted || (i(r.saved), c(""), u(""), g(""), w.current && (w.current.value = ""), t(n === "revoke" ? "Cookie 已撤销" : "来源设置已保存"));
}
} catch (e) {
- E.current.signal.aborted || x(R(e));
+ E.current.signal.aborted || x(z(e));
} finally {
E.current.signal.aborted || y(!1);
}
@@ -2371,7 +2426,7 @@ function xn({ source: e, toast: t }) {
}),
/* @__PURE__ */ J("div", {
class: "scraping-label",
- children: ["连接方式", /* @__PURE__ */ J(bn, {
+ children: ["连接方式", /* @__PURE__ */ J(En, {
value: a,
onChange: o
})]
@@ -2482,14 +2537,14 @@ function xn({ source: e, toast: t }) {
})
});
}
-function Sn({ data: e, error: t, toast: n }) {
+function On({ data: e, error: t, toast: n }) {
let [r, i] = W(""), [a, o] = W(!1), [s, c] = W(""), l = q(null);
K(() => v(l.current, a), [a]);
let u = q(new AbortController()), f = q(0);
async function m(e = !1) {
let t = ++f.current;
- await _n({
- read: (e) => z("/api/scraping/cover", e),
+ await Cn({
+ read: (e) => B("/api/scraping/cover", e),
active: () => !u.current.signal.aborted && t === f.current,
render: (t) => {
o(t.status === "running"), t.status === "running" && (e = !1), t.status === "failed" && !e && c(t.error || "采集未取得"), t.status === "complete" && !e && n(t.result || "封面采集完成");
@@ -2502,9 +2557,9 @@ function Sn({ data: e, error: t, toast: n }) {
if (!a) {
f.current++, o(!0), c("");
try {
- await B("/api/scraping/cover", { code: r }, "POST", u.current.signal), await m();
+ await V("/api/scraping/cover", { code: r }, "POST", u.current.signal), await m();
} catch (e) {
- u.current.signal.aborted || (o(!1), c(R(e)));
+ u.current.signal.aborted || (o(!1), c(z(e)));
}
}
}
@@ -2549,7 +2604,7 @@ function Sn({ data: e, error: t, toast: n }) {
]
})
}),
- e?.sources.map((e) => /* @__PURE__ */ J(xn, {
+ e?.sources.map((e) => /* @__PURE__ */ J(Dn, {
source: e,
toast: n
}, e.source))
@@ -2558,32 +2613,32 @@ function Sn({ data: e, error: t, toast: n }) {
}
//#endregion
//#region src/islands/library-processing.tsx
-var Cn = (e, t) => z("/api/library-processing", t);
-function wn({ data: e, error: t, toast: n, onComplete: r, mode: i, monitor: a }) {
- let [o, s] = W(e || { status: "idle" }), [c, l] = W(t), [u, g] = W(!1), [_, y] = W(!1), b = q(new AbortController()), x = q(0), S = q(o.status), C = q(null), w = u || o.status === "running";
- K(() => v(C.current, w), [w]);
- async function T() {
- let e = ++x.current;
- await _n({
- read: (e) => z("/api/library-processing", e),
- active: () => !b.current.signal.aborted && x.current === e,
+var kn = (e, t) => B("/api/library-processing", t);
+function An({ data: e, error: t, toast: n, onComplete: r, mode: i, monitor: a }) {
+ let [o, s] = W(e || { status: "idle" }), [c, l] = W(t), [u, m] = W(!1), [g, _] = W(!1), y = q(new AbortController()), b = q(0), x = q(o.status), S = q(null), C = u || o.status === "running";
+ K(() => v(S.current, C), [C]);
+ async function w() {
+ let e = ++b.current;
+ await Cn({
+ read: (e) => B("/api/library-processing", e),
+ active: () => !y.current.signal.aborted && b.current === e,
keepWatching: i === "notice" || !!a,
render: (e) => {
- s(e), l(""), e.status === "complete" && S.current === "running" && i !== "notice" && (y(!0), n("已完成扫描与资料采集")), S.current === "running" && (e.status === "complete" || e.status === "failed") && r?.(), S.current = e.status;
+ s(e), l(""), e.status === "complete" && x.current === "running" && i !== "notice" && (_(!0), n("已完成扫描与资料采集")), x.current === "running" && (e.status === "complete" || e.status === "failed") && r?.(), x.current = e.status;
},
disconnected: () => l("连接中断,正在重新读取处理进度")
});
}
- G(() => ((o.status === "running" || i === "notice" || a) && T(), () => b.current.abort()), []);
- async function E() {
- if (!w) {
- g(!0), l(""), y(!1);
+ G(() => ((o.status === "running" || i === "notice" || a) && w(), () => y.current.abort()), []);
+ async function T() {
+ if (!C) {
+ m(!0), l(""), _(!1);
try {
- let e = await B("/api/library-processing", {}, "POST", b.current.signal);
- if (b.current.signal.aborted) return;
- S.current = e.status, s(e), g(!1), await T();
+ let e = await V("/api/library-processing", {}, "POST", y.current.signal);
+ if (y.current.signal.aborted) return;
+ x.current = e.status, s(e), m(!1), await w();
} catch (e) {
- b.current.signal.aborted || (l(R(e)), g(!1));
+ y.current.signal.aborted || (l(z(e)), m(!1));
}
}
}
@@ -2606,11 +2661,11 @@ function wn({ data: e, error: t, toast: n, onComplete: r, mode: i, monitor: a })
/* @__PURE__ */ J("div", {
"aria-live": "polite",
children: [
- o.status === "running" && /* @__PURE__ */ J(I, { children: [/* @__PURE__ */ J("div", { dangerouslySetInnerHTML: { __html: f(`${o.stage || "正在处理"}${o.total ? ` · ${o.checked || 0} / ${o.total}` : ""}`) } }), !!o.total && /* @__PURE__ */ J("div", { dangerouslySetInnerHTML: { __html: m(`已处理 ${o.checked || 0} / ${o.total} 个视频`, o.checked || 0, o.total) } })] }),
+ o.status === "running" && /* @__PURE__ */ J(I, { children: [/* @__PURE__ */ J("div", { dangerouslySetInnerHTML: { __html: f(`${o.stage || "正在处理"}${o.total ? ` · ${o.checked || 0} / ${o.total}` : ""}`) } }), !!o.total && /* @__PURE__ */ J("div", { dangerouslySetInnerHTML: { __html: Fe(`已处理 ${o.checked || 0} / ${o.total} 个视频`, o.checked || 0, o.total) } })] }),
(c || o.status === "failed") && /* @__PURE__ */ J("div", {
role: "alert",
onClick: (e) => {
- e.target.closest("[data-note-action]") && E();
+ e.target.closest("[data-note-action]") && T();
},
dangerouslySetInnerHTML: { __html: p(c || o.error || "处理未完成,请重试", {
variant: "error",
@@ -2626,7 +2681,7 @@ function wn({ data: e, error: t, toast: n, onComplete: r, mode: i, monitor: a })
e.asset_id ? ":" : "",
e.message
] })) }),
- _ && /* @__PURE__ */ J("div", {
+ g && /* @__PURE__ */ J("div", {
class: "library-processing-result",
dangerouslySetInnerHTML: { __html: p(`已扫描 ${o.scanned || 0} 个文件,识别 ${o.identified || 0} 个番号,整理 ${o.candidates || 0} 组资料候选。`, {
variant: "success",
@@ -2651,10 +2706,10 @@ function wn({ data: e, error: t, toast: n, onComplete: r, mode: i, monitor: a })
children: "复核资料"
}),
o.status !== "failed" && /* @__PURE__ */ J("button", {
- ref: C,
+ ref: S,
type: "button",
class: "geist-button primary",
- onClick: () => void E(),
+ onClick: () => void T(),
children: "扫描并补全资料"
})
]
@@ -2662,12 +2717,12 @@ function wn({ data: e, error: t, toast: n, onComplete: r, mode: i, monitor: a })
}
//#endregion
//#region src/state/index.ts
-var Tn = { "quality-goals": {
- refresh: pn,
- reset: fn
-} }, En = () => Object.keys(Tn);
-async function Dn(e) {
- let t = Tn[e];
+var jn = { "quality-goals": {
+ refresh: yn,
+ reset: vn
+} }, Mn = () => Object.keys(jn);
+async function Nn(e) {
+ let t = jn[e];
if (!t) throw Error(`未登记的共享 store:${String(e)}`);
try {
return await t.refresh(), !0;
@@ -2677,24 +2732,24 @@ async function Dn(e) {
}
//#endregion
//#region src/review-evidence.ts
-var On = (e = "") => /^https?:\/\//i.test(e) ? e : "";
-function kn(e = "") {
- let n = On(e) || (e.startsWith("/") && !e.startsWith("//") ? e : "");
+var Pn = (e = "") => /^https?:\/\//i.test(e) ? e : "";
+function Fn(e = "") {
+ let n = Pn(e) || (e.startsWith("/") && !e.startsWith("//") ? e : "");
return `<div class="reviewimage" data-review-picture><span class="reviewimageempty"${n ? " hidden" : ""}>未取得来源图片</span>${n ? `<img src="${t(n)}" alt="来源候选图片" loading="lazy">` : ""}</div>`;
}
-function An(e) {
- let n = On(e.profile_url), r = (e.preview_assets || []).slice(0, 6), i = Math.max(0, Number(e.video_count || e.videos || 0));
+function In(e) {
+ let n = Pn(e.profile_url), r = (e.preview_assets || []).slice(0, 6), i = Math.max(0, Number(e.video_count || e.videos || 0));
return `<section class="reviewidentityevidence"><h5>候选身份:${t(e.babepedia_name || "未标注")}</h5>
<div class="reviewevidenceactions">${n ? `<a class="geist-button externallink" href="${t(n)}" target="_blank" rel="noopener noreferrer">来源资料<svg class="externalmark" viewBox="0 0 24 24" aria-hidden="true"><use href="#i-external-link" /></svg></a>` : ""}
<button type="button" class="geist-button" data-entity-kind="creator" data-entity-name="${t(e.creator || "")}">查看全部 ${i.toLocaleString()} 部作品</button></div>
- ${kn(e.preview_url)}
+ ${Fn(e.preview_url)}
<p>通过后记录身份判断。</p>
${r.length ? `<h5>本地作品样本</h5><div class="reviewevidencesamples">${r.map((e) => `<div class="reviewevidencesample">
<button class="geist-button" type="button" data-review-open-item="${e.id}"><span data-middle-truncate title="${t(e.name)}">${t(e.name)}</span></button>
<button class="geist-button" type="button" data-review-reveal="${e.id}" aria-label="打开 ${t(e.name)} 的文件位置">文件位置</button>
</div>`).join("")}</div>` : "<p>暂无本地作品样本,打开全部作品核对。</p>"}</section>`;
}
-function jn(e) {
+function Ln(e) {
for (let t of e.querySelectorAll("[data-review-picture] img")) {
let e = () => {
t.hidden = !0;
@@ -2706,7 +2761,7 @@ function jn(e) {
}
//#endregion
//#region src/review-bulk.ts
-var Mn = () => ({
+var Rn = () => ({
busy: !1,
category: "",
filter: "",
@@ -2717,7 +2772,7 @@ var Mn = () => ({
assets: /* @__PURE__ */ new Map(),
errors: /* @__PURE__ */ new Map()
});
-function Nn(e) {
+function zn(e) {
let t = e?.querySelector(".reviewcontrols");
if (!e || !t || t.offsetParent === null) return;
let n = e.closest("main");
@@ -2727,7 +2782,7 @@ function Nn(e) {
n.classList.toggle("is-stuck", n.offsetParent !== null && window.scrollY > 0 && Number.isFinite(e) && Math.abs(n.getBoundingClientRect().top - e) <= 1);
}
}
-function Pn(e, t) {
+function Bn(e, t) {
let n = [[
"candidates",
t ? "按候选数量" : "全部待复核",
@@ -2743,7 +2798,7 @@ function Pn(e, t) {
"list-filter"
]), n;
}
-function Fn(e, t) {
+function Vn(e, t) {
let n = /* @__PURE__ */ new Map();
for (let r of e) {
let e, i;
@@ -2760,11 +2815,11 @@ function Fn(e, t) {
}
return [...n.values()];
}
-function In(e, t, n, r, i) {
+function Hn(e, t, n, r, i) {
let a = e.anchor === null ? -1 : t.indexOf(e.anchor), o = t.indexOf(n);
r && a >= 0 && o >= 0 ? t.slice(Math.min(a, o), Math.max(a, o) + 1).forEach((t) => e.selected.add(t)) : i ? e.selected.add(n) : e.selected.delete(n), e.anchor = n;
}
-async function Ln(e, t, n, r) {
+async function Un(e, t, n, r) {
let i = [], a = 0;
for (let o of e) {
if (!r()) break;
@@ -2775,7 +2830,7 @@ async function Ln(e, t, n, r) {
} catch (e) {
i.push({
key: o.key,
- message: R(e)
+ message: z(e)
});
}
}
@@ -2784,17 +2839,17 @@ async function Ln(e, t, n, r) {
failures: i
};
}
-function Rn(e) {
+function Wn(e) {
return e.length ? [...new Set(e.flatMap((e) => e.candidates?.map((e) => e.source || "") || []))].filter((t) => t && e.every((e) => e.candidates?.filter((e) => e.source === t).length === 1)) : [];
}
-function zn(e, t) {
+function Gn(e, t) {
let n = e.querySelector(".reviewlist");
if (!n || !t.rows.length || t.locked) return;
let r = t.state, i = [...n.querySelectorAll("[data-review-key]")];
t.category !== void 0 && r.category !== t.category && (r.category = t.category, r.filter = "", r.groupBy = "candidates", r.anchor = null);
- let a = Pn(t.rows, t.metadata);
+ let a = Bn(t.rows, t.metadata);
a.some((e) => e[0] === r.groupBy) || (r.groupBy = "candidates", r.filter = "");
- let o = Fn(t.rows, r.groupBy);
+ let o = Vn(t.rows, r.groupBy);
o.some((e) => e.key === r.filter) || (r.filter = "");
let s = () => [...n.querySelectorAll("[data-review-key]")].filter((e) => !e.closest("[hidden]")), l = () => s().filter((e) => r.selected.has(e.dataset.reviewKey)), u = () => t.rows.filter((e) => l().some((t) => t.dataset.reviewKey === e.item_key)), d = (e) => !e.querySelector("[data-review-status=\"approved\"]")?.disabled, f = (e, t = "") => {
let n = document.createElement("button");
@@ -2886,7 +2941,7 @@ function zn(e, t) {
e.className = "reviewpickname", e.append(...n.childNodes), n.classList.add("reviewpickheading"), n.append(i, e);
} else e.prepend(i);
let o = (e, n) => {
- In(r, s().map((e) => e.dataset.reviewKey), t, e, n), P();
+ Hn(r, s().map((e) => e.dataset.reviewKey), t, e, n), P();
};
if (i.addEventListener("mousedown", (e) => {
e.shiftKey && e.preventDefault();
@@ -2900,7 +2955,7 @@ function zn(e, t) {
else if (n.key === "ArrowDown" || n.key === "ArrowUp") {
n.preventDefault();
let i = s(), a = i[i.indexOf(e) + (n.key === "ArrowDown" ? 1 : -1)];
- a && (r.anchor === null && (r.anchor = t), In(r, i.map((e) => e.dataset.reviewKey), a.dataset.reviewKey, !0, !0), P(), a.querySelector(".reviewpickitem input")?.focus());
+ a && (r.anchor === null && (r.anchor = t), Hn(r, i.map((e) => e.dataset.reviewKey), a.dataset.reviewKey, !0, !0), P(), a.querySelector(".reviewpickitem input")?.focus());
}
}
}), M.push(() => {
@@ -2929,14 +2984,14 @@ function zn(e, t) {
function P() {
let e = l();
S.textContent = e.length === s().length ? "清空当前选择" : r.filter ? "全选当前分类" : "全选本页", k.hidden = !e.length, T.textContent = `已选 ${e.length} 项`, C.disabled = !e.length || e.some((e) => !d(e)), w.disabled = !e.length;
- let n = Rn(u());
+ let n = Wn(u());
E.hidden = !t.metadata || !u().some((e) => (e.candidates?.length || 0) > 1);
let i = e.length && !n.length ? "所选项目无共同来源" : "统一选择来源", a = JSON.stringify([i, n]);
if (a !== N) {
N = a, E.innerHTML = g([["", i], ...n.map((e) => [e, e])], "", { label: "统一选择来源" });
let e = b(E.firstElementChild);
e.disabled = !n.length, e.addEventListener("change", () => {
- if (!(r.busy || !Rn(u()).includes(e.value))) {
+ if (!(r.busy || !Wn(u()).includes(e.value))) {
for (let n of l()) {
let i = t.rows.find((e) => e.item_key === n.dataset.reviewKey).candidates.find((t) => t.source === e.value);
n.querySelectorAll("input[type=\"radio\"]").forEach((e) => {
@@ -2969,7 +3024,7 @@ function zn(e, t) {
e instanceof KeyboardEvent && e.key === "Tab" || (e.preventDefault(), e.stopImmediatePropagation());
};
e.addEventListener("click", c, !0), e.addEventListener("keydown", c, !0);
- let u = 0, d = await Ln(a, async (e) => {
+ let u = 0, d = await Un(a, async (e) => {
try {
return await t.submit(e);
} finally {
@@ -2986,14 +3041,14 @@ function zn(e, t) {
let f = e.parentElement;
t.refresh(), f?.querySelector(".reviewbulktoolbar button")?.focus({ preventScroll: !0 });
}
- P(), Nn(e);
+ P(), zn(e);
}
//#endregion
//#region src/native-image.ts
-function Bn(e, t, n, r) {
+function Kn(e, t, n, r) {
return e > 0 && t > 0 && e === n && t === r;
}
-function Vn(e, t, n, r, i = 1) {
+function qn(e, t, n, r, i = 1) {
let a = Number.isFinite(i) && i > 0 ? i : 1;
e /= a, t /= a;
let o = [
@@ -3010,7 +3065,7 @@ function Vn(e, t, n, r, i = 1) {
}
//#endregion
//#region src/entity-skeleton.ts
-function Hn(e, t) {
+function Jn(e, t) {
return `<section data-skeleton="entity/${e}" role="status" aria-label="正在读取资料">
<span class="sr-only">正在读取资料</span><div aria-hidden="true">
<div class="entityhero"><div class="entityportrait ${e === "studio" || e === "agency" ? "square " : ""}skeleton"></div>
@@ -3022,7 +3077,7 @@ function Hn(e, t) {
}
//#endregion
//#region src/catalog-onboarding.ts
-var Un = [
+var Yn = [
"loc",
"creator",
"performer",
@@ -3039,16 +3094,16 @@ var Un = [
"jav",
"thumb"
];
-function Wn() {
+function Xn() {
let e = (e) => Array(64).fill(e).join("");
return {
tiers: "<div class=\"tier catalog-placeholder\" aria-hidden=\"true\">" + e("<span class=\"av\"><span class=\"ring\"></span><span class=\"nm\">&nbsp;</span></span>") + "</div><div class=\"tier catalog-placeholder\" aria-hidden=\"true\">" + e("<span class=\"brandpill\"><span class=\"mk\"></span><span class=\"placeholder-name\">&nbsp;</span></span>") + "</div>",
tags: "<span class=\"catalog-placeholder placeholder-tags\" aria-hidden=\"true\">" + e("<span class=\"pill\">&nbsp;</span>") + "</span>"
};
}
-async function Gn(e, t) {
+async function Zn(e, t) {
let n = new URLSearchParams();
- for (let t of Un) e[t] && n.set(t, e[t]);
+ for (let t of Yn) e[t] && n.set(t, e[t]);
let [r, i] = await Promise.all([t("/api/facets?" + n), t("/api/items?" + n + "&limit=5")]), a = [...new Set([
...r.creators || [],
...r.tagperformers || [],
@@ -3059,7 +3114,7 @@ async function Gn(e, t) {
return r.set("q", e), r.set("limit", "1"), (await t("/api/items?" + r)).total > 0 ? e : "";
}))).filter(Boolean);
}
-function Kn({ kind: e = "catalog", filtered: t = !1, jav: n = !1, configurable: r = !1, online: i = !1 } = {}) {
+function Qn({ kind: e = "catalog", filtered: t = !1, jav: n = !1, configurable: r = !1, online: i = !1 } = {}) {
let a = r ? "<a class=\"geist-button primary\" href=\"/configuration\">添加内容</a>" : "", o = "<a class=\"geist-button\" href=\"/follow-manage\">添加来源</a>";
return t || n ? u("search", n ? "还没有符合条件的 JAV 作品" : "没有符合条件的内容", n ? "已扫描但尚未补充发行资料的视频可在全部内容中查看。" : "清除筛选或搜索条件后查看全部内容。", { actions: "<a class=\"geist-button primary\" href=\"/?loc=&thumb=0\">查看全部内容</a>" }) : e === "catalog" ? u("play", "还没有视频", "添加媒体文件夹或关注来源,开始建立你的馆藏。", { actions: a + o }) : u(e === "tags" ? "tags" : "user-round", "还没有" + ({
tags: "标签",
@@ -3072,7 +3127,7 @@ function Kn({ kind: e = "catalog", filtered: t = !1, jav: n = !1, configurable:
}
//#endregion
//#region src/sidebar.ts
-function qn(e) {
+function $n(e) {
return [
"/",
"/unseen",
@@ -3082,23 +3137,23 @@ function qn(e) {
"/junk-files"
].includes(e) || /^\/(item|mix|parts|editions)\//.test(e) || /^\/playlists\/\d+\/\d+$/.test(e) || /^\/(performers|studios|creators|series|agencies)\/.+/.test(e);
}
-function Jn(e, t) {
+function er(e, t) {
return e.dataset.surface === t && e.querySelector(".dnav") ? !1 : (e.dataset.surface = t, e.replaceChildren(), !0);
}
-function Yn(e) {
+function tr(e) {
let t = /* @__PURE__ */ new Map();
for (let n of e) for (let e of new Set(n.tags || [])) t.set(e, (t.get(e) || 0) + 1);
return [...t].sort((e, t) => t[1] - e[1]).slice(0, 30);
}
//#endregion
//#region src/management.ts
-function Xn(e) {
+function nr(e) {
return e.filter((e) => ["115", "pikpak"].includes(e.location) && (e.roots === void 0 || e.roots.length > 0)).map((e) => e.location);
}
-function Zn(e, t) {
+function rr(e, t) {
return t.filter((t) => e.some((e) => e.location === t));
}
-function Qn() {
+function ir() {
return `<div class="cleanuppage" data-skeleton="cleanup" aria-busy="true" aria-label="正在读取数据管理状态">
<div class="cleanupgrid">${[
[
@@ -3144,7 +3199,7 @@ function Qn() {
<footer class="geist-fieldset-footer" data-geist-fieldset-footer><button type="button"${r === 3 ? " class=\"danger\"" : ""} disabled>${r === 3 ? "<svg aria-hidden=\"true\"><use href=\"#i-trash\"></use></svg><span>" + t + "</span>" : t}</button></footer>
</section>`).join("")}</div></div>`;
}
-function $n(e, t = !1, n = !1) {
+function ar(e, t = !1, n = !1) {
if (t || n) return "";
let r = "<svg class=\"externalmark\" viewBox=\"0 0 24 24\" aria-hidden=\"true\"><use href=\"#i-external-link\"></use></svg>";
return `<details class="taste-history-guide"${e ? " open" : ""}>
@@ -3158,28 +3213,28 @@ function $n(e, t = !1, n = !1) {
<button type="button" class="geist-button taste-guide-skip">跳过</button>
</div></details>`;
}
-var er = "peach-taste-guide-dismissed";
-function tr(e, t) {
+var or = "peach-taste-guide-dismissed";
+function sr(e, t) {
y(e, ".taste-history-guide", "taste-guide-collapse");
let n = e.querySelector(".taste-history-guide");
n?.querySelector(".taste-guide-skip")?.addEventListener("click", () => {
- t.setItem(er, "1"), n.remove();
+ t.setItem(or, "1"), n.remove();
});
}
//#endregion
//#region src/resource-sync.ts
-var $ = (e = 0) => Number(e).toLocaleString(), nr = {
+var $ = (e = 0) => Number(e).toLocaleString(), cr = {
local: "本地磁盘",
115: "115",
pikpak: "PikPak"
};
-function rr(e, t) {
+function lr(e, t) {
let n = e.cache || {
files: 0,
bytes: 0
}, r = !!(e.missing || n.files);
return `<div class="resourcepanel" data-geist-fieldset><div class="resourcesources">${(e.sources || []).map((e) => `<article>
- <div class="resourcesourcetitle"><b>${nr[e.location] || "媒体来源"}</b><span class="${e.online ? "online" : "offline"}">${e.online ? "可访问" : "离线,已跳过"}</span></div>
+ <div class="resourcesourcetitle"><b>${cr[e.location] || "媒体来源"}</b><span class="${e.online ? "online" : "offline"}">${e.online ? "可访问" : "离线,已跳过"}</span></div>
<strong>${e.online ? `${$(e.missing)} 项` : "—"}</strong>
<small>${e.online ? `找不到文件 · 已检查 ${$(e.checked)} 项` : `馆藏中有 ${$(e.total)} 项`}</small>
${e.unreadable ? `<small>${$(e.unreadable)} 项读取失败,已跳过</small>` : ""}</article>`).join("")}</div>
@@ -3190,60 +3245,60 @@ function rr(e, t) {
}
//#endregion
//#region src/jav-artwork.ts
-function ir(e) {
+function ur(e) {
return [
"small",
"sleeve",
"preview"
].includes(String(e)) ? "small" : "big";
}
-function ar(e) {
+function dr(e) {
return {
- javLayout: ir(e.javLayout),
- javImage: or(e.javLayout === "preview" ? "thumbnail" : e.javImage)
+ javLayout: ur(e.javLayout),
+ javImage: fr(e.javLayout === "preview" ? "thumbnail" : e.javImage)
};
}
-function or(e) {
+function fr(e) {
return e === "thumbnail" ? "thumbnail" : "cover";
}
-function sr(e, t) {
- return e.is_jav && e.code && e.has_cover && (or(t) === "cover" || !e.has_thumb) ? "cover" : e.has_thumb ? "thumbnail" : "";
+function pr(e, t) {
+ return e.is_jav && e.code && e.has_cover && (fr(t) === "cover" || !e.has_thumb) ? "cover" : e.has_thumb ? "thumbnail" : "";
}
-function cr(e, t) {
+function mr(e, t) {
e.querySelectorAll("img[data-jav-image]").forEach((e) => {
- let n = e.dataset.javCover || "", r = e.dataset.javThumb || "", i = !!(n && (or(t) === "cover" || !r)), a = i ? n : r;
+ let n = e.dataset.javCover || "", r = e.dataset.javThumb || "", i = !!(n && (fr(t) === "cover" || !r)), a = i ? n : r;
e.classList.toggle("cover", i), e.classList.toggle("whole", i && e.dataset.javImageLayout !== "big"), e.classList.toggle("front", i && e.dataset.javImageLayout === "big"), e.removeAttribute("style"), a && e.getAttribute("src") !== a && (e.src = a);
});
}
//#endregion
//#region src/islands.ts
-var lr = {
+var hr = {
"library-processing": {
- load: Cn,
- component: wn
+ load: kn,
+ component: An
},
scraping: {
- load: yn,
- component: Sn
+ load: Tn,
+ component: On
},
"quality-goals": {
- load: mn,
- component: gn
+ load: bn,
+ component: Sn
},
configuration: {
- load: vt,
- component: Tt
+ load: wt,
+ component: jt
}
-}, ur = () => Object.keys(lr), dr = /* @__PURE__ */ new Map();
-async function fr(e, t, n, r = {}) {
- let i = lr[e];
+}, gr = () => Object.keys(hr), _r = /* @__PURE__ */ new Map();
+async function vr(e, t, n, r = {}) {
+ let i = hr[e];
if (!i) throw Error(`未注册的 island:${String(e)}`);
- pr(t);
+ yr(t);
let a = {
controller: new AbortController(),
painted: !1
};
- dr.set(t, a);
+ _r.set(t, a);
let o;
try {
o = {
@@ -3254,12 +3309,12 @@ async function fr(e, t, n, r = {}) {
if (a.controller.signal.aborted) return;
o = {
data: null,
- error: R(e)
+ error: z(e)
};
}
- if (dr.get(t) !== a) return;
+ if (_r.get(t) !== a) return;
if (r.isCurrent && !r.isCurrent()) {
- dr.delete(t);
+ _r.delete(t);
return;
}
t.textContent = "", a.painted = !0;
@@ -3269,9 +3324,9 @@ async function fr(e, t, n, r = {}) {
};
Oe(oe(i.component, s), t);
}
-function pr(e) {
- let t = dr.get(e);
- t && (t.controller.abort(), dr.delete(e), t.painted && Oe(null, e));
+function yr(e) {
+ let t = _r.get(e);
+ t && (t.controller.abort(), _r.delete(e), t.painted && Oe(null, e));
}
//#endregion
-export { er as TASTE_GUIDE_KEY, je as boundedPreference, Kn as catalogEmptyHtml, Gn as catalogSuggestions, Qn as cleanupSkeletonHtml, Xn as cloudLocations, Zn as cloudPreferenceLocations, Mn as createReviewSelection, Wn as emptyCatalogLayout, Hn as entitySkeletonHtml, vn as followJobProgress, An as identityEvidenceHtml, ur as islandNames, sr as javImageKind, Bn as matchesFaceSource, fr as mountIsland, Ne as mountNumberSetting, Vn as nativeImageFit, or as normalizeJavImage, ir as normalizeJavLayout, ar as normalizeJavPreferences, ke as preferredDirection, Dn as refreshStore, rr as resourceScanHtml, kn as reviewImageHtml, qn as sidebarHasCatalogContent, Yn as sidebarTagCounts, En as storeNames, cr as syncJavImages, Me as syncNumberSetting, Jn as syncSidebarSurface, $n as tasteHistoryGuideHtml, pr as unmountIsland, Nn as updateReviewSticky, _n as watchJob, jn as wireReviewPictures, zn as wireReviewSelection, tr as wireTasteHistoryGuide };
+export { or as TASTE_GUIDE_KEY, je as boundedPreference, Qn as catalogEmptyHtml, Zn as catalogSuggestions, ir as cleanupSkeletonHtml, nr as cloudLocations, rr as cloudPreferenceLocations, Rn as createReviewSelection, Ie as distributionChart, Xn as emptyCatalogLayout, Jn as entitySkeletonHtml, wn as followJobProgress, In as identityEvidenceHtml, gr as islandNames, pr as javImageKind, Fe as jobProgressHtml, Kn as matchesFaceSource, vr as mountIsland, Ne as mountNumberSetting, qn as nativeImageFit, fr as normalizeJavImage, ur as normalizeJavLayout, dr as normalizeJavPreferences, ke as preferredDirection, Re as radarChart, Le as rankedChart, Nn as refreshStore, lr as resourceScanHtml, Fn as reviewImageHtml, $n as sidebarHasCatalogContent, tr as sidebarTagCounts, Pe as statCardBody, Mn as storeNames, mr as syncJavImages, Me as syncNumberSetting, er as syncSidebarSurface, ar as tasteHistoryGuideHtml, yr as unmountIsland, zn as updateReviewSticky, Cn as watchJob, Ln as wireReviewPictures, Gn as wireReviewSelection, sr as wireTasteHistoryGuide };
diff --git a/web/index.html b/web/index.html
index 5a8e05702..7582137f6 100644
--- a/web/index.html
+++ b/web/index.html
@@ -258,6 +258,7 @@
<div class="settingrow"><span><b>头像与站点图标刷新</b><small>作者头像、来源图标和外链圆标保存在本机,到期后下次显示时重新取一次;视频与图片不保存。</small></span><div id="metadataRefreshSetting"></div></div>
</section>
<section class="settinggroup"><h3>安全</h3>
+ <div class="settingrow"><span><b>保持登录时间</b><small>在此浏览器下次登录并勾选“保持登录”时生效。</small></span><div id="loginDaysSetting"></div></div>
<label class="settingrow"><span><b>SFW 模式</b><small id="sfwDescription">模糊、降低饱和度并压暗全站图片和视频,包括封面、头像与详情预览;停止悬停预览。文字、品牌标识和来源图标保持可见。</small></span><input class="ptoggle" type="checkbox" id="censorSetting" role="switch" aria-describedby="sfwDescription"></label>
</section>
</div>