Repository navigation
Let the booth video looper frame the leaderboard - #30
Merged
Merged
Conversation
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>
Contributor
There was a problem hiding this comment.
🟡 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
- 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>
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.

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; BicepembedOrigins) is a list of origins allowed to frame the board, separated by spaces or commas.main.parameters.jsonsets it tohttps://ghlearn.github.io http://localhost:* http://127.0.0.1:*.frame-ancestors 'none', no CORS.sandbox="allow-scripts allow-forms", which gives the page an opaque origin, so:https://<WEBSITE_HOSTNAME>, because WebKit won't match'self'from an opaque origin;GET /api/boardand the Mona Sans font are sent withAccess-Control-Allow-Origin: *. Both are public, credential-free reads.kiosk.jsscrolls 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/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 checkandaz bicep buildare 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.