Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/try-page.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- "studio/**"
- "v2/**"
pull_request:
# Forge (studio/) is not read by the try page, the frame, Prism ids or the try codespace: a pull
# Forge (studio/) is not read by the try page, the frame, the identity page or the try codespace: a pull
# request that changes only Forge or the v2/ prototypes does not wait for them.
paths-ignore:
- "studio/**"
Expand Down Expand Up @@ -64,10 +64,12 @@ jobs:
fi
- name: Verify, answer add 20 22 and replay 22/22
run: npm run test:try
- name: Prism ids - the pinned stitch copy matches its lock, every session check refuses, and two apps share one id
- name: Prism accounts - every signature check refuses, and the passkey flow signs in
run: npm run test:identity
- name: Build the canonical frame every Prism app loads
run: node frame/publish.mjs "$RUNNER_TEMP/frame" "$GITHUB_SHA"
- name: Build the sign-in page for id.uor.foundation, pinned by hash
run: node identity/publish.mjs "$RUNNER_TEMP/identity" "$GITHUB_SHA"

deploy:
name: publish the try page and the canonical frame
Expand Down
1 change: 0 additions & 1 deletion bootstrap/frame-sync.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ const FRAME = [
"bootstrap/precache.mjs",
"bootstrap/register.mjs",
"bootstrap/screens.mjs",
"bootstrap/weight.mjs",
"bootstrap/worker-runtime.mjs",
"lighthouserc.json",
"site/app.mjs",
Expand Down
34 changes: 18 additions & 16 deletions bootstrap/page.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ const prismRegistry = new URL(`https://${DEFAULT_REGISTRY}/`);
// a frame change reaches this app without rebuilding it. app.json may name
// another frame host, for a test or a mirror.
const frameHost = new URL(meta.frame ?? "https://uor-foundation.github.io/template/frame/");
// Prism accounts: the sign-in page the frame's account panel shows. The
// page's policy frames that one origin and no other. app.json may name
// another, for a test.
const accounts = new URL(meta.accounts ?? "https://id.uor.foundation/");
const shareUrl = live.href;

// The one speculation rule: the frame marks the pages a visitor is about to
Expand All @@ -117,26 +121,23 @@ const speculationRules = JSON.stringify({
// with the page's, so the frame does not wait for a TLS handshake.
const frameConnect = frameHost.origin !== live.origin ? `<link rel="preconnect" href="${escape(frameHost.origin)}" crossorigin />` : "";

// The origins this page's connect-src must name for the frame: its Unsplash
// worker, for the theme panel's search, and stitch's relay (with its
// WebSocket origin), where a visitor's Prism id devices meet. Both are read
// from the live frame at build, after its SHA-256 is checked as the browser
// checks it. The frame itself is not written into the page: the page's own
// stand-in (prism-page.css) shows, drawn as the bar, until the module
// arrives, which keeps the first load inside the Lighthouse budget.
async function frameAllowed() {
// The frame's Unsplash worker, which this page's connect-src must name for
// the theme panel's search: read from the live frame at build, after its
// SHA-256 is checked as the browser checks it. The frame itself is not
// written into the page: the page's own stand-in (prism-page.css) shows,
// drawn as the bar, until the module arrives, which keeps the first load
// inside the Lighthouse budget.
async function frameUnsplash() {
try {
const pointer = await (await fetch(new URL("current.json", frameHost), { cache: "no-store" })).json();
if (!/^[0-9a-f]{64}$/.test(pointer.sha256 ?? "")) throw new Error("the frame pointer names no sha256");
const bytes = Buffer.from(await (await fetch(new URL(pointer.module, frameHost))).arrayBuffer());
if (hex(bytes) !== pointer.sha256) throw new Error(`the frame is ${hex(bytes)}, its pointer says ${pointer.sha256}`);
const frame = await import(`data:text/javascript;base64,${bytes.toString("base64")}`);
const origin = (value) => (/^https:\/\/[a-z0-9.-]+$/.test(value ?? "") ? value : "");
const relay = origin(/^https:\/\/[a-z0-9.-]+/.exec(frame.PRISM_RELAY ?? "")?.[0]);
return { unsplash: origin(frame.UNSPLASH_ORIGIN), relay: relay ? `${relay} ${relay.replace(/^https:/, "wss:")}` : "" };
return /^https:\/\/[a-z0-9.-]+$/.test(frame.UNSPLASH_ORIGIN ?? "") ? frame.UNSPLASH_ORIGIN : "";
} catch (error) {
console.warn(`page: the frame could not be read at build (${error.message}); no Unsplash or relay origin in connect-src`);
return { unsplash: "", relay: "" };
console.warn(`page: the frame could not be read at build (${error.message}); no Unsplash origin in connect-src`);
return "";
}
}
// The repository's GitHub stars at build, so the bar shows them from its
Expand Down Expand Up @@ -165,7 +166,7 @@ async function githubStars() {
}
}
const stars = await githubStars();
const frameOrigins = await frameAllowed();
const unsplashOrigin = await frameUnsplash();

// ---------------------------------------------------------------------------
// The workspace and the spec, rendered here so the page says everything
Expand Down Expand Up @@ -431,8 +432,9 @@ const fill = {
HOLO_SEARCH_ORIGIN: holoSearch.origin,
REGISTRY_ORIGIN: prismRegistry.origin,
FRAME_ORIGIN: frameHost.origin,
UNSPLASH_ORIGIN: frameOrigins.unsplash,
PRISM_RELAY_ORIGINS: frameOrigins.relay,
ACCOUNTS: escape(accounts.href),
ACCOUNTS_ORIGIN: accounts.origin,
UNSPLASH_ORIGIN: unsplashOrigin,
OG_IMAGE: escape(new URL("og.png", live).href),
OG_ALT: escape(`${meta.name}: ${meta.purpose}`),
NAME: escape(meta.name),
Expand Down
150 changes: 0 additions & 150 deletions bootstrap/weight.mjs

This file was deleted.

18 changes: 7 additions & 11 deletions frame.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"spec": "prism/frame-lock/1",
"source": {
"repository": "UOR-Foundation/template",
"commit": "d65a5ff543bf98fc4bbfb4a4e81789767529ab1d",
"raw": "https://raw.githubusercontent.com/UOR-Foundation/template/d65a5ff543bf98fc4bbfb4a4e81789767529ab1d/"
"commit": "0b7c323035b2bbb3729f4afad75820cac228cb09",
"raw": "https://raw.githubusercontent.com/UOR-Foundation/template/0b7c323035b2bbb3729f4afad75820cac228cb09/"
},
"files": [
{
"path": "bootstrap/frame-sync.mjs",
"sha256": "5d874908a8f5813b6f7c1004ec0e73ec03584139bf7ac8ffabb2ad5c0eeee7af"
"sha256": "c82b0a057aeccd601ec817ea71d7211b10083d884a1267f8bdf310f11199062b"
},
{
"path": "bootstrap/icons.py",
Expand All @@ -20,7 +20,7 @@
},
{
"path": "bootstrap/page.mjs",
"sha256": "8eee238bce9206ca58fc9be5471c28c0bdab82e2350ed78f1972da2a1da6581f"
"sha256": "2df4ef057d37e778b04f67e4f63d862c7da6a77c301d0862b2bb8681fc8ec9d4"
},
{
"path": "bootstrap/precache.mjs",
Expand All @@ -34,17 +34,13 @@
"path": "bootstrap/screens.mjs",
"sha256": "c9787ebf5ad8e8b649034ec3e43f8812ba51777ba59eb11f1f51ca084a395b67"
},
{
"path": "bootstrap/weight.mjs",
"sha256": "de432422e9931b4adf0f422a2030d7b38097a60a4d8fc9ed62fd20fe0c468373"
},
{
"path": "bootstrap/worker-runtime.mjs",
"sha256": "0f9fbb6ec4db48fb7f7c4b779a0494e95d5411e868b36e1e163e5173fcc34557"
},
{
"path": "lighthouserc.json",
"sha256": "85aa0f6219cb8396b34f5b461c1d4d7b149e4cc1674cbd2f0100c5b5e16636d9"
"sha256": "0145d04da93193801b0d8736ceba7e0df94b9b15f183b07a16e6feda16d72082"
},
{
"path": "site/app.mjs",
Expand All @@ -56,7 +52,7 @@
},
{
"path": "site/page.template.html",
"sha256": "b48b9d18e23e959c9e96b4bec58e2e7d80b7b977e981d8a7b0fd369293819b08"
"sha256": "d7df0bc4d5190ca38ee768bdbd54cbc665ede811608de846068c8a92bd02c14d"
},
{
"path": "site/prism-page.css",
Expand All @@ -72,7 +68,7 @@
},
{
"path": "site/sw.js",
"sha256": "baf0fbd7da2fa0b33124951bbd1218aa6658c342340fb24415c636f220c9ea74"
"sha256": "b4d4eb5c8314f5abed013ea9d172e7352dbdfa5aa2b503901df364ebcfbf11f7"
},
{
"path": "site/theme.js",
Expand Down
4 changes: 2 additions & 2 deletions frame/frame.css
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,8 @@ svg.gh, svg.fill { fill: currentColor; stroke: none; }
#github[hidden] + .sep { display: none; }
/* Full screen: the corners point out to enter, in to leave. */
:host([fullscreen]) #fullscreen .expand, :host(:not([fullscreen])) #fullscreen .shrink { display: none; }
/* The account: a line drawing signed out; while the Prism id window is open
* it breathes; signed in, the same figure filled, in the full text
/* The account: a line drawing signed out; while the device is asked for its
* passkey it breathes; signed in, the same figure filled, in the full text
* colour, so who is signed in reads at a glance and nothing else changes. */
#account.signed-in { color: var(--foreground); }
#account.signed-in svg.person { fill: currentColor; }
Expand Down
Loading
Loading