# 唯一源
`client/electron/src/icons/agentmail.svg` 是图标唯一源(24×24 视图框,`currentColor`
跟随文字色)。此前各端用的都是占位物:Electron 的窗口/托盘指向一个**不存在**的
`src/icons/tray-icon.png`(`nativeImage` 拿到空图,托盘不可见),
HarmonyOS 的 `startIcon/foreground/background` 是 1×1 PNG,
Web 端根本没有 favicon。
# 为什么带生成脚本
PNG/ICO 是二进制的,换一次配色要重出十几个尺寸,手工做必然出现
「Web 是旧的、Harmony 是新的」这种不一致,而且没人能复核。
`generate.py` 只认上面那一份源,所有变体都由它推导(本机无 rsvg/ImageMagick,
用 cairosvg + Pillow)。改图标只需改源文件再跑一次脚本。
# 各端产物
- **Web**:`public/assets/{agentmail.svg,favicon.ico,apple-touch-icon.png}` + `index.html` 引用。
放 `assets/` 下而非根目录,是因为 Gateway 只把 `/assets/*` 与 `/` 交给静态处理器
(`server/cmd/server/main.go`),放根下会 404。已实测本机与 LAN 均 200。
- **Electron**:应用图标 `icon.png`(512) / `icon.ico`(16–256) / 各尺寸 PNG /
托盘 `tray-icon.png`(32),`package.json` 里 `win.icon` 与 `linux.icon` 指过去。
托盘用品牌色字形而非白色 —— 浅色面板下白色会消失。
- **HarmonyOS**:`startIcon.png`(512) 用完整应用图标(启动页底色浅 `#FFF` /
深 `#000`,白底蓝图标两套都立得住);分层图标的 `background` 是品牌色整块、
`foreground` 是白色字形并留 12% 安全区,避免被系统圆角裁掉。
- **应用内**:新增 `BrandMarkIcon`(fill 型,与现有描边图标集不同族),
替换登录页与初始化页品牌位的占位 `MailboxIcon`;后者已无引用,一并删除。
图标色 `#2563eb` 与门户 Dashy 主题主色一致。
# 验证
- 前端 typecheck 与 196 项测试全绿;`npm run build` 产物含三个图标文件
- Gateway 重新部署后 `/assets/{agentmail.svg,favicon.ico,apple-touch-icon.png}`
在本机与 `192.168.2.60:8180` 都返回 200,Content-Type 正确
- 所有 PNG/ICO 用 Pillow 复核尺寸与 alpha 边界(合成失败会表现为全透明,
已用 getbbox 排除)
77 lines
2.1 KiB
JSON
77 lines
2.1 KiB
JSON
{
|
|
"name": "agentmail-web",
|
|
"version": "0.1.0",
|
|
"private": true,
|
|
"type": "module",
|
|
"main": "electron/main.cjs",
|
|
"scripts": {
|
|
"dev": "vite",
|
|
"dev:electron": "ELECTRON_START_URL=http://localhost:5173 electron electron/main.cjs",
|
|
"build": "vite build",
|
|
"build:win": "vite build && electron-builder --win",
|
|
"build:linux": "vite build && electron-builder --linux",
|
|
"preview": "vite preview",
|
|
"typecheck": "tsc --noEmit",
|
|
"test": "node test/markdown-xss.test.mjs && node test/narrow-layout.test.mjs && node test/theme.test.mjs && vitest run",
|
|
"test:narrow": "node test/manual/narrow-verify.mjs",
|
|
"test:wide": "node test/manual/wide-regression.mjs",
|
|
"test:components": "vitest run",
|
|
"test:watch": "vitest"
|
|
},
|
|
"dependencies": {
|
|
"lunar-javascript": "1.7.7",
|
|
"react": "^18.3.1",
|
|
"react-dom": "^18.3.1",
|
|
"react-markdown": "^9.0.1",
|
|
"remark-gfm": "^4.0.0",
|
|
"zustand": "^4.5.4"
|
|
},
|
|
"devDependencies": {
|
|
"@testing-library/dom": "10.4.1",
|
|
"@testing-library/jest-dom": "6.9.1",
|
|
"@testing-library/react": "16.3.0",
|
|
"@testing-library/user-event": "14.6.1",
|
|
"@types/react": "^18.3.3",
|
|
"@types/react-dom": "^18.3.0",
|
|
"@vitejs/plugin-react": "^4.3.1",
|
|
"autoprefixer": "^10.4.19",
|
|
"electron": "^44.2.0",
|
|
"electron-builder": "^26.15.3",
|
|
"jsdom": "26.1.0",
|
|
"postcss": "^8.4.39",
|
|
"tailwindcss": "^3.4.6",
|
|
"typescript": "^5.5.3",
|
|
"vite": "^5.3.4",
|
|
"vitest": "3.2.4"
|
|
},
|
|
"build": {
|
|
"appId": "xyz.jianfgit.agentmail",
|
|
"productName": "AgentMail",
|
|
"files": [
|
|
"dist/**/*",
|
|
"electron/**/*"
|
|
],
|
|
"directories": {
|
|
"buildResources": "src/icons",
|
|
"output": "release"
|
|
},
|
|
"win": {
|
|
"icon": "src/icons/icon.ico",
|
|
"target": [
|
|
{ "target": "nsis", "arch": ["x64"] }
|
|
]
|
|
},
|
|
"linux": {
|
|
"icon": "src/icons",
|
|
"target": [
|
|
{ "target": "AppImage", "arch": ["x64"] },
|
|
{ "target": "deb", "arch": ["x64"] }
|
|
],
|
|
"category": "Network"
|
|
},
|
|
"nsis": {
|
|
"oneClick": false,
|
|
"allowToChangeInstallationDirectory": true
|
|
}
|
|
}
|
|
} |