mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-10 18:05: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"
|
||||
)
|
||||
|
||||
type APIConfigResp struct {
|
||||
config.Config
|
||||
SyncNodeIds []uint64 `json:"sync_node_ids" gorm:"serializer:json"`
|
||||
SyncOverwrite bool `json:"sync_overwrite"`
|
||||
}
|
||||
|
||||
func GetConfig(c *gin.Context) {
|
||||
relativePath := c.Param("path")
|
||||
|
||||
|
@ -74,16 +68,14 @@ func GetConfig(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, APIConfigResp{
|
||||
Config: config.Config{
|
||||
Name: stat.Name(),
|
||||
Content: string(content),
|
||||
ChatGPTMessages: chatgpt.Content,
|
||||
FilePath: absPath,
|
||||
ModifiedAt: stat.ModTime(),
|
||||
Dir: filepath.Dir(relativePath),
|
||||
},
|
||||
SyncNodeIds: cfg.SyncNodeIds,
|
||||
SyncOverwrite: cfg.SyncOverwrite,
|
||||
c.JSON(http.StatusOK, config.Config{
|
||||
Name: stat.Name(),
|
||||
Content: string(content),
|
||||
ChatGPTMessages: chatgpt.Content,
|
||||
FilePath: absPath,
|
||||
ModifiedAt: stat.ModTime(),
|
||||
Dir: filepath.Dir(relativePath),
|
||||
SyncNodeIds: cfg.SyncNodeIds,
|
||||
SyncOverwrite: cfg.SyncOverwrite,
|
||||
})
|
||||
}
|
||||
|
|
|
@ -101,5 +101,7 @@ func EditConfig(c *gin.Context) {
|
|||
FilePath: absPath,
|
||||
ModifiedAt: time.Now(),
|
||||
Dir: filepath.Dir(relativePath),
|
||||
SyncNodeIds: cfg.SyncNodeIds,
|
||||
SyncOverwrite: cfg.SyncOverwrite,
|
||||
})
|
||||
}
|
||||
|
|
|
@ -28,4 +28,6 @@ type Config struct {
|
|||
Status ConfigStatus `json:"status"`
|
||||
Dir string `json:"dir"`
|
||||
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