Repository navigation
feat(badges): multiple badge overlays, rank badges, corner positions + pill corner fix - #161
Merged
Merged
Conversation
…ner positions - `badge` now accepts a comma-separated list (or repeated params) of up to 4 values: '?badge=4K,HD' - Rank badges: 1-2 digit values (6, 12) or URL-encoded hashes (%236) render as 'sethwv#6'/'sethwv#12' and are valid without ALLOW_CUSTOM_BADGES, enabling AP/coaches poll rankings on hosted instances ('#'' starts a URL fragment, so bare digits are the friendly form) - Optional per-badge position suffix pins a corner: 4K@br / HD@top-left (tl/tr/bl/br or long forms); unpinned badges spread across corners in reading order (TL, TR, BL, BR) so '?badge=6,12' puts each team's rank over its own half; a lone badge keeps the historic top-right placement; badges sharing a corner are laid out side by side - Invalid entries are dropped silently, matching existing single-badge behavior; base-image caching now strips repeated badge params cleanly - Fix pre-existing pill rendering bug: the bottom-right corner arcTo passed the tangent-start point instead of the corner vertex, leaving a degenerate first tangent and drawing a diagonal slash across the pill bottom - Pill cache key versioned (_v2) so instances without the startup cache clear don't serve pre-fix pills - Docs updated for thumb/cover/logo; endpoint tests added for single, ranked, encoded, pinned, four-badge, and invalid-entry cases
Limit multi-badge overlay documentation to matchup logo routes, which are the paths that apply the overlay.
Show rendered NCAA rank-badge examples in the thumbnail and matchup logo API references.
github-actions Bot
pushed a commit
that referenced
this pull request
Oct 1, 2026
…+ pill corner fix (#161) Extends the `badge` query parameter to support **up to 4 badge overlays per request**, motivated by showing AP/coaches poll rankings on matchup thumbnails:
github-actions Bot
pushed a commit
that referenced
this pull request
Oct 1, 2026
…+ pill corner fix (#161) Extends the `badge` query parameter to support **up to 4 badge overlays per request**, motivated by showing AP/coaches poll rankings on matchup thumbnails:
github-actions Bot
pushed a commit
that referenced
this pull request
Oct 1, 2026
…+ pill corner fix (#161) Extends the `badge` query parameter to support **up to 4 badge overlays per request**, motivated by showing AP/coaches poll rankings on matchup thumbnails:
github-actions Bot
pushed a commit
that referenced
this pull request
Oct 1, 2026
…+ pill corner fix (#161) Extends the `badge` query parameter to support **up to 4 badge overlays per request**, motivated by showing AP/coaches poll rankings on matchup thumbnails:
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.
Description
Extends the
badgequery parameter to support up to 4 badge overlays per request, motivated by showing AP/coaches poll rankings on matchup thumbnails:renders
#10over Miami's half (top-left) and#6over Ole Miss' half (top-right).badgeparams (?badge=4K,HD). Invalid entries are dropped silently (existing single-badge behavior); a request with no valid entries renders badge-free as before.6,10) or URL-encoded hashes (%236) render as#6/#10. These are valid withoutALLOW_CUSTOM_BADGESso rankings work on hosted instances — bare digits are the friendly form since a literal#starts the URL fragment.@tl/@tr/@bl/@br(long forms accepted), e.g.?badge=4K@br,10,6keeps the quality badge clear of the rankings. Badges sharing a corner are laid out side by side.arcToinstead of the corner vertex, leaving a degenerate first tangent — node-canvas rendered a diagonal slash across the pill bottom (visible on light team-color backgrounds). Fixed to the canonical vertex form; verified via row-by-row pixel extents (bottom edge now mirrors the top). Pill cache key versioned (_v2) so instances that skip the startup badges-cache clear don't serve pre-fix pills.Works on thumb, cover, and logo routes (logo keeps its
badgeScale0.18). Base-image caching is preserved: the un-badged render is cached under the badge-stripped URL and reused across badge combinations; the stripper now handles repeatedbadgeparams and?badge=X&a=1correctly.Type of Change
Changes Made
src/helpers/image/badge.js: rank-badge validation,parseBadges()list/position parser,renderBadgePill()extraction (per-pill fsCache retained, versioned),addBadgesOverlay()multi-badge compositor (single-pass, corner grouping), BR-cornerarcTofixsrc/helpers/routeUtils.js:applyBadgeWithCachingnow drives the parsed badge list; robuststripBadgeParamsrc/helpers/imageUtils.js: re-export updatesdocs/api-reference/{thumb,cover,logo}.md: param docs + new Badge Overlays section with examplestest/endpoints.test.js: single-badge regression, bare-digit ranks, encoded%23ranks, pinned position, four badges, invalid-entry casesRelated Issue
Closes #
Testing
Test Details:
ALLOW_CUSTOM_BADGES(exercises the real whitelist path) andIMAGE_CACHE_HOURS=0badge=10,6≡badge=%2310,%236;badge=≡badge=100(3-digit, invalid → no overlay);badge=BOGUS,4K≡badge=4K(invalid dropped, base-image cache reused)Screenshots/Examples
Checklist
Additional Notes
Backward compatible: every existing single-badge URL produces pixel-identical output to
dev(verified by md5 across the old/new overlay paths on identical inputs) except the corrected bottom-right pill corner, which is the intended fix.