fix cfg lock

This commit is contained in:
shoopea
2025-12-28 16:20:37 +01:00
parent 6a0c8006d6
commit a1ed1035e9
2 changed files with 17 additions and 4 deletions

13
api.go
View File

@@ -218,6 +218,8 @@ func ApiAppAdd(c *gin.Context) {
Active: false, Active: false,
} }
cfg.Apps = append(cfg.Apps, app) cfg.Apps = append(cfg.Apps, app)
CfgUnlock()
err := cfg.Save() err := cfg.Save()
if err != nil { if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{ c.JSON(http.StatusInternalServerError, gin.H{
@@ -259,6 +261,17 @@ func ApiAppDel(c *gin.Context) {
}) })
return return
} }
CfgUnlock()
err := cfg.Save()
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"message": "error",
"error": err,
})
return
}
c.JSON(http.StatusOK, gin.H{ c.JSON(http.StatusOK, gin.H{
"message": "done", "message": "done",
}) })

View File

@@ -1,7 +1,7 @@
// Code generated by version.sh (@generated) DO NOT EDIT. // Code generated by version.sh (@generated) DO NOT EDIT.
package main package main
var githash = "1890050" var githash = "6a0c800"
var branch = "master" var branch = "master"
var buildstamp = "2025-12-28_15:14:58" var buildstamp = "2025-12-28_15:20:20"
var commits = "119" var commits = "120"
var version = "1890050-b119 - 2025-12-28_15:14:58" var version = "6a0c800-b120 - 2025-12-28_15:20:20"