Enhance browser configuration and path retrieval

- Updated `config.py` to include a comprehensive browser configuration section, allowing for dynamic retrieval of browser paths and drivers for Chrome, Edge, Firefox, and Brave.
- Refactored `new_signup.py`, `new_tempemail.py`, and `oauth_auth.py` to utilize the new browser configuration, improving flexibility and maintainability.
- Removed deprecated `get_default_chrome_path` function and replaced it with a more generalized `get_default_browser_path` function in `utils.py`.
- Updated localization files to include new strings related to browser path validation and selection.
This commit is contained in:
yeongpin
2025-04-12 14:11:22 +08:00
parent c42d7d5422
commit db3a2032dc
7 changed files with 582 additions and 201 deletions

View File

@@ -2,7 +2,7 @@ import os
import sys
import configparser
from colorama import Fore, Style
from utils import get_user_documents_path, get_default_chrome_path, get_linux_cursor_path
from utils import get_user_documents_path, get_linux_cursor_path, get_default_driver_path, get_default_browser_path
import shutil
import datetime
@@ -29,8 +29,19 @@ def setup_config(translator=None):
# Default configuration
default_config = {
'Browser': {
'default_browser': 'chrome',
'chrome_path': get_default_browser_path('chrome'),
'edge_path': get_default_browser_path('edge'),
'firefox_path': get_default_browser_path('firefox'),
'brave_path': get_default_browser_path('brave'),
'chrome_driver_path': get_default_driver_path('chrome'),
'edge_driver_path': get_default_driver_path('edge'),
'firefox_driver_path': get_default_driver_path('firefox'),
'brave_driver_path': get_default_driver_path('brave')
},
'Chrome': {
'chromepath': get_default_chrome_path()
'chromepath': get_default_browser_path('chrome')
},
'Turnstile': {
'handle_turnstile_time': '2',