Initial commit: Telegram Web Client with bot chat sync
- Backend: FastAPI + Telethon v2 WebSocket server - Frontend: React + TypeScript + Vite + Zustand - Features: Phone auth, 2FA, real-time bot chat - Fix: Use chats= instead of from_users= to sync messages from all devices - Config: BOT_USERNAME=AnvilForgeBot Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
1
backend/models/__init__.py
Normal file
1
backend/models/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
# Models module
|
||||
42
backend/models/schemas.py
Normal file
42
backend/models/schemas.py
Normal file
@@ -0,0 +1,42 @@
|
||||
from pydantic import BaseModel
|
||||
from typing import Optional, List
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
class PhoneAuthRequest(BaseModel):
|
||||
phone: str
|
||||
|
||||
|
||||
class CodeAuthRequest(BaseModel):
|
||||
phone: str
|
||||
code: str
|
||||
phone_code_hash: str
|
||||
|
||||
|
||||
class PasswordAuthRequest(BaseModel):
|
||||
phone: str
|
||||
password: str
|
||||
|
||||
|
||||
class SendMessageRequest(BaseModel):
|
||||
text: str
|
||||
|
||||
|
||||
class MessageResponse(BaseModel):
|
||||
id: int
|
||||
text: Optional[str]
|
||||
date: datetime
|
||||
is_outgoing: bool
|
||||
sender_name: Optional[str] = None
|
||||
|
||||
|
||||
class AuthStatus(BaseModel):
|
||||
authenticated: bool
|
||||
phone: Optional[str] = None
|
||||
user_id: Optional[int] = None
|
||||
username: Optional[str] = None
|
||||
|
||||
|
||||
class WebSocketMessage(BaseModel):
|
||||
type: str # "auth_phone", "auth_code", "auth_password", "send_message", "get_history"
|
||||
data: dict
|
||||
Reference in New Issue
Block a user