Two authz behaviours were hard-coded on Platform.QQBOT/TELEGRAM/... in gateway/authz_mixin.py (_GROUP_CHAT_ENV, _ALLOWLIST_SUPPRESSES_PAIRING), so a plugin-registered platform could not get them and removing the bundled QQ adapter would silently drop QQ_GROUP_ALLOWED_USERS gating and change pairing. PlatformEntry gains group_allowed_chats_env and allowlist_suppresses_pairing; authz_mixin reads them through authz_field (live entry, else the bundled gateway_env.AUTHZ). Every bundled platform that was in the old tables declares them in its AUTHZ, so behaviour is unchanged.
32 lines
1.6 KiB
Python
32 lines
1.6 KiB
Python
"""BlueBubbles (iMessage) env -> gateway config bridge (``PlatformEntry.env_overrides``)."""
|
|
|
|
from gateway.config import Platform
|
|
from gateway.platform_env import EnvCred, home_step, int_or, mention_patterns, strip_slash, truthy_token
|
|
from utils import is_truthy_value
|
|
|
|
ENV_ENABLE_CREDENTIALS = ("BLUEBUBBLES_SERVER_URL", "BLUEBUBBLES_PASSWORD")
|
|
# ``require_mention`` is always written: an unset env reads as "" -> False.
|
|
ENV_OVERRIDES = (
|
|
EnvCred(
|
|
Platform.BLUEBUBBLES, ("BLUEBUBBLES_SERVER_URL", "BLUEBUBBLES_PASSWORD"),
|
|
fixed=(
|
|
("server_url", "BLUEBUBBLES_SERVER_URL", "", strip_slash), ("password", "BLUEBUBBLES_PASSWORD"),
|
|
("webhook_host", "BLUEBUBBLES_WEBHOOK_HOST", "127.0.0.1"),
|
|
("webhook_port", "BLUEBUBBLES_WEBHOOK_PORT", "", int_or(8645)),
|
|
("webhook_path", "BLUEBUBBLES_WEBHOOK_PATH", "/bluebubbles-webhook"),
|
|
("send_read_receipts", "BLUEBUBBLES_SEND_READ_RECEIPTS", "true", is_truthy_value),
|
|
("require_mention", "BLUEBUBBLES_REQUIRE_MENTION", "", truthy_token),
|
|
),
|
|
optional=(("mention_patterns", "BLUEBUBBLES_MENTION_PATTERNS", mention_patterns),),
|
|
),
|
|
home_step(Platform.BLUEBUBBLES, "BLUEBUBBLES_HOME_CHANNEL"),
|
|
)
|
|
|
|
# Authorization env names (``PlatformEntry`` fields). Core reads them from this file when the
|
|
# live entry lacks them: a user plugin overriding this platform, safe mode, the plugin disabled.
|
|
AUTHZ = {
|
|
"allowed_users_env": "BLUEBUBBLES_ALLOWED_USERS",
|
|
"allow_all_env": "BLUEBUBBLES_ALLOW_ALL_USERS",
|
|
"allowlist_suppresses_pairing": True,
|
|
}
|