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
Connect your GPU: the web address steps say where to get cloudflared, iPads get the tablet words, and a connected computer stays first
Adarsh13860833c226
diff --git a/src/components/gpu/comfy-finder.tsx b/src/components/gpu/comfy-finder.tsxindex dc189c5f..61c563e8 100644--- a/src/components/gpu/comfy-finder.tsx+++ b/src/components/gpu/comfy-finder.tsx@@ -1,6 +1,7 @@"use client";import { Copy } from "lucide-react";+import { Fragment } from "react";import { copyWithToast } from "@/lib/clipboard";import { rememberedComfy } from "./computer-runtime";@@ -28,7 +29,7 @@ export function isLocalAddress(url: string): boolean {export const gib = (bytes?: number) => (bytes ? `${(bytes / 2 ** 30).toFixed(bytes >= 10 * 2 ** 30 ? 0 : 1)} GB` : undefined);-/** The command that puts a public https address in front of a local ComfyUI. */+/** The command that gives a ComfyUI on this computer a web address (a Cloudflare quick tunnel; nothing to sign up for). */export const tunnelCommand = (port: number) => `cloudflared tunnel --url http://localhost:${port}`;function CopyLine({ text, label }: { text: string; label: string }) {@@ -49,16 +50,51 @@ function CopyLine({ text, label }: { text: string; label: string }) {);}-/** How to give a ComfyUI a public address: a tunnel on the computer it runs on (its usual port, or the one last found). */+const RELEASES = "https://github.com/cloudflare/cloudflared/releases/latest/download";++/**+ * Where to get cloudflared, Cloudflare's free app that gives a program on a computer a web address: the Mac and Windows+ * installers (signed by Cloudflare; they put it where Terminal and Command Prompt find it), and Cloudflare's own page for+ * Linux. A file starts downloading in place; the page opens in a new tab.+ */+const CLOUDFLARED: { label: string; href: string; page?: boolean }[] = [+ { label: "Mac", href: `${RELEASES}/cloudflared-arm64.pkg` },+ { label: "Intel Mac", href: `${RELEASES}/cloudflared-amd64.pkg` },+ { label: "Windows", href: `${RELEASES}/cloudflared-windows-amd64.msi` },+ { label: "Linux", href: "https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/downloads/#linux", page: true },+];++/**+ * How to give a ComfyUI a web address, in three steps on the computer it runs on: install cloudflared, run its one+ * command (ComfyUI's usual port, or the one last found), paste the address it shows. No words a visitor has to look up.+ */export function TunnelSteps() {const port = rememberedComfy()?.port ?? 8188;return (<div className="space-y-2 rounded-xl border p-3 text-[13px]">- <p className="font-medium">Give your ComfyUI a public address</p>- <p className="text-[12px] text-muted-foreground">On the computer that runs ComfyUI, start a tunnel, then paste the https address it prints below:</p>- <CopyLine text={tunnelCommand(port)} label="tunnel command" />+ <p className="font-medium">Give your ComfyUI a web address</p>+ <p className="text-[12px] text-muted-foreground">Cloudflare's free app, cloudflared, gives it one. On the computer that runs ComfyUI:</p>+ <ol className="list-decimal space-y-2 pl-5 text-[12px] text-muted-foreground">+ <li>+ Install cloudflared for{" "}+ {CLOUDFLARED.map((d, i) => (+ <Fragment key={d.label}>+ {i > 0 && (i === CLOUDFLARED.length - 1 ? " or " : ", ")}+ <a href={d.href} {...(d.page && { target: "_blank", rel: "noreferrer" })} className="font-medium text-brand-text underline-offset-4 hover:underline">+ {d.label}+ </a>+ </Fragment>+ ))}+ .+ </li>+ <li className="space-y-1.5">+ <span className="block">Open Terminal (on Windows, Command Prompt), paste this and press Enter:</span>+ <CopyLine text={tunnelCommand(port)} label="the command" />+ </li>+ <li>Paste the web address it shows, ending in trycloudflare.com, in the box below. Keep that window open: the address works while it runs.</li>+ </ol><p className="text-[11px] text-muted-foreground">- Or ngrok: ngrok http {port}. ComfyUI on another port? Use that port instead of {port}.+ Does your ComfyUI's own address end in a number other than {port}? Put that number in the command in place of {port}.</p></div>);diff --git a/src/components/gpu/connect-choice.tsx b/src/components/gpu/connect-choice.tsxindex dae43922..b1472773 100644--- a/src/components/gpu/connect-choice.tsx+++ b/src/components/gpu/connect-choice.tsx@@ -23,7 +23,8 @@ import { openConnect, openFinder, useComputerState, type FindReason } from "./co* "Connect your GPU": the ComfyUI on this computer first (the quickest way: nothing to install, runs while Fuobe is* open in this browser). For an account, a link (a tunnel) second, for runs that go on with the tab closed; for the* owner of a hosted studio, a ComfyUI at a server address (a cloud GPU, a tunnel). On a phone, in Safari, or on a page- * that can't ask for the permission, only the second way, with why.+ * that can't ask for the permission, only the second way, with why; or, when the computer was connected from another+ * browser, its state (runs started here go to it), with the second way on request.*/export type AccountGpuView = OwnerGpuView | { mode: "link"; url: string; hasToken: boolean };@@ -120,13 +121,17 @@ function ComputerProblem({ here, server }: { here: ReturnType<typeof useHere>; s);return null;}- return (- <p className="text-[12px] text-muted-foreground">- {server === "down" ? "ComfyUI isn't running on your computer. Start it there." : server === "no-setting" ? "ComfyUI on your computer needs Fuobe's setting again. Open Fuobe there to see how." : "Offline. Open Fuobe on the computer that runs ComfyUI."}- </p>- );+ // The server's word: this browser doesn't hold the jobs (a phone, Safari, another computer). The tab that runs them is+ // in the browser that connected the computer, which may be on this very computer: never "open Fuobe" as if it weren't.+ return <p className="text-[12px] text-muted-foreground">{SERVER_PROBLEM[server ?? "offline"]}</p>;}+const SERVER_PROBLEM: Record<"down" | "no-setting" | "offline", string> = {+ down: "ComfyUI isn't running on your computer. Start it, and your runs go on by themselves.",+ "no-setting": "ComfyUI on your computer needs Fuobe's setting again. The Fuobe tab in the browser you connected it from shows how.",+ offline: "Offline. Your runs start when a Fuobe tab is open in the browser you connected your computer from.",+};+/** "Other websites could also send work to your ComfyUI": the guard isn't in it yet. */function NoGuard({ port }: { port: number }) {return (@@ -195,6 +200,7 @@ function ComputerStatus({ gpu, onDisconnect, other, look = true }: { gpu: Comput{busy ? <Loader2 className="animate-spin" /> : <Unplug />} Disconnect</Button></div>+ {!look && online && <p className="text-[12px] text-muted-foreground">Runs you start from here go to your computer.</p>}{mine?.busy && <p className="text-[12px] text-muted-foreground">Disconnect stops the runs going on now.</p>}{gpu.cors === "any" && <p className="text-[12px] text-amber-700 dark:text-amber-400">Your ComfyUI lets every website in. To keep it private, start it with --enable-cors-header {window.location.origin} instead.</p>}{look && online && guard === false && gpu.cors !== "any" && shownPort && <NoGuard port={shownPort} />}@@ -343,7 +349,7 @@ export function OwnerServerComfy({label={hosted ? "Server address" : "ComfyUI server URL"}idleLabel="Connect"placeholder={hosted ? "https://…" : "http://127.0.0.1:8188"}- hint={hosted ? "An address Fuobe's server can reach: a cloud GPU, or a tunnel to your own." : "Where ComfyUI listens; a local install is http://127.0.0.1:8188."}+ hint={hosted ? "A web address Fuobe's server can reach: a cloud GPU, or the ComfyUI on your computer through cloudflared." : "Where ComfyUI listens; a local install is http://127.0.0.1:8188."}hideDefault={hosted}extraValues={computer ? { comfyWhere: "server" } : undefined}place={place}@@ -446,27 +452,36 @@ function AccountChoice({ fromRun, kind, reason, onStart, onNotNow, className, loconst [link, setLink] = useState(false);if (q.isError) return <p className="text-[13px] text-muted-foreground">{q.error.message}</p>;if (!q.data) return <Loader2 className="size-5 animate-spin text-muted-foreground" />;+ const disconnect = async () => {+ qc.setQueryData(["account-gpu"], await gpuCall("DELETE"));+ void qc.invalidateQueries({ queryKey: ["viewer"] });+ void qc.invalidateQueries({ queryKey: ["status"] });+ };if (support !== "ok") {- // A phone, Safari, a plain-http page: only the link, and nothing looks for a ComfyUI on this device.+ // A phone, Safari, a plain-http page: nothing looks for a ComfyUI on this device.+ // Connected with "this computer" already (from another browser): runs started here go to it, so its state comes+ // first, and the web address (which would take the runs off it) only on request.+ if (gpu?.mode === "computer")+ return (+ <div className="space-y-4">+ <ComputerStatus gpu={gpu} look={false} onDisconnect={disconnect} other={{ label: link ? "Keep using your computer" : "Use a web address instead", onClick: () => setLink((v) => !v) }} />+ {link && (+ <>+ <p className="text-[12px] text-muted-foreground">Once a web address is connected, your runs go there instead of to your computer.</p>+ <YourGpu className={className} onLinked={onStart} />+ </>+ )}+ </div>+ );+ // Why not this computer, then the web address form (once connected, the form alone says so).return (<div className="space-y-4">- <p className="rounded-xl bg-muted px-3 py-2.5 text-[13px] text-muted-foreground">{unsupportedWords(support)}</p>+ {!gpu && <p className="rounded-xl bg-muted px-3 py-2.5 text-[13px] text-muted-foreground">{unsupportedWords(support)}</p>}<YourGpu className={className} onLinked={onStart} /></div>);}- if (gpu?.mode === "computer" && !flow && !link)- return (- <ComputerStatus- gpu={gpu}- onDisconnect={async () => {- qc.setQueryData(["account-gpu"], await gpuCall("DELETE"));- void qc.invalidateQueries({ queryKey: ["viewer"] });- void qc.invalidateQueries({ queryKey: ["status"] });- }}- other={{ label: "Use a link instead", onClick: () => setLink(true) }}- />- );+ if (gpu?.mode === "computer" && !flow && !link) return <ComputerStatus gpu={gpu} onDisconnect={disconnect} other={{ label: "Use a link instead", onClick: () => setLink(true) }} />;const linked = gpu?.mode === "link";return (<ChoiceCards@@ -591,13 +606,22 @@ function OwnerChoice({ fromRun, kind, reason, onStart, onNotNow, className, look{computer ? serverOpen && serverBox : serverForm}</div>);- // A phone, Safari, a plain-http page: what the computer said last (if it runs there), why not here, and the server way.+ // A phone, Safari, a plain-http page. While ComfyUI runs on the owner's computer, runs started here go to it: its+ // state, and the server way (which would stop them) only on request. Otherwise why not here, and the server way.if (support !== "ok")return (<div className={cn("w-full min-w-0 space-y-3 sm:max-w-[36rem]", className)}>- {state}- <p className="rounded-xl bg-muted px-3 py-2.5 text-[13px] text-muted-foreground">{unsupportedWords(support, true)}</p>- {serverBox}+ {computer ? (+ <>+ {state}+ {serverOpen && serverBox}+ </>+ ) : (+ <>+ <p className="rounded-xl bg-muted px-3 py-2.5 text-[13px] text-muted-foreground">{unsupportedWords(support, true)}</p>+ {serverBox}+ </>+ )}</div>);if (computer && !flow)@@ -664,7 +688,10 @@ export function OwnerComfyWhere({ value, onChange }: { value: string; onChange:);})}</div>- {support !== "ok" && (picking || computer) ? (+ {support !== "ok" && computer ? (+ // Set up from another browser: runs started here go there, and this page can't see that ComfyUI itself.+ <p className="text-[13px] text-muted-foreground">Your runs go to your computer while a Fuobe tab is open in the browser you connected it from.</p>+ ) : support !== "ok" && picking ? (<p className="text-[13px] text-muted-foreground">{unsupportedWords(support, true)}</p>) : picking && !computer ? (<ThisComputerdiff --git a/src/components/gpu/open-connect.ts b/src/components/gpu/open-connect.tsindex ce0de166..8e35e174 100644--- a/src/components/gpu/open-connect.ts+++ b/src/components/gpu/open-connect.ts@@ -40,6 +40,12 @@ const subscribeNarrow = (cb: () => void) => {return () => m.removeEventListener("change", cb);};+/**+ * Under Safari's words, a quieter last line: what the other browsers allow (never "open Fuobe in…": it is open). Not on+ * an iPad, whose browsers are all Safari underneath (that is a "phone").+ */+export const OTHER_BROWSERS = "Chrome, Edge and Firefox allow this, so switching browser also works.";+/** Can this browser use the ComfyUI on its computer at all ("ok"), or why not. */export function useComputerSupport(): "ok" | "safari" | "phone" | "http" {const narrow = useSyncExternalStore(subscribeNarrow, () => window.matchMedia(NARROW).matches, () => false);diff --git a/src/components/gpu/this-computer.tsx b/src/components/gpu/this-computer.tsxindex d2f548ed..5ea8c61e 100644--- a/src/components/gpu/this-computer.tsx+++ b/src/components/gpu/this-computer.tsx@@ -20,6 +20,7 @@ import { madeNoun } from "@/lib/relay";import { cn } from "@/lib/utils";import { computerState, rememberComfy, rememberedComfy, restartComputerRunner, store, stored } from "./computer-runtime";import { InstallConnect, PairInstead } from "./fuobe-connect";+import { OTHER_BROWSERS } from "./open-connect";import { useLocalComfy, type Finder } from "./use-local-comfy";/**@@ -122,9 +123,6 @@ const UNSUPPORTED_OWNER: Record<Unsupported, string> = {http: "Your browser marks this page as not secure, so it doesn't let the page talk to programs on this computer, like ComfyUI. Use a ComfyUI on a server below, or give this studio a secure address.",};-/** Under Safari's words, a quieter last line: what the other browsers allow (never "open Fuobe in…": it is open). */-const OTHER_BROWSERS = "Chrome, Edge and Firefox allow this, so switching browser also works.";-/** The words, for a <p>: the two sentences, and on Safari the other browsers' line below them. */export const unsupportedWords = (why: Unsupported, owner = false) => (<>diff --git a/src/components/gpu/your-gpu.tsx b/src/components/gpu/your-gpu.tsxindex 71db2f28..100010c2 100644--- a/src/components/gpu/your-gpu.tsx+++ b/src/components/gpu/your-gpu.tsx@@ -34,8 +34,9 @@ async function call<T>(method: string, body?: unknown, test = false): Promise<T>/*** "Your GPU" (public sign-up): an account's own ComfyUI, where its runs go (never this studio's keys- * or GPU). The server calls it, so it needs a public address: a Cloudflare Tunnel or ngrok in front- * of a local ComfyUI. Nothing here looks for a ComfyUI on this device: it shows the tunnel command. 36rem wide at most+ * or GPU). The server calls it, so it needs a web address anyone can reach: cloudflared (or another tunnel) in front+ * of a local ComfyUI. Nothing here looks for a ComfyUI on this device: it shows how to make that address (TunnelSteps),+ * in words a visitor needs no dictionary for. 36rem wide at most* from sm up, unless a wider page lifts that (className, as ConnectChoice's).*/export function YourGpu({ className, onLinked }: { className?: string; onLinked?: () => void } = {}) {@@ -92,7 +93,7 @@ export function YourGpu({ className, onLinked }: { className?: string; onLinked?return (<div className={cn("w-full min-w-0 space-y-4 sm:max-w-[36rem]", className)}><p className="text-[13px] text-muted-foreground">- {gpu ? "Your runs go to your ComfyUI through this web address." : "Your runs go to your ComfyUI through a secure web address. Here's how to make one:"}+ {gpu ? "Your runs go to your ComfyUI through this web address." : "Your runs reach your ComfyUI through a web address. Here's how to give it one:"}</p>{gpu ? (<div className="flex items-start gap-2.5 rounded-xl bg-brand-faint px-3 py-2.5 text-[13px]">@@ -114,11 +115,11 @@ export function YourGpu({ className, onLinked }: { className?: string; onLinked?<div className="space-y-3"><div className="space-y-1.5"><Label htmlFor={`${id}-url`} className="text-[13px]">- {gpu ? "Connect another address" : "Your ComfyUI's public address"}+ {gpu ? "Connect another address" : "Your ComfyUI's web address"}</Label>- <Input id={`${id}-url`} placeholder="https://your-tunnel.trycloudflare.com" value={url} onChange={(e) => setUrl(e.target.value)} aria-invalid={!!error || local} />+ <Input id={`${id}-url`} placeholder="https://your-address.trycloudflare.com" value={url} onChange={(e) => setUrl(e.target.value)} aria-invalid={!!error || local} />{local && (- <p className="text-[12px] text-destructive">That address only works on your own network. Paste the https address your tunnel prints.</p>+ <p className="text-[12px] text-destructive">That address only works on your own computer or network. Paste the one cloudflared shows, ending in trycloudflare.com.</p>)}</div><div className="space-y-1.5">@@ -127,7 +128,7 @@ export function YourGpu({ className, onLinked }: { className?: string; onLinked?</Label><Input id={`${id}-token`} type="password" autoComplete="off" value={token} onChange={(e) => setToken(e.target.value)} aria-describedby={`${id}-token-hint`} /><p id={`${id}-token-hint`} className="text-[12px] text-muted-foreground">- Only if your tunnel or ComfyUI asks for a password or token.+ Only if your ComfyUI or its web address asks for a password or token.</p></div>{error && <p className="text-[12px] text-destructive">{error}</p>}diff --git a/src/components/live/live-edit-app.tsx b/src/components/live/live-edit-app.tsxindex 1b8c3fa7..3230f5c4 100644--- a/src/components/live/live-edit-app.tsx+++ b/src/components/live/live-edit-app.tsx@@ -4,7 +4,7 @@ import { Cpu, LogIn, Sparkles, Zap } from "lucide-react";import Link from "next/link";import { useSearchParams } from "next/navigation";import { useMemo, useState } from "react";-import { openConnect, useComputerSupport } from "@/components/gpu/open-connect";+import { OTHER_BROWSERS, openConnect, useComputerSupport } from "@/components/gpu/open-connect";import { rememberedComfy } from "@/components/gpu/computer-runtime";import { PhoneNavButton } from "@/components/nav/phone-nav-button";import { Button } from "@/components/ui/button";@@ -86,18 +86,14 @@ export function LiveEditPanel({ image, text, onUse, onClose }: { image?: string;<div><p className="font-heading text-[24px] leading-tight">Change it as you type</p><p className="mt-1.5 text-[13.5px] text-muted-foreground">- {live.s === "guest"- ? "Sign up free to run Live edit on your own GPU."- : live.s === "connect"- ? "Live edit runs on your own GPU. Connect it to start."- : "Live edit on your computer needs Chrome or Edge on a desktop."}+ {live.s === "guest" ? "Sign up free to run Live edit on your own GPU." : live.s === "connect" ? "Live edit runs on your own GPU. Connect it to start." : <CantReach />}</p><div className="mt-3 flex gap-2">{live.s === "guest" ? (<Button asChild><Link href={signInHref("signup", "/edit")}>Sign up free</Link></Button>- ) : live.s === "connect" ? (+ ) : live.s === "connect" || live.s === "unsupported" ? (<Button onClick={() => openConnect()}><Cpu className="size-4" />Connect your GPU@@ -124,6 +120,28 @@ export function LiveSkeleton() {);}+/**+ * Live edit with "this computer" in a browser that can't reach it (Safari, a phone or tablet, a page marked not secure):+ * why, in the person's terms, then the way that works from here (a web address; "Connect your GPU" beside these words+ * opens it). Never "open Fuobe in…": Fuobe is open.+ */+const CANT_REACH: Record<"safari" | "phone" | "http", string> = {+ safari: "Safari doesn't let a website talk to programs on your Mac. Give your ComfyUI a web address, and Live edit works from Safari.",+ phone: "A phone or tablet can't talk to programs on your computer from a website. Give your ComfyUI a web address, and Live edit works from here.",+ http: "Your browser marks this page as not secure, so it doesn't let the page talk to programs on this computer. Give your ComfyUI a web address, and Live edit works from here.",+};++function CantReach() {+ const support = useComputerSupport();+ const why = support === "ok" ? "http" : support;+ return (+ <>+ {CANT_REACH[why]}+ {why === "safari" && <span className="mt-1 block text-[12px]">{OTHER_BROWSERS}</span>}+ </>+ );+}+/** Guests, accounts without a GPU, and browsers that can't reach this computer: the recorded session, and the next step. */function LiveShowcase({ kind }: { kind: "guest" | "connect" | "unsupported" }) {const [nudge, setNudge] = useState(false);@@ -180,8 +198,14 @@ function LiveShowcase({ kind }: { kind: "guest" | "connect" | "unsupported" }) {</>) : (<>- <p className="font-medium">Live edit on your computer needs Chrome or Edge on a desktop</p>- <p className="mt-1 text-[13px] text-muted-foreground">This browser can't reach the ComfyUI on your computer. Open Fuobe in Chrome or Edge there.</p>+ <p className="font-medium">Live edit can't reach your ComfyUI from here</p>+ <p className="mt-1 text-[13px] text-muted-foreground">+ <CantReach />+ </p>+ <Button className="mt-3" onClick={() => openConnect()}>+ <Cpu className="size-4" />+ Connect your GPU+ </Button></>)}</div>diff --git a/src/lib/local-comfy.ts b/src/lib/local-comfy.tsindex 06822642..9581f087 100644--- a/src/lib/local-comfy.ts+++ b/src/lib/local-comfy.ts@@ -368,14 +368,16 @@ export function preflightPath(method: "GET" | "POST", path: string): string {/*** Can this browser reach a ComfyUI on its own computer? Chrome, Edge, Brave and Firefox on a computer can. Safari* can't (an https page may not call http://127.0.0.1), nor can any browser on an iPhone or iPad (all are Safari- * underneath), nor a phone (no ComfyUI there): those get the link instead.+ * underneath), nor a phone (no ComfyUI there): those get the link instead. An iPad's browsers say "Macintosh", as a+ * Mac's do: its touch screen tells them apart (no Mac has one).*/export function browserSupport(- nav: { userAgent?: string; userAgentData?: { mobile?: boolean; platform?: string } },+ nav: { userAgent?: string; maxTouchPoints?: number; userAgentData?: { mobile?: boolean; platform?: string } },screen: { narrow: boolean; coarse?: boolean },): "ok" | "safari" | "phone" {const ua = nav.userAgent ?? "";if (/iPhone|iPad|iPod/.test(ua) || nav.userAgentData?.mobile || /Android.+Mobile|Mobile Safari/.test(ua)) return "phone";+ if (/Macintosh/.test(ua) && (nav.maxTouchPoints ?? 0) > 1) return "phone";if (screen.narrow && screen.coarse !== false) return "phone";if (!nav.userAgentData && /Safari\//.test(ua) && !/Chrome|Chromium|CriOS|FxiOS|Edg|Firefox|OPR/.test(ua)) return "safari";return "ok";diff --git a/tests/computer-pure.test.ts b/tests/computer-pure.test.tsindex 79087f37..10d8fc00 100644--- a/tests/computer-pure.test.ts+++ b/tests/computer-pure.test.ts@@ -465,6 +465,19 @@ describe("which browsers can reach the ComfyUI on this computer", () => {expect(browserSupport(nav("Mozilla/5.0 (Windows NT 10.0) Chrome/141.0 Safari/537.36", { brands: true }), { narrow: true, coarse: true })).toBe("phone");});+ it("an iPad's browsers say Macintosh, as a Mac's do: its touch screen makes them a tablet, at any width", () => {+ const ipadSafari = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0 Safari/605.1.15";+ const ipadChrome = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/141.0 Version/18.0 Safari/605.1.15";+ const ipadFirefox = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) FxiOS/141.0 Safari/605.1.15";+ for (const ua of [ipadSafari, ipadChrome, ipadFirefox]) expect(browserSupport({ userAgent: ua, maxTouchPoints: 5 }, { narrow: false, coarse: false })).toBe("phone");+ // A Mac has no touch screen: Safari there is Safari, Chrome and Firefox there can.+ expect(browserSupport({ userAgent: ipadSafari, maxTouchPoints: 0 }, { narrow: false })).toBe("safari");+ expect(browserSupport({ userAgent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0 Safari/537.36", maxTouchPoints: 0, userAgentData: { platform: "macOS", mobile: false } }, { narrow: false })).toBe("ok");+ expect(browserSupport({ userAgent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 15.6; rv:151.0) Gecko/20100101 Firefox/151.0", maxTouchPoints: 0 }, { narrow: false })).toBe("ok");+ // A Windows laptop with a touch screen is still a computer.+ expect(browserSupport({ userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0 Safari/537.36", maxTouchPoints: 10, userAgentData: { platform: "Windows", mobile: false } }, { narrow: false })).toBe("ok");+ });+it("an http page on a network address can't ask Chrome for the permission; localhost and https can", () => {expect(pageCanReach("https://fuobe.com")).toBe(true);expect(pageCanReach("http://localhost:3000")).toBe(true);diff --git a/tests/e2e/computer-mode.mjs b/tests/e2e/computer-mode.mjsindex f82839c6..6a2833eb 100644--- a/tests/e2e/computer-mode.mjs+++ b/tests/e2e/computer-mode.mjs@@ -449,7 +449,8 @@ try {const { ctx, page } = await account("[email protected]", { viewport: { width: 390, height: 844 }, isMobile: true, hasTouch: true, userAgent: iphone });await page.goto(`${SITE}/connect`, { waitUntil: "load" });const phone = await until(() => page.getByText("A phone or tablet can't reach the ComfyUI on your computer from a website.").first().isVisible(), 30_000);- check("a phone gets the link option, with why", !!phone && (await page.getByText(/public address/i).first().isVisible()));+ check("a phone gets the link option, with why", !!phone && (await page.getByText("Give your ComfyUI a web address", { exact: true }).first().isVisible()));+ check("…with where to get cloudflared, and no word to look up", (await page.getByRole("link", { name: "Windows", exact: true }).first().isVisible()) && !(await page.getByText(/start a tunnel|tunnel command|https address|public address|ngrok/i).first().isVisible().catch(() => false)));check("…and only the tunnel steps: nothing looks for a ComfyUI on the phone", !(await page.getByText(/No ComfyUI answered|may ask to let this site reach/).first().isVisible().catch(() => false)) && ctx.loopback.length === 0, ctx.loopback.slice(0, 3).join(" "));await page.screenshot({ path: path.join(shots, "6-phone.png") });// In "this computer" mode, the phone's page never tries to run the jobs itself: they wait for the computer's tab.@@ -459,7 +460,38 @@ try {await page.reload({ waitUntil: "load" });await sleep(4000);check("a phone in this-computer mode never runs the jobs itself", beats.length === 0, beats.join(" "));+ // …and its GPU settings say the computer is connected, not that this page can't reach it: the web address only on+ // request.+ await page.goto(`${SITE}/settings#your-gpu`, { waitUntil: "load" });+ const shown = (l) => l.locator("visible=true").count();+ await until(async () => (await shown(page.getByRole("button", { name: "Use a web address instead" }))) > 0, 30_000);+ check(+ "a phone in this-computer mode shows the computer first, with the web address on request",+ (await shown(page.getByText("Your computer", { exact: true }))) > 0 &&+ (await shown(page.getByRole("button", { name: "Use a web address instead" }))) > 0 &&+ (await shown(page.getByText("A phone or tablet can't reach"))) === 0,+ );+ await page.screenshot({ path: path.join(shots, "6b-phone-computer.png") });+ await page.getByRole("button", { name: "Use a web address instead" }).locator("visible=true").first().click();+ check(+ "…which opens the web address steps, saying the runs then go there",+ !!(await until(async () => (await shown(page.getByText("Give your ComfyUI a web address", { exact: true }))) > 0, 10_000)) &&+ (await shown(page.getByText("Once a web address is connected, your runs go there instead of to your computer."))) > 0,+ );+ await page.screenshot({ path: path.join(shots, "6d-phone-web-address.png") });await ctx.close();+ // An iPad's Safari says "Macintosh", as a Mac's does: its touch screen makes it a tablet, never "Safari on your Mac".+ const ipadUa = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0 Safari/605.1.15";+ const ipad = await account("[email protected]", { viewport: { width: 1024, height: 1366 }, hasTouch: true, userAgent: ipadUa });+ await ipad.ctx.addInitScript(() => {+ Object.defineProperty(Navigator.prototype, "userAgentData", { get: () => undefined });+ Object.defineProperty(Navigator.prototype, "maxTouchPoints", { get: () => 5 });+ });+ await ipad.page.goto(`${SITE}/connect`, { waitUntil: "load" });+ const tablet = await until(() => ipad.page.getByText("A phone or tablet can't reach the ComfyUI on your computer from a website.").first().isVisible(), 30_000);+ check("an iPad gets the tablet words, not Safari's or the finder", !!tablet && !(await ipad.page.getByText(/talk to programs on your Mac|switching browser/).first().isVisible().catch(() => false)));+ await ipad.page.screenshot({ path: path.join(shots, "6c-ipad.png") });+ await ipad.ctx.close();const safari = "Mozilla/5.0 (Macintosh; Intel Mac OS X 15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Safari/605.1.15";const s = await account("[email protected]", { userAgent: safari });// Safari has no navigator.userAgentData (Chromium keeps its own under another user agent).