mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 18:35:51 +02:00
enhance: update gonginx and cosy to latest version
This commit is contained in:
parent
af9395ad69
commit
85da74b3f0
39 changed files with 799 additions and 662 deletions
|
@ -13,9 +13,13 @@ func BuildNginxConfig(c *gin.Context) {
|
|||
if !api.BindAndValid(c, &ngxConf) {
|
||||
return
|
||||
}
|
||||
c.Set("maybe_error", "nginx_config_syntax_error")
|
||||
content, err := ngxConf.BuildConfig()
|
||||
if err != nil {
|
||||
api.ErrHandler(c, err)
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"content": ngxConf.BuildConfig(),
|
||||
"content": content,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -28,9 +32,11 @@ func TokenizeNginxConfig(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
c.Set("maybe_error", "nginx_config_syntax_error")
|
||||
ngxConfig := nginx.ParseNgxConfigByContent(json.Content)
|
||||
|
||||
ngxConfig, err := nginx.ParseNgxConfigByContent(json.Content)
|
||||
if err != nil {
|
||||
api.ErrHandler(c, err)
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, ngxConfig)
|
||||
|
||||
}
|
||||
|
@ -43,10 +49,13 @@ func FormatNginxConfig(c *gin.Context) {
|
|||
if !api.BindAndValid(c, &json) {
|
||||
return
|
||||
}
|
||||
|
||||
c.Set("maybe_error", "nginx_config_syntax_error")
|
||||
content, err := nginx.FmtCode(json.Content)
|
||||
if err != nil {
|
||||
api.ErrHandler(c, err)
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"content": nginx.FmtCode(json.Content),
|
||||
"content": content,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue