ui improovements

This commit is contained in:
pavel 2026-05-14 22:52:59 +02:00
commit 950139010e
7 changed files with 67 additions and 0 deletions

View file

@ -15,6 +15,7 @@ func (a *App) routes() http.Handler {
mux.HandleFunc("/api/workspaces", a.withAuth(a.handleWorkspaces))
mux.HandleFunc("/api/projects", a.withAuth(a.handleProjects))
mux.HandleFunc("/api/projects/", a.withAuth(a.handleProjectSubroutes))
mux.HandleFunc("/api/caddy/config", a.withAuth(a.handleCaddyConfig))
mux.HandleFunc("/api/webhooks/deploy/", a.handleDeployWebhook)
return loggingMiddleware(mux)
}
@ -268,3 +269,16 @@ func (a *App) handleProjectLogs(w http.ResponseWriter, r *http.Request, user Use
}
writeJSON(w, http.StatusOK, map[string]any{"lines": lines, "logs": logs})
}
func (a *App) handleCaddyConfig(w http.ResponseWriter, r *http.Request, _ User) {
if r.Method != http.MethodGet {
http.Error(w, "method not allowed", http.StatusMethodNotAllowed)
return
}
cfg, err := a.fetchCaddyConfig(r.Context())
if err != nil {
http.Error(w, err.Error(), http.StatusBadGateway)
return
}
writeJSON(w, http.StatusOK, cfg)
}