Server: - Split into views, routes, helpers, models modules - Merged /ws/talk and /ws/update into single /ws/chat endpoint - Replaced polling with push-based broadcast model - Added username uniqueness validation on connect - Fixed run_server arguments bug (workers parameter) - Removed deprecated loop argument from Sanic listeners - Replaced datetime.utcnow() with timezone-aware datetime.now(timezone.utc) Client: - Rewrote client as single-file module - Migrated from websocket-client to websockets (asyncio) - Fixed websocket-client conflict with asyncio event loop on Windows - Added progress indicators for key generation, exchange, connection - Added animated 3D spinning cube in UI - Updated RSA key from 512 to 2048 bits CLI: - Removed unnecessary asyncio.run() wrapper - Simplified entry point
24 lines
475 B
Python
24 lines
475 B
Python
from typing import Optional
|
|
from .logger import logger
|
|
from .factory import create_app
|
|
|
|
app = create_app()
|
|
|
|
|
|
def run_server(
|
|
host: str = "0.0.0.0",
|
|
port: int = 8000,
|
|
admin_password: Optional[str] = None,
|
|
workers: int = 1,
|
|
) -> None:
|
|
app.ctx.admin_password = admin_password
|
|
logger.info(f"Starting server on {host}:{port}")
|
|
|
|
app.run(
|
|
host=host,
|
|
port=port,
|
|
workers=workers,
|
|
debug=False,
|
|
access_log=True,
|
|
)
|