High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.
fix: add cache routes to orchestrator for server mode
Dataaff3cce410b0
diff --git a/internal/orchestrator/handlers.go b/internal/orchestrator/handlers.goindex 5303ae09..0e667576 100644--- a/internal/orchestrator/handlers.go+++ b/internal/orchestrator/handlers.go@@ -89,6 +89,10 @@ func (o *Orchestrator) registerHandlers(mux *http.ServeMux, skipLaunch bool) {registerCapabilityRoute(mux, "POST /tabs/{id}/evaluate", o.AllowsEvaluate(), "evaluate", "security.allowEvaluate", "evaluate_disabled", o.proxyTabRequest)registerCapabilityRoute(mux, "GET /tabs/{id}/download", o.AllowsDownload(), "download", "security.allowDownload", "download_disabled", o.proxyTabRequest)registerCapabilityRoute(mux, "POST /tabs/{id}/upload", o.AllowsUpload(), "upload", "security.allowUpload", "upload_disabled", o.proxyTabRequest)++ // Cache operations - proxy to first running instance+ mux.HandleFunc("POST /cache/clear", o.proxyToFirstInstance)+ mux.HandleFunc("GET /cache/status", o.proxyToFirstInstance)}func (o *Orchestrator) handleList(w http.ResponseWriter, r *http.Request) {diff --git a/internal/orchestrator/proxy.go b/internal/orchestrator/proxy.goindex 859d4e06..41e70dd4 100644--- a/internal/orchestrator/proxy.go+++ b/internal/orchestrator/proxy.go@@ -335,3 +335,39 @@ func (o *Orchestrator) singleRunningInstance() *InstanceInternal {}return only}++// proxyToFirstInstance proxies requests to the first running instance.+// Used for browser-wide operations like cache clearing that aren't tab-specific.+func (o *Orchestrator) proxyToFirstInstance(w http.ResponseWriter, r *http.Request) {+ inst := o.firstRunningInstance()+ if inst == nil {+ httpx.Error(w, 503, fmt.Errorf("no running instance available"))+ return+ }++ activity.EnrichRequest(r, activity.Update{+ InstanceID: inst.ID,+ ProfileID: inst.ProfileID,+ ProfileName: inst.ProfileName,+ })++ targetURL, err := o.instancePathURL(inst, r.URL.Path, r.URL.RawQuery)+ if err != nil {+ httpx.Error(w, 502, err)+ return+ }+ o.proxyToURL(w, r, targetURL)+}++// firstRunningInstance returns any running instance (used for browser-wide ops).+func (o *Orchestrator) firstRunningInstance() *InstanceInternal {+ o.mu.RLock()+ defer o.mu.RUnlock()++ for _, inst := range o.instances {+ if inst.Status == "running" && instanceIsActive(inst) {+ return inst+ }+ }+ return nil+}