diff options
Diffstat (limited to 'src/hydrilla')
-rw-r--r-- | src/hydrilla/mitmproxy_launcher/addon_script.py.mitmproxy | 9 | ||||
-rw-r--r-- | src/hydrilla/mitmproxy_launcher/launch.py | 15 |
2 files changed, 13 insertions, 11 deletions
diff --git a/src/hydrilla/mitmproxy_launcher/addon_script.py.mitmproxy b/src/hydrilla/mitmproxy_launcher/addon_script.py.mitmproxy new file mode 100644 index 0000000..fe853d1 --- /dev/null +++ b/src/hydrilla/mitmproxy_launcher/addon_script.py.mitmproxy @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: CC0-1.0 + +# Copyright (C) 2022 Wojtek Kosior <koszko@koszko.org> +# +# Available under the terms of Creative Commons Zero v1.0 Universal. + +from hydrilla.proxy.addon import HaketiloAddon + +addons = [HaketiloAddon()] diff --git a/src/hydrilla/mitmproxy_launcher/launch.py b/src/hydrilla/mitmproxy_launcher/launch.py index 2f706fd..3b7749d 100644 --- a/src/hydrilla/mitmproxy_launcher/launch.py +++ b/src/hydrilla/mitmproxy_launcher/launch.py @@ -45,16 +45,13 @@ from .. import _version from ..translations import smart_gettext as _ +here = Path(__file__).resolve().parent + + xdg_state_home = os.environ.get('XDG_STATE_HOME', '.local/state') default_dir = str(Path.home() / xdg_state_home / 'haketilo') old_default_dir_path = Path.home() / '.haketilo/' -addon_script_text = ''' -from hydrilla.proxy.addon import HaketiloAddon - -addons = [HaketiloAddon()] -''' - @click.command(help=_('cli_help.haketilo')) @click.option('-l', '--listen-host', default='127.0.0.1', type=click.STRING, help=_('cli_opt.haketilo.listen_host')) @@ -83,10 +80,6 @@ def launch(listen_host: str, port: int, launch_browser: bool, directory: str) \ directory_path.mkdir(parents=True, exist_ok=True) - script_path = directory_path / 'addon.py' - - script_path.write_text(addon_script_text) - launch_browser_str = 'true' if launch_browser else 'false' sys.argv = [ @@ -100,7 +93,7 @@ def launch(listen_host: str, port: int, launch_browser: bool, directory: str) \ '--set', f'haketilo_listen_host={listen_host}', '--set', f'haketilo_listen_port={port}', '--set', f'haketilo_launch_browser={launch_browser_str}', - '--scripts', str(script_path) + '--scripts', str(here / 'addon_script.py.mitmproxy') ] for entry_point in distribution('mitmproxy').entry_points: |