Skip to content

Add profile picker to cookie import UI#121

Closed
ngurney wants to merge 2 commits intogarrytan:mainfrom
ngurney:ngurney/browser-profile-picker
Closed

Add profile picker to cookie import UI#121
ngurney wants to merge 2 commits intogarrytan:mainfrom
ngurney:ngurney/browser-profile-picker

Conversation

@ngurney
Copy link

@ngurney ngurney commented Mar 17, 2026

Problem

Chromium-based browsers support multiple profiles, each with its own cookie store. The cookie picker always read from the `Default` profile, making it impossible to import cookies from other profiles (e.g. a work or personal Arc/Chrome profile where your dev app session lives).

Solution

After selecting a browser, the picker now loads its available profiles and shows a row of profile pills. Switching profiles reloads the domain list. The selected profile is sent with import requests.

Profile display names are read from each profile's `Preferences` JSON (the same name shown in the browser's profile switcher), falling back to the directory name if unavailable.

Changes

  • `cookie-import-browser.ts` — new `listProfiles(browser)` scans for `Default` + `Profile N` subdirs that have a `Cookies` file, reads display names from `Preferences`, returns `ProfileInfo[]` sorted Default-first
  • `cookie-picker-routes.ts` — new `GET /cookie-picker/profiles?browser=` endpoint; `profile` param threaded through `/domains` and `/import` routes
  • `cookie-picker-ui.ts` — profile pills row rendered between browser selector and search (hidden when only one profile exists); pills show display names, send directory ids in requests
  • `write-commands.ts` — `--profile` flag added to direct CLI import: `cookie-import-browser arc --domain localhost --profile "Profile 1"`

Behaviour

  • Single-profile browsers: profile pills row is hidden, no change in UX
  • Multi-profile browsers: profile pills appear below the browser selector showing each profile's display name; first profile is auto-selected

🤖 Generated with Claude Code

ngurney and others added 2 commits March 16, 2026 22:57
Chromium-based browsers support multiple profiles, each with its own
cookie store. The previous implementation always read from the 'Default'
profile, making it impossible to import cookies from non-default profiles
(e.g. a work or freelance profile in Arc or Chrome).

Changes:
- cookie-import-browser.ts: add `listProfiles()` which scans a browser's
  data directory for profile subdirs (Default, Profile N) that have a
  Cookies file, reads the display name from each profile's Preferences
  JSON, and returns `ProfileInfo[]` sorted Default-first
- cookie-picker-routes.ts: expose GET /cookie-picker/profiles?browser=
  endpoint; thread an optional `profile` query/body param through the
  /domains and /import routes
- cookie-picker-ui.ts: after selecting a browser, load its profiles and
  render a row of monospace profile pills (hidden when only one profile
  exists); switching profiles reloads the domain list; the selected
  profile id is sent with import requests
- write-commands.ts: support --profile flag in direct CLI import mode
  (cookie-import-browser <browser> --domain <d> --profile "Profile 1")

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
For Chromium profiles signed into a Google account, prefer
account_info[0].email over the generic profile.name (e.g. 'Person 2').
The email is more distinctive when a user has multiple profiles signed
into different accounts. Falls back to profile.name, then directory id.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ngurney
Copy link
Author

ngurney commented Mar 17, 2026

Closing in favour of #65 which covers the same ground and adds an Import All button + fixes findInstalledBrowsers() detection.

One thing worth adding to #65: for Chrome profiles signed into a Google account, profile.name gives generic names like "Person 2". Checking account_info[0].email first gives much more useful labels (e.g. "nick@example.com"). Simple addition to readProfileName / wherever you read the display name:

const email = prefs?.account_info?.[0]?.email;
if (email) return email;
return prefs?.profile?.name ?? null;

@ngurney ngurney closed this Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant