The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.
TypeScript ai-videocomfyuicreative-toolsgenerative-aiideogramimage-generationimage-to-3dimage-to-videoltx-videominimax-h3nextjsopen-sourceopen-weightsqwen-imagetext-to-imagevideo-generationwan
Set it up with my AI: one Send to my computer on the phone's way, Log in first on the computer
Adarsh3c1ab320f6f2
diff --git a/docs/public-signup.md b/docs/public-signup.mdindex e975661e..8d67303d 100644--- a/docs/public-signup.md+++ b/docs/public-signup.md@@ -482,7 +482,9 @@ cloudflared tunnel --url http://localhost:8188 # or: ngrok http 8188An account can let its own AI (ChatGPT, Claude, or a coding agent such as Claude Code, Codex orGemini CLI) do the setup: **Set it up with my AI** on the Connect your GPU card, in Settings → Your-GPU and at `/connect?setup=ai`. A guest signs up first and comes back there. The panel picks the+GPU and at `/connect?setup=ai`. A guest who opens that link gets **Log in** first, for the account it+started with (most often on a phone), then **Sign up free**. Both come back to the same link, its+way included. The panel picks theway for the browser (Fuobe Connect first while it is published, then this browser, or a web addresson Safari, on a phone and on a page on plain http), gives the AI a short message with two links (thesteps and the status), and ticks off each step as the account's open tab sees it. It ends with a@@ -504,6 +506,9 @@ address, with the box for it in focus.`/connect?setup=ai&way=address` on that computer, signed in to the same account: the box for theaddress is there, under the same setup code (a different code means another account). UntilFuobe has an address, the status's next step is the tunnel even while the phone's tab sleeps.+ The phone has one **Send to my computer** button (**Copy link for my computer** where the+ browser can't share). It sends `/connect?setup=ai` with the way the phone is on: `way=address`+ for a web address, `way=connect` for Fuobe Connect. The computer opens on that same way.- **ComfyUI starting again.** When ComfyUI stops answering on this computer, the panel and thestatus say it is starting again for up to 5 minutes (a portable or Easy-Install ComfyUI loadsevery add-on first), with the minutes so far. After that they say it didn't come back: look at@@ -547,7 +552,9 @@ address, with the box for it in focus.budget, the shared one still holds, and an active code never uses either. With no proxy at all,only the shared budget applies. The steps and Fuobe's files: 60 a minute per visitor(behind a trusted proxy), and no budget shared by everyone, so no visitor can use up another- person's. All answer 429 with `Retry-After`.+ person's. All answer 429 with `Retry-After`. Past the budget for unknown codes, the answer still+ tells the AI to ask the person for the code Fuobe shows now: a code that is active works at once,+ and the wait is only for a person with no new code.The code is `src/server/ai-setup.ts`, `src/lib/ai-setup/`, `src/components/gpu/ai-setup/` and`src/app/api/setup/`.diff --git a/src/app/api/setup/[code]/route.ts b/src/app/api/setup/[code]/route.tsindex 6210a685..10926bed 100644--- a/src/app/api/setup/[code]/route.ts+++ b/src/app/api/setup/[code]/route.ts@@ -1,6 +1,6 @@import { connection } from "next/server";import { setupCode } from "@/lib/ai-setup/code";-import { BAD_CODE, NOT_ACTIVE, notActiveText, toPublic, toText } from "@/lib/ai-setup/status";+import { BAD_CODE, NOT_ACTIVE, notActiveBusy, notActiveText, toPublic, toText } from "@/lib/ai-setup/status";import { freshPart, readSetup, setupOf, viewOf } from "@/server/ai-setup";import { answer, guessBudget, inMinutes } from "@/server/ai-setup-http";import { hit } from "@/server/rate";@@ -22,8 +22,9 @@ export async function GET(request: Request, ctx: RouteContext<"/api/setup/[code]if (!setup) {const r = guessBudget("setup:miss", request.headers, 10, 600, TEN_MINUTES);if (!r.ok) {- const error = `Too many codes that aren't active. Try again in ${inMinutes(r.retryAfterS)}.`;- return answer(request, 429, { ...NOT_ACTIVE, error, retryAfterS: r.retryAfterS }, `${error}\n`, { "Retry-After": String(r.retryAfterS) });+ // Still what to do: the code Fuobe shows now works at once; the wait is only for a person with no new code.+ const busy = notActiveBusy(inMinutes(r.retryAfterS));+ return answer(request, 429, { ...busy.json, retryAfterS: r.retryAfterS }, busy.text, { "Retry-After": String(r.retryAfterS) });}return answer(request, 404, { ...NOT_ACTIVE }, notActiveText());}diff --git a/src/components/gpu/ai-setup/ai-setup-panel.tsx b/src/components/gpu/ai-setup/ai-setup-panel.tsxindex 69c7c191..6e04e3fb 100644--- a/src/components/gpu/ai-setup/ai-setup-panel.tsx+++ b/src/components/gpu/ai-setup/ai-setup-panel.tsx@@ -1046,42 +1046,24 @@ function AddressForm({Keep the address to yourself. Paste it here, not in your AI's chat.{" "}{!showToken && <Quiet onClick={() => setWithToken(true)}>Has a password or token?</Quiet>}</p>- {phone && <OnComputer site={site} host={host} />}+ {phone && <OnComputer host={host} />}</div>);}/**- * On a phone: the address is on the computer's clipboard, so it goes into Fuobe there. The link opens this box on the- * computer, under the same code once the person signs in with the same account.+ * On a phone: the address is on the computer's clipboard, so it goes into Fuobe there: the page that opens this box on+ * the computer, under the same code once the person logs in with the same account. The button that sends that page is+ * the one at the top of the panel (PhoneSend), never a second one here.*/-function OnComputer({ site, host }: { site: string; host: string }) {+function OnComputer({ host }: { host: string }) {const path = aiSetupHref("address");- const link = `${site}${path}`;- const share = typeof navigator !== "undefined" && typeof navigator.share === "function";return (- <div className="space-y-1.5 rounded-lg bg-muted/60 px-2.5 py-2 text-[12px]">- <p>- The address goes on your computer's clipboard, not your phone's. On that computer, open <span className="break-all font-medium">{host}{path}</span> and sign in with this- account. This box is there, with the same setup code. Paste the address in it. If your phone shares the computer's clipboard, you can paste it here instead.- </p>- <Button- size="sm"- variant="secondary"- className="h-9"- onClick={async () => {- if (share) {- try {- await navigator.share({ title: "Paste my ComfyUI's web address in Fuobe", url: link });- return;- } catch {}- }- await copyWithToast(link, "Link copied");- }}- >- <Send /> {share ? "Send this link to my computer" : "Copy this link for my computer"}- </Button>- </div>+ <p className="rounded-lg bg-muted/60 px-2.5 py-2 text-[12px]">+ The address goes on your computer's clipboard, not your phone's. On that computer, open <span className="break-all font-medium">{host}{path}</span> and log in with+ this account, or press {sendLabel(canShare())} at the top. This box is there, with the same setup code. Paste the address in it. If your phone shares the+ computer's clipboard, you can paste it here instead.+ </p>);}@@ -1108,26 +1090,38 @@ function ModelDownload({ model, gbTenths, os, onCheck, checking }: { model: Firs);}-/** On a phone: the steps run on the computer. Send this page there, or use an AI app here with the computer's system picked. */+/** Can this browser hand a link to another app (the share sheet)? Else the link is copied. */+const canShare = () => typeof navigator !== "undefined" && typeof navigator.share === "function";+/** The name of the phone's one button that sends the setup to the computer. */+const sendLabel = (share: boolean) => (share ? "Send to my computer" : "Copy link for my computer");++/**+ * On a phone: the steps run on the computer. One button sends this setup there on the way picked here (a web address+ * opens at the box for it, Fuobe Connect at its checks), under the same code once the person logs in with this account.+ * Or an AI app here, with the computer's system picked.+ */function PhoneSend({ site, os, way, onOs }: { site: string; os: Os | null; way: Way; onOs: (os: Os) => void }) {- const link = `${site}/connect?setup=ai`;- const share = typeof navigator !== "undefined" && typeof navigator.share === "function";+ const link = `${site}${aiSetupHref(way)}`;+ const share = canShare();return (<div className="space-y-3">- <Button- className="h-11 w-full"- onClick={async () => {- if (share) {- try {- await navigator.share({ title: "Set up Fuobe on my computer", url: link });- return;- } catch {}- }- await copyWithToast(link, "Link copied");- }}- >- <Send /> {share ? "Send to my computer" : "Copy link for my computer"}- </Button>+ <div className="space-y-1.5">+ <Button+ className="h-11 w-full"+ onClick={async () => {+ if (share) {+ try {+ await navigator.share({ title: "Set up Fuobe on my computer", url: link });+ return;+ } catch {}+ }+ await copyWithToast(link, "Link copied");+ }}+ >+ <Send /> {sendLabel(share)}+ </Button>+ <p className="text-[12px] text-muted-foreground">It opens this setup on your computer. Log in there with this account.</p>+ </div><div className="space-y-1.5"><p className="text-[12px] text-muted-foreground">Or start with an AI app on this phone. The commands run on your computer.{" "}diff --git a/src/components/gpu/connect-gpu.tsx b/src/components/gpu/connect-gpu.tsxindex 006afda0..e896a3f9 100644--- a/src/components/gpu/connect-gpu.tsx+++ b/src/components/gpu/connect-gpu.tsx@@ -1,7 +1,7 @@"use client";import { useQuery, useQueryClient } from "@tanstack/react-query";-import { CircleAlert, Cpu, Loader2, Sparkles } from "lucide-react";+import { BotMessageSquare, CircleAlert, Cpu, Loader2, Sparkles } from "lucide-react";import Link from "next/link";import { useRouter, useSearchParams } from "next/navigation";import { useEffect, useRef } from "react";@@ -160,6 +160,32 @@ export function ConnectGpu() {</div>);+ // A guest at "Set it up with my AI" (a phone's Send to my computer, or the page the AI names) most often started it+ // signed in somewhere else: Log in comes first, with the same account, and comes back to this same link.+ if (guest && ai)+ return (+ <div className="space-y-6">+ {header(1)}+ <Card>+ <div className="flex items-start gap-3">+ <BotMessageSquare aria-hidden className="mt-0.5 size-5 shrink-0 text-brand-text" />+ <div className="min-w-0 space-y-3">+ <p className="text-[14px] font-medium">Set it up with your AI</p>+ <p className="text-[13px] text-muted-foreground">Started on your phone? Log in with the same account, and the setup goes on here.</p>+ <div className="flex flex-wrap gap-2">+ <Button asChild className="h-11 sm:h-9">+ <Link href={signInHref("login", aiHref)}>Log in</Link>+ </Button>+ <Button asChild variant="secondary" className="h-11 sm:h-9">+ <Link href={signInHref("signup", aiHref)}>Sign up free</Link>+ </Button>+ </div>+ </div>+ </div>+ </Card>+ </div>+ );+if (guest)return (<div className="space-y-6">@@ -175,13 +201,13 @@ export function ConnectGpu() {</p><div className="flex flex-wrap gap-2"><Button asChild className="h-11 sm:h-9">- <Link href={signInHref("signup", ai ? aiHref : "/connect")}>Sign up free</Link>+ <Link href={signInHref("signup", "/connect")}>Sign up free</Link></Button><Button asChild variant="secondary" className="h-11 sm:h-9">- <Link href={signInHref("login", ai ? aiHref : "/connect")}>Log in</Link>+ <Link href={signInHref("login", "/connect")}>Log in</Link></Button><Button asChild variant="secondary" className="h-11 sm:h-9">- <Link href={signInHref("signup", ai ? aiHref : AI_SETUP_HREF)}>Set it up with my AI</Link>+ <Link href={signInHref("signup", AI_SETUP_HREF)}>Set it up with my AI</Link></Button></div></div>diff --git a/src/components/login-form.tsx b/src/components/login-form.tsxindex 415aca66..95541845 100644--- a/src/components/login-form.tsx+++ b/src/components/login-form.tsx@@ -6,6 +6,7 @@ import { usePathname, useRouter, useSearchParams } from "next/navigation";import { useEffect, useState } from "react";import { Button } from "@/components/ui/button";import { Input } from "@/components/ui/input";+import { isWay } from "@/lib/ai-setup/ways";import { announceAuthChange, rememberViewer, signOut, useStatus, useViewer } from "@/lib/api";import { safeNext } from "@/lib/safe-redirect";import { cn } from "@/lib/utils";@@ -74,9 +75,13 @@ export function LoginForm() {// Settings' Your GPU (its Sign up free): the welcome page is that same choice.const q = new URLSearchParams({ welcome: "1" });if (after !== "/" && !after.startsWith("/connect") && !after.startsWith("/settings#your-gpu")) q.set("next", after);- // "Set it up with my AI" (a guest's sign-up from it): the welcome page opens with it.+ // "Set it up with my AI" (a guest's sign-up from it): the welcome page opens with it, on the link's way.const nextUrl = new URL(after, window.location.origin);- if (nextUrl.pathname === "/connect" && nextUrl.searchParams.get("setup") === "ai") q.set("setup", "ai");+ if (nextUrl.pathname === "/connect" && nextUrl.searchParams.get("setup") === "ai") {+ q.set("setup", "ai");+ const way = nextUrl.searchParams.get("way");+ if (isWay(way)) q.set("way", way);+ }// With hosted runs on, a GPU of its own is optional: straight back to where it was.const dest = mode === "signup" && !hosted ? new URL(`/connect?${q}`, window.location.origin).toString() : after;rememberViewer(mode === "owner" ? "owner" : "account");diff --git a/src/lib/ai-setup/status.ts b/src/lib/ai-setup/status.tsindex 7dd8fe7c..f4f54c50 100644--- a/src/lib/ai-setup/status.ts+++ b/src/lib/ai-setup/status.ts@@ -117,5 +117,15 @@ export const NOT_ACTIVE = {export const notActiveText = () => `Fuobe setup status: ${NOT_ACTIVE.next.say}\n`;+/**+ * A code that isn't active, after too many of them from one place (429): the same next step, because a code that is+ * active works at once. The wait (`wait`, like "7 min") is only for when the person has no new code.+ */+export function notActiveBusy(wait: string) {+ const say = `${NOT_ACTIVE.next.say} A code that is active works at once. Too many codes that are not active were read from here: only if the person has no new code, wait ${wait}, then try again.`;+ const error = `Too many codes that are not active. Ask the person for the code Fuobe shows now. With no new code, try again in ${wait}.`;+ return { json: { ...NOT_ACTIVE, next: { ...NOT_ACTIVE.next, say }, error }, text: `Fuobe setup status: ${say}\n` };+}+/** A code in the wrong shape. */export const BAD_CODE = "A setup code has 12 letters and digits, like ABCD-EFGH-JKMN.";diff --git a/tests/ai-setup-routes.test.ts b/tests/ai-setup-routes.test.tsindex 10fb23b0..4b0916e6 100644--- a/tests/ai-setup-routes.test.ts+++ b/tests/ai-setup-routes.test.ts@@ -311,6 +311,28 @@ describe("the public status", () => {expect((await read(body.code)).status).toBe(200);});+ it("still says what to do past the budget for codes that aren't active: ask for the code Fuobe shows now", async () => {+ const at = (q = "") => read("ZZZZ-ZZZZ-ZZZZ", q, { "x-forwarded-for": "198.51.100.9" });+ for (let i = 0; i < 10; i++) expect((await at()).status).toBe(404);+ const text = await at();+ expect(text.status).toBe(429);+ const wait = Number(text.headers.get("retry-after"));+ expect(wait).toBeGreaterThan(0);+ expect(text.headers.get("content-type")).toMatch(/^text\/plain/);+ const words = await text.text();+ expect(words).toMatch(/^[\x0a\x20-\x7e]*$/);+ expect(words).toContain("Ask the person for the code Fuobe shows now.");+ expect(words).toContain("A code that is active works at once.");+ expect(words).toMatch(/only if the person has no new code, wait \d+ (s|min), then try again\./);+ const json = await (await at("?format=json")).json();+ expect(json).toMatchObject({ fuobe_setup: 1, state: "not_active", next: { id: "new-code" }, retryAfterS: expect.any(Number) });+ expect(json.next.say).toContain("Ask the person for the code Fuobe shows now.");+ expect(json.error).toContain("Ask the person for the code Fuobe shows now.");+ // The code Fuobe shows now works at once: an active code never uses this budget.+ const { body } = await create(a);+ expect((await read(body.code, "", { "x-forwarded-for": "198.51.100.9" })).status).toBe(200);+ });+it("limits guesses per visitor behind a trusted proxy", async () => {process.env.FUOBE_TRUST_PROXY = "1";try {diff --git a/tests/e2e/ai-setup.mjs b/tests/e2e/ai-setup.mjsindex 4ce1bb8c..74f1752a 100644--- a/tests/e2e/ai-setup.mjs+++ b/tests/e2e/ai-setup.mjs@@ -8,13 +8,14 @@//// pnpm build && node tests/e2e/ai-setup.mjs//-// Checks: a guest gets "Set it up with my AI" through sign-up; the panel opens with a code, and nothing moves when the+// Checks: a guest at "Set it up with my AI" gets Log in first, then Sign up, both back to the same link; the panel opens with a code, and nothing moves when the// code arrives; the hand-offs wait for the browser's question; each stand-in ticks the checklist on and the public// status follows (text and JSON, no cookie); the guard step waits for the guard; it connects by itself and makes the// first picture; the prefill links and the agent command carry the code and nothing else; End this code ends it; a-// ComfyUI that stops answering is waited for, with the time so far; Safari gets the web address; a phone gets Send to-// my computer, and its setup ends on the computer at the box for the address, under the same code; a web address's-// ComfyUI on the processor is said as such.+// ComfyUI that stops answering is waited for, with the time so far; Safari gets the web address; a phone gets one Send+// to my computer, which sends the way the phone is on, and its setup ends on the computer at the box for the address,+// under the same code, after Log in through the form; a guest's Sign up from that link comes back on its way; a web+// address's ComfyUI on the processor is said as such.import { spawn } from "node:child_process";import fs from "node:fs";import os from "node:os";@@ -132,24 +133,6 @@ async function signUp(page) {throw new Error("sign-up kept answering 429");}-/** The same account in another browser (the computer, after the phone). */-async function logIn(page, email) {- for (let i = 0; i < 6; i++) {- const r = await page.evaluate(- (email) =>- fetch("/api/auth/login", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ email, password: "long enough password" }) }).then((r) => ({- status: r.status,- wait: Number(r.headers.get("retry-after")) || 5,- })),- email,- );- if (r.status === 200 || r.status === 201) return;- if (r.status !== 429) throw new Error(`log-in answered ${r.status}`);- await sleep(r.wait * 1000 + 200);- }- throw new Error("log-in kept answering 429");-}-/** The setup code the panel shows, once it shows one. */const codeOf = (page) =>until(async () => {@@ -157,8 +140,45 @@ const codeOf = (page) =>return t && /^[A-Z2-9]{4}-[A-Z2-9]{4}-[A-Z2-9]{4}$/.test(t) ? t : null;}, 15_000);+/**+ * A guest's card at /connect?setup=ai: its links in order, as [name, href], once it shows (null if it never does). The+ * card says, in one line, to log in with the account the setup started with.+ */+const guestLinks = (page) =>+ until(async () => {+ const card = page.getByText("Started on your phone? Log in with the same account, and the setup goes on here.").locator("..");+ if (!(await card.isVisible())) return null;+ return card.getByRole("link").evaluateAll((as) => as.map((a) => [a.textContent.trim(), a.getAttribute("href")]));+ }, 30_000);++/** navigator.share as a phone has it, kept on the page (window.__shared), never a share sheet. */+const withShare = (ctx) =>+ ctx.addInitScript(() => {+ window.__shared = [];+ Navigator.prototype.share = async function (d) {+ window.__shared.push(d);+ };+ });++/** The phone's one button that sends the setup to the computer: how many there are, and the link it sends. */+async function sendToComputer(page) {+ const buttons = page.getByRole("button", { name: /my computer/ });+ const count = await buttons.count();+ const before = await page.evaluate(() => window.__shared.length);+ await page.getByRole("button", { name: "Send to my computer", exact: true }).click();+ const shared = await until(() => page.evaluate((n) => window.__shared[n]?.url, before), 5000);+ return { count, url: shared };+}++/** On a phone: the way picked by hand (Change, then the way's pill). */+async function pickWayOn(page, name) {+ await page.getByRole("button", { name: "Change", exact: true }).click();+ await page.getByRole("tab", { name, exact: true }).click();+ await page.getByRole("button", { name: "Done", exact: true }).click();+}+/** What the person's AI reads: the status, with no cookie. */-const status = (code, json = false) => fetch(`${SITE}/api/setup/${code}${json ? "?format=json" : ""}`).then(async (r) => ({ status: r.status, body: json ? await r.json() : await r.text() }));+const status =(code, json = false) => fetch(`${SITE}/api/setup/${code}${json ? "?format=json" : ""}`).then(async (r) => ({ status: r.status, body: json ? await r.json() : await r.text() }));let browser;try {@@ -177,10 +197,14 @@ try {const page = await ctx.newPage();if (process.env.E2E_CONSOLE) page.on("console", (m) => console.log(`[page] ${m.type()} ${m.text()}`));- // A guest: the button signs up first.+ // A guest at Set it up with my AI: Log in first (the account it started with), then Sign up, both back to this link.await page.goto(`${SITE}/connect?setup=ai`, { waitUntil: "load" });- const guestButton = page.getByRole("link", { name: "Set it up with my AI" });- check(`${tag}: a guest gets Set it up with my AI, through sign-up`, !!(await until(() => guestButton.isVisible(), 30_000)) && /\/login\?signup=1&next=%2Fconnect%3Fsetup%3Dai/.test((await guestButton.getAttribute("href")) ?? ""));+ const links = await guestLinks(page);+ check(+ `${tag}: a guest gets Log in first, then Sign up free, both back to Set it up with my AI`,+ JSON.stringify(links) === JSON.stringify([["Log in", "/login?next=%2Fconnect%3Fsetup%3Dai"], ["Sign up free", "/login?signup=1&next=%2Fconnect%3Fsetup%3Dai"]]),+ JSON.stringify(links),+ );await page.screenshot({ path: path.join(shots, `${tag}-0-guest.png`) });// An account: the panel, with a code. The code is held back a moment here: the page keeps its place for it.@@ -190,7 +214,7 @@ try {if (route.request().method() === "POST" && held++ === 0) await sleep(2500);return route.continue();});- await page.goto(`${SITE}/connect?setup=ai`, { waitUntil: "load" });+ await page.goto(`${SITE}/connect?setup=ai&way=direct`, { waitUntil: "load" });const heading = page.getByRole("heading", { name: "Set it up with your AI" });check(`${tag}: the panel opens`, !!(await until(() => heading.isVisible(), 30_000)));// Where the checklist sits under the panel's heading (the page around the panel may settle meanwhile).@@ -270,7 +294,7 @@ try {check(`${tag}: the status never holds the account's email or the GPU's name`, !JSON.stringify(st?.body ?? {}).includes("example.com") && !JSON.stringify(st?.body ?? {}).includes("5090"));// End this code: the AI's reads stop.- await page.goto(`${SITE}/connect?setup=ai`, { waitUntil: "load" });+ await page.goto(`${SITE}/connect?setup=ai&way=direct`, { waitUntil: "load" });await heading.waitFor({ timeout: 30_000 });await sleep(1500);const lookAgain = page.getByRole("button", { name: "Let Fuobe look" });@@ -297,7 +321,7 @@ try {const page = await ctx.newPage();await page.goto(`${SITE}/connect`, { waitUntil: "load" });await signUp(page);- await page.goto(`${SITE}/connect?setup=ai`, { waitUntil: "load" });+ await page.goto(`${SITE}/connect?setup=ai&way=direct`, { waitUntil: "load" });await page.getByRole("heading", { name: "Set it up with your AI" }).waitFor({ timeout: 30_000 });const codeEl = page.locator("span[aria-label^='Setup code']");const code = await until(async () => {@@ -343,6 +367,11 @@ try {await signUp(page);await page.goto(`${SITE}/connect?setup=ai`, { waitUntil: "load" });await page.getByRole("heading", { name: "Set it up with your AI" }).waitFor({ timeout: 30_000 });+ check("Safari: Fuobe Connect first, for a Mac", !!(await until(() => page.getByText("For ComfyUI on your macOS computer, with Fuobe Connect.").isVisible(), 10_000)));+ check("Safari: …paired with the code ComfyUI shows", await page.getByText("The code ComfyUI shows").isVisible());+ await page.screenshot({ path: path.join(shots, "safari-connect-1440.png"), fullPage: true });+ await page.goto(`${SITE}/connect?setup=ai&way=address`, { waitUntil: "load" });+ await page.getByRole("heading", { name: "Set it up with your AI" }).waitFor({ timeout: 30_000 });check("Safari: the web address way, for a Mac", await page.getByText("For ComfyUI on your macOS computer, through a web address.").isVisible());check("Safari: the address form is in the checklist", await page.getByLabel("Your ComfyUI's web address").isVisible());const href = (await page.getByRole("link", { name: /Open in ChatGPT/ }).getAttribute("href").catch(() => "")) ?? "";@@ -360,16 +389,25 @@ try {userAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 19_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",colorScheme: "dark",}, { safari: true });+ await withShare(ctx);const page = await ctx.newPage();await page.goto(`${SITE}/connect`, { waitUntil: "load" });await signUp(page);await page.goto(`${SITE}/connect?setup=ai`, { waitUntil: "load" });await page.getByRole("heading", { name: "Set it up with your AI" }).waitFor({ timeout: 30_000 });check("phone: Send to my computer comes first", await page.getByRole("button", { name: /Send to my computer|Copy link for my computer/ }).isVisible());+ check("phone: …and says to log in there with this account", await page.getByText("It opens this setup on your computer. Log in there with this account.").isVisible());check("phone: the AI apps wait for the computer to be picked", await page.getByText("Pick the computer that runs ComfyUI first.").isVisible());await page.getByRole("tab", { name: "Windows" }).click();const href = await until(() => page.getByRole("link", { name: /Open in ChatGPT/ }).getAttribute("href"), 10_000);check("phone: the message says every command runs on the computer", !!href && decodeURIComponent(href).includes("I am on my phone now"));+ // One button sends the setup to the computer, on the way the phone is on.+ let sent = await sendToComputer(page);+ check("phone, Fuobe Connect: one button sends the setup to the computer, on Fuobe Connect", sent.count === 1 && sent.url === `${SITE}/connect?setup=ai&way=connect`, JSON.stringify(sent));+ await pickWayOn(page, "A web address");+ await page.getByLabel("Your ComfyUI's web address").waitFor({ timeout: 10_000 });+ sent = await sendToComputer(page);+ check("phone, web address: still one button, and it sends the box for the address", sent.count === 1 && sent.url === `${SITE}/connect?setup=ai&way=address`, JSON.stringify(sent));const wide = await page.evaluate(() => document.documentElement.scrollWidth > window.innerWidth + 1);check("phone: no sideways scroll", !wide);await page.screenshot({ path: path.join(shots, "phone-390-dark.png"), fullPage: true });@@ -380,15 +418,22 @@ try {// the page the status names, signed in to the same account: the box for the address, in focus, under the same code.{const phoneCtx = await context(browser, { viewport: { width: 390, height: 844 }, isMobile: true, hasTouch: true, userAgent: IPHONE }, { safari: true });+ await withShare(phoneCtx);const phone = await phoneCtx.newPage();await phone.goto(`${SITE}/connect`, { waitUntil: "load" });const email = await signUp(phone);await phone.goto(`${SITE}/connect?setup=ai`, { waitUntil: "load" });await phone.getByRole("heading", { name: "Set it up with your AI" }).waitFor({ timeout: 30_000 });await phone.getByRole("tab", { name: "Windows" }).click();+ await pickWayOn(phone, "A web address");const code = await codeOf(phone);check("phone to computer: the phone has a code", !!code, code ?? "");- check("phone to computer: the phone says where the address goes, with a link for the computer", (await phone.getByText(/On that computer, open .*\/connect\?setup=ai&way=address/).isVisible()) && (await phone.getByRole("button", { name: /this link (to|for) my computer/ }).isVisible()));+ check(+ "phone to computer: the phone says where the address goes, and names its one Send button",+ await phone.getByText(/On that computer, open .*\/connect\?setup=ai&way=address and log in with this account, or press Send to my computer at the top\./).isVisible(),+ );+ const sent = await sendToComputer(phone);+ check("phone to computer: Send to my computer sends the box for the address", sent.count === 1 && sent.url === `${SITE}/connect?setup=ai&way=address`, JSON.stringify(sent));await phone.screenshot({ path: path.join(shots, "phone-to-computer-1-phone.png"), fullPage: true });let st = await until(async () => {const s = await status(code, true);@@ -399,12 +444,20 @@ try {const pcCtx = await context(browser, { viewport: { width: 1440, height: 900 } });const pc = await pcCtx.newPage();- await pc.goto(`${SITE}/connect?setup=ai&way=address`, { waitUntil: "load" });- const logInLink = pc.locator('a[href*="next=%2Fconnect%3Fsetup%3Dai%26way%3Daddress"]', { hasText: "Log in" }).first();- check("phone to computer: signed out, Log in comes back to the same page", !!(await until(() => logInLink.isVisible(), 30_000)));+ await pc.goto(sent.url ?? `${SITE}/connect?setup=ai&way=address`, { waitUntil: "load" });+ const pcLinks = await guestLinks(pc);+ check(+ "phone to computer: signed out, Log in comes first, for the phone's account, then Sign up free, both back to the same page",+ JSON.stringify(pcLinks) === JSON.stringify([["Log in", "/login?next=%2Fconnect%3Fsetup%3Dai%26way%3Daddress"], ["Sign up free", "/login?signup=1&next=%2Fconnect%3Fsetup%3Dai%26way%3Daddress"]]),+ JSON.stringify(pcLinks),+ );await pc.screenshot({ path: path.join(shots, "phone-to-computer-2-guest-1440.png") });- await logIn(pc, email);- await pc.goto(`${SITE}/connect?setup=ai&way=address`, { waitUntil: "load" });+ // Log in through the form: back at the same page.+ await pc.getByText("Started on your phone? Log in with the same account, and the setup goes on here.").locator("..").getByRole("link", { name: "Log in", exact: true }).click();+ await pc.getByPlaceholder("Email").fill(email);+ await pc.getByPlaceholder("Password", { exact: true }).fill("long enough password");+ await pc.locator('form button[type="submit"]').click();+ check("phone to computer: Log in comes back to the same page", !!(await until(() => pc.url() === `${SITE}/connect?setup=ai&way=address`, 30_000)), pc.url());await pc.getByRole("heading", { name: "Set it up with your AI" }).waitFor({ timeout: 30_000 });const box = pc.getByLabel("Your ComfyUI's web address");check("phone to computer: the computer shows the box for the address", !!(await until(() => box.isVisible(), 15_000)));@@ -430,6 +483,27 @@ try {await pcCtx.close();}+ // A guest who signs up from a phone's link: the new account comes back to Set it up with my AI, on the link's way.+ {+ const ctx = await context(browser, { viewport: { width: 390, height: 844 }, colorScheme: "dark" });+ const page = await ctx.newPage();+ await page.goto(`${SITE}/connect?setup=ai&way=address`, { waitUntil: "load" });+ await guestLinks(page);+ await page.screenshot({ path: path.join(shots, "guest-from-phone-link-390-dark.png"), fullPage: true });+ check("guest from a phone's link, 390: no sideways scroll", !(await page.evaluate(() => document.documentElement.scrollWidth > window.innerWidth + 1)));+ await page.getByRole("link", { name: "Sign up free", exact: true }).last().click();+ await page.getByPlaceholder("Email").fill(`e2e-ai-setup-form-${Date.now()}@example.com`);+ await page.getByPlaceholder("Password (at least 8 characters)").fill("long enough password");+ await page.locator('form button[type="submit"]').click();+ const back = await until(() => {+ const u = new URL(page.url());+ return u.pathname === "/connect" && u.searchParams.get("setup") === "ai" && u.searchParams.get("way") === "address";+ }, 30_000);+ check("guest from a phone's link: Sign up comes back to Set it up with my AI, on the web address", !!back, page.url());+ check("guest from a phone's link: …at the box for the address", !!(await until(() => page.getByLabel("Your ComfyUI's web address").isVisible(), 30_000)));+ await ctx.close();+ }+// A web address whose ComfyUI runs on the processor: said as such, never as a GPU that is too small. (The server// never tests an address on this computer, so the account's saved address and its check are played here.){@@ -447,7 +521,7 @@ try {await ctx.route(/\/api\/gpu\/badges/, (route) =>route.fulfill({ json: { connected: true, checkedAt: Date.now(), models: { "oss-z-image-turbo#t2i": ["g", 0, 0, 0], "oss-krea2-turbo#t2i": ["g", 0, 0, 0], "oss-sdxl#t2i": ["g", 0, 0, 0], "oss-flux1-schnell#t2i": ["g", 0, 0, 0] }, presets: {} } }),);- await page.goto(`${SITE}/connect?setup=ai`, { waitUntil: "load" });+ await page.goto(`${SITE}/connect?setup=ai&way=address`, { waitUntil: "load" });await page.getByRole("heading", { name: "Set it up with your AI" }).waitFor({ timeout: 30_000 });const steps = page.getByRole("list", { name: "Setup steps" });check("processor, web address: the model step says it runs on the processor", !!(await until(() => steps.getByText("ComfyUI runs on the processor").isVisible(), 20_000)));