add saving cfg

This commit is contained in:
shoopea
2024-11-17 16:25:39 +01:00
parent e1806fd27a
commit 3bcd6664a6
5 changed files with 51 additions and 4 deletions

View File

@@ -113,6 +113,18 @@ func (a *AdminConfig) Run() {
})
})
r.GET("/save", func(c *gin.Context) {
if err := cfg.Save(); err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"message": "error",
})
} else {
c.JSON(http.StatusOK, gin.H{
"message": "done",
})
}
})
fsys, _ := fs.Sub(assets, "assets/static")
r.StaticFS("/assets", http.FS(fsys))