Initial MCM project: FastAPI + Textual TUI unified messenger

MultiCustomerMessenger supporting Telegram (python-telegram-bot),
WhatsApp (Green API) and SMS (python-gsmmodem-new). REST API with
Bearer-token auth, SQLAlchemy models for MariaDB, APScheduler for
background polling, and Textual TUI running in same asyncio event-loop.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-03 14:43:19 +01:00
commit 7a8c8149c9
38 changed files with 2072 additions and 0 deletions

18
api/auth.py Normal file
View File

@@ -0,0 +1,18 @@
from fastapi import HTTPException, Security, status
from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer
from config import settings
_bearer = HTTPBearer(auto_error=False)
def require_api_key(
credentials: HTTPAuthorizationCredentials | None = Security(_bearer),
) -> str:
if not credentials or credentials.credentials != settings.api_key:
raise HTTPException(
status_code=status.HTTP_401_UNAUTHORIZED,
detail="Invalid or missing API key",
headers={"WWW-Authenticate": "Bearer"},
)
return credentials.credentials