精简: 去掉 Telegram 机器人+通知: tgbot 包/stats-notify 与 hash 清理 job/登录通知/backuptotgbot/testTgBot/全部 tg* 设置/locale Bot 本地化/SecretClears 机制; 连带清理 Swagger/外部流量/邮件/2FA 的残留测试
This commit is contained in:
@@ -5,31 +5,6 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestCheckValidSmtpFrom(t *testing.T) {
|
||||
base := func() *AllSetting {
|
||||
return &AllSetting{WebPort: 2053, SubPort: 2096}
|
||||
}
|
||||
|
||||
for _, v := range []string{"", "panel@example.com"} {
|
||||
s := base()
|
||||
s.SmtpFrom = v
|
||||
if err := s.CheckValid(); err != nil {
|
||||
t.Errorf("CheckValid with smtpFrom=%q: unexpected error %v", v, err)
|
||||
}
|
||||
}
|
||||
|
||||
for _, v := range []string{
|
||||
"not-an-address",
|
||||
"panel@example.com\r\nBcc: evil@example.com",
|
||||
"a@b\nSubject: injected",
|
||||
} {
|
||||
s := base()
|
||||
s.SmtpFrom = v
|
||||
if err := s.CheckValid(); err == nil {
|
||||
t.Errorf("CheckValid with smtpFrom=%q: want error, got nil", v)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestCheckValidWildcardListenPortConflict(t *testing.T) {
|
||||
s := &AllSetting{WebPort: 2053, SubPort: 2053, WebListen: "0.0.0.0", SubListen: ""}
|
||||
|
||||
@@ -36,18 +36,6 @@ type AllSetting struct {
|
||||
SubShowIdentityOnAllLinks bool `json:"subShowIdentityOnAllLinks" form:"subShowIdentityOnAllLinks"`
|
||||
Datepicker string `json:"datepicker" form:"datepicker"`
|
||||
|
||||
TgBotEnable bool `json:"tgBotEnable" form:"tgBotEnable"`
|
||||
TgBotToken string `json:"tgBotToken" form:"tgBotToken"`
|
||||
TgBotProxy string `json:"tgBotProxy" form:"tgBotProxy"`
|
||||
TgBotAPIServer string `json:"tgBotAPIServer" form:"tgBotAPIServer"`
|
||||
TgBotChatId string `json:"tgBotChatId" form:"tgBotChatId"`
|
||||
TgRunTime string `json:"tgRunTime" form:"tgRunTime"`
|
||||
TgBotBackup bool `json:"tgBotBackup" form:"tgBotBackup"`
|
||||
TgCpu int `json:"tgCpu" form:"tgCpu" validate:"gte=0,lte=100"`
|
||||
TgMemory int `json:"tgMemory" form:"tgMemory" validate:"gte=0,lte=100"`
|
||||
TgLang string `json:"tgLang" form:"tgLang"`
|
||||
TgEnabledEvents string `json:"tgEnabledEvents" form:"tgEnabledEvents"`
|
||||
|
||||
OutboundDownThreshold int `json:"outboundDownThreshold" form:"outboundDownThreshold" validate:"gte=1,lte=100"`
|
||||
|
||||
TimeLocation string `json:"timeLocation" form:"timeLocation"`
|
||||
@@ -97,7 +85,6 @@ type AllSetting struct {
|
||||
type AllSettingView struct {
|
||||
AllSetting
|
||||
|
||||
HasTgBotToken bool `json:"hasTgBotToken"`
|
||||
HasApiToken bool `json:"hasApiToken"`
|
||||
HasWarpSecret bool `json:"hasWarpSecret"`
|
||||
HasNordSecret bool `json:"hasNordSecret"`
|
||||
|
||||
Reference in New Issue
Block a user