Uh oh!
There was an error while loading. Please reload this page.
Refactor 3Speak to embed-based upload with thumbnail support - #701
Conversation
Replace the old ThreeSpeakManager video system with a simpler embed-based approach. Videos are uploaded via TUS protocol and inserted as embed URLs. Thumbnails are auto-extracted from the video and can be overridden with a custom upload, then added to post metadata so feed previews show correctly. Key changes: - New threespeak-embed API layer with proper types, configurable endpoints, and structured error handling - Auto-add threespeakfund beneficiary (11%) in both publish and submit flows - Fix runtime crash in drafts page (removed reference to deleted state) - Fix canvas memory leak, blob URL leaks, and race conditions in upload component - Remove dead code (video gallery, video attach hook, unused type fields) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughAdds a 3Speak embed upload flow (client TUS upload, token proxy, thumbnail proxy), enforces a threespeak beneficiary when embed URLs exist, replaces legacy gallery/manager/video metadata flows with embed-based UI, and removes many old ThreeSpeak-specific modules and types. Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant Editor as Editor/Toolbar
participant VideoUpload as VideoUpload Component
participant EmbedAPI as 3Speak Embed API
participant Server as App Server (upload-token/thumbnail)
participant PublishState as Publish State / Beneficiaries
User->>Editor: Click "Insert video"
Editor->>VideoUpload: Open upload/recorder UI
User->>VideoUpload: Select or record file
VideoUpload->>Server: POST /api/threespeak/upload-token (request token)
Server->>EmbedAPI: POST /uploads/token (forward API key)
EmbedAPI-->>Server: return token
Server-->>VideoUpload: return token
VideoUpload->>EmbedAPI: TUS upload with Bearer token
EmbedAPI-->>VideoUpload: 201 + x-embed-url header (embedUrl, permlink)
alt thumbnail set
VideoUpload->>Server: POST /api/threespeak/thumbnail (permlink, thumbnail_url)
Server->>EmbedAPI: POST /video/{permlink}/thumbnail (X-API-Key)
EmbedAPI-->>Server: success
Server-->>VideoUpload: success
end
VideoUpload->>Editor: onVideoUploaded(embedUrl, thumbnailUrl?)
Editor->>PublishState: Insert embedUrl into body
PublishState->>PublishState: hasThreeSpeakEmbed(body) -> enforceThreeSpeakBeneficiary(...)
PublishState-->>Editor: Update beneficiaries / locked state
Estimated code review effort🎯 4 (Complex) | ⏱️ ~75 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
- Guard against empty permlink on upload success - Fix TUS error status extraction (read from originalResponse) - Extract shared beneficiary enforcement utility (deduplicate 4 sites) - Derive hasThreeSpeakVideo from content + flag to prevent desync - Normalize existing threespeakfund weight instead of blind append - Lock threespeakfund in submit beneficiary editor (match publish dialog) - Use keyboard-focusable button for video upload trigger Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
feruzm
commented
Mar 17, 2026
LGTM, @menobass thank you very much for valuable contribution! |
Summary
threespeakfundbeneficiary (11%) in both publish and submit flows when 3speak embeds are detectedKey changes
threespeak-embedAPI layer — proper TypeScript types, configurable endpoints viaEcencyConfigManager, structured error handling (replaces fragile string-based status code detection)threespeakfund(11%) is automatically added inpublish,submit/publish, andsubmit/scheduleflows; locked in the beneficiary editor UIsetPublishingVideostate in drafts pageuse-publish-video-attach.ts,publish-editor-video-gallery*.tsx, unused Advanced type fields (isThreespeak,videoId,speakPermlink,speakAuthor,isNsfw,videoMetadata)Setup required
The ecency team needs to set the following env vars:
NEXT_PUBLIC_THREESPEAK_EMBED_API_KEY— 3Speak embed API keyNEXT_PUBLIC_THREESPEAK_EMBED_ENDPOINT— (optional, defaults tohttps://embed.3speak.tv)Test plan
threespeakfundbeneficiary appears in the tx🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Refactor
Documentation