Skip to content

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

feat: mark temporary instance profiles and filter from GET /profiles

Mario5fa765507dd8
diff --git a/internal/bridge/api.go b/internal/bridge/api.go
index 707c6358..35a1e16a 100644
--- a/internal/bridge/api.go
+++ b/internal/bridge/api.go
@@ -73,6 +73,7 @@ type ProfileInfo struct {
LastUsed time.Time `json:"lastUsed"`
DiskUsage int64 `json:"diskUsage"`
Running bool `json:"running"`
+ Temporary bool `json:"temporary,omitempty"` // ephemeral instance profiles (auto-generated)
Source string `json:"source,omitempty"`
ChromeProfileName string `json:"chromeProfileName,omitempty"`
AccountEmail string `json:"accountEmail,omitempty"`
diff --git a/internal/orchestrator/orchestrator.go b/internal/orchestrator/orchestrator.go
index 6badf521..7107d0d7 100644
--- a/internal/orchestrator/orchestrator.go
+++ b/internal/orchestrator/orchestrator.go
@@ -319,12 +319,20 @@ func (o *Orchestrator) markStopped(id string) {
o.mu.Unlock()
if strings.HasPrefix(profileName, "instance-") {
+ // Delete profile directory
profilePath := filepath.Join(o.baseDir, profileName)
if err := os.RemoveAll(profilePath); err != nil {
- slog.Warn("failed to delete temporary profile", "name", profileName, "err", err)
+ slog.Warn("failed to delete temporary profile directory", "name", profileName, "err", err)
} else {
slog.Info("deleted temporary profile", "name", profileName)
}
+
+ // Also delete profile metadata via profile manager
+ if o.profiles != nil {
+ if err := o.profiles.Delete(profileName); err != nil {
+ slog.Warn("failed to delete profile metadata", "name", profileName, "err", err)
+ }
+ }
}
}
diff --git a/internal/profiles/handlers.go b/internal/profiles/handlers.go
index a389abb9..aa0f98af 100644
--- a/internal/profiles/handlers.go
+++ b/internal/profiles/handlers.go
@@ -27,6 +27,35 @@ func (pm *ProfileManager) handleList(w http.ResponseWriter, r *http.Request) {
web.Error(w, 500, err)
return
}
+
+ // Filter out temporary profiles by default (unless requested with ?all=true)
+ showAll := r.URL.Query().Get("all") == "true"
+ if !showAll {
+ filtered := []map[string]any{}
+ for _, p := range profiles {
+ if !p.Temporary {
+ // Convert to map for JSON response
+ filtered = append(filtered, map[string]any{
+ "id": p.ID,
+ "name": p.Name,
+ "created": p.Created,
+ "lastUsed": p.LastUsed,
+ "diskUsage": p.DiskUsage,
+ "running": p.Running,
+ "source": p.Source,
+ "chromeProfileName": p.ChromeProfileName,
+ "accountEmail": p.AccountEmail,
+ "accountName": p.AccountName,
+ "hasAccount": p.HasAccount,
+ "useWhen": p.UseWhen,
+ "description": p.Description,
+ })
+ }
+ }
+ web.JSON(w, 200, filtered)
+ return
+ }
+
web.JSON(w, 200, profiles)
}
diff --git a/internal/profiles/profiles.go b/internal/profiles/profiles.go
index 72e01d0f..28f2ad64 100644
--- a/internal/profiles/profiles.go
+++ b/internal/profiles/profiles.go
@@ -7,6 +7,7 @@ import (
"os"
"path/filepath"
"sort"
+ "strings"
"sync"
"time"
@@ -86,10 +87,15 @@ func (pm *ProfileManager) List() ([]bridge.ProfileInfo, error) {
if _, err := os.Stat(filepath.Join(pm.baseDir, entry.Name(), "Default")); err != nil {
continue
}
+
+ // Mark as temporary if it's an auto-generated instance profile
+ isTemporary := strings.HasPrefix(entry.Name(), "instance-")
+
profiles = append(profiles, bridge.ProfileInfo{
ID: info.ID,
Name: info.Name,
Created: info.CreatedAt,
+ Temporary: isTemporary,
DiskUsage: int64(info.SizeMB * 1024 * 1024),
Source: info.Source,
ChromeProfileName: info.ChromeProfileName,