High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.
fix: dashboard mode
Luigi Agostidf5478312150
diff --git a/cmd/pinchtab/cmd_dashboard.go b/cmd/pinchtab/cmd_dashboard.goindex 82ac52f1..5d8f2ad2 100644--- a/cmd/pinchtab/cmd_dashboard.go+++ b/cmd/pinchtab/cmd_dashboard.go@@ -119,25 +119,36 @@ func runDashboard(cfg *config.RuntimeConfig) {strings.EqualFold(os.Getenv("PINCHTAB_AUTO_LAUNCH"), "yes")if autoLaunch {defaultProfile := os.Getenv("PINCHTAB_DEFAULT_PROFILE")+ defaultProfileExplicit := defaultProfile != ""defaultPort := os.Getenv("PINCHTAB_DEFAULT_PORT")- // defaultPort is optional - will auto-allocate if not specified- if defaultProfile == "" {- defaultProfile = "default"- }-- if err := os.MkdirAll(filepath.Join(profilesDir, defaultProfile, "Default"), 0755); err != nil {- slog.Warn("failed to create default profile dir", "err", err)- }go func() {time.Sleep(500 * time.Millisecond)+ profileToLaunch := defaultProfile+ // If profile is not explicitly configured, prefer an existing profile.+ // Only synthesize "default" when nothing exists yet.+ if !defaultProfileExplicit {+ list, err := profMgr.List()+ if err != nil {+ slog.Warn("auto-launch profile list failed", "err", err)+ }+ if len(list) > 0 {+ profileToLaunch = list[0].Name+ } else {+ profileToLaunch = "default"+ if err := os.MkdirAll(filepath.Join(profilesDir, profileToLaunch, "Default"), 0755); err != nil {+ slog.Warn("failed to create auto-launch profile dir", "profile", profileToLaunch, "err", err)+ }+ }+ }+headlessDefault := os.Getenv("PINCHTAB_HEADED") == ""- inst, err := orch.Launch(defaultProfile, defaultPort, headlessDefault)+ inst, err := orch.Launch(profileToLaunch, defaultPort, headlessDefault)if err != nil {- slog.Warn("auto-launch failed", "err", err)+ slog.Warn("auto-launch failed", "profile", profileToLaunch, "err", err)return}- slog.Info("auto-launched default instance", "id", inst.ID, "port", inst.Port, "headless", headlessDefault)+ slog.Info("auto-launched instance", "profile", profileToLaunch, "id", inst.ID, "port", inst.Port, "headless", headlessDefault)}()} else {slog.Info("dashboard auto-launch disabled", "hint", "set PINCHTAB_AUTO_LAUNCH=1 to enable")diff --git a/internal/dashboard/dashboard/profiles.js b/internal/dashboard/dashboard/profiles.jsindex 5c9bcb70..6892383b 100644--- a/internal/dashboard/dashboard/profiles.js+++ b/internal/dashboard/dashboard/profiles.js@@ -70,14 +70,15 @@ async function loadProfiles() {}const instanceByName = {};- instances.forEach(inst => { instanceByName[inst.name] = inst; });+ instances.forEach(inst => {+ const key = inst.profileName || inst.name;+ if (!key) return;+ instanceByName[key] = inst;+ });Object.keys(profileByName).forEach(k => { delete profileByName[k]; });profiles.forEach(p => { profileByName[p.name] = p; });- const profileNames = new Set(profiles.map(p => p.name));- const extraInstances = instances.filter(i => !profileNames.has(i.name) && i.status !== 'stopped');-const grid = document.getElementById('profiles-grid');const cards = [];@@ -85,14 +86,6 @@ async function loadProfiles() {cards.push(renderProfileCard(p, instanceByName[p.name] || null));});- extraInstances.forEach(inst => {- cards.push(renderProfileCard({- name: inst.name,- sizeMB: 0,- source: 'instance'- }, inst));- });-if (cards.length === 0) {grid.innerHTML = '<div class="empty-state"><div class="crab">🦀</div>No profiles yet.<br>Click <b>+ New Profile</b> to create one.</div>';return;