Peach: Local-first video metadata scraper and media manager.
feat(ui): 完善侧栏媒体库与主题交互
longmeidaoccb70f6aee48
diff --git a/README.en.md b/README.en.mdindex e0267be2d..d8ae91f41 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.+Choose a media library at the top of the sidebar; theme and settings controls are fixed at the bottom. Give folders a library name in Configuration to group matching names into one library. Library selection filters work lists and facets.+“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@@ -100,7 +102,7 @@ uv sync --locked --python 3.14 --extra macosSetup configures media folders, access scope and ports. Alternatively, use the `peach init` terminal wizard followed by `peach serve`; executables are in the virtual environment directories above.Source deployments default to a sibling `peach-data/` directory. Set `PEACH_DATA_ROOT` for a custom location.-The access password is optional during setup. Leave it blank to allow devices that can reach Peach to enter directly. Configuration lets you set, change or disable the password; the login page offers session durations. Existing deployments retain their current login requirement. Local CA generation requires OpenSSL.+The access password is optional during setup. Leave it blank to allow devices that can reach Peach to enter directly. Configuration lets you set, change or disable the password; Security settings control how long to stay signed in. Existing deployments retain their current login requirement. Local CA generation requires OpenSSL.See [operations](docs/OPERATIONS.md) for configuration, HTTPS, CloudDrive mounts and non-interactive initialization.## Your datadiff --git a/README.md b/README.mdindex f7c9f83aa..d357ed320 100644--- a/README.md+++ b/README.md@@ -42,6 +42,8 @@ Peach 是单用户、本地优先的个人媒体系统。在自己的电脑上界面采用 Board 风格。设置中可选择「使用旧版 UI」并应用刷新;「增加对比度」关闭导航玻璃的透明与折射。数量和时间支持范围内自定义,可关闭的功能使用开关控制。+侧栏顶部选择媒体库,底部切换明暗主题并打开设置。配置中给文件夹填写媒体库名称,同名文件夹归入一库;库选择限定作品列表与筛选项。+登录页勾选「保持登录」时,使用此浏览器安全设置里的保持时间(1–365 天,默认 30 天)。不勾选时使用最长 12 小时的浏览器会话。## 快速开始@@ -98,7 +100,7 @@ uv sync --locked --python 3.14 --extra macos首次设置页会配置媒体文件夹、访问范围和端口。也可使用 `peach init` 的终端问答,再用 `peach serve` 启动服务;可执行文件位于上述虚拟环境目录。源码部署默认使用仓库同级的 `peach-data/`;自定义位置需设置 `PEACH_DATA_ROOT`。-首次设置的访问密码为可选项:留空时,能连接到 Peach 的设备可直接访问。配置页可设置、修改或关闭密码,登录页可选择保持登录时间。已有部署保留当前登录要求。本机 CA 生成需要 OpenSSL。+首次设置的访问密码为可选项:留空时,能连接到 Peach 的设备可直接访问。配置页可设置、修改或关闭密码,安全设置可调整保持登录时间。已有部署保留当前登录要求。本机 CA 生成需要 OpenSSL。配置、HTTPS、CloudDrive 挂载与非交互初始化详见 [运行与配置](docs/OPERATIONS.md)。## 数据属于自己diff --git a/docs/BOARD_UI.md b/docs/BOARD_UI.mdindex cb0116e0f..5dcd48b8c 100644--- a/docs/BOARD_UI.md+++ b/docs/BOARD_UI.md@@ -85,7 +85,13 @@ Charts 已核对 Stat Cards、Bar List、Radar、Radial,以及 Orders、Revenu## 验证记录-- 160 项前端测试通过,包含非法值不保存、关闭恢复、异步读取值恢复、图表数值与可访问语义;构建与类型检查通过。+侧栏采用 AI chat 公开变体的分组标题、展开叶项与尾部计数:标题 14/20,计数 12/16、1×4 内边距、4px 圆角。媒体库入口适配公开 `DashboardUserMenu`:265px 面板、16px 圆角、10px 内边距,桌面右侧 8px、手机下方展开,150ms ease-out 淡入、缩放 .95 与 2px 模糊。收起时点击 Logo 展开侧栏,不保留空的选择行。设置固定在底部,与明暗开关并排;收起时明暗开关只显示目标主题图标。主题动画参考公开 `https://www.boardui.com/r/theme-toggle.json`:200ms 滑块与 820ms 柔边扩散,缓动 `cubic-bezier(.16,1,.3,1)`,减少动态效果时直接切换。++媒体库使用 `[media.libraries]` 为声明路径命名,同名路径归为一库。库选择限定作品列表与筛选项;来源 ID、挂载映射和 ledger 路径保留其业务含义。统计、口味和维护任务仍按整个部署汇总。配置表单读写库名,预览只读,不保存真实配置。++详情使用并列观看进度卡与独立动作按钮;Esc 先退出详情、再收起侧栏。首页与实体页排序保持横向滚动,换批按钮沿用动画 SVG,采用中性 Board 按钮。++- 162 项前端测试通过,包含非法值不保存、关闭恢复、异步读取值恢复、图表数值、库名提交、分组展开记忆与可访问语义;构建与类型检查通过。- 18984 直接服务正式工作树。桌面已检查设置、首页、详情、统计、口味、数据管理、关注管理、配置与复核;390×844 已检查设置、详情、标签与事务所索引,没有页面横向溢出。- 设置关闭图标中心偏差为 0;纯图标控件不覆盖工具栏业务显隐。旧版模式关闭 Board 样式,增加对比度时导航 `backdrop-filter` 为 `none`,退出两种状态均已核对。- 预览只读,未写真实 ledger、配置或凭据;脱盘状态下真实播放未验证。生产入口与版本号未改。diff --git a/docs/PRODUCT_BACKLOG.md b/docs/PRODUCT_BACKLOG.mdindex a9257eca4..124ce41ee 100644--- a/docs/PRODUCT_BACKLOG.md+++ b/docs/PRODUCT_BACKLOG.md@@ -10,6 +10,8 @@统计与口味已接入 Stat Cards、独立实现的排名条、雷达与分布环;侧栏使用同一导航的 60/260px 宽窄态,手机从左侧滑入。设置滚动渐隐、手机输入字号、焦点环留白及登录保持时长已接入。业务进度的适配范围与不适用图表见 [Board 适配](BOARD_UI.md)。+侧栏底部固定设置和明暗开关,收起时 Logo 负责展开;媒体库入口采用侧向面板。路径可命名分组,库选择限定作品列表与筛选项;部署级统计、口味和维护任务仍保持全局。详情优先响应 Esc,手机排序栏可横向滚动。预览不保存真实配置。+## 已有骨架、尚未完成(6 项)- Windows 独立测试包的局域网访问与 mDNS:按用户要求先恢复本机访问,后续加入此功能;测试域名与开发环境隔离。首启页的局域网选项与当前测试包限制不一致,也在此项闭环。diff --git a/frontend/src/islands.ts b/frontend/src/islands.tsindex 9ebce3c3a..ce48faa1a 100644--- a/frontend/src/islands.ts+++ b/frontend/src/islands.ts@@ -16,6 +16,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';+export { sidebarSectionHtml, wireSidebarGroups, transitionTheme } from './sidebar-groups';import type { Attributes, ComponentType } from 'preact';import { errorMessage } from './api';diff --git a/frontend/src/islands/configuration.tsx b/frontend/src/islands/configuration.tsxindex ce1882228..c420ff8e5 100644--- a/frontend/src/islands/configuration.tsx+++ b/frontend/src/islands/configuration.tsx@@ -43,7 +43,7 @@ export interface ConfigurationData {/** 设置文件的指纹,保存时带回去,服务端据此拒绝盖掉别处的改动。 */revision: string;media_dirs: string[];- media_sources?: { location: string; root: string; path: string; online?: boolean }[];+ media_sources?: { location: string; root: string; path: string; online?: boolean; library?: string }[];windows?: boolean;port: number;port_editable?: boolean;@@ -153,6 +153,7 @@ function ConfigurationForm({ data, receipt }: { data: ConfigurationData; receiptconst [dirs, setDirs] = useState<string[]>(initial?.length ? initial.map((row) => row.path) : data.media_dirs.length ? data.media_dirs : ['']);const [kinds, setKinds] = useState<string[]>(initial?.map((row) => row.location) ?? []);const [roots, setRoots] = useState<string[]>(initial?.map((row) => row.root) ?? []);+ const [libraries, setLibraries] = useState<string[]>(initial?.map((row) => row.library || '') ?? []);const [port, setPort] = useState(String(data.port));const [scanNow, setScanNow] = useState(false);const [rowErrors, setRowErrors] = useState<string[]>([]);@@ -188,6 +189,7 @@ function ConfigurationForm({ data, receipt }: { data: ConfigurationData; receiptconst remove = (index: number) => {setKinds((list) => list.filter((_, i) => i !== index));setRoots((list) => list.filter((_, i) => i !== index));+ setLibraries((list) => list.filter((_, i) => i !== index));setDirs((list) => list.filter((_, i) => i !== index));setRowErrors((errors) => errors.filter((_, i) => i !== index));};@@ -226,7 +228,7 @@ function ConfigurationForm({ data, receipt }: { data: ConfigurationData; receiptconst result = await apiSend<SaveResult>(CONFIGURATION_URL, {revision: revision.current,media_dirs: dirs,- ...(data.media_sources ? { media_sources: dirs.map((path, i) => ({ path, location: kinds[i] || 'local', root: roots[i] || '' })) } : {}),+ ...(data.media_sources ? { media_sources: dirs.map((path, i) => ({ path, location: kinds[i] || 'local', root: roots[i] || '', library: libraries[i] || '' })) } : {}),port,scan_now: scanNow,});@@ -290,6 +292,10 @@ function ConfigurationForm({ data, receipt }: { data: ConfigurationData; receipt</button>) : null}<div class="configsource">+ <label>媒体库+ <input class="geist-input" aria-label={`媒体库 ${index + 1}`} maxLength={80} value={libraries[index] || ''} placeholder="同名文件夹归入同一个媒体库"+ onInput={(event) => { const next = [...libraries]; next[index] = event.currentTarget.value; setLibraries(next); }} />+ </label><div class="configsourcelabel">媒体来源<MediaSourceSelect label={`媒体来源 ${index + 1}`} value={kinds[index] || 'local'}onChange={(value) => { const next = [...kinds]; next[index] = value; setKinds(next); }} />diff --git a/frontend/src/sidebar-groups.ts b/frontend/src/sidebar-groups.tsnew file mode 100644index 000000000..6a32f0928--- /dev/null+++ b/frontend/src/sidebar-groups.ts@@ -0,0 +1,32 @@+/** 侧栏筛选分组:标题、展开状态与叶项计数各自承担一种含义。 */+const escape=(value:string)=>value.replace(/[&<>"']/g,char=>({'&':'&','<':'<','>':'>','"':'"',"'":'''}[char]!));+export function sidebarSectionHtml(title:string,body:string,extra='',kind=''):string {+ if(!body)return '';+ const id=`sidebar-group-${encodeURIComponent(title)}`;+ return `<section class="sec${kind?' cat-'+escape(kind):''}" data-sidebar-group="${escape(title)}"><h3><button type="button" class="board-section-toggle" aria-expanded="true" aria-controls="${id}"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="#i-chevron-right"/></svg><span>${escape(title)}</span></button>${extra}</h3><div class="board-sidebar-body" id="${id}">${body}</div></section>`;+}+export function wireSidebarGroups(root:HTMLElement):void {+ root.querySelectorAll<HTMLElement>('[data-sidebar-group]').forEach(group=>{+ if(group.dataset.sidebarWired)return;group.dataset.sidebarWired='true';+ const button=group.querySelector<HTMLButtonElement>('.board-section-toggle')!,body=group.querySelector<HTMLElement>('.board-sidebar-body')!;+ const key=`peach.sidebar.group.${group.dataset.sidebarGroup}`;+ let saved:string|null=null;try{saved=sessionStorage.getItem(key)}catch{}+ const show=(open:boolean)=>{button.setAttribute('aria-expanded',String(open));body.hidden=!open};+ const active=!!body.querySelector('[aria-pressed=true]');+ show(saved!==null?saved==='open':active||group.classList.contains('cat-src')||group.dataset.sidebarGroup==='时长');+ button.onclick=()=>{const open=button.getAttribute('aria-expanded')!=='true';show(open);try{sessionStorage.setItem(key,open?'open':'closed')}catch{}};+ });+}++let themeChanging=false;+/** Board 的主题切换从触发器中心扩散,减少动态效果时直接应用。 */+export async function transitionTheme(button:HTMLElement,apply:()=>void):Promise<void>{+ if(themeChanging)return;+ if(!document.startViewTransition||matchMedia('(prefers-reduced-motion: reduce)').matches){apply();return}+ const rect=button.getBoundingClientRect(),x=rect.left+rect.width/2,y=rect.top+rect.height/2;+ const size=Math.hypot(Math.max(x,innerWidth-x),Math.max(y,innerHeight-y))*2.5;+ const mask=`url("data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><filter id="b" x="-50%" y="-50%" width="200%" height="200%"><feGaussianBlur stdDeviation="2"/></filter></defs><circle cx="50" cy="50" r="42" fill="white" filter="url(#b)"/></svg>')}")`;+ const style=document.createElement('style');style.textContent=`::view-transition-old(root){animation:none}::view-transition-new(root){mix-blend-mode:normal;mask-image:${mask};mask-repeat:no-repeat;animation:peach-theme-reveal 820ms cubic-bezier(.16,1,.3,1) both}@keyframes peach-theme-reveal{from{mask-position:${x}px ${y}px;mask-size:0px 0px}to{mask-position:${x-size/2}px ${y-size/2}px;mask-size:${size}px ${size}px}}`;+ themeChanging=true;document.head.append(style);+ try{await document.startViewTransition(apply).finished}catch{apply()}finally{style.remove();themeChanging=false}+}diff --git a/frontend/test/configuration.test.tsx b/frontend/test/configuration.test.tsxindex 5ec06dbb9..3f67e6154 100644--- a/frontend/test/configuration.test.tsx+++ b/frontend/test/configuration.test.tsx@@ -167,7 +167,7 @@ describe('媒体文件夹列表', () => {const fetch = fetchMock(200, { saved: true, url: '/', revision: 'rev-2' });vi.stubGlobal('fetch', fetch);const { el } = mount({ windows: false, media_sources: [- { location: '115', root: 'B:\\', path: '/Volumes/115', online: false },+ { location: '115', root: 'B:\\', path: '/Volumes/115', online: false, library: '收藏' },{ location: 'pikpak', root: 'A:\\', path: '/Volumes/PikPak', online: true },] });expect(inputs(el).map((input) => input.value)).toEqual(['/Volumes/115', '/Volumes/PikPak']);@@ -176,8 +176,8 @@ describe('媒体文件夹列表', () => {submit(el); await settle();const body = JSON.parse(String(fetch.mock.calls[0]?.[1].body));expect(body.media_sources).toEqual([- { location: '115', root: 'B:\\', path: '/Volumes/115' },- { location: 'pikpak', root: 'A:\\', path: '/Volumes/PikPak' },+ { location: '115', root: 'B:\\', path: '/Volumes/115', library: '收藏' },+ { location: 'pikpak', root: 'A:\\', path: '/Volumes/PikPak', library: '' },]);});it('一行一个文件夹,只有一行时没有移除键', () => {diff --git a/frontend/test/sidebar-groups.test.ts b/frontend/test/sidebar-groups.test.tsnew file mode 100644index 000000000..88655038a--- /dev/null+++ b/frontend/test/sidebar-groups.test.ts@@ -0,0 +1,16 @@+import { beforeEach, expect, it } from 'vitest';+import { sidebarSectionHtml, wireSidebarGroups } from '../src/sidebar-groups';+beforeEach(()=>{document.body.replaceChildren();sessionStorage.clear()});+it('opens selected filters and preserves the user disclosure choice after rendering',()=>{+ const render=()=>{document.body.innerHTML=sidebarSectionHtml('标签','<button aria-pressed="true">已选标签</button>');wireSidebarGroups(document.body)};+ render();expect(document.querySelector<HTMLElement>('.board-sidebar-body')!.hidden).toBe(false);+ document.querySelector<HTMLButtonElement>('.board-section-toggle')!.click();+ render();expect(document.querySelector<HTMLElement>('.board-sidebar-body')!.hidden).toBe(true);+ expect(document.querySelector('.board-section-toggle')!.getAttribute('aria-expanded')).toBe('false');+});+it('escapes titles and retains a valid disclosure target',()=>{+ document.body.innerHTML=sidebarSectionHtml('<img>', '<button>条目</button>');wireSidebarGroups(document.body);+ expect(document.querySelector('img')).toBeNull();+ const button=document.querySelector('.board-section-toggle')!;+ expect(document.getElementById(button.getAttribute('aria-controls')!)).not.toBeNull();+});diff --git a/scripts/test_runner.py b/scripts/test_runner.pyindex ef88d5941..0f0afa5e1 100644--- a/scripts/test_runner.py+++ b/scripts/test_runner.py@@ -27,7 +27,7 @@ COMMON_PATTERNS = ("test_context_budget.py", "test_test_collection.py")SCOPES: dict[str, tuple[str, ...]] = {"checks": ("test_copy_final_state.py", "test_dependency_policy.py", "test_repo_hygiene.py", "test_test_planning.py"),"follow": ("test_follow*.py", "test_http.py", "test_migrations.py"),- "catalog": ("test_ad_judgement.py", "test_composite_name_split.py",+ "catalog": ("test_ad_judgement.py", "test_composite_name_split.py", "test_media_libraries.py","test_duplicate_identity_merge.py","test_entity_merge.py", "test_fastapi_api.py", "test_migrations.py","test_review_mirror.py", "test_rm_web.py",diff --git a/src/peach/media_configuration.py b/src/peach/media_configuration.pyindex cb31d3e9a..f76f082ae 100644--- a/src/peach/media_configuration.py+++ b/src/peach/media_configuration.py@@ -59,6 +59,7 @@ def rows(config, *, windows: bool, probe: bool = False) -> list[dict[str, Any]]:for index, root in enumerate(roots):mount = root if windows else (mounts[index] if index < len(mounts) else "")result.append({"location": location, "root": root, "path": mount,+ "library": config.library_names.get(root) or PureWindowsPath(root).name or root,"online": platform.root_online(Path(mount)) if probe and mount else False})return resultdiff --git a/src/peach/media_libraries.py b/src/peach/media_libraries.pynew file mode 100644index 000000000..966d76591--- /dev/null+++ b/src/peach/media_libraries.py@@ -0,0 +1,22 @@+"""媒体库按声明路径分组,来源与挂载仍由媒体配置管理。"""+from pathlib import PureWindowsPath+++def libraries(config):+ groups = {}+ for location, roots in config.locations.items():+ for root in roots:+ name = config.library_names.get(root) or PureWindowsPath(root).name or root+ groups.setdefault(name, []).append({"location": location, "root": root})+ return [{"id": name, "name": name, "roots": roots} for name, roots in groups.items()]+++def predicate(config, library):+ """路径边界精确匹配;未知库返回空集。"""+ roots = next((row["roots"] for row in libraries(config) if row["id"] == library), [])+ terms, params = [], []+ for item in roots:+ prefix = str(PureWindowsPath(item["root"])).rstrip("\\") + "\\"+ terms.append("(a.location=? AND substr(a.path,1,?)=? COLLATE NOCASE)")+ params.extend((item["location"], len(prefix), prefix))+ return "(" + " OR ".join(terms) + ")" if terms else "0", paramsdiff --git a/src/peach/routes_api.py b/src/peach/routes_api.pyindex 40f4df373..1204cc3f8 100644--- a/src/peach/routes_api.py+++ b/src/peach/routes_api.py@@ -86,6 +86,13 @@ def source_health(request: Request, args: dict[str, str] = Depends(require_auth)}[email protected]("/api/libraries")+def media_library_list(request: Request, args: dict[str, str] = Depends(require_auth)):+ from . import media_libraries, settings_file+ return {"libraries": [{"id": row["id"], "name": row["name"], "folders": len(row["roots"])}+ for row in media_libraries.libraries(settings_file.active())]}++@router.post("/api/reveal")def reveal(request: Request, body: dict[str, Any] = Body(default_factory=dict), args: dict[str, str] = Depends(require_auth)):"""在本机文件管理器里定位某个资产的源文件。diff --git a/src/peach/routes_configuration.py b/src/peach/routes_configuration.pyindex de714df95..79edfad49 100644--- a/src/peach/routes_configuration.py+++ b/src/peach/routes_configuration.py@@ -193,6 +193,18 @@ def _validate(body: dict[str, Any], config) -> tuple[dict[str, Any], dict[str, Alocations, mounts, problems = media_configuration.validate(body["media_sources"], windows=os.name == "nt")paths = []validated.update(locations=locations, mounts=mounts)+ names = {}+ if not problems:+ for index, row in enumerate(body["media_sources"]):+ name = str(row.get("library", "")).strip()+ if len(name) > 80 or any(ord(char) < 32 for char in name):+ problems = [""] * len(body["media_sources"])+ problems[index] = "媒体库名称请使用 1 到 80 个可见字符"+ break+ root = str(media_configuration.PureWindowsPath(row["path"] if os.name == "nt" else row["root"]))+ if name:+ names[root] = name+ validated["library_names"] = nameselse:paths, problems = onboarding.read_media_dirs(rows, validate=onboarding.media_dir_validator(windows=os.name == "nt"))@@ -316,6 +328,7 @@ def save_configuration(request: Request, body: dict[str, Any] = Body(default_faclocations["local"] = onboarding.posix_declared_roots(len(paths))mounts["local"] = tuple(str(path) for path in paths)prepared = replace(config, locations=locations, mounts=mounts,+ library_names=validated.get("library_names", config.library_names),server=replace(config.server, port=validated["port"]))temporary = config.path.with_suffix(".pending.toml")try:diff --git a/src/peach/settings_file.py b/src/peach/settings_file.pyindex 9a06c5821..a44184992 100644--- a/src/peach/settings_file.py+++ b/src/peach/settings_file.py@@ -169,6 +169,7 @@ class PeachConfig:#: `asset.location` -> 本机挂载点,即该来源的每个声明根落在本机哪个目录,按顺序#: 与 `locations` 里的声明根一一对应。Windows 上通常为空:盘符本身就是挂载点。mounts: dict[str, tuple[str, ...]] = field(default_factory=dict)+ library_names: dict[str, str] = field(default_factory=dict)#: `asset.location` -> 账本口径的声明根,至少一个。locations: dict[str, tuple[str, ...]] = field(default_factory=lambda: dict(DEFAULT_LOCATION_ROOTS))@@ -294,7 +295,7 @@ def _merge(raise _fail(path, "`directories` 里有不认识的键:" + "、".join(unknown))media = _table(document, "media", path)- stray = sorted(set(media) - {_LOCATIONS_KEY, _MOUNTS_KEY})+ stray = sorted(set(media) - {_LOCATIONS_KEY, _MOUNTS_KEY, "libraries"})if stray:# 第一阶段的 `[media] R = '/Volumes/RESOURCES'`。键空间从盘符换成了 location ID,# 把它当未知键忽略等于「所有来源都没挂」——整台机器安静地进脱盘模式。@@ -365,6 +366,7 @@ def _merge(config = PeachConfig(data_root=data_root, path=path, present=present, data_root_found=found,directories=directories, mounts=mounts, locations=locations,+ library_names=_string_map(_table(media, "libraries", path), path, "media.libraries."),server=server, replication=replication,)return _apply_environment(config, environ)@@ -519,6 +521,8 @@ def render(config: PeachConfig) -> str:"# 一个来源有几个目录就写几个:local = ['D:\\Videos', 'E:\\Movies']。",]lines += _render_roots(dict(config.locations))+ lines += ["", "[media.libraries]"]+ lines += [f"{_render_value(root)} = {_render_value(name)}" for root, name in config.library_names.items()]lines += ["","[media.mounts]",diff --git a/src/peach/web_catalog.py b/src/peach/web_catalog.pyindex 7345d1c34..a0c69afd9 100644--- a/src/peach/web_catalog.py+++ b/src/peach/web_catalog.py@@ -12,6 +12,7 @@ from __future__ import annotationsimport hashlibimport randomimport time+from . import media_libraries, settings_filefrom .catalog_rules import (LENGTH_TAGS,@@ -131,6 +132,10 @@ def catalog_filter(contract: WebContract, args):# 普通馆藏仍是视频表面;回收站必须展示所有文件类型,否则从垃圾复核移入的# 图片、网址快捷方式等会变成不可见、不可恢复,只能被「清空回收站」直接删掉。where, par = ([] if trash else ["a.medium='video'"]), []+ if args.get("library"):+ clause, values = media_libraries.predicate(settings_file.active(), args["library"])+ where.append(clause)+ par.extend(values)if trash:where.append("a.disposal='trash'")else:@@ -932,6 +937,10 @@ def q_facets(with contract.read_connection() as c:scope = (JAV_ASSET_CLAUSE if jav else "") + state_clause(state)scope_params: list[object] = []+ if filters and filters.get("library") and asset_id is None:+ library_clause, library_params = media_libraries.predicate(settings_file.active(), filters["library"])+ scope += "AND " + library_clause + " "+ scope_params.extend(library_params)if asset_id is not None:scope += "AND a.id=? "scope_params.append(int(asset_id))diff --git a/src/peach/web_router.py b/src/peach/web_router.pyindex 849f5eded..f400ae292 100644--- a/src/peach/web_router.py+++ b/src/peach/web_router.py@@ -133,7 +133,7 @@ def _get_facets(contract, args):scope_key = f"{scope_kind}:{scope_name}:{asset_id or ''}:{state}"filters = {key: args[key] for key in ('loc', 'creator', 'performer', 'studio', 'series', 'agency', 'tag', 'tag_match',- 'len', 'dur_min', 'dur_max', 'orient', 'exclude_vertical', 'q', 'thumb',+ 'len', 'dur_min', 'dur_max', 'orient', 'exclude_vertical', 'q', 'thumb', 'library',) if args.get(key)}scope_key += repr(sorted(filters.items()))return contract.cached(diff --git a/tests/test_media_libraries.py b/tests/test_media_libraries.pynew file mode 100644index 000000000..e75056243--- /dev/null+++ b/tests/test_media_libraries.py@@ -0,0 +1,44 @@+"""媒体库分组、路径边界与配置往返。"""+import sqlite3+import tomllib+import unittest+from dataclasses import replace+from tempfile import TemporaryDirectory+from pathlib import Path+from types import SimpleNamespace++from peach import media_libraries, settings_file+++class MediaLibraryTests(unittest.TestCase):+ def config(self):+ return SimpleNamespace(locations={"local": ("R:\\Media", "S:\\Other")},+ library_names={"R:\\Media": "电影", "S:\\Other": "电影"})++ def test_named_roots_share_one_library(self):+ rows = media_libraries.libraries(self.config())+ self.assertEqual(len(rows), 1)+ self.assertEqual(len(rows[0]["roots"]), 2)++ def test_filter_observes_source_and_directory_boundary(self):+ with sqlite3.connect(":memory:") as db:+ db.execute("CREATE TABLE asset (location TEXT, path TEXT)")+ db.executemany("INSERT INTO asset VALUES (?,?)", [+ ("local", "r:\\media\\one.mp4"), ("local", "R:\\MediaExtra\\two.mp4"),+ ("online", "R:\\Media\\three.mp4"), ("local", "S:\\Other\\four.mp4")])+ clause, args = media_libraries.predicate(self.config(), "电影")+ self.assertEqual(db.execute("SELECT count(*) FROM asset a WHERE " + clause, args).fetchone()[0], 2)+ clause, args = media_libraries.predicate(self.config(), "不存在")+ self.assertEqual(db.execute("SELECT count(*) FROM asset a WHERE " + clause, args).fetchone()[0], 0)++ def test_library_names_round_trip_toml(self):+ root, name = "R:\\Media", '电影 "精选"'+ line = f"{settings_file._render_value(root)} = {settings_file._render_value(name)}"+ self.assertEqual(tomllib.loads(line), {root: name})+ with TemporaryDirectory() as directory:+ config = settings_file.load_config(environ={"PEACH_DATA_ROOT": directory})+ config = replace(config, library_names={root: name})+ config.path.parent.mkdir(parents=True, exist_ok=True)+ config.path.write_text(settings_file.render(config), encoding="utf-8")+ loaded = settings_file.load_config(environ={"PEACH_DATA_ROOT": directory})+ self.assertEqual(loaded.library_names, {root: name})diff --git a/tests/test_web_ui.py b/tests/test_web_ui.pyindex f37f087c5..3985e23b3 100644--- a/tests/test_web_ui.py+++ b/tests/test_web_ui.py@@ -581,7 +581,8 @@ class WebUiSourceTests(unittest.TestCase):self.assertNotIn("$('#drawer').insertAdjacentHTML(", source)self.assertPageContains("const scroll=$('#drawerScroll'),key=surfacePath()+location.search;")self.assertPageContains("scroll.innerHTML=`<div style=\"display:flex;align-items:center;justify-content:space-between;margin-bottom:10px\">")- self.assertPageContains("scroll.insertAdjacentHTML('beforeend',`<div class=\"sec cat-online\">")+ self.assertPageContains("scroll.insertAdjacentHTML('beforeend',document.documentElement.classList.contains('original-design')?")+ self.assertPageContains("sidebarSectionHtml('内容标签',tagBody,'','online')")# 换页面的判据记在滚动层上:syncSidebarSurface() 判定换页就 replaceChildren(),# 传宿主进去会连 #drawerScroll 一起清掉,和整块 innerHTML 是同一种失败。self.assertPageContains("syncSidebarSurface(scroll,key)")@@ -5473,7 +5474,7 @@ class WebUiSourceTests(unittest.TestCase):self.assertPageContains("function commitContextFilter(mutate)")self.assertPageContains("const search=entityFilterSearch(filters)")# 没有数据的区块不渲染,画幅也必须来自 scoped API,不能硬画横屏/竖屏两个按钮。- self.assertPageContains("const sec=(t,b,x,cat)=>b?")+ self.assertPageContains("sidebarSectionHtml(t,b,x,cat)")self.assertPageContains("const chips=(items,key,multi,limit)=>items.length?")self.assertPageContains("chips(facetData.orientations,'orient')")self.assertPageLacks("chips([{k:'竖屏'},{k:'横屏'}],'orient')")diff --git a/web/app.js b/web/app.jsindex 20a960d06..3e88596d5 100644--- a/web/app.js+++ b/web/app.js@@ -1,4 +1,4 @@-import { resourceScanHtml, boundedPreference, mountNumberSetting, syncNumberSetting, statCardBody, rankedChart, radarChart, distributionChart, jobProgressHtml } from './dist/peach-ui.js';+import { resourceScanHtml, boundedPreference, mountNumberSetting, syncNumberSetting, statCardBody, rankedChart, radarChart, distributionChart, jobProgressHtml, sidebarSectionHtml, wireSidebarGroups, transitionTheme } 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';@@ -452,6 +452,8 @@ function applyTheme(choice=appSettings.theme){const root=document.documentElement;if(choice==='system')delete root.dataset.theme;else root.dataset.theme=choice;const dark=choice==='dark'||(choice==='system'&&prefersDark.matches);+ document.querySelectorAll('[data-board-theme]').forEach(button=>button.setAttribute('aria-pressed',String((button.dataset.boardTheme==='dark')===dark)));+ document.querySelector('.board-theme-toggle')?.classList.toggle('is-dark',dark);document.querySelectorAll('meta[data-theme-color]').forEach(meta=>{meta.media=(meta.dataset.themeColor==='dark')===dark?'all':'not all';});@@ -3150,10 +3152,10 @@ async function buildBars(){const off=key==='loc'&&sourceOffline(it.k);return `<button class="chip${off?' offline':''}" aria-pressed="${sel}" data-key="${key}" data-multi="${multi?1:0}"${off?`disabled title="${OFFLINE_HINT}"`:''}- data-val="${esc(it.k)}">${dot}${esc(it.label||tagLabel(it.k))}${it.n!=null?`<span class="n">${it.n.toLocaleString()}</span>`:''}</button>`;+ data-val="${esc(it.k)}">${dot}<span class="chip-label">${esc(it.label||tagLabel(it.k))}</span>${it.n!=null?`<span class="n">${it.n.toLocaleString()}</span>`:''}</button>`;}).join('')+`</div>`:'';// 按语义类别区分来源、创作者、内容和技术规格。- const sec=(t,b,x,cat)=>b?`<div class="sec${cat?' cat-'+cat:''}"><h3>${t}${x||''}</h3>${b}</div>`:'';+ const sec=(t,b,x,cat)=>document.documentElement.classList.contains('original-design')?(b?`<div class="sec${cat?' cat-'+cat:''}"><h3>${t}${x||''}</h3>${b}</div>`:''):sidebarSectionHtml(t,b,x,cat);const scopedCreators=context.type==='entity'&&context.kind==='creator'? facetData.creators.filter(item=>item.k!==context.name):facetData.creators;// 与窄栏共用 EDGE_ICONS —— 两边条目必须一致,抽屉不另写一份硬编码@@ -3175,7 +3177,7 @@ async function buildBars(){+sec('内容标签',chips(facetData.tags,'tag',false,30),facetData.tags.length>30?'<button data-more="tag">更多</button>':'','general')+sec('影片属性',chips(facetData.tech,'tag',false,16),'','meta')+sec('关注标签',followTagRows.length?`<div class="chips">`+followTagRows.map(row=>- `<button class="chip online" data-follow-drawer-tag="${esc(row.k)}">${esc(tagLabel(row.k))}<span class="n">${row.n.toLocaleString()}</span></button>`+ `<button class="chip online" data-follow-drawer-tag="${esc(row.k)}"><span class="chip-label">${esc(tagLabel(row.k))}</span><span class="n">${row.n.toLocaleString()}</span></button>`).join('')+`</div>`:'','','online');const dc=$('#drawerClose'); if(dc)dc.onclick=()=>openDrawer(false);$('#drawer').querySelectorAll('[data-page]').forEach(b=>b.onclick=()=>{@@ -7122,9 +7124,10 @@ function renderFollowDrawer(items){scroll.querySelectorAll('.sec').forEach(section=>section.remove());const counts=sidebarTagCounts(items.map(item=>({tags:followCardTags(item)})));if(!counts.length)return;- scroll.insertAdjacentHTML('beforeend',`<div class="sec cat-online"><h3>内容标签</h3><div class="chips">${+ const tagBody=`<div class="chips">${counts.map(([tag,n])=>- `<button class="chip online" data-follow-drawer-tag="${esc(tag)}" aria-pressed="${followTags.has(tag)}">${esc(tagLabel(tag))}<span class="n">${n}</span></button>`).join('')}</div></div>`);+ `<button class="chip online" data-follow-drawer-tag="${esc(tag)}" aria-pressed="${followTags.has(tag)}"><span class="chip-label">${esc(tagLabel(tag))}</span><span class="n">${n}</span></button>`).join('')}</div>`;+ scroll.insertAdjacentHTML('beforeend',document.documentElement.classList.contains('original-design')?`<div class="sec cat-online"><h3>内容标签</h3>${tagBody}</div>`:sidebarSectionHtml('内容标签',tagBody,'','online'));$('#drawer').querySelectorAll('[data-follow-drawer-tag]').forEach(b=>b.onclick=()=>{followTags=new Set([b.dataset.followDrawerTag]);openDrawer(false);route(followViewPath());openFollow(false)});@@ -8115,10 +8118,10 @@ async function openItem(id,push=true,queueContext=null,anchor=null){${it.release_date?`<span class="detailmetaitem">${icon('calendar')}<span>${esc(it.release_date)}</span></span>`:''}</div><div class="detailidentity">${identityRows}</div><div class="stags" id="detailTags"></div>- <div class="trace"><div class="lab mono"><span>离开位置</span><span id="ratioTxt">0%</span></div>- <div class="bar"><u id="watched"></u><b id="mark"></b></div>- <div class="lab mono trace-real"><span>真实观看</span><span id="realTxt">0%</span></div>- <div class="bar"><u id="realBar"></u></div>+ <div class="trace"><div class="trace-metric"><div class="lab mono"><span>离开位置</span><span id="ratioTxt">0%</span></div>+ <div class="bar"><u id="watched"></u><b id="mark"></b></div></div>+ <div class="trace-metric"><div class="lab mono trace-real"><span>真实观看</span><span id="realTxt">0%</span></div>+ <div class="bar"><u id="realBar"></u></div></div></div><div class="fb"><button class="like" id="likeBtn" aria-label="${it.liked?'取消喜欢':'喜欢'}" title="喜欢 · 记录口味偏好" aria-pressed="${!!it.liked}">${icon('thumbs-up')}</button>@@ -8824,9 +8827,9 @@ document.addEventListener('keydown',e=>{if(!$('#settingsPanel').hidden){openSettings(false);return}if(!$('#searchMenu').hidden){$('#searchMenu').hidden=true;return}if(!$('#tok').hidden){$('#tokClose').click();return}+ const st=$('#stage');if(st&&!st.hidden){const c=$('#closeStage');if(c){c.click();return}}if($('#drawer').classList.contains('open')){openDrawer(false);return}if(selectMode||selected.size||followSelected.size){setSelectMode(false,true);return}- const st=$('#stage');if(st&&!st.hidden){const c=$('#closeStage');if(c)c.click()}return;}// 输入态不抢键:搜索框、标签弹窗和任何可编辑区域里的按键归它们自己处理。@@ -9094,11 +9097,41 @@ function decorate(){let filterFrame;const boardBrand=document.querySelector('#brandHome');boardBrand.setAttribute('aria-label','Peach 首页');+let libraryPicker;+if(!legacyUI){+ libraryPicker=document.createElement('div');libraryPicker.className='board-library-menu';libraryPicker.id='boardLibraryMenu';libraryPicker.hidden=true;libraryPicker.setAttribute('popover','manual');libraryPicker.setAttribute('role','dialog');libraryPicker.setAttribute('aria-label','媒体库');+ document.body.append(libraryPicker);+ boardBrand.setAttribute('aria-haspopup','dialog');boardBrand.setAttribute('aria-controls',libraryPicker.id);+ boardBrand.insertAdjacentHTML('beforeend','<svg class="board-library-chevron" viewBox="0 0 16 16" aria-hidden="true"><path d="m5 6 3-3 3 3M5 10l3 3 3-3"/></svg>');+ boardBrand.onclick=event=>{event.preventDefault();if(!document.querySelector('#drawer').classList.contains('open')){event.stopImmediatePropagation();openDrawer(true)}};+ const floating=wireAnchoredMenu(document.querySelector('#drawer'),boardBrand,libraryPicker,{side:true});+ libraryPicker.addEventListener('toggle',event=>{if(event.newState==='open')libraryPicker.querySelector('button')?.focus()});+ libraryPicker.addEventListener('keydown',event=>{if(event.key==='Escape'){event.stopPropagation();floating.setOpen(false);boardBrand.focus()}});+ api('/api/libraries').then(data=>{+ const choices=[['','全部媒体库'],...data.libraries.map(row=>[row.id,row.name])];+ const selected=sessionStorage.getItem('peach.library')||'';+ if(!choices.some(row=>row[0]===selected)){sessionStorage.removeItem('peach.library');location.reload();return}+ const current=sessionStorage.getItem('peach.library')||'';+ boardBrand.querySelector('h1').textContent=current||'全部媒体库';+ libraryPicker.innerHTML=`<p>媒体库</p><div class="board-library-rows">${choices.map(([id,name],i)=>`<button type="button" data-library="${esc(id)}" aria-pressed="${id===current}"><span class="board-library-avatar" data-color="${i%3}">${esc(name.slice(0,1))}</span><span>${esc(name)}</span></button>`).join('')}</div><footer><button type="button" class="geist-button" data-library-manage>管理媒体库</button></footer>`;+ libraryPicker.querySelectorAll('[data-library]').forEach(button=>button.onclick=()=>{sessionStorage.setItem('peach.library',button.dataset.library);location.assign('/')});+ libraryPicker.querySelector('[data-library-manage]').onclick=()=>{floating.setOpen(false);openDrawer(false);location.assign('/configuration')};+ }).catch(()=>{libraryPicker.hidden=true});+}const boardToggle=document.querySelector('#filterBtn'),toggleHome=document.createComment('sidebar toggle');boardToggle.before(toggleHome);+if(!legacyUI){+ const foot=document.createElement('div');foot.className='board-sidebar-foot';+ foot.innerHTML=`<div class="board-theme-toggle" role="group" aria-label="明暗主题"><span class="board-theme-thumb" aria-hidden="true"></span><button type="button" data-board-theme="light" aria-label="浅色主题">${icon('sun')}</button><button type="button" data-board-theme="dark" aria-label="深色主题">${icon('moon')}</button></div>`;+ foot.append(document.querySelector('#settingsBtn'));document.querySelector('#drawer').append(foot);+ foot.querySelectorAll('[data-board-theme]').forEach(button=>button.onclick=()=>{if(button.getAttribute('aria-pressed')==='true')return;transitionTheme(button,()=>{appSettings.theme=button.dataset.boardTheme;saveSettings();applyTheme();renderThemeSetting()})});+ applyTheme();+}function placeBrand(){if(legacyUI)return;const close=document.querySelector('#drawerClose');if(close){const head=close.parentElement;head.classList.add('board-sidebar-head');+ boardBrand.setAttribute('aria-label',document.querySelector('#drawer').classList.contains('open')?'选择媒体库':'展开侧栏');+ wireSidebarGroups(document.querySelector('#drawerScroll'));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;@@ -9177,7 +9210,7 @@ if(!legacyUI && /Chrome|Chromium|Edg\//.test(navigator.userAgent)){};new ResizeObserver(draw).observe(node);draw();}- const sync=()=>document.querySelectorAll('.board-filter-frame,.top .search,.edge,.drawer').forEach(attach);+ const sync=()=>document.querySelectorAll('.board-filter-frame,.top .search,.top>.ib,.edge,.drawer').forEach(attach);new MutationObserver(sync).observe(document.querySelector('#main'),{childList:true,subtree:true});sync();}diff --git a/web/board.css b/web/board.cssindex bd0548b93..dae2801e6 100644--- a/web/board.css+++ b/web/board.css@@ -28,7 +28,7 @@:root{--glass-fill:rgba(248,250,255,.72);--glass-rim:rgba(255,255,255,.76);--glass-low:rgba(70,80,100,.12);--glass-text:#242830;--glass-shadow:0 5px 20px #11182714;--glass-sheen:rgba(255,255,255,.38)}:root[data-theme="dark"]{--glass-fill:rgba(29,32,39,.68);--glass-rim:rgba(255,255,255,.23);--glass-low:rgba(255,255,255,.055);--glass-text:#e7e9ee;--glass-shadow:0 5px 20px #00000026;--glass-sheen:rgba(230,239,255,.08)}@media(prefers-color-scheme:dark){:root:not([data-theme]){--glass-fill:rgba(29,32,39,.68);--glass-rim:rgba(255,255,255,.23);--glass-low:rgba(255,255,255,.055);--glass-text:#e7e9ee;--glass-shadow:0 5px 20px #00000026;--glass-sheen:rgba(230,239,255,.08)}}-.board-filter-frame.board-filter-frame.board-filter-frame,.drawer.drawer,.drawer.drawer.open,.edge.edge,.top .search.search{+.board-filter-frame.board-filter-frame.board-filter-frame,.drawer.drawer,.drawer.drawer.open,.edge.edge,.top .search.search,.top.top>.ib{background:linear-gradient(125deg,var(--glass-sheen),transparent 42%,var(--glass-low)),var(--glass-fill);backdrop-filter:var(--glass-optic,blur(22px)) saturate(145%);-webkit-backdrop-filter:var(--glass-optic,blur(22px)) saturate(145%);border:0;box-shadow:inset 0 1px 0 var(--glass-rim),inset 1px 0 0 var(--glass-low),inset -1px 0 0 var(--glass-low),inset 0 -1px 0 var(--glass-low),var(--glass-shadow);@@ -40,10 +40,10 @@.board-filter-frame.board-filter-frame .pill,.board-filter-frame.board-filter-frame .sorts button{color:var(--glass-text)}.board-filter-frame.board-filter-frame #tagbar .pill[data-tag]:not([aria-pressed="true"]){border-color:var(--glass-low)}.board-filter-frame.board-filter-frame #tagbar .pill[data-state][aria-pressed="true"],.board-filter-frame.board-filter-frame .sorts button[aria-pressed="true"]{background:color-mix(in srgb,var(--ink) 10%,transparent)}-.board-filter-frame.board-filter-frame .sorts #batchAction{color:var(--ground);background:var(--ink)}+.board-filter-frame.board-filter-frame .sorts #batchAction,.entitycollectionhead .sorts .entitybatch{color:var(--ink);background:var(--surface);border:1px solid var(--line);border-radius:8px;box-shadow:inset 0 1px 0 #ffffff0a,0 1px 2px #00000012}.top.top,body.board-scrolled .top.top{background:transparent;box-shadow:none;backdrop-filter:none;border:0}.top .search.search{border-radius:999px;padding-left:16px}-.top.top>.ib{border-radius:50%;background:var(--glass-fill);backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px);box-shadow:inset 0 1px 0 var(--glass-low)}+.top.top>.ib{border-radius:50%}.drawer.drawer{border-radius:26px}.edge.edge{border-radius:24px}.drawer.drawer .dnav button:not([aria-pressed="true"]),.edge.edge button:not([aria-pressed="true"]){color:var(--glass-text)}@supports not (backdrop-filter:blur(1px)){.board-filter-frame.board-filter-frame.board-filter-frame,.drawer.drawer,.drawer.drawer.open,.edge.edge,.top .search.search{background:var(--ground)}}@@ -165,14 +165,14 @@ body::before{display:none}.board-filter-frame .tagbar{border-bottom:0;border-radius:16px 16px 0 0}.board-filter-frame .count{border-radius:0 0 16px 16px;min-width:0}.board-filter-frame .sorts{position:relative;min-width:0;overflow-x:auto;scrollbar-width:none}-@media(max-width:760px){.board-filter-frame .count{display:flex;flex-wrap:wrap;gap:8px;overflow:visible}.board-filter-frame .count>.mono{width:100%}.board-filter-frame .sorts{flex:1 1 100%;width:100%;margin:0}}+@media(max-width:760px){.board-filter-frame .count{display:flex;flex-wrap:wrap;gap:8px;overflow:visible}.board-filter-frame .count>.mono{width:100%}.board-filter-frame .count .sorts,.entitycollectionhead .sorts{flex:1 1 100%;width:0;max-width:100%;min-width:0;margin:0;overflow-x:auto;overflow-y:hidden;overscroll-behavior-x:contain;touch-action:pan-x pan-y;padding:4px 2px}}[data-overflow-right="true"]{mask-image:linear-gradient(to right,#000 calc(100% - 18px),transparent)}[data-overflow-left="true"]{mask-image:linear-gradient(to right,transparent,#000 18px)}[data-overflow-left="true"][data-overflow-right="true"]{mask-image:linear-gradient(to right,transparent,#000 18px,#000 calc(100% - 18px),transparent)}.drawer #brandHome{display:flex;gap:10px;align-items:center;margin-right:auto;text-decoration:none;color:var(--ink)}.drawer #brandHome .mark{width:28px;height:28px}.drawer #brandHome h1{font-size:20px;letter-spacing:.02em}.drawer #brandHome .sub{display:none}.edge::before{content:'';width:28px;height:28px;background:url('/peach-logo.png') center/contain no-repeat;padding:0;margin:4px 0 16px}-.top .search{max-width:760px;margin-left:0;margin-right:auto}+.top .search{max-width:none;flex:1 1 0;min-width:0;margin-left:0;margin-right:0}.board-filter-frame #tagbar{height:48px;gap:6px;padding:8px 12px}.board-filter-frame #tagbar .pill{height:30px;padding:0 10px;font-size:13px;line-height:20px;border-radius:8px;border:1px solid transparent}.board-filter-frame #tagbar .pill[data-state]{border:0;background:none}@@ -311,6 +311,70 @@ button,input,select,textarea{font-family:inherit}}@media(prefers-reduced-motion:reduce){:root{--board-motion:0s;--board-dialog-motion:0s}.settingscard .settingshead::after{transition:none}}/* Stat Cards 的内层读数与底栏;统计卡仍是可键盘切换的视图入口。 */+/* 侧栏分组使用标题行与带计数的叶项。 */+.drawer.drawer{display:flex;flex-direction:column;overflow:hidden}+.drawer .drawerscroll{flex:1;min-height:0;scrollbar-width:none}+.drawer .drawerscroll::-webkit-scrollbar{display:none}+.drawer .ovtrack{display:none}+.drawer #brandHome{min-width:0;border-radius:24px;flex:1}+.drawer #brandHome h1{font-size:14px;line-height:20px;letter-spacing:0;font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}+.board-library-chevron{width:16px;height:16px;flex:none;fill:none;stroke:var(--muted);stroke-width:1.6}+.board-library-menu{position:fixed;inset:auto;margin:0;box-sizing:border-box;width:265px;max-width:calc(100vw - 32px);padding:10px;border:1px solid var(--line);border-radius:16px;background:var(--ground);color:var(--ink);box-shadow:0 8px 24px #0002;overflow-y:auto;scrollbar-width:none;transform-origin:top left}+.board-library-menu:popover-open{animation:board-library-in .15s ease-out both}+@keyframes board-library-in{from{opacity:0;transform:scale(.95);filter:blur(2px)}to{opacity:1;transform:scale(1);filter:blur(0)}}+.board-library-menu>p{padding:5px 8px 0;margin:0 0 6px;color:var(--muted);font-size:14px;line-height:20px}+.board-library-rows{display:flex;flex-direction:column;gap:4px}+.board-library-rows button{display:flex;align-items:center;gap:8px;padding:6px 8px;min-height:32px;border:0;border-radius:10px;background:transparent;color:var(--ink);font:inherit;text-align:left;cursor:pointer}+.board-library-rows button:hover,.board-library-rows button[aria-pressed=true]{background:var(--hover)}+.board-library-avatar{display:grid;place-items:center;width:20px;height:20px;flex:none;border-radius:50%;background:var(--picked);font-size:12px;color:var(--muted)}+.board-library-avatar[data-color="1"]{background:#bef264;color:#365314}.board-library-avatar[data-color="2"]{background:#fbcfe8;color:#9d174d}+.board-library-rows button>span:last-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}+.board-library-menu footer{margin:14px -10px 0;padding:14px 18px 8px;border-top:1px solid var(--line)}+.board-library-menu footer button{width:100%}+@media(min-width:761px){.drawer:not(.open) .board-sidebar-head #filterBtn,.drawer:not(.open) .board-library-chevron{display:none}.drawer:not(.open) .board-sidebar-head{min-height:32px;flex-direction:row;justify-content:center}.drawer:not(.open) #brandHome{justify-content:center;width:36px;gap:0}.drawer:not(.open) #brandHome .mark{width:28px;height:28px}}+@media(prefers-reduced-motion:reduce){.board-library-menu:popover-open{animation:none}}+.board-sidebar-foot{display:flex;align-items:center;justify-content:space-between;gap:8px;flex:none;padding:12px}+.board-sidebar-foot>#settingsBtn{width:36px;height:36px;padding:0;display:grid;place-items:center;border-radius:8px;background:transparent;flex:none}+.board-sidebar-foot>#settingsBtn svg{width:20px;height:20px;margin:0}+.board-theme-toggle{position:relative;isolation:isolate;display:flex;gap:4px;padding:4px;border-radius:24px;background:var(--picked)}+.board-theme-toggle button{display:grid;place-items:center;width:32px;height:32px;flex:none;padding:0;border:0;border-radius:50%;background:transparent;color:var(--muted);cursor:pointer}+.board-theme-toggle button[aria-pressed=true]{color:var(--ink)}+.board-theme-toggle svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8}+.board-theme-thumb{position:absolute;z-index:-1;left:4px;top:4px;width:32px;height:32px;background:var(--ground);border-radius:50%;box-shadow:0 1px 3px #0001;transition:transform .2s ease}+.board-theme-toggle.is-dark .board-theme-thumb{transform:translateX(36px)}+@media(min-width:761px){.drawer:not(.open) .board-sidebar-foot{flex-direction:column;padding:12px 10px}.drawer:not(.open) .board-theme-toggle{padding:2px;background:transparent}.drawer:not(.open) .board-theme-toggle button[aria-pressed=true],.drawer:not(.open) .board-theme-thumb{display:none}}+@media(prefers-reduced-motion:reduce){.board-theme-thumb{transition:none}}+.drawer .sec[data-sidebar-group]{border:0;padding:0;margin:20px 0 0}+.drawer .sec[data-sidebar-group]>h3{margin:0 0 4px;letter-spacing:0;text-transform:none;color:var(--muted);font-size:14px;line-height:20px;font-weight:400;gap:4px}+.board-section-toggle{display:flex;align-items:center;gap:8px;flex:1;min-width:0;padding:8px;border:0;border-radius:10px;background:transparent;color:inherit;font:inherit;text-align:left;cursor:pointer}+.board-section-toggle:hover{background:var(--hover)}+.board-section-toggle svg{width:14px;height:14px;flex:none;fill:none;stroke:currentColor;stroke-width:1.7;transform:rotate(0deg)}+.board-section-toggle[aria-expanded=true] svg{transform:rotate(90deg)}+.drawer .sec:has(.board-section-toggle[aria-expanded=false]) [data-more]{display:none}+.drawer .board-sidebar-body[hidden]{display:none}+.drawer .board-sidebar-body .chips{display:flex;flex-direction:column;gap:2px;padding-left:8px}+.drawer .board-sidebar-body .chip{display:flex;width:100%;min-width:0;min-height:36px;gap:8px;padding:8px;border:0;border-radius:10px;background:transparent;color:var(--muted);font-size:14px;line-height:20px;text-align:left;font-weight:400}+.drawer .board-sidebar-body .chip:hover{background:var(--hover);color:var(--ink)}+.drawer .board-sidebar-body .chip[aria-pressed=true]{color:var(--ink);background:var(--picked)}+.drawer .board-sidebar-body .chip-label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}+.drawer .board-sidebar-body .chip .n{margin-left:auto;flex:none;padding:1px 4px;border-radius:4px;background:var(--surface);color:var(--muted);font-size:12px;line-height:16px}+.drawer .board-sidebar-body .chip svg{flex:none;width:16px;height:16px}+/* 观看进度与动作分别成组,操作按钮保留各自的可访问名称。 */+.sidecontent .trace{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;padding:0;margin:8px 0 16px}+.sidecontent .trace-metric{min-width:0;padding:14px 12px;background:var(--surface);border-radius:12px}+.sidecontent .trace .lab{font-family:inherit;font-size:13px;line-height:18px;margin:0 0 12px;gap:8px}+.sidecontent .trace .lab>span:last-child{color:var(--ink);font-variant-numeric:tabular-nums}+.sidecontent .trace .bar{height:4px;border-radius:4px}+.sidecontent .fb{display:flex;flex-wrap:wrap;gap:4px;width:100%;padding:0;border:0;background:transparent;overflow:visible;margin:0 0 16px}+.sidecontent .fb button,.sidecontent .fb .fdownload{flex:0 0 36px;width:36px;height:36px;min-width:36px;display:grid;place-items:center;padding:0;border:0;border-radius:8px;background:var(--surface)}+.sidecontent .fb button svg,.sidecontent .fb .fdownload svg{display:block;width:18px;height:18px;margin:0}+.sidecontent .fb button[aria-pressed=true]{box-shadow:inset 0 0 0 1px currentColor}+.sidecontent .fb .dispose{margin-left:auto}+.sidecontent .obtn{min-height:40px;border-radius:10px;padding:8px 12px;font-size:14px;line-height:20px;font-weight:500;background:var(--surface);color:var(--ink);border:1px solid var(--line);gap:8px;box-shadow:inset 0 1px 0 #ffffff0a}+.sidecontent .obtn svg{width:20px;height:20px;color:#ff669d}+.sidecontent .obtn b{font-size:12px;line-height:18px;padding:1px 6px;border-radius:5px;background:var(--picked);font-weight:500}+.sidecontent .obtn:hover{background:var(--hover)}+.board-filter-frame.board-filter-frame .sorts #batchAction:hover,.entitycollectionhead .sorts .entitybatch:hover{background:var(--hover);color:var(--ink)}: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}diff --git a/web/dist/peach-ui.js b/web/dist/peach-ui.jsindex 34ee5f22e..355849488 100644--- a/web/dist/peach-ui.js+++ b/web/dist/peach-ui.js@@ -1,7 +1,7 @@import { LOC as e, esc as t, faviconUrl as n, fmtDur as r, fmtSize as i, icon as a, requestErrorMessage as o } from "/js/core.js";import { MEDIA_SOURCE_ICONS as s, checkboxHtml as c, confirmModal as l, emptyStateHtml as u, fieldsetTitle as d, loadingDotsHtml as f, noteHtml as p, progressHtml as m, projectBannerHtml as h, selectFieldHtml as g, selectOptionIconHtml as _, setActionBusy as v, wireCollapse as y, wireSelectField as b } from "/js/ui-components.js";//#region node_modules/preact/dist/preact.module.js-var x, S, C, w, T, E, D, O, k, A, j, ee, M, N, P, te = {}, ne = [], re = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, ie = Array.isArray;+var x, S, C, w, T, E, D, O, k, A, j, ee, M, te, N, P = {}, ne = [], re = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, ie = Array.isArray;function F(e, t) {for (var n in t) e[n] = t[n];return e;@@ -67,7 +67,7 @@ function fe() {}function pe(e, t, n, r, i, a, o, s, c, l, u) {var d, f, p, m, h, g, _ = r && r.__k || ne, v = t.length;- for (c = me(n, t, _, c, v), d = 0; d < v; d++) (p = n.__k[d]) != null && (f = p.__i != -1 && _[p.__i] || te, p.__i = d, g = be(e, p, f, i, a, o, s, c, l, u), m = p.__e, p.ref && f.ref != p.ref && (f.ref && Te(f.ref, null, p), u.push(p.ref, p.__c || m, p)), h == null && m != null && (h = m), 4 & p.__u ? (c = he(p, c, e), f.__e && (f.__e = null)) : typeof p.type == "function" && g !== void 0 ? c = g : m && (c = m.nextSibling), p.__u &= -7);+ for (c = me(n, t, _, c, v), d = 0; d < v; d++) (p = n.__k[d]) != null && (f = p.__i != -1 && _[p.__i] || P, p.__i = d, g = be(e, p, f, i, a, o, s, c, l, u), m = p.__e, p.ref && f.ref != p.ref && (f.ref && Te(f.ref, null, p), u.push(p.ref, p.__c || m, p)), h == null && m != null && (h = m), 4 & p.__u ? (c = he(p, c, e), f.__e && (f.__e = null)) : typeof p.type == "function" && g !== void 0 ? c = g : m && (c = m.nextSibling), p.__u &= -7);return n.__e = h, c;}function me(e, t, n, r, i) {@@ -107,7 +107,7 @@ function ve(e, t, n, r, i) {if (typeof r == "string" && (e.style.cssText = r = ""), r) for (t in r) n && t in n || _e(e.style, t, "");if (n) for (t in n) r && n[t] == r[t] || _e(e.style, t, n[t]);}- } else if (t[0] == "o" && t[1] == "n") a = t != (t = t.replace(ee, "$1")), o = t.toLowerCase(), t = o in e || t == "onFocusOut" || t == "onFocusIn" ? o.slice(2) : t.slice(2), e.l ||= {}, e.l[t + a] = n, n ? r ? n[j] = r[j] : (n[j] = M, e.addEventListener(t, a ? P : N, a)) : e.removeEventListener(t, a ? P : N, a);+ } else if (t[0] == "o" && t[1] == "n") a = t != (t = t.replace(ee, "$1")), o = t.toLowerCase(), t = o in e || t == "onFocusOut" || t == "onFocusIn" ? o.slice(2) : t.slice(2), e.l ||= {}, e.l[t + a] = n, n ? r ? n[j] = r[j] : (n[j] = M, e.addEventListener(t, a ? N : te, a)) : e.removeEventListener(t, a ? N : te, a);else {if (i == "http://www.w3.org/2000/svg") t = t.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");else if (t != "width" && t != "height" && t != "href" && t != "list" && t != "form" && t != "tabIndex" && t != "download" && t != "rowSpan" && t != "colSpan" && t != "role" && t != "popover" && t in e) try {@@ -182,7 +182,7 @@ function Ce(e) {return typeof e != "object" || !e || e.__b > 0 ? e : ie(e) ? e.map(Ce) : e.constructor === void 0 ? F({}, e) : null;}function we(e, t, n, r, i, a, o, s, c) {- var l, u, d, f, p, m, h, g = n.props || te, _ = t.props, v = t.type;+ var l, u, d, f, p, m, h, g = n.props || P, _ = t.props, v = t.type;if (v == "svg" ? i = "http://www.w3.org/2000/svg" : v == "math" ? i = "http://www.w3.org/1998/Math/MathML" : i ||= "http://www.w3.org/1999/xhtml", a != null) {for (l = 0; l < a.length; l++) if ((p = a[l]) && "setAttribute" in p == !!v && (v ? p.localName == v : p.nodeType == 3)) {e = p, a[l] = null;@@ -232,7 +232,7 @@ function De(e, t, n) {}function Oe(e, t, n) {var r, i, a, o;- t == document && (t = document.documentElement), S.__ && S.__(e, t), i = (r = typeof n == "function") ? null : n && n.__k || t.__k, a = [], o = [], be(t, e = (!r && n || t).__k = oe(I, null, [e]), i || te, te, t.namespaceURI, !r && n ? [n] : i ? null : t.firstChild ? x.call(t.childNodes) : null, a, !r && n ? n : i ? i.__e : t.firstChild, r, o), Se(a, e, o), e.props.children = null;+ t == document && (t = document.documentElement), S.__ && S.__(e, t), i = (r = typeof n == "function") ? null : n && n.__k || t.__k, a = [], o = [], be(t, e = (!r && n || t).__k = oe(I, null, [e]), i || P, P, t.namespaceURI, !r && n ? [n] : i ? null : t.firstChild ? x.call(t.childNodes) : null, a, !r && n ? n : i ? i.__e : t.firstChild, r, o), Se(a, e, o), e.props.children = null;}x = ne.slice, S = { __e: function(e, t, n, r) {for (var i, a, o; t = t.__;) if ((i = t.__c) && !i.__) try {@@ -250,7 +250,7 @@ x = ne.slice, S = { __e: function(e, t, n, r) {this.__v && (this.__e = !0, e && this.__h.push(e), de(this));}, ce.prototype.render = I, T = [], D = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, O = function(e, t) {return e.__v.__b - t.__v.__b;-}, fe.__r = 0, k = Math.random().toString(8), A = "__d" + k, j = "__a" + k, ee = /(PointerCapture)$|Capture$/i, M = 0, N = ye(!1), P = ye(!0);+}, fe.__r = 0, k = Math.random().toString(8), A = "__d" + k, j = "__a" + k, ee = /(PointerCapture)$|Capture$/i, M = 0, te = ye(!1), N = ye(!0);//#endregion//#region src/sort-preferences.tsfunction ke(e, t, n) {@@ -399,14 +399,65 @@ function Re(e, t) {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/sidebar-groups.ts+var ze = (e) => e.replace(/[&<>"']/g, (e) => ({+ "&": "&",+ "<": "<",+ ">": ">",+ "\"": """,+ "'": "'"+})[e]);+function Be(e, t, n = "", r = "") {+ if (!t) return "";+ let i = `sidebar-group-${encodeURIComponent(e)}`;+ return `<section class="sec${r ? " cat-" + ze(r) : ""}" data-sidebar-group="${ze(e)}"><h3><button type="button" class="board-section-toggle" aria-expanded="true" aria-controls="${i}"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="#i-chevron-right"/></svg><span>${ze(e)}</span></button>${n}</h3><div class="board-sidebar-body" id="${i}">${t}</div></section>`;+}+function Ve(e) {+ e.querySelectorAll("[data-sidebar-group]").forEach((e) => {+ if (e.dataset.sidebarWired) return;+ e.dataset.sidebarWired = "true";+ let t = e.querySelector(".board-section-toggle"), n = e.querySelector(".board-sidebar-body"), r = `peach.sidebar.group.${e.dataset.sidebarGroup}`, i = null;+ try {+ i = sessionStorage.getItem(r);+ } catch {}+ let a = (e) => {+ t.setAttribute("aria-expanded", String(e)), n.hidden = !e;+ }, o = !!n.querySelector("[aria-pressed=true]");+ a(i === null ? o || e.classList.contains("cat-src") || e.dataset.sidebarGroup === "时长" : i === "open"), t.onclick = () => {+ let e = t.getAttribute("aria-expanded") !== "true";+ a(e);+ try {+ sessionStorage.setItem(r, e ? "open" : "closed");+ } catch {}+ };+ });+}+var He = !1;+async function Ue(e, t) {+ if (He) return;+ if (!document.startViewTransition || matchMedia("(prefers-reduced-motion: reduce)").matches) {+ t();+ return;+ }+ let n = e.getBoundingClientRect(), r = n.left + n.width / 2, i = n.top + n.height / 2, a = Math.hypot(Math.max(r, innerWidth - r), Math.max(i, innerHeight - i)) * 2.5, o = document.createElement("style");+ o.textContent = `::view-transition-old(root){animation:none}::view-transition-new(root){mix-blend-mode:normal;mask-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20100%20100%22%3E%3Cdefs%3E%3Cfilter%20id%3D%22b%22%20x%3D%22-50%25%22%20y%3D%22-50%25%22%20width%3D%22200%25%22%20height%3D%22200%25%22%3E%3CfeGaussianBlur%20stdDeviation%3D%222%22%2F%3E%3C%2Ffilter%3E%3C%2Fdefs%3E%3Ccircle%20cx%3D%2250%22%20cy%3D%2250%22%20r%3D%2242%22%20fill%3D%22white%22%20filter%3D%22url(%23b)%22%2F%3E%3C%2Fsvg%3E");mask-repeat:no-repeat;animation:peach-theme-reveal 820ms cubic-bezier(.16,1,.3,1) both}@keyframes peach-theme-reveal{from{mask-position:${r}px ${i}px;mask-size:0px 0px}to{mask-position:${r - a / 2}px ${i - a / 2}px;mask-size:${a}px ${a}px}}`, He = !0, document.head.append(o);+ try {+ await document.startViewTransition(t).finished;+ } catch {+ t();+ } finally {+ o.remove(), He = !1;+ }+}+//#endregion//#region src/api.ts-var ze = class extends Error {+var We = class extends Error {status;body;constructor(e, t, n = null) {super(o(e, t)), this.name = "ApiError", this.status = t, this.body = n;}-}, Be = (e) => {+}, Ge = (e) => {if (!e || typeof e != "object") return "";let t = e;for (let e of [@@ -428,7 +479,7 @@ async function B(e, t) {try {r = await n.json();} catch {}- if (!n.ok) throw new ze(Be(r) || `请求失败(${n.status})`, n.status);+ if (!n.ok) throw new We(Ge(r) || `请求失败(${n.status})`, n.status);return r;}async function V(e, t, n = "POST", r) {@@ -445,14 +496,14 @@ async function V(e, t, n = "POST", r) {try {a = await i.json();} catch {}- if (!i.ok) throw new ze(Be(a) || `请求失败(${i.status})`, i.status, a);+ if (!i.ok) throw new We(Ge(a) || `请求失败(${i.status})`, i.status, a);return a;}//#endregion//#region node_modules/preact/hooks/dist/hooks.module.js-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 Ke, H, qe, Je, Ye = 0, Xe = [], U = S, Ze = U.__b, Qe = U.__r, $e = U.diffed, et = U.__c, tt = U.unmount, nt = U.__;+function rt(e, t) {+ U.__h && U.__h(H, e, Ye || t), Ye = 0;var n = H.__H || (H.__H = {__: [],__h: []@@ -460,11 +511,11 @@ function Qe(e, t) {return e >= n.__.length && n.__.push({}), n.__[e];}function W(e) {- return We = 1, $e(st, e);+ return Ye = 1, it(ft, 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) {+function it(e, t, n) {+ var r = rt(Ke++, 2);+ if (r.t = e, !r.__c && (r.__ = [n ? n(t) : ft(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)) {@@ -496,97 +547,97 @@ function $e(e, t, n) {return r.__N || r.__;}function G(e, t) {- var n = Qe(Ve++, 3);- !U.__s && ot(n.__H, t) && (n.__ = e, n.u = t, H.__H.__h.push(n));+ var n = rt(Ke++, 3);+ !U.__s && dt(n.__H, t) && (n.__ = e, n.u = t, H.__H.__h.push(n));}function K(e, t) {- var n = Qe(Ve++, 4);- !U.__s && ot(n.__H, t) && (n.__ = e, n.u = t, H.__h.push(n));+ var n = rt(Ke++, 4);+ !U.__s && dt(n.__H, t) && (n.__ = e, n.u = t, H.__h.push(n));}function q(e) {- return We = 5, et(function() {+ return Ye = 5, at(function() {return { current: e };}, []);}-function et(e, t) {- var n = Qe(Ve++, 7);- return ot(n.__H, t) && (n.__ = e(), n.__H = t, n.__h = e), n.__;+function at(e, t) {+ var n = rt(Ke++, 7);+ return dt(n.__H, t) && (n.__ = e(), n.__H = t, n.__h = e), n.__;}-function tt() {- for (var e; e = Ge.shift();) {+function ot() {+ for (var e; e = Xe.shift();) {var t = e.__H;if (e.__P && t) try {- t.__h.some(it), t.__h.some(at), t.__h = [];+ t.__h.some(lt), t.__h.some(ut), t.__h = [];} catch (n) {t.__h = [], U.__e(n, e.__v);}}}U.__b = function(e) {- H = null, Ke && Ke(e);+ H = null, Ze && Ze(e);}, U.__ = function(e, t) {- e && t.__k && t.__k.__m && (e.__m = t.__k.__m), Ze && Ze(e, t);+ e && t.__k && t.__k.__m && (e.__m = t.__k.__m), nt && nt(e, t);}, U.__r = function(e) {- qe && qe(e), Ve = 0;+ Qe && Qe(e), Ke = 0;var t = (H = e.__c).__H;- t && (He === H ? (t.__h = [], H.__h = [], t.__.some(function(e) {+ t && (qe === H ? (t.__h = [], H.__h = [], t.__.some(function(e) {e.__N && (e.__ = e.__N), e.u = e.__N = void 0;- })) : (t.__h.some(it), t.__h.some(at), t.__h = [], Ve = 0)), He = H;+ })) : (t.__h.some(lt), t.__h.some(ut), t.__h = [], Ke = 0)), qe = H;}, U.diffed = function(e) {- Je && Je(e);+ $e && $e(e);var t = e.__c;- t && t.__H && (t.__H.__h.length && (Ge.push(t) !== 1 && Ue === U.requestAnimationFrame || ((Ue = U.requestAnimationFrame) || rt)(tt)), t.__H.__.some(function(e) {+ t && t.__H && (t.__H.__h.length && (Xe.push(t) !== 1 && Je === U.requestAnimationFrame || ((Je = U.requestAnimationFrame) || ct)(ot)), t.__H.__.some(function(e) {e.u &&= (e.__H = e.u, void 0);- })), He = H = null;+ })), qe = H = null;}, U.__c = function(e, t) {t.some(function(e) {try {- e.__h.some(it), e.__h = e.__h.filter(function(e) {- return !e.__ || at(e);+ e.__h.some(lt), e.__h = e.__h.filter(function(e) {+ return !e.__ || ut(e);});} catch (n) {t.some(function(e) {e.__h &&= [];}), t = [], U.__e(n, e.__v);}- }), Ye && Ye(e, t);+ }), et && et(e, t);}, U.unmount = function(e) {- Xe && Xe(e);+ tt && tt(e);var t, n = e.__c;n && n.__H && (n.__H.__.some(function(e) {try {- it(e);+ lt(e);} catch (e) {t = e;}}), n.__H = void 0, t && U.__e(t, n.__v));};-var nt = typeof requestAnimationFrame == "function";-function rt(e) {+var st = typeof requestAnimationFrame == "function";+function ct(e) {var t, n = function() {- clearTimeout(r), nt && cancelAnimationFrame(t), setTimeout(e);+ clearTimeout(r), st && cancelAnimationFrame(t), setTimeout(e);}, r = setTimeout(n, 35);- nt && (t = requestAnimationFrame(n));+ st && (t = requestAnimationFrame(n));}-function it(e) {+function lt(e) {var t = H, n = e.__c;typeof n == "function" && (e.__c = void 0, n()), H = t;}-function at(e) {+function ut(e) {var t = H;e.__c = e.__(), H = t;}-function ot(e, t) {+function dt(e, t) {return !e || e.length !== t.length || t.some(function(t, n) {return t !== e[n];});}-function st(e, t) {+function ft(e, t) {return typeof t == "function" ? t(e) : t;}//#endregion//#region node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js-var ct = 0;+var pt = 0;Array.isArray;function J(e, t, n, r, i, a) {t ||= {};@@ -603,7 +654,7 @@ function J(e, t, n, r, i, a) {__e: null,__c: null,constructor: void 0,- __v: --ct,+ __v: --pt,__i: -1,__u: 0,__source: i,@@ -614,7 +665,7 @@ function J(e, t, n, r, i, a) {}//#endregion//#region src/islands/access-settings.tsx-function lt({ id: e, label: t, value: n, onInput: r, error: i, help: a, current: o = !1, disabled: s = !1 }) {+function mt({ 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: [@@ -644,7 +695,7 @@ function lt({ id: e, label: t, value: n, onInput: r, error: i, help: a, current:]});}-function ut({ initial: e, receipt: t }) {+function ht({ 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",@@ -669,7 +720,7 @@ function ut({ initial: e, receipt: t }) {});r(e), a(""), s(""), l(""), f(!1), _({}), t(e.mode === "open" ? "已关闭访问密码" : "已保存访问密码");} catch (e) {- let t = e instanceof ze ? e.body : null, n = t?.errors || t?.detail?.errors;+ let t = e instanceof We ? e.body : null, n = t?.errors || t?.detail?.errors;n ? _(n) : h(z(e));} finally {b.current = !1, v(x.current, !1);@@ -705,7 +756,7 @@ function ut({ initial: e, receipt: t }) {})]}), /* @__PURE__ */ J("span", { children: "关闭访问密码,允许能连接到 Peach 的设备直接访问" })]}) : null,- n.mode === "password" ? /* @__PURE__ */ J(lt, {+ n.mode === "password" ? /* @__PURE__ */ J(mt, {id: "access-current",label: "当前访问密码",value: i,@@ -713,7 +764,7 @@ function ut({ initial: e, receipt: t }) {error: g.current_password,current: !0}) : null,- n.mode === "locked" ? null : /* @__PURE__ */ J(I, { children: [/* @__PURE__ */ J(lt, {+ n.mode === "locked" ? null : /* @__PURE__ */ J(I, { children: [/* @__PURE__ */ J(mt, {id: "access-password",label: n.mode === "password" ? "新访问密码" : "设置访问密码",value: o,@@ -721,7 +772,7 @@ function ut({ initial: e, receipt: t }) {disabled: u,error: u ? void 0 : g.password,help: u ? "关闭访问密码时无需填写。" : "至少 8 个字符。保存后其他设备需要重新登录。"- }), /* @__PURE__ */ J(lt, {+ }), /* @__PURE__ */ J(mt, {id: "access-confirm",label: "确认访问密码",value: c,@@ -752,7 +803,7 @@ function ut({ initial: e, receipt: t }) {}//#endregion//#region src/islands/release-updates.tsx-var dt = /* @__PURE__ */ new Set([+var gt = /* @__PURE__ */ new Set(["downloading","verifying","extracting",@@ -760,13 +811,13 @@ var dt = /* @__PURE__ */ new Set(["restarting","installing"]);-function ft({ initial: e, initialJob: t }) {+function _t({ 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, dt.has(i.state));+ v(h.current, gt.has(i.state));}, [i.state]), G(() => () => {u.current = !1, c.current?.abort();}, []);@@ -783,7 +834,7 @@ function ft({ initial: e, initialJob: t }) {onConfirm: g}));}, [i.state]), G(() => {- if (!dt.has(i.state)) return;+ if (!gt.has(i.state)) return;let e = new AbortController(), t, n = 0, o = async () => {try {let t = await B("/api/configuration/update-status", e.signal);@@ -803,7 +854,7 @@ function ft({ initial: e, initialJob: t }) {};}, [i.state]);let _ = async (e) => {- if (c.current || dt.has(i.state)) return;+ if (c.current || gt.has(i.state)) return;let t = new AbortController();c.current = t, f.current = !1, s(""), v(e, !0);try {@@ -930,7 +981,7 @@ function ft({ initial: e, initialJob: t }) {/* @__PURE__ */ J("button", {type: "button",class: "geist-button",- disabled: dt.has(i.state),+ disabled: gt.has(i.state),onClick: (e) => y(e.currentTarget),children: "检查更新"})@@ -940,7 +991,7 @@ function ft({ initial: e, initialJob: t }) {}//#endregion//#region src/islands/peach-proxy.tsx-function pt({ initial: e, receipt: t }) {+function vt({ 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;@@ -1031,7 +1082,7 @@ function pt({ initial: e, receipt: t }) {}//#endregion//#region src/islands/desktop-settings.tsx-function mt({ label: e, checked: t, disabled: n, change: r }) {+function yt({ label: e, checked: t, disabled: n, change: r }) {return /* @__PURE__ */ J("label", {class: "configcheck",children: [/* @__PURE__ */ J("span", {@@ -1051,7 +1102,7 @@ function mt({ label: e, checked: t, disabled: n, change: r }) {}), /* @__PURE__ */ J("span", { children: e })]});}-function ht({ label: e, checked: t, disabled: n, change: r }) {+function bt({ label: e, checked: t, disabled: n, change: r }) {return /* @__PURE__ */ J("label", {class: "configtoggle",children: [/* @__PURE__ */ J("span", { children: e }), /* @__PURE__ */ J("input", {@@ -1064,7 +1115,7 @@ function ht({ label: e, checked: t, disabled: n, change: r }) {})]});}-function gt({ startup: e, receipt: t }) {+function xt({ 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) {@@ -1097,7 +1148,7 @@ function gt({ startup: e, receipt: t }) {role: "group","aria-labelledby": "startupTitle",children: [- /* @__PURE__ */ J(ht, {+ /* @__PURE__ */ J(bt, {label: "开机后启动 Peach",checked: n,disabled: !e.available,@@ -1105,7 +1156,7 @@ function gt({ startup: e, receipt: t }) {}),/* @__PURE__ */ J("div", {class: "configoption",- children: [/* @__PURE__ */ J(ht, {+ children: [/* @__PURE__ */ J(bt, {label: "静默启动",checked: i,disabled: !e.available || !n,@@ -1117,7 +1168,7 @@ function gt({ startup: e, receipt: t }) {}),/* @__PURE__ */ J("div", {class: "configoption",- children: [/* @__PURE__ */ J(ht, {+ children: [/* @__PURE__ */ J(bt, {label: "在桌面创建快捷方式",checked: o,disabled: !p,@@ -1152,7 +1203,7 @@ function gt({ startup: e, receipt: t }) {})]});}-function _t({ data: e }) {+function St({ data: e }) {let t = q(null);return K(() => {let n = t.current, r = document.createElement("details");@@ -1166,7 +1217,7 @@ function _t({ data: e }) {return n.replaceChildren(r), y(n, "details", "uninstall-data"), () => n.replaceChildren();}, [e]), /* @__PURE__ */ J("div", { ref: t });}-function vt({ uninstall: e }) {+function Ct({ uninstall: e }) {let [t, n] = W(!1), [r, i] = W("");async function a() {await l({@@ -1198,13 +1249,13 @@ function vt({ uninstall: e }) {children: "卸载会退出 Peach、移除程序、开机自启和桌面图标。原始媒体文件保留。"})]}),- /* @__PURE__ */ J(mt, {+ /* @__PURE__ */ J(yt, {label: "完全卸载:同时删除设置、本地数据库、观看记录、凭据和缓存",checked: t,disabled: !e.full_available || !!r,change: n}),- /* @__PURE__ */ J(_t, { data: e }),+ /* @__PURE__ */ J(St, { data: e }),e.message && /* @__PURE__ */ J("p", {class: "confighelp",children: e.message@@ -1230,7 +1281,7 @@ function vt({ uninstall: e }) {}//#endregion//#region src/islands/clouddrive-guide.tsx-var yt = [+var wt = [{name: "机械硬盘,或内存 8 GB 以内",cache: "10–20 GiB",@@ -1250,7 +1301,7 @@ var yt = [task: "2 个起步"}];-function bt() {+function Tt() {let e = q(null);return K(() => {e.current && y(e.current, "details", "clouddrive-guide");@@ -1302,7 +1353,7 @@ function bt() {scope: "col",children: "同时处理视频"})- ] }) }), /* @__PURE__ */ J("tbody", { children: yt.map((e) => /* @__PURE__ */ J("tr", { children: [+ ] }) }), /* @__PURE__ */ J("tbody", { children: wt.map((e) => /* @__PURE__ */ J("tr", { children: [/* @__PURE__ */ J("th", {scope: "row",children: e.name@@ -1346,18 +1397,18 @@ function bt() {}//#endregion//#region src/islands/configuration.tsx-var xt = "/api/configuration", St = "/api/pick-folder", Ct = 8e3, wt = (e, t) => B(xt, t), Tt = ({ html: e, class: t }) => /* @__PURE__ */ J("div", {+var Et = "/api/configuration", Dt = "/api/pick-folder", Ot = 8e3, kt = (e, t) => B(Et, t), At = ({ html: e, class: t }) => /* @__PURE__ */ J("div", {class: t,dangerouslySetInnerHTML: { __html: e }-}), Et = (e) => !(e instanceof ze) || e.status !== 400 ? null : e.body?.errors ?? null;-function Dt({ facts: e }) {+}), jt = (e) => !(e instanceof We) || e.status !== 400 ? null : e.body?.errors ?? null;+function Mt({ 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(Tt, { html: d("configFactsTitle", "运行信息") }), /* @__PURE__ */ J("dl", {+ children: [/* @__PURE__ */ J(At, { 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",@@ -1378,7 +1429,7 @@ function Dt({ facts: e }) {})});}-function Ot({ data: e }) {+function Nt({ data: e }) {let [t, n] = W(e.media_sources), [r, i] = W(""), a = q(null);G(() => () => a.current?.abort(), []);let o = async (e) => {@@ -1386,7 +1437,7 @@ function Ot({ data: e }) {let t = new AbortController();a.current = t, v(e, !0), i("");try {- let e = await B(xt, t.signal);+ let e = await B(Et, t.signal);t.signal.aborted || n(e.media_sources);} catch (e) {t.signal.aborted || i(z(e));@@ -1400,7 +1451,7 @@ function Ot({ data: e }) {children: [/* @__PURE__ */ J("div", {class: "geist-fieldset-content",children: [- /* @__PURE__ */ J(Tt, { html: d("configMountsTitle", "挂载状态") }),+ /* @__PURE__ */ J(At, { html: d("configMountsTitle", "挂载状态") }),/* @__PURE__ */ J("dl", {class: "configfacts",children: t.map((e) => /* @__PURE__ */ J(I, { children: [/* @__PURE__ */ J("dt", { children: [/* @__PURE__ */ J("span", {@@ -1437,7 +1488,7 @@ function Ot({ data: e }) {})]}) : null;}-function kt({ value: e, label: t, onChange: n }) {+function Pt({ 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;@@ -1463,45 +1514,45 @@ function kt({ value: e, label: t, onChange: n }) {class: "configsourcecontrol"});}-function At({ data: e, receipt: t }) {+function Ft({ data: e, receipt: t }) {let n = e.media_sources?.filter((e) => ["local","115","pikpak"- ].includes(e.location)), [r, i] = W(n?.length ? n.map((e) => e.path) : e.media_dirs.length ? e.media_dirs : [""]), [a, o] = W(n?.map((e) => e.location) ?? []), [s, c] = W(n?.map((e) => e.root) ?? []), [l, u] = W(String(e.port)), [f, m] = W(!1), [h, g] = W([]), [_, y] = W(""), [b, x] = W(""), [S, C] = W(null), [w, T] = W(null), E = q(!1), D = q(e.revision), O = q([]), k = q(null);+ ].includes(e.location)), [r, i] = W(n?.length ? n.map((e) => e.path) : e.media_dirs.length ? e.media_dirs : [""]), [a, o] = W(n?.map((e) => e.location) ?? []), [s, c] = W(n?.map((e) => e.root) ?? []), [l, u] = W(n?.map((e) => e.library || "") ?? []), [f, m] = W(String(e.port)), [h, g] = W(!1), [_, y] = W([]), [b, x] = W(""), [S, C] = W(""), [w, T] = W(null), [E, D] = W(null), O = q(!1), k = q(e.revision), A = q([]), j = q(null);K(() => {- w !== null && (O.current[w]?.focus(), T(null));- }, [w]), G(() => {- if (!S) return;- let e = setTimeout(() => location.assign(S.url), Ct);+ E !== null && (A.current[E]?.focus(), D(null));+ }, [E]), G(() => {+ if (!w) return;+ let e = setTimeout(() => location.assign(w.url), Ot);return () => clearTimeout(e);- }, [S]);- let A = (e, t) => {+ }, [w]);+ let ee = (e, t) => {i((n) => n.map((n, r) => r === e ? t : n));- }, j = () => {- T(r.length), i((e) => [...e, ""]);- }, ee = (e) => {- o((t) => t.filter((t, n) => n !== e)), c((t) => t.filter((t, n) => n !== e)), i((t) => t.filter((t, n) => n !== e)), g((t) => t.filter((t, n) => n !== e));- }, M = (e, t) => {- g((n) => {+ }, M = () => {+ D(r.length), i((e) => [...e, ""]);+ }, te = (e) => {+ o((t) => t.filter((t, n) => n !== e)), c((t) => t.filter((t, n) => n !== e)), u((t) => t.filter((t, n) => n !== e)), i((t) => t.filter((t, n) => n !== e)), y((t) => t.filter((t, n) => n !== e));+ }, N = (e, t) => {+ y((n) => {let r = [...n];for (; r.length <= e;) r.push("");return r[e] = t, r;});- }, N = async (e, t) => {+ }, P = async (e, t) => {if (t.getAttribute("aria-busy") !== "true") {v(t, !0);try {- let { path: t } = await V(St, { initial: r[e] ?? "" });- t && (A(e, t), M(e, ""));+ let { path: t } = await V(Dt, { initial: r[e] ?? "" });+ t && (ee(e, t), N(e, ""));} catch (t) {- M(e, z(t));+ N(e, z(t));} finally {v(t, !1);}}};- return S ? /* @__PURE__ */ J("div", {+ return w ? /* @__PURE__ */ J("div", {class: "configsaved",role: "status",children: /* @__PURE__ */ J("div", {@@ -1514,7 +1565,7 @@ function At({ data: e, receipt: t }) {}), /* @__PURE__ */ J("p", { children: /* @__PURE__ */ J("span", { children: ["配置已保存,Peach 正在重新启动。稍后自动跳转,或点击",/* @__PURE__ */ J("a", {- href: S.url,+ href: w.url,children: "进入馆藏"}),"。"@@ -1525,26 +1576,27 @@ function At({ data: e, receipt: t }) {"data-geist-fieldset": !0,"aria-labelledby": "configTitle",onSubmit: async (n) => {- if (n.preventDefault(), !E.current) {- E.current = !0, v(k.current, !0), x("");+ if (n.preventDefault(), !O.current) {+ O.current = !0, v(j.current, !0), C("");try {- let n = await V(xt, {- revision: D.current,+ let n = await V(Et, {+ revision: k.current,media_dirs: r,...e.media_sources ? { media_sources: r.map((e, t) => ({path: e,location: a[t] || "local",- root: s[t] || ""+ root: s[t] || "",+ library: l[t] || ""})) } : {},- port: l,- scan_now: f+ port: f,+ scan_now: h});- D.current = n.revision, g([]), y(""), t("已保存配置"), C(n);+ k.current = n.revision, y([]), x(""), t("已保存配置"), T(n);} catch (e) {- let t = Et(e);- t ? (g(t.media_dirs ?? []), y(t.port ?? "")) : (g([]), y(""), x(z(e)));+ let t = jt(e);+ t ? (y(t.media_dirs ?? []), x(t.port ?? "")) : (y([]), x(""), C(z(e)));} finally {- E.current = !1, v(k.current, !1);+ O.current = !1, v(j.current, !1);}}},@@ -1552,7 +1604,7 @@ function At({ data: e, receipt: t }) {children: [/* @__PURE__ */ J("div", {class: "geist-fieldset-content",children: [- /* @__PURE__ */ J(Tt, { html: d("configTitle", "这台电脑") }),+ /* @__PURE__ */ J(At, { html: d("configTitle", "这台电脑") }),/* @__PURE__ */ J("div", {class: "configfield",children: [@@ -1577,17 +1629,17 @@ function At({ data: e, receipt: t }) {type: "text",value: t,"aria-label": `媒体文件夹 ${n + 1}`,- "aria-invalid": h[n] ? "true" : void 0,- onInput: (e) => A(n, e.currentTarget.value),+ "aria-invalid": _[n] ? "true" : void 0,+ onInput: (e) => ee(n, e.currentTarget.value),ref: (e) => {- O.current[n] = e;+ A.current[n] = e;}}),/* @__PURE__ */ J("button", {type: "button",class: "geist-button configpick","aria-label": "选择文件夹",- onClick: (e) => N(n, e.currentTarget),+ onClick: (e) => P(n, e.currentTarget),children: /* @__PURE__ */ J("svg", {viewBox: "0 0 24 24","aria-hidden": "true",@@ -1598,7 +1650,7 @@ function At({ data: e, receipt: t }) {type: "button",class: "geist-button configrm danger","aria-label": "移除这个文件夹",- onClick: () => ee(n),+ onClick: () => te(n),children: /* @__PURE__ */ J("svg", {viewBox: "0 0 24 24","aria-hidden": "true",@@ -1607,31 +1659,45 @@ function At({ data: e, receipt: t }) {}) : null,/* @__PURE__ */ J("div", {class: "configsource",- children: [/* @__PURE__ */ J("div", {- class: "configsourcelabel",- children: ["媒体来源", /* @__PURE__ */ J(kt, {- label: `媒体来源 ${n + 1}`,- value: a[n] || "local",- onChange: (e) => {- let t = [...a];- t[n] = e, o(t);+ children: [+ /* @__PURE__ */ J("label", { children: ["媒体库", /* @__PURE__ */ J("input", {+ class: "geist-input",+ "aria-label": `媒体库 ${n + 1}`,+ maxLength: 80,+ value: l[n] || "",+ placeholder: "同名文件夹归入同一个媒体库",+ onInput: (e) => {+ let t = [...l];+ t[n] = e.currentTarget.value, u(t);}- })]- }), e.windows === !1 ? /* @__PURE__ */ J("label", { children: ["Windows 中的对应路径", /* @__PURE__ */ J("input", {- class: "geist-input",- "aria-label": `Windows 中的对应路径 ${n + 1}`,- value: s[n] || "",- placeholder: "例如 B:\\\\",- onInput: (e) => {- let t = [...s];- t[n] = e.currentTarget.value, c(t);- }- })] }) : null]+ })] }),+ /* @__PURE__ */ J("div", {+ class: "configsourcelabel",+ children: ["媒体来源", /* @__PURE__ */ J(Pt, {+ label: `媒体来源 ${n + 1}`,+ value: a[n] || "local",+ onChange: (e) => {+ let t = [...a];+ t[n] = e, o(t);+ }+ })]+ }),+ e.windows === !1 ? /* @__PURE__ */ J("label", { children: ["Windows 中的对应路径", /* @__PURE__ */ J("input", {+ class: "geist-input",+ "aria-label": `Windows 中的对应路径 ${n + 1}`,+ value: s[n] || "",+ placeholder: "例如 B:\\\\",+ onInput: (e) => {+ let t = [...s];+ t[n] = e.currentTarget.value, c(t);+ }+ })] }) : null+ ]}),- h[n] ? /* @__PURE__ */ J("p", {+ _[n] ? /* @__PURE__ */ J("p", {class: "configbad",role: "alert",- children: h[n]+ children: _[n]}) : null]}, n))@@ -1639,10 +1705,10 @@ function At({ data: e, receipt: t }) {/* @__PURE__ */ J("button", {type: "button",class: "geist-button configadd",- onClick: j,+ onClick: M,children: "添加文件夹"}),- a.some((e) => e === "115" || e === "pikpak") ? /* @__PURE__ */ J(bt, {}) : null,+ a.some((e) => e === "115" || e === "pikpak") ? /* @__PURE__ */ J(Tt, {}) : null,a.some((e) => e === "115" || e === "pikpak") ? e.mount_dependencies?.filter((e) => !e.available).map((e) => /* @__PURE__ */ J("p", {class: "confighelp",children: [@@ -1685,14 +1751,14 @@ function At({ data: e, receipt: t }) {class: "geist-input",type: "text",inputMode: "numeric",- value: l,- "aria-invalid": _ ? "true" : void 0,- onInput: (e) => u(e.currentTarget.value)+ value: f,+ "aria-invalid": b ? "true" : void 0,+ onInput: (e) => m(e.currentTarget.value)}),- _ ? /* @__PURE__ */ J("p", {+ b ? /* @__PURE__ */ J("p", {class: "configbad",role: "alert",- children: _+ children: b}) : null,/* @__PURE__ */ J("p", {class: "confighelp",@@ -1706,8 +1772,8 @@ function At({ data: e, receipt: t }) {class: "pcheck",children: [/* @__PURE__ */ J("input", {type: "checkbox",- checked: f,- onChange: (e) => m(e.currentTarget.checked)+ checked: h,+ onChange: (e) => g(e.currentTarget.checked)}), /* @__PURE__ */ J("span", {"aria-hidden": "true",children: /* @__PURE__ */ J("svg", {@@ -1717,7 +1783,7 @@ function At({ data: e, receipt: t }) {})]}), /* @__PURE__ */ J("span", { children: "保存后扫描并补全资料" })]}),- b ? /* @__PURE__ */ J(Tt, { html: p(b, {+ S ? /* @__PURE__ */ J(At, { html: p(S, {variant: "error",label: "没有保存"}) }) : null@@ -1728,14 +1794,14 @@ function At({ data: e, receipt: t }) {children: [/* @__PURE__ */ J("p", { children: e.port_editable === !1 ? "保存后 Peach 会重新载入配置。" : "保存后 Peach 会重新启动,端口改了就用新地址打开。" }), /* @__PURE__ */ J("button", {type: "submit",class: "geist-button primary",- ref: k,+ ref: j,children: "保存配置"})]})]});}-function jt({ receipt: e, data: t, error: n }) {- return n || !t ? /* @__PURE__ */ J(Tt, {+function It({ receipt: e, data: t, error: n }) {+ return n || !t ? /* @__PURE__ */ J(At, {class: "configpage",html: p(n || "没有读到配置", {variant: "error",@@ -1748,7 +1814,7 @@ function jt({ receipt: e, data: t, error: n }) {class: "configgroup",children: "通用"}) : null,- t.startup ? /* @__PURE__ */ J(gt, {+ t.startup ? /* @__PURE__ */ J(xt, {startup: t.startup,receipt: e}) : null,@@ -1756,23 +1822,23 @@ function jt({ receipt: e, data: t, error: n }) {class: "configgroup",children: "媒体"}),- t.editable ? /* @__PURE__ */ J(At, {+ t.editable ? /* @__PURE__ */ J(Ft, {data: t,receipt: e- }) : /* @__PURE__ */ J(Tt, { html: p(t.notice, {+ }) : /* @__PURE__ */ J(At, { html: p(t.notice, {variant: "secondary",label: "只读"}) }),- /* @__PURE__ */ J(Ot, { data: t }),+ /* @__PURE__ */ J(Nt, { data: t }),t.peach_proxy || t.access ? /* @__PURE__ */ J("h2", {class: "configgroup",children: "网络与访问"}) : null,- t.peach_proxy ? /* @__PURE__ */ J(pt, {+ t.peach_proxy ? /* @__PURE__ */ J(vt, {initial: t.peach_proxy,receipt: e}) : null,- t.access ? /* @__PURE__ */ J(ut, {+ t.access ? /* @__PURE__ */ J(ht, {initial: t.access,receipt: e}) : null,@@ -1780,34 +1846,34 @@ function jt({ receipt: e, data: t, error: n }) {class: "configgroup",children: "更新与维护"}),- t.updates ? /* @__PURE__ */ J(ft, {+ t.updates ? /* @__PURE__ */ J(_t, {initial: t.updates,initialJob: t.update_job}) : null,- /* @__PURE__ */ J(Dt, { facts: t.facts }),- t.uninstall ? /* @__PURE__ */ J(vt, { uninstall: t.uninstall }) : null+ /* @__PURE__ */ J(Mt, { facts: t.facts }),+ t.uninstall ? /* @__PURE__ */ J(Ct, { uninstall: t.uninstall }) : null]});}//#endregion//#region node_modules/@preact/signals-core/dist/signals-core.module.js-var Mt = Symbol.for("preact-signals");-function Nt() {+var Lt = Symbol.for("preact-signals");+function Rt() {if (X > 1) X--;else {var e, t = !1;for ((function() {- var e = Vt;- for (Vt = void 0; e !== void 0;) {+ var e = Kt;+ for (Kt = 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;}- })(); Lt !== void 0;) {- var n = Lt;- for (Lt = void 0, Rt++; n !== void 0;) {+ })(); Ht !== void 0;) {+ var n = Ht;+ for (Ht = void 0, Ut++; n !== void 0;) {var r = n.u;- if (n.u = void 0, n.f &= -3, !(8 & n.f) && Gt(n)) try {+ if (n.u = void 0, n.f &= -3, !(8 & n.f) && Xt(n)) try {n.c();} catch (n) {t ||= (e = n, !0);@@ -1815,30 +1881,30 @@ function Nt() {n = r;}}- if (Rt = 0, X--, t) throw e;+ if (Ut = 0, X--, t) throw e;}}-function Pt(e) {+function zt(e) {if (X > 0) return e();- Bt = ++zt, X++;+ Gt = ++Wt, X++;try {return e();} finally {- Nt();+ Rt();}}-var Ft, Y = void 0;-function It(e) {- var t = Y, n = Ft;- Y = void 0, Ft = void 0;+var Bt, Y = void 0;+function Vt(e) {+ var t = Y, n = Bt;+ Y = void 0, Bt = void 0;try {return e();} finally {- Y = t, Ft = n;+ Y = t, Bt = n;}}-var Lt = void 0, X = 0, Rt = 0, zt = 0, Bt = 0, Vt = void 0, Ht = 0;-function Ut(e) {+var Ht = void 0, X = 0, Ut = 0, Wt = 0, Gt = 0, Kt = void 0, qt = 0;+function Jt(e) {if (Y !== void 0) {var t = e.n;if (t === void 0 || t.t !== Y) return t = {@@ -1857,11 +1923,11 @@ function Ut(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 = Mt, Z.prototype.h = function() {+Z.prototype.brand = Lt, 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 ? It(function() {+ n !== e && e.e === void 0 && (e.x = n, this.t = e, n === void 0 ? Vt(function() {var e;(e = t.W) == null || e.call(t);}) : n.e = e);@@ -1869,16 +1935,16 @@ Z.prototype.brand = Mt, 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 && It(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 && Vt(function() {var e;(e = t.Z) == null || e.call(t);}));}}, Z.prototype.subscribe = function(e) {var t = this;- return $t(function() {+ return an(function() {var n = t.value;- It(function() {+ Vt(function() {return e(n);});}, { name: "sub" });@@ -1890,41 +1956,41 @@ Z.prototype.brand = Mt, Z.prototype.h = function() {return this.value;}, Z.prototype.peek = function() {var e = this;- return It(function() {+ return Vt(function() {return e.value;});}, Object.defineProperty(Z.prototype, "value", {get: function() {- var e = Ut(this);+ var e = Jt(this);return e !== void 0 && (e.i = this.i), this.v;},set: function(e) {if (e !== this.v) {- if (Rt > 100) throw Error("Cycle detected");+ if (Ut > 100) throw Error("Cycle detected");(function(e) {- X !== 0 && Rt === 0 && e.l !== Bt && (e.l = Bt, Vt = {+ X !== 0 && Ut === 0 && e.l !== Gt && (e.l = Gt, Kt = {S: e,v: e.v,i: e.i,- o: Vt+ o: Kt});- })(this), this.v = e, this.i++, Ht++, X++;+ })(this), this.v = e, this.i++, qt++, X++;try {for (var t = this.t; t !== void 0; t = t.x) t.t.N();} finally {- Nt();+ Rt();}}}});-function Wt(e, t) {+function Yt(e, t) {return new Z(e, t);}-function Gt(e) {+function Xt(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 Kt(e) {+function Zt(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) {@@ -1933,7 +1999,7 @@ function Kt(e) {}}}-function qt(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;@@ -1941,21 +2007,21 @@ function qt(e) {e.s = n;}function Q(e, t) {- Z.call(this, void 0, t), this.x = e, this.s = void 0, this.g = Ht - 1, this.f = 4;+ Z.call(this, void 0, t), this.x = e, this.s = void 0, this.g = qt - 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 === Ht)) return !0;- if (this.g = Ht, this.f |= 1, this.i > 0 && !Gt(this)) return this.f &= -2, !0;+ if ((36 & this.f) == 32 || (this.f &= -5, this.g === qt)) return !0;+ if (this.g = qt, this.f |= 1, this.i > 0 && !Xt(this)) return this.f &= -2, !0;var e = Y;try {- Kt(this), Y = this;+ Zt(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, qt(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;@@ -1974,14 +2040,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 = Ut(this);+ var e = Jt(this);if (this.h(), e !== void 0 && (e.i = this.i), 16 & this.f) throw this.v;return this.v;} });-function Jt(e, t) {+function $t(e, t) {return new Q(e, t);}-function Yt(e) {+function en(e) {var t = e.m;if (e.m = void 0, typeof t == "function") {X++;@@ -1990,24 +2056,24 @@ function Yt(e) {try {t();} catch (t) {- throw e.f &= -2, e.f |= 8, Xt(e), t;+ throw e.f &= -2, e.f |= 8, tn(e), t;} finally {- Y = n, Nt();+ Y = n, Rt();}}}-function Xt(e) {+function tn(e) {for (var t = e.s; t !== void 0; t = t.n) t.S.U(t);- e.x = void 0, e.s = void 0, Yt(e);+ e.x = void 0, e.s = void 0, en(e);}-function Zt(e) {+function nn(e) {if (Y !== this) throw Error("Out-of-order effect");- qt(this), Y = e, this.f &= -2, 8 & this.f && Xt(this), Nt();+ Qt(this), Y = e, this.f &= -2, 8 & this.f && tn(this), Rt();}-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);+function rn(e, t) {+ this.x = e, this.m = void 0, this.s = void 0, this.u = void 0, this.f = 32, this.name = t?.name, Bt && Bt.push(this);}-Qt.prototype.c = function() {+rn.prototype.c = function() {var e = this.S();try {if (8 & this.f || this.x === void 0) return;@@ -2016,20 +2082,20 @@ Qt.prototype.c = function() {} finally {e();}-}, Qt.prototype.S = function() {+}, rn.prototype.S = function() {if (1 & this.f) throw Error("Cycle detected");- this.f |= 1, this.f &= -9, Yt(this), Kt(this), X++;+ this.f |= 1, this.f &= -9, en(this), Zt(this), X++;var e = Y;- 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() {+ return Y = this, nn.bind(this, e);+}, rn.prototype.N = function() {+ 2 & this.f || (this.f |= 2, this.u = Ht, Ht = this);+}, rn.prototype.d = function() {+ this.f |= 8, 1 & this.f || tn(this);+}, rn.prototype.dispose = function() {this.d();};-function $t(e, t) {- var n = new Qt(e, t);+function an(e, t) {+ var n = new rn(e, t);try {n.c();} catch (e) {@@ -2040,35 +2106,35 @@ function $t(e, t) {}//#endregion//#region node_modules/@preact/signals/dist/signals.module.js-var en, tn, nn = typeof window < "u" && !!window.__PREACT_SIGNALS_DEVTOOLS__, rn = [];-$t(function() {- en = this.N;+var on, sn, cn = typeof window < "u" && !!window.__PREACT_SIGNALS_DEVTOOLS__, ln = [];+an(function() {+ on = this.N;})();-function an(e, t) {+function un(e, t) {S[e] = t.bind(null, S[e] || function() {});}-function on(e) {- if (tn) {- var t = tn;- tn = void 0, t();+function dn(e) {+ if (sn) {+ var t = sn;+ sn = void 0, t();}- tn = e && e.S();+ sn = e && e.S();}-function sn(e) {- var t = this, n = e.data, r = ln(n);+function fn(e) {+ var t = this, n = e.data, r = mn(n);r.name = "ReactiveDom", r.value = n;- var i = et(function() {+ var i = at(function() {for (var e = t, n = t.__v; n = n.__;) if (n.__c) {n.__c.__$f |= 4;break;}- var i = Jt(function() {+ var i = $t(function() {var e = r.value.value;return e === 0 ? 0 : !0 === e ? "" : e || "";- }), a = Jt(function() {+ }), a = $t(function() {return !Array.isArray(i.value) && !w(i.value);- }), o = $t(function() {- if (this.N = fn, a.value) {+ }), o = an(function() {+ if (this.N = _n, a.value) {var t = i.value;e.__v && e.__v.__e && e.__v.__e.nodeType === 3 && (e.__v.__e.data = t);}@@ -2079,14 +2145,14 @@ function sn(e) {}, []), a = i[0], o = i[1];return a.value ? o.peek() : o.value;}-sn.displayName = "ReactiveTextNode", Object.defineProperties(Z.prototype, {+fn.displayName = "ReactiveTextNode", Object.defineProperties(Z.prototype, {constructor: {configurable: !0,value: void 0},type: {configurable: !0,- value: sn+ value: fn},props: {configurable: !0,@@ -2101,7 +2167,7 @@ sn.displayName = "ReactiveTextNode", Object.defineProperties(Z.prototype, {configurable: !0,value: 1}-}), an("__b", function(e, t) {+}), un("__b", function(e, t) {if (typeof t.type == "string") {var n, r = t.props;for (var i in r) if (i !== "children") {@@ -2110,26 +2176,26 @@ sn.displayName = "ReactiveTextNode", Object.defineProperties(Z.prototype, {}}e(t);-}), an("__r", function(e, t) {+}), un("__r", function(e, t) {if (e(t), t.type !== I) {- on();+ dn();var n, r = t.__c;r && (r.__$f &= -2, (n = r.__$u) === void 0 && (r.__$u = n = function(e, t) {var n;- return $t(function() {+ return an(function() {n = this;}, { name: t }), n.c = e, n;}(function(e) {return function() {var t;- nn && ((t = this.y) == null || t.call(this)), e.__$f |= 1, e.setState({});+ cn && ((t = this.y) == null || t.call(this)), e.__$f |= 1, e.setState({});};- }(r), typeof t.type == "function" ? t.type.displayName || t.type.name : ""))), on(n);+ }(r), typeof t.type == "function" ? t.type.displayName || t.type.name : ""))), dn(n);}-}), an("__e", function(e, t, n, r) {- on(), e(t, n, r);-}), an("diffed", function(e, t) {- on();+}), un("__e", function(e, t, n, r) {+ dn(), e(t, n, r);+}), un("diffed", function(e, t) {+ dn();var n;if (typeof t.type == "string" && (n = t.__e)) {var r = t.__np, i = t.props, a = n.U;@@ -2139,25 +2205,25 @@ sn.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 = cn(n, c, u, i), a[c] = l) : l.o(u, i);+ l === void 0 ? (l = pn(n, c, u, i), a[c] = l) : l.o(u, i);}}e(t);});-function cn(e, t, n, r) {- var i = t in e && e.ownerSVGElement === void 0, a = Wt(n);+function pn(e, t, n, r) {+ var i = t in e && e.ownerSVGElement === void 0, a = Yt(n);return {o: function(e, t) {a.value = e, r = t;},- d: $t(function() {- this.N = fn;+ d: an(function() {+ this.N = _n;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));})};}-an("unmount", function(e, t) {+un("unmount", function(e, t) {if (typeof t.type == "string") {var n = t.__e;if (n) {@@ -2181,7 +2247,7 @@ an("unmount", function(e, t) {}}e(t);-}), an("__h", function(e, t, n, r) {+}), un("__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;@@ -2195,44 +2261,44 @@ an("unmount", function(e, t) {for (var s in this.props) if (!(s in e)) return !0;return !1;};-function ln(e, t) {- return et(function() {- return Wt(e, t);+function mn(e, t) {+ return at(function() {+ return Yt(e, t);}, []);}-var un = function(e) {+var hn = function(e) {queueMicrotask(function() {queueMicrotask(e);});};-function dn() {- Pt(function() {- for (var e; e = rn.shift();) en.call(e);+function gn() {+ zt(function() {+ for (var e; e = ln.shift();) on.call(e);});}-function fn() {- rn.push(this) === 1 && (S.requestAnimationFrame || un)(dn);+function _n() {+ ln.push(this) === 1 && (S.requestAnimationFrame || hn)(gn);}//#endregion//#region src/state/quality-goals.ts-var pn = "/api/quality-goals?limit=200", mn = {+var vn = "/api/quality-goals?limit=200", yn = {data: null,error: ""-}, hn = Wt(mn), gn = 0, _n = Jt(() => hn.value);-Jt(() => hn.value.data?.total ?? null);-function vn() {- gn += 1, hn.value = mn;+}, bn = Yt(yn), xn = 0, Sn = $t(() => bn.value);+$t(() => bn.value.data?.total ?? null);+function Cn() {+ xn += 1, bn.value = yn;}-async function yn(e) {- let t = gn += 1;+async function wn(e) {+ let t = xn += 1;try {- let n = await B(pn, e);- return t === gn && (hn.value = {+ let n = await B(vn, e);+ return t === xn && (bn.value = {data: n,error: ""}), n;} catch (n) {- throw !e?.aborted && t === gn && (hn.value = {+ throw !e?.aborted && t === xn && (bn.value = {data: null,error: z(n)}), n;@@ -2240,9 +2306,9 @@ async function yn(e) {}//#endregion//#region src/islands/quality-goals.tsx-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;+var Tn = (e, t) => wn(t), En = (e) => e.has_cover ? `/cover?code=${encodeURIComponent(e.code ?? "")}` : `/poster?id=${e.id}&c=4`;+function Dn({ openItem: t, javTitleHtml: n, javDisplayName: a, srcBadge: o }) {+ let { data: s, error: c } = Sn.value;if (c) return /* @__PURE__ */ J("div", {class: "qualitylist",dangerouslySetInnerHTML: { __html: p(c, {@@ -2261,7 +2327,7 @@ function Sn({ openItem: t, javTitleHtml: n, javDisplayName: a, srcBadge: o }) {"aria-label": `打开 ${a(s)}`,onClick: () => t(s.id),children: /* @__PURE__ */ J("img", {- src: xn(s),+ src: En(s),alt: "",loading: "lazy",onError: (e) => e.currentTarget.remove()@@ -2295,7 +2361,7 @@ function Sn({ openItem: t, javTitleHtml: n, javDisplayName: a, srcBadge: o }) {}//#endregion//#region src/jobs.ts-async function Cn(e) {+async function On(e) {let t = e.pause || ((e) => new Promise((t) => setTimeout(t, e))), n = 0;for (; e.active();) {let r;@@ -2310,11 +2376,11 @@ async function Cn(e) {await t(2e3);}}-function wn(e) {+function kn(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;- Cn({+ On({read: e.read,active: () => !i && e.active() && t.isConnected,keepWatching: e.watchIdle !== !1,@@ -2340,8 +2406,8 @@ function wn(e) {}//#endregion//#region src/islands/scraping.tsx-var Tn = (e, t) => B("/api/scraping", t);-function En({ value: e, onChange: t }) {+var An = (e, t) => B("/api/scraping", t);+function jn({ value: e, onChange: t }) {let n = q(null), r = q(t);return r.current = t, K(() => {let t = n.current;@@ -2355,7 +2421,7 @@ function En({ value: e, onChange: t }) {class: "scraping-network"});}-function Dn({ source: e, toast: t }) {+function Mn({ 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, _));@@ -2426,7 +2492,7 @@ function Dn({ source: e, toast: t }) {}),/* @__PURE__ */ J("div", {class: "scraping-label",- children: ["连接方式", /* @__PURE__ */ J(En, {+ children: ["连接方式", /* @__PURE__ */ J(jn, {value: a,onChange: o})]@@ -2537,13 +2603,13 @@ function Dn({ source: e, toast: t }) {})});}-function On({ data: e, error: t, toast: n }) {+function Nn({ 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 Cn({+ await On({read: (e) => B("/api/scraping/cover", e),active: () => !u.current.signal.aborted && t === f.current,render: (t) => {@@ -2604,7 +2670,7 @@ function On({ data: e, error: t, toast: n }) {]})}),- e?.sources.map((e) => /* @__PURE__ */ J(Dn, {+ e?.sources.map((e) => /* @__PURE__ */ J(Mn, {source: e,toast: n}, e.source))@@ -2613,13 +2679,13 @@ function On({ data: e, error: t, toast: n }) {}//#endregion//#region src/islands/library-processing.tsx-var kn = (e, t) => B("/api/library-processing", t);-function An({ data: e, error: t, toast: n, onComplete: r, mode: i, monitor: a }) {+var Pn = (e, t) => B("/api/library-processing", t);+function Fn({ 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({+ await On({read: (e) => B("/api/library-processing", e),active: () => !y.current.signal.aborted && b.current === e,keepWatching: i === "notice" || !!a,@@ -2717,12 +2783,12 @@ function An({ data: e, error: t, toast: n, onComplete: r, mode: i, monitor: a })}//#endregion//#region src/state/index.ts-var jn = { "quality-goals": {- refresh: yn,- reset: vn-} }, Mn = () => Object.keys(jn);-async function Nn(e) {- let t = jn[e];+var In = { "quality-goals": {+ refresh: wn,+ reset: Cn+} }, Ln = () => Object.keys(In);+async function Rn(e) {+ let t = In[e];if (!t) throw Error(`未登记的共享 store:${String(e)}`);try {return await t.refresh(), !0;@@ -2732,24 +2798,24 @@ async function Nn(e) {}//#endregion//#region src/review-evidence.ts-var Pn = (e = "") => /^https?:\/\//i.test(e) ? e : "";-function Fn(e = "") {- let n = Pn(e) || (e.startsWith("/") && !e.startsWith("//") ? e : "");+var zn = (e = "") => /^https?:\/\//i.test(e) ? e : "";+function Bn(e = "") {+ let n = zn(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 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));+function Vn(e) {+ let n = zn(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>- ${Fn(e.preview_url)}+ ${Bn(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 Ln(e) {+function Hn(e) {for (let t of e.querySelectorAll("[data-review-picture] img")) {let e = () => {t.hidden = !0;@@ -2761,7 +2827,7 @@ function Ln(e) {}//#endregion//#region src/review-bulk.ts-var Rn = () => ({+var Un = () => ({busy: !1,category: "",filter: "",@@ -2772,7 +2838,7 @@ var Rn = () => ({assets: /* @__PURE__ */ new Map(),errors: /* @__PURE__ */ new Map()});-function zn(e) {+function Wn(e) {let t = e?.querySelector(".reviewcontrols");if (!e || !t || t.offsetParent === null) return;let n = e.closest("main");@@ -2782,7 +2848,7 @@ function zn(e) {n.classList.toggle("is-stuck", n.offsetParent !== null && window.scrollY > 0 && Number.isFinite(e) && Math.abs(n.getBoundingClientRect().top - e) <= 1);}}-function Bn(e, t) {+function Gn(e, t) {let n = [["candidates",t ? "按候选数量" : "全部待复核",@@ -2798,7 +2864,7 @@ function Bn(e, t) {"list-filter"]), n;}-function Vn(e, t) {+function Kn(e, t) {let n = /* @__PURE__ */ new Map();for (let r of e) {let e, i;@@ -2815,11 +2881,11 @@ function Vn(e, t) {}return [...n.values()];}-function Hn(e, t, n, r, i) {+function qn(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 Un(e, t, n, r) {+async function Jn(e, t, n, r) {let i = [], a = 0;for (let o of e) {if (!r()) break;@@ -2839,17 +2905,17 @@ async function Un(e, t, n, r) {failures: i};}-function Wn(e) {+function Yn(e) {return e.length ? [...new Set(e.flatMap((e) => e.candidates?.map((e) => e.source || "") || []))].filter((t) => t && e.every((e) => e.candidates?.filter((e) => e.source === t).length === 1)) : [];}-function Gn(e, t) {+function Xn(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 = Bn(t.rows, t.metadata);+ let a = Gn(t.rows, t.metadata);a.some((e) => e[0] === r.groupBy) || (r.groupBy = "candidates", r.filter = "");- let o = Vn(t.rows, r.groupBy);+ let o = Kn(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");@@ -2904,15 +2970,15 @@ function Gn(e, t) {let j = e.querySelector(".reviewcontrols");j ? j.append(p) : n.before(p), e.append(k), n.classList.add("reviewgroups");let ee = () => {- r.selected.clear(), r.anchor = null, P();+ r.selected.clear(), r.anchor = null, N();};A.onclick = () => {r.busy || (ee(), S.focus({ preventScroll: !0 }));}, S.onclick = () => {if (r.busy) return;let e = s(), t = l().length === e.length;- e.forEach((e) => t ? r.selected.delete(e.dataset.reviewKey) : r.selected.add(e.dataset.reviewKey)), P();- }, C.onclick = () => te("approved", C), w.onclick = () => te("rejected", w);+ e.forEach((e) => t ? r.selected.delete(e.dataset.reviewKey) : r.selected.add(e.dataset.reviewKey)), N();+ }, C.onclick = () => P("approved", C), w.onclick = () => P("rejected", w);let M = [];for (let e of o) {let t = e.rows.map((e) => i.find((t) => t.dataset.reviewKey === e.item_key)).filter((e) => !!e), a = document.createElement("section");@@ -2925,7 +2991,7 @@ function Gn(e, t) {d.className = "reviewlist", o.append(l, u), a.append(o, d), n.append(a), u.onclick = () => {if (r.busy) return;let e = t.every((e) => r.selected.has(e.dataset.reviewKey));- t.forEach((t) => e ? r.selected.delete(t.dataset.reviewKey) : r.selected.add(t.dataset.reviewKey)), P();+ t.forEach((t) => e ? r.selected.delete(t.dataset.reviewKey) : r.selected.add(t.dataset.reviewKey)), N();}, M.push(() => {u.textContent = t.every((e) => r.selected.has(e.dataset.reviewKey)) ? "清空本组" : "全选本组";});@@ -2941,7 +3007,7 @@ function Gn(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) => {- Hn(r, s().map((e) => e.dataset.reviewKey), t, e, n), P();+ qn(r, s().map((e) => e.dataset.reviewKey), t, e, n), N();};if (i.addEventListener("mousedown", (e) => {e.shiftKey && e.preventDefault();@@ -2955,7 +3021,7 @@ function Gn(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), Hn(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), qn(r, i.map((e) => e.dataset.reviewKey), a.dataset.reviewKey, !0, !0), N(), a.querySelector(".reviewpickitem input")?.focus());}}}), M.push(() => {@@ -2973,25 +3039,25 @@ function Gn(e, t) {n.target.closest("[data-review-asset],[data-pick-all],[data-pick-none]") && r.assets.set(t, [...e.querySelectorAll("[data-review-asset][aria-pressed=\"true\"]")].map((e) => Number(e.dataset.reviewAsset)));});for (let n of e.querySelectorAll("input[type=\"radio\"]")) r.choices.has(t) && (n.checked = r.choices.get(t) === n.value), n.addEventListener("change", () => {- n.checked && r.choices.set(t, n.value), P();+ n.checked && r.choices.set(t, n.value), N();});}}e.addEventListener("keydown", (t) => {- r.busy || !e.contains(n) || (t.key === "Escape" && r.selected.size && (t.preventDefault(), t.stopPropagation(), ee()), (t.ctrlKey || t.metaKey) && t.key.toLowerCase() === "a" && !t.target.matches("textarea,input:not([type=\"checkbox\"]):not([type=\"radio\"])") && (t.preventDefault(), t.stopPropagation(), s().forEach((e) => r.selected.add(e.dataset.reviewKey)), P()));+ r.busy || !e.contains(n) || (t.key === "Escape" && r.selected.size && (t.preventDefault(), t.stopPropagation(), ee()), (t.ctrlKey || t.metaKey) && t.key.toLowerCase() === "a" && !t.target.matches("textarea,input:not([type=\"checkbox\"]):not([type=\"radio\"])") && (t.preventDefault(), t.stopPropagation(), s().forEach((e) => r.selected.add(e.dataset.reviewKey)), N()));});- let N = "";- function P() {+ let te = "";+ function N() {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 = Wn(u());+ let n = Yn(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: "统一选择来源" });+ if (a !== te) {+ te = 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 || !Wn(u()).includes(e.value))) {+ if (!(r.busy || !Yn(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) => {@@ -3004,7 +3070,7 @@ function Gn(e, t) {}M.forEach((e) => e());}- async function te(n, i) {+ async function P(n, i) {if (r.busy || !l().length) return;let a = l().map((e) => ({key: e.dataset.reviewKey,@@ -3024,7 +3090,7 @@ function Gn(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 Un(a, async (e) => {+ let u = 0, d = await Jn(a, async (e) => {try {return await t.submit(e);} finally {@@ -3041,14 +3107,14 @@ function Gn(e, t) {let f = e.parentElement;t.refresh(), f?.querySelector(".reviewbulktoolbar button")?.focus({ preventScroll: !0 });}- P(), zn(e);+ N(), Wn(e);}//#endregion//#region src/native-image.ts-function Kn(e, t, n, r) {+function Zn(e, t, n, r) {return e > 0 && t > 0 && e === n && t === r;}-function qn(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 = [@@ -3065,7 +3131,7 @@ function qn(e, t, n, r, i = 1) {}//#endregion//#region src/entity-skeleton.ts-function Jn(e, t) {+function $n(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>@@ -3077,7 +3143,7 @@ function Jn(e, t) {}//#endregion//#region src/catalog-onboarding.ts-var Yn = [+var er = ["loc","creator","performer",@@ -3094,16 +3160,16 @@ var Yn = ["jav","thumb"];-function Xn() {+function tr() {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\"> </span></span>") + "</div><div class=\"tier catalog-placeholder\" aria-hidden=\"true\">" + e("<span class=\"brandpill\"><span class=\"mk\"></span><span class=\"placeholder-name\"> </span></span>") + "</div>",tags: "<span class=\"catalog-placeholder placeholder-tags\" aria-hidden=\"true\">" + e("<span class=\"pill\"> </span>") + "</span>"};}-async function Zn(e, t) {+async function nr(e, t) {let n = new URLSearchParams();- for (let t of Yn) e[t] && n.set(t, e[t]);+ for (let t of er) 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 || [],@@ -3114,7 +3180,7 @@ async function Zn(e, t) {return r.set("q", e), r.set("limit", "1"), (await t("/api/items?" + r)).total > 0 ? e : "";}))).filter(Boolean);}-function Qn({ kind: e = "catalog", filtered: t = !1, jav: n = !1, configurable: r = !1, online: i = !1 } = {}) {+function rr({ 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: "标签",@@ -3127,7 +3193,7 @@ function Qn({ kind: e = "catalog", filtered: t = !1, jav: n = !1, configurable:}//#endregion//#region src/sidebar.ts-function $n(e) {+function ir(e) {return ["/","/unseen",@@ -3137,23 +3203,23 @@ function $n(e) {"/junk-files"].includes(e) || /^\/(item|mix|parts|editions)\//.test(e) || /^\/playlists\/\d+\/\d+$/.test(e) || /^\/(performers|studios|creators|series|agencies)\/.+/.test(e);}-function er(e, t) {+function ar(e, t) {return e.dataset.surface === t && e.querySelector(".dnav") ? !1 : (e.dataset.surface = t, e.replaceChildren(), !0);}-function tr(e) {+function or(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 nr(e) {+function sr(e) {return e.filter((e) => ["115", "pikpak"].includes(e.location) && (e.roots === void 0 || e.roots.length > 0)).map((e) => e.location);}-function rr(e, t) {+function cr(e, t) {return t.filter((t) => e.some((e) => e.location === t));}-function ir() {+function lr() {return `<div class="cleanuppage" data-skeleton="cleanup" aria-busy="true" aria-label="正在读取数据管理状态"><div class="cleanupgrid">${[[@@ -3199,7 +3265,7 @@ function ir() {<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 ar(e, t = !1, n = !1) {+function ur(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" : ""}>@@ -3213,28 +3279,28 @@ function ar(e, t = !1, n = !1) {<button type="button" class="geist-button taste-guide-skip">跳过</button></div></details>`;}-var or = "peach-taste-guide-dismissed";-function sr(e, t) {+var dr = "peach-taste-guide-dismissed";+function fr(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(or, "1"), n.remove();+ t.setItem(dr, "1"), n.remove();});}//#endregion//#region src/resource-sync.ts-var $ = (e = 0) => Number(e).toLocaleString(), cr = {+var $ = (e = 0) => Number(e).toLocaleString(), pr = {local: "本地磁盘",115: "115",pikpak: "PikPak"};-function lr(e, t) {+function mr(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>${cr[e.location] || "媒体来源"}</b><span class="${e.online ? "online" : "offline"}">${e.online ? "可访问" : "离线,已跳过"}</span></div>+ <div class="resourcesourcetitle"><b>${pr[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>@@ -3245,60 +3311,60 @@ function lr(e, t) {}//#endregion//#region src/jav-artwork.ts-function ur(e) {+function hr(e) {return ["small","sleeve","preview"].includes(String(e)) ? "small" : "big";}-function dr(e) {+function gr(e) {return {- javLayout: ur(e.javLayout),- javImage: fr(e.javLayout === "preview" ? "thumbnail" : e.javImage)+ javLayout: hr(e.javLayout),+ javImage: _r(e.javLayout === "preview" ? "thumbnail" : e.javImage)};}-function fr(e) {+function _r(e) {return e === "thumbnail" ? "thumbnail" : "cover";}-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 vr(e, t) {+ return e.is_jav && e.code && e.has_cover && (_r(t) === "cover" || !e.has_thumb) ? "cover" : e.has_thumb ? "thumbnail" : "";}-function mr(e, t) {+function yr(e, t) {e.querySelectorAll("img[data-jav-image]").forEach((e) => {- let n = e.dataset.javCover || "", r = e.dataset.javThumb || "", i = !!(n && (fr(t) === "cover" || !r)), a = i ? n : r;+ let n = e.dataset.javCover || "", r = e.dataset.javThumb || "", i = !!(n && (_r(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 hr = {+var br = {"library-processing": {- load: kn,- component: An+ load: Pn,+ component: Fn},scraping: {- load: Tn,- component: On+ load: An,+ component: Nn},"quality-goals": {- load: bn,- component: Sn+ load: Tn,+ component: Dn},configuration: {- load: wt,- component: jt+ load: kt,+ component: It}-}, gr = () => Object.keys(hr), _r = /* @__PURE__ */ new Map();-async function vr(e, t, n, r = {}) {- let i = hr[e];+}, xr = () => Object.keys(br), Sr = /* @__PURE__ */ new Map();+async function Cr(e, t, n, r = {}) {+ let i = br[e];if (!i) throw Error(`未注册的 island:${String(e)}`);- yr(t);+ wr(t);let a = {controller: new AbortController(),painted: !1};- _r.set(t, a);+ Sr.set(t, a);let o;try {o = {@@ -3312,9 +3378,9 @@ async function vr(e, t, n, r = {}) {error: z(e)};}- if (_r.get(t) !== a) return;+ if (Sr.get(t) !== a) return;if (r.isCurrent && !r.isCurrent()) {- _r.delete(t);+ Sr.delete(t);return;}t.textContent = "", a.painted = !0;@@ -3324,9 +3390,9 @@ async function vr(e, t, n, r = {}) {};Oe(oe(i.component, s), t);}-function yr(e) {- let t = _r.get(e);- t && (t.controller.abort(), _r.delete(e), t.painted && Oe(null, e));+function wr(e) {+ let t = Sr.get(e);+ t && (t.controller.abort(), Sr.delete(e), t.painted && Oe(null, e));}//#endregion-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 };+export { dr as TASTE_GUIDE_KEY, je as boundedPreference, rr as catalogEmptyHtml, nr as catalogSuggestions, lr as cleanupSkeletonHtml, sr as cloudLocations, cr as cloudPreferenceLocations, Un as createReviewSelection, Ie as distributionChart, tr as emptyCatalogLayout, $n as entitySkeletonHtml, kn as followJobProgress, Vn as identityEvidenceHtml, xr as islandNames, vr as javImageKind, Fe as jobProgressHtml, Zn as matchesFaceSource, Cr as mountIsland, Ne as mountNumberSetting, Qn as nativeImageFit, _r as normalizeJavImage, hr as normalizeJavLayout, gr as normalizeJavPreferences, ke as preferredDirection, Re as radarChart, Le as rankedChart, Rn as refreshStore, mr as resourceScanHtml, Bn as reviewImageHtml, ir as sidebarHasCatalogContent, Be as sidebarSectionHtml, or as sidebarTagCounts, Pe as statCardBody, Ln as storeNames, yr as syncJavImages, Me as syncNumberSetting, ar as syncSidebarSurface, ur as tasteHistoryGuideHtml, Ue as transitionTheme, wr as unmountIsland, Wn as updateReviewSticky, On as watchJob, Hn as wireReviewPictures, Xn as wireReviewSelection, Ve as wireSidebarGroups, fr as wireTasteHistoryGuide };diff --git a/web/js/core.js b/web/js/core.jsindex b7fa49add..0350ad89f 100644--- a/web/js/core.js+++ b/web/js/core.js@@ -25,6 +25,10 @@ export function requestErrorMessage(cause,status=0){return '操作未完成,请重试;持续失败时查看托盘日志。';}const api=async(p,o)=>{+ if(!o?.method||o.method==='GET'){+ const library=sessionStorage.getItem('peach.library');+ if(library&&/^\/api\/(items|facets)(\?|$)/.test(p))p+=(p.includes('?')?'&':'?')+'library='+encodeURIComponent(library);+ }const {signal=null,...rest}=o||{};const init={headers:{'Content-Type':'application/json'},...rest};if(signal)init.signal=signal;diff --git a/web/js/ui-components.js b/web/js/ui-components.jsindex d7376b141..bb7119213 100644--- a/web/js/ui-components.js+++ b/web/js/ui-components.js@@ -519,16 +519,21 @@ let openedMenu=null;if(!globalThis.__peachMenuCloser){globalThis.__peachMenuCloser=true;document.addEventListener('click',event=>{- if(openedMenu&&!openedMenu.mount.contains(event.target))openedMenu.setOpen(false)},true);+ if(openedMenu&&!openedMenu.mount.contains(event.target)&&!openedMenu.menu.contains(event.target))openedMenu.setOpen(false)},true);}export function closeAnchoredMenu(){if(openedMenu)openedMenu.setOpen(false)}/* 可用的视口上沿是固定顶栏的下缘。顶栏在每一页都盖着最上面那一条,菜单顶到 8px会被它压掉半截,而且看不出是被压住的——只是第一项凭空不见了。 */const viewportTop=()=>8+(parseFloat(getComputedStyle(document.documentElement).getPropertyValue('--topH'))||0);-export function wireAnchoredMenu(mount,toggle,menu){+export function wireAnchoredMenu(mount,toggle,menu,{side=false}={}){const position=()=>{const anchor=toggle.getBoundingClientRect(),width=menu.getBoundingClientRect().width;+ if(side&&innerWidth>=640){+ menu.style.maxHeight=Math.max(0,innerHeight-32)+'px';+ menu.style.left=Math.max(16,Math.min(anchor.right+8,innerWidth-width-16))+'px';+ menu.style.top=Math.max(16,Math.min(anchor.top,innerHeight-menu.offsetHeight-16))+'px';return;+ }const top=viewportTop(),under=innerHeight-8-anchor.bottom-8,over=anchor.top-8-top;/* 下方放不下就改到上方;两侧都放不下时取宽的那一侧,并把菜单压到那一侧的高度,内容在菜单内滚。不压高度的话它会横跨触发钮盖住自己,点开之后连改的是哪一个@@ -563,10 +568,10 @@ export function wireAnchoredMenu(mount,toggle,menu){window.removeEventListener('scroll',closeFromViewport,true);}toggle.setAttribute('aria-expanded',String(open));- openedMenu=open?{mount,setOpen}:(openedMenu&&openedMenu.mount===mount?null:openedMenu)};+ openedMenu=open?{mount,menu,setOpen}:(openedMenu&&openedMenu.mount===mount?null:openedMenu)};toggle.addEventListener('click',event=>{event.stopPropagation();setOpen(menu.hidden)});mount.addEventListener('keydown',event=>{- if(event.key==='Escape'&&!menu.hidden){setOpen(false);toggle.focus()}});+ if(event.key==='Escape'&&!menu.hidden){event.stopPropagation();setOpen(false);toggle.focus()}});return {setOpen,isOpen:()=>!menu.hidden};}