opus_new
This commit is contained in:
1 parent
922dd223c4
commit
fa80cc6cea
2 files changed
+96
-3
No files matched your search
@@ -224,12 +224,41 @@ async def run_browser_task(task_id: str, task: str, max_steps: int, model: str):
|
||||
existing_prefs['safebrowsing'] = {}
|
||||
existing_prefs['safebrowsing']['enabled'] = False
|
||||
|
||||
# Разрешаем cookies для всех сайтов
|
||||
existing_prefs['profile']['default_content_setting_values'] = existing_prefs.get('profile', {}).get('default_content_setting_values', {})
|
||||
existing_prefs['profile']['default_content_setting_values']['cookies'] = 1 # 1 = Allow
|
||||
|
||||
# Отключаем Tracking Protection
|
||||
if 'tracking_protection' not in existing_prefs:
|
||||
existing_prefs['tracking_protection'] = {}
|
||||
existing_prefs['tracking_protection']['block_all_3pc_toggle_enabled'] = False
|
||||
existing_prefs['tracking_protection']['tracking_protection_3pcd_enabled'] = False
|
||||
existing_prefs['tracking_protection']['tracking_protection_level'] = 0
|
||||
|
||||
with open(prefs_path, 'w') as f:
|
||||
json_mod.dump(existing_prefs, f)
|
||||
logger.info(f"[{task_id}] Chrome Preferences updated (third-party cookies allowed)")
|
||||
except Exception as e:
|
||||
logger.warning(f"[{task_id}] Could not update Chrome Preferences: {e}")
|
||||
|
||||
# Обновляем Local State для глобальных настроек cookies
|
||||
try:
|
||||
local_state_path = os.path.join(user_data_dir, "Local State")
|
||||
local_state = {}
|
||||
if os.path.exists(local_state_path):
|
||||
with open(local_state_path, 'r') as f:
|
||||
local_state = json_mod.load(f)
|
||||
|
||||
if 'browser' not in local_state:
|
||||
local_state['browser'] = {}
|
||||
local_state['browser']['enabled_labs_experiments'] = local_state.get('browser', {}).get('enabled_labs_experiments', [])
|
||||
|
||||
with open(local_state_path, 'w') as f:
|
||||
json_mod.dump(local_state, f)
|
||||
logger.info(f"[{task_id}] Local State updated")
|
||||
except Exception as e:
|
||||
logger.warning(f"[{task_id}] Could not update Local State: {e}")
|
||||
|
||||
# Удаляем файл блокировки профиля, если он остался от предыдущего запуска
|
||||
# В Linux это обычно симлинк SingletonLock
|
||||
for lock_name in ["SingletonLock", "SingletonCookie", "SingletonSocket"]:
|
||||
@@ -271,15 +300,17 @@ async def run_browser_task(task_id: str, task: str, max_steps: int, model: str):
|
||||
"--password-store=basic",
|
||||
"--use-mock-keychain",
|
||||
"--force-color-profile=srgb",
|
||||
"--disable-features=IsolateOrigins,site-per-process,ThirdPartyStoragePartitioning,BlockThirdPartyCookies",
|
||||
"--disable-features=IsolateOrigins,site-per-process,ThirdPartyStoragePartitioning,BlockThirdPartyCookies,SameSiteByDefaultCookies,CookiesWithoutSameSiteMustBeSecure,ThirdPartyPhaseout,TrackingProtection3pcd",
|
||||
"--disable-site-isolation-trials",
|
||||
"--disable-web-security",
|
||||
"--disable-notifications",
|
||||
"--disable-popup-blocking",
|
||||
"--disable-print-preview",
|
||||
"--disable-prompt-on-repost",
|
||||
"--disable-sync",
|
||||
"--no-pings",
|
||||
"--mute-audio",
|
||||
"--enable-unsafe-swiftshader", # Исправляет ошибку WebGL в Docker
|
||||
"--autoplay-policy=no-user-gesture-required",
|
||||
"--enable-unsafe-swiftshader",
|
||||
"--ignore-gpu-blocklist",
|
||||
"--enable-webgl",
|
||||
"--test-type",
|
||||
|
||||
Reference in new issue
Block a user