Add location grouping with cola layout

This commit is contained in:
Ian Gulliver
2026-01-24 15:04:42 -08:00
parent c662ff80f4
commit 8b50762c92
12 changed files with 241 additions and 10 deletions

10
http.go
View File

@@ -24,6 +24,7 @@ func (t *Tendrils) startHTTPServer() {
mux := http.NewServeMux()
mux.HandleFunc("/api/status", t.handleAPIStatus)
mux.HandleFunc("/api/config", t.handleAPIConfig)
mux.Handle("/", http.FileServer(http.Dir("static")))
log.Printf("[http] listening on %s", t.HTTPPort)
@@ -40,6 +41,15 @@ func (t *Tendrils) handleAPIStatus(w http.ResponseWriter, r *http.Request) {
json.NewEncoder(w).Encode(status)
}
func (t *Tendrils) handleAPIConfig(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
if t.config == nil {
json.NewEncoder(w).Encode(&Config{})
return
}
json.NewEncoder(w).Encode(t.config)
}
func (t *Tendrils) GetStatus() *StatusResponse {
return &StatusResponse{
Nodes: t.getNodes(),