mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-09-20 02:00:14 +00:00
Merge branch 'upstream/master' into master and preserve domain extensions
This commit is contained in:
@@ -29,6 +29,14 @@ func listNotification(c *gin.Context) ([]*model.Notification, error) {
|
||||
if err := copier.Copy(¬ifications, &slist); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// 列表端点不回显写入态凭据:notifications 是 copier 复制出的副本,置零安全,
|
||||
// 不影响 singleton 内原始数据。
|
||||
for _, n := range notifications {
|
||||
n.URL = ""
|
||||
n.RequestHeader = ""
|
||||
n.RequestBody = ""
|
||||
}
|
||||
return notifications, nil
|
||||
}
|
||||
|
||||
@@ -118,15 +126,24 @@ func updateNotification(c *gin.Context) (any, error) {
|
||||
n.Name = nf.Name
|
||||
n.RequestMethod = nf.RequestMethod
|
||||
n.RequestType = nf.RequestType
|
||||
n.RequestHeader = nf.RequestHeader
|
||||
n.RequestBody = nf.RequestBody
|
||||
n.URL = nf.URL
|
||||
n.Type = nf.Type
|
||||
verifyTLS := nf.VerifyTLS
|
||||
n.VerifyTLS = &verifyTLS
|
||||
formatMetricUnits := nf.FormatMetricUnits
|
||||
n.FormatMetricUnits = &formatMetricUnits
|
||||
|
||||
|
||||
// 凭据在列表接口已脱敏,前端无法回填;空值视为"不修改",保留旧值避免误清空。
|
||||
if nf.URL != "" {
|
||||
n.URL = nf.URL
|
||||
}
|
||||
if nf.RequestHeader != "" {
|
||||
n.RequestHeader = nf.RequestHeader
|
||||
}
|
||||
if nf.RequestBody != "" {
|
||||
n.RequestBody = nf.RequestBody
|
||||
}
|
||||
|
||||
ns := model.NotificationServerBundle{
|
||||
Notification: &n,
|
||||
Server: nil,
|
||||
|
||||
Reference in New Issue
Block a user