后端: - 修复登录校验、DB 并发(单例+WAL+纯Go sqlite)、会话密钥持久化等核心缺陷 - 新增 Timer CRUD/签到/手动触发、执行日志、仪表盘、驱动元数据等 API - 统一驱动接口: 带 context 的执行器、真实错误返回、敏感字段掩码、连通性测试 - 补全钉钉执行器; Timer 触发/提醒去重; 配置支持默认值与环境变量覆盖 前端: - Vite+Vue3+TS+Pinia+Element Plus, 由驱动元数据动态渲染配置表单 - 登录/仪表盘(倒计时环)/定时器/规则/账号/日志/设置页面, 支持暗色模式 - 主题色 #66ccff, 信号波纹 logo, go:embed 单二进制部署 构建: Dockerfile 增加前端构建阶段; 补充各驱动配置文档 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
51 lines
1.3 KiB
Go
51 lines
1.3 KiB
Go
package email
|
|
|
|
const (
|
|
// AccountType 邮箱账号类型标识
|
|
AccountType = "email"
|
|
// RuleType 发送邮件的规则类型标识
|
|
RuleType = "email"
|
|
)
|
|
|
|
// SMTP 加密方式
|
|
const (
|
|
SecuritySSL = "ssl" // 隐式 TLS,一般是 465 端口
|
|
SecuritySTARTTLS = "starttls" // 显式 TLS,一般是 587 端口
|
|
SecurityNone = "none" // 不加密,一般是 25 端口
|
|
)
|
|
|
|
type EmailAccountConfig struct {
|
|
SMTPServer string `json:"smtp_server"`
|
|
Port int `json:"port"`
|
|
Username string `json:"username"`
|
|
Password string `json:"password"`
|
|
// 加密方式,留空时按 ssl 处理(兼容旧配置)
|
|
Security string `json:"security"`
|
|
// 发件人地址,留空时使用 Username
|
|
From string `json:"from"`
|
|
// 用于测试邮件发送的地址
|
|
TestDestination string `json:"test_destination"`
|
|
}
|
|
|
|
// SecurityOrDefault 返回加密方式,兼容没有该字段的旧配置
|
|
func (c *EmailAccountConfig) SecurityOrDefault() string {
|
|
if c.Security == "" {
|
|
return SecuritySSL
|
|
}
|
|
return c.Security
|
|
}
|
|
|
|
// FromOrDefault 返回发件人地址
|
|
func (c *EmailAccountConfig) FromOrDefault() string {
|
|
if c.From == "" {
|
|
return c.Username
|
|
}
|
|
return c.From
|
|
}
|
|
|
|
type EmailRule struct {
|
|
Msg string `json:"msg"`
|
|
Title string `json:"title"`
|
|
Destinations []string `json:"destinations"` // 邮件地址列表
|
|
}
|