Skip to content

fix: resolve active Chromium profile for browser history import#402

Open
vingeraycn wants to merge 1 commit into
SuperCmdLabs:mainfrom
vingeraycn:fix/chromium-browser-profile-detection
Open

fix: resolve active Chromium profile for browser history import#402
vingeraycn wants to merge 1 commit into
SuperCmdLabs:mainfrom
vingeraycn:fix/chromium-browser-profile-detection

Conversation

@vingeraycn
Copy link
Copy Markdown

Problem

All Chromium-family browsers hardcode Default/History as the history file path in listImportableBrowsers(). Users with non-default Chrome profiles (e.g. 'Profile 7') cannot import their browser history — the browser shows as unavailable in the import dropdown.

Fixes #401

Solution

Added resolveChromiumHistoryPath(rootDir) which dynamically resolves the correct profile directory:

  1. Local State — Reads {rootDir}/Local State JSON to find profile.last_used (the active profile)
  2. Default fallback — If Local State is missing or the profile has no History file, falls back to Default/History
  3. Profile scan — If Default doesn't exist either, scans all Profile * and Default subdirectories, returning the first with a History file
  4. Last resort — Returns Default/History path even if it doesn't exist (caller checks existence)

Changes

  • Added resolveChromiumHistoryPath() helper with the 4-tier resolution algorithm
  • Changed Chromium browser definitions from hardcoded dbPath to rootDir
  • Display name includes profile name when not 'Default' (e.g., 'Google Chrome (Profile 7)')
  • No changes to ImportableBrowser interface — fully backward compatible
  • No changes to importFromBrowser() signature — existing callers unaffected

Testing

  • TypeScript compilation passes (tsc --noEmit)
  • Main build passes (npm run build:main)
  • Manually verified that Chrome with 'Profile 7' is now correctly detected

Previously, all Chromium-family browsers (Chrome, Arc, Brave, Edge, Vivaldi)
hardcoded 'Default/History' as the history file path. Users with non-default
Chrome profiles (e.g. 'Profile 7') could not import their browser history.

This adds resolveChromiumHistoryPath() which:
1. Reads 'Local State' to detect the last-used profile
2. Falls back to 'Default' if Local State is missing or profile has no History
3. Scans all profile subdirectories as a final fallback

The ImportableBrowser interface and importFromBrowser() signature are unchanged.
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.

Browser history import doesn't detect non-default Chrome profiles

1 participant