more debug

This commit is contained in:
shoopea
2025-12-28 22:06:06 +01:00
parent ad88d9fe88
commit f47ddd1873
2 changed files with 65 additions and 5 deletions

62
api.go
View File

@@ -8,10 +8,14 @@ import (
"time"
"github.com/gin-gonic/gin"
log "github.com/sirupsen/logrus"
"github.com/tidwall/pretty"
)
func ApiRun(c *gin.Context) {
log.WithFields(log.Fields{}).Debugf("starting")
log.WithFields(log.Fields{}).Debugf("done")
cfg.Run(true)
c.JSON(http.StatusOK, gin.H{
"message": "done",
@@ -19,6 +23,9 @@ func ApiRun(c *gin.Context) {
}
func ApiSnapshotAdd(c *gin.Context) {
log.WithFields(log.Fields{"app": c.Param("app")}).Debugf("starting")
log.WithFields(log.Fields{"app": c.Param("app")}).Debugf("done")
if app, ok := cfg.apps[c.Param("app")]; ok {
schedule := c.Param("schedule")
if _, ok := app.schedule[schedule]; ok {
@@ -47,6 +54,9 @@ func ApiSnapshotAdd(c *gin.Context) {
}
func ApiSnapshotDel(c *gin.Context) {
log.WithFields(log.Fields{}).Debugf("starting")
log.WithFields(log.Fields{}).Debugf("done")
c.JSON(http.StatusInternalServerError, gin.H{
"message": "error",
"error": "not implemented",
@@ -54,6 +64,9 @@ func ApiSnapshotDel(c *gin.Context) {
}
func ApiSnapshotList(c *gin.Context) {
log.WithFields(log.Fields{"app": c.Param("app")}).Debugf("starting")
log.WithFields(log.Fields{"app": c.Param("app")}).Debugf("done")
if app, ok := cfg.apps[c.Param("app")]; ok {
if snapshots, err := app.Snapshots(); err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
@@ -76,6 +89,9 @@ func ApiSnapshotList(c *gin.Context) {
// FIXME
func ApiScheduleAdd(c *gin.Context) {
log.WithFields(log.Fields{}).Debugf("starting")
log.WithFields(log.Fields{}).Debugf("done")
c.JSON(http.StatusInternalServerError, gin.H{
"message": "error",
"error": "not implemented",
@@ -84,6 +100,9 @@ func ApiScheduleAdd(c *gin.Context) {
// FIXME
func ApiScheduleDel(c *gin.Context) {
log.WithFields(log.Fields{}).Debugf("starting")
log.WithFields(log.Fields{}).Debugf("done")
c.JSON(http.StatusInternalServerError, gin.H{
"message": "error",
"error": "not implemented",
@@ -92,6 +111,9 @@ func ApiScheduleDel(c *gin.Context) {
// FIXME
func ApiScheduleList(c *gin.Context) {
log.WithFields(log.Fields{}).Debugf("starting")
log.WithFields(log.Fields{}).Debugf("done")
c.JSON(http.StatusInternalServerError, gin.H{
"message": "error",
"error": "not implemented",
@@ -99,6 +121,9 @@ func ApiScheduleList(c *gin.Context) {
}
func ApiRunApp(c *gin.Context) {
log.WithFields(log.Fields{"app": c.Param("app")}).Debugf("starting")
log.WithFields(log.Fields{"app": c.Param("app")}).Debugf("done")
if app, ok := cfg.apps[c.Param("app")]; ok {
if err := app.RunStandaloneTime(time.Now()); err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
@@ -119,6 +144,9 @@ func ApiRunApp(c *gin.Context) {
}
func ApiSave(c *gin.Context) {
log.WithFields(log.Fields{}).Debugf("starting")
log.WithFields(log.Fields{}).Debugf("done")
if err := cfg.Save(true); err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"message": "error",
@@ -132,6 +160,9 @@ func ApiSave(c *gin.Context) {
}
func ApiConfig(c *gin.Context) {
log.WithFields(log.Fields{}).Debugf("starting")
log.WithFields(log.Fields{}).Debugf("done")
if b, err := cfg.Pretty(true); err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"message": "error",
@@ -143,6 +174,9 @@ func ApiConfig(c *gin.Context) {
}
func ApiConfigApp(c *gin.Context) {
log.WithFields(log.Fields{"app": c.Param("app")}).Debugf("starting")
log.WithFields(log.Fields{"app": c.Param("app")}).Debugf("done")
name := c.Param("app")
found := false
@@ -171,6 +205,9 @@ func ApiConfigApp(c *gin.Context) {
}
func ApiAppList(c *gin.Context) {
log.WithFields(log.Fields{}).Debugf("starting")
log.WithFields(log.Fields{}).Debugf("done")
list := make([]string, 0)
CfgLock()
@@ -194,6 +231,9 @@ func ApiAppList(c *gin.Context) {
}
func ApiListSchedule(c *gin.Context) {
log.WithFields(log.Fields{"schedule": c.Param("schedule")}).Debugf("starting")
log.WithFields(log.Fields{"schedule": c.Param("schedule")}).Debugf("done")
name := c.Param("schedule")
list := make([]string, 0)
@@ -222,6 +262,9 @@ func ApiListSchedule(c *gin.Context) {
}
func ApiAppAdd(c *gin.Context) {
log.WithFields(log.Fields{"app": c.Param("app")}).Debugf("starting")
log.WithFields(log.Fields{"app": c.Param("app")}).Debugf("done")
name := c.Param("app")
found := false
@@ -262,6 +305,9 @@ func ApiAppAdd(c *gin.Context) {
}
func ApiAppDel(c *gin.Context) {
log.WithFields(log.Fields{"app": c.Param("app")}).Debugf("starting")
log.WithFields(log.Fields{"app": c.Param("app")}).Debugf("done")
name := c.Param("app")
found := false
@@ -305,6 +351,9 @@ func ApiAppDel(c *gin.Context) {
}
func ApiAppActivate(c *gin.Context) {
log.WithFields(log.Fields{"app": c.Param("app")}).Debugf("starting")
log.WithFields(log.Fields{"app": c.Param("app")}).Debugf("done")
name := c.Param("app")
CfgLock()
@@ -348,6 +397,9 @@ func ApiAppActivate(c *gin.Context) {
}
func ApiAppDeactivate(c *gin.Context) {
log.WithFields(log.Fields{"app": c.Param("app")}).Debugf("starting")
log.WithFields(log.Fields{"app": c.Param("app")}).Debugf("done")
name := c.Param("app")
CfgLock()
@@ -384,6 +436,9 @@ func ApiAppDeactivate(c *gin.Context) {
}
func ApiAppSourceList(c *gin.Context) {
log.WithFields(log.Fields{"app": c.Param("app")}).Debugf("starting")
log.WithFields(log.Fields{"app": c.Param("app")}).Debugf("done")
name := c.Param("app")
found := false
app := &AppConfig{}
@@ -418,6 +473,9 @@ func ApiAppSourceList(c *gin.Context) {
}
func ApiAppSourceAdd(c *gin.Context) {
log.WithFields(log.Fields{"app": c.Param("app"), "src": c.Param("src")}).Debugf("starting")
log.WithFields(log.Fields{"app": c.Param("app"), "src": c.Param("src")}).Debugf("done")
name := c.Param("app")
found := false
app := &AppConfig{}
@@ -503,8 +561,10 @@ func ApiAppSourceAdd(c *gin.Context) {
}
// FIXME
func ApiAppSourceDel(c *gin.Context) {
log.WithFields(log.Fields{"app": c.Param("app"), "src": c.Param("src")}).Debugf("starting")
log.WithFields(log.Fields{"app": c.Param("app"), "src": c.Param("src")}).Debugf("done")
name := c.Param("app")
found := false
app := &AppConfig{}

View File

@@ -1,7 +1,7 @@
// Code generated by version.sh (@generated) DO NOT EDIT.
package main
var githash = "fc81c38"
var githash = "ad88d9f"
var branch = "master"
var buildstamp = "2025-12-28_20:58:00"
var commits = "126"
var version = "fc81c38-b126 - 2025-12-28_20:58:00"
var buildstamp = "2025-12-28_21:05:59"
var commits = "127"
var version = "ad88d9f-b127 - 2025-12-28_21:05:59"