Add transport policy config

This commit is contained in:
jwinterm
2026-07-05 20:30:33 -04:00
parent 237d1e4fcb
commit ba620e32ca
14 changed files with 406 additions and 20 deletions
+11 -6
View File
@@ -2,12 +2,10 @@ from __future__ import annotations
from dataclasses import dataclass
from .config import AppConfig, default_config
from .plan import BrowsePlan, plan_url
PROFILE_ROOT = ".ampb/profiles"
@dataclass(frozen=True)
class OpenPlan:
browse_plan: BrowsePlan
@@ -20,9 +18,16 @@ class OpenPlan:
message: str
def prepare_open(raw_url: str, *, consent: bool = False, dry_run: bool = True) -> OpenPlan:
browse_plan = plan_url(raw_url)
profile_path = f"{PROFILE_ROOT}/{browse_plan.route.profile}"
def prepare_open(
raw_url: str,
*,
consent: bool = False,
dry_run: bool = True,
config: AppConfig | None = None,
) -> OpenPlan:
config = config or default_config()
browse_plan = plan_url(raw_url, config=config)
profile_path = config.profile_path(browse_plan.route.profile)
proxy = _proxy_for(browse_plan)
if browse_plan.action.startswith("blocked"):