diff --git a/.goosehints b/.goosehints new file mode 100644 index 0000000..694e293 --- /dev/null +++ b/.goosehints @@ -0,0 +1,18 @@ +Summary of the Program and Its Architecture: + +1. README.md: + • Introduces the purpose: to support the Mautrix Google Chat Authentication Process. + • Details manual steps to log in to https://chat.google.com, inspect browser cookies (COMPASS, SSID, SID, OSID, HSID) using Developer Tools, and form them into a JSON payload that is then sent to a bot to enable automated portal creation in chats. + +2. selenium_cookie_extractor_json.py: + • Uses Selenium with Chrome in incognito mode to open https://chat.google.com. + • The user is guided to log in and verify the necessary cookies via the browser’s Developer Tools. + • Once the user presses Enter, the script extracts all cookies, filters for the target cookies (with special handling for the COMPASS cookie by selecting the one with path "/" if present), and then outputs a JSON object with these cookie values. + • This JSON output can be used in further automation steps with a bot. + +3. flake.nix: + • Provides a Nix development shell configuration which ensures a reproducible environment. + • Specifies dependencies: Python3, Selenium, and Chromedriver, ensuring that the proper tools are available in the development environment. + +Overall Architecture: + • The repository is architected around a single-purpose automation tool to simplify cookie extraction for Google Chat authentication, with supporting documentation (README.md) and a reproducible development environment (flake.nix). diff --git a/README.md b/README.md new file mode 100644 index 0000000..5e1afdc --- /dev/null +++ b/README.md @@ -0,0 +1,30 @@ +# Google Cookie Retrieval + +This is a simple Selenium script used to quickly run through the [Mautrix Google Chat Authentication Process](https://docs.mau.fi/bridges/python/googlechat/authentication.html). + +It was written primarily with [goose](https://github.com/block/goose) (honk!). + +## The goal: Automate this +1. Open a private chat with the bridge bot. Usually @googlechatbot:your.server. + - If the bot doesn't accept the invite, see the troubleshooting page + +1. Open https://chat.google.com in a private browser window and log in normally, then extract cookies: + 1. Press F12 to open developer tools. + 1. select the "Application" (Chrome) or "Storage" (Firefox) tab. + 1. In the sidebar, expand "Cookies" and select https://chat.google.com. + 1. In the cookie list, find the COMPASS, SSID, SID, OSID and HSID rows. + - When using Firefox, you may have multiple COMPASS cookies with different paths. Pick the one where path is /. + 1. Form a JSON object with the extracted cookies. It should look something like this (field names are case-insensitive): + ```json + { + "compass": "dynamite-ui=...", + "ssid": "...", + "sid": "...", + "osid": "...", + "hsid": "..." + } + ``` + 1. Close the browser window to prevent the cookies being invalidated (Google uses refresh tokens, so you need to close the window within a few minutes). +1. Send login-cookie {the json object} to the bot. + +Recent chats should now get portals automatically. Other chats will get portals as you receive messages.