Semaphore/api/apps.go

37 lines
678 B
Go
Raw Normal View History

2024-07-07 22:28:19 +02:00
package api
import (
"github.com/ansible-semaphore/semaphore/api/helpers"
"github.com/ansible-semaphore/semaphore/util"
"net/http"
)
func getApps(w http.ResponseWriter, r *http.Request) {
type app struct {
ID string `json:"id"`
Title string `json:"title"`
Icon string `json:"icon"`
Color string `json:"color"`
DarkColor string `json:"dark_color"`
}
apps := make([]app, 0)
for k, a := range util.Config.Apps {
if !a.Active {
continue
}
apps = append(apps, app{
ID: k,
Title: a.Title,
Icon: a.Icon,
Color: a.Color,
DarkColor: a.DarkColor,
})
}
helpers.WriteJSON(w, http.StatusOK, apps)
}