076914e5b7
- Split client, native, remote, serve, markdown, and SDK internals into focused packages with direct imports. - Move local and remote transport framing/protocol helpers behind clearer module boundaries. - Break up the extension injected DOM logic into a separate content dispatch bundle and dedicated content modules. - Add explicit client handling for passive remote discovery without noisy PQ warnings. - Keep behavior covered with updated unit, integration, and extension tests.
95 lines
2.8 KiB
Python
95 lines
2.8 KiB
Python
"""Project-wide constants for browser-cli.
|
|
|
|
Only static values live here. Runtime-derived state (e.g. installed version,
|
|
open sockets, locks) stays in the owning module.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
from pathlib import Path
|
|
|
|
APP_NAME = "browser-cli"
|
|
RUNTIME_DIRNAME = ".browser_cli"
|
|
DEFAULT_ALIAS = "default"
|
|
|
|
NATIVE_HOST_NAME = "com.browsercli.host"
|
|
EXTENSION_ID = "bfpmkhngkjnfhabmfckgeohlilokodkg"
|
|
SUPPORTED_BROWSERS = ["chrome", "chromium", "brave", "edge", "vivaldi"]
|
|
|
|
PROTOCOL_MIN_CLIENT = "0.9.0"
|
|
MAX_MSG_BYTES = 32 * 1024 * 1024
|
|
DEFAULT_REMOTE_PORT = 443
|
|
DEFAULT_PAGE_SIZE = 100
|
|
DEFAULT_TRANSPORT_THRESHOLD = 512
|
|
|
|
NO_ROUTE_COMMANDS = {"browser-cli.targets", "browser-cli.auth.keys", "browser-cli.auth.trust"}
|
|
GENTLE_MODES = ["auto", "normal", "gentle", "ultra"]
|
|
|
|
PAGEABLE_COMMANDS = {
|
|
"tabs.list",
|
|
"tabs.filter",
|
|
"tabs.query",
|
|
"group.list",
|
|
"group.tabs",
|
|
"group.query",
|
|
"windows.list",
|
|
"dom.query",
|
|
"dom.text",
|
|
"dom.attr",
|
|
"extract.links",
|
|
"extract.images",
|
|
"extract.json",
|
|
"cookies.list",
|
|
"session.list",
|
|
}
|
|
|
|
NATIVE_HOST_DIRS = {
|
|
"chrome": {
|
|
"linux": [Path.home() / ".config/google-chrome/NativeMessagingHosts"],
|
|
"darwin": [Path.home() / "Library/Application Support/Google/Chrome/NativeMessagingHosts"],
|
|
},
|
|
"chromium": {
|
|
"linux": [Path.home() / ".config/chromium/NativeMessagingHosts"],
|
|
"darwin": [Path.home() / "Library/Application Support/Chromium/NativeMessagingHosts"],
|
|
},
|
|
"brave": {
|
|
"linux": [Path.home() / ".config/BraveSoftware/Brave-Browser/NativeMessagingHosts"],
|
|
"darwin": [Path.home() / "Library/Application Support/BraveSoftware/Brave-Browser/NativeMessagingHosts"],
|
|
},
|
|
"edge": {
|
|
"linux": [Path.home() / ".config/microsoft-edge/NativeMessagingHosts"],
|
|
"darwin": [Path.home() / "Library/Application Support/Microsoft Edge/NativeMessagingHosts"],
|
|
},
|
|
"vivaldi": {
|
|
"linux": [Path.home() / ".config/vivaldi/NativeMessagingHosts"],
|
|
"darwin": [Path.home() / "Library/Application Support/Vivaldi/NativeMessagingHosts"],
|
|
},
|
|
}
|
|
|
|
WINDOWS_NATIVE_HOST_REGISTRY_KEYS = {
|
|
"chrome": [r"Software\Google\Chrome\NativeMessagingHosts"],
|
|
"chromium": [r"Software\Chromium\NativeMessagingHosts"],
|
|
"brave": [r"Software\BraveSoftware\Brave-Browser\NativeMessagingHosts"],
|
|
"edge": [r"Software\Microsoft\Edge\NativeMessagingHosts"],
|
|
"vivaldi": [r"Software\Vivaldi\NativeMessagingHosts"],
|
|
}
|
|
|
|
CONFIG_DIR = Path(os.environ.get("XDG_CONFIG_HOME", str(Path.home() / ".config"))) / APP_NAME
|
|
DEFAULT_KEY_PATH = CONFIG_DIR / "client.key.pem"
|
|
DEFAULT_AUTHORIZED_KEYS_PATH = CONFIG_DIR / "authorized_keys"
|
|
|
|
SSH_AGENTC_REQUEST_IDENTITIES = 11
|
|
SSH_AGENT_IDENTITIES_ANSWER = 12
|
|
SSH_AGENTC_SIGN_REQUEST = 13
|
|
SSH_AGENT_SIGN_RESPONSE = 14
|
|
|
|
PQ_KEX_ALG = "ML-KEM-768"
|
|
PQ_TRANSPORT_ALG = "ML-KEM-768+ChaCha20Poly1305"
|
|
|
|
SER_JSON = 0
|
|
SER_MSGPACK = 1
|
|
COMP_NONE = 0
|
|
COMP_ZLIB = 1
|
|
COMP_GZIP = 2
|
|
COMP_ZSTD = 3
|