Add track filtering, WS keepalive, and improve error handling

- Add track filtering by uploader (my tracks / all tracks) with UI tabs
- Add WebSocket ping/pong keepalive (30s interval) to prevent disconnects
- Add auto-reconnect on WebSocket close (3s delay)
- Add request logging middleware with DATABASE_URL output on startup
- Handle missing S3 files gracefully (return 404 instead of 500)
- Add debug logging for audio ended event

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-12-12 18:10:25 +03:00
parent 3dd10d6dab
commit fdc854256c
7 changed files with 144 additions and 11 deletions

View File

@@ -77,11 +77,16 @@ def get_file_content(s3_key: str) -> bytes:
return response["Body"].read()
def get_file_size(s3_key: str) -> int:
"""Get file size from S3 without downloading"""
def get_file_size(s3_key: str) -> int | None:
"""Get file size from S3 without downloading. Returns None if file not found."""
client = get_s3_client()
response = client.head_object(Bucket=settings.s3_bucket_name, Key=s3_key)
return response["ContentLength"]
try:
response = client.head_object(Bucket=settings.s3_bucket_name, Key=s3_key)
return response["ContentLength"]
except client.exceptions.ClientError as e:
if e.response['Error']['Code'] == '404':
return None
raise
def get_file_range(s3_key: str, start: int, end: int):