feat: add /og contextual share-image route#3963
Merged
Merged
Conversation
Screenshots the webapp /image-generator/share/<type>/<id> pages via the scraper and serves the PNG, mirroring the devcard v2 image pipeline. One generic route over an allowlist of types (posts, comments, sources, squads, profile, tags, invite, plus); forwards ?userid for share attribution; cached public max-age/s-maxage 1h. Backs the webapp share-card PR (dailydotdev/apps#6243). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
🍹 The Update (preview) for dailydotdev/api/prod (at 3bef5c1) was successful. Resource Changes Name Type Operation
~ vpc-native-check-analytics-report-cron kubernetes:batch/v1:CronJob update
~ vpc-native-user-profile-analytics-history-clickhouse-cron kubernetes:batch/v1:CronJob update
~ vpc-native-expire-super-agent-trial-cron kubernetes:batch/v1:CronJob update
+ vpc-native-api-clickhouse-migration-9e3f27d6 kubernetes:batch/v1:Job create
~ vpc-native-calculate-top-readers-cron kubernetes:batch/v1:CronJob update
~ vpc-native-validate-active-users-cron kubernetes:batch/v1:CronJob update
~ vpc-native-update-tag-materialized-views-cron kubernetes:batch/v1:CronJob update
~ vpc-native-rotate-weekly-quests-cron kubernetes:batch/v1:CronJob update
- vpc-native-api-clickhouse-migration-03f7fbd4 kubernetes:batch/v1:Job delete
~ vpc-native-squad-posts-analytics-refresh-cron kubernetes:batch/v1:CronJob update
~ vpc-native-clean-channel-highlights-cron kubernetes:batch/v1:CronJob update
~ vpc-native-clean-zombie-images-cron kubernetes:batch/v1:CronJob update
~ vpc-native-post-analytics-clickhouse-cron kubernetes:batch/v1:CronJob update
~ vpc-native-clean-old-notifications-cron kubernetes:batch/v1:CronJob update
~ vpc-native-update-current-streak-cron kubernetes:batch/v1:CronJob update
~ vpc-native-materialize-yearly-best-post-archives-cron kubernetes:batch/v1:CronJob update
~ vpc-native-clean-zombie-users-cron kubernetes:batch/v1:CronJob update
~ vpc-native-post-analytics-history-day-clickhouse-cron kubernetes:batch/v1:CronJob update
~ vpc-native-personalized-digest-deployment kubernetes:apps/v1:Deployment update
~ vpc-native-update-tags-str-cron kubernetes:batch/v1:CronJob update
~ vpc-native-private-deployment kubernetes:apps/v1:Deployment update
~ vpc-native-update-source-public-threshold-cron kubernetes:batch/v1:CronJob update
~ vpc-native-temporal-deployment kubernetes:apps/v1:Deployment update
~ vpc-native-update-achievement-rarity-cron kubernetes:batch/v1:CronJob update
~ vpc-native-clean-zombie-opportunities-cron kubernetes:batch/v1:CronJob update
~ vpc-native-generate-search-invites-cron kubernetes:batch/v1:CronJob update
~ vpc-native-worker-job-deployment kubernetes:apps/v1:Deployment update
~ vpc-native-personalized-digest-cron kubernetes:batch/v1:CronJob update
~ vpc-native-generic-referral-reminder-cron kubernetes:batch/v1:CronJob update
~ vpc-native-bg-deployment kubernetes:apps/v1:Deployment update
- vpc-native-api-db-migration-03f7fbd4 kubernetes:batch/v1:Job delete
~ vpc-native-rotate-daily-quests-cron kubernetes:batch/v1:CronJob update
~ vpc-native-clean-zombie-user-companies-cron kubernetes:batch/v1:CronJob update
~ vpc-native-channel-highlights-cron kubernetes:batch/v1:CronJob update
~ vpc-native-hourly-notification-cron kubernetes:batch/v1:CronJob update
~ vpc-native-daily-digest-cron kubernetes:batch/v1:CronJob update
~ vpc-native-clean-gifted-plus-cron kubernetes:batch/v1:CronJob update
~ vpc-native-user-profile-updated-sync-cron kubernetes:batch/v1:CronJob update
~ vpc-native-ws-deployment kubernetes:apps/v1:Deployment update
~ vpc-native-post-analytics-achievements-cron kubernetes:batch/v1:CronJob update
~ vpc-native-update-highlighted-views-cron kubernetes:batch/v1:CronJob update
... and 14 other changes |
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.
What
Adds a
/og/:type/:name.pngroute that renders the webapp's contextual share-card pages and screenshots them via the scraper — the same pipeline as the DevCard v2 image (/devcards/v2), no Satori.Backs the webapp PR: dailydotdev/apps#6243.
How
src/routes/shareImages.ts: one generic handler over an allowlist of types (posts, comments, sources, squads, profile, tags, invite, plus). Builds${COMMENTS_PREFIX}${WEBAPP_MAGIC_IMAGE_PREFIX}/share/<type>/<id>,POSTs{ url, selector: '#screenshot_wrapper' }toSCRAPER_URL/screenshot, and streams the PNG withcache-control: public, max-age=3600, s-maxage=3600+ COOP/CORP headers (mirrors devcards v2).?useridfor share attribution (post/squad "shared by / invited you")./oginsrc/routes/index.ts.Test plan
GET /og/posts/<id>.png(and?userid=<userId>)GET /og/{comments,sources,squads,profile,tags,invite,plus}/<id>.png.png→ 404.🤖 Generated with Claude Code