mirror of
https://github.com/garrytan/gstack.git
synced 2026-05-06 21:46:40 +02:00
fix: prefer account email over generic profile name in picker
Chrome profiles signed into a Google account often have generic display names like "Person 2". Check account_info[0].email first for a more readable label, falling back to profile.name as before. Addresses review feedback from @ngurney. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -152,15 +152,22 @@ export function listProfiles(browserName: string): ProfileEntry[] {
|
||||
const cookiePath = path.join(browserDir, entry.name, 'Cookies');
|
||||
if (!fs.existsSync(cookiePath)) continue;
|
||||
|
||||
// Try to read display name from Preferences
|
||||
// Try to read display name from Preferences.
|
||||
// Prefer account email — signed-in Chrome profiles often have generic
|
||||
// names like "Person 2" while the email is far more readable.
|
||||
let displayName = entry.name;
|
||||
try {
|
||||
const prefsPath = path.join(browserDir, entry.name, 'Preferences');
|
||||
if (fs.existsSync(prefsPath)) {
|
||||
const prefs = JSON.parse(fs.readFileSync(prefsPath, 'utf-8'));
|
||||
const profileName = prefs?.profile?.name;
|
||||
if (profileName && typeof profileName === 'string') {
|
||||
displayName = profileName;
|
||||
const email = prefs?.account_info?.[0]?.email;
|
||||
if (email && typeof email === 'string') {
|
||||
displayName = email;
|
||||
} else {
|
||||
const profileName = prefs?.profile?.name;
|
||||
if (profileName && typeof profileName === 'string') {
|
||||
displayName = profileName;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user