pythonlib: Hotfix screen property out of bounds 0.2.11

Adds back handling for when Browserforge screen properties are out of bounds.
This commit is contained in:
daijro 2024-10-09 06:20:57 -05:00
parent b2f74a24f3
commit 76bedb5251
2 changed files with 4 additions and 1 deletions

View file

@ -31,6 +31,9 @@ def _cast_to_properties(
if isinstance(data, dict): if isinstance(data, dict):
_cast_to_properties(camoufox_data, type_key, data, ff_version) _cast_to_properties(camoufox_data, type_key, data, ff_version)
continue continue
# Fix values that are out of bounds
if type_key.startswith("screen.") and isinstance(data, int) and data < 0:
data = 0
# Replace the Firefox versions with ff_version # Replace the Firefox versions with ff_version
if ff_version and isinstance(data, str): if ff_version and isinstance(data, str):
data = re.sub(r'(?<!\d)(1[0-9]{2})(\.0)(?!\d)', rf'{ff_version}\2', data) data = re.sub(r'(?<!\d)(1[0-9]{2})(\.0)(?!\d)', rf'{ff_version}\2', data)

View file

@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
[tool.poetry] [tool.poetry]
name = "camoufox" name = "camoufox"
version = "0.2.10" version = "0.2.11"
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"