Lightweight containerized prosody tooling + moved auth scripts + xmpp reconnect/auth stabilization
This commit is contained in:
@@ -17,6 +17,7 @@ from django.core.cache import cache
|
||||
|
||||
from core.clients import signalapi
|
||||
from core.messaging import media_bridge
|
||||
from core.transports.capabilities import supports, unsupported_reason
|
||||
from core.util import logs
|
||||
|
||||
log = logs.get_logger("transport")
|
||||
@@ -32,6 +33,10 @@ def _service_key(service: str) -> str:
|
||||
return str(service or "").strip().lower()
|
||||
|
||||
|
||||
def _capability_checks_enabled() -> bool:
|
||||
return bool(getattr(settings, "CAPABILITY_ENFORCEMENT_ENABLED", True))
|
||||
|
||||
|
||||
def _runtime_key(service: str) -> str:
|
||||
return f"gia:service:runtime:{_service_key(service)}"
|
||||
|
||||
@@ -898,6 +903,10 @@ async def send_reaction(
|
||||
remove: bool = False,
|
||||
):
|
||||
service_key = _service_key(service)
|
||||
if _capability_checks_enabled() and not supports(service_key, "reactions"):
|
||||
reason = unsupported_reason(service_key, "reactions")
|
||||
log.warning("capability-check failed service=%s feature=reactions: %s", service_key, reason)
|
||||
return False
|
||||
if not str(emoji or "").strip() and not remove:
|
||||
return False
|
||||
|
||||
@@ -968,6 +977,13 @@ async def send_reaction(
|
||||
|
||||
async def start_typing(service: str, recipient: str):
|
||||
service_key = _service_key(service)
|
||||
if _capability_checks_enabled() and not supports(service_key, "typing"):
|
||||
log.warning(
|
||||
"capability-check failed service=%s feature=typing: %s",
|
||||
service_key,
|
||||
unsupported_reason(service_key, "typing"),
|
||||
)
|
||||
return False
|
||||
if service_key == "signal":
|
||||
await signalapi.start_typing(recipient)
|
||||
return True
|
||||
@@ -998,6 +1014,13 @@ async def start_typing(service: str, recipient: str):
|
||||
|
||||
async def stop_typing(service: str, recipient: str):
|
||||
service_key = _service_key(service)
|
||||
if _capability_checks_enabled() and not supports(service_key, "typing"):
|
||||
log.warning(
|
||||
"capability-check failed service=%s feature=typing: %s",
|
||||
service_key,
|
||||
unsupported_reason(service_key, "typing"),
|
||||
)
|
||||
return False
|
||||
if service_key == "signal":
|
||||
await signalapi.stop_typing(recipient)
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user