Spaces:
Running
Running
File size: 1,585 Bytes
052f728 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | // Boot dispatcher — the only file that decides which of the three modes
// this page runs in. Keep the `?embedded=1` branch first: the host shell
// iframes this same origin with that param and its behavior must never
// be shadowed by app-specific modes.
import { ReachyMini } from "@pollen-robotics/reachy-mini-sdk";
(window as unknown as { ReachyMini: typeof ReachyMini }).ReachyMini = ReachyMini;
window.dispatchEvent(new Event("reachymini:ready"));
const params = new URLSearchParams(window.location.search);
const isEmbed = params.get("embedded") === "1" || params.get("embed") === "1";
if (isEmbed) {
void import("./embed");
} else if (params.get("practice") === "1") {
// Robot-free mode: the on-screen puppet runs the programs. No auth,
// no host shell — reachable only by explicit URL.
void import("./practice");
} else {
// Standalone visit: the host shell owns the page (OAuth, robot picker,
// top bar). Dynamically imported so practice/embed never load React/MUI.
void import("@pollen-robotics/reachy-mini-sdk/host/auto").then(({ mountHost }) => {
mountHost({
appName: "Reachy Blocks",
appIconUrl: "/icon.svg",
appEmoji: "🧩",
enableMicrophone: false,
devToken:
import.meta.env.VITE_HF_TOKEN && import.meta.env.VITE_HF_USERNAME
? {
token: import.meta.env.VITE_HF_TOKEN as string,
userName: import.meta.env.VITE_HF_USERNAME as string,
}
: undefined,
clientId: import.meta.env.VITE_HF_OAUTH_CLIENT_ID as string | undefined,
});
});
}
|