mirror of
https://github.com/Such-Software/adaptive-multi-protocol-browser.git
synced 2026-10-18 23:08:33 +02:00
Add transport policy config
This commit is contained in:
+11
-6
@@ -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"):
|
||||
|
||||
Reference in New Issue
Block a user