-
Notifications
You must be signed in to change notification settings - Fork 3.1k
feat(og): add opengraph images for templates, blogs, and updated existing opengraph image for all other pages #2466
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ting opengraph image for all other pages
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThis PR implements OpenGraph image generation for template pages to improve social media sharing. When users save templates, the system captures a workflow preview and uploads it as an OG image. Key Changes:
Implementation Notes:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant DeployModal as Template Deploy Modal
participant WorkflowStore as Workflow Store
participant OGCapture as OG Capture Container
participant CaptureLib as capture-preview.ts
participant API as /api/templates/[id]/og-image
participant Storage as Storage Service
participant DB as Database
User->>DeployModal: Save template
DeployModal->>DB: Create/update template record
DB-->>DeployModal: Template saved (templateId)
Note over DeployModal: onDeploymentComplete() called immediately
DeployModal->>User: Show success state
par Async OG Image Capture
DeployModal->>DeployModal: setIsCapturing(true)
DeployModal->>DeployModal: requestAnimationFrame x2
Note over DeployModal: Wait ~2 frames for DOM render
DeployModal->>OGCapture: Render hidden container
OGCapture->>WorkflowStore: Get workflow state (blocks, edges, loops)
WorkflowStore-->>OGCapture: Current workflow state
OGCapture->>OGCapture: Render WorkflowPreview off-screen
DeployModal->>CaptureLib: captureWorkflowPreview(element)
CaptureLib->>CaptureLib: html-to-image.toPng()
Note over CaptureLib: Retry up to 3 times if needed
CaptureLib-->>DeployModal: Base64 PNG data
DeployModal->>CaptureLib: uploadOGImage(templateId, imageData)
CaptureLib->>API: PUT /api/templates/{id}/og-image
API->>API: Validate session & template ownership
API->>API: Decode base64 & validate PNG magic bytes
API->>API: Check file size < 5MB
API->>Storage: uploadFile(buffer, og-images context)
Storage-->>API: Upload result with path
API->>DB: Update templates.ogImageUrl
DB-->>API: Success
API-->>CaptureLib: { ogImageUrl }
CaptureLib-->>DeployModal: OG image URL
DeployModal->>DeployModal: setIsCapturing(false)
end
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
24 files reviewed, 5 comments
Summary
Type of Change
Testing
Tested manually
Checklist