Skip to content

feat(hosted): card layout options in the card URL (#94) - #414

Merged
rowkav09 merged 2 commits into
mainfrom
feat/hosted-card-layout
Sep 24, 2026
Merged

rowkav09 merged 2 commits into
mainfrom
feat/hosted-card-layout

Conversation

@rowkav09

Copy link
Copy Markdown
Member

Part of #94 (the hosted card only read theme, width and show).

  • /card/<cardId>.svg and /api/card accept optional layout options in the URL query only: padding (12-48), radius (0-24), titleSize (14-30), subtitleSize (10-20), progressHeight (2-12), the same ranges as settings.js card.layout, plus textAlign, fieldOrder, progressPosition, progressWidth and direction with the values the renderer accepts.
  • Each option is allowlisted. Out-of-range, malformed or repeated values return 400 invalid_layout, like theme/width/show. Other query params (such as id on /api/card) are handled as before.
  • Artwork options are left out because the hosted card never draws artwork.
  • Not touched: the ingest payload, the v1 schema and INGEST_KEYS in hosted/lib/service.js. The PC still sends only playback fields.
  • The ETag is still computed over the rendered SVG, so each layout variant caches separately (covered by a test).
  • hosted/README.md endpoints table has a row for the new params.

node --test test/hosted-*.test.js: 54 pass. Full suite: 742 pass.

The hosted lane knows this is coming and will check it against the live service after merge.

The hosted card reads padding, radius, titleSize, subtitleSize, progressHeight, textAlign, fieldOrder, progressPosition, progressWidth and direction from the URL query. Each is allowlisted and range-checked; bad or repeated values return 400 invalid_layout. The ingest payload and schema are unchanged, and the ETag is still over the rendered SVG.
@github-actions

Copy link
Copy Markdown
Contributor

/mira pause

@github-actions github-actions Bot added mira-paused Pause automatic Mira reviews on this pull request area:docs size:M labels Sep 24, 2026
@codecov

codecov Bot commented Sep 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:docs mira-paused Pause automatic Mira reviews on this pull request size:M

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant