Skip to content

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

fix: exclude management routes from activity feed

Mario7692d66c6030
diff --git a/dashboard.go b/dashboard.go
index e88f87fd..308f8e19 100644
--- a/dashboard.go
+++ b/dashboard.go
@@ -4,6 +4,7 @@ import (
"encoding/json"
"fmt"
"net/http"
+ "strings"
"sync"
"time"
)
@@ -186,8 +187,11 @@ func (d *Dashboard) TrackingMiddleware(pm *ProfileManager, next http.Handler) ht
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
start := time.Now()
- // Skip dashboard routes
- if r.URL.Path == "/dashboard" || r.URL.Path == "/dashboard/agents" || r.URL.Path == "/dashboard/events" {
+ // Skip dashboard, profile, instance, and screencast management routes
+ p := r.URL.Path
+ if strings.HasPrefix(p, "/dashboard") || strings.HasPrefix(p, "/profiles") ||
+ strings.HasPrefix(p, "/instances") || strings.HasPrefix(p, "/screencast/tabs") ||
+ p == "/welcome" || p == "/favicon.ico" || p == "/health" {
next.ServeHTTP(w, r)
return
}
diff --git a/dashboard_test.go b/dashboard_test.go
index 79ecdaec..30376359 100644
--- a/dashboard_test.go
+++ b/dashboard_test.go
@@ -188,7 +188,8 @@ func TestTrackingMiddlewareAnonymous(t *testing.T) {
})
handler := d.TrackingMiddleware(pm, inner)
- req := httptest.NewRequest("GET", "/health", nil)
+ // Use /snapshot (a real agent endpoint, not skipped)
+ req := httptest.NewRequest("GET", "/snapshot", nil)
w := httptest.NewRecorder()
handler.ServeHTTP(w, req)
@@ -198,26 +199,25 @@ func TestTrackingMiddlewareAnonymous(t *testing.T) {
}
}
-func TestTrackingMiddlewareSkipsDashboard(t *testing.T) {
+func TestTrackingMiddlewareSkipsManagementRoutes(t *testing.T) {
d := NewDashboard()
pm := NewProfileManager(t.TempDir())
- called := false
inner := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- called = true
w.WriteHeader(200)
})
handler := d.TrackingMiddleware(pm, inner)
- req := httptest.NewRequest("GET", "/dashboard", nil)
- w := httptest.NewRecorder()
- handler.ServeHTTP(w, req)
- if !called {
- t.Error("inner handler should be called")
+ // All of these should be skipped
+ for _, path := range []string{"/dashboard", "/profiles", "/instances", "/health", "/welcome", "/favicon.ico"} {
+ req := httptest.NewRequest("GET", path, nil)
+ w := httptest.NewRecorder()
+ handler.ServeHTTP(w, req)
}
+
agents := d.GetAgents()
if len(agents) != 0 {
- t.Error("dashboard routes should not be tracked")
+ t.Errorf("management routes should not be tracked, got %+v", agents)
}
}