High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.
feat: support POST /instances/launch with empty body - auto-generate instance name and default to headless
Mario512c01347a3d
diff --git a/internal/orchestrator/handlers.go b/internal/orchestrator/handlers.goindex bac580b0..7adb1982 100644--- a/internal/orchestrator/handlers.go+++ b/internal/orchestrator/handlers.go@@ -4,6 +4,7 @@ import ("encoding/json""fmt""net/http"+ "time""github.com/pinchtab/pinchtab/internal/web")@@ -118,19 +119,30 @@ func (o *Orchestrator) handleLaunchByName(w http.ResponseWriter, r *http.Requestvar req struct {Name string `json:"name"`Port string `json:"port,omitempty"`- Headless bool `json:"headless"`+ Headless *bool `json:"headless"` // pointer to distinguish unset from false}- if err := json.NewDecoder(r.Body).Decode(&req); err != nil {- web.Error(w, 400, fmt.Errorf("invalid JSON"))- return++ // Decode body if present (empty body is allowed)+ if r.ContentLength > 0 {+ if err := json.NewDecoder(r.Body).Decode(&req); err != nil {+ web.Error(w, 400, fmt.Errorf("invalid JSON"))+ return+ }}++ // Default: generate name if not providedif req.Name == "" {- web.Error(w, 400, fmt.Errorf("name is required"))- return+ req.Name = fmt.Sprintf("instance-%d", time.Now().UnixNano())}- // Port is optional - if not provided, Launch() will auto-allocate- inst, err := o.Launch(req.Name, req.Port, req.Headless)+ // Default: headless=true if not specified+ headless := true+ if req.Headless != nil {+ headless = *req.Headless+ }++ // Port is optional - if not provided, Launch() will auto-allocate+ inst, err := o.Launch(req.Name, req.Port, headless)if err != nil {web.Error(w, 409, err)return