Peach: Local-first video metadata scraper and media manager.
fix: 用信息提示条展示可用更新
longmeidaob9043e678cf8
diff --git a/docs/reference-snapshots/geist-settings.md b/docs/reference-snapshots/geist-settings.mdindex 18993b233..73ee81700 100644--- a/docs/reference-snapshots/geist-settings.md+++ b/docs/reference-snapshots/geist-settings.md@@ -47,6 +47,8 @@## 管理页面间距审查+更新可用提示复用中性 Note、信息图标与“有可用更新”标签;普通更新不是错误或有风险的后果。2026-09-06 复核 `https://vercel.com/geist/note` 的 Best Practices:Note 用于局部持续信息,secondary 用于中性信息;Status Dot 文档限定部署状态。Note HTML 版本沿用本页登记的 `f3471155…`。检查为最新后恢复普通状态文字,更新按钮仍放在原操作栏,不重复增加 CTA。+站内文字链接参考本页 Fieldset 的 `View documentation` 示例:`text-[var(--geist-link-color)]`、`hover:underline`、`focus-visible:outline-2` 与 `outline-offset-4`。Peach 使用主题链接色、悬停下划线及 2px 焦点轮廓,访问后颜色保持一致;“配置 Peach 代理”跳转 `/configuration#peachProxy`,不附外链箭头。独立 `/geist/link` 页面未取得,证据来自官方 Fieldset 示例及本页已登记 HTML。2026-09-06 再次通过 HTTPX 获取官方 Fieldset、Input、Description、Note 的 HTML/CSS。Fieldset 与共同 CSS 的 SHA-256 与本页首表一致;Input 为 `df3a8b7ba933798842915d06056ef079878faa091af6b8d67e61d69cc0a08962`,Description 为 `7a16d502b3fdba316ef740057b275d2acdeb85f79d4944201331af906d9b497f`。浏览器参考页返回 `js execution timed out`,实时参考布局未取得。diff --git a/frontend/src/islands/release-updates.tsx b/frontend/src/islands/release-updates.tsxindex 0a690ba78..127ea933c 100644--- a/frontend/src/islands/release-updates.tsx+++ b/frontend/src/islands/release-updates.tsx@@ -1,5 +1,5 @@import { useEffect, useRef, useState } from 'preact/hooks';-import { fieldsetTitle, setActionBusy, progressHtml, confirmModal } from '@peach/legacy/ui';+import { fieldsetTitle, setActionBusy, progressHtml, confirmModal, noteHtml } from '@peach/legacy/ui';import { apiGet, apiSend, errorMessage } from '../api';export interface ReleaseState {@@ -91,9 +91,9 @@ export function ReleaseUpdates({ initial, initialJob }: { initial: ReleaseState;<dt>更新通道</dt><dd>{data.channel}</dd><dt>最新版本</dt><dd>{data.latest_version || (data.state === 'unchecked' ? '尚未检查' : '未取得')}</dd></dl>- <p class={error || data.state === 'error' ? 'configbad' : 'confighelp'} role={error || data.state === 'error' ? 'alert' : 'status'}>+ {data.state === 'available' && !error ? <div role="status" dangerouslySetInnerHTML={{__html:noteHtml(data.message,{label:'有可用更新'})}} /> : <p class={error || data.state === 'error' ? 'configbad' : 'confighelp'} role={error || data.state === 'error' ? 'alert' : 'status'}>{error || data.message}- </p>+ </p>}{job.state !== 'idle' ? <div aria-live="polite"><p class={job.state === 'error' ? 'configbad' : 'confighelp'}>{job.message}</p>{job.state !== 'error' ? <>diff --git a/frontend/test/release-updates.test.tsx b/frontend/test/release-updates.test.tsxnew file mode 100644index 000000000..d4aae37d7--- /dev/null+++ b/frontend/test/release-updates.test.tsx@@ -0,0 +1,22 @@+import { render } from 'preact';+import { afterEach, expect, it, vi } from 'vitest';+import { ReleaseUpdates } from '../src/islands/release-updates';++// @ts-expect-error 遗留组件使用正式实现验证图标与提示语义。+vi.mock('@peach/legacy/ui', () => import('../../web/js/ui-components.js'));+const host = document.createElement('div');+afterEach(() => { render(null, host); host.remove(); });+const initial = { current_version:'0.22.2',latest_version:'0.22.3',channel:'测试版',installation:'独立测试包',state:'available',message:'发现新测试版 0.22.3。',release_url:'https://example.com/releases' };++it('可用更新用持续信息提示且检查为最新后移除提示', () => {+ document.body.append(host);+ render(<ReleaseUpdates initial={initial} />, host);+ expect(host.querySelector('[role="status"] .geist-note-secondary')?.textContent).toContain('有可用更新');+ expect(host.querySelector('.geist-note svg')).not.toBeNull();+ expect(host.querySelector('.geist-note-warning,.geist-note-error')).toBeNull();+ expect(host.textContent).toContain('下载并安装');+ render(null, host);+ render(<ReleaseUpdates initial={{...initial,state:'current',message:'已是最新测试版。'}} />, host);+ expect(host.querySelector('.geist-note')).toBeNull();+ expect(host.textContent).not.toContain('下载并安装');+});diff --git a/web/dist/peach-ui.js b/web/dist/peach-ui.jsindex 1ffcf7751..f310d50ef 100644--- a/web/dist/peach-ui.js+++ b/web/dist/peach-ui.js@@ -619,40 +619,40 @@ var rt = /* @__PURE__ */ new Set(["installing"]);function it({ initial: e, initialJob: t }) {- let [n, i] = B(e), [o, s] = B(t || {+ let [n, i] = B(e), [o, l] = B(t || {state: "idle",progress: 0- }), [l, u] = B(""), f = U(null), p = U(!0), m = U(!1), h = U(null);+ }), [u, f] = B(""), p = U(null), m = U(!0), h = U(!1), g = U(null);V(() => {- d(h.current, rt.has(o.state));+ d(g.current, rt.has(o.state));}, [o.state]), V(() => () => {- p.current = !1, f.current?.abort();+ m.current = !1, p.current?.abort();}, []);- let g = async () => {+ let _ = async () => {let e = await I("/api/configuration/update-restart", {});- p.current && s(e);+ m.current && l(e);};V(() => {- o.state !== "ready" || m.current || (m.current = !0, r({+ o.state !== "ready" || h.current || (h.current = !0, r({title: "更新已准备好",body: `Peach ${o.version || ""} 将在重启后安装。`,confirmLabel: "立即重启",cancelLabel: "稍后",- onConfirm: g+ onConfirm: _}));}, [o.state]), V(() => {if (!rt.has(o.state)) return;let e = new AbortController(), t, n = 0, r = async () => {try {let t = await F("/api/configuration/update-status", e.signal);- e.signal.aborted || (s(t), n = 0, t.state === "complete" && i((e) => ({+ e.signal.aborted || (l(t), n = 0, t.state === "complete" && i((e) => ({...e,current_version: t.version || e.current_version,state: "current",message: "已是最新测试版。"})));} catch {- ++n >= 120 && !e.signal.aborted && u("尚未连接到 Peach,请检查托盘后刷新页面。");+ ++n >= 120 && !e.signal.aborted && f("尚未连接到 Peach,请检查托盘后刷新页面。");}!e.signal.aborted && n < 120 && (t = setTimeout(r, 1e3));};@@ -660,22 +660,22 @@ function it({ initial: e, initialJob: t }) {e.abort(), clearTimeout(t);};}, [o.state]);- let _ = async (e) => {- if (f.current || rt.has(o.state)) return;+ let v = async (e) => {+ if (p.current || rt.has(o.state)) return;let t = new AbortController();- f.current = t, m.current = !1, u(""), d(e, !0);+ p.current = t, h.current = !1, f(""), d(e, !0);try {let e = await I("/api/configuration/update", {}, "POST", t.signal);- t.signal.aborted || s(e);+ t.signal.aborted || l(e);} catch (e) {- t.signal.aborted || u(P(e));+ t.signal.aborted || f(P(e));} finally {- f.current = null, d(e, !1);+ p.current = null, d(e, !1);}- }, v = async (t) => {- if (f.current) return;+ }, y = async (t) => {+ if (p.current) return;let n = new AbortController();- f.current = n, d(t, !0), u("");+ p.current = n, d(t, !0), f("");try {let e = await F("/api/configuration/updates", n.signal);n.signal.aborted || i(e);@@ -683,9 +683,9 @@ function it({ initial: e, initialJob: t }) {n.signal.aborted || (i({...e,state: "error"- }), u(P(t)));+ }), f(P(t)));} finally {- f.current = null, d(t, !1);+ p.current = null, d(t, !1);}};return /* @__PURE__ */ W("section", {@@ -709,10 +709,13 @@ function it({ initial: e, initialJob: t }) {/* @__PURE__ */ W("dd", { children: n.latest_version || (n.state === "unchecked" ? "尚未检查" : "未取得") })]}),- /* @__PURE__ */ W("p", {- class: l || n.state === "error" ? "configbad" : "confighelp",- role: l || n.state === "error" ? "alert" : "status",- children: l || n.message+ n.state === "available" && !u ? /* @__PURE__ */ W("div", {+ role: "status",+ dangerouslySetInnerHTML: { __html: s(n.message, { label: "有可用更新" }) }+ }) : /* @__PURE__ */ W("p", {+ class: u || n.state === "error" ? "configbad" : "confighelp",+ role: u || n.state === "error" ? "alert" : "status",+ children: u || n.message}),o.state === "idle" ? null : /* @__PURE__ */ W("div", {"aria-live": "polite",@@ -745,23 +748,23 @@ function it({ initial: e, initialJob: t }) {body: `Peach ${o.version || ""} 将在重启后安装。`,confirmLabel: "立即重启",cancelLabel: "稍后",- onConfirm: g+ onConfirm: _});},children: "重启安装"}) : null,n.state === "available" && n.installation === "独立测试包" && o.state !== "ready" ? /* @__PURE__ */ W("button", {- ref: h,+ ref: g,type: "button",class: "geist-button primary",- onClick: (e) => _(e.currentTarget),+ onClick: (e) => v(e.currentTarget),children: "下载并安装"}) : null,/* @__PURE__ */ W("button", {type: "button",class: "geist-button",disabled: rt.has(o.state),- onClick: (e) => v(e.currentTarget),+ onClick: (e) => y(e.currentTarget),children: "检查更新"})]