Explorar o código

fix: auto cert state error on editor switch

0xJacky %!s(int64=2) %!d(string=hai) anos
pai
achega
4f5259cea6
Modificáronse 1 ficheiros con 3 adicións e 2 borrados
  1. 3 2
      server/api/domain.go

+ 3 - 2
server/api/domain.go

@@ -110,6 +110,8 @@ func GetDomain(c *gin.Context) {
 		return
 	}
 
+	certModel, _ := model.FirstCert(name)
+
 	if site.Advanced {
 		origContent, err := os.ReadFile(path)
 		if err != nil {
@@ -122,6 +124,7 @@ func GetDomain(c *gin.Context) {
 			"enabled":          enabled,
 			"name":             name,
 			"config":           string(origContent),
+			"auto_cert":        certModel.AutoCert == model.AutoCertEnabled,
 			"chatgpt_messages": chatgpt.Content,
 		})
 		return
@@ -161,8 +164,6 @@ func GetDomain(c *gin.Context) {
 		}
 	}
 
-	certModel, _ := model.FirstCert(name)
-
 	c.Set("maybe_error", "nginx_config_syntax_error")
 
 	c.JSON(http.StatusOK, gin.H{