mirror of
https://forge.fsky.io/oneflux/omegafox.git
synced 2026-02-10 16:22:03 -08:00
pythonlib: Fix WebGL injection causing crashing 0.4.4-beta
This commit is contained in:
parent
145b737069
commit
cf3f8e6bde
5 changed files with 22 additions and 21 deletions
|
|
@ -456,10 +456,6 @@ def launch_options(
|
||||||
# Convert executable path to a Path object
|
# Convert executable path to a Path object
|
||||||
executable_path = Path(abspath(executable_path))
|
executable_path = Path(abspath(executable_path))
|
||||||
|
|
||||||
# Block WebGL by default until a fix is avaliable.
|
|
||||||
if block_webgl is None:
|
|
||||||
block_webgl = True
|
|
||||||
|
|
||||||
# Handle virtual display
|
# Handle virtual display
|
||||||
if virtual_display:
|
if virtual_display:
|
||||||
env['DISPLAY'] = virtual_display
|
env['DISPLAY'] = virtual_display
|
||||||
|
|
@ -472,6 +468,10 @@ def launch_options(
|
||||||
if os:
|
if os:
|
||||||
check_valid_os(os)
|
check_valid_os(os)
|
||||||
|
|
||||||
|
# webgl_config requires OS to be set
|
||||||
|
elif webgl_config:
|
||||||
|
raise ValueError('OS must be set when using webgl_config')
|
||||||
|
|
||||||
# Add the default addons
|
# Add the default addons
|
||||||
add_default_addons(addons, exclude_addons)
|
add_default_addons(addons, exclude_addons)
|
||||||
|
|
||||||
|
|
@ -565,19 +565,15 @@ def launch_options(
|
||||||
firefox_user_prefs['media.peerconnection.enabled'] = False
|
firefox_user_prefs['media.peerconnection.enabled'] = False
|
||||||
|
|
||||||
# Allow allow_webgl parameter for backwards compatibility
|
# Allow allow_webgl parameter for backwards compatibility
|
||||||
if block_webgl and not launch_options.pop('allow_webgl', 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')
|
||||||
else:
|
else:
|
||||||
# Warn the user about WebGL
|
|
||||||
if not i_know_what_im_doing:
|
|
||||||
print(
|
|
||||||
'NOTICE: WebGL is known to cause crashing or behave unexpectedly.'
|
|
||||||
'A fix will be avaliable soon.'
|
|
||||||
)
|
|
||||||
|
|
||||||
# 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:
|
||||||
merge_into(config, sample_webgl(target_os, *webgl_config))
|
merge_into(config, sample_webgl(target_os, *webgl_config))
|
||||||
|
else:
|
||||||
|
merge_into(config, sample_webgl(target_os))
|
||||||
|
|
||||||
# Use software rendering to be less unique
|
# Use software rendering to be less unique
|
||||||
merge_into(
|
merge_into(
|
||||||
|
|
|
||||||
|
|
@ -36,3 +36,6 @@ ff_version: >-
|
||||||
no_region: >-
|
no_region: >-
|
||||||
Because you did not pass in a locale region, Camoufox will generate one for you.
|
Because you did not pass in a locale region, Camoufox will generate one for you.
|
||||||
This can cause suspicion if your IP does not match your locale region.
|
This can cause suspicion if your IP does not match your locale region.
|
||||||
|
|
||||||
|
block_webgl: >-
|
||||||
|
Disabling WebGL is not recommended. Many WAFs will check if WebGL is enabled.
|
||||||
|
|
@ -44,21 +44,23 @@ def sample_webgl(
|
||||||
(vendor, renderer),
|
(vendor, renderer),
|
||||||
)
|
)
|
||||||
result = cursor.fetchone()
|
result = cursor.fetchone()
|
||||||
conn.close()
|
|
||||||
|
|
||||||
if not result:
|
if not result:
|
||||||
raise ValueError(f'No WebGL data found for vendor "{vendor}" and renderer "{renderer}"')
|
raise ValueError(f'No WebGL data found for vendor "{vendor}" and renderer "{renderer}"')
|
||||||
|
|
||||||
if result[3] <= 0: # Check OS-specific probability
|
if result[3] <= 0: # Check OS-specific probability
|
||||||
|
# Get a list of possible (vendor, renderer) pairs for this OS
|
||||||
|
cursor.execute(
|
||||||
|
f'SELECT DISTINCT vendor, renderer FROM webgl_fingerprints WHERE {os} > 0'
|
||||||
|
)
|
||||||
|
possible_pairs = cursor.fetchall()
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
f'Vendor "{vendor}" and renderer "{renderer}" combination not valid for {os.title()}.'
|
f'Vendor "{vendor}" and renderer "{renderer}" combination not valid for {os.title()}.\n'
|
||||||
|
f'Possible pairs: {", ".join(str(pair) for pair in possible_pairs)}'
|
||||||
)
|
)
|
||||||
|
|
||||||
return {
|
conn.close()
|
||||||
'vendor': result[0],
|
return orjson.loads(result[2])
|
||||||
'renderer': result[1],
|
|
||||||
**orjson.loads(result[2]),
|
|
||||||
}
|
|
||||||
|
|
||||||
# Get all vendor/renderer pairs and their probabilities for this OS
|
# Get all vendor/renderer pairs and their probabilities for this OS
|
||||||
cursor.execute(f'SELECT vendor, renderer, data, {os} FROM webgl_fingerprints WHERE {os} > 0')
|
cursor.execute(f'SELECT vendor, renderer, data, {os} FROM webgl_fingerprints WHERE {os} > 0')
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
|
||||||
|
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "camoufox"
|
name = "camoufox"
|
||||||
version = "0.4.3"
|
version = "0.4.4-beta"
|
||||||
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"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue