more api call

This commit is contained in:
shoopea
2025-12-28 19:27:10 +01:00
parent c8715679f8
commit fd1c14831f
3 changed files with 61 additions and 4 deletions

52
api.go
View File

@@ -192,6 +192,34 @@ func ApiAppList(c *gin.Context) {
c.Data(http.StatusOK, "application/json", pretty.PrettyOptions(b, &pretty.Options{Indent: " "}))
}
func ApiListSchedule(c *gin.Context) {
name := c.Param("schedule")
list := make([]string, 0)
CfgLock()
defer CfgUnlock()
for _, app := range cfg.Apps {
for _, sched := range app.Schedule {
if sched == name && !slices.Contains(list, app.Name) {
list = append(list, app.Name)
}
}
}
slices.Sort(list)
b, err := json.Marshal(list)
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"message": "error",
"error": err,
})
return
}
c.Data(http.StatusOK, "application/json", pretty.PrettyOptions(b, &pretty.Options{Indent: " "}))
}
func ApiAppAdd(c *gin.Context) {
name := c.Param("app")
found := false
@@ -334,3 +362,27 @@ func ApiAppDeactivate(c *gin.Context) {
"message": "done",
})
}
// FIXME
func ApiAppSourceList(c *gin.Context) {
c.JSON(http.StatusInternalServerError, gin.H{
"message": "error",
"error": "not implemented",
})
}
// FIXME
func ApiAppSourceAdd(c *gin.Context) {
c.JSON(http.StatusInternalServerError, gin.H{
"message": "error",
"error": "not implemented",
})
}
// FIXME
func ApiAppSourceDel(c *gin.Context) {
c.JSON(http.StatusInternalServerError, gin.H{
"message": "error",
"error": "not implemented",
})
}