Skip to content

Commit

Permalink
isolate mitmconfig within ~/.local/share/octotail
Browse files Browse the repository at this point in the history
  • Loading branch information
rarescosma committed Oct 16, 2024
1 parent 1e48831 commit 5ea2bb7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion octotail/mitm.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@
from argparse import Namespace
from contextlib import suppress
from dataclasses import dataclass
from pathlib import Path
from queue import Empty
from threading import Event
from typing import List

from mitmproxy.tools.main import mitmdump
from pykka import ActorRef, ThreadingActor
from xdg.BaseDirectory import xdg_data_home

from octotail.utils import Ok, Result, Retry, debug, is_port_open, retries

MITM_CONFIG_DIR = Path(xdg_data_home) / "octotail" / "mitmproxy"
MARKERS = Namespace(
ws_header="WebSocket text message",
ws_host="alive.github.com",
Expand Down Expand Up @@ -102,7 +105,9 @@ def _extract_job_id(buffer: str) -> int | None:


def _mitmdump_wrapper(q: multiprocessing.Queue, port: int) -> None:
sys.argv = f"mitmdump --flow-detail=4 --no-rawtcp -p {port}".split()
sys.argv = (
f"mitmdump --flow-detail=4 --no-rawtcp -p {port} --set confdir={MITM_CONFIG_DIR}".split()
)
setattr(sys.stdout, "isatty", lambda: False)
setattr(sys.stdout, "write", q.put)
mitmdump()
Expand Down

0 comments on commit 5ea2bb7

Please sign in to comment.