提交图

3 提交

作者 SHA1 备注 提交日期
779ffc3d55 fix(tauri): grant the window controls the permissions they call
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run
The minimize, maximize and close buttons did nothing. They were wired
correctly; the ACL rejected them. core:default resolves to
core🪟default, which grants only read-only queries — is-maximized
is in it, which is why the maximize icon tracked state correctly, but
minimize, toggle-maximize, close and start-dragging are not. Both
windows are decorations: false, so with close denied the main window
could not be closed at all except through the tray.

Add two capabilities rather than widening the shared one: the main
window gets the four controls it draws, and the pet window gets dragging
alone, since it is moved by dragging its body and must not be able to
close or resize itself.

Every one of these calls was a bare void expression, so the rejection
was swallowed and looked identical to an unwired button. Route them
through a helper that reports the failure in the shell error banner.

This is the second time a missing capability has surfaced as a silent
no-op — the pet window previously had no entry at all. Add tests that
read the shipped capability files and assert each permission the UI
calls is granted to the window that calls it.

Also translate the TypeError the Tauri shim throws outside the
application into a sentence a user can act on. The dev server is
reachable at 127.0.0.1:1420, so opening it in a browser and hitting save
produced "Cannot read properties of undefined (reading 'invoke')".

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-27 01:19:42 +08:00
e8d9dbc8f6 refactor(ui): share ipc error formatting
Tauri rejects `invoke` with the deserialized Rust error value, which for
`RuntimeCommandError { code, message }` is a plain object rather than an
`Error`. Nine call sites used `reason instanceof Error ? reason.message :
String(reason)`, so every send, reconnect, stop, and settings failure showed
the user `[object Object]`.

`ProfileManager` already had a correct implementation; this lifts it into
`src/lib/errorMessage.ts` and routes the other call sites through it. The
module also exports `isCancelledError`, which a later batch needs to tell a
deliberate stop apart from a real failure.

Refs P1-16 / F-08.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-26 22:31:16 +08:00
051b9ced6a fix(chat): restrict markdown link protocols
Assistant messages come from a remote AstrBot instance and are untrusted, but
the markdown renderer passed the href through verbatim, so `javascript:` and
`data:` URLs reached an anchor. Inside this webview, script execution has
access to the full Tauri IPC surface.

Links are now resolved with `new URL()` and only http/https/mailto survive;
anything else renders as the original plain text. Relative hrefs are rejected
too rather than being presented as absolute links against the placeholder base.
`rel` gains `noopener`.

The helper lives in `src/lib/` rather than beside the component because a
non-component export in a component module fails `react-refresh` under the
repository's `--max-warnings 0` lint gate.

Refs P1-15 / F-05.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-26 22:28:46 +08:00