mirror of
https://github.com/tnb-labs/panel.git
synced 2026-08-30 17:05:19 +08:00
443516a2cf
依赖注入:
- 移除 google/wire(含 wire.go/wire_gen.go 与全部 ProviderSet),
改用 samber/do v2 单注入器 + 双入口惰性构建
- 贡献模型替代命令式注册:路由 routes:、命令 commands:、
任务 jobs: 前缀经 internal/registry 收集与校验
- 构造函数统一 func NewXxx(i do.Injector) (T, error)
三层架构:
- 补全用例层:每个 biz.XxxRepo 配 XxxUsecase,
service/command/job 表现层只依赖用例,不再直接引用仓储
路由与文档:
- route/http.go 按域拆为声明式 Endpoint 贡献,
Endpoint 承载登录白名单与端点限流语义
- 调试模式下提供 OpenAPI 3.1 文档:/openapi.json 与 /docs(Scalar),
从 validate 标签生成
目录与依赖:
- internal/http/{middleware,request,rule} 拍平至 internal/*
- CLI 命令拆至 internal/command
- 日志轮转 timberjack 换为 libtnb/logrotate
- 升级 validator/cron/sessions/gormstore/sqlite/securecookie
- 数据库迁移保持 gormigrate 不变
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
43 lines
2.3 KiB
Go
43 lines
2.3 KiB
Go
package request
|
|
|
|
type SettingPanel struct {
|
|
Name string `json:"name" validate:"required"`
|
|
Channel string `json:"channel" validate:"required && in:stable,beta"`
|
|
Locale string `json:"locale" validate:"required"`
|
|
Entrance string `json:"entrance" validate:"required"`
|
|
EntranceError string `json:"entrance_error" validate:"in:418,nginx,close"` // 安全入口错误页伪装类型
|
|
LoginCaptcha bool `json:"login_captcha"` // 登录验证码
|
|
OfflineMode bool `json:"offline_mode"`
|
|
AutoUpdate bool `json:"auto_update"`
|
|
TwoFA bool `json:"two_fa"`
|
|
Lifetime uint `json:"lifetime" validate:"required && min:10 && max:43200"` // 登录超时,单位:分
|
|
IPHeader string `json:"ip_header"`
|
|
BindDomain []string `json:"bind_domain"`
|
|
BindIP []string `json:"bind_ip" validate:"unique && dive && ipcidr"`
|
|
BindUA []string `json:"bind_ua"`
|
|
WebsitePath string `json:"website_path" validate:"required"`
|
|
BackupPath string `json:"backup_path" validate:"required"`
|
|
BackupFormat string `json:"backup_format" validate:"in:tar.xz,tar.gz,tar.zst,zip,7z"` // 备份压缩格式
|
|
ProjectPath string `json:"project_path" validate:"required"`
|
|
ContainerSock string `json:"container_sock"`
|
|
HiddenMenu []string `json:"hidden_menu"` // 隐藏的菜单项
|
|
CustomLogo string `json:"custom_logo" validate:"url"` // 自定义 Logo URL
|
|
IPDBType string `json:"ipdb_type" validate:"in:custom,subscribe"` // IPDB 来源类型: "" / "custom" / "subscribe"
|
|
IPDBURL string `json:"ipdb_url"` // IPDB 订阅链接
|
|
IPDBPath string `json:"ipdb_path"` // IPDB 地理位置库路径
|
|
Port uint `json:"port" validate:"required && min:1 && max:65535"` // 面板端口
|
|
TLS string `json:"tls" validate:"in:off,acme,self-signed,custom"` // 面板 TLS: off, acme, self-signed, custom
|
|
PublicIP []string `json:"public_ip"`
|
|
Cert string `json:"cert"`
|
|
Key string `json:"key"`
|
|
}
|
|
|
|
type SettingCert struct {
|
|
Cert string `json:"cert" validate:"required"`
|
|
Key string `json:"key" validate:"required"`
|
|
}
|
|
|
|
type SettingMemo struct {
|
|
Content string `json:"content"`
|
|
}
|