feat: v2.1.0 界面与凭据改进 —— 单一 API/MCP Key、邮件 Markdown 正文、/inboxs 域名筛选、暗色主题

- 单一 Key:API 与 MCP 共用一个 wmh_ Key,凭据迁移至 settings 表(0004 删除 api_credentials)
- Markdown:入库时 HTML→Markdown(mailhook 同思路),webhook payload 新增 markdown 字段
- /emails 路由改为 /inboxs 并支持域名筛选;设置按钮移入头像下拉
- 主题切换按钮(头像左侧,亮/暗持久化);设置模态仅 全局 Webhook/账号密码 两 tab 且高度限屏
- 列表操作列按钮加 SVG 图标;mailboxes 去 Webhook 列;最近邮件加收件人列
This commit is contained in:
bigcode
2026-09-30 13:27:28 +08:00
parent fec96e49cc
commit 7370cce784
38 changed files with 1281 additions and 512 deletions
+58 -19
View File
@@ -1,25 +1,64 @@
/** antd v6 主题配置:默认主题 + 少量 token 覆写(主色与品牌一致) */
/** antd v6 主题配置:亮/暗双主题(暗色用 darkAlgorithm),品牌色一致 */
import type { ThemeConfig } from "antd";
import { theme } from "antd";
/** # 成员变量: 品牌主色 **/
export const BRAND_COLOR = "#2f54eb";
/** # 成员变量: antd 主题 */
export const antdTheme: ThemeConfig = {
token: {
colorPrimary: BRAND_COLOR,
borderRadius: 8,
fontFamily:
"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif",
},
components: {
Layout: {
siderBg: "#ffffff",
headerBg: "#ffffff",
headerHeight: 64,
},
Card: {
headerHeight: 56,
},
},
/** # 成员变量: 主题存储键(localStorage) **/
export const THEME_STORAGE_KEY = "wmh_theme";
/** # 成员变量: 亮色主题基础 token(两种主题共用) **/
const baseToken = {
colorPrimary: BRAND_COLOR,
borderRadius: 8,
fontFamily:
"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif",
};
/** # 函数
* 构建主题配置
* 参数: dark - 是否暗色模式
* 返回值: antd ThemeConfig
*/
export function buildAntdTheme(dark: boolean): ThemeConfig {
return {
algorithm: dark ? [theme.darkAlgorithm] : undefined,
token: {
...baseToken,
},
components: {
Layout: {
siderBg: dark ? "#141414" : "#ffffff",
headerBg: dark ? "#141414" : "#ffffff",
headerHeight: 64,
},
Card: {
headerHeight: 56,
},
},
};
}
/** # 函数
* 读取本地存储的主题偏好(默认亮色)
*/
export function loadDarkMode(): boolean {
try {
return localStorage.getItem(THEME_STORAGE_KEY) === "dark";
} catch {
return false;
}
}
/** # 函数
* 持久化主题偏好并同步 <html data-theme>(供 styles.css 暗色覆盖)
*/
export function applyDarkMode(dark: boolean): void {
try {
localStorage.setItem(THEME_STORAGE_KEY, dark ? "dark" : "light");
} catch {
// 隐私模式等场景忽略
}
document.documentElement.dataset.theme = dark ? "dark" : "light";
}