fix: allow Vercel preview deployments via wildcard CORS#4
Open
sktbrd wants to merge 46 commits into
Open
Conversation
…config Allow all origins
…tegration - Added detailed request/response logging for dashboard monitoring - Enhanced CORS headers for web application compatibility - Added client IP tracking and request ID generation - Improved error handling and cleanup logging - Added progress tracking for FFmpeg and IPFS upload operations - Fixed Tailscale funnel integration for external access
…vice - Added 'cors' dependency to package.json and package-lock.json. - Updated server.js to implement a more robust CORS setup allowing specific origins and methods. - Improved logging for incoming requests, including detailed information for transcoding operations. - Enhanced error handling and cleanup processes during video transcoding. - Created a backup of the original server.js for reference. - Added a sample video file for testing purposes.
…for video transcoding
…add live monitoring script
… sessionId fallback
… transcoding logic into a cleaner structure
… and platform information
…etup - Clarify internal port 8080 vs external port 8081 - Add production deployment section with Mac Mini M4 configuration - Document Tailscale Funnel routing - Add health check endpoint examples
Updates the log to include new video transcode events for multiple users and devices, while removing earlier entries to maintain relevance and reduce log size. Helps keep logs current for monitoring and troubleshooting.
Includes an additional node property in the logged output to enhance traceability and support debugging across distributed environments.
…gress - Add /progress/:requestId SSE endpoint for real-time progress streaming - Add activeJobs Map to track progress and SSE clients per request - Add broadcastProgress() to send updates to all connected clients - Add getVideoDuration() using ffprobe for accurate progress calculation - Parse FFmpeg stderr for time progress during transcoding - Use client's correlationId for SSE (enables pre-subscription) - Preserve existing SSE clients when initializing job tracking - Progress stages: receiving (5%), transcoding (0-80%), uploading (80-100%), complete
…pp tracking fields
- Use ipfs.skatehive.app gateway (branded custom gateway) - Add PINATA_GROUP_VIDEOS support for organized uploads - Standardize metadata to match webapp schema - Add missing fields: fileType, uploadDate, transcoded, videoDuration, originalFileName - Add conditional fields: viewport, connectionType - Preserve backward compatibility with sourceApp/appVersion
- Removed less critical fields to comply with Pinata 10 keyvalue limit - Kept essential fields: creator, source, uploadDate, transcoded, originalFileName, videoDuration, requestId, sourceApp, platform, thumbnailUrl - Fixed empty string issue (only include non-empty optional fields) - Added detailed Pinata error logging for debugging
…lity - Add checkWebOptimized() — ffprobe checks if H.264/AAC/≤1080p before transcoding - Optimized videos skip transcoding, upload directly to IPFS (2x faster) - Adaptive CRF: 20 (short clips) / 22 (normal) / 24 (long/large) - Cap resolution at 1080p, bitrate at 5Mbps - Default preset changed to medium (better quality) - Remove obsolete docker-compose version key Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Generate JPEG thumbnail with FFmpeg (frame at 10% duration, max 640px) - Upload thumbnail to Pinata and store URL in video metadata - Falls back gracefully if thumbnail generation fails - Client-provided thumbnails still take priority Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add -pix_fmt yuv420p to the ffmpeg args so all transcoded output is guaranteed 8-bit 4:2:0 — required for hardware decode on iOS/Android. Also extend checkWebOptimized to reject videos whose pix_fmt is not yuv420p (e.g. 10-bit h264), so they go through re-encoding instead of being passed through as-is. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Pinata intermittently returns 400 errors during video upload, causing the entire transcode to fail with no retry. This adds a 3-attempt retry loop with 2s/4s backoff, and logs the actual Pinata response body so we can diagnose the root cause when it fails. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds wildcard pattern support to origin matching so that https://*.vercel.app previews are accepted without hardcoding each deployment URL. ALLOWED_ORIGINS env var also supports wildcards for custom patterns. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
isOriginAllowed()— entries likehttps://*.vercel.appnow match any preview URL (e.g.skatehive3-0-gdgt8ea4v-sktbrds-projects.vercel.app)https://*.vercel.appin the defaultALLOWED_ORIGINSso Vercel previews work without any.envchangesALLOWED_ORIGINSenv var supports*wildcards for custom patternsTest plan
/transcodeand/progress/:requestIdrequests succeed without CORS errorshttps://skatehive.appstill works (exact match path)🤖 Generated with Claude Code