summaryrefslogtreecommitdiff
path: root/internal/api/server.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/api/server.go')
-rw-r--r--internal/api/server.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/internal/api/server.go b/internal/api/server.go
index fe883bb..4af7325 100644
--- a/internal/api/server.go
+++ b/internal/api/server.go
@@ -57,6 +57,7 @@ type Server struct {
elaborateLimiter *ipRateLimiter // per-IP rate limiter for elaborate/validate endpoints
webhookSecret string // HMAC-SHA256 secret for GitHub webhook validation
projects []config.Project // configured projects for webhook routing
+ githubURLForTest func(fullName string) string // overrides GitHub SSH URL in tests
vapidPublicKey string
vapidPrivateKey string
vapidEmail string
@@ -64,7 +65,7 @@ type Server struct {
dropsDir string
llm *llm.Client
budget budgetReporter // optional; per-provider spend headroom for GET /api/budget
- basePath string // URL prefix the UI is mounted at, e.g. "/claudomator-oss"
+ basePath string // URL prefix the UI is mounted at, e.g. "/claudomator"
}
// SetAPIToken configures a bearer token that must be supplied to access the API.
@@ -95,10 +96,12 @@ func (s *Server) SetWorkspaceRoot(path string) {
}
// SetBasePath sets the URL prefix the UI is served under (e.g. "/claudomator-oss").
+// The server rewrites the base-path meta tag in index.html at request time.
func (s *Server) SetBasePath(p string) {
s.basePath = p
}
+
// Pool returns the executor pool, for graceful shutdown by the caller.
func (s *Server) Pool() *executor.Pool { return s.pool }
@@ -194,15 +197,10 @@ func (s *Server) routes() {
s.mux.HandleFunc("POST /api/drops", s.handlePostDrop)
if s.registry != nil {
mcpHandler := executor.NewAgentMCPHandler(s.registry)
- // The streamable HTTP transport uses POST (messages), GET (SSE stream),
- // and DELETE (session end). Register them explicitly so the patterns are
- // more specific than the "GET /" catch-all and don't conflict.
s.mux.Handle("POST /mcp", mcpHandler)
s.mux.Handle("GET /mcp", mcpHandler)
s.mux.Handle("DELETE /mcp", mcpHandler)
}
- // Chatbot-facing MCP server. Always mounted; the handler refuses to serve
- // unless a shared API token is configured and presented as a bearer.
chatbotHandler := s.chatbotMCPHandler()
s.mux.Handle("POST /chatbot/mcp", chatbotHandler)
s.mux.Handle("GET /chatbot/mcp", chatbotHandler)
@@ -703,6 +701,8 @@ func (s *Server) handleGetExecution(w http.ResponseWriter, r *http.Request) {
writeJSON(w, http.StatusOK, exec)
}
+// handleStaticFiles serves embedded web UI files. For index.html it rewrites the
+// base-path meta tag so the UI knows which API prefix to use.
func (s *Server) handleStaticFiles(w http.ResponseWriter, r *http.Request) {
if r.URL.Path == "/" || r.URL.Path == "/index.html" {
raw, err := fs.ReadFile(webui.Files, "index.html")