Skip to content

High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.

refactor: move dashboard to /dashboard, API-first root

Bosch729007acdbe5
diff --git a/cmd/pinchtab/cmd_dashboard.go b/cmd/pinchtab/cmd_dashboard.go
index c2a9eb74..ba325dae 100644
--- a/cmd/pinchtab/cmd_dashboard.go
+++ b/cmd/pinchtab/cmd_dashboard.go
@@ -59,6 +59,16 @@ func runDashboard(cfg *config.RuntimeConfig) {
orch.RegisterHandlers(mux)
profMgr.RegisterHandlers(mux)
+ // Root returns health check (API-first design)
+ mux.HandleFunc("GET /{$}", func(w http.ResponseWriter, r *http.Request) {
+ web.JSON(w, 200, map[string]any{
+ "status": "ok",
+ "mode": "dashboard",
+ "dashboard": "/dashboard",
+ "docs": "/api/docs",
+ })
+ })
+
mux.HandleFunc("GET /health", func(w http.ResponseWriter, r *http.Request) {
web.JSON(w, 200, map[string]string{"status": "ok", "mode": "dashboard"})
})
diff --git a/dashboard/vite.config.ts b/dashboard/vite.config.ts
index 9c0e7f8d..7bcc4e0d 100644
--- a/dashboard/vite.config.ts
+++ b/dashboard/vite.config.ts
@@ -5,12 +5,13 @@ import tailwindcss from '@tailwindcss/vite'
export default defineConfig({
plugins: [react(), tailwindcss()],
- base: '/', // Served at / by Go
+ base: '/dashboard/', // Served at /dashboard by Go
server: {
port: 5173,
proxy: {
'/api': 'http://localhost:9867',
'/health': 'http://localhost:9867',
+ '/metrics': 'http://localhost:9867',
},
},
build: {
diff --git a/internal/dashboard/dashboard.go b/internal/dashboard/dashboard.go
index 1d234827..9297a9ea 100644
--- a/internal/dashboard/dashboard.go
+++ b/internal/dashboard/dashboard.go
@@ -302,16 +302,17 @@ func (d *Dashboard) RegisterHandlers(mux *http.ServeMux) {
mux.HandleFunc("GET /api/agents", d.handleAgents)
mux.HandleFunc("GET /api/events", d.handleSSE)
- // Static files served at /
+ // Static files served at /dashboard/
sub, _ := fs.Sub(dashboardFS, "dashboard")
fileServer := http.FileServer(http.FS(sub))
- // Serve static assets
- mux.Handle("GET /assets/", d.withNoCache(fileServer))
- mux.Handle("GET /pinchtab-headed-192.png", d.withNoCache(fileServer))
+ // Serve static assets under /dashboard/
+ mux.Handle("GET /dashboard/assets/", http.StripPrefix("/dashboard", d.withNoCache(fileServer)))
+ mux.Handle("GET /dashboard/pinchtab-headed-192.png", http.StripPrefix("/dashboard", d.withNoCache(fileServer)))
- // SPA: serve dashboard.html for all other routes
- mux.Handle("GET /", d.withNoCache(http.HandlerFunc(d.handleDashboardUI)))
+ // SPA: serve dashboard.html for /dashboard
+ mux.Handle("GET /dashboard", d.withNoCache(http.HandlerFunc(d.handleDashboardUI)))
+ mux.Handle("GET /dashboard/", d.withNoCache(http.HandlerFunc(d.handleDashboardUI)))
}
func (d *Dashboard) handleAgents(w http.ResponseWriter, r *http.Request) {