AstrBot-Desktop/src-tauri/tauri.conf.json

60 行
1.6 KiB
JSON

{
"$schema": "https://schema.tauri.app/config/2",
"productName": "AstrBot Desktop",
"version": "0.1.0-alpha.2",
"identifier": "com.yokiirobw.astrbot-desktop",
"build": {
"beforeDevCommand": "npm run dev",
"devUrl": "http://127.0.0.1:1420",
"beforeBuildCommand": "npm run build",
"frontendDist": "../dist"
},
"app": {
"windows": [
{
"label": "main",
"title": "AstrBot Desktop",
"width": 1100,
"height": 760,
"minWidth": 720,
"minHeight": 520,
"center": true,
"resizable": true,
"decorations": false,
"shadow": false
},
{
"label": "desktop-pet",
"title": "AstrBot Pet",
fix(pet): read stored preferences and stop the pet from stealing focus An audit of the destroy→hide change across four lenses raised 17 findings; 14 survived adversarial verification. Two of them were regressions that change introduced, and both had the same shape: code that only worked because the pet window used to not exist. show_pet_context_menu picked the pet window and fell back to main. While the pet rendered inside the app its window had been destroyed at startup, so the fallback happened to select the visible main window. Now that the window merely hides, the menu was being anchored to a hidden HWND, which Win32 cannot bring to the foreground. The visibility test is explicit now rather than incidental. DesktopPetView read the connection state in a mount effect and nothing emitted connection events, so destroy-and-rebuild was what re-read it. Without a remount the floating pet showed whatever was true at startup for the rest of the session. reveal_pet_window now emits pet-window-revealed and the view re-reads on it. The rest were already there. Every pet setting was decorative: the preferences were applied and then dropped, so reveal_pet_window had to invent an answer and hard-coded the first monitor, the safe edge and always-on-top — reverting the user's choices on every show. The pet view re-sent a fully hard-coded payload whenever game mode toggled, and the settings page initialised its controls from literals, so returning to the page and changing one thing pushed three stale defaults back onto the window. There is a session-scoped store now, a command to read it, and both frontends read before they write. Persisting it across restarts is F-75. Always-on-top is off by default, which is what the Q6 acceptance criterion asked for (F-35), and the window no longer takes focus when shown — it was activating on show and swallowing keystrokes meant for the main window. focusable is left alone on purpose: clearing it adds WS_EX_NOACTIVATE, which would re-break the context menu now anchored to that window. That is F-79. The pet also painted a solid dark rectangle before its assets arrived. The transparency rule is gated on a class that an effect inside the 5.2 MB lazy chunk added, so until that chunk ran the app's opaque background won. This is why the earlier hunt for "the rule that beats !important" found nothing: the class was not applied yet, so specificity was never the question. The pet now has its own entry document carrying the class statically. An inline script would not do — tauri-utils only nonces script[src^='http'], so it would pass in dev and be blocked by script-src 'self' in a release build. Rust tests 92 → 97, frontend 30 → 35. All 11 mutations of the new assertions were confirmed to fail. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-27 05:25:27 +08:00
"url": "pet.html",
"width": 180,
"height": 220,
"resizable": false,
"decorations": false,
"shadow": false,
"transparent": true,
fix(pet): read stored preferences and stop the pet from stealing focus An audit of the destroy→hide change across four lenses raised 17 findings; 14 survived adversarial verification. Two of them were regressions that change introduced, and both had the same shape: code that only worked because the pet window used to not exist. show_pet_context_menu picked the pet window and fell back to main. While the pet rendered inside the app its window had been destroyed at startup, so the fallback happened to select the visible main window. Now that the window merely hides, the menu was being anchored to a hidden HWND, which Win32 cannot bring to the foreground. The visibility test is explicit now rather than incidental. DesktopPetView read the connection state in a mount effect and nothing emitted connection events, so destroy-and-rebuild was what re-read it. Without a remount the floating pet showed whatever was true at startup for the rest of the session. reveal_pet_window now emits pet-window-revealed and the view re-reads on it. The rest were already there. Every pet setting was decorative: the preferences were applied and then dropped, so reveal_pet_window had to invent an answer and hard-coded the first monitor, the safe edge and always-on-top — reverting the user's choices on every show. The pet view re-sent a fully hard-coded payload whenever game mode toggled, and the settings page initialised its controls from literals, so returning to the page and changing one thing pushed three stale defaults back onto the window. There is a session-scoped store now, a command to read it, and both frontends read before they write. Persisting it across restarts is F-75. Always-on-top is off by default, which is what the Q6 acceptance criterion asked for (F-35), and the window no longer takes focus when shown — it was activating on show and swallowing keystrokes meant for the main window. focusable is left alone on purpose: clearing it adds WS_EX_NOACTIVATE, which would re-break the context menu now anchored to that window. That is F-79. The pet also painted a solid dark rectangle before its assets arrived. The transparency rule is gated on a class that an effect inside the 5.2 MB lazy chunk added, so until that chunk ran the app's opaque background won. This is why the earlier hunt for "the rule that beats !important" found nothing: the class was not applied yet, so specificity was never the question. The pet now has its own entry document carrying the class statically. An inline script would not do — tauri-utils only nonces script[src^='http'], so it would pass in dev and be blocked by script-src 'self' in a release build. Rust tests 92 → 97, frontend 30 → 35. All 11 mutations of the new assertions were confirmed to fail. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-27 05:25:27 +08:00
"alwaysOnTop": false,
"focus": false,
"skipTaskbar": true,
"visible": false,
"x": 120,
"y": 120,
"create": true
}
],
"security": {
feat(chat): carry voice and other non-image attachments end to end F-33. A voice reply produced nothing at all: no marker, no event, no error. Four independent gates each dropped it, and fixing any one alone would have changed nothing observable. The mapper reached `map_media` for image, record, file and video alike, but its only emitting branch was gated on the frame being an image, and the `attachment_saved` fallback rejected every other type outright. Both now carry whatever type arrived, with the frame type as the marker's alt text so the renderer knows what to expect before any bytes exist. `pending_media` was also a single slot, so a second attachment in one reply overwrote the first before it was paired; it is a bounded queue now, and an `attachment_saved` with no id no longer consumes the media frame still waiting for one. The download judged a candidate path successful only if the bytes sniffed as an image — this server answers unknown paths with its own text under HTTP 200, so sniffing is load-bearing and cannot simply be dropped. Audio and video signatures are recognised now, and a declared Content-Type is trusted when it names media rather than only images. SILK is included deliberately: it is what AstrBot relays for QQ and WeChat voice, no browser decodes it, and recognising it is what lets the UI say so instead of rendering a player whose play button does nothing. The CSP had no `media-src`, so it fell back to `default-src 'self'` and an `<audio src="blob:">` was refused — in release builds only, since the dev server serves no CSP at all. That is the same divergence as F-04 and the inline-script trap in pet.html, so the policy now has a test of its own that pins each directive the app depends on, including that script-src still refuses inline. The renderer chose `<img>` unconditionally. The element now follows the media type of the bytes that actually arrived, falling back to the marker's declared kind for the placeholder and the failure message. `map_media` also kept a private copy of the message-id handling that included the reopen-suffix overwrite fixed earlier in `adopt_message_id`; it shares the one implementation now. Protocol tests 22 -> 26, Rust client 99 -> 101, frontend 35 -> 43. All six mutations of the new assertions were confirmed to fail. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-27 06:16:55 +08:00
"csp": "default-src \u0027self\u0027; connect-src ipc: http://ipc.localhost http://127.0.0.1:*; img-src \u0027self\u0027 asset: http://asset.localhost data: blob:; media-src \u0027self\u0027 asset: http://asset.localhost data: blob:; style-src \u0027self\u0027 \u0027unsafe-inline\u0027; script-src \u0027self\u0027"
}
},
"bundle": {
"active": true,
"targets": ["nsis"],
"icon": [
"icons/32x32.png",
"icons/128x128.png",
"icons/128x128@2x.png",
"icons/icon.ico"
]
}
}