精简: 去掉邮件模块(SMTP 通知): service/email 包、订阅者接线、testSmtp 端点、全部 smtp* 设置
This commit is contained in:
@@ -4,7 +4,6 @@ import (
|
||||
"crypto/tls"
|
||||
"math"
|
||||
"net"
|
||||
"net/mail"
|
||||
"net/netip"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -49,19 +48,6 @@ type AllSetting struct {
|
||||
TgLang string `json:"tgLang" form:"tgLang"`
|
||||
TgEnabledEvents string `json:"tgEnabledEvents" form:"tgEnabledEvents"`
|
||||
|
||||
SmtpEnable bool `json:"smtpEnable" form:"smtpEnable"`
|
||||
SmtpHost string `json:"smtpHost" form:"smtpHost"`
|
||||
SmtpPort int `json:"smtpPort" form:"smtpPort" validate:"gte=1,lte=65535"`
|
||||
SmtpUsername string `json:"smtpUsername" form:"smtpUsername"`
|
||||
SmtpPassword string `json:"smtpPassword" form:"smtpPassword"`
|
||||
SmtpFrom string `json:"smtpFrom" form:"smtpFrom"`
|
||||
SmtpFromName string `json:"smtpFromName" form:"smtpFromName"`
|
||||
SmtpTo string `json:"smtpTo" form:"smtpTo"`
|
||||
SmtpEncryptionType string `json:"smtpEncryptionType" form:"smtpEncryptionType"`
|
||||
SmtpEnabledEvents string `json:"smtpEnabledEvents" form:"smtpEnabledEvents"`
|
||||
SmtpCpu int `json:"smtpCpu" form:"smtpCpu" validate:"gte=0,lte=100"`
|
||||
SmtpMemory int `json:"smtpMemory" form:"smtpMemory" validate:"gte=0,lte=100"`
|
||||
|
||||
OutboundDownThreshold int `json:"outboundDownThreshold" form:"outboundDownThreshold" validate:"gte=1,lte=100"`
|
||||
|
||||
TimeLocation string `json:"timeLocation" form:"timeLocation"`
|
||||
@@ -111,11 +97,10 @@ type AllSetting struct {
|
||||
type AllSettingView struct {
|
||||
AllSetting
|
||||
|
||||
HasTgBotToken bool `json:"hasTgBotToken"`
|
||||
HasApiToken bool `json:"hasApiToken"`
|
||||
HasWarpSecret bool `json:"hasWarpSecret"`
|
||||
HasNordSecret bool `json:"hasNordSecret"`
|
||||
HasSmtpPassword bool `json:"hasSmtpPassword"`
|
||||
HasTgBotToken bool `json:"hasTgBotToken"`
|
||||
HasApiToken bool `json:"hasApiToken"`
|
||||
HasWarpSecret bool `json:"hasWarpSecret"`
|
||||
HasNordSecret bool `json:"hasNordSecret"`
|
||||
}
|
||||
|
||||
func pathHasForbiddenChar(s string) bool {
|
||||
@@ -260,12 +245,6 @@ func (s *AllSetting) CheckValid() error {
|
||||
return common.NewError("time location not exist:", s.TimeLocation)
|
||||
}
|
||||
|
||||
if s.SmtpFrom != "" {
|
||||
if _, err := mail.ParseAddress(s.SmtpFrom); err != nil {
|
||||
return common.NewError("SMTP from address is not valid:", s.SmtpFrom)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user