Files
cc-web/.trellis/tasks/08-25-instance-custom-icon/research/frontend-icon-chain.md

27 lines
1.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 前端图标与设置链路调研
## 图标消费点
- `public/index.html`:favicon、32px favicon、Apple Touch 图标、Manifest,以及登录页 `icon-192.png`。
- `public/app.js`:浏览器通知固定使用 `/icon-192.png`,强制修改密码面板再次渲染登录 Logo。
- `public/sw.js`:Service Worker 通知默认使用 `/icon-192.png`。
- `public/site.webmanifest`:PWA 安装图标使用 `icon-192.png` 与 `icon-512.png`。
## 设置链路
- `#settings-btn` 调用 `showSettingsPanel()`,Codex 与 Claude 设置页都复用 `buildAppearanceSettingsHtml()` / `mountAppearanceSettings()`。
- 设置读取与保存统一走 WebSocket 消息;服务端在消息 switch 中分发 `get_*_config` / `save_*_config` 并回推配置。
- 新功能适合增加独立的实例图标配置消息,避免混入 Codex/Claude 模型配置。
## 静态资源与缓存
- 静态资源由 `server.js` 从 `PUBLIC_DIR` 返回,响应使用 `Cache-Control: no-store, max-age=0`。
- 默认图标未参与前端资产 hash;自定义运行时 URL 应带版本参数或 ETag,确保同页更新。
- PWA/操作系统已安装图标受平台缓存控制,即使动态 Manifest 更新也不保证立即刷新;浏览器页签、登录 Logo 与通知图标可可靠动态更新。
## 测试与风险
- 总回归入口是 `npm run regression`;`scripts/regression.js` 已覆盖设置页消息与静态结构。
- 必须覆盖默认回退、设置页上传/恢复消息、通知图标与登录 Logo 使用统一 URL。
- 不应修改主题级设置按钮图标;实例品牌图标与主题装饰资产是不同职责。