后端: - 修复登录校验、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>
57 lines
1.5 KiB
Go
57 lines
1.5 KiB
Go
package github
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
"strings"
|
|
|
|
"github.com/ssdomei232/goodBaby/internal/meta"
|
|
)
|
|
|
|
type GithubMakeRepositoryPublicRuleValidator struct{}
|
|
|
|
func (v *GithubMakeRepositoryPublicRuleValidator) GetType() string {
|
|
return RuleTypeMakeRepoPublic
|
|
}
|
|
|
|
func (v *GithubMakeRepositoryPublicRuleValidator) Validate(configJSON string) error {
|
|
var config GithubReposConfig
|
|
if err := json.Unmarshal([]byte(configJSON), &config); err != nil {
|
|
return fmt.Errorf("解析 GitHub 规则配置失败: %v", err)
|
|
}
|
|
|
|
if len(config.Repos) == 0 {
|
|
return fmt.Errorf("GitHub 规则配置错误: 至少需要指定一个仓库")
|
|
}
|
|
|
|
for _, repo := range config.Repos {
|
|
if strings.TrimSpace(repo) == "" {
|
|
return fmt.Errorf("GitHub 规则配置错误: 仓库名不能为空")
|
|
}
|
|
if strings.Contains(repo, "/") {
|
|
return fmt.Errorf("GitHub 规则配置错误: 只填写仓库名(不含所有者),收到 %q", repo)
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (v *GithubMakeRepositoryPublicRuleValidator) Meta() meta.RuleMeta {
|
|
return meta.RuleMeta{
|
|
Type: RuleTypeMakeRepoPublic,
|
|
Label: "公开 GitHub 仓库",
|
|
Description: "触发时把指定的私有仓库改为公开。",
|
|
AccountType: AccountType,
|
|
Fields: []meta.Field{
|
|
{
|
|
Key: "repos",
|
|
Label: "仓库列表",
|
|
Type: meta.FieldStringList,
|
|
Required: true,
|
|
Placeholder: "my-repo",
|
|
Help: "只填仓库名,所有者取自关联的 GitHub 账号",
|
|
},
|
|
},
|
|
}
|
|
}
|