This commit is contained in:
shoopea
2025-12-28 16:31:28 +01:00
parent a1ed1035e9
commit d92380cccb
5 changed files with 29 additions and 24 deletions

13
api.go
View File

@@ -11,7 +11,7 @@ import (
)
func ApiRun(c *gin.Context) {
cfg.Run()
cfg.Run(true)
c.JSON(http.StatusOK, gin.H{
"message": "done",
})
@@ -118,7 +118,7 @@ func ApiRunApp(c *gin.Context) {
}
func ApiSave(c *gin.Context) {
if err := cfg.Save(); err != nil {
if err := cfg.Save(true); err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"message": "error",
"error": err,
@@ -131,7 +131,7 @@ func ApiSave(c *gin.Context) {
}
func ApiConfig(c *gin.Context) {
if b, err := cfg.Pretty(); err != nil {
if b, err := cfg.Pretty(true); err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"message": "error",
"error": err,
@@ -151,7 +151,7 @@ func ApiConfigApp(c *gin.Context) {
for _, app := range cfg.Apps {
if app.Name == name {
found = true
if b, err := app.Pretty(); err != nil {
if b, err := app.Pretty(false); err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"message": "error",
"error": err,
@@ -220,7 +220,7 @@ func ApiAppAdd(c *gin.Context) {
cfg.Apps = append(cfg.Apps, app)
CfgUnlock()
err := cfg.Save()
err := cfg.Save(false)
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"message": "error",
@@ -262,8 +262,7 @@ func ApiAppDel(c *gin.Context) {
return
}
CfgUnlock()
err := cfg.Save()
err := cfg.Save(false)
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"message": "error",