aboutsummaryrefslogtreecommitdiff
path: root/src/hydrilla/mitmproxy_launcher/launch.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/hydrilla/mitmproxy_launcher/launch.py')
-rw-r--r--src/hydrilla/mitmproxy_launcher/launch.py15
1 files changed, 4 insertions, 11 deletions
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: