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
5 changes: 3 additions & 2 deletions runtime/wit/internal.wit
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,9 @@ interface lifecycle {

record boot-config {
/// The home origin, as an absolute URL without a trailing slash.
/// Release artifacts and, until installation lands, app bundles are
/// fetched from it.
/// It may carry a path (a GitHub Pages project site is served
/// under `/<repo>/`). Release artifacts and, until installation
/// lands, app bundles are fetched from it.
home-origin: string,
/// The device this worker is: the glue's sessionStorage anchor, or
/// an id the glue minted for a fresh device. The glue names the
Expand Down
5 changes: 4 additions & 1 deletion web/boot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,10 @@ fetch(new URL("config.json", location.href), { cache: "no-store" })
control.postMessage({
t: "hello",
device,
homeOrigin: location.origin,
// The directory this page is served from, not `location.origin`: a
// GitHub Pages project site lives under `/<repo>/`, and the kernel
// fetches `{home-origin}/apps/...`, so the prefix must be kept.
homeOrigin: new URL(".", location.href).href.replace(/\/$/, ""),
relay,
// The OAuth redirect (`lifecycle.boot-config.page-url`): this page's
// URL without query or fragment, which is where the popup comes back
Expand Down
4 changes: 2 additions & 2 deletions web/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,8 @@ const ready: Promise<Exports> = (async () => {
driveOauth: string | undefined;
},
) => Promise<void>;
// The home origin without a trailing slash, per `lifecycle.boot-config`.
// `location.origin` is spelled that way, and every tab that can reach this
// The home origin without a trailing slash, per `lifecycle.boot-config`;
// the tab derives it from its own URL, and every tab that can reach this
// worker is on the home origin by construction.
// `option<string>` lowers as `T | undefined` (m1-context.md "Value
// mapping"), so an absent base is passed as the absence itself rather
Expand Down