后端: - 修复登录校验、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>
64 lines
2.0 KiB
Go
64 lines
2.0 KiB
Go
// Package meta 定义驱动向前端暴露的元数据。
|
|
//
|
|
// WebUI 依靠这些描述动态渲染账号 / 规则的配置表单,
|
|
// 新增一个驱动时只要提供 Meta(),前端无需改动。
|
|
package meta
|
|
|
|
// FieldType 决定前端使用哪种输入控件
|
|
type FieldType string
|
|
|
|
const (
|
|
FieldString FieldType = "string" // 单行文本
|
|
FieldPassword FieldType = "password" // 密码框
|
|
FieldTextarea FieldType = "textarea" // 多行文本
|
|
FieldNumber FieldType = "number" // 数字
|
|
FieldStringList FieldType = "string-list" // 字符串数组
|
|
FieldNumberList FieldType = "number-list" // 数字数组
|
|
FieldBool FieldType = "bool" // 开关
|
|
)
|
|
|
|
// Field 描述配置 JSON 中的一个字段
|
|
type Field struct {
|
|
Key string `json:"key"`
|
|
Label string `json:"label"`
|
|
Type FieldType `json:"type"`
|
|
Required bool `json:"required"`
|
|
Placeholder string `json:"placeholder,omitempty"`
|
|
Help string `json:"help,omitempty"`
|
|
// Secret 为 true 的字段在读取接口中会被掩码
|
|
Secret bool `json:"secret,omitempty"`
|
|
Default any `json:"default,omitempty"`
|
|
}
|
|
|
|
// AccountMeta 账号类型的元数据
|
|
type AccountMeta struct {
|
|
Type string `json:"type"`
|
|
Label string `json:"label"`
|
|
Description string `json:"description,omitempty"`
|
|
Docs string `json:"docs,omitempty"`
|
|
Testable bool `json:"testable"`
|
|
Fields []Field `json:"fields"`
|
|
}
|
|
|
|
// RuleMeta 规则类型的元数据
|
|
type RuleMeta struct {
|
|
Type string `json:"type"`
|
|
Label string `json:"label"`
|
|
Description string `json:"description,omitempty"`
|
|
Docs string `json:"docs,omitempty"`
|
|
// AccountType 该规则需要的账号类型,为空表示不需要关联账号
|
|
AccountType string `json:"account_type"`
|
|
Fields []Field `json:"fields"`
|
|
}
|
|
|
|
// SecretKeys 返回需要掩码的字段名
|
|
func SecretKeys(fields []Field) []string {
|
|
keys := make([]string, 0, len(fields))
|
|
for _, f := range fields {
|
|
if f.Secret {
|
|
keys = append(keys, f.Key)
|
|
}
|
|
}
|
|
return keys
|
|
}
|