From 00fa0d359f26a176d8a42433038db3a884152482 Mon Sep 17 00:00:00 2001 From: Jens <1742418+1cu@users.noreply.github.com> Date: Sun, 7 Dec 2025 01:07:35 +0100 Subject: [PATCH] feat: Add Chrome 136+ safe defaults for browser configuration (#717) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## â„šī¸ Description This PR updates the default browser configuration to be safe for Chrome/Chromium 136+ out of the box. Chrome 136+ (released March 2025) requires `--user-data-dir` to be specified when using `--remote-debugging-port` for security reasons. Since nodriver relies on remote debugging, the bot needs proper defaults to avoid validation errors. **Motivation:** Eliminate Chrome 136+ configuration validation errors for fresh installations and ensure session persistence by default. ## 📋 Changes Summary - Set `browser.arguments` default to include `--user-data-dir=.temp/browser-profile` - Set `browser.user_data_dir` default to `.temp/browser-profile` (previously `None`) - Regenerated JSON schema (`config.schema.json`) with new defaults **Benefits:** - ✅ Chrome 136+ compatible out of the box (no validation errors) - ✅ Browser session/cookies persist across runs (better UX) - ✅ Consistent with existing `.temp` directory pattern (update state, caches) - ✅ Already gitignored - no accidental commits of browser profiles **No breaking changes:** Existing configs with explicit `browser.arguments: []` continue to work (users can override defaults). ### âš™ī¸ Type of Change - [x] ✨ New feature (adds new functionality without breaking existing usage) ## ✅ Checklist - [x] I have reviewed my changes to ensure they meet the project's standards. - [x] I have tested my changes and ensured that all tests pass (`pdm run test`). - [x] I have formatted the code (`pdm run format`). - [x] I have verified that linting passes (`pdm run lint`). - [x] I have updated documentation where necessary. By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice. ## Summary by CodeRabbit * **Bug Fixes** * Standardized browser profile configuration with improved default user data directory settings. âœī¸ Tip: You can customize this high-level summary in your review settings. --- schemas/config.schema.json | 2 +- src/kleinanzeigen_bot/model/config_model.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/schemas/config.schema.json b/schemas/config.schema.json index 7f288b7..0c639fe 100644 --- a/schemas/config.schema.json +++ b/schemas/config.schema.json @@ -152,7 +152,7 @@ "type": "null" } ], - "default": null, + "default": ".temp/browser-profile", "description": "See https://github.com/chromium/chromium/blob/main/docs/user_data_dir.md", "title": "User Data Dir" }, diff --git a/src/kleinanzeigen_bot/model/config_model.py b/src/kleinanzeigen_bot/model/config_model.py index a4fab8f..552a49a 100644 --- a/src/kleinanzeigen_bot/model/config_model.py +++ b/src/kleinanzeigen_bot/model/config_model.py @@ -80,7 +80,7 @@ class DownloadConfig(ContextualModel): class BrowserConfig(ContextualModel): arguments:List[str] = Field( - default_factory = list, + default_factory = lambda: ["--user-data-dir=.temp/browser-profile"], description = "See https://peter.sh/experiments/chromium-command-line-switches/" ) binary_location:str | None = Field( @@ -93,7 +93,7 @@ class BrowserConfig(ContextualModel): ) use_private_window:bool = True user_data_dir:str | None = Field( - default = None, + default = ".temp/browser-profile", description = "See https://github.com/chromium/chromium/blob/main/docs/user_data_dir.md" ) profile_name:str | None = None