feat(邮件通知): 重构邮件通知系统并增加配置选项
- 移除 Cloudflare Email 绑定,改为支持外部邮件网关 - 新增邮件通知全局开关及管理员/用户通知独立配置 - 在管理后台添加邮件通知配置界面 - 优化邮件发送逻辑,增加错误处理和日志记录 - 更新相关文档说明
This commit is contained in:
@@ -40,6 +40,12 @@ export type CommentSettingsResponse = {
|
||||
adminEnabled: boolean;
|
||||
};
|
||||
|
||||
export type EmailNotifySettingsResponse = {
|
||||
globalEnabled: boolean;
|
||||
adminEnabled: boolean;
|
||||
userEnabled: boolean;
|
||||
};
|
||||
|
||||
export async function loginAdmin(name: string, password: string): Promise<string> {
|
||||
const res = await post<AdminLoginResponse>('/admin/login', { name, password });
|
||||
const key = res.data.key;
|
||||
@@ -71,6 +77,18 @@ export function saveAdminEmail(email: string): Promise<{ message: string }> {
|
||||
return put<{ message: string }>('/admin/settings/email', { email });
|
||||
}
|
||||
|
||||
export function fetchEmailNotifySettings(): Promise<EmailNotifySettingsResponse> {
|
||||
return get<EmailNotifySettingsResponse>('/admin/settings/email-notify');
|
||||
}
|
||||
|
||||
export function saveEmailNotifySettings(data: {
|
||||
globalEnabled?: boolean;
|
||||
adminEnabled?: boolean;
|
||||
userEnabled?: boolean;
|
||||
}): Promise<{ message: string }> {
|
||||
return put<{ message: string }>('/admin/settings/email-notify', data);
|
||||
}
|
||||
|
||||
export function fetchCommentSettings(): Promise<CommentSettingsResponse> {
|
||||
return get<CommentSettingsResponse>('/admin/settings/comments');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user