From fb608c93da0738d10006962d92fac9ea217d8677 Mon Sep 17 00:00:00 2001 From: oneflux Date: Mon, 21 Apr 2025 20:25:42 -0700 Subject: [PATCH] remove playwright integration --- scripts/run-pw.py | 82 ------------------------------------------- settings/camoufox.cfg | 2 -- 2 files changed, 84 deletions(-) delete mode 100644 scripts/run-pw.py diff --git a/scripts/run-pw.py b/scripts/run-pw.py deleted file mode 100644 index 29a5e7f..0000000 --- a/scripts/run-pw.py +++ /dev/null @@ -1,82 +0,0 @@ -import argparse -import json -import os -import shutil -import time -from pathlib import Path - -from _mixin import find_src_dir, get_moz_target, temp_cd -from playwright.sync_api import sync_playwright - -LOCAL_PATH = Path(os.path.abspath(__file__)).parent - -CONFIG = { - 'window.outerWidth': 1920, - 'window.outerHeight': 1080, -} - - -def launch_playwright(executable_path): - """Launch playwright Firefox with unlimited time""" - with sync_playwright() as p: - print('Launching browser.', executable_path) - browser = p.firefox.launch( - executable_path=executable_path, - headless=False, - args=[ - '--stderr', - str(LOCAL_PATH / 'debug.log'), - '--config', - json.dumps(CONFIG), - ], - ) - page = browser.new_page() - url = os.getenv('URL') or 'https://google.com' - page.goto(url) - try: - time.sleep(1e9) - except: - print('Closing...') - finally: - browser.close() - - -def get_args(): - """Get CLI parameters""" - parser = argparse.ArgumentParser( - description='Package Camoufox for different operating systems.' - ) - parser.add_argument('--version', required=True, help='Camoufox version') - parser.add_argument('--release', required=True, help='Camoufox release number') - return parser.parse_args() - - -def main(): - """Run the browser with Playwright""" - args = get_args() - - src_dir = find_src_dir('.', args.version, args.release) - moz_target = get_moz_target(target='linux', arch='x86_64') - - launcher_path = os.path.abspath(os.path.join('.', 'legacy', 'launcher', 'dist', 'launch')) - - with temp_cd(src_dir): - print(f'Looking for file: obj-{moz_target}/dist/bin/camoufox-bin') - with temp_cd(f'obj-{moz_target}/dist/bin'): - if os.path.exists('camoufox-bin'): - # Copy launcher_path to . if we are using camoufox-bin - shutil.copy(launcher_path, '.') - file_name = 'launch' - elif os.path.exists('firefox-bin'): - # Or else just use firefox-bin - file_name = 'firefox-bin' - else: - raise FileNotFoundError(f'Binary not found: obj-{moz_target}/dist/bin') - file_path = os.path.abspath(f'obj-{moz_target}/dist/bin/{file_name}') - - with temp_cd(os.path.dirname(file_path)): - launch_playwright(file_path) - - -if __name__ == '__main__': - main() diff --git a/settings/camoufox.cfg b/settings/camoufox.cfg index 1493b9b..86ceaf8 100644 --- a/settings/camoufox.cfg +++ b/settings/camoufox.cfg @@ -26,8 +26,6 @@ defaultPref("gfx.content.azure.backends", "skia"); // Do not truncate pastes defaultPref("editor.truncate_user_pastes", false); -// Tweaks that undo Playwright: - // Enable content isolation (WAFs can detect this!) defaultPref("fission.autostart", true); defaultPref("fission.webContentIsolationStrategy", 2);