Peach: Local-first video metadata scraper and media manager.
fix(ui): 配置表单统一保存主按钮
longmeidaob2392b9b9b09
diff --git a/docs/STATUS.md b/docs/STATUS.mdindex a03705e4c..3cb65075a 100644--- a/docs/STATUS.md+++ b/docs/STATUS.md@@ -21,7 +21,7 @@- 本机经正式域名访问时 `/healthz` 返回 `configurable=true`;配置读取、保存与选文件夹共用本机连接判据。托盘负责配置重载,正式 HTTPS 地址与端口保持托盘管理。- 首启和配置页按系统显示缺失依赖下载:CloudDrive、挂载驱动、FFmpeg/ffprobe、OpenSSL。Windows 已识别 CloudDrive 与 WinFsp;全量及桌面、手机预览通过,生产浏览器取证超时。- 首次设置提供可跳过的历史导入指南;数据管理首屏共用 Fieldset,网盘专属操作按来源显隐,界面使用「本地数据库」。影响域及深浅色、手机预览通过;未执行真实同步、清理或历史采集。-- 口令闸门在 Windows 已生效:不带口令的请求回 401(`/healthz` 除外),设备用 `peach token` 登录一次。+- 可选访问密码已实现,待集成重启:首启可留空,配置页可设置、修改或关闭;登录页选择设备会话期限。现有安装保留系统口令保护,内部 API 令牌独立。配置 Fieldset 使用 20px 正文间距、8px 标题说明间距,字段错误就地标红。- macOS 是 reader,代码与 `peach-data` 都在内置盘;`peach.local` 经 8900/8443 和 pf 提供 80/443,GET 正常、写入端点返回 409。- 两端各用本机 CA,私钥与凭据不跨机同步;代码走 Git、账本走单写者复制、图片产物走 Syncthing,三条链路互不兜底。本机坐标在 `<数据根>/config.toml`;ADR-0023 第 1~3 阶段已合入并在 Windows 生效。- Windows 真实 ledger 为 `peach-data/database/ledger.db`,已应用到 `0024`(外键 ON DELETE 与索引),0 待处理。diff --git a/frontend/src/islands/access-settings.tsx b/frontend/src/islands/access-settings.tsxindex 9e3634904..31e861761 100644--- a/frontend/src/islands/access-settings.tsx+++ b/frontend/src/islands/access-settings.tsx@@ -74,6 +74,6 @@ export function AccessSettings({ initial, receipt }: { initial: AccessState; rec{state.mode === 'password' || state.mode === 'legacy' ? <label class="configcheck"><span class="pcheck"><input type="checkbox" checked={disable} onChange={(event) => setDisable(event.currentTarget.checked)} /><span aria-hidden="true"><svg viewBox="0 0 24 24"><use href="#i-check" /></svg></span></span><span>关闭访问密码,允许能连接到 Peach 的设备直接访问</span></label> : null}{error ? <p class="configbad" role="alert">{error}</p> : null}</div>- {state.mode !== 'locked' ? <div class="geist-fieldset-footer"><p>保存后立即生效。</p><button class="geist-button" type="submit" ref={button}>{disable ? '关闭访问密码' : '保存访问密码'}</button></div> : null}+ {state.mode !== 'locked' ? <div class="geist-fieldset-footer"><p>保存后立即生效。</p><button class="geist-button primary" type="submit" ref={button}>保存配置</button></div> : null}</form>;}diff --git a/frontend/test/access-settings.test.tsx b/frontend/test/access-settings.test.tsxindex 8d4f7a718..0c3dd9e96 100644--- a/frontend/test/access-settings.test.tsx+++ b/frontend/test/access-settings.test.tsx@@ -12,6 +12,7 @@ it('系统口令可直接转为可选密码且关闭需要明确提交', async (vi.stubGlobal('fetch', fetcher);render(<AccessSettings initial={{ mode: 'legacy', revision: 'legacy' }} receipt={receipt} />, host);expect(host.querySelector('[autocomplete="current-password"]')).toBeNull();+ expect(host.querySelector('.geist-fieldset-footer .primary')?.textContent).toBe('保存配置');const toggle = host.querySelector<HTMLInputElement>('[type="checkbox"]')!;toggle.checked = true; toggle.dispatchEvent(new Event('change', { bubbles: true })); await settle();expect(host.querySelector('[autocomplete="new-password"]')).toBeNull();diff --git a/tests/test_access.py b/tests/test_access.pyindex 67fc1f884..e08b64ce2 100644--- a/tests/test_access.py+++ b/tests/test_access.py@@ -86,7 +86,7 @@ class AccessTests(unittest.IsolatedAsyncioTestCase):policy = access.save(self.path, "")body = {"revision": policy["revision"], "action": "set", "password": "correct-password", "confirmation": "correct-password"}self.assertEqual((await self.client.post("/api/configuration/access", json=body, headers={"Origin": "https://evil.example"})).status_code, 403)- async with httpx.AsyncClient(transport=httpx.ASGITransport(app=self.app, client=("192.168.1.2", 1)), base_url="http://localhost") as remote:+ async with httpx.AsyncClient(transport=httpx.ASGITransport(app=self.app, client=("192.0.2.2", 1)), base_url="http://localhost") as remote:self.assertEqual((await remote.post("/api/configuration/access", json=body)).status_code, 403)body["revision"] = "stale"self.assertEqual((await self.client.post("/api/configuration/access", json=body)).status_code, 409)diff --git a/web/dist/peach-ui.js b/web/dist/peach-ui.jsindex a9afd2ac3..ae5aec5df 100644--- a/web/dist/peach-ui.js+++ b/web/dist/peach-ui.js@@ -587,10 +587,10 @@ function qe({ initial: e, receipt: t }) {}), r.mode === "locked" ? null : /* @__PURE__ */ W("div", {class: "geist-fieldset-footer",children: [/* @__PURE__ */ W("p", { children: "保存后立即生效。" }), /* @__PURE__ */ W("button", {- class: "geist-button",+ class: "geist-button primary",type: "submit",ref: b,- children: f ? "关闭访问密码" : "保存访问密码"+ children: "保存配置"})]})]});