Serve a fallback for cold profile OG images

Đang mở
#4 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
Nửa ngày
Mức phù hợp với người mới
72/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
nextjs, typescript
Lĩnh vực
backend

Hướng nghiên cứu

Start at app/[username]/opengraph-image.tsx:43 to see how cachedPng is called without an onMiss, then read lib/og/pngCache.ts:93-99 for the cold-miss 404 path and the x-og-cache header values. Check app/[username]/vs/[opponent]/opengraph-image.tsx for the same pattern and look at how scripts/warm-og.mjs writes real renders so the fallback stays replaceable. Add a fallback asset such as public/og-root.png plus a route test covering cold miss, fallback and warmed hit; done means a never-warmed valid profile returns 200 PNG bytes with x-og-cache: fallback.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug help wanted

Current behavior

A profile with no warmed OG PNG returns 404 from /<login>/opengraph-image. X, Slack, Telegram and other unfurlers then show a blank or text-only card on the first share.

Live probes:

torvalds/opengraph-image   200   x-og-cache: r2-hit
defunkt/opengraph-image    404   x-og-cache: miss-empty
octocat/opengraph-image    404   x-og-cache: miss-empty

Cause

app/[username]/opengraph-image.tsx:43 calls cachedPng without an onMiss callback. lib/og/pngCache.ts:93-99 treats a cold miss as 404 with no-store. scripts/warm-og.mjs fills only handles that are already in the local warm set, and app/api/og/[username]/route.tsx is restricted to a local force flag.

Expected behavior

A valid profile should never return a blank OG response. Serve a branded fallback PNG on a cold miss, for example the existing public/og-root.png or a card-shaped fallback, with x-og-cache: fallback and normal public cache headers. Schedule or request a real render separately; do not do a Satori render on the request path.

Scope

  • app/[username]/opengraph-image.tsx
  • app/[username]/vs/[opponent]/opengraph-image.tsx if it shares the path
  • lib/og/pngCache.ts for an explicit fallback path
  • a fallback asset and a route test

Acceptance

  • A valid profile that has never been warmed returns 200 with PNG bytes, not 404.
  • The response identifies the fallback with x-og-cache.
  • A later warm still replaces the fallback through the normal cache path.
  • A test covers cold miss, fallback and warmed hit.
Ngôn ngữ chính
TypeScript
Star
7
Fork
0
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của LangerSword/gitone

Tất cả issue của LangerSword/gitone

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.