fix: auto cert state error on editor switch

This commit is contained in:
0xJacky 2023-05-01 14:12:31 +08:00
parent ca3c9946ce
commit 4f5259cea6
No known key found for this signature in database
GPG key ID: B6E4A6E4A561BAF0

View file

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