Add HTML landing page for SVG cards with project footer - #25
Conversation
Implement content negotiation in all API endpoints via a new `sendResponse` utility. When a card URL is accessed via a browser (Accept: text/html), it now serves a styled HTML page that: - Centers the SVG card. - Adds a footer in the bottom-left with the text "This is a gitlyy a readme stats generator." - Links the word "gitlyy" to the project's GitHub repository. Non-browser requests continue to receive the raw SVG. Includes `Vary: Accept` header for correct CDN caching. Co-authored-by: Chintanpatel24 <216989679+Chintanpatel24@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR introduces content negotiation for the card endpoints so browser navigations can receive a simple HTML landing page (wrapping the SVG card with a small project footer), while non-browser clients continue receiving raw SVG.
Changes:
- Added
src/response.jswith a sharedsendResponse(req, res, svg, status)helper to return either SVG or an HTML wrapper based on theAcceptheader. - Updated the 10 existing API endpoints to use
sendResponseinstead of directly sendingimage/svg+xml. - Added
Vary: Accepthandling in the shared response helper to support correct caching across content types.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/response.js | Adds shared response helper with HTML wrapper + SVG fallback based on Accept. |
| api/streak.js | Uses sendResponse for streak card output and errors. |
| api/profile.js | Uses sendResponse for profile card output and errors. |
| api/pr-stats.js | Uses sendResponse for PR stats card output and errors. |
| api/overview.js | Uses sendResponse for overview card output and errors. |
| api/music.js | Uses sendResponse for music card output and errors. |
| api/master.js | Uses sendResponse for master dashboard card output and errors. |
| api/languages.js | Uses sendResponse for language cards output and errors. |
| api/issues.js | Uses sendResponse for issues card output and errors. |
| api/contribution.js | Uses sendResponse for contribution cards output and errors. |
| api/commits.js | Uses sendResponse for commits cards output and errors. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This PR implements a landing page for the GitHub stats cards. When a user clicks on a card in a README, they will be taken to a clean web page showing the card and a small footer reference to the gitlyy project.
Key changes:
src/response.jsto handle content negotiation.sendResponse.Varyheader.PR created automatically by Jules for task 1669454921884861657 started by @Chintanpatel24