diff --git a/archivebox/plugins/singlefile/config.json b/archivebox/plugins/singlefile/config.json index ee546272..fe4962a0 100644 --- a/archivebox/plugins/singlefile/config.json +++ b/archivebox/plugins/singlefile/config.json @@ -52,6 +52,13 @@ "x-fallback": "CHECK_SSL_VALIDITY", "description": "Whether to verify SSL certificates" }, + "SINGLEFILE_CHROME_ARGS": { + "type": "array", + "items": {"type": "string"}, + "default": [], + "x-fallback": "CHROME_ARGS", + "description": "Chrome command-line arguments for SingleFile" + }, "SINGLEFILE_ARGS": { "type": "array", "items": {"type": "string"}, diff --git a/archivebox/plugins/singlefile/on_Snapshot__50_singlefile.py b/archivebox/plugins/singlefile/on_Snapshot__50_singlefile.py index c7dc1686..30c544a6 100644 --- a/archivebox/plugins/singlefile/on_Snapshot__50_singlefile.py +++ b/archivebox/plugins/singlefile/on_Snapshot__50_singlefile.py @@ -14,6 +14,7 @@ Environment variables: SINGLEFILE_USER_AGENT: User agent string (x-fallback: USER_AGENT) SINGLEFILE_COOKIES_FILE: Path to cookies file (x-fallback: COOKIES_FILE) SINGLEFILE_CHECK_SSL_VALIDITY: Whether to verify SSL certs (x-fallback: CHECK_SSL_VALIDITY) + SINGLEFILE_CHROME_ARGS: Chrome command-line arguments (x-fallback: CHROME_ARGS) SINGLEFILE_ARGS: Default SingleFile arguments (JSON array) SINGLEFILE_ARGS_EXTRA: Extra arguments to append (JSON array) """ @@ -134,6 +135,7 @@ def save_singlefile(url: str, binary: str) -> tuple[bool, str | None, str]: cookies_file = get_env('SINGLEFILE_COOKIES_FILE') or get_env('COOKIES_FILE', '') singlefile_args = get_env_array('SINGLEFILE_ARGS', []) singlefile_args_extra = get_env_array('SINGLEFILE_ARGS_EXTRA', []) + chrome_args = get_env_array('SINGLEFILE_CHROME_ARGS') or get_env_array('CHROME_ARGS', []) chrome = get_env('SINGLEFILE_CHROME_BINARY') or get_env('CHROME_BINARY', '') cmd = [binary, *singlefile_args] @@ -149,6 +151,11 @@ def save_singlefile(url: str, binary: str) -> tuple[bool, str | None, str]: elif chrome: cmd.extend(['--browser-executable-path', chrome]) + # Pass Chrome arguments (includes user-data-dir and other launch options) + if chrome_args: + # SingleFile expects --browser-args as a JSON array string + cmd.extend(['--browser-args', json.dumps(chrome_args)]) + # SSL handling if not check_ssl: cmd.append('--browser-ignore-insecure-certs')