From 29782180d9e59a1fb7bd746a98ffa4bd5c8d3cb1 Mon Sep 17 00:00:00 2001 From: cclohmar Date: Mon, 15 Jun 2026 19:34:36 +0000 Subject: [PATCH] feat(apps): auto-register app routes from DefaultApps --- src/core/ui/handler.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/core/ui/handler.go b/src/core/ui/handler.go index 04682e8..abca47c 100644 --- a/src/core/ui/handler.go +++ b/src/core/ui/handler.go @@ -29,6 +29,19 @@ func (h *Handler) RegisterRoutes(mux *http.ServeMux, authGate func(http.Handler) staticDir := filepath.Join(h.appDir, "static") mux.Handle("GET /static/", http.StripPrefix("/static", http.FileServer(http.Dir(staticDir)))) mux.Handle("GET /", authGate(http.HandlerFunc(h.launcherPage))) + // App routes + for _, a := range DefaultApps("") { + if a.URL != "" && a.URL != "#" && a.URL != "/" && a.URL != "/admin" { + mux.Handle("GET "+a.URL, authGate(http.HandlerFunc(h.appPage(a.Name, a.Icon, a.Description)))) + } + } +} + +func (h *Handler) appPage(name, icon, desc string) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + component := AppPage(name, icon, desc) + component.Render(r.Context(), w) + } } func (h *Handler) launcherPage(w http.ResponseWriter, r *http.Request) {