The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(gateway/platforms): signal/bluebubbles — reuse utils.TRUTHY_STRINGS
Teknium4f322d04a97d
diff --git a/gateway/platforms/bluebubbles.py b/gateway/platforms/bluebubbles.pyindex 1a28bbda685..c0f5fc458eb 100644--- a/gateway/platforms/bluebubbles.py+++ b/gateway/platforms/bluebubbles.py@@ -26,6 +26,7 @@ from gateway.platforms.base import (cache_image_from_bytes, cache_audio_from_bytes, cache_document_from_bytes)from .media_cache import ext_for_mimefrom gateway.platforms.helpers import compile_mention_patterns, strip_markdown+from utils import TRUTHY_STRINGS# Historical BlueBubbles mime→ext maps, preserved verbatim as overrides for# the shared dispatch in gateway.platforms.media_cache. Both maps are@@ -68,7 +69,6 @@ _ADDRESS_RE = re.compile(r"^\+\d+")_GUID_CACHE_SIZE = 500 # LRU cap for resolved chat-GUID lookups_LOCAL_HOSTS = {"0.0.0.0", "127.0.0.1", "localhost", "::"}-_TRUTHY = {"true", "1", "yes", "on"}def _redact(text: str) -> str:@@ -135,7 +135,7 @@ class BlueBubblesAdapter(BasePlatformAdapter):_require_mention = extra.get("require_mention")if _require_mention is None:_require_mention = os.getenv("BLUEBUBBLES_REQUIRE_MENTION")- self.require_mention = str(_require_mention).strip().lower() in _TRUTHY+ self.require_mention = str(_require_mention).strip().lower() in TRUTHY_STRINGSself._mention_patterns = self._compile_mention_patterns(extra["mention_patterns"] if "mention_patterns" in extra else os.getenv("BLUEBUBBLES_MENTION_PATTERNS"))diff --git a/gateway/platforms/signal.py b/gateway/platforms/signal.pyindex 3fbcded8a27..7267c1189dc 100644--- a/gateway/platforms/signal.py+++ b/gateway/platforms/signal.py@@ -39,6 +39,7 @@ from gateway.platforms.signal_rate_limit import (SignalRateLimitError, _extract_retry_after_seconds, _format_wait, _is_signal_rate_limit_error,_signal_send_timeout, get_scheduler)from gateway.platforms._shared import get_scoped_secret as _sig_secret+from utils import TRUTHY_STRINGSlogger = logging.getLogger(__name__)@@ -56,7 +57,6 @@ _MEDIA_TYPE_BY_MIME_PREFIX = (_OUTCOME_REACTION = {ProcessingOutcome.SUCCESS: "✅", ProcessingOutcome.FAILURE: "❌"}_QUOTE_AUTHOR_KEYS = ("author", "authorNumber", "authorUuid", "authorAci", "authorServiceId", "authorServiceIdString")-_TRUTHY = ("true", "1", "yes", "on")def _parse_comma_list(value: str) -> List[str]:@@ -195,7 +195,7 @@ class SignalAdapter(BasePlatformAdapter):_rm_cfg = extra.get("require_mention")self.require_mention = (bool(_rm_cfg) if _rm_cfg is not None- else os.getenv("SIGNAL_REQUIRE_MENTION", "false").lower() in _TRUTHY)+ else os.getenv("SIGNAL_REQUIRE_MENTION", "false").lower() in TRUTHY_STRINGS)# DM allowlist mirrors run.py's SIGNAL_ALLOWED_USERS so reaction hooks (which fire# before run.py's auth gate) can skip unauthorized senders. "*" = open.self.dm_allow_from = set(_parse_comma_list(_sig_secret("SIGNAL_ALLOWED_USERS", "*")))