Skip to content

Let the booth video looper frame the leaderboard - #30

Merged
arilivigni merged 2 commits into
mainfrom
arilivigni-leaderboard-embed-looper
Nov 13, 2026
Merged

arilivigni merged 2 commits into
mainfrom
arilivigni-leaderboard-embed-looper

Conversation

@arilivigni

Copy link
Copy Markdown
Contributor

Why

The GitHub Learn booth video looper is moving from Azure App Service to GitHub Pages in ghlearn/ghlearn-video-looper, so the whole team can maintain its slides. On Azure it relayed the leaderboard through its own server. Pages can't do that, so the looper has to frame the board directly, and the board has to allow it.

What changes

  • EMBED_ORIGINS (app setting; Bicep embedOrigins) is a list of origins allowed to frame the board, separated by spaces or commas. main.parameters.json sets it to https://ghlearn.github.io http://localhost:* http://127.0.0.1:*.
    • When it's empty the policy is byte-for-byte the same as before: frame-ancestors 'none', no CORS.
    • An invalid entry stops the service at startup, with an error that names it.
  • When framing is on, two more changes apply. Bento frames embeds with sandbox="allow-scripts allow-forms", which gives the page an opaque origin, so:
    • the CSP also names the service's own https://<WEBSITE_HOSTNAME>, because WebKit won't match 'self' from an opaque origin;
    • GET /api/board and the Mona Sans font are sent with Access-Control-Allow-Origin: *. Both are public, credential-free reads.
  • kiosk.js scrolls the board a page at a time while the looper is showing it, and parks it at the top otherwise. It does nothing outside a frame and only listens to the page that frames it.
  • Docs: a new section, "Showing the board in the booth video looper", in docs/leaderboard-service.md, and a note in the runbook.

Testing

  • npm test: 340 pass. New tests cover the embed policy and CORS, the committed origins, rejection of bad origins, and the kiosk helper's message handling.
  • npm run check and az bicep build are clean.

Deployment

To be applied with az webapp config appsettings set … EMBED_ORIGINS=… plus the packaged zip deploy, ahead of merge, so the Pages looper can be verified. That avoids an infra redeploy, which needs the secure keys.

The GitHub Learn video looper is moving to GitHub Pages
(ghlearn/ghlearn-video-looper), where it can no longer relay the board
through its own server. The service can now name the pages allowed to
frame it.

- EMBED_ORIGINS (app setting, Bicep embedOrigins) lists the origins
  allowed in frame-ancestors. Empty keeps frame-ancestors 'none', and the
  policy is byte-for-byte the same as before.
- When framing is on, the CSP also names the service's own origin, since a
  sandboxed frame has an opaque origin that 'self' doesn't match in WebKit.
  /api/board and the font are sent with Access-Control-Allow-Origin: *
  for the same reason.
- kiosk.js scrolls the board a page at a time while the looper shows it,
  and does nothing outside a frame.
- Invalid origins stop the service at startup.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 4, 2026 21:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The kiosk can skip bottom rows or retain a stale scroll position, and origin validation accepts ports above 65535.

3 open issues
What changed in this PR

Enables the GitHub Pages booth video looper to frame the leaderboard directly, replacing its reliance on an Azure-hosted relay while preserving the default no-framing policy.

Changes:

  • Adds configurable framing origins and conditional CORS for public board data and the font.
  • Adds a frame-only kiosk helper for scrolling and resetting the board.
  • Updates infrastructure, packaging checks, tests, and operational documentation.
File Description
tests/​leaderboard-service.test.mjs Adds embed-policy, CORS, configuration, and kiosk checks.
scripts/​package-leaderboard.mjs Includes the kiosk script in deployment smoke checks.
leaderboard-service/​server.mjs Loads and logs embedding configuration at startup.
leaderboard-service/​public/​kiosk.js Adds parent-controlled scrolling and idle resets.
leaderboard-service/​public/​index.html Loads the kiosk helper.
leaderboard-service/​app.mjs Validates framing origins, builds CSP, and conditionally enables CORS.
infra/​modules/​app.bicep Passes EMBED_ORIGINS to App Service.
infra/​main.parameters.json Configures GitHub Pages and local framing origins.
infra/​main.bicep Exposes and forwards the embedding parameter.
docs/​leaderboard-service.md Documents embedding configuration and kiosk behavior.
booth/​RUNBOOK.md Adds the deployment note for looper embedding.

Review effort: Balanced

Comment thread leaderboard-service/app.mjs Resolved
Comment thread leaderboard-service/public/kiosk.js Resolved
Comment thread leaderboard-service/public/kiosk.js Resolved
- Embed origins with a port outside 1..65535 now stop the service.
- After waiting for a 0px frame to gain height, the kiosk returns to the top.
- When a tall board cannot be paged at the comfortable pace, pages stop
  overlapping and holds and glides shrink so the bottom is always reached.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@arilivigni
arilivigni merged commit e33529e into main Nov 13, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants