From d08c9817cced25af5896a5d8dd5f3770286e718f Mon Sep 17 00:00:00 2001 From: YokiiroBW Date: Mon, 27 Jul 2026 06:39:51 +0800 Subject: [PATCH] docs: record tonight's voice and awareness work, and what it did not finish MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds docs/reports/voice-and-awareness-2026-07-27.md alongside ADR-0008, assigns F-80 to F-83 for what is genuinely blocked, marks F-33 and F-70 implemented, and appends the session to progress.md and the changelog. Recorded rather than smoothed over: two pushes tonight carried a failing gate, because I read test results out of a grep instead of an exit code; the first attempt at the segmented-reply fix was wrong in a way my own diagnostic fixtures already documented; and the earlier reading of the architecture's screenshot exclusion as product-level was a mis-read that would have cancelled the feature. Also states plainly that game companionship does not work yet and why — PrintWindow over GDI cannot capture a hardware-accelerated surface — and that cargo test --workspace and tauri:build were not run at all, because the dev process holds the executable. Co-Authored-By: Claude Opus 5 --- CHANGELOG.md | 20 ++ docs/progress.md | 32 ++- docs/reports/fix-queue-2026-07-26.md | 46 ++-- .../reports/voice-and-awareness-2026-07-27.md | 219 ++++++++++++++++++ 4 files changed, 297 insertions(+), 20 deletions(-) create mode 100644 docs/reports/voice-and-awareness-2026-07-27.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b90a05..e7edb65 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,6 +47,16 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and - Synchronized the 13-item roadmap status with the actual P02 implementation state. - Documented external prerequisites for HTTPS certificate pinning, signed updates, and dual-server soak testing. +- Voice input records the microphone and sends the audio for AstrBot to transcribe. The previous + implementation called the browser speech API, which WebView2 does not provide, so it could never + have worked. Refused permission, a missing microphone, and a microphone held by another program are + now reported as three different things. +- Voice, file, and video attachments in a reply are now carried through and played or shown, instead + of being dropped without a marker, an event, or an error. A SILK-encoded voice message says that no + browser can play it rather than showing a player that does nothing. +- The companion can be shown one window the user authorizes: its text or its picture. Authorization is + per window, rate limited, revocable, and off until switched on; a banner shows while it is live. + ### Fixed - Message action buttons render as borderless icons again. Their labels were being laid out inside @@ -71,6 +81,16 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and and the pet settings page now reflects what the window is actually doing rather than a fixed set of defaults. They are not yet remembered across restarts. - The desktop pet's animation now follows the connection again after the first time it is shown. +- Attachments now reach AstrBot. They were sent under a top-level `attachments` key that the server's + chat request does not declare, and unknown keys are ignored rather than rejected, so every + attachment was discarded in silence while the send reported success. They travel inside `message` as + segments now. +- A reply that arrives in several blocks keeps every block. The blocks were appended into one message + and then replaced wholesale by the final frame, so only whichever block that frame restated was + ever shown. A block that merely restates text already streamed is no longer shown twice. +- Streaming replies no longer break into one message per fragment when the server sends no message id + on the opening frames. +- An attachment download is now bounded while it runs rather than measured after being read in full. - The pet's context menu is anchored to a visible window again. - One unreachable connection no longer freezes the whole application. The reachability probe now runs outside the runtime lock, so a slot that is connecting cannot block status, sending, diff --git a/docs/progress.md b/docs/progress.md index 475626d..44298de 100644 --- a/docs/progress.md +++ b/docs/progress.md @@ -308,6 +308,7 @@ Still not claimed complete: automatic startup activation, real Tauri multi-windo - Added responsive runtime metadata and chat layout refinements; preserved the existing pet event bus for Q13 state synchronization. - Updated frontend test mocks for runtime status schema changes. - Validation: Vitest (6), TypeScript, ESLint, and targeted Prettier checks pass. + ## 2026-07-21: frontend UI audit and chat-page visual increment - Completed the Impeccable audit and recorded the P0-P3 findings in `docs/reports/ui-audit-2026-07-21.md`. @@ -346,7 +347,6 @@ Still not claimed complete: automatic startup activation, real Tauri multi-windo - Validation: targeted Prettier, ESLint, TypeScript, Vitest 6/6, Vite production build, Playwright 5/5, Rust fmt, Clippy with warnings denied, Rust workspace tests (67), and Rust workspace check all passed. - Known non-blocking warnings: Node is `24.14.0` while the package requires `>=24.17.0`; Vite reports the intentional lazy `DesktopPetView` chunk above 500 kB. - ## 2026-07-21: roadmap completion audit Roadmap audit and acceptance updates are included in commit f61f440. @@ -378,7 +378,6 @@ Current branch: feat/p02-dual-connections. Run the full stage gate, refresh the local acceptance checklist, then create the P02 pull request. Do not claim certificate pinning, signed updates, or dual-server soak until the external prerequisites are supplied. - ## 2026-07-21: full local stage gate - Frontend lint, TypeScript, Vitest (9 tests), Vite production build: passed. @@ -573,7 +572,7 @@ Current stage: P02 dual connections, branch `feat/p02-dual-connections`. Six com - **F-19** One profile can no longer occupy both runtime slots. Enforced inside `activate_slot` (which also covers startup auto-connect), cross-checked against `connection_slots` in the command, and the operations switch guard now covers probe and disconnect. Both rules are - negative — they ask only whether the profile is bound to the *other* slot — because auto-connect + negative — they ask only whether the profile is bound to the _other_ slot — because auto-connect activates from `auto_connect_slot` and never writes `connection_slots`. - **F-18** Sends are validated before anything is written to history, via a new read-only `ensure_slot_can_send`. A failure that the server never received marks the row rather than @@ -698,3 +697,30 @@ Rust 112 passed / 2 ignored. Frontend 29 passed / 6 files. Playwright 5 passed. Verified in a browser against the real stylesheet rather than by inspection: four visible fields plus a collapsed advanced section, the insecure checkbox appearing only for `http://` and carrying `required`, and the display name resolving to identity@host. + +## 2026-07-27 夜 · 语音、窗口读取与游戏陪伴 + +完整记录见 [voice-and-awareness-2026-07-27.md](./reports/voice-and-awareness-2026-07-27.md), +边界与策略见 [ADR-0008](./decisions/ADR-0008-screen-awareness-and-voice-boundary.md)。 + +按队列顺序推进:A 段清掉卡住这三个功能的前期修复(分段回复丢内容、非图片媒体帧、出站附件契约、 +下载体积守卫),B 段实施功能本体(策略模块、窗口读取命令、送往陪伴槽位、语音录制)。七个提交, +每个都在门槛全绿后才推送。 + +**已可用**:语音录制与发送(服务端 STT 待用户配置 provider)、语音/文件/视频回复的接收与播放、 +单窗口授权读取与把文本或画面发给陪伴槽位、常驻的读屏指示器与终止开关。 + +**已修的沉默缺陷**:附件从未真正送达 AstrBot(放在服务端不读的键里);分段回复只显示其中一段; +CSP 缺 `media-src` 会让语音在发布版无法播放而 dev 无感。 + +**未完成**:游戏陪伴受阻于 `capture.rs` 用 GDI `PrintWindow`,捕获不到硬件加速的游戏画面(F-80, +需改 `Windows.Graphics.Capture`);WebView2 麦克风权限行为需真机确认(F-81);STT provider 属用户 +决策(F-82);只能授权前台窗口,无窗口选择器(F-83)。 + +### 测试状态 + +Rust 139 通过(`astrbot-desktop` 113、`desktop-protocol` 26),前端 59 通过 / 11 文件, +Playwright 5 通过,`npm run build` 通过。25 处刻意回归全部被对应测试抓到。 + +`cargo test --workspace`(含集成测试)与 `npm run tauri:build` **未执行**——`astrbot-desktop.exe` +被运行中的 dev 进程占用。遵守工作流「不得声称未执行的检查已通过」,这两项记为待补。 diff --git a/docs/reports/fix-queue-2026-07-26.md b/docs/reports/fix-queue-2026-07-26.md index a2fe979..1fbec98 100644 --- a/docs/reports/fix-queue-2026-07-26.md +++ b/docs/reports/fix-queue-2026-07-26.md @@ -1,7 +1,7 @@ # AstrBot Desktop 修复队列 -基于 2026-07-26 全源码审计 · 共 78 项 · 8 个批次 -(原 73 项 + 2026-07-27 桌宠窗口审计补编 F-75 – F-79) +基于 2026-07-26 全源码审计 · 共 82 项 · 8 个批次 +(原 73 项 + 2026-07-27 桌宠窗口审计补编 F-75 – F-79 + 语音/屏幕读取补编 F-80 – F-83) > 配套审计档案:[full-source-audit-2026-07-26.md](./full-source-audit-2026-07-26.md)。 > 本文中的 `P0-1` / `P1-7` 等编号均指向该档案中的对应发现。 @@ -319,6 +319,18 @@ N-12、N-13 是 `4f73c08` **自身引入的回归**——把窗口从销毁改 **本批未修、已编号**:F-75 – F-79,见下。 +### F-80 – F-83 语音与屏幕读取补编(2026-07-27 夜) + +来自语音/窗口读取实施过程中确认的四项。前三项**不是缺陷队列意义上的缺陷**,而是实施后暴露的真实 +阻塞,按队列惯例统一编号以便追踪。 + +| 新编号 | 位置与实质 | 性质 | 验收 | +| -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | +| **F-80** | `windows/capture.rs` 用 GDI 的 `PrintWindow`。它捕获不到硬件加速的游戏画面——DirectX/Vulkan 的后台缓冲不经过 GDI,结果是黑图或陈旧内容 | 真实技术墙。**故意未绕过**:给模型送黑图比报错更糟 | 改用 `Windows.Graphics.Capture` 后,全屏游戏窗口的截帧内容与屏幕一致 | +| **F-81** | WebView2 的麦克风访问触发 `PermissionRequested`,由宿主应用处理;wry 只在 `clipboard: true` 时注册处理器,Tauri 该项默认 false,本应用未开启。因此结果由 WebView2 默认行为决定,无法在不出真机构建的情况下确认 | 未知,需真机 | 装包后按「语音输入」,记录是弹窗/自动允许/自动拒绝;若为自动拒绝,需在 wry 层注册处理器 | +| **F-82** | 服务端 STT 需要用户配置 provider(API key 或自托管模型)。AstrBot 的 STT 在 `PreProcessStage`、TTS 在 `ResultDecorateStage`,均由默认为 `False` 的配置开关控制 | **用户决策**,不得代为选择——这是唯一会把用户语音送往外部的环节。TTS 可用 Edge TTS 零密钥开启 | 用户配好 provider 后,一段录音能回文本 | +| **F-83** | 只能授权**前台**窗口:`windows/` 下没有非前台窗口枚举,因此无法做「窗口选择器」。现以「给你几秒切到目标窗口」代替,并拒绝抓到本进程窗口 | 缺失能力 | 出现可选列表,且列表不泄漏未授权窗口的内容(只列标题与进程) | + ## 功能空缺盘点(2026-07-27) 用户询问语音聊天、窗口感知、游戏陪伴是否已有。三项**均在既定产品范围内** @@ -373,21 +385,21 @@ N-12、N-13 是 `4f73c08` **自身引入的回归**——把窗口从销毁改 ## R5 · 协议健壮与契约治理批 -| ID | 来源 | 位置 | 动作 | 验证 | -| -------- | ----- | -------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | -| **F-26** | P1-5 | `gateway_client.rs:179-184,282-284` | `UnsupportedEventType` / `InvalidPayload` 降级为事件级跳过(记日志、推进 `last_event_id`),仅版本/身份不匹配保持终态 | 单测:mock 推未知事件类型 → 槽位保持 Connected,后续事件正常 | -| **F-27** | P2-15 | `envelope.rs:171` 及各 payload | 信封与只读 payload 移除 `deny_unknown_fields`(`ToolProposal`/`ToolResult` **保留**);或解析失败跳过并推进游标 | 单测:信封带附加字段仍能解析;不再出现重放死循环 | -| **F-28** | P1-8 | `docs/protocol/v1/schemas/`;`tests/protocol_contract.rs` | 重跑 `export_schemas --write`;新增测试比对 `generated_schemas()` 与磁盘文件 | `cargo test` 即可发现漂移;`connection-profile.schema.json` 含 `remoteDisplayName` | -| **F-29** | P2-16 | `astrbot.rs:17-43`;`src/features/chat/types.ts:13`;`ChatPanel.tsx:240`;README | `TransportKind` 加 `#[serde(rename = "astrbot-openapi")]` 统一两套拼写,前端 enum 与文档同步(**跨端原子改动,一次落地**;DB 值不变,无迁移) | 全库 grep 无 `astr-bot-open-api` 残留 | -| **F-30** | P2-5 | `astrbot_client.rs:128-133,431-438` | 删除恒 false 的身份自比较,或改为探测可观测特征后再比对;文档明示 AstrBot 身份为 URL 派生 | 代码无死分支;`docs/decisions/` 记录该限制 | -| **F-31** | P2-19 | `mock-gateway/src/routes.rs:196-206`、`state.rs:161-173`、`config.rs:29-31` | `Lagged` 改 `break`(迫使走重连重放);cursor 未命中先发 gap 事件;`server_instance_id` 掺端口 | soak 增加 sequence 单调无缺口断言 | -| **F-32** | P2-17 | `astrbot.rs:381-444` | complete 后记录 per-message 完成标记,同 id 的后续 plain/complete 需显式重新开窗或忽略 | 单测覆盖"重复 complete"与"complete 后迟到 plain" | -| **F-33** | P2-18 | `astrbot.rs:336-353` | 非图片媒体输出通用占位标记;`pending_media` 改 FIFO 队列 | 单测:`record` + `attachment_saved` 产出可见标记;双图交错不丢 | -| **F-34** | P2-13 | `commands.rs:341`;`ChatPanel.tsx:916-917` | mapper 为无 `message_id` 的流合成稳定流内 id(如 `synthetic-{stream}`),前后端同步取消 event_id 回退 | 单测:省略 message_id 的多帧流合并为一条消息 | -| **F-70** | P2-6 | `astrbot_client.rs:383-388` | `download_attachment` 先查 `Content-Length`,改流式累读并在超过 16MiB 时立即中断,不再整体读入内存后才校验 | 单测:mock 返回超限 body,客户端在读满前返回超限错误且内存占用有界 | -| **F-71** | P2-7 | `gateway_client.rs:121-126` | `health()` 与 SSE 一致附带 bearer | 单测:mock 对无 bearer 的 health 返回 401,激活仍成功即失败 | -| **F-72** | P2-8 | `gateway_client.rs:237-238` | 仅在「连接存活超阈值且收到过事件」时重置退避,避免服务端接受即优雅关流时进入约 10 次/秒热重连 | 单测:mock 接受连接后立即关闭,断言重连间隔单调增长 | -| **F-73** | P2-29 | `astrbot_client.rs:554-565` | JWT `exp` 判定改 `exp <= now + 30s`;不可解析的 token 打 debug 日志 | 单测:`exp` 落在 30 秒内的 token 被判为过期 | +| ID | 来源 | 位置 | 动作 | 验证 | +| --------------------------- | ----- | -------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| **F-26** | P1-5 | `gateway_client.rs:179-184,282-284` | `UnsupportedEventType` / `InvalidPayload` 降级为事件级跳过(记日志、推进 `last_event_id`),仅版本/身份不匹配保持终态 | 单测:mock 推未知事件类型 → 槽位保持 Connected,后续事件正常 | +| **F-27** | P2-15 | `envelope.rs:171` 及各 payload | 信封与只读 payload 移除 `deny_unknown_fields`(`ToolProposal`/`ToolResult` **保留**);或解析失败跳过并推进游标 | 单测:信封带附加字段仍能解析;不再出现重放死循环 | +| **F-28** | P1-8 | `docs/protocol/v1/schemas/`;`tests/protocol_contract.rs` | 重跑 `export_schemas --write`;新增测试比对 `generated_schemas()` 与磁盘文件 | `cargo test` 即可发现漂移;`connection-profile.schema.json` 含 `remoteDisplayName` | +| **F-29** | P2-16 | `astrbot.rs:17-43`;`src/features/chat/types.ts:13`;`ChatPanel.tsx:240`;README | `TransportKind` 加 `#[serde(rename = "astrbot-openapi")]` 统一两套拼写,前端 enum 与文档同步(**跨端原子改动,一次落地**;DB 值不变,无迁移) | 全库 grep 无 `astr-bot-open-api` 残留 | +| **F-30** | P2-5 | `astrbot_client.rs:128-133,431-438` | 删除恒 false 的身份自比较,或改为探测可观测特征后再比对;文档明示 AstrBot 身份为 URL 派生 | 代码无死分支;`docs/decisions/` 记录该限制 | +| **F-31** | P2-19 | `mock-gateway/src/routes.rs:196-206`、`state.rs:161-173`、`config.rs:29-31` | `Lagged` 改 `break`(迫使走重连重放);cursor 未命中先发 gap 事件;`server_instance_id` 掺端口 | soak 增加 sequence 单调无缺口断言 | +| **F-32** | P2-17 | `astrbot.rs:381-444` | complete 后记录 per-message 完成标记,同 id 的后续 plain/complete 需显式重新开窗或忽略 | 单测覆盖"重复 complete"与"complete 后迟到 plain" | +| **F-33**(已修 2026-07-27) | P2-18 | `astrbot.rs:336-353` | 非图片媒体输出通用占位标记;`pending_media` 改 FIFO 队列 | 单测:`record` + `attachment_saved` 产出可见标记;双图交错不丢 | +| **F-34** | P2-13 | `commands.rs:341`;`ChatPanel.tsx:916-917` | mapper 为无 `message_id` 的流合成稳定流内 id(如 `synthetic-{stream}`),前后端同步取消 event_id 回退 | 单测:省略 message_id 的多帧流合并为一条消息 | +| **F-70**(已修 2026-07-27) | P2-6 | `astrbot_client.rs:383-388` | `download_attachment` 先查 `Content-Length`,改流式累读并在超过 16MiB 时立即中断,不再整体读入内存后才校验 | 单测:mock 返回超限 body,客户端在读满前返回超限错误且内存占用有界 | +| **F-71** | P2-7 | `gateway_client.rs:121-126` | `health()` 与 SSE 一致附带 bearer | 单测:mock 对无 bearer 的 health 返回 401,激活仍成功即失败 | +| **F-72** | P2-8 | `gateway_client.rs:237-238` | 仅在「连接存活超阈值且收到过事件」时重置退避,避免服务端接受即优雅关流时进入约 10 次/秒热重连 | 单测:mock 接受连接后立即关闭,断言重连间隔单调增长 | +| **F-73** | P2-29 | `astrbot_client.rs:554-565` | JWT `exp` 判定改 `exp <= now + 30s`;不可解析的 token 打 debug 日志 | 单测:`exp` 落在 30 秒内的 token 被判为过期 | 上列四项系 2026-07-27 补编。它们与 F-26、F-30 同处 `gateway_client.rs` / `astrbot_client.rs`,按本队列 「同文件相邻改动合并进同一批」的编排原则归入 R5;放入 R4 会让两个可并行分支争夺同一文件。 diff --git a/docs/reports/voice-and-awareness-2026-07-27.md b/docs/reports/voice-and-awareness-2026-07-27.md new file mode 100644 index 0000000..bea2770 --- /dev/null +++ b/docs/reports/voice-and-awareness-2026-07-27.md @@ -0,0 +1,219 @@ +# 语音 · 窗口读取 · 游戏陪伴 实施记录(2026-07-27 夜) + +按队列顺序推进:先清语音/屏幕读取被卡住的前期修复(A 段),再实施功能本体(B 段)。 +七个提交,每个都过完整门槛后才推送。 + +> 配套文档:[ADR-0008](../decisions/ADR-0008-screen-awareness-and-voice-boundary.md)(边界与策略)、 +> [fix-queue-2026-07-26.md](./fix-queue-2026-07-26.md)(缺陷队列与 F 编号)。 + +## 门槛结果 + +| 项 | 结果 | +| -------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | +| `cargo fmt --all -- --check` | 通过 | +| `cargo clippy --workspace --all-targets -- -D warnings` | 通过 | +| `cargo test --workspace --lib` | **139 通过 / 0 失败**(`astrbot-desktop` 113、`desktop-protocol` 26) | +| `npm run typecheck` / `lint` | 通过(`--max-warnings 0`) | +| `npm run test -- --run` | **59 通过 / 11 文件**(本轮 35 → 59) | +| `npm run build` | 通过 | +| `npm run test:e2e` | 5 通过 | +| `cargo test --workspace`(含集成测试)与 `npm run tauri:build` | **未执行**:`target\debug\astrbot-desktop.exe` 被运行中的 dev 进程占用。停掉 dev 后需补跑 | + +测试计数变化:Rust 101 → 139(协议 12 → 26、客户端 99 → 113),前端 35 → 59。 +**每一条新断言都做过变异检验**,共 25 处刻意回归全部被对应测试抓到;其中两处第一次检验时 +「无测试覆盖」,补测试后才通过(见下方 A2)。 + +--- + +## A 段 · 前期修复 + +### A2 · 分段回复不再丢内容(N-9) + +`streaming: false` 的 `plain` 帧被当作 delta **追加**进 `accumulated`,随后 `map_complete` +用自己的文本**整体替换**它。三段的回复只显示一段,其余既不显示也不入库。 + +真正的形状比原判断复杂,而且**我第一版改错了**:这类块**有时是已流式发过内容的重述,有时是全新 +内容**——`astrbot_client.rs` 的诊断夹具里写着 `// Repeats what the delta stream already carried` 和 +`// Carries content the stream never delivers`,那些注释是我自己写的。按「每块一个气泡」实现会把 +重述显示两遍,并且立刻 complete 每一块导致截流/取消时已无消息可终止,两条 R2 哨兵拿到 `stop` +而不是 `error`/`cancelled`。 + +修正后两处统一走一个 `reconcile()`,三条互斥规则,任一分支都不会丢已展示的文本: + +1. 逐字节是已展示内容的前缀延伸 → 只发尾部(流式收敛场景,既有测试钉住); +2. 空白归一化后已被展示过 → 什么都不发(分段场景,N-9 本体); +3. 与已展示内容分叉 → 另起一条消息,两边都保留。 + +顺带修掉 `adopt_message_id` 的一个真实缺陷:同 id 分支会把 `m1#part-1` 覆盖回 `m1`,抹掉刚区分开 +的分块。`map_media` 里还留着同一段逻辑的私有副本,带同一个缺陷,已合并。 + +**同时修的 N-4 映射器半边**:`event()` 在没有任何帧携带 `message_id` 前发出的 delta,元数据里 +`message_id` 为 `None`,客户端回退到每事件唯一的 `event_id`,于是每个 delta 自成一条消息。现在流 +id 兜底命名。**N-4 的「两个气泡」现象本身尚未确认是这条**,客户端的 `messageId || eventId` 回退 +未动。 + +### A3 · 非图片媒体帧(F-33) + +语音回复此前**什么都不产生**:无标记、无事件、无报错。四道独立闸门各自丢弃它,**只修任何一道都 +看不出变化**: + +| 闸门 | 症状 | 修法 | +| --------------- | ---------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- | +| 映射器 | `map_media` 唯一的产出分支写死 `frame_type == "image"`,`map_attachment_saved` 直接拒绝非图片 | 两处都按实际类型产出,帧类型写进标记的 alt 文本 | +| `pending_media` | 单槽位,一条回复里第二个媒体帧顶掉第一个 | 有界队列;无 id 的 `attachment_saved` 不再消耗待配对项 | +| 下载 | 候选路径只在字节嗅探为图片时才算成功(服务端对未知路径以 HTTP 200 返回自己的文本,故嗅探是必需的) | 增加音频/视频签名;`Content-Type` 声明为媒体类型时才可短路嗅探 | +| **CSP** | 无 `media-src`,回退到不含 `blob:` 的 `default-src 'self'`,`