pythonlib: Add COOP toggle (workaround for #150) 0.4.10

This commit is contained in:
daijro 2025-01-25 18:02:40 -06:00
parent 33085c90f3
commit a9b1934790
3 changed files with 13 additions and 3 deletions

View file

@ -341,6 +341,7 @@ def launch_options(
block_images: Optional[bool] = None,
block_webrtc: Optional[bool] = None,
block_webgl: Optional[bool] = None,
disable_coop: Optional[bool] = None,
webgl_config: Optional[Tuple[str, str]] = None,
geoip: Optional[Union[str, bool]] = None,
humanize: Optional[Union[bool, float]] = None,
@ -383,6 +384,9 @@ def launch_options(
Whether to block WebRTC entirely.
block_webgl (Optional[bool]):
Whether to block WebGL. To prevent leaks, only use this for special cases.
disable_coop (Optional[bool]):
Disables the Cross-Origin-Opener-Policy, allowing elements in cross-origin iframes,
such as the Turnstile checkbox, to be clicked.
geoip (Optional[Union[str, bool]]):
Calculate longitude, latitude, timezone, country, & locale based on the IP address.
Pass the target IP address to use, or `True` to find the IP address automatically.
@ -587,11 +591,14 @@ def launch_options(
firefox_user_prefs['permissions.default.image'] = 2
if block_webrtc:
firefox_user_prefs['media.peerconnection.enabled'] = False
if disable_coop:
LeakWarning.warn('disable_coop', i_know_what_im_doing)
firefox_user_prefs['browser.tabs.remote.useCrossOriginOpenerPolicy'] = False
# Allow allow_webgl parameter for backwards compatibility
if block_webgl or launch_options.pop('allow_webgl', True) is False:
firefox_user_prefs['webgl.disabled'] = True
LeakWarning.warn('block_webgl')
LeakWarning.warn('block_webgl', i_know_what_im_doing)
else:
# If the user has provided a specific WebGL vendor/renderer pair, use it
if webgl_config:

View file

@ -43,3 +43,6 @@ block_webgl: >-
custom_fonts_only: >-
Disabling OS-specific fonts while spoofing your OS will make your browser fingerprint inconsistent.
WAFs can detect this mismatch between your claimed OS and available system fonts.
disable_coop: >-
Disabling Cross-Origin-Opener-Policy (COOP) handling can potentially be detected by sophisticated WAFs.

View file

@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
[tool.poetry]
name = "camoufox"
version = "0.4.9"
version = "0.4.10"
description = "Wrapper around Playwright to help launch Camoufox"
authors = ["daijro <daijro.dev@gmail.com>"]
license = "MIT"