fix: Fixed issue with sync ssl to node failed (#10393)

Refs https://github.com/1Panel-dev/1Panel/issues/10237
This commit is contained in:
CityFun
2025-09-17 07:11:59 +00:00
committed by GitHub
parent 1181b13c83
commit c408619042
2 changed files with 13 additions and 1 deletions
+5
View File
@@ -10,6 +10,11 @@ import (
func BindDomain() gin.HandlerFunc {
return func(c *gin.Context) {
localRequest := c.GetBool("LOCAL_REQUEST")
if localRequest {
c.Next()
return
}
settingRepo := repo.NewISettingRepo()
status, err := settingRepo.Get(repo.WithByKey("BindDomain"))
if err != nil {
+8 -1
View File
@@ -11,6 +11,14 @@ import (
func WhiteAllow() gin.HandlerFunc {
return func(c *gin.Context) {
tokenString := c.GetHeader("X-Panel-Local-Token")
clientIP := c.ClientIP()
if clientIP == "127.0.0.1" && tokenString != "" && c.Request.URL.Path == "/api/v2/core/xpack/sync/ssl" {
c.Set("LOCAL_REQUEST", true)
c.Next()
return
}
settingRepo := repo.NewISettingRepo()
status, err := settingRepo.Get(repo.WithByKey("AllowIPs"))
if err != nil {
@@ -22,7 +30,6 @@ func WhiteAllow() gin.HandlerFunc {
c.Next()
return
}
clientIP := c.ClientIP()
for _, ip := range strings.Split(status.Value, ",") {
if len(ip) == 0 {
continue