mirror of
https://forge.fsky.io/oneflux/omegafox.git
synced 2026-02-11 03:42:05 -08:00
pythonlib: Fix out of bounds screen values 0.1.0b4
This commit is contained in:
parent
9c3e6918cf
commit
4eb559f043
3 changed files with 8 additions and 5 deletions
|
|
@ -5,13 +5,13 @@ from browserforge.fingerprints import Fingerprint, FingerprintGenerator
|
||||||
from yaml import CLoader, load
|
from yaml import CLoader, load
|
||||||
|
|
||||||
# Load the browserforge.yaml file
|
# Load the browserforge.yaml file
|
||||||
with open(os.path.join(os.path.dirname(__file__), 'browserforge.yaml'), 'r') as f:
|
with open(os.path.join(os.path.dirname(__file__), 'browserforge.yml'), 'r') as f:
|
||||||
BROWSERFORGE_DATA = load(f, Loader=CLoader)
|
BROWSERFORGE_DATA = load(f, Loader=CLoader)
|
||||||
|
|
||||||
FP_GENERATOR = FingerprintGenerator(browser='firefox', os=('linux', 'macos', 'windows'))
|
FP_GENERATOR = FingerprintGenerator(browser='firefox', os=('linux', 'macos', 'windows'))
|
||||||
|
|
||||||
|
|
||||||
def _cast_to_properties(camoufox_data, cast_enum: dict, bf_dict: dict):
|
def _cast_to_properties(camoufox_data: dict, cast_enum: dict, bf_dict: dict) -> None:
|
||||||
"""
|
"""
|
||||||
Casts Browserforge fingerprints to Camoufox config properties.
|
Casts Browserforge fingerprints to Camoufox config properties.
|
||||||
"""
|
"""
|
||||||
|
|
@ -26,7 +26,10 @@ def _cast_to_properties(camoufox_data, cast_enum: dict, bf_dict: dict):
|
||||||
# If the value is a dictionary, recursively recall
|
# If the value is a dictionary, recursively recall
|
||||||
if isinstance(data, dict):
|
if isinstance(data, dict):
|
||||||
_cast_to_properties(camoufox_data, type_key, data)
|
_cast_to_properties(camoufox_data, type_key, data)
|
||||||
else:
|
continue
|
||||||
|
# Fix values that are out of bounds
|
||||||
|
if type_key.startswith("screen.") and isinstance(data, int) and data < 0:
|
||||||
|
data = 0
|
||||||
camoufox_data[type_key] = data
|
camoufox_data[type_key] = data
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
|
||||||
|
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "camoufox"
|
name = "camoufox"
|
||||||
version = "0.1.0b3"
|
version = "0.1.0b4"
|
||||||
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