mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 02:15:48 +02:00
fix(config): integrate SyncNodeIds and SyncOverwrite into Config struct
This commit is contained in:
parent
3502227510
commit
b84c444c55
3 changed files with 13 additions and 17 deletions
|
@ -15,12 +15,6 @@ import (
|
||||||
"github.com/uozi-tech/cosy"
|
"github.com/uozi-tech/cosy"
|
||||||
)
|
)
|
||||||
|
|
||||||
type APIConfigResp struct {
|
|
||||||
config.Config
|
|
||||||
SyncNodeIds []uint64 `json:"sync_node_ids" gorm:"serializer:json"`
|
|
||||||
SyncOverwrite bool `json:"sync_overwrite"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetConfig(c *gin.Context) {
|
func GetConfig(c *gin.Context) {
|
||||||
relativePath := c.Param("path")
|
relativePath := c.Param("path")
|
||||||
|
|
||||||
|
@ -74,15 +68,13 @@ func GetConfig(c *gin.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.JSON(http.StatusOK, APIConfigResp{
|
c.JSON(http.StatusOK, config.Config{
|
||||||
Config: config.Config{
|
|
||||||
Name: stat.Name(),
|
Name: stat.Name(),
|
||||||
Content: string(content),
|
Content: string(content),
|
||||||
ChatGPTMessages: chatgpt.Content,
|
ChatGPTMessages: chatgpt.Content,
|
||||||
FilePath: absPath,
|
FilePath: absPath,
|
||||||
ModifiedAt: stat.ModTime(),
|
ModifiedAt: stat.ModTime(),
|
||||||
Dir: filepath.Dir(relativePath),
|
Dir: filepath.Dir(relativePath),
|
||||||
},
|
|
||||||
SyncNodeIds: cfg.SyncNodeIds,
|
SyncNodeIds: cfg.SyncNodeIds,
|
||||||
SyncOverwrite: cfg.SyncOverwrite,
|
SyncOverwrite: cfg.SyncOverwrite,
|
||||||
})
|
})
|
||||||
|
|
|
@ -101,5 +101,7 @@ func EditConfig(c *gin.Context) {
|
||||||
FilePath: absPath,
|
FilePath: absPath,
|
||||||
ModifiedAt: time.Now(),
|
ModifiedAt: time.Now(),
|
||||||
Dir: filepath.Dir(relativePath),
|
Dir: filepath.Dir(relativePath),
|
||||||
|
SyncNodeIds: cfg.SyncNodeIds,
|
||||||
|
SyncOverwrite: cfg.SyncOverwrite,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,4 +28,6 @@ type Config struct {
|
||||||
Status ConfigStatus `json:"status"`
|
Status ConfigStatus `json:"status"`
|
||||||
Dir string `json:"dir"`
|
Dir string `json:"dir"`
|
||||||
Urls []string `json:"urls,omitempty"`
|
Urls []string `json:"urls,omitempty"`
|
||||||
|
SyncNodeIds []uint64 `json:"sync_node_ids,omitempty"`
|
||||||
|
SyncOverwrite bool `json:"sync_overwrite"`
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue