mirror of
https://github.com/yusufipk/YTChatHub.git
synced 2026-09-11 19:06:14 +00:00
feat: implement image proxy for YouTube CDN images with caching to prevent rate limits
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
- **Rich message parsing**: Full support for superchats, memberships, badges (moderator, member, verified)
|
||||
- **Timezone-aware timestamps**: All message timestamps display in user's local timezone with proper browser detection
|
||||
- **Visual selection feedback**: Previously selected messages show dimmed state for better user experience
|
||||
- **Image proxy implemented**: Backend proxies all YouTube CDN images with caching to prevent 429 rate limit errors
|
||||
|
||||
## Recent Decisions
|
||||
- Fixed CORS issues by setting headers on raw response object after `reply.hijack()` for SSE endpoint
|
||||
@@ -24,14 +25,16 @@
|
||||
- **Timezone Support**: Implemented browser timezone detection and proper timestamp formatting across dashboard and overlay using `Intl.DateTimeFormat` with GMT+3 fallback.
|
||||
- **Visual Selection States**: Added three-tier visual feedback system - active (selected), normal, and previously-selected (dimmed) states for better user experience.
|
||||
- **UI Polish**: Fixed pulse animations on initial load, hidden N/A messages, and improved overlay timestamp display.
|
||||
- **Image Proxy**: Added `/proxy/image` endpoint in backend with in-memory caching (24hr TTL, max 1000 images) to prevent YouTube CDN 429 rate limit errors. All avatars, badges, and emojis now route through proxy with stale-on-error fallback.
|
||||
|
||||
## Immediate Next Steps
|
||||
1. Test with live YouTube stream to verify badge parsing and superchat detection
|
||||
2. Add search/filter functionality for chat messages
|
||||
3. Implement error recovery and reconnection logic for stream interruptions
|
||||
4. Add keyboard shortcuts for quick message selection
|
||||
5. Consider persistent cache for images (SQLite or file-based) for better reliability
|
||||
|
||||
## Open Questions
|
||||
- Whether to add message search/filtering UI controls
|
||||
- How to handle rate limiting and backoff strategies for long streams
|
||||
- Whether to persist Innertube visitor data between runs
|
||||
- Should image cache be persistent across restarts?
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
- [ ] Add theme controls and customization options.
|
||||
|
||||
## Phase 4 – Reliability & Polish
|
||||
- [x] Implement image proxy with caching to prevent YouTube CDN 429 errors.
|
||||
- [ ] Expand logging/metrics for long-stream observability.
|
||||
- [ ] Write tests (unit/integration) and contributor documentation.
|
||||
|
||||
@@ -47,4 +48,5 @@
|
||||
- **✅ Timestamp Resolution Fixed**: Critical bug resolved - timestamps now display correct current time instead of 1970 epoch
|
||||
- **✅ Timezone Support**: All timestamps display in user's local timezone with browser detection and GMT+3 fallback
|
||||
- **✅ Visual Selection States**: Three-tier feedback system (active/normal/previously-selected) for better UX
|
||||
- **✅ Image Proxy Implemented**: Backend now proxies all YouTube CDN images (avatars, badges, emojis) with 24hr in-memory cache to prevent 429 rate limit errors
|
||||
- **Next**: Add search/filter, error recovery, and polish UX details
|
||||
|
||||
@@ -18,3 +18,4 @@
|
||||
- **Timezone Context Pattern**: React context provider (`TimezoneContext`) manages browser timezone detection and shares across components for consistent timestamp formatting.
|
||||
- **Selection State Management**: Three-tier visual state system (active/selected, normal, previously-selected) with CSS class composition for clear user feedback.
|
||||
- **Timestamp Resolution**: Backend uses `timestamp_usec` (microseconds) from YouTube data, converts to milliseconds, and frontend formats in user's local timezone.
|
||||
- **Image Proxy Pattern**: Backend `/proxy/image` endpoint caches YouTube CDN images (avatars, badges, emojis) with MD5-hashed keys, 24hr TTL, and 1000-image LRU eviction. Returns stale cache on 429 errors or network failures. Frontend `proxyImageUrl()` helper transparently rewrites YouTube CDN URLs to use proxy.
|
||||
|
||||
Reference in New Issue
Block a user