mirror of
https://github.com/daijro/camoufox.git
synced 2026-08-26 08:00:18 +00:00
v150 with Windows Support - Python Package Being Merged Separately (#611)
* fix v150 patches * screen related patch fixes * fix juggler issues with 150 * Update grading.py improved build tester scoring * fix windows build for v150 - scripts/_mixin.py: switch moz_target from x86_64-pc-mingw32 (no longer supported in FF150) to x86_64-pc-windows-msvc - additions/juggler/screencast/HeadlessWindowCapturer.h: typedef pid_t on XP_WIN; libwebrtc headers (video_capture.h, desktop_capturer.h) reference pid_t which is POSIX-only - patches/anti-font-fingerprinting.patch: include mozilla/dom/Document.h in gfxTextRun.cpp; on Windows it is not transitively included so doc->GetInnerWindow() failed with "incomplete type 'Document'" Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * make service test use local binary * updated ff fingerprint versions * Update README.md --------- Co-authored-by: Ubuntu <ubuntu@ip-172-31-15-96.us-east-2.compute.internal> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -22,7 +22,10 @@ FP_GENERATOR = FingerprintGenerator(browser='firefox', os=('linux', 'macos', 'wi
|
||||
|
||||
# Bundled real fingerprint presets
|
||||
PRESETS_FILE = Path(__file__).parent / 'fingerprint-presets.json'
|
||||
_PRESETS_CACHE: Optional[Dict] = None
|
||||
PRESETS_V150_FILE = Path(__file__).parent / 'fingerprint-presets-v150.json'
|
||||
# Firefox major version at which the v150 preset bundle becomes preferred.
|
||||
PRESETS_V150_MIN_FF = 149
|
||||
_PRESETS_CACHE: Dict[Path, Dict] = {}
|
||||
|
||||
# CreepJS OS marker fonts used for OS detection
|
||||
_MACOS_MARKER_FONTS = [
|
||||
@@ -184,16 +187,32 @@ def _generate_random_voice_subset(target_os: str) -> List[str]:
|
||||
return result
|
||||
|
||||
|
||||
def load_presets() -> Optional[Dict]:
|
||||
def _select_presets_file(ff_version: Optional[Any] = None) -> Path:
|
||||
"""Pick the bundled-presets file appropriate for a given Firefox version.
|
||||
|
||||
For Firefox >= PRESETS_V150_MIN_FF, prefer the v150 bundle (real
|
||||
fingerprints scraped from contemporary browsers); otherwise fall back to
|
||||
the original bundle.
|
||||
"""
|
||||
try:
|
||||
major = int(str(ff_version).split('.', 1)[0]) if ff_version else 0
|
||||
except (ValueError, TypeError):
|
||||
major = 0
|
||||
if major >= PRESETS_V150_MIN_FF and PRESETS_V150_FILE.exists():
|
||||
return PRESETS_V150_FILE
|
||||
return PRESETS_FILE
|
||||
|
||||
|
||||
def load_presets(ff_version: Optional[Any] = None) -> Optional[Dict]:
|
||||
"""Load bundled fingerprint presets from JSON file."""
|
||||
global _PRESETS_CACHE
|
||||
if _PRESETS_CACHE is not None:
|
||||
return _PRESETS_CACHE
|
||||
if not PRESETS_FILE.exists():
|
||||
path = _select_presets_file(ff_version)
|
||||
if path in _PRESETS_CACHE:
|
||||
return _PRESETS_CACHE[path]
|
||||
if not path.exists():
|
||||
return None
|
||||
with open(PRESETS_FILE) as f:
|
||||
_PRESETS_CACHE = json.load(f)
|
||||
return _PRESETS_CACHE
|
||||
with open(path) as f:
|
||||
_PRESETS_CACHE[path] = json.load(f)
|
||||
return _PRESETS_CACHE[path]
|
||||
|
||||
|
||||
# Map OS names to preset keys
|
||||
@@ -209,12 +228,13 @@ _OS_TO_PRESET_KEY = {
|
||||
|
||||
def get_random_preset(
|
||||
os: Optional[str] = None,
|
||||
ff_version: Optional[Any] = None,
|
||||
) -> Optional[Dict]:
|
||||
"""
|
||||
Get a random preset for the given OS.
|
||||
Returns None if no presets are available.
|
||||
"""
|
||||
presets = load_presets()
|
||||
presets = load_presets(ff_version)
|
||||
if not presets:
|
||||
return None
|
||||
|
||||
|
||||
@@ -591,7 +591,7 @@ def launch_options(
|
||||
if isinstance(fingerprint_preset, dict):
|
||||
preset = fingerprint_preset
|
||||
else:
|
||||
preset = get_random_preset(os=os)
|
||||
preset = get_random_preset(os=os, ff_version=ff_version_str)
|
||||
if preset:
|
||||
merge_into(config, from_preset(preset, ff_version_str))
|
||||
_used_preset = True
|
||||
|
||||
Reference in New Issue
Block a user