Lightweight containerized prosody tooling + moved auth scripts + xmpp reconnect/auth stabilization

This commit is contained in:
2026-03-05 02:18:12 +00:00
parent 0718a06c19
commit 2140c5facf
69 changed files with 3767 additions and 144 deletions

View File

@@ -0,0 +1,7 @@
from core.transports.capabilities import (
capability_snapshot,
supports,
unsupported_reason,
)
__all__ = ["supports", "unsupported_reason", "capability_snapshot"]

View File

@@ -0,0 +1,100 @@
from __future__ import annotations
CAPABILITY_SCHEMA_VERSION = 1
_TRANSPORT_CAPABILITIES: dict[str, dict[str, bool]] = {
"signal": {
"send": True,
"reactions": True,
"edits": False,
"deletes": False,
"threaded_replies": True,
"typing": True,
"read_receipts": True,
"media_images": True,
"media_video": True,
"media_audio": True,
"media_documents": True,
},
"whatsapp": {
"send": True,
"reactions": True,
"edits": False,
"deletes": False,
"threaded_replies": True,
"typing": True,
"read_receipts": True,
"media_images": True,
"media_video": True,
"media_audio": True,
"media_documents": True,
},
"instagram": {
"send": True,
"reactions": False,
"edits": False,
"deletes": False,
"threaded_replies": False,
"typing": True,
"read_receipts": False,
"media_images": True,
"media_video": True,
"media_audio": False,
"media_documents": False,
},
"xmpp": {
"send": False,
"reactions": False,
"edits": False,
"deletes": False,
"threaded_replies": False,
"typing": False,
"read_receipts": False,
"media_images": False,
"media_video": False,
"media_audio": False,
"media_documents": False,
},
}
def _service_key(service: str) -> str:
return str(service or "").strip().lower()
def _capabilities_for(service: str) -> dict[str, bool]:
defaults = _TRANSPORT_CAPABILITIES.get(_service_key(service))
if defaults is None:
return {}
return dict(defaults)
def supports(service: str, feature: str) -> bool:
feature_key = str(feature or "").strip().lower()
if not feature_key:
return False
return bool(_capabilities_for(service).get(feature_key, False))
def unsupported_reason(service: str, feature: str) -> str:
if supports(service, feature):
return ""
service_key = _service_key(service) or "unknown"
feature_key = str(feature or "").strip().lower() or "requested_action"
return f"{service_key} does not support {feature_key}."
def capability_snapshot(service: str = "") -> dict:
if service:
key = _service_key(service)
return {
"schema_version": CAPABILITY_SCHEMA_VERSION,
"service": key,
"capabilities": _capabilities_for(key),
}
return {
"schema_version": CAPABILITY_SCHEMA_VERSION,
"services": {
key: dict(value) for key, value in sorted(_TRANSPORT_CAPABILITIES.items())
},
}