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,
}
cfg.Apps = append(cfg.Apps, app)
CfgUnlock()
err := cfg.Save()
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
@@ -259,6 +261,17 @@ func ApiAppDel(c *gin.Context) {
})
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{
"message": "done",
})