Personal-use NixOS configuration
at main 33 lines 1.4 kB view raw
1diff --git a/playwright_captcha/utils/camoufox_add_init_script/add_init_script.py b/playwright_captcha/utils/camoufox_add_init_script/add_init_script.py 2index e8f2dce..3a97f65 100644 3--- a/playwright_captcha/utils/camoufox_add_init_script/add_init_script.py 4+++ b/playwright_captcha/utils/camoufox_add_init_script/add_init_script.py 5@@ -5,6 +5,9 @@ from pathlib import Path 6 7 import aiofiles 8 9+from platformdirs import user_cache_dir 10+ 11+INSTALL_DIR: Path = Path(user_cache_dir("playwright-captcha")) 12 13 def get_addon_path(): 14 """Get the absolute path to the addon's directory""" 15@@ -27,7 +30,7 @@ async def add_init_script(js_script_string: str, addon_path: str = 'addon') -> s 16 """ 17 18 # create the scripts directory if it doesn't exist 19- scripts_dir = os.path.join(addon_path, 'scripts') 20+ scripts_dir = os.path.join(INSTALL_DIR, 'scripts') 21 os.makedirs(scripts_dir, exist_ok=True) 22 23 # generate hash for the script 24@@ -67,7 +70,7 @@ def clean_scripts(addon_path: str = 'addon') -> None: 25 :param addon_path: Path to the addon's directory 26 """ 27 28- scripts_dir = os.path.join(addon_path, 'scripts') 29+ scripts_dir = os.path.join(INSTALL_DIR, 'scripts') 30 if os.path.exists(scripts_dir): 31 for filename in os.listdir(scripts_dir): 32 file_path = os.path.join(scripts_dir, filename) 33 from platformdirs import user_cache_dir