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_images: Optional[bool] = None,
block_webrtc: Optional[bool] = None, block_webrtc: Optional[bool] = None,
block_webgl: Optional[bool] = None, block_webgl: Optional[bool] = None,
disable_coop: Optional[bool] = None,
webgl_config: Optional[Tuple[str, str]] = None, webgl_config: Optional[Tuple[str, str]] = None,
geoip: Optional[Union[str, bool]] = None, geoip: Optional[Union[str, bool]] = None,
humanize: Optional[Union[bool, float]] = None, humanize: Optional[Union[bool, float]] = None,
@ -383,6 +384,9 @@ def launch_options(
Whether to block WebRTC entirely. Whether to block WebRTC entirely.
block_webgl (Optional[bool]): block_webgl (Optional[bool]):
Whether to block WebGL. To prevent leaks, only use this for special cases. 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]]): geoip (Optional[Union[str, bool]]):
Calculate longitude, latitude, timezone, country, & locale based on the IP address. 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. 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 firefox_user_prefs['permissions.default.image'] = 2
if block_webrtc: if block_webrtc:
firefox_user_prefs['media.peerconnection.enabled'] = False 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 # Allow allow_webgl parameter for backwards compatibility
if block_webgl or launch_options.pop('allow_webgl', True) is False: if block_webgl or launch_options.pop('allow_webgl', True) is False:
firefox_user_prefs['webgl.disabled'] = True firefox_user_prefs['webgl.disabled'] = True
LeakWarning.warn('block_webgl') LeakWarning.warn('block_webgl', i_know_what_im_doing)
else: else:
# If the user has provided a specific WebGL vendor/renderer pair, use it # If the user has provided a specific WebGL vendor/renderer pair, use it
if webgl_config: if webgl_config:

View file

@ -43,3 +43,6 @@ block_webgl: >-
custom_fonts_only: >- custom_fonts_only: >-
Disabling OS-specific fonts while spoofing your OS will make your browser fingerprint inconsistent. 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. 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] [tool.poetry]
name = "camoufox" name = "camoufox"
version = "0.4.9" version = "0.4.10"
description = "Wrapper around Playwright to help launch Camoufox" description = "Wrapper around Playwright to help launch Camoufox"
authors = ["daijro <daijro.dev@gmail.com>"] authors = ["daijro <daijro.dev@gmail.com>"]
license = "MIT" license = "MIT"