Skip to content

Comments

feat: show which Google account is used for Gemini Web search#5

Open
guilhermesilveira wants to merge 2 commits intonicobailon:mainfrom
guilhermesilveira:feat/show-google-account
Open

feat: show which Google account is used for Gemini Web search#5
guilhermesilveira wants to merge 2 commits intonicobailon:mainfrom
guilhermesilveira:feat/show-google-account

Conversation

@guilhermesilveira
Copy link

Summary

When multiple Google accounts are signed into Chrome, it's not obvious which one is being used for Gemini Web searches. This PR makes the active account visible.

What changed

chrome-cookies.ts

Added getActiveGoogleEmail(cookies) — queries accounts.google.com/ListAccounts (the same endpoint Chrome uses internally) to discover the primary account email. No extra dependencies.

gemini-web.ts

isGeminiWebAvailable() now returns { cookies, email } instead of just CookieMap. The email is fetched once alongside cookie validation.

index.ts

Added /google-account command that shows which Google account is active:

  • Gemini Web using: user@gmail.com
  • Or a warning if cookies are missing / email can't be determined

All callers updated

gemini-search.ts, gemini-url-context.ts, video-extract.ts, youtube-extract.ts — all updated to use availability.cookies pattern. No behavior change.

Add getActiveGoogleEmail() that queries accounts.google.com/ListAccounts
to discover the primary Google account email from the Chrome cookies.

Changes:
- chrome-cookies.ts: add getActiveGoogleEmail(cookies) function
- gemini-web.ts: isGeminiWebAvailable() now returns { cookies, email }
- index.ts: add /google-account command to show active account
- Update all callers to use availability.cookies pattern

The /google-account command shows which email is being used for
Gemini Web searches, so users with multiple Google accounts know
exactly which one is active.
…tAccounts

The ListAccounts endpoint (accounts.google.com) returns 400 because the
cookies needed for that endpoint (LSID, __Host-1PLSID, __Host-GAPS, etc.)
are not in the ALL_COOKIE_NAMES allowlist and are never sent.

Instead, extract the email from the gemini.google.com/app HTML page, which
already embeds the logged-in user's email and authenticates with the cookies
we do have (__Secure-1PSID, SID, HSID, etc.). The ListAccounts approach is
kept as a fallback.
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