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
Site QA: fixes from the live check of fuobe.com, batch 6
Adarsh49c4a58ec76f
diff --git a/next.config.ts b/next.config.tsindex 7b148572..c2b30707 100644--- a/next.config.ts+++ b/next.config.ts@@ -38,14 +38,8 @@ const nextConfig: NextConfig = {{ source: "/apps/:id(app-click-to-ad|app-link-to-video-ad)", destination: "/marketing/click-to-ad", permanent: false },// The Virality Predictor app became the /virality page (its frame step is the Hook Frame app).{ source: "/apps/app-virality-predictor", destination: "/virality", permanent: true },- // Studio hubs have one path per mode (src/lib/hubs.ts): old `?mode=` links, and a clip handed- // to Upscale or Audio without a mode, open that mode's own page (prerendered with the right studio).- ...["audio", "video-tools", "upscale"].map((hub) => ({- source: `/${hub}`,- has: [{ type: "query" as const, key: "mode", value: "(?<mode>[a-z0-9-]+)" }],- destination: `/${hub}/:mode`,- permanent: false,- })),+ // Studio hubs have one path per mode (src/lib/hubs.ts). Old `?mode=` links go to it in src/proxy.ts (hubModeLink),+ // which drops the mode from the query; a clip handed to Upscale or Audio without a mode opens Sound for video / Video....["audio", "upscale"].map((hub) => ({source: `/${hub}`,has: [{ type: "query" as const, key: "video" }],diff --git a/src/app/(studio)/apps/[id]/page.tsx b/src/app/(studio)/apps/[id]/page.tsxindex 80f7ca03..8e3ce76f 100644--- a/src/app/(studio)/apps/[id]/page.tsx+++ b/src/app/(studio)/apps/[id]/page.tsx@@ -12,7 +12,7 @@ export function generateStaticParams() {export async function generateMetadata({ params }: PageProps<"/apps/[id]">): Promise<Metadata> {const { id } = await params;const preset = getPreset(id);- return { title: preset?.type === "app" ? preset.name : "Not found" };+ return preset?.type === "app" ? { title: preset.name, description: `${preset.description}. A one-click Fuobe app on open-source models.` } : { title: "Not found" };}async function AppStudio({ params }: { params: PageProps<"/apps/[id]">["params"] }) {diff --git a/src/app/(studio)/apps/page.tsx b/src/app/(studio)/apps/page.tsxindex af6c7bad..fcb9a1d2 100644--- a/src/app/(studio)/apps/page.tsx+++ b/src/app/(studio)/apps/page.tsx@@ -4,14 +4,17 @@ import { PresetGallery } from "@/components/preset-gallery";import { APPS } from "@/lib/catalog";import { toPresetCard } from "@/lib/preset-card-data";-export const metadata: Metadata = { title: "Apps" };+export const metadata: Metadata = {+ title: "Apps",+ description: "One-click AI tools for faces, products, styles and fun, running on open-source ComfyUI workflows.",+};export default function Page() {return (<PageShell><PageHeadertitle="Apps"- description="One-click tools for faces, products, styles and fun. Every app runs on a frontier cloud model or an open-source ComfyUI workflow."+ description="One-click tools for faces, products, styles and fun, each on an open-source ComfyUI workflow (and a cloud model where the studio has one)."/>{/* Slim card data only: no prompt templates, routes or LoRA URLs in the page payload. */}<PresetGallery presets={APPS.map(toPresetCard)} href="/apps/{id}" noun="apps" />diff --git a/src/app/(studio)/effects/page.tsx b/src/app/(studio)/effects/page.tsxindex 1c001596..6cacb143 100644--- a/src/app/(studio)/effects/page.tsx+++ b/src/app/(studio)/effects/page.tsx@@ -4,14 +4,17 @@ import { PresetGallery } from "@/components/preset-gallery";import { EFFECTS } from "@/lib/catalog";import { toPresetCard } from "@/lib/preset-card-data";-export const metadata: Metadata = { title: "Effects" };+export const metadata: Metadata = {+ title: "Effects",+ description: "Explosions, transformations and viral VFX from one photo, made with open-source models on your own GPU.",+};export default function Page() {return (<PageShell><PageHeadertitle="Effects"- description="Explosions, transformations and viral VFX from a single photo. Fuobe DoP runs each with its effect LoRA where one is cleared, free on your GPU or hosted in the cloud; colour looks are graded in your browser."+ description="Explosions, transformations and viral VFX from one photo. Runs free on your GPU or in the cloud; color looks apply instantly in your browser."/><PresetGallery presets={EFFECTS.map(toPresetCard)} href="/video?preset={id}" noun="effects" /></PageShell>diff --git a/src/app/(studio)/motions/page.tsx b/src/app/(studio)/motions/page.tsxindex 66604255..468b9254 100644--- a/src/app/(studio)/motions/page.tsx+++ b/src/app/(studio)/motions/page.tsx@@ -4,14 +4,17 @@ import { PresetGallery } from "@/components/preset-gallery";import { MOTIONS } from "@/lib/catalog";import { toPresetCard } from "@/lib/preset-card-data";-export const metadata: Metadata = { title: "Camera motions" };+export const metadata: Metadata = {+ title: "Camera motions",+ description: "Director-grade camera moves for any image: crash zooms, orbits, bullet time and more, filmed by open-source models on your own GPU.",+};export default function Page() {return (<PageShell><PageHeadertitle="Camera motions"- description="Director-grade camera moves for any image. Pick a move, drop in a start frame: Fuobe DoP runs it with its camera LoRA, free on your GPU or hosted in the cloud. A move with no LoRA of its own runs its words on any video model."+ description="Pick a camera move and add a start frame. Fuobe DoP films it with a trained camera LoRA, free on your GPU or in the cloud."/><PresetGallery presets={MOTIONS.map(toPresetCard)} href="/video?preset={id}" noun="moves" /></PageShell>diff --git a/src/app/api/assist/route.ts b/src/app/api/assist/route.tsindex d06ca60b..75c9e927 100644--- a/src/app/api/assist/route.ts+++ b/src/app/api/assist/route.ts@@ -1,5 +1,6 @@import { after, connection } from "next/server";import { z } from "zod";+import { isGuest } from "@/lib/guest-access";import { addMessage, availability, createThread, listThreads, resolveAgent, resolveMode, run } from "@/server/assist/agent";import { AssistMessage, ModeChoice } from "@/server/assist/schemas";@@ -10,12 +11,15 @@ const Create = AssistMessage.extend({mode: ModeChoice.optional(),});-/** Chats (all, `?project=<id>`, or `?project=none` for chats outside projects; `?q=` searches), with what can run. */+/**+ * Chats (all, `?project=<id>`, or `?project=none` for chats outside projects; `?q=` searches), with what can run.+ * A guest's or an account's list (GUEST_HEADER) is empty: the chats are the owner's.+ */export async function GET(request: Request) {await connection();const sp = new URL(request.url).searchParams;const project = sp.get("project");- const threads = listThreads({ project: project === "none" ? null : (project ?? undefined), q: sp.get("q") ?? undefined });+ const threads = isGuest(request) ? [] : listThreads({ project: project === "none" ? null : (project ?? undefined), q: sp.get("q") ?? undefined });const [agent, can] = await Promise.all([resolveAgent(), availability()]);return Response.json({ threads, agent, availability: can });}diff --git a/src/app/api/auth/logout/route.ts b/src/app/api/auth/logout/route.tsindex 240babb1..cbb2d05b 100644--- a/src/app/api/auth/logout/route.ts+++ b/src/app/api/auth/logout/route.ts@@ -1,7 +1,10 @@import { cookies } from "next/headers";-import { SESSION_COOKIE } from "@/server/auth";+import { endSession, SESSION_COOKIE } from "@/server/auth";+/** Sign out: this session ends on the server too (a copy of its cookie stops working), and the browser forgets it. */export async function POST() {- (await cookies()).delete(SESSION_COOKIE);+ const jar = await cookies();+ endSession(jar.get(SESSION_COOKIE)?.value);+ jar.delete(SESSION_COOKIE);return Response.json({ ok: true });}diff --git a/src/app/api/palettes/route.ts b/src/app/api/palettes/route.tsindex 958becca..97be66f2 100644--- a/src/app/api/palettes/route.ts+++ b/src/app/api/palettes/route.ts@@ -11,10 +11,14 @@ const Body = z.object({thumb: z.string().startsWith("/api/files/").max(500).nullable().optional(),});-/** Your colour signatures and the 50 built-in palettes, plus which models take a palette natively. */+/**+ * Your colour signatures and the 50 built-in palettes, plus which models take a palette natively. A guest or an account+ * (GUEST_HEADER) gets the built-in ones only: the signatures are the owner's.+ */export async function GET(request: Request) {await connection();- return Response.json({ items: isGuest(request) ? [] : listPalettes(), caps: signatureCaps() });+ const items = listPalettes();+ return Response.json({ items: isGuest(request) ? items.filter((p) => p.source === "builtin") : items, caps: signatureCaps() });}export async function POST(request: Request) {diff --git a/src/app/api/uploads/route.ts b/src/app/api/uploads/route.tsindex 77e48ab8..7fe0e27b 100644--- a/src/app/api/uploads/route.ts+++ b/src/app/api/uploads/route.ts@@ -1,7 +1,7 @@import fs from "node:fs";import path from "node:path";import { nanoid } from "nanoid";-import { CONNECT_GPU_HEADER, CONNECT_GPU_MESSAGE } from "@/lib/guest-access";+import { CONNECT_GPU_HEADER, CONNECT_GPU_UPLOAD_MESSAGE } from "@/lib/guest-access";import { imageSize } from "@/lib/image-size";import { sniffMedia, type SniffKind } from "@/lib/sniff";import { ACCOUNT_LIMITS, ACCOUNT_MESSAGES, accountTotalBytes, accountUsage, diskHasRoom, filesFullMessage } from "@/server/account-files";@@ -156,7 +156,7 @@ async function ownerUpload(request: Request): Promise<Response> {// An accountasync function accountUpload(request: Request, account: Account): Promise<Response> {- if (!accountGpu(account.id)) return json(403, { error: CONNECT_GPU_MESSAGE, code: "connect-gpu" }, { [CONNECT_GPU_HEADER]: "1" });+ if (!accountGpu(account.id)) return json(403, { error: CONNECT_GPU_UPLOAD_MESSAGE, code: "connect-gpu" }, { [CONNECT_GPU_HEADER]: "1" });if (!diskHasRoom()) return json(503, { error: ACCOUNT_MESSAGES.diskLow });// A fair share: 60 an hour, 300 a day, 2 at once.const hour = hit(`up:h:${account.id}`, ACCOUNT_LIMITS.uploadsPerHour, 60 * 60_000);diff --git a/src/app/layout.tsx b/src/app/layout.tsxindex d0709429..f9101ff3 100644--- a/src/app/layout.tsx+++ b/src/app/layout.tsx@@ -1,4 +1,4 @@-import type { Metadata } from "next";+import type { Metadata, Viewport } from "next";import { Geist_Mono, Inter, Instrument_Serif } from "next/font/google";import { Providers } from "./providers";import "./globals.css";@@ -13,10 +13,23 @@ const instrumentSerif = Instrument_Serif({});const geistMono = Geist_Mono({ subsets: ["latin"], variable: "--font-geist-mono", display: "swap" });+const TITLE = "Fuobe — open-source AI image & video studio";+const DESCRIPTION = "An open-source AI studio for images, video and sound on your own GPU: ComfyUI workflows, camera motions, effects, apps, lipsync and upscaling.";+export const metadata: Metadata = {- title: { default: "Fuobe — open-source AI image & video studio", template: "%s · Fuobe" },- description:- "Create images and videos with the best paid models or fully open-source ComfyUI workflows. Camera motions, apps, lipsync, upscaling and more.",+ // A shared link's preview image needs a full address: the project's public site (the image is the same on every install).+ metadataBase: new URL("https://fuobe.com"),+ title: { default: TITLE, template: "%s · Fuobe" },+ description: DESCRIPTION,+ openGraph: { siteName: "Fuobe", type: "website", title: TITLE, description: DESCRIPTION },+ twitter: { card: "summary_large_image", title: TITLE, description: DESCRIPTION },+};++export const viewport: Viewport = {+ themeColor: [+ { media: "(prefers-color-scheme: light)", color: "#ffffff" },+ { media: "(prefers-color-scheme: dark)", color: "#121213" },+ ],};export default function RootLayout({ children }: LayoutProps<"/">) {diff --git a/src/app/opengraph-image.alt.txt b/src/app/opengraph-image.alt.txtnew file mode 100644index 00000000..47e6a530--- /dev/null+++ b/src/app/opengraph-image.alt.txt@@ -0,0 +1 @@+Fuobe, the open-source AI studio for images, video and sound\ No newline at end of filediff --git a/src/app/opengraph-image.jpg b/src/app/opengraph-image.jpgnew file mode 100644index 00000000..88406a01Binary files /dev/null and b/src/app/opengraph-image.jpg differdiff --git a/src/app/providers.tsx b/src/app/providers.tsxindex 3c82ceb8..740cb3a2 100644--- a/src/app/providers.tsx+++ b/src/app/providers.tsx@@ -2,9 +2,10 @@import { QueryClient, QueryClientProvider } from "@tanstack/react-query";import { ThemeProvider } from "next-themes";-import { useState } from "react";+import { useEffect, useState } from "react";import dynamic from "next/dynamic";import { GuestPrompt } from "@/components/guest-prompt";+import { AUTH_CHANNEL } from "@/lib/api";/** The GPU pre-flight's guided fix: loaded after the page, listening for "fuobe:gpu-setup". */const GuidedFixHost = dynamic(() => import("@/components/gpu/guided-fix").then((m) => m.GuidedFixHost), { ssr: false });@@ -15,6 +16,16 @@ export function Providers({ children }: { children: React.ReactNode }) {const [client] = useState(() => new QueryClient({ defaultOptions: { queries: { staleTime: 5_000, refetchOnWindowFocus: true, retry: 1 } } }),);+ // Signed in or out in another tab: this one asks who is looking again (its sidebar, its studios' refusals).+ useEffect(() => {+ if (typeof BroadcastChannel === "undefined") return;+ const c = new BroadcastChannel(AUTH_CHANNEL);+ c.onmessage = () => {+ void client.invalidateQueries({ queryKey: ["viewer"] });+ void client.invalidateQueries({ queryKey: ["status"] });+ };+ return () => c.close();+ }, [client]);return (<ThemeProvider attribute="class" defaultTheme="system" enableSystem disableTransitionOnChange><QueryClientProvider client={client}>diff --git a/src/app/s/share-page.tsx b/src/app/s/share-page.tsxindex fa0fe8c1..268d8e43 100644--- a/src/app/s/share-page.tsx+++ b/src/app/s/share-page.tsx@@ -1,4 +1,5 @@import { Box, Download, EyeOff, FileText, Link2Off } from "lucide-react";+import Link from "next/link";import { coverSlide, orderForLayout, pieces, type PublicItem, type PublicMedia, type PublicShare } from "@/lib/share";import { cn } from "@/lib/utils";import { Carousel, RecreateButton } from "@/components/share/share-client";@@ -234,16 +235,20 @@ function Nothing() {);}-/** A revoked, expired, wrong or emptied link: one calm screen, no way into the studio. */+/** A revoked, expired, wrong or emptied link: one calm screen, and the studio's own front door. */export function ShareGone() {return (- <main className="grid min-h-svh place-items-center bg-background px-6 pb-[10vh] text-center">- <div className="max-w-[460px]">+ <main className="flex min-h-svh flex-col bg-background">+ <p className="px-4 pt-5 font-heading text-[22px] leading-none sm:px-8">Fuobe</p>+ <div className="mx-auto flex max-w-[460px] flex-1 flex-col items-center justify-center px-6 pb-[10vh] text-center"><span className="mx-auto grid size-12 place-items-center rounded-2xl bg-brand-faint text-brand-text"><Link2Off className="size-5" /></span><h1 className="mt-5 font-heading text-[34px] leading-tight text-balance">This link isn't available</h1><p className="mt-2 text-[15px] text-pretty text-muted-foreground">It may have expired or been turned off, or what it shared was removed. Ask the person who sent it for a new link.</p>+ <Link href="/" prefetch={false} className="mt-7 inline-flex h-9 items-center rounded-full bg-primary px-4 text-[14px] font-medium text-primary-foreground hover:bg-primary/90">+ Make your own with Fuobe+ </Link></div></main>);diff --git a/src/components/ads/ads-home.tsx b/src/components/ads/ads-home.tsxindex d723f4cd..f281eddc 100644--- a/src/components/ads/ads-home.tsx+++ b/src/components/ads/ads-home.tsx@@ -9,6 +9,8 @@ import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent,import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";import { Skeleton } from "@/components/ui/skeleton";import { BrandStart } from "@/components/brand/brand-dialog";+import { SelfHostNote } from "@/components/self-host-note";+import { useIsVisitor } from "@/lib/api";import { ResearchLabel } from "@/components/brand/research-progress";import type { BrandKit } from "@/lib/catalog/marketing";import { timeAgo } from "@/lib/format";@@ -99,6 +101,8 @@ export function AdsHome() {const { engine, setEngine } = useMarketingEngine();const brands = useBrands();const [deleting, setDeleting] = useState<BrandKit | null>(null);+ // A brand is saved to the studio's library, which is its owner's: a guest or an account is told so, not given the form.+ const visitor = useIsVisitor();return (<div className="flex min-h-svh min-w-0 flex-col"><MarketingHeader title="Ads Studio" active="ads" engine={engine} onEngine={setEngine} />@@ -107,7 +111,11 @@ export function AdsHome() {<h2 className="font-heading text-display text-balance">Create performing static ads</h2><p className="mx-auto mt-2 max-w-lg text-[15px] text-muted-foreground">Enter your website. Your logo, colours, brand voice and selling points load on their own — then on-brand ads for every product, in 1:1, 4:5 and 9:16, with headlines and CTAs.</p><div className="mx-auto mt-6 max-w-[620px] rounded-[20px] border bg-background p-3 text-left shadow-soft sm:rounded-composer sm:p-4">- <BrandStart onDone={(b) => router.push(`/ads/${b.id}`)} />+ {visitor ? (+ <SelfHostNote className="p-1 text-[14px]">Brand kits aren't on free accounts yet. Free accounts can use the Image, Video and Audio studios, camera motions, effects and apps.</SelfHostNote>+ ) : (+ <BrandStart onDone={(b) => router.push(`/ads/${b.id}`)} />+ )}</div></section>@@ -133,8 +141,8 @@ export function AdsHome() {<div className="mx-auto grid size-12 place-items-center rounded-2xl bg-brand-faint text-brand-text"><Target className="size-5" /></div>- <p className="mt-4 text-[15px] font-medium">No brand kit added yet</p>- <p className="mt-1 text-[13px] text-muted-foreground">Paste a link or create one manually to get started.</p>+ <p className="mt-4 text-[15px] font-medium">No brands yet</p>+ {!visitor && <p className="mt-1 text-[13px] text-muted-foreground">Paste a link or create one manually to get started.</p>}</div>)}</section>diff --git a/src/components/ads/multiplier.tsx b/src/components/ads/multiplier.tsxindex 13d3926a..83282a42 100644--- a/src/components/ads/multiplier.tsx+++ b/src/components/ads/multiplier.tsx@@ -174,7 +174,7 @@ function MentionImages({ value, onChange, onMention, max }: { value: string[]; o/** Ad Multiplier: a reference ad (4–30 s) → new versions: recreated from a prompt, or with a new hook / CTA. */export function AdMultiplier({ models }: { models: Record<string, ModelInfo> }) {const qc = useQueryClient();- const { engine, setEngine } = useMarketingEngine();+ const { engine, setEngine, mode: engineMode } = useMarketingEngine();const access = useModelAccess();const [video, setVideo] = useState<SlotValue | null>(null);const [duration, setDuration] = useState<number | null>(null);@@ -494,7 +494,7 @@ export function AdMultiplier({ models }: { models: Record<string, ModelInfo> })/></div><p className="flex flex-wrap items-center justify-center gap-1.5 pt-6 text-center text-[12px] text-muted-foreground">- <Sparkles className="size-3" /> Cloud: Kling O3 edit, Happy Horse edit, Gemini Omni Flash · Open source: Fuobe Genjutsu (Wan Animate), Wan 2.2 clips joined around your ad+ <Sparkles className="size-3" /> {engineMode === "open" ? "" : "Cloud: Kling O3 edit, Happy Horse edit, Gemini Omni Flash · "}Open source: Fuobe Genjutsu (Wan Animate), Wan 2.2 clips joined around your ad</p></div></div>diff --git a/src/components/app-sidebar.tsx b/src/components/app-sidebar.tsxindex 043f7af3..173f84aa 100644--- a/src/components/app-sidebar.tsx+++ b/src/components/app-sidebar.tsx@@ -32,12 +32,13 @@ import {DropdownMenuTrigger,} from "@/components/ui/dropdown-menu";import { Kbd } from "@/components/ui/kbd";+import { Skeleton } from "@/components/ui/skeleton";import { CommandPalette, CommandPaletteProvider, useCommandPalette } from "@/components/command-palette";import { IntentLink } from "@/components/intent-link";import { JobNotifications } from "@/components/job-notifications";import { NAV, type NavGroupDef } from "@/components/nav-items";import { SkillBuilderProvider } from "@/components/skills/skill-builder-provider";-import { CONNECT_GPU_EVENT, signInHref, useEngineMode, useIsGuest, useStatus, useViewer, type StatusInfo } from "@/lib/api";+import { CONNECT_GPU_EVENT, signInHref, useEngineMode, useStatus, useViewer, type StatusInfo } from "@/lib/api";import { useModKey } from "@/lib/keys";import { fullScreenStudio, groupId, NAV_CLOSED_KEY, navActive, NEW_CREATION_HREF, parseClosed, scrollFades, sidebarCookie, SIDEBAR_STATE_SCRIPT, sidebarOpenFromCookie } from "@/lib/nav";import { cn } from "@/lib/utils";@@ -366,21 +367,54 @@ function SearchRow() {);}-/** Public sign-up, signed out: "Sign up" and "Log in", coming back to this page (under Suspense: it reads the path). */-function GuestRow() {- const guest = useIsGuest();+const VIEWER_KEY = "fuobe:viewer";++/**+ * Runs while the HTML is parsed: `<html data-viewer="owner">` in a browser where the owner was signed in last time, so+ * the row kept for "Sign up / Log in" (or an account's menu) isn't drawn and then taken away on every page load.+ */+const VIEWER_SCRIPT = `(function(){try{var v=localStorage.getItem("${VIEWER_KEY}");if(v)document.documentElement.setAttribute("data-viewer",v)}catch(e){}})()`;++/** The row's place while the viewer isn't known (in the server's shell too: ViewerRow reads the query, so it's the fallback there). */+function ViewerRowPlaceholder() {+ return (+ <>+ <script type={typeof window === "undefined" ? "text/javascript" : "text/plain"} suppressHydrationWarning dangerouslySetInnerHTML={{ __html: VIEWER_SCRIPT }} />+ <SidebarMenuItem aria-hidden className="mt-1 h-8 group-data-[collapsible=icon]:h-[70px] [html[data-viewer='owner']_&]:hidden [html[data-viewer='account']_&]:hidden" />+ </>+ );+}++/**+ * Public sign-up, signed out: "Sign up" and "Log in", coming back to this page with its query (a preset picked…). Until+ * the viewer is known the row keeps its height, so the menu under it doesn't move when it comes (except in a browser the+ * owner or an account used last: they get no row here). Under Suspense: it reads the path.+ */+function ViewerRow() {+ const viewer = useViewer().data;const pathname = usePathname();- if (!guest) return null;+ const search = useSearchParams().toString();+ const here = search ? `${pathname}?${search}` : pathname;+ const kind = !viewer ? undefined : viewer.owner ? "owner" : viewer.account ? "account" : viewer.publicSignup ? "guest" : "owner";+ useEffect(() => {+ if (!kind) return;+ try {+ localStorage.setItem(VIEWER_KEY, kind);+ } catch {}+ document.documentElement.setAttribute("data-viewer", kind);+ }, [kind]);+ if (!kind) return <ViewerRowPlaceholder />;+ if (kind !== "guest") return null;return (<SidebarMenuItem className="mt-1 flex gap-1.5 group-data-[collapsible=icon]:flex-col"><SidebarMenuButton asChild tooltip="Sign up free" className="h-8 flex-1 justify-center bg-primary text-[13px] text-primary-foreground hover:bg-primary/90 hover:text-primary-foreground">- <a href={signInHref("signup", pathname)}>+ <a href={signInHref("signup", here)}><UserPlus /><span>Sign up</span></a></SidebarMenuButton><SidebarMenuButton asChild tooltip="Log in" className="h-8 flex-1 justify-center border border-sidebar-border text-[13px]">- <a href={signInHref("login", pathname)}>+ <a href={signInHref("login", here)}><LogIn /><span>Log in</span></a>@@ -535,8 +569,8 @@ export function AppSidebar() {)}</div><SidebarMenu>- <Suspense fallback={null}>- <GuestRow />+ <Suspense fallback={<ViewerRowPlaceholder />}>+ <ViewerRow /></Suspense><SearchRow /><SidebarMenuItem>@@ -575,6 +609,11 @@ export function AppSidebar() {<SidebarFooter className="gap-1 border-t border-sidebar-border" onClick={closeOnLink}>{status?.viewer ? (<YourGpuChip viewer={status.viewer} />+ ) : !status ? (+ // Not known yet: no "add key / offline" the install may not have, for a visitor who never sees them.+ <div aria-hidden className="flex h-[30px] items-center px-2 group-data-[collapsible=icon]:hidden">+ <Skeleton className="h-3 w-2/3" />+ </div>) : (<IntentLinkhref="/settings"diff --git a/src/components/audio-tools/audio-tools.tsx b/src/components/audio-tools/audio-tools.tsxindex bd2397ca..8a0b02e6 100644--- a/src/components/audio-tools/audio-tools.tsx+++ b/src/components/audio-tools/audio-tools.tsx@@ -335,7 +335,7 @@ export function AudioLoopTool({ tabs }: { tabs?: React.ReactNode }) {{!clip && (<ToolHerotitle="Make it as long as you need"- subtitle="Loop a music bed, ambience or a beat to any length up to 10 minutes. Smooth crossfaded seams on your ComfyUI (free, runs on CPU); whole repeats on the cloud, for under a cent."+ subtitle={`Loop a music bed, ambience or a beat to any length up to 10 minutes. Smooth crossfaded seams on your ComfyUI (free, runs on CPU)${mode === "open" ? "." : "; whole repeats on the cloud, for under a cent."}`}/>)}<div className={cn("mx-auto max-w-[820px] space-y-3", clip ? "pt-4" : "mt-8")}>@@ -425,7 +425,7 @@ export function AudioJoinTool({ tabs }: { tabs?: React.ReactNode }) {{!clips.length && (<ToolHerotitle="Join clips into one track"- subtitle={`Up to ${JOIN_MAX_CLIPS} clips, in the order you set. Crossfaded on your ComfyUI (free, runs on CPU); end to end on the cloud, for under a cent.`}+ subtitle={`Up to ${JOIN_MAX_CLIPS} clips, in the order you set. Crossfaded on your ComfyUI (free, runs on CPU)${mode === "open" ? "." : "; end to end on the cloud, for under a cent."}`}/>)}<div className={cn("mx-auto max-w-[820px] space-y-3", clips.length ? "pt-4" : "mt-8")}>diff --git a/src/components/av/language-picker.tsx b/src/components/av/language-picker.tsxindex 05920850..0bd75391 100644--- a/src/components/av/language-picker.tsx+++ b/src/components/av/language-picker.tsx@@ -88,7 +88,7 @@ export function TargetLanguages({<CommandItem key={l.code} value={`${l.name} ${l.code}`} disabled={!ok && !on} onSelect={() => toggle(l.code)} className="justify-between"><span className={cn(!ok && "text-muted-foreground")}>{l.name}- {!ok && <span className="ml-1.5 text-[11px]">· not on this route</span>}+ {!ok && <span className="ml-1.5 text-[11px]">· not available with these voices yet</span>}</span>{on && <Check className="size-3.5 text-brand-text" />}</CommandItem>diff --git a/src/components/av/media-drop.tsx b/src/components/av/media-drop.tsxindex 43d634d3..c218d38d 100644--- a/src/components/av/media-drop.tsx+++ b/src/components/av/media-drop.tsx@@ -26,7 +26,10 @@ export function MediaDrop({compact,player,preview = true,+ local,}: {+ /** The file stays in this browser (a blob: URL, nothing uploaded): for tools that only read it here (Virality). */+ local?: boolean;/** The preview <video>, for tools that drive it (Trim plays the selection in it). */player?: React.Ref<HTMLVideoElement>;kind: "video" | "image";@@ -52,6 +55,10 @@ export function MediaDrop({if (!f) return;if (kindOfFile(f) !== kind) return void toast(wrongKindMessage(kind));onFile?.(f);+ if (local) {+ const url = URL.createObjectURL(f);+ return void onChange({ ref: url, preview: url, kind, name: f.name });+ }void fileToSlot(f, onChange, kind);};const Icon = kind === "video" ? FileVideo : ImagePlus;diff --git a/src/components/av/trim-tool.tsx b/src/components/av/trim-tool.tsxindex a0815fe0..2d7cbcb1 100644--- a/src/components/av/trim-tool.tsx+++ b/src/components/av/trim-tool.tsx@@ -26,7 +26,7 @@ const MIN_LENGTH = 0.5;* trimmed by typed times, with its length read from the file when it says.*/export function TrimTool({ tabs }: { tabs?: React.ReactNode }) {- const [engine] = useEngine();+ const [engine, , engineMode] = useEngine();const create = useCreateGeneration();const results = useGenerations({ features: [TRIM_FEATURE], limit: 24 });const [video, setVideo] = useState<SlotValue | null>(null);@@ -88,7 +88,7 @@ export function TrimTool({ tabs }: { tabs?: React.ReactNode }) {const total = unread?.length ?? length;return (<ToolShell title="Video tools" tabs={tabs}>- {!video && <ToolHero title="Keep just the part you need" subtitle="Pick where it starts and ends — the sound comes along. Free on your ComfyUI (CPU), fractions of a cent on the cloud." />}+ {!video && <ToolHero title="Keep just the part you need" subtitle={`Pick where it starts and ends — the sound comes along. Free on your ComfyUI (CPU)${engineMode === "open" ? "." : ", fractions of a cent on the cloud."}`} />}<div className={cn("mx-auto max-w-[820px] space-y-3", video ? "pt-4" : "mt-8")}><MediaDrop kind="video" value={video} onChange={pick} onFile={(f) => (dropped.current = f)} preview={false} title="Add a video to trim" hint="MP4, MOV or WebM up to 200 MB" compact />{video && (diff --git a/src/components/brand/products.tsx b/src/components/brand/products.tsxindex 0649aa63..2bd364d3 100644--- a/src/components/brand/products.tsx+++ b/src/components/brand/products.tsx@@ -8,7 +8,8 @@ import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, Dimport { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";import { MAX_SELLING_POINTS, type Product } from "@/lib/catalog/marketing";import { cn } from "@/lib/utils";-import { toastError } from "@/lib/refusals";+import { refusalShown, toastError } from "@/lib/refusals";+import { normalizeWebsite } from "@/lib/website";import { useProductActions, type ProductInput } from "@/components/marketing/hooks";import { areaCls, FieldRow, inputCls, TagInput } from "./fields";import { ImageList } from "./image-list";@@ -118,14 +119,10 @@ export function AddFromLink({ brandId, onAdded, limit = 3, withBrand, className,const [url, setUrl] = useState("");const [slow, setSlow] = useState(false);const go = () => {- if (!url.trim()) return void toast("Use a valid product link.");- const host = (() => {- try {- return new URL(/^https?:/i.test(url) ? url : `https://${url}`).hostname;- } catch {- return url;- }- })();+ // The server's own rule (it would refuse the link anyway), before the "Reading…" and the kit animation start.+ const link = normalizeWebsite(url);+ if (!link) return void toast("Use a valid product link.");+ const host = new URL(link).hostname;setSlow(false);const t = setTimeout(() => setSlow(true), 12_000);const id = toast.loading(`Reading ${host}`);@@ -139,7 +136,8 @@ export function AddFromLink({ brandId, onAdded, limit = 3, withBrand, className,setUrl("");onAdded?.(r.duplicate ? [r.duplicate] : r.products, { brand: r.brand });},- onError: (e) => toast.error(`${(e as Error).message}`, { id, description: "Try again, or add it by hand." }),+ // A refusal that opened its own card (sign up, connect your GPU): the card alone, no "try again" toast on top.+ onError: (e) => (refusalShown(e) ? toast.dismiss(id) : toast.error((e as Error).message, { id, description: "Try again, or add it by hand." })),onSettled: () => clearTimeout(t),},);diff --git a/src/components/canvas/canvas-list.tsx b/src/components/canvas/canvas-list.tsxindex e1fd6c9e..83eb5ef2 100644--- a/src/components/canvas/canvas-list.tsx+++ b/src/components/canvas/canvas-list.tsx@@ -14,7 +14,8 @@ import { Input } from "@/components/ui/input";import { Skeleton } from "@/components/ui/skeleton";import { EngineSwitch } from "@/components/studio/engine-switch";import { PageShell } from "@/components/page-shell";-import { useEngine } from "@/lib/api";+import { SelfHostNote } from "@/components/self-host-note";+import { useEngine, useIsVisitor } from "@/lib/api";// Types only: the catalog (models, templates) stays on the server; the page passes slim template cards.import type { CanvasNodeType, CanvasSummary, Outline } from "@/lib/catalog/canvas";import type { Engine } from "@/lib/catalog/types";@@ -150,7 +151,8 @@ const GROUP_NOTES: Record<string, string> = {"Effects 2.0 chains": "A photo, an image edit that sets the scene, then Fuobe DoP animates it with the effect. Open weights on both engines: free on your GPU.",};-function TemplateCard({ t, engine, onUse, busy }: { t: TemplateCardData; engine: Engine; onUse: () => void; busy: boolean }) {+/** onUse: none for a guest or an account (a canvas is saved to the owner's library: the page says so once). */+function TemplateCard({ t, engine, onUse, busy }: { t: TemplateCardData; engine: Engine; onUse?: () => void; busy: boolean }) {const { outline, models } = t.byEngine[engine];return (<article className="flex min-w-0 flex-col overflow-hidden rounded-xl border bg-card">@@ -169,9 +171,11 @@ function TemplateCard({ t, engine, onUse, busy }: { t: TemplateCardData; engine:{engine === "open" ? <Cpu className="mt-px size-3.5 shrink-0" /> : <Cloud className="mt-px size-3.5 shrink-0" />}<span className="line-clamp-2">{models.join(" · ")}</span></p>- <Button size="sm" className="mt-auto w-fit rounded-full" onClick={onUse} disabled={busy}>- {busy ? <Loader2 className="animate-spin" /> : <Plus />} Use template- </Button>+ {onUse && (+ <Button size="sm" className="mt-auto w-fit rounded-full" onClick={onUse} disabled={busy}>+ {busy ? <Loader2 className="animate-spin" /> : <Plus />} Use template+ </Button>+ )}</div></article>);@@ -189,6 +193,8 @@ function ListInner({ templates }: { templates: TemplateCardData[] }) {const [renaming, setRenaming] = useState<CanvasSummary | null>(null);const [draft, setDraft] = useState("");const [deleting, setDeleting] = useState<CanvasSummary | null>(null);+ // A canvas is saved to the studio's library, which is its owner's: a guest or an account can look, not start one.+ const visitor = useIsVisitor();const items = (canvases.data ?? []).filter((c) => !q || c.name.toLowerCase().includes(q.toLowerCase()));const setTab = (t: "mine" | "templates") => router.replace(t === "templates" ? "/canvas?tab=templates" : "/canvas", { scroll: false });@@ -211,9 +217,13 @@ function ListInner({ templates }: { templates: TemplateCardData[] }) {<h1 className="font-heading text-[34px] leading-tight">Canvas</h1><p className="mt-1 max-w-xl text-[15px] text-muted-foreground">Make images, videos and ideas in one place: wire prompts, files and models together, then run them in order or side by side.</p></div>- <Button className="w-fit rounded-full" onClick={() => void start("new", {})} disabled={!!creating}>- {creating === "new" ? <Loader2 className="animate-spin" /> : <Plus />} New canvas- </Button>+ {visitor ? (+ <SelfHostNote className="max-w-xs sm:text-right">Canvas editing is coming to free accounts.</SelfHostNote>+ ) : (+ <Button className="w-fit rounded-full" onClick={() => void start("new", {})} disabled={!!creating}>+ {creating === "new" ? <Loader2 className="animate-spin" /> : <Plus />} New canvas+ </Button>+ )}</div><div className="mt-6 flex flex-wrap items-center gap-3">@@ -278,9 +288,11 @@ function ListInner({ templates }: { templates: TemplateCardData[] }) {<EmptyDescription>Build a workflow once — prompt → image → video, three models side by side — and run it again whenever you like.</EmptyDescription></EmptyHeader><EmptyContent className="flex-row justify-center">- <Button className="rounded-full" onClick={() => void start("new", {})} disabled={!!creating}>- <Plus /> New canvas- </Button>+ {!visitor && (+ <Button className="rounded-full" onClick={() => void start("new", {})} disabled={!!creating}>+ <Plus /> New canvas+ </Button>+ )}<Button variant="secondary" className="rounded-full" onClick={() => setTab("templates")}>Browse templates</Button>@@ -303,7 +315,7 @@ function ListInner({ templates }: { templates: TemplateCardData[] }) {{templates.filter((t) => (t.group ?? "") === group).map((t) => (- <TemplateCard key={t.id} t={t} engine={engine} busy={creating === t.id} onUse={() => void start(t.id, { templateId: t.id, engine })} />+ <TemplateCard key={t.id} t={t} engine={engine} busy={creating === t.id} onUse={visitor ? undefined : () => void start(t.id, { templateId: t.id, engine })} />))}</div></section>diff --git a/src/components/cinema/projects-view.tsx b/src/components/cinema/projects-view.tsxindex 5c86c870..a3cf9b59 100644--- a/src/components/cinema/projects-view.tsx+++ b/src/components/cinema/projects-view.tsx@@ -7,6 +7,8 @@ import { useState } from "react";import { PageShell } from "@/components/page-shell";import { PageHeader } from "@/components/page-shell";import { HadItemsScript, useHadItems } from "@/components/use-had-items";+import { SelfHostNote } from "@/components/self-host-note";+import { useIsVisitor } from "@/lib/api";import { Button } from "@/components/ui/button";import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";import { Skeleton } from "@/components/ui/skeleton";@@ -107,7 +109,8 @@ const GRID = "grid grid-cols-1 gap-x-5 gap-y-7 sm:grid-cols-2 lg:grid-cols-3 xl:* The first-production block, or (`loading`) a placeholder of exactly its size: a grid skeleton* swapped for this block moved the page (CLS 0.048 in the round-4 audit).*/-function EmptyProjects({ loading, onCreate, className }: { loading?: boolean; onCreate: () => void; className?: string }) {+/** onCreate: none for a guest or an account (a project is saved to the owner's library), who is told so instead. */+function EmptyProjects({ loading, onCreate, className }: { loading?: boolean; onCreate?: () => void; className?: string }) {return (<div className={cn("mx-auto flex max-w-md flex-col items-center pt-[8vh] text-center", className)} aria-busy={loading || undefined} aria-label={loading ? "Loading projects" : undefined}>{loading ? (@@ -128,11 +131,20 @@ function EmptyProjects({ loading, onCreate, className }: { loading?: boolean; on<div className="grid size-14 place-items-center rounded-2xl bg-brand-faint text-brand-text"><Clapperboard className="size-6" /></div>- <h2 className="mt-5 font-heading text-[26px] leading-tight">Start your first production</h2>- <p className="mt-2 text-[15px] text-muted-foreground">Projects keep your generations, elements, and chats together – create one to start.</p>- <Button className="mt-6" onClick={onCreate}>- <Plus /> New project- </Button>+ {onCreate ? (+ <>+ <h2 className="mt-5 font-heading text-[26px] leading-tight">Start your first production</h2>+ <p className="mt-2 text-[15px] text-muted-foreground">Projects keep your generations, elements, and chats together – create one to start.</p>+ <Button className="mt-6" onClick={onCreate}>+ <Plus /> New project+ </Button>+ </>+ ) : (+ <>+ <h2 className="mt-5 font-heading text-[26px] leading-tight">Projects aren't on free accounts yet</h2>+ <SelfHostNote className="mt-2 text-[15px]">Free accounts can use the Image, Video and Audio studios, camera motions, effects and apps.</SelfHostNote>+ </>+ )}</>)}</div>@@ -144,13 +156,18 @@ export function CinemaProjects() {const router = useRouter();const [creating, setCreating] = useState(false);const [editing, setEditing] = useState<CinemaProject | null>(null);+ // A project is saved to the studio's library, which is its owner's: a guest or an account can't start one.+ const visitor = useIsVisitor();+ const onCreate = visitor ? undefined : () => setCreating(true);useHadItems("cinema-projects", data?.length);return (<PageShell wide><PageHeader title="Cinema Studio" description="Direct films shot by shot: genre, camera, lens, palette and light, with characters and locations that stay the same.">- <Button onClick={() => setCreating(true)}>- <Plus /> New project- </Button>+ {!visitor && (+ <Button onClick={() => setCreating(true)}>+ <Plus /> New project+ </Button>+ )}</PageHeader>{isLoading ? (// Both shapes are in the server's shell; the one this browser saw last time shows from the first paint.@@ -165,10 +182,10 @@ export function CinemaProjects() {</div>))}</div>- <EmptyProjects loading className="[html[data-had-cinema-projects='1']_&]:hidden" onCreate={() => setCreating(true)} />+ <EmptyProjects loading className="[html[data-had-cinema-projects='1']_&]:hidden" onCreate={onCreate} /></div>) : !data?.length ? (- <EmptyProjects key="empty" onCreate={() => setCreating(true)} />+ <EmptyProjects key="empty" onCreate={onCreate} />) : (<div key="cards" className={GRID}>{data.map((p) => (diff --git a/src/components/command-palette.tsx b/src/components/command-palette.tsxindex 98500493..10d5198a 100644--- a/src/components/command-palette.tsx+++ b/src/components/command-palette.tsx@@ -1,8 +1,9 @@"use client";import { useQuery } from "@tanstack/react-query";-import { Bell, Clapperboard, Cpu, Film, GraduationCap, KeyRound, Layers, LayoutGrid, Loader2, Play, Plug, Plus, Scale, Server, Settings2, ShieldCheck, Sparkles, UserRound, Wand2, type LucideIcon } from "lucide-react";+import { AudioLines, Bell, Clapperboard, Code, Cpu, Film, GraduationCap, Image as ImageIcon, KeyRound, Layers, LayoutGrid, Loader2, LogIn, Play, Plug, Plus, Scale, Server, Settings2, ShieldCheck, Sparkles, SunMoon, UserPlus, UserRound, Wand2, type LucideIcon } from "lucide-react";import { useRouter } from "next/navigation";+import { useTheme } from "next-themes";import { createContext, lazy, Suspense, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";import { useSkills } from "@/components/assist/hooks";import { NAV } from "@/components/nav-items";@@ -10,7 +11,8 @@ import { MediaThumb } from "@/components/studio/result-media";import { CommandDialog, CommandEmpty, CommandGroup, CommandItem, CommandList } from "@/components/ui/command";import { Kbd } from "@/components/ui/kbd";import { Command as CommandPrimitive } from "cmdk";-import { useEngineMode, useGenerations, useModelAccess, useViewer, type ViewerInfo } from "@/lib/api";+import { signInHref, useEngineMode, useGenerations, useIsGuest, useModelAccess, useViewer, type ViewerInfo } from "@/lib/api";+import { FUOBE_REPO } from "@/lib/connections";import type { Generation } from "@/lib/catalog/types";import { indexEntries, KIND_LABELS, rankPalette, skillEntries, type PaletteEntry, type PaletteIndex, type PaletteKind } from "@/lib/command-search";import { useModKey } from "@/lib/keys";@@ -107,10 +109,24 @@ export function settingEntries(viewer: Pick<ViewerInfo, "owner" | "account"> | ureturn viewer?.account ? ACCOUNT_SETTINGS : GUEST_SETTINGS;}+/** Things to do rather than pages to open (Go to): the theme, the source, and for a guest, signing up or in. */+const THEME_HREF = "action:theme";+const ACTIONS: (PaletteEntry & { icon: LucideIcon })[] = [+ { key: "action:theme", kind: "page", label: "Toggle dark mode", hint: "Theme", href: THEME_HREF, keywords: "dark light theme night mode appearance", icon: SunMoon },+ { key: "action:github", kind: "page", label: "Source on GitHub", hint: "Open source", href: FUOBE_REPO, keywords: "github code repo repository open source download install self host", icon: Code },+];+const GUEST_ACTIONS: (PaletteEntry & { icon: LucideIcon })[] = [+ { key: "action:signup", kind: "page", label: "Sign up free", hint: "Account", href: signInHref("signup"), keywords: "sign up register create account join", icon: UserPlus },+ { key: "action:login", kind: "page", label: "Log in", hint: "Account", href: signInHref("login"), keywords: "log in login sign in account", icon: LogIn },+];// Icons as elements made once (a component picked during render would remount on every keystroke).const iconEl = (Icon: LucideIcon) => <Icon className="text-muted-foreground" />;-const ICONS = new Map<string, React.ReactNode>([...PAGES, ...SETTING_ENTRIES, ...ACCOUNT_SETTINGS, ...GUEST_SETTINGS].map((e) => [e.key, iconEl(e.icon)]));+const ICONS = new Map<string, React.ReactNode>([...PAGES, ...SETTING_ENTRIES, ...ACCOUNT_SETTINGS, ...GUEST_SETTINGS, ...ACTIONS, ...GUEST_ACTIONS].map((e) => [e.key, iconEl(e.icon)]));const KIND_ICONS: Partial<Record<PaletteKind, React.ReactNode>> = { app: iconEl(LayoutGrid), motion: iconEl(Film), effect: iconEl(Wand2), model: iconEl(Clapperboard), skill: iconEl(Play) };+/** A model's icon by the studio it opens in: a voice or music model isn't a clapperboard. */+const MODEL_ICONS = { audio: iconEl(AudioLines), image: iconEl(ImageIcon) };+const modelIcon = (href: string) =>+ /^\/audio\b/.test(href) ? MODEL_ICONS.audio : /^\/(image|edit|inpaint|outpaint|upscale\/image|image-to-3d)\b/.test(href) ? MODEL_ICONS.image : undefined;function useDebounced<T>(value: T, ms: number): T {const [v, setV] = useState(value);@@ -125,7 +141,7 @@ function useDebounced<T>(value: T, ms: number): T {function Row({ entry, onPick }: { entry: PaletteEntry; onPick: (e: PaletteEntry) => void }) {return (<CommandItem value={entry.key} onSelect={() => onPick(entry)} className="h-9 gap-2.5 text-[14px]">- {ICONS.get(entry.key) ?? KIND_ICONS[entry.kind] ?? KIND_ICONS.app}+ {ICONS.get(entry.key) ?? (entry.kind === "model" ? modelIcon(entry.href) : undefined) ?? KIND_ICONS[entry.kind] ?? KIND_ICONS.app}<span className="min-w-0 truncate">{entry.label}</span>{entry.hint && <span data-slot="command-shortcut" className="ml-auto shrink-0 truncate pl-2 text-[12px] text-muted-foreground max-sm:max-w-[40%]">{entry.hint}</span>}</CommandItem>@@ -183,9 +199,10 @@ function PaletteBody({ onPick, onOpenRecent, onClose }: { onPick: (e: PaletteEntconst recent = useGenerations({ q: dq || undefined, limit: 5, statuses: ["succeeded"] }, { keepPrevious: true });// Skills that run by themselves: "Run <skill>…" opens its Run form.const skills = useSkills();+ const guest = useIsGuest();const entries = useMemo(- () => [...PAGES, ...settings, ...skillEntries(skills.data ?? []), ...(index.data ? indexEntries(index.data, mode, access) : [])],- [index.data, mode, access, skills.data, settings],+ () => [...PAGES, ...ACTIONS, ...(guest ? GUEST_ACTIONS : []), ...settings, ...skillEntries(skills.data ?? []), ...(index.data ? indexEntries(index.data, mode, access) : [])],+ [index.data, mode, access, skills.data, settings, guest],);const groups = useMemo(() => rankPalette(entries, query), [entries, query]);const recentItems = (recent.data ?? []).filter((g) => g.outputs[0]);@@ -296,13 +313,16 @@ export function CommandPalette() {// Set when the palette closes onto something else (a page, the viewer): focus stays with that.const leaving = useRef(false);+ const { resolvedTheme, setTheme } = useTheme();const pick = useCallback((e: PaletteEntry) => {- leaving.current = true;setOpen(false);+ if (e.href === THEME_HREF) return setTheme(resolvedTheme === "dark" ? "light" : "dark");+ if (/^https?:/.test(e.href)) return void window.open(e.href, "_blank", "noopener,noreferrer");+ leaving.current = true;router.push(e.href);},- [router, setOpen],+ [router, setOpen, resolvedTheme, setTheme],);const openRecent = useCallback((g: Generation) => {diff --git a/src/components/content-factory/home.tsx b/src/components/content-factory/home.tsxindex 5160a2e7..022e8c12 100644--- a/src/components/content-factory/home.tsx+++ b/src/components/content-factory/home.tsx@@ -15,7 +15,9 @@ import { EngineSwitch } from "@/components/studio/engine-switch";import { Segmented, usd } from "@/components/faceless/controls";import { NarratorChip } from "@/components/faceless/narrator";import { StyleArt } from "@/components/faceless/style-art";-import { uploadFile, useEngine, useHydrated } from "@/lib/api";+import { SelfHostNote } from "@/components/self-host-note";+import { useEdgeFade } from "@/components/studio/use-edge-fade";+import { uploadFile, useEngine, useHydrated, useIsVisitor } from "@/lib/api";import {ANIMATION_STYLES,CF_LENGTHS,@@ -83,6 +85,11 @@ export function ContentFactoryHome({ voices }: { voices: PickerData["voices"] })const [uploading, setUploading] = useState(false);const [claudeOpen, setClaudeOpen] = useState(false);const [example, setExample] = useState(0);+ // The estimate's problem (no narrator voice yet…) is a hint until Generate is pressed.+ const [tried, setTried] = useState(false);+ // A series doesn't run on an account's own GPU yet (only the studios' generations do): said here, not after Generate.+ const visitor = useIsVisitor();+ const [exampleRow, exampleFade] = useEdgeFade<HTMLDivElement>();const file = useRef<HTMLInputElement>(null);const promptRef = useRef<HTMLTextAreaElement>(null);const ids = { prompt: useId(), link: useId(), voice: useId() };@@ -181,7 +188,8 @@ export function ContentFactoryHome({ voices }: { voices: PickerData["voices"] })// One run at a time: a second Enter (or click) before the first request has re-rendered would plan, make and bill it twice.const submitting = useRef(false);const submit = async () => {- if (submitting.current) return;+ if (submitting.current || visitor) return;+ setTried(true);if (blocker) {toast(blocker, { id: "cf-blocker" });if (!prompt.trim()) promptRef.current?.focus();@@ -342,7 +350,7 @@ export function ContentFactoryHome({ voices }: { voices: PickerData["voices"] })placeholder={`${examples[example % examples.length]}…`}className="mt-1 w-full resize-none bg-transparent px-1 text-body leading-relaxed outline-none [field-sizing:content] placeholder:text-subtle-foreground"/>- <div className="scrollbar-none -mx-1 flex gap-1.5 overflow-x-auto px-1 pb-1">+ <div ref={exampleRow} style={exampleFade} className="scrollbar-none -mx-1 flex gap-1.5 overflow-x-auto px-1 pb-1">{examples.slice(0, 5).map((ex) => (<button key={ex} type="button" onClick={() => setPrompt(ex)} className="h-7 shrink-0 rounded-full bg-secondary px-2.5 text-[12px] text-secondary-foreground hover:bg-accent">{ex}@@ -428,15 +436,20 @@ export function ContentFactoryHome({ voices }: { voices: PickerData["voices"] })Review scripts first</label>)}- <Button onClick={() => void submit()} disabled={busy} className="ml-auto h-9 rounded-full px-4">+ <Button onClick={() => void submit()} disabled={busy || visitor} className="ml-auto h-9 rounded-full px-4">{busy ? <Loader2 className="animate-spin" /> : mode === "here" ? <ArrowRight /> : <Bot />}{busy ? "Planning your episodes…" : mode === "here" ? (episodes > 1 ? `Generate ${episodes} episodes` : "Generate") : "Get the prompt"}</Button></div>- {mode === "here" && est?.error && (- <p role="alert" className="mt-2 text-[12px] text-destructive">- {est.error}- </p>+ {visitor ? (+ <SelfHostNote className="mt-2">Content Factory runs on a self-hosted Fuobe for now.</SelfHostNote>+ ) : (+ mode === "here" &&+ est?.error && (+ <p role={tried ? "alert" : undefined} className={cn("mt-2 text-[12px]", tried ? "text-destructive" : "text-muted-foreground")}>+ {est.error}+ </p>+ ))}{blocker && prompt.trim() && (<p className="mt-2 text-[12px] text-muted-foreground" aria-live="polite">diff --git a/src/components/dub/dub-studio.tsx b/src/components/dub/dub-studio.tsxindex 7fbf102d..db054371 100644--- a/src/components/dub/dub-studio.tsx+++ b/src/components/dub/dub-studio.tsx@@ -32,7 +32,7 @@ const ONE_SHOT: Record<OneShotModel, { name: string; note: string }> = {};const ROUTE_LINE = {- open: "Open source: MelBand RoFormer splits the voice from the music and Qwen3-ASR times it → your local LLM translates → you review → Chatterbox speaks each line in the cloned voice, at its time → InfiniteTalk re-syncs the lips → mixed back over the music.",+ open: "Open source: MelBand RoFormer splits the voice from the music and Qwen3-ASR times it → an AI translates each line → you review → Chatterbox speaks each line in the cloned voice, at its time → InfiniteTalk re-syncs the lips → mixed back over the music.",cloud: "Cloud: ElevenLabs isolates the voice and Demucs lifts out the music and effects → Scribe v2 times the voice → Claude (or a local model) translates → you review → ElevenLabs speaks each line at its time and Chatterbox turns it into the speaker's voice → Sync Lipsync 3 → mixed back over the music and effects.",};@@ -90,7 +90,7 @@ export function DubStudio({ tabs }: { tabs?: React.ReactNode }) {}function NewDub({ onStarted }: { onStarted: (id: string) => void }) {- const [engine] = useEngine();+ const [engine, , engineMode] = useEngine();const { create } = useDubActions();const [video, setVideo] = useState<SlotValue | null>(null);const [duration, setDuration] = useState<number | undefined>(undefined);@@ -144,15 +144,18 @@ function NewDub({ onStarted }: { onStarted: (id: string) => void }) {/><Panel title="How"><div role="radiogroup" aria-label="How to dub" className="grid gap-2 sm:grid-cols-2">- <ModeCard on={!oneShot} icon={<Languages className="size-4" />} title="Review the script first" onClick={() => setMode("steps")} note="Transcribe and translate, edit every line, then voice it. Cloud and open source." />- <ModeCard- on={oneShot}- disabled={engine === "open"}- icon={<Wand2 className="size-4" />}- title="One shot"- onClick={() => setMode("oneshot")}- note={engine === "open" ? "Cloud only — switch the engine to Cloud" : "HeyGen or ElevenLabs dub the whole video in one go."}- />+ <ModeCard on={!oneShot} icon={<Languages className="size-4" />} title="Review the script first" onClick={() => setMode("steps")} note={engineMode === "open" ? "Transcribe and translate, edit every line, then voice it." : "Transcribe and translate, edit every line, then voice it. Cloud and open source."} />+ {/* One shot is cloud only: an open-source-only studio doesn't offer it (nobody here can switch the engine). */}+ {engineMode !== "open" && (+ <ModeCard+ on={oneShot}+ disabled={engine === "open"}+ icon={<Wand2 className="size-4" />}+ title="One shot"+ onClick={() => setMode("oneshot")}+ note={engine === "open" ? "Cloud only — switch the engine to Cloud" : "HeyGen or ElevenLabs dub the whole video in one go."}+ />+ )}</div>{oneShot && (<div className="mt-3 flex flex-col gap-1.5 sm:flex-row sm:items-center">diff --git a/src/components/elements-view.tsx b/src/components/elements-view.tsxindex 35502aae..5e562e73 100644--- a/src/components/elements-view.tsx+++ b/src/components/elements-view.tsx@@ -27,7 +27,9 @@ import { Skeleton } from "@/components/ui/skeleton";import { fileToSlot, MediaSlot, type SlotValue } from "@/components/studio/media-slot";import { ELEMENT_ICONS } from "@/components/studio/prompt-input";import { VoiceRecorder } from "@/components/studio/voice-recorder";-import { useDeleteElement, useElements, useSaveElement } from "@/lib/api";+import { SelfHostNote } from "@/components/self-host-note";+import { useEdgeFade } from "@/components/studio/use-edge-fade";+import { useDeleteElement, useElements, useIsVisitor, useSaveElement } from "@/lib/api";import { ELEMENT_KINDS, elementKindInfo, handleFor, MAX_ELEMENT_PHOTOS, type ElementKind, type StudioElement } from "@/lib/catalog/elements";import { isLegacySoulId, SOUL_ID_PHOTOS } from "@/lib/catalog/training";import { copyText } from "@/lib/clipboard";@@ -44,6 +46,15 @@ const TIPS: Record<ElementKind, string> = {const MAX_PHOTOS = MAX_ELEMENT_PHOTOS;+/** Each kind's own examples in the name and description fields. */+const EXAMPLES: Record<ElementKind, { name: string; description: string }> = {+ character: { name: "Maya", description: "woman in her 30s, short copper hair, freckles" },+ location: { name: "Rooftop bar", description: "neon-lit rooftop bar at night, city skyline behind" },+ prop: { name: "Red sneaker", description: "glossy red high-top sneaker with a white sole" },+ style: { name: "Film noir", description: "high-contrast black and white, hard shadows, rain" },+ voice: { name: "Narrator Sam", description: "warm, low male voice, calm and unhurried" },+};+function PhotoGrid({ photos, setPhotos }: { photos: SlotValue[]; setPhotos: React.Dispatch<React.SetStateAction<SlotValue[]>> }) {const addFiles = (files: FileList | File[]) => {for (const f of [...files].slice(0, MAX_PHOTOS - photos.length)) {@@ -171,15 +182,7 @@ function ElementForm({ onOpenChange, element, defaultKind = "character", onSaved<Inputvalue={name}onChange={(e) => setName(e.target.value)}- placeholder={- kind === "character"- ? "Name, e.g. Maya"- : kind === "location"- ? "Name, e.g. Rooftop bar"- : kind === "prop"- ? "Name, e.g. Red sneaker"- : "Name, e.g. Film noir"- }+ placeholder={`Name, e.g. ${EXAMPLES[kind].name}`}autoFocus/><p className="flex items-center gap-1 px-1 text-[12px] text-muted-foreground">@@ -191,7 +194,7 @@ function ElementForm({ onOpenChange, element, defaultKind = "character", onSavedvalue={description}onChange={(e) => setDescription(e.target.value)}rows={2}- placeholder="Short description (optional) — used when a model can't take photos, e.g. “woman in her 30s, short copper hair, freckles”"+ placeholder={`Short description (optional) — used when a model can't take ${kind === "voice" ? "a recording" : "photos"}, e.g. “${EXAMPLES[kind].description}”`}className="resize-none text-sm"/><div className="space-y-2">@@ -357,6 +360,9 @@ function ElementsBody() {const els = useElements();const [tab, setTab] = useState<ElementKind | "all">("all");const [open, setOpen] = useState(sp.get("new") === "1");+ // An element is saved to the studio's library, which is its owner's: a guest or an account is told so, not given a form.+ const visitor = useIsVisitor();+ const [kinds, kindsFade] = useEdgeFade<HTMLDivElement>();const list = useMemo(() => (els.data ?? []).filter((e) => tab === "all" || e.kind === tab), [els.data, tab]);return (@@ -365,11 +371,15 @@ function ElementsBody() {title="Elements"description="Characters, locations, props and styles you can reuse. Save one once, then type @ in any image or video prompt — Fuobe sends its photos as references, or its trained LoRA when you've trained one.">- <Button onClick={() => setOpen(true)}>- <Plus /> New element- </Button>+ {visitor ? (+ <SelfHostNote className="max-w-xs">Free accounts can't save elements here yet.</SelfHostNote>+ ) : (+ <Button onClick={() => setOpen(true)}>+ <Plus /> New element+ </Button>+ )}</PageHeader>- <div role="group" aria-label="Kinds" className="scrollbar-none -mx-1 mb-5 flex gap-1 overflow-x-auto px-1">+ <div ref={kinds} style={kindsFade} role="group" aria-label="Kinds" className="scrollbar-none -mx-1 mb-5 flex gap-1 overflow-x-auto px-1">{(["all", ...ELEMENT_KINDS.map((k) => k.kind)] as const).map((k) => (<buttonkey={k}@@ -403,13 +413,15 @@ function ElementsBody() {<p className="mx-auto mt-1 max-w-md text-[14px] text-muted-foreground">Save a person, a place or a product from a few photos. Then write “@Maya walking into @Rooftop_bar” in any prompt.</p>- <Button className="mt-5" variant="outline" onClick={() => setOpen(true)}>- <Plus /> New element- </Button>+ {!visitor && (+ <Button className="mt-5" variant="outline" onClick={() => setOpen(true)}>+ <Plus /> New element+ </Button>+ )}</div>)}<ElementDialog- open={open}+ open={open && !visitor}onOpenChange={(o) => {setOpen(o);if (!o && sp.get("new")) router.replace("/elements");diff --git a/src/components/explainer/explainer-studio.tsx b/src/components/explainer/explainer-studio.tsxindex 0b7aa928..71cbd4b6 100644--- a/src/components/explainer/explainer-studio.tsx+++ b/src/components/explainer/explainer-studio.tsx@@ -13,7 +13,8 @@ import { Skeleton } from "@/components/ui/skeleton";import { Switch } from "@/components/ui/switch";import { EngineSwitch } from "@/components/studio/engine-switch";import { fileToSlot } from "@/components/studio/media-slot";-import { useEngine } from "@/lib/api";+import { SelfHostNote } from "@/components/self-host-note";+import { useEngine, useIsVisitor } from "@/lib/api";import {ANIMATION_MODES,AUTO_SECONDS,@@ -58,7 +59,7 @@ type Draft =| Exclude<ExplainerSource, { kind: "image" }>;const STEPS = [- { icon: Sparkles, title: "Choose Preset", text: "One of 22 looks: whiteboard, pixel art, paper diorama…" },+ { icon: Sparkles, title: "Choose a style", text: "One of 22 looks: whiteboard, pixel art, paper diorama…" },{ icon: Paperclip, title: "Attach a file or just prompt", text: "Images, a PDF, Word or text document, or a link — or only a topic." },{ icon: Download, title: "Download your result", text: "A narrated, subtitled video; fix any scene in the timeline." },];@@ -146,6 +147,10 @@ function LinkPopover({ engine, disabled, onAdd }: { engine: EpisodeSettings["engexport function ExplainerStudio({ picker }: { picker: PickerData }) {const router = useRouter();const [engine, setEngine] = useEngine();+ // An explainer doesn't run on an account's own GPU yet (only the studios' generations do): said here, not after Generate.+ const visitor = useIsVisitor();+ // The estimate's problem (no narrator voice yet…) is a hint until Generate is pressed.+ const [tried, setTried] = useState(false);const genre = genreInfo("education");const [draft, setDraft] = useState<EpisodeSettings>(() => ({ ...defaultSettings("cloud", genre, { explainer: true }), auto: true }));const [prompt, setPrompt] = useState("");@@ -234,6 +239,8 @@ export function ExplainerStudio({ picker }: { picker: PickerData }) {};const generate = () => {+ if (visitor) return;+ setTried(true);if (!prompt.trim() && !sources.length) return void toast("Add a prompt, or attach a file or link", { id: "faceless-blocker" });if (manualBad) return void toast("Duration must be Auto or a whole number of seconds between 15 and 600", { id: "faceless-blocker" });if (sources.some((s) => s.kind === "image" && s.uploading)) return void toast("Uploading…", { id: "faceless-blocker" });@@ -370,7 +377,7 @@ export function ExplainerStudio({ picker }: { picker: PickerData }) {<Settings2 className="size-4" /></button></PopoverTrigger>- <PopoverContent className="w-[min(92vw,340px)] space-y-4 p-3" align="end" collisionPadding={12}>+ <PopoverContent className="w-[min(92vw,340px)] space-y-4 p-3" align="start" collisionPadding={12}><div className="space-y-2"><p className="text-[11px] font-semibold tracking-wide text-muted-foreground uppercase">Animation</p><Segmented label="Animation" value={settings.animation} options={ANIMATION_MODES.map((m) => ({ value: m.id, label: m.label }))} onChange={(animation) => set({ animation, resolution: undefined })} />@@ -386,11 +393,12 @@ export function ExplainerStudio({ picker }: { picker: PickerData }) {</div><div className="mt-3 flex flex-wrap items-center gap-3">- <EstimateLine data={estimate.data} loading={estimate.isFetching} engine={engine} className="min-w-0 flex-1" />- <Button onClick={generate} disabled={create.isPending} className="rounded-full">+ <EstimateLine data={estimate.data} loading={estimate.isFetching} engine={engine} className="min-w-0 flex-1" quiet={!tried} />+ <Button onClick={generate} disabled={create.isPending || visitor} className="rounded-full">{create.isPending ? <Loader2 className="animate-spin" /> : <Sparkles />} Generate</Button></div>+ {visitor && <SelfHostNote className="mt-2">Explainer videos run on a self-hosted Fuobe for now.</SelfHostNote>}</div><ol className="mt-6 grid gap-2 sm:grid-cols-3 lg:grid-cols-1" aria-label="How it works">diff --git a/src/components/faceless/controls.tsx b/src/components/faceless/controls.tsxindex 8ef21515..13709842 100644--- a/src/components/faceless/controls.tsx+++ b/src/components/faceless/controls.tsx@@ -75,8 +75,11 @@ export function Section({ title, hint, children, className }: { title: string; hexport const usd = (n: number) => (n >= 10 ? `$${n.toFixed(0)}` : `$${n.toFixed(2)}`);-/** "≈ $7.02" / "Demo · free" / "Free · your GPU", with what it's made of in a popover. */-export function EstimateLine({ data, loading, engine, className }: { data: EstimateResult | undefined; loading?: boolean; engine: Engine; className?: string }) {+/**+ * "≈ $7.02" / "Demo · free" / "Free · your GPU", with what it's made of in a popover. quiet: the estimate's problem (no+ * narrator voice yet…) is a plain hint, not a warning: nothing has been asked of the visitor yet.+ */+export function EstimateLine({ data, loading, engine, className, quiet }: { data: EstimateResult | undefined; loading?: boolean; engine: Engine; className?: string; quiet?: boolean }) {const [open, setOpen] = useState(false);if (!data) return <span className={cn("inline-flex items-center gap-1.5 font-mono text-[12px] text-muted-foreground", className)}>{loading && <Loader2 className="size-3 animate-spin" />}Estimating…</span>;const price = data.demo ? "Demo · free" : engine === "open" ? "Free · your GPU" : `≈ ${usd(data.estimate.total)}${data.estimate.unknown ? "+" : ""}`;@@ -119,8 +122,8 @@ export function EstimateLine({ data, loading, engine, className }: { data: Estim{formatLength(data.seconds)} · {data.blocks} scene{data.blocks === 1 ? "" : "s"}</span>{data.error && (- <span role="alert" className="inline-flex min-w-0 items-start gap-1 text-[12px] text-warning">- <AlertTriangle className="mt-0.5 size-3 shrink-0" />+ <span role={quiet ? undefined : "alert"} className={cn("inline-flex min-w-0 items-start gap-1 text-[12px]", quiet ? "text-muted-foreground" : "text-warning")}>+ {quiet ? <Info className="mt-0.5 size-3 shrink-0" /> : <AlertTriangle className="mt-0.5 size-3 shrink-0" />}<span className="min-w-0">{data.error}</span></span>)}diff --git a/src/components/faceless/faceless-home.tsx b/src/components/faceless/faceless-home.tsxindex 2ff1575e..d04f9bda 100644--- a/src/components/faceless/faceless-home.tsx+++ b/src/components/faceless/faceless-home.tsx@@ -9,8 +9,10 @@ import { SidebarTrigger } from "@/components/ui/sidebar";import { Skeleton } from "@/components/ui/skeleton";import { EngineSwitch } from "@/components/studio/engine-switch";import { radioKeys, radioTab } from "@/components/studio/radio-keys";-import { useEngine } from "@/lib/api";-import { CHANNEL_IDEAS, GENRES, MAX_IDEA, MAX_SCRIPT, wordCount, youtubeKind, YOUTUBE_ERROR, type FacelessGenre } from "@/lib/catalog/faceless";+import { SelfHostNote } from "@/components/self-host-note";+import { useEdgeFade } from "@/components/studio/use-edge-fade";+import { useEngine, useIsVisitor } from "@/lib/api";+import { GENRE_IDEAS, GENRES, MAX_IDEA, MAX_SCRIPT, wordCount, youtubeKind, YOUTUBE_ERROR, type FacelessGenre } from "@/lib/catalog/faceless";import { cn } from "@/lib/utils";import { toastError } from "@/lib/refusals";import { ChannelCard, EmptyChannels } from "./cards";@@ -39,6 +41,10 @@ export function FacelessHome() {const ideaId = useId();const refId = useId();const g = GENRES.find((x) => x.id === genre)!;+ const [genreRow, genreFade] = useEdgeFade<HTMLDivElement>();+ const [ideaRow, ideaFade] = useEdgeFade<HTMLDivElement>();+ // A channel doesn't run on an account's own GPU yet (only the studios' generations do): said here, not after Next.+ const visitor = useIsVisitor();const checkRef = (v: string) => {const bad = v.trim() && !youtubeKind(v);@@ -47,6 +53,7 @@ export function FacelessHome() {};const submit = () => {+ if (visitor) return;if (!idea.trim()) return void toast("Describe the channel first", { id: "faceless-blocker" });if (!checkRef(reference)) return;create.mutate(@@ -80,7 +87,7 @@ export function FacelessHome() {<p className="mx-auto mt-2 max-w-[560px] text-body text-muted-foreground">A narrated, illustrated show — scripts, voice-over, animation, music and subtitles — with the same look in every episode.</p><div className="mt-7 rounded-[20px] border bg-background p-3 text-left shadow-soft transition-[border-color,box-shadow] focus-within:border-primary focus-within:ring-4 focus-within:ring-brand-faint sm:rounded-composer sm:p-4">- <div role="radiogroup" aria-label="Genre" onKeyDown={radioKeys} className="scrollbar-none flex gap-1 overflow-x-auto">+ <div ref={genreRow} style={genreFade} role="radiogroup" aria-label="Genre" onKeyDown={radioKeys} className="scrollbar-none flex gap-1 overflow-x-auto">{GENRES.map((x) => (<buttonkey={x.id}@@ -117,8 +124,8 @@ export function FacelessHome() {placeholder="Channel idea, e.g. “Channel about survival in the wild”"className="mt-2 w-full resize-none bg-transparent px-1 text-body leading-relaxed outline-none [field-sizing:content] placeholder:text-subtle-foreground"/>- <div className="scrollbar-none -mx-1 flex gap-1.5 overflow-x-auto px-1 pb-1">- {CHANNEL_IDEAS.map((ex) => (+ <div ref={ideaRow} style={ideaFade} className="scrollbar-none -mx-1 flex gap-1.5 overflow-x-auto px-1 pb-1">+ {GENRE_IDEAS[genre].map((ex) => (<button key={ex} type="button" onClick={() => setIdea(ex)} className="h-7 shrink-0 rounded-full bg-secondary px-2.5 text-[12px] text-secondary-foreground hover:bg-accent">{ex.replace(/^Channel (about|with) /, "")}</button>@@ -174,7 +181,7 @@ export function FacelessHome() {setScript({ name: f.name, text });}}/>- <Button onClick={submit} disabled={create.isPending} className="ml-auto h-9 rounded-full px-4">+ <Button onClick={submit} disabled={create.isPending || visitor} className="ml-auto h-9 rounded-full px-4">{create.isPending ? <Loader2 className="animate-spin" /> : <ArrowRight />}{create.isPending ? "Creating…" : "Next"}</Button>@@ -184,6 +191,7 @@ export function FacelessHome() {{refError}</p>)}+ {visitor && <SelfHostNote className="px-1 pt-2">Faceless channels run on a self-hosted Fuobe for now.</SelfHostNote>}</div></div>diff --git a/src/components/fashion/character-sheet.tsx b/src/components/fashion/character-sheet.tsxindex 20cbaab2..397cb005 100644--- a/src/components/fashion/character-sheet.tsx+++ b/src/components/fashion/character-sheet.tsx@@ -196,7 +196,7 @@ export function CharacterSheetView({ fields, defaults }: { fields: CastFieldDatareturn (<PageShell wide>- <PageHeader title="Build your AI avatar" description="Create a consistent AI character for your videos — from reference or define your character's look from scratch.">+ <PageHeader title="Character Sheet" description="Build your AI avatar: a consistent character for your videos, from a reference or defined from scratch."><EngineSwitch value={engine} onChange={setEngine} /></PageHeader><div className="grid gap-6 lg:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]">diff --git a/src/components/fashion/fashion-view.tsx b/src/components/fashion/fashion-view.tsxindex 0caebec3..37e03720 100644--- a/src/components/fashion/fashion-view.tsx+++ b/src/components/fashion/fashion-view.tsx@@ -23,7 +23,7 @@ import { toastError } from "@/lib/refusals";import { useStoredReducer } from "./stored";import { TemplatePreview } from "./template-preview";-const LABELS = ["Select presets", "Character", "Generation", "Clothing", "Photoset"];+const LABELS = ["Select a template", "Character", "Generation", "Clothing", "Photoset"];const BANNER_KEY = "fuobe.fashion.banner";/*** The outfit and photoset models' names (FASHION_MODELS has each step's per engine): Fuobe Try-On (the Original, FLUX.2@@ -152,8 +152,7 @@ export function FashionView() {<button type="button" onClick={hideBanner} aria-label="Hide" className="absolute top-3 right-3 grid size-7 place-items-center rounded-full hover:bg-accent"><X className="size-4" /></button>- <p className="font-heading text-[26px] leading-tight">Fashion factory</p>- <p className="mt-1 max-w-xl text-[14px] text-muted-foreground">Easily create branded photoshoots by combining your product with a consistent character, delivering unique and professional visuals every time.</p>+ <p className="max-w-xl pr-8 text-[14px] text-muted-foreground">Easily create branded photoshoots by combining your product with a consistent character, delivering unique and professional visuals every time.</p><Button className="mt-3" size="sm" onClick={hideBanner}>Select template</Button>@@ -165,9 +164,9 @@ export function FashionView() {</div>{s.step === "template" && (- <section aria-label="Select presets" className="space-y-4">+ <section aria-label="Select a template" className="space-y-4"><div>- <h2 className="font-heading text-[26px] leading-tight">Select presets</h2>+ <h2 className="font-heading text-[26px] leading-tight">Select a template</h2><p className="text-[14px] text-muted-foreground">Choose a template or aesthetic for the photo set</p></div><div role="radiogroup" aria-label="Templates" className="grid grid-cols-2 gap-3 lg:grid-cols-3">diff --git a/src/components/genjutsu/genjutsu-studio.tsx b/src/components/genjutsu/genjutsu-studio.tsxindex 4f8d70c5..b812e0f6 100644--- a/src/components/genjutsu/genjutsu-studio.tsx+++ b/src/components/genjutsu/genjutsu-studio.tsx@@ -24,7 +24,9 @@ import { radioKeys, radioTab } from "@/components/studio/radio-keys";import { SketchEditor, type Stroke } from "@/components/studio/sketch-editor";import { VideoTrimmer, type TrimRange, type VideoTrimmerHandle } from "@/components/studio/video-trimmer";import { openInStudio } from "@/components/swap-studio/hooks";-import { useEngine, useGenerations, useModelAccess } from "@/lib/api";+import { SelfHostNote } from "@/components/self-host-note";+import { useEdgeFade } from "@/components/studio/use-edge-fade";+import { useEngine, useGenerations, useIsVisitor, useModelAccess } from "@/lib/api";import { CHARACTER_SWAP, cutsInPart, cutWarning, partWords, seedProblem, type CharacterOptions, type CharacterQuality } from "@/lib/catalog/character-swap";import {chooseMaker,@@ -36,6 +38,7 @@ import {makerLicence,makerOffered,makersFor,+ qualityFor,MODE_TARGETS,OPEN_TARGET_PROBLEM,resolutionWords,@@ -61,7 +64,9 @@ import { LookPicker, type LookSource } from "./look-picker";import { SetupCode } from "./setup-code";import { useClipCuts } from "./use-cuts";-const LIMITS = `MP4, MOV or WebM · ${GENJUTSU.minSeconds}–${GENJUTSU.maxSeconds} s are used · ${GENJUTSU.maxBytes / 1024 / 1024} MB`;+/** The upload box's line: the mode's own window (Character swap: 5–15 s of one shot). */+const limits = (character: boolean) =>+ `MP4, MOV or WebM · ${character ? `${CHARACTER_SWAP.minSeconds}–${CHARACTER_SWAP.maxSeconds}` : `${GENJUTSU.minSeconds}–${GENJUTSU.maxSeconds}`} s are used · ${GENJUTSU.maxBytes / 1024 / 1024} MB`;interface Paint {mask: string;@@ -96,6 +101,8 @@ const seedOf = (s: string): number | undefined => (s.trim() === "" ? undefined :*/export function GenjutsuStudio() {const [engine, setEngine, engineMode] = useEngine();+ // Genjutsu doesn't run on an account's own GPU yet (only the studios' generations do): said here, not after Generate.+ const visitor = useIsVisitor();const access = useModelAccess();const [mode, setModeState] = useState<GenjutsuMode>("motion");const source = useSourceClip(GENJUTSU.maxBytes);@@ -481,7 +488,7 @@ export function GenjutsuStudio() {{!clip ? (<ClipDropaccept={GENJUTSU.accept}- limits={LIMITS}+ limits={limits(mode === "character")}onFile={(f) => {const err = source.pick(f);if (err) toast.error(err);@@ -700,12 +707,12 @@ export function GenjutsuStudio() {)}{maker && options.length <= 1 && (<p className="text-[12px] text-muted-foreground">- <SourceBadge source={maker.source} /> <span className="font-medium text-foreground">{maker.label}</span> · {maker.note} · {makerLicence(maker)}+ <SourceBadge source={maker.source} /> <span className="font-medium text-foreground">{maker.label}</span> · {maker.note} · {makerLicence(maker, !/your GPU|on fal/.test(maker.note ?? ""))}</p>)}{maker?.pair && (- <Field label="Quality" hint={(maker.tier ?? tier) === "standard" ? "Lite — the cheaper, faster tier" : "The full Original"}>+ <Field label="Quality" hint={(maker.tier ?? tier) === "standard" ? "Standard: the cheaper, faster tier" : "High: the full Original"}><Segmentedlabel="Quality"value={maker.tier ?? tier}@@ -720,7 +727,13 @@ export function GenjutsuStudio() {{(!isCharacter || !maker?.h3) && (<Field label="Resolution" hint={maker ? upFirst(resolutionWords(maker, quality)) : undefined}>- <Segmented label="Resolution" value={quality} onChange={setQuality} options={GENJUTSU.qualities.map((q) => ({ value: q, label: q }))} />+ {/* What renders is what shows as picked: a model that stops at 480p shows 480p, not the 720p asked for. */}+ <Segmented+ label="Resolution"+ value={(maker && GENJUTSU.qualities.find((q) => q === qualityFor(maker, quality))) || quality}+ onChange={setQuality}+ options={GENJUTSU.qualities.map((q) => ({ value: q, label: q }))}+ /></Field>)}@@ -743,10 +756,11 @@ export function GenjutsuStudio() {</>)}</div>- <Button className="rounded-full" onClick={() => start()} disabled={!!blocker || runMutation.isPending}>+ <Button className="rounded-full" onClick={() => start()} disabled={!!blocker || runMutation.isPending || visitor}>{runMutation.isPending ? <Loader2 className="size-4 animate-spin" /> : <Wand2 className="size-4" />} Generate</Button></div>+ {visitor && <SelfHostNote>Genjutsu runs on a self-hosted Fuobe for now.</SelfHostNote>}{est && est.notes.length > 0 && !blocker && (<ul className="space-y-1 text-[12px] leading-snug text-muted-foreground">{est.notes.map((n) => (@@ -867,9 +881,16 @@ function frameHint(mode: GenjutsuMode, target: GenjutsuTarget | undefined, point/** The four modes as tabs under the header (the selected one is in the URL as ?mode=). */function ModeTabsRow({ mode, onMode }: { mode: GenjutsuMode; onMode: (m: GenjutsuMode) => void }) {+ const [row, fade] = useEdgeFade<HTMLDivElement>();+ // The selected tab stays in view on a phone, where the row scrolls (only the row: the page stays put).+ useEffect(() => {+ const r = row.current;+ const on = r?.querySelector<HTMLElement>('[aria-selected="true"]');+ if (r && on) r.scrollTo({ left: Math.max(0, on.offsetLeft - (r.clientWidth - on.offsetWidth) / 2) });+ }, [mode, row]);return (<div className="border-b">- <div role="tablist" aria-label="Genjutsu modes" onKeyDown={tabKeys} className="scrollbar-none flex gap-1 overflow-x-auto px-3 sm:px-6">+ <div ref={row} style={fade} role="tablist" aria-label="Genjutsu modes" onKeyDown={tabKeys} className="scrollbar-none flex gap-1 overflow-x-auto px-3 sm:px-6">{GENJUTSU_MODES.map((m) => {const on = m.id === mode;return (diff --git a/src/components/genjutsu/setup-code.tsx b/src/components/genjutsu/setup-code.tsxindex 2627330f..2d2afdc6 100644--- a/src/components/genjutsu/setup-code.tsx+++ b/src/components/genjutsu/setup-code.tsx@@ -19,7 +19,7 @@ export function SetupCode({ setup, onPaste }: { setup: GenjutsuSetup; onPaste: (const [text, setText] = useState("");const copy = async () => {const link = `${window.location.origin}/genjutsu?setup=${encodeSetup(setup)}`;- if (await copyText(link)) toast("Setup copied", { description: "A link with this mode, model and references — paste it here, or send it to someone on this Fuobe." });+ if (await copyText(link)) toast("Setup copied", { description: "A link with this mode, model and references — paste it here, or send it to someone on this site." });else toast.error("Couldn't copy — your browser blocked the clipboard");};const paste = () => {diff --git a/src/components/home-view.tsx b/src/components/home-view.tsxindex 1e230c0c..1e08f3df 100644--- a/src/components/home-view.tsx+++ b/src/components/home-view.tsx@@ -27,7 +27,7 @@ import { HadItemsScript, useHadItems } from "@/components/use-had-items";import { CardPending, IntentLink } from "@/components/intent-link";import { PresetCard } from "@/components/preset-gallery";import { MediaThumb } from "@/components/studio/result-media";-import { useEngine, useGenerations, useHydrated, useStatus } from "@/lib/api";+import { CONNECT_GPU_EVENT, signInHref, useEngine, useGenerations, useHydrated, useStatus } from "@/lib/api";import { EngineSwitch } from "@/components/studio/engine-switch";import type { Generation } from "@/lib/catalog/types";import { issueStartToken, START_PARAM } from "@/lib/composer";@@ -198,11 +198,13 @@ export function HomeView({const statusData = useStatus().data;const status = hydrated ? statusData : undefined;const nothingConnected = !!status && noConnection(status);- // Until something is connected (or it's put away): three ways to start, under the composer. It's- // in the static shell too (no status yet), so it doesn't push the page down when the status- // arrives; FirstRunScript hides it before the first paint in a browser that has put it away.+ // Until something is connected (or it's put away): three ways to start, under the composer. The+ // static shell (no status yet) shows it only in a browser where it showed last time+ // (FirstRunScript), so a visitor to a public studio, who never gets it, doesn't see it come and go.const firstRun = showFirstRun(status);const guide = !status || firstRun;+ // A guest or an account (public sign-up) runs open-source models on its own GPU, whatever the install's engines.+ const visitor = status?.viewer;useEffect(() => {if (!status) return;try {@@ -221,6 +223,7 @@ export function HomeView({};// What Start will run, and what it costs, before it's pressed (or why it's a demo, and the engine that would run it).const runsFor = status ? startLine(status, quotes?.[mode.id], engine, mode.id as "image" | "video" | "edit") : null;+ const openModel = quotes?.[mode.id]?.open?.name;const focusComposer = () => requestAnimationFrame(() => box.current?.focus());const startOver = useCallback(() => {setPrompt("");@@ -235,7 +238,8 @@ export function HomeView({<div className="flex flex-col items-center pt-[8vh] text-center"><h1 className="font-heading text-display text-balance sm:text-[44px]">What will you create today?</h1><p className="mt-2 text-[15px] text-muted-foreground">- {engineMode === "open"+ {/* Before the status: the words a public studio's visitors get (the owner's own install corrects them in a moment). */}+ {!status || visitor || engineMode === "open"? "Fully open-source models running on your own ComfyUI.": engineMode === "cloud"? "Frontier paid models through your own API keys."@@ -286,10 +290,29 @@ export function HomeView({</div></div></div>- {runsFor && (- <p className="mt-2 text-[12px] text-muted-foreground">- {runsFor.text}- {runsFor.other && (+ {/* Its line's height is kept from the first paint, so the tools under it don't move when it fills in. */}+ {visitor && openModel && !visitor.gpu.connected ? (+ <p className="mt-2 min-h-[18px] text-[12px] text-muted-foreground">+ {visitor.kind === "guest" ? (+ <>+ <a href={signInHref("signup")} className="text-brand-text underline underline-offset-2 hover:no-underline">+ Sign up free+ </a>{" "}+ to run {openModel} on your own GPU+ </>+ ) : (+ <>+ <button type="button" onClick={() => window.dispatchEvent(new Event(CONNECT_GPU_EVENT))} className="text-brand-text underline underline-offset-2 hover:no-underline">+ Connect your GPU+ </button>{" "}+ to run {openModel} · Free+ </>+ )}+ </p>+ ) : (+ <p className="mt-2 min-h-[18px] text-[12px] text-muted-foreground">+ {runsFor?.text}+ {runsFor?.other && (<>{" · "}<button type="button" onClick={() => setEngine(runsFor.other!)} className="text-brand-text underline underline-offset-2 hover:no-underline">@@ -303,7 +326,7 @@ export function HomeView({<><FirstRunScript /><GetStarted- className={cn("mt-6 max-w-[960px]", !status && "[html[data-first-run='0']_&]:hidden")}+ className={cn("mt-6 max-w-[960px]", !status && "hidden [html[data-first-run='1']_&]:block")}status={status}prices={prices}onDemo={focusComposer}diff --git a/src/components/katana/katana-studio.tsx b/src/components/katana/katana-studio.tsxindex 2fc10a3f..ef80233e 100644--- a/src/components/katana/katana-studio.tsx+++ b/src/components/katana/katana-studio.tsx@@ -254,8 +254,9 @@ export function KatanaStudio() {Model</Label><Select value={m.id} onValueChange={setModelId}>- <SelectTrigger id="katana-model" className="h-9 w-full rounded-full sm:w-72">- <SelectValue />+ <SelectTrigger id="katana-model" className="h-9 w-full rounded-full sm:w-auto sm:min-w-0 sm:flex-1">+ {/* The name alone here: the menu says each model's seconds. */}+ <SelectValue>{m.label}</SelectValue></SelectTrigger><SelectContent>{motionModels.map((x) => (diff --git a/src/components/library-view.tsx b/src/components/library-view.tsxindex e869ae40..b1e4aa01 100644--- a/src/components/library-view.tsx+++ b/src/components/library-view.tsx@@ -39,7 +39,7 @@ import {} from "@/components/ui/dropdown-menu";import { Kbd } from "@/components/ui/kbd";import { Skeleton } from "@/components/ui/skeleton";-import { BULK_MAX, useCreateGeneration, useFolders, useGenerationActions, useLibrary, useLibraryFacets, useShares, useUploads, type Asset, type FeedFilter } from "@/lib/api";+import { BULK_MAX, useCreateGeneration, useFolders, useGenerationActions, useIsVisitor, useLibrary, useLibraryFacets, useShares, useStatus, useUploads, type Asset, type FeedFilter } from "@/lib/api";import type { Generation, MediaKind, ReviewStatus } from "@/lib/catalog/types";import { keyCombo, useModKey } from "@/lib/keys";import { buildEntries, folderAndDescendants, reviewInfo, splitByDate, toggleAll, TRASH_DAYS, type LibraryEntry } from "@/lib/library";@@ -230,6 +230,10 @@ function Inner() {const folderId = sp.get("folder") ?? undefined;const trash = tab.id === "trash";const uploadsTab = tab.id === "uploads";+ // A guest or an account sees its own runs only; an account without a GPU can't add files yet.+ const visitor = useIsVisitor();+ const seen = useStatus().data?.viewer;+ const noGpu = seen?.kind === "account" && !seen.gpu.connected;// Library → Shared: the share links, not results (no search, selection or filters there).const sharedTab = tab.id === "shared";const [q, setQ] = useState("");@@ -493,6 +497,15 @@ function Inner() {}if (folder) return <Empty title="This folder is empty">Drag cards onto it, or select some and choose Move to folder.</Empty>;if (tab.id === "favorites") return <Empty title="Nothing liked yet">Mark the ones you like with the heart to keep them here.</Empty>;+ if (uploadsTab && noGpu)+ return (+ <Empty title="No uploads yet">+ <Link href="/connect" className="text-brand-text underline underline-offset-2">+ Connect your GPU+ </Link>{" "}+ to add your own files.+ </Empty>+ );if (uploadsTab) return <Empty title="No uploads yet">Files you add to a studio show up here.</Empty>;return (<Empty title="Your creations will appear here">@@ -517,7 +530,7 @@ function Inner() {) : (<div className="min-w-0"><h1 className="font-heading text-[34px] leading-tight">Library</h1>- <p className="mt-1 max-w-2xl text-[15px] text-muted-foreground">Everything you make, across cloud and open-source runs.</p>+ <p className="mt-1 max-w-2xl text-[15px] text-muted-foreground">{visitor ? "What you make on your own GPU." : "Everything you make, across cloud and open-source runs."}</p></div>)}<div className={cn("flex w-full items-center gap-2 sm:w-auto", sharedTab && "hidden")}>diff --git a/src/components/library/folders.tsx b/src/components/library/folders.tsxindex 637a9f53..0c980b5e 100644--- a/src/components/library/folders.tsx+++ b/src/components/library/folders.tsx@@ -27,7 +27,7 @@ import {DropdownMenuSubTrigger,DropdownMenuTrigger,} from "@/components/ui/dropdown-menu";-import { useFolderActions } from "@/lib/api";+import { useFolderActions, useIsVisitor } from "@/lib/api";import { childFolders, DEFAULT_FOLDER_COLOR, FOLDER_COLORS, folderMoveError, folderPath, folderSwatch, folderTree, MAX_FOLDER_DEPTH, type Folder } from "@/lib/library";import { cn } from "@/lib/utils";import { toastError } from "@/lib/refusals";@@ -390,6 +390,8 @@ function FolderCard({ folder, all, onOpen, onDropIds, steps }: { folder: Folder;/** The folders inside `parent` (the library root with null), pinned first, and a New folder tile. `steps`: Show steps is on. */export function FolderStrip({ all, parent, onOpen, onMove, steps }: { all: Folder[]; parent: Folder | null; onOpen: (f: Folder) => void; onMove: (ids: string[], f: Folder) => void; steps?: boolean }) {const [creating, setCreating] = useState(false);+ // Folders are the studio's library, its owner's: a guest or an account isn't offered one the server would refuse.+ const visitor = useIsVisitor();const kids = childFolders(all, parent?.id ?? null);return (<div className="scrollbar-none -mx-1 flex gap-2 overflow-x-auto px-1 py-1" role="list" aria-label={parent ? `Folders in ${parent.name}` : "Folders"}>@@ -398,7 +400,7 @@ export function FolderStrip({ all, parent, onOpen, onMove, steps }: { all: Folde<FolderCard folder={f} all={all} onOpen={() => onOpen(f)} onDropIds={(ids) => onMove(ids, f)} steps={steps} /></div>))}- {roomInside(all, parent) && (+ {roomInside(all, parent) && !visitor && (<div role="listitem" className="flex shrink-0"><buttononClick={() => setCreating(true)}diff --git a/src/components/login-form.tsx b/src/components/login-form.tsxindex b323345e..e993b9a3 100644--- a/src/components/login-form.tsx+++ b/src/components/login-form.tsx@@ -1,13 +1,14 @@"use client";-import { Loader2, Lock, Sparkles } from "lucide-react";+import { Eye, EyeOff, Loader2, Lock, LogOut, Sparkles } from "lucide-react";import Link from "next/link";-import { useSearchParams } from "next/navigation";-import { useState } from "react";+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 { useViewer } from "@/lib/api";+import { announceAuthChange, signOut, useViewer } from "@/lib/api";import { safeNext } from "@/lib/safe-redirect";+import { cn } from "@/lib/utils";/** "signup" and "login" are accounts (public sign-up); "owner" is the install password. */type Mode = "signup" | "login" | "owner";@@ -23,6 +24,8 @@ const COPY: Record<Mode, { title: string; lead: string; button: string }> = {export function LoginForm() {const params = useSearchParams();+ const router = useRouter();+ const pathname = usePathname();const viewer = useViewer();const open = !!viewer.data?.publicSignup;const [chosen, setChosen] = useState<Mode | null>(null);@@ -30,12 +33,28 @@ export function LoginForm() {const [email, setEmail] = useState("");const [password, setPassword] = useState("");const [error, setError] = useState<string | null>(null);+ // The email is taken (409): offer to log in with it instead.+ const [taken, setTaken] = useState(false);+ const [shown, setShown] = useState(false);const [busy, setBusy] = useState(false);const next = safeNext(params.get("next"), typeof window === "undefined" ? "http://localhost" : window.location.origin);+ // Sign up and log in have their own tab title (the page's metadata says "Sign in" for both).+ useEffect(() => {+ if (!viewer.isPending) document.title = `${mode === "signup" ? "Sign up" : mode === "login" ? "Log in" : "Sign in"} · Fuobe`;+ }, [mode, viewer.isPending]);++ /** The other form; the URL says which (?signup=1), so a reload or a shared link opens the same one. */const choose = (m: Mode) => {setChosen(m);setError(null);+ setTaken(false);+ if (m === "owner") return;+ const q = new URLSearchParams(params.toString());+ if (m === "signup") q.set("signup", "1");+ else q.delete("signup");+ const s = q.toString();+ router.replace(s ? `${pathname}?${s}` : pathname, { scroll: false });};const submit = async (e: React.FormEvent) => {@@ -52,10 +71,12 @@ export function LoginForm() {const q = new URLSearchParams({ welcome: "1" });if (after !== "/" && !after.startsWith("/connect")) q.set("next", after);const dest = mode === "signup" ? new URL(`/connect?${q}`, window.location.origin).toString() : after;+ announceAuthChange();window.location.assign(dest);return;}setError(((await res.json().catch(() => ({}))) as { error?: string }).error ?? "Couldn't sign in");+ setTaken(mode === "signup" && res.status === 409);setBusy(false);};@@ -67,6 +88,26 @@ export function LoginForm() {);}+ // Already signed in as an account: say so, rather than a form that would sign in again.+ const account = viewer.data?.signedIn && !viewer.data.owner ? viewer.data.account : undefined;+ if (account && params.get("owner") !== "1") {+ return (+ <div className="w-full max-w-sm animate-fade-up rounded-2xl border bg-background p-7 shadow-soft">+ <div className="mb-5 grid size-11 place-items-center rounded-xl bg-primary text-primary-foreground">+ <Sparkles className="size-5" />+ </div>+ <h1 className="font-heading text-[28px] leading-tight">You're signed in</h1>+ <p className="mt-1 text-[13px] break-words text-muted-foreground">As {account.email}.</p>+ <Button asChild className="mt-5 h-11 w-full">+ <Link href={next}>Continue</Link>+ </Button>+ <Button variant="ghost" className="mt-2 h-10 w-full text-muted-foreground" onClick={() => void signOut()}>+ <LogOut /> Sign out+ </Button>+ </div>+ );+ }+const copy = COPY[mode];const short = mode === "signup" && password.length > 0 && password.length < 8;return (@@ -79,6 +120,9 @@ export function LoginForm() {{mode !== "owner" && (<Inputtype="email"+ id="login-email"+ name="email"+ aria-label="Email"autoFocusautoComplete="email"placeholder="Email"@@ -88,21 +132,54 @@ export function LoginForm() {aria-invalid={!!error}/>)}- <Input- type="password"- autoFocus={mode === "owner"}- autoComplete={mode === "signup" ? "new-password" : "current-password"}- placeholder={mode === "signup" ? "Password (at least 8 characters)" : "Password"}- value={password}- onChange={(e) => setPassword(e.target.value)}- className={mode === "owner" ? "mt-5 h-11" : "mt-2.5 h-11"}- aria-invalid={!!error || short}- />- {error && <p className="mt-2 text-[13px] text-destructive">{error}</p>}+ <div className={cn("relative", mode === "owner" ? "mt-5" : "mt-2.5")}>+ <Input+ type={shown ? "text" : "password"}+ id="login-password"+ name="password"+ aria-label="Password"+ autoFocus={mode === "owner"}+ autoComplete={mode === "signup" ? "new-password" : "current-password"}+ placeholder={mode === "signup" ? "Password (at least 8 characters)" : "Password"}+ value={password}+ onChange={(e) => setPassword(e.target.value)}+ className="h-11 pr-11"+ aria-invalid={!!error || short}+ aria-describedby={short ? "pw-hint" : undefined}+ />+ <button+ type="button"+ onClick={() => setShown((s) => !s)}+ aria-label="Show password"+ aria-pressed={shown}+ className="absolute top-1/2 right-1.5 grid size-8 -translate-y-1/2 place-items-center rounded-md text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring"+ >+ {shown ? <EyeOff className="size-4" /> : <Eye className="size-4" />}+ </button>+ </div>+ {short && (+ <p id="pw-hint" className="mt-2 text-[13px] text-destructive">+ Use at least 8 characters ({8 - password.length} more)+ </p>+ )}+ {error && (+ <p role="alert" className="mt-2 text-[13px] text-destructive">+ {taken ? error.replace(/\s*Log in instead\.?$/, "") : error}+ {taken && (+ <>+ {" "}+ <button type="button" className="font-medium text-foreground underline underline-offset-4" onClick={() => choose("login")}>+ Log in instead+ </button>+ </>+ )}+ </p>+ )}<Button type="submit" className="mt-4 h-11 w-full" disabled={!password || (mode !== "owner" && !email) || (mode === "signup" && password.length < 8) || busy}>{busy && <Loader2 className="animate-spin" />} {copy.button}</Button>{mode === "signup" && <p className="mt-3 text-center text-[12px] text-muted-foreground">The studio's owner can see what you upload and make here.</p>}+ {mode === "login" && <p className="mt-3 text-center text-[12px] text-muted-foreground">Forgot your password? There's no email reset yet: create a new account.</p>}{open && (<div className="mt-4 space-y-1.5 text-center text-[13px] text-muted-foreground">{mode === "signup" ? (diff --git a/src/components/marketing/click-to-ad.tsx b/src/components/marketing/click-to-ad.tsxindex b3f868dd..32691f06 100644--- a/src/components/marketing/click-to-ad.tsx+++ b/src/components/marketing/click-to-ad.tsx@@ -132,7 +132,7 @@ function KitBrand({ brand }: { brand: BrandKit }) {/** Click to Ad: product link → product kit → style → a 9:16 ad of up to 12 s with voiceover and captions. */export function ClickToAd({ models }: { models: Record<string, ModelInfo> }) {const qc = useQueryClient();- const { engine, setEngine } = useMarketingEngine();+ const { engine, setEngine, mode: engineMode } = useMarketingEngine();const products = useProducts();const { update } = useProductActions();// The link is read by AddFromLink's own mutation: follow it by its key.@@ -453,7 +453,7 @@ export function ClickToAd({ models }: { models: Record<string, ModelInfo> }) {/></div><p className="flex items-center justify-center gap-1.5 pt-4 text-[12px] text-muted-foreground">- <Sparkles className="size-3" /> Cloud: Seedance 2.5 shots or an OmniHuman presenter, ElevenLabs voice, Auto Subtitle · Open source: Wan 2.2, InfiniteTalk, Chatterbox (your voice sample), caption burn-in+ <Sparkles className="size-3" /> {engineMode === "open" ? "" : "Cloud: Seedance 2.5 shots or an OmniHuman presenter, ElevenLabs voice, Auto Subtitle · "}Open source: Wan 2.2, InfiniteTalk, Chatterbox (your voice sample), caption burn-in</p></div></div>diff --git a/src/components/mixed-media/mixed-studio.tsx b/src/components/mixed-media/mixed-studio.tsxindex c8f34d9c..3e1838f8 100644--- a/src/components/mixed-media/mixed-studio.tsx+++ b/src/components/mixed-media/mixed-studio.tsx@@ -56,10 +56,13 @@ const HOW = [{ step: "Customize settings", text: "Each preset has its own colours, materials and intensity. Save them per preset; they stay in this browser." },{step: "Generate & preview",- text: "Make one preview frame first to check the look, then render the whole video, frame by frame at the rate you pick. Smooth draws only the first frame in the look and carries it through the clip; on the cloud, Fast restyles it in one video-to-video pass.",+ text: "Make one preview frame first to check the look, then render the whole video, frame by frame at the rate you pick. Smooth draws only the first frame in the look and carries it through the clip.",},];+/** What the cloud adds to "How it works", said only where the install offers the cloud. */+const HOW_CLOUD = " On the cloud, Fast restyles it in one video-to-video pass.";+const MODE_OPTIONS: { value: MixedMode; label: string; title: string }[] = [{ value: "frames", label: "Per frame", title: "Every frame drawn again in the look — the mixed-media flicker" },{ value: "smooth", label: "Smooth", title: "The first frame in the look, then carried through the clip by depth — no flicker" },@@ -69,7 +72,7 @@ const MODE_OPTIONS: { value: MixedMode; label: string; title: string }[] = [/** Mixed Media: pick a look, add a ≤10 s clip, tune the settings, preview one frame, render. */export function MixedStudio({ models, frameModels }: { models: Record<Engine, RestyleModelInfo[]>; frameModels: Record<Engine, RestyleModelInfo[]> }) {const [tab, setTab] = useState<Tab>("presets");- const [engine, setEngine] = useEngine();+ const [engine, setEngine, engineMode] = useEngine();useEffect(() => {const t = new URLSearchParams(window.location.search).get("tab");// eslint-disable-next-line react-hooks/set-state-in-effect -- read once after hydration@@ -110,7 +113,7 @@ export function MixedStudio({ models, frameModels }: { models: Record<Engine, Re{tab === "history" ? (<MixedHistory onStart={() => pick("presets")} />) : tab === "how" ? (- <How onStart={() => pick("presets")} />+ <How onStart={() => pick("presets")} cloud={engineMode !== "open"} />) : (<><div className="mx-auto max-w-[720px] pt-8 pb-6 text-center sm:pt-12">@@ -128,7 +131,7 @@ export function MixedStudio({ models, frameModels }: { models: Record<Engine, Re);}-function How({ onStart }: { onStart: () => void }) {+function How({ onStart, cloud }: { onStart: () => void; cloud: boolean }) {return (<div className="mx-auto max-w-[920px] pt-10"><h2 className="text-center font-heading text-[34px] leading-tight">How it works</h2>@@ -137,7 +140,10 @@ function How({ onStart }: { onStart: () => void }) {<li key={h.step} className="rounded-2xl border bg-background p-5"><span className="grid size-7 place-items-center rounded-full bg-primary text-[13px] font-semibold text-primary-foreground">{i + 1}</span><p className="mt-3 text-[15px] font-semibold">{h.step}</p>- <p className="mt-1 text-[14px] text-muted-foreground">{h.text}</p>+ <p className="mt-1 text-[14px] text-muted-foreground">+ {h.text}+ {cloud && i === HOW.length - 1 && HOW_CLOUD}+ </p></li>))}</ol>@@ -145,15 +151,16 @@ function How({ onStart }: { onStart: () => void }) {<p className="font-medium text-foreground">Cost</p><p className="mt-1">A render is counted in frames: seconds × frame rate, rounded down (10 s at 8 FPS = 80 frames; at most 10 s × 24 FPS = 240). Fuobe Mixed Media draws every- frame again in the look — Z-Image Turbo following the frame's own outlines, with the look's LoRA and one seed — free on your GPU, or on the cloud- at about a cent a frame. Nano Banana 2 and Seedream 5.0 Flash redraw frames too, priced per frame. Smooth draws only the first frame in the look, then Wan 2.2- Fun VACE carries it through the clip by depth, priced per second. Fast restyles the clip in one video-to-video pass, priced by the model. The estimate shows- before you generate.+ frame again in the look — Z-Image Turbo following the frame's own outlines, with the look's LoRA and one seed — free on your GPU+ {cloud ? ", or on the cloud at about a cent a frame. Nano Banana 2 and Seedream 5.0 Flash redraw frames too, priced per frame." : "."} Smooth draws only the+ first frame in the look, then Wan 2.2 Fun VACE carries it through the clip by depth{cloud ? ", priced per second. Fast restyles the clip in one video-to-video pass, priced by the model" : ""}.+ The estimate shows before you generate.</p><p className="mt-2">- Over {FRAME_LIMITS.perClip} frames, the frames go back together as clips and are joined. Nano Banana 2 and Seedream redraw frames in runs of {FRAME_LIMITS.lane}{" "}- side by side, each frame matching the one before it and each run starting from your preview frame, so their look can shift slightly every {FRAME_LIMITS.lane}{" "}- frames. If a frame fails, the frames still waiting stop, and Try again redraws only the frames that didn’t finish.+ Over {FRAME_LIMITS.perClip} frames, the frames go back together as clips and are joined.+ {cloud &&+ ` Nano Banana 2 and Seedream redraw frames in runs of ${FRAME_LIMITS.lane} side by side, each frame matching the one before it and each run starting from your preview frame, so their look can shift slightly every ${FRAME_LIMITS.lane} frames.`}{" "}+ If a frame fails, the frames still waiting stop, and Try again redraws only the frames that didn’t finish.</p></div><div className="mt-6 text-center">diff --git a/src/components/model3d/model3d-studio.tsx b/src/components/model3d/model3d-studio.tsxindex 7f60973b..659cf78f 100644--- a/src/components/model3d/model3d-studio.tsx+++ b/src/components/model3d/model3d-studio.tsx@@ -2,7 +2,7 @@import { Box, Loader2, PersonStanding } from "lucide-react";import Link from "next/link";-import { useSearchParams } from "next/navigation";+import { useRouter, useSearchParams } from "next/navigation";import { Suspense, useCallback, useEffect, useRef, useState } from "react";import { toast } from "sonner";import { Button } from "@/components/ui/button";@@ -15,7 +15,7 @@ import { FailedTile, PendingTile } from "@/components/studio/feed";import { MediaSlot, type SlotValue } from "@/components/studio/media-slot";import { MediaDrop } from "@/components/av/media-drop";import { Panel, ToolHero, ToolShell } from "@/components/av/tool-shell";-import { useCreateGeneration, useEngine, useGenerations, useModelAccess } from "@/lib/api";+import { useCreateGeneration, useEngine, useGenerations, useHydrated, useModelAccess, useStatus } from "@/lib/api";import {MAX_3D_PROMPT,MODEL3D_FEATURE,@@ -128,6 +128,16 @@ export function Model3dStudio({ info }: { info: Record<string, Model3dInfo> }) {const create = useCreateGeneration();const results = useGenerations({ features: [MODEL3D_FEATURE, "app:app-image-to-3d"], limit: 24 });const [mode, setMode] = useState<Model3dMode>("image");+ const router = useRouter();+ // A mode picked here goes in the URL (?mode=), so a reload or a shared link opens it again (UrlModel reads it).+ const pickMode = (m: Model3dMode) => {+ setMode(m);+ router.replace(m === "image" ? "/image-to-3d" : `/image-to-3d?mode=${m}`, { scroll: false });+ };+ // The engine is known once the install's engine mode is: no price asked for a cloud model an open-only install refuses.+ const statusKnown = !!useStatus().data;+ const hydrated = useHydrated();+ const engineKnown = statusKnown && hydrated;const [photo, setPhoto] = useState<SlotValue | null>(null);const [views, setViews] = useState<Partial<Record<ViewSide, SlotValue | null>>>({});const [text, setText] = useState("");@@ -155,7 +165,7 @@ export function Model3dStudio({ info }: { info: Record<string, Model3dInfo> }) {const priced: GenerationRequest | null = modelId? model3dRequest({ ...input, photo: input.photo ?? PLACEHOLDER, views: { front: PLACEHOLDER, left: PLACEHOLDER, ...sides }, prompt: input.prompt?.trim() || "an object" }): null;- const preview = useRunPreview(priced);+ const preview = useRunPreview(engineKnown ? priced : null);const price = priceLine(preview.data);const cloudAllowed = engineMode !== "open";const go = () => {@@ -174,7 +184,7 @@ export function Model3dStudio({ info }: { info: Record<string, Model3dInfo> }) {<UrlModel onModel={fromUrl} onMode={setMode} onRig={showRigHint} /></Suspense><ToolHero title="Your product, in 3D" subtitle={HINTS[mode]} />- <ModePicker mode={mode} onChange={setMode} />+ <ModePicker mode={mode} onChange={pickMode} />{rigHint && (<p role="status" className="mx-auto mt-4 max-w-[880px] rounded-2xl border bg-brand-faint px-4 py-3 text-[13px] text-brand-text"><PersonStanding className="mr-1.5 inline size-4 align-[-3px]" aria-hidden />diff --git a/src/components/palettes/color-signature-panel.tsx b/src/components/palettes/color-signature-panel.tsxindex 9e644a07..0e80654d 100644--- a/src/components/palettes/color-signature-panel.tsx+++ b/src/components/palettes/color-signature-panel.tsx@@ -226,14 +226,16 @@ export function ColorSignaturePanel({</div>)}</section>- <section>- <p className="mb-1.5 text-[12px] font-medium text-muted-foreground">Cinema palettes</p>- <div className="grid grid-cols-2 gap-2">- {builtins.map((p) => (- <PaletteCard key={p.id} palette={p} selected={value?.id === p.id} onSelect={() => onPick(value?.id === p.id ? undefined : toPalettePick(p, value?.lock))} />- ))}- </div>- </section>+ {builtins.length > 0 && (+ <section>+ <p className="mb-1.5 text-[12px] font-medium text-muted-foreground">Cinema palettes</p>+ <div className="grid grid-cols-2 gap-2">+ {builtins.map((p) => (+ <PaletteCard key={p.id} palette={p} selected={value?.id === p.id} onSelect={() => onPick(value?.id === p.id ? undefined : toPalettePick(p, value?.lock))} />+ ))}+ </div>+ </section>+ )}</div></>)}diff --git a/src/components/photodump/photodump-view.tsx b/src/components/photodump/photodump-view.tsxindex ebfc281c..4ddb9aed 100644--- a/src/components/photodump/photodump-view.tsx+++ b/src/components/photodump/photodump-view.tsx@@ -281,7 +281,7 @@ export function PhotodumpView() {<div className="sticky bottom-3 z-10 flex items-center justify-between gap-3 rounded-2xl border bg-background/95 p-3 shadow-normal backdrop-blur"><p className="min-w-0 truncate text-[13px]">{pack ? <><span className="font-medium">{pack.name}</span> · {pack.count} photos</> : <span className="text-muted-foreground">Pick a pack to continue</span>}</p><Button disabled={!pack} onClick={() => go(1)}>- Use this preset <ArrowRight />+ Use this pack <ArrowRight /></Button></div>{runs.length > 0 && (diff --git a/src/components/preset-gallery.tsx b/src/components/preset-gallery.tsxindex d3cd7802..7620a1f5 100644--- a/src/components/preset-gallery.tsx+++ b/src/components/preset-gallery.tsx@@ -11,7 +11,7 @@ import { useProgressive } from "@/components/use-progressive";import { CardChip, badgeKey, parseBadgeKey } from "@/components/gpu/readiness-chip";import { useGpuBadges } from "@/hooks/use-gpu";import { useEngineMode, useViewer } from "@/lib/api";-import { interleaveByCategory, previewFlip, searchText, type PresetCardData } from "@/lib/preset-cards";+import { interleaveByCategory, matchesSearch, previewFlip, searchText, type PresetCardData } from "@/lib/preset-cards";import { cn } from "@/lib/utils";/** A tiny label shown on hover/focus (CSS only: a gallery has hundreds of these). */@@ -216,7 +216,7 @@ export function PresetGallery({cat === "All" && !query? mixed.filter((p) => runsOn === "all" || p[runsOn]): index- .filter(([p, text]) => (cat === "All" || p.category === cat) && (!query || text.includes(query)) && (runsOn === "all" || p[runsOn]))+ .filter(([p, text]) => (cat === "All" || p.category === cat) && (!query || matchesSearch(text, query)) && (runsOn === "all" || p[runsOn])).map(([p]) => p),[index, mixed, cat, query, runsOn],);@@ -263,9 +263,10 @@ export function PresetGallery({<RunsOnControl value={runsOn} onChange={setRunsOn} locked={locked} owner={!!viewer?.owner} /></div></div>- {visitor && badges && !badges.connected && !badges.off && (- <p className="text-[13px] text-muted-foreground">- <Link href="/connect" className="font-medium text-brand-text underline-offset-2 hover:underline">+ {/* Its line is kept (unseen) until the viewer and its chips are known, so the strip and grid don't move when it comes. */}+ {(!viewer || (visitor && (!badges || (!badges.connected && !badges.off)))) && (+ <p className={cn("text-[13px] text-muted-foreground", !(visitor && badges) && "invisible", !viewer && "[html[data-viewer='owner']_&]:hidden")} aria-hidden={!(visitor && badges) || undefined}>+ <Link href="/connect" tabIndex={visitor && badges ? undefined : -1} className="font-medium text-brand-text underline-offset-2 hover:underline">Connect your GPU</Link>{" "}to see what runs on it.@@ -275,13 +276,15 @@ export function PresetGallery({ref={strip}role="group"aria-label="Categories"- className="fade-x scrollbar-none -mx-1 flex snap-x scroll-px-1 gap-1 overflow-x-auto px-1"+ // From sm up every category shows (wrapped): a mouse can't scroll a row whose scrollbar is hidden.+ className="fade-x scrollbar-none -mx-1 flex snap-x scroll-px-1 gap-1 overflow-x-auto px-1 sm:flex-wrap sm:overflow-visible">{cats.map((c) => (<buttonkey={c}type="button"aria-pressed={cat === c}+ onFocus={(e) => e.currentTarget.scrollIntoView({ block: "nearest", inline: "nearest" })}onClick={(e) => {setCat(c);e.currentTarget.scrollIntoView({ block: "nearest", inline: "nearest", behavior: "smooth" });diff --git a/src/components/self-host-note.tsx b/src/components/self-host-note.tsxnew file mode 100644index 00000000..eadc52ed--- /dev/null+++ b/src/components/self-host-note.tsx@@ -0,0 +1,18 @@+import { cn } from "@/lib/utils";+import { FUOBE_REPO } from "@/lib/connections";++/**+ * Where a studio saves to its owner's library (projects, canvases, brands, elements…), which guests and free accounts+ * can't do yet: says so up front, with the way to use it now (Fuobe is open source), instead of a form the server refuses.+ */+export function SelfHostNote({ children, className }: { children: React.ReactNode; className?: string }) {+ return (+ <p role="note" className={cn("text-[13px] text-pretty text-muted-foreground", className)}>+ {children}{" "}+ <a href={FUOBE_REPO} target="_blank" rel="noreferrer" className="font-medium text-foreground underline underline-offset-4">+ Run Fuobe yourself+ </a>{" "}+ (it's open source) to use it now.+ </p>+ );+}diff --git a/src/components/shorts/ui.tsx b/src/components/shorts/ui.tsxindex 0a2c32cc..7dff1d5e 100644--- a/src/components/shorts/ui.tsx+++ b/src/components/shorts/ui.tsx@@ -163,7 +163,8 @@ export function ClipBar({ clip, onRemove }: { clip: SourceClip; onRemove: () =></span><div className="min-w-0 flex-1"><p className="truncate text-[13px] font-medium">{clip.name}</p>- <p className="truncate text-[11px] text-muted-foreground" aria-live="polite">+ {/* An error is read whole (two lines), not cut off like the size line. */}+ <p className={cn("text-[11px]", clip.error ? "line-clamp-2 text-destructive" : "truncate text-muted-foreground")} aria-live="polite">{clip.error? clip.error: clip.uploadingdiff --git a/src/components/storyboard-view.tsx b/src/components/storyboard-view.tsxindex 0f637a10..8c1abefd 100644--- a/src/components/storyboard-view.tsx+++ b/src/components/storyboard-view.tsx@@ -18,7 +18,7 @@ import { finishGaveUp, useSoulFinish } from "@/components/studio/soul-finish";import { FailedTile, MediaThumb, PendingTile, tileRatio } from "@/components/studio/feed";import { fileToSlot, MediaSlot, type SlotValue } from "@/components/studio/media-slot";import { Viewer } from "@/components/studio/viewer";-import { useCreateGeneration, useEngine, useGenerationActions, useGenerations } from "@/lib/api";+import { useCreateGeneration, useEngine, useGenerationActions, useGenerations, useIsVisitor, useStatus } from "@/lib/api";import { MAX_FRAMES, STORYBOARD_ASPECTS, STORYBOARD_LOOK_MODEL, STORYBOARD_PARTNER_IDS, storyboardModels, type StoryboardPartner } from "@/lib/catalog/storyboard";import { lookCard } from "@/lib/catalog/soul-cards";import type { Engine, Generation } from "@/lib/catalog/types";@@ -272,6 +272,10 @@ function Board({export function StoryboardView({ modelNames = {} }: { /** Display names of the storyboard models, from the server. */ modelNames?: Record<string, string> }) {const qc = useQueryClient();const [engine, setEngine] = useEngine();+ // The engine is known once the install's engine mode is: no price asked for a cloud board an open-only install refuses.+ const statusReady = !!useStatus().data;+ // A storyboard doesn't run on an account's own GPU yet (only the studios' generations do), nor for a guest who signs up.+ const visitor = useIsVisitor();const [mode, setMode] = useState<"auto" | "manual">("auto");const [story, setStory] = useState("");const [count, setCount] = useState(4);@@ -336,6 +340,7 @@ export function StoryboardView({ modelNames = {} }: { /** Display names of the splaceholderData: keepPreviousData,retry: false,staleTime: 30_000,+ enabled: statusReady && (JSON.parse(priceKey) as { engine?: string }).engine === engine,});const est = estimate.data && !estimate.isError ? estimate.data : undefined;const submit = useMutation({@@ -483,7 +488,9 @@ export function StoryboardView({ modelNames = {} }: { /** Display names of the s{engine === "cloud" && <PartnerPill value={partner} onChange={setPartner} names={modelNames} />}<div className="ml-auto flex shrink-0 items-center gap-2"><span className="text-right text-[12px] leading-tight tabular-nums text-muted-foreground" aria-live="polite">- {estimate.isError ? (+ {visitor ? (+ <span className="block font-semibold text-foreground">Not on free accounts yet</span>+ ) : estimate.isError ? (<span className="text-destructive">{(estimate.error as Error).message}</span>) : (<>@@ -492,14 +499,18 @@ export function StoryboardView({ modelNames = {} }: { /** Display names of the s</>)}</span>- <Button size="icon" className="size-10 shrink-0 rounded-full" disabled={!ready || submit.isPending || estimate.isError} onClick={() => submit.mutate()} aria-label="Generate storyboard">+ <Button size="icon" className="size-10 shrink-0 rounded-full" disabled={!ready || submit.isPending || estimate.isError || visitor} onClick={() => submit.mutate()} aria-label="Generate storyboard">{submit.isPending ? <Loader2 className="animate-spin" /> : <ArrowUp />}</Button></div></div><p className="mt-2 flex items-start gap-1.5 text-[11px] text-muted-foreground"><Sparkles className="mt-px size-3 shrink-0" />- {mode === "auto" ? "Your story is split into frames by the prompt LLM (Settings → AI helper), or a shot list when none is set." : "One prompt per frame. References keep the cast consistent."}+ {mode === "auto"+ ? visitor+ ? "Fuobe splits your story into frames."+ : "Your story is split into frames by the prompt LLM (Settings → AI helper), or a shot list when none is set."+ : "One prompt per frame. References keep the cast consistent."}{lookName && ` Every frame gets the ${lookName} look's grade${aspect === "21:9" ? ", made at 16:9 and cropped to 21:9" : ""}.`}</p></div>diff --git a/src/components/studio/audio-controls.tsx b/src/components/studio/audio-controls.tsxindex e847630a..c89131c0 100644--- a/src/components/studio/audio-controls.tsx+++ b/src/components/studio/audio-controls.tsx@@ -262,7 +262,7 @@ export function DialogueEditor({ model, lines, onChange }: { model: ModelDef; livalue={l.text}onChange={(e) => set(i, { text: e.target.value })}rows={1}- placeholder={i % 2 ? "…and the reply. Try audio tags like [laughs] or [whispers]" : "What does the first speaker say?"}+ placeholder={i % 2 ? "…and the reply." : "What does the first speaker say?"}className="field-sizing-content max-h-32 min-h-8 flex-1 resize-none bg-transparent py-1 text-[14px] leading-snug outline-none placeholder:text-subtle-foreground"/><buttondiff --git a/src/components/studio/composer.tsx b/src/components/studio/composer.tsxindex ca93cc39..46e1920a 100644--- a/src/components/studio/composer.tsx+++ b/src/components/studio/composer.tsx@@ -220,6 +220,25 @@ export function Composer({ docked }: { docked: boolean }) {const [focused, setFocused] = useState(false);const promptRef = useRef<PromptInputHandle>(null);const root = useRef<HTMLDivElement>(null);+ // The words typed are kept for this tab, per page (a hub's mode has its own): a visit to other modes and back finds+ // them again, as a studio the router keeps mounted does. A prompt from the link (?prompt=) wins.+ const draftKey = useRef<string | null>(null);+ useEffect(() => {+ draftKey.current = `fuobe:draft:${window.location.pathname}`;+ try {+ const kept = sessionStorage.getItem(draftKey.current);+ if (kept && !typed.prompt) setDraft({ prompt: kept });+ } catch {}+ // Once, on arrival.+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, []);+ useEffect(() => {+ if (!draftKey.current) return;+ try {+ if (typed.prompt) sessionStorage.setItem(draftKey.current, typed.prompt);+ else sessionStorage.removeItem(draftKey.current);+ } catch {}+ }, [typed.prompt]);// Connection status can arrive before this Suspense subtree hydrates: render the server's view (no status) until then.const hydrated = useHydrated();const liveStatus = useStatus().data;@@ -591,7 +610,8 @@ export function Composer({ docked }: { docked: boolean }) {const alternative = config.comfyOnly?.alternative;const alternativeHref = alternative && `${alternative.href}${video?.startsWith("/api/files/") ? `&video=${encodeURIComponent(video)}` : ""}`;const demo = !!(model && status && status.demoMode !== "off" && !model.routes.some((r) => status.providers[r.provider]?.configured));- const costText = costLabel({ demo, cost, unknown: loraPriceUnknown }, formatCost);+ // On the open engine every run is free on the GPU: said even before the run can be planned (no voice sample, no clip yet).+ const costText = costLabel({ demo, cost: cost ?? (engine === "open" && model ? 0 : null), unknown: loraPriceUnknown }, formatCost);// Attachments: only when something is attached, a required slot is still empty, or none of a "one of these" group is filled (U8).const kinds = [...attach.kinds];diff --git a/src/components/studio/engine-switch.tsx b/src/components/studio/engine-switch.tsxindex 5b09a221..324768db 100644--- a/src/components/studio/engine-switch.tsx+++ b/src/components/studio/engine-switch.tsx@@ -4,7 +4,7 @@ import { Cloud, Cpu, Lock } from "lucide-react";import Link from "next/link";import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";import type { Engine } from "@/lib/catalog/types";-import { useEngineMode } from "@/lib/api";+import { useEngineMode, useViewer } from "@/lib/api";import { cn } from "@/lib/utils";import { radioKeys, radioTab } from "./radio-keys";@@ -30,28 +30,41 @@ export function EngineSwitch({compact?: boolean;}) {const mode = useEngineMode();+ // Only the owner can change the engine mode (Settings): anyone else gets a plain badge, not a link to a page they can't use.+ const owner = useViewer().data?.owner === true;const idx = OPTIONS.findIndex((o) => o.value === value);if (mode !== "both") {const o = OPTIONS.find((x) => x.value === mode)!;const text = mode === "open" ? "Open source only" : "Cloud only";- return (+ const cls = cn(+ "inline-flex shrink-0 items-center gap-1.5 rounded-full bg-muted px-3 text-[13px] font-medium whitespace-nowrap text-muted-foreground transition-colors",+ size === "sm" ? "h-8" : "h-8 sm:h-9",+ );+ const body = (+ <>+ <o.icon className="size-3.5" />+ <span className={cn(compact && "hidden sm:inline")}>{text}</span>+ </>+ );+ return owner ? (<Tooltip><TooltipTrigger asChild>- <Link- href="/settings"- aria-label={`${text} — change in Settings`}- className={cn(- "inline-flex shrink-0 items-center gap-1.5 rounded-full bg-muted px-3 text-[13px] font-medium whitespace-nowrap text-muted-foreground transition-colors hover:text-foreground",- size === "sm" ? "h-8" : "h-8 sm:h-9",- )}- >- <o.icon className="size-3.5" />- <span className={cn(compact && "hidden sm:inline")}>{text}</span>+ <Link href="/settings" aria-label={`${text} — change in Settings`} className={cn(cls, "hover:text-foreground")}>+ {body}<Lock className="size-3 opacity-60" /></Link></TooltipTrigger><TooltipContent>{text} · locked in Settings → Engine mode</TooltipContent></Tooltip>+ ) : (+ <Tooltip>+ <TooltipTrigger asChild>+ <span tabIndex={0} className={cls}>+ {body}+ </span>+ </TooltipTrigger>+ <TooltipContent>{mode === "open" ? "This studio runs open-source models, free on your own GPU" : "This studio runs paid cloud models"}</TooltipContent>+ </Tooltip>);}return (diff --git a/src/components/studio/mode-studio.tsx b/src/components/studio/mode-studio.tsxindex 523110e1..7e1fbc37 100644--- a/src/components/studio/mode-studio.tsx+++ b/src/components/studio/mode-studio.tsx@@ -14,7 +14,13 @@ export interface ModeTab {href: string;}-/** Underline tabs on their own row under the page title; they scroll sideways (with faded edges) on phones. */+/** A tab chosen with the keyboard: the next mode's tabs (each mode's page draws its own) take the focus back. */+let refocus = false;++/**+ * Underline tabs on their own row under the page title; they scroll sideways (with faded edges) on phones. Each mode is+ * its own history entry, so Back returns to the mode before.+ */export function ModeTabs({ tabs, current }: { tabs: ModeTab[]; current: string }) {const [ref, fade] = useEdgeFade<HTMLDivElement>();const active = useRef<HTMLAnchorElement>(null);@@ -25,6 +31,10 @@ export function ModeTabs({ tabs, current }: { tabs: ModeTab[]; current: string }if (!el || !row) return;const left = el.offsetLeft - row.offsetLeft;if (left < row.scrollLeft || left + el.offsetWidth > row.scrollLeft + row.clientWidth) row.scrollLeft = left - 12;+ if (refocus) {+ refocus = false;+ el.focus({ preventScroll: true });+ }}, [current, ref]);return (<nav aria-label="Modes" className="border-b">@@ -36,11 +46,12 @@ export function ModeTabs({ tabs, current }: { tabs: ModeTab[]; current: string }key={m.id}ref={on ? active : undefined}href={m.href}- replacescroll={false}+ // A keyboard's Enter is a click with no pointer (detail 0).+ onClick={(e) => (refocus = e.detail === 0)}aria-current={on ? "page" : undefined}className={cn(- "relative flex h-10 shrink-0 items-center px-2.5 text-[13px] font-medium whitespace-nowrap text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:text-foreground",+ "relative flex h-10 shrink-0 items-center rounded-md px-2.5 text-[13px] font-medium whitespace-nowrap text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset","after:absolute after:inset-x-2.5 after:bottom-0 after:h-0.5 after:rounded-full after:transition-colors focus-visible:after:bg-ring",on && "text-foreground after:bg-foreground",)}diff --git a/src/components/studio/prompt-input.tsx b/src/components/studio/prompt-input.tsxindex a885c777..309e940e 100644--- a/src/components/studio/prompt-input.tsx+++ b/src/components/studio/prompt-input.tsx@@ -99,7 +99,24 @@ export const PromptInput = forwardRef<// Mount only: afterwards the field and the draft move together.}, []); // eslint-disable-line react-hooks/exhaustive-deps+ // The "@" (and the space before it) that the @ button put in, while nothing was picked or typed after it.+ const started = useRef<{ at: number; len: number } | null>(null);+ const latest = useRef(value);+ useLayoutEffect(() => {+ latest.current = value;+ });+ /** The @ button's "@" left alone (Escape, or a click elsewhere): taken out again, so the prompt isn't left with a stray "@". */+ const dropBareMention = () => {+ const s = started.current;+ started.current = null;+ const v = latest.current;+ if (!s || v.slice(s.at + s.len - 1, s.at + s.len) !== "@" || /\S/.test(v[s.at + s.len] ?? " ")) return;+ onChange(v.slice(0, s.at) + v.slice(s.at + s.len));+ setCaret(s.at);+ };+const insert = (el: StudioElement) => {+ started.current = null;if (!mention) return;const end = caret ?? value.length;const next = `${value.slice(0, mention.start)}@${el.handle} ${value.slice(end)}`;@@ -120,6 +137,7 @@ export const PromptInput = forwardRef<const needsSpace = at > 0 && !/\s/.test(value[at - 1] ?? "");const next = `${value.slice(0, at)}${needsSpace ? " " : ""}@${value.slice(at)}`;const pos = at + (needsSpace ? 2 : 1);+ started.current = { at, len: needsSpace ? 2 : 1 };onChange(next);setDismissed(null);requestAnimationFrame(() => {@@ -147,7 +165,12 @@ export const PromptInput = forwardRef<}}onSelect={syncCaret}onClick={syncCaret}- onBlur={() => setTimeout(() => setCaret(null), 120)}+ onBlur={() =>+ setTimeout(() => {+ setCaret(null);+ if (document.activeElement !== ta.current) dropBareMention();+ }, 120)+ }onScroll={(e) => {if (mirror.current) mirror.current.scrollTop = e.currentTarget.scrollTop;}}@@ -167,8 +190,11 @@ export const PromptInput = forwardRef<if (open && e.key === "Escape") {e.preventDefault();setDismissed(mention!.start);+ dropBareMention();return;}+ // Anything typed after the @ button's "@" is the visitor's own: it stays.+ if (e.key.length === 1 || e.key === "Backspace") started.current = null;if (e.key === "Enter" && !e.shiftKey && !e.nativeEvent.isComposing) {e.preventDefault();onSubmit();diff --git a/src/components/swap-studio/home.tsx b/src/components/swap-studio/home.tsxindex eb78eef5..0f590f75 100644--- a/src/components/swap-studio/home.tsx+++ b/src/components/swap-studio/home.tsx@@ -10,7 +10,8 @@ import { Button } from "@/components/ui/button";import { Skeleton } from "@/components/ui/skeleton";import { Panel, ToolHero, ToolShell } from "@/components/av/tool-shell";import { EngineSwitch } from "@/components/studio/engine-switch";-import { useEngine } from "@/lib/api";+import { SelfHostNote } from "@/components/self-host-note";+import { useEngine, useIsVisitor } from "@/lib/api";import { characterLicenceLine } from "@/lib/catalog/character-swap";import { SWAP_STUDIO, type SwapProjectCard } from "@/lib/catalog/swap-studio";import { STUDIO_MODELS } from "@/lib/catalog/swap-studio-plan";@@ -18,7 +19,7 @@ import { toastError } from "@/lib/refusals";import { useCreateSwapProject, useDeleteSwapProject, useSwapProjects } from "./hooks";const STEPS = [- { icon: Film, title: "Clips and your character", text: "Add whole clips (MP4, MOV, MKV, WebM or AVI, up to 149.66 s) and a picture of who comes in." },+ { icon: Film, title: "Clips and your character", text: "Add whole clips (MP4, MOV, MKV, WebM or AVI, up to 2½ minutes) and a picture of who comes in." },{ icon: Scissors, title: "Shots and words", text: "Find the edits, keep or replace each shot, transcribe who says what and build the prompts." },{ icon: UserRound, title: "Who and the scene", text: "Click who to swap on any frame, track the shot, approve a mask and a scene anchor." },{ icon: Layers, title: "Segments and takes", text: "Render each shot in segments that continue from each other, compare takes, keep the best, assemble." },@@ -41,6 +42,8 @@ export function SwapStudioHome() {const [name, setName] = useState("");const [confirm, setConfirm] = useState<SwapProjectCard | null>(null);const nameId = useId();+ // A project is saved to the studio's library, which is its owner's: a guest or an account is told so up front.+ const visitor = useIsVisitor();const start = () =>create.mutate(@@ -55,13 +58,13 @@ export function SwapStudioHome() {<ToolShell title="Character Swap Studio" engineSwitch={false} header={<EngineSwitch value={engine} onChange={setEngine} />} wide><ToolHerotitle="Swap a character through whole clips"- subtitle="Akatz Labs' H3 Character Swap workbench, shot by shot: on your GPU with H3 Relay 2.0 (masks, history, lossless continuations), or in the cloud with fal's MiniMax H3 and the swap LoRA."+ subtitle="Put your character into whole clips, shot by shot: pick who to swap, check each shot, keep the best take."><formclassName="mt-6 flex w-full max-w-lg flex-col gap-2 sm:flex-row"onSubmit={(e) => {e.preventDefault();- start();+ if (!visitor) start();}}><label htmlFor={nameId} className="sr-only">@@ -72,14 +75,16 @@ export function SwapStudioHome() {value={name}maxLength={SWAP_STUDIO.maxNameChars}onChange={(e) => setName(e.target.value)}- placeholder="Name the project (“Rain scene, take 2”)"- className="h-10 min-w-0 flex-1 rounded-full border bg-background px-4 text-[14px] outline-none focus-visible:ring-2 focus-visible:ring-ring"+ placeholder="Project name, e.g. Rain scene"+ disabled={visitor}+ className="h-10 min-w-0 shrink-0 rounded-full border bg-background px-4 text-[14px] outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-60 sm:flex-1"/>- <Button type="submit" className="h-10 rounded-full px-5" disabled={create.isPending}>+ <Button type="submit" className="h-10 rounded-full px-5" disabled={create.isPending || visitor}>{create.isPending ? <Loader2 className="size-4 animate-spin" /> : <Drama className="size-4" />}New project · {engine === "open" ? "your GPU" : "cloud"}</Button></form>+ {visitor && <SelfHostNote className="mt-3 max-w-lg">Free accounts can't save projects here yet.</SelfHostNote>}</ToolHero><ol className="mx-auto mt-8 grid max-w-[1040px] gap-3 sm:grid-cols-2 lg:grid-cols-4" aria-label="How it works">@@ -143,12 +148,15 @@ export function SwapStudioHome() {)}</section>- <Panel title="Licences" className="mt-8">- <ul className="space-y-1 text-[12px] text-pretty text-muted-foreground">- <li>Your GPU: {characterLicenceLine("open", STUDIO_MODELS.open.swap)}</li>- <li>Cloud: {characterLicenceLine("cloud", STUDIO_MODELS.cloud.swap)}</li>- <li>The workbench follows Akatz Labs' H3 Character Swap tool (MIT); its prompts are reused with that notice. The swap LoRA releases are Akatz Labs'.</li>- </ul>+ <Panel className="mt-8">+ <details>+ <summary className="cursor-pointer text-[13px] font-semibold">Models and licences</summary>+ <ul className="mt-2 space-y-1 text-[12px] text-pretty text-muted-foreground">+ <li>The workbench follows Akatz Labs' H3 Character Swap tool (MIT): H3 Relay 2.0 on your GPU (masks, history, lossless continuations), or fal's MiniMax H3 with the swap LoRA in the cloud. Its prompts are reused with that notice; the swap LoRA releases are Akatz Labs'.</li>+ <li>Your GPU: {characterLicenceLine("open", STUDIO_MODELS.open.swap)}</li>+ <li>Cloud: {characterLicenceLine("cloud", STUDIO_MODELS.cloud.swap)}</li>+ </ul>+ </details><Link href="/genjutsu?mode=character" className="mt-3 inline-flex items-center gap-1 text-[13px] font-medium text-brand-text hover:underline"><Sparkles className="size-3.5" /> One quick swap of one part instead? Genjutsu → Character swap <ArrowRight className="size-3.5" /></Link>diff --git a/src/components/virality/virality-studio.tsx b/src/components/virality/virality-studio.tsxindex ee5e25a2..0b90711e 100644--- a/src/components/virality/virality-studio.tsx+++ b/src/components/virality/virality-studio.tsx@@ -31,8 +31,13 @@ export function ViralityStudio() {useEffect(() => () => abort.current?.abort(), []);// A result belongs to the clip it was measured on.const current = run && clip && run.ref === clip.ref ? run : null;+ // The clip is read here, never uploaded: its blob: URL goes when it's replaced and when the page closes.+ const blob = useRef<string | null>(null);+ useEffect(() => () => void (blob.current && URL.revokeObjectURL(blob.current)), []);const change = (v: SlotValue | null) => {abort.current?.abort();+ if (blob.current && blob.current !== v?.ref) URL.revokeObjectURL(blob.current);+ blob.current = v?.ref.startsWith("blob:") ? v.ref : null;setClip(v);};const go = async () => {@@ -54,13 +59,13 @@ export function ViralityStudio() {<ToolShell title="Virality predictor" engineSwitch={false}><ToolHero title="Will your first 3 seconds hold?" subtitle="An honest check of your video's hook — movement, a cut, faces, on-screen text and sound in the opening seconds, measured right here in your browser. Nothing is generated or charged." /><div className="mx-auto mt-8 grid max-w-[880px] gap-3">- <MediaDrop kind="video" value={clip} onChange={change} title="Add your video" hint="MP4 (H.264) or WebM · the opening 3 seconds are what's checked" compact />+ <MediaDrop kind="video" value={clip} onChange={change} title="Add your video" hint="MP4 (H.264) or WebM · the opening 3 seconds are what's checked" compact local /><div className="flex flex-wrap items-center gap-2"><Button size="lg" className={cn("rounded-full", (!clip || clip.uploading) && "bg-muted text-muted-foreground hover:bg-muted")} onClick={go} disabled={current?.status === "running"}>{current?.status === "running" ? <Loader2 className="size-4 animate-spin" /> : current?.status === "done" ? <RefreshCw className="size-4" /> : <TrendingUp className="size-4" />}{current?.status === "done" ? "Check again" : "Check the hook"}</Button>- <p className="text-[12px] text-muted-foreground">Runs in your browser · works on both engines and in demo mode</p>+ <p className="text-[12px] text-muted-foreground">Runs in your browser · nothing is uploaded</p></div>{current?.status === "running" && (<div className="rounded-2xl border bg-background p-3 shadow-soft" role="status" aria-live="polite">@@ -94,12 +99,13 @@ function ParityNote() {<p id="virality-parity" className="font-medium">{VIRALITY_PARITY.title}</p>- <p className="text-pretty text-muted-foreground">{VIRALITY_PARITY.body}</p>- <p className="text-pretty text-muted-foreground">{VIRALITY_PARITY.cloud}</p>- <p className="text-pretty text-muted-foreground">{VIRALITY_PARITY.open}</p>+ <p className="text-pretty text-muted-foreground">{VIRALITY_PARITY.lead}</p><details className="group pt-1"><summary className="cursor-pointer text-[12px] font-medium text-foreground marker:text-muted-foreground">Run TRIBE v2 yourself (non-commercial)</summary><div className="mt-2 space-y-2 text-[12px] text-muted-foreground">+ <p className="text-pretty">{VIRALITY_PARITY.body}</p>+ <p className="text-pretty">{VIRALITY_PARITY.cloud}</p>+ <p className="text-pretty">{VIRALITY_PARITY.open}</p><p><span className="font-medium text-foreground">Worker:</span> <span className="font-mono break-words">{TRIBE_WORKER.endpoint}</span></p>@@ -256,7 +262,8 @@ function NextSteps({ clip, measure, byId }: { clip: SlotValue; measure: HookMeas}};const weak = (id: SignalId) => byId[id]?.verdict === "weak";- const video = new URLSearchParams({ video: clip.ref }).toString();+ // A clip read in this browser only (blob:) can't go to another studio: that studio asks for it again.+ const video = clip.ref.startsWith("blob:") ? "" : new URLSearchParams({ video: clip.ref }).toString();return (<Panel title="Next steps"><div className="flex flex-wrap gap-2">@@ -274,14 +281,14 @@ function NextSteps({ clip, measure, byId }: { clip: SlotValue; measure: HookMeas)}{weak("sound") && (<Button asChild variant="outline" className="rounded-full">- <Link href={`/audio/video?${video}`} prefetch={false}>+ <Link href={video ? `/audio/video?${video}` : "/audio/video"} prefetch={false}><Volume2 className="size-4" /> Add sound</Link></Button>)}{measure.input.height > 0 && measure.input.width / measure.input.height > 0.66 && (<Button asChild variant="outline" className="rounded-full">- <Link href={`/reframe?${video}`} prefetch={false}>+ <Link href={video ? `/reframe?${video}` : "/reframe"} prefetch={false}><Crop className="size-4" /> Reframe to 9:16</Link></Button>diff --git a/src/lib/api.ts b/src/lib/api.tsindex ac503b7c..025bab96 100644--- a/src/lib/api.ts+++ b/src/lib/api.ts@@ -1086,6 +1086,37 @@ export function useIsGuest(): boolean {return !!v && v.publicSignup && !v.signedIn;}+/** A signed-in account (public sign-up), not the studio's owner. */+export function useIsAccount(): boolean {+ const v = useViewer().data;+ return !!v?.account && !v.owner;+}++/** This browser's tabs hear on it that who is signed in changed (src/app/providers.tsx asks again). */+export const AUTH_CHANNEL = "fuobe-auth";++/** Tells this browser's other tabs that someone signed in or out, so they don't go on as the one before. */+export function announceAuthChange(): void {+ try {+ const c = new BroadcastChannel(AUTH_CHANNEL);+ c.postMessage("changed");+ c.close();+ } catch {}+}++/** Signing out: the server forgets the session, the other tabs hear of it, and the page starts again signed out. */+export async function signOut(): Promise<void> {+ await fetch("/api/auth/logout", { method: "POST" });+ announceAuthChange();+ window.location.reload();+}++/** A guest or an account, once known: the studio's library, projects and settings are its owner's, not theirs. */+export function useIsVisitor(): boolean {+ const v = useViewer().data;+ return !!v && !v.owner;+}+/** "Sign up" / "Log in" with a way back here. */export function signInHref(mode: "signup" | "login", next?: string): string {const p = new URLSearchParams();diff --git a/src/lib/av/virality.ts b/src/lib/av/virality.tsindex e23c59fb..c101aa8e 100644--- a/src/lib/av/virality.ts+++ b/src/lib/av/virality.ts@@ -22,6 +22,7 @@ export const SILENCE_DB = -45;export const VIRALITY_PARITY = {title: "A heuristic hook check, not a prediction",+ lead: "A quick check of your first 3 seconds: motion, cuts, faces, text and sound, held against common rules of thumb. Useful for spotting a slow opening, not a forecast of views.",body: "Higgsfield's Virality Predictor scores videos with Meta's TRIBE v2, a brain-response model released for non-commercial use only (CC BY-NC 4.0). No cloud provider hosts it, so Fuobe shows no virality score. This page measures your first 3 seconds in your browser and holds them against common rules of thumb — useful for spotting a slow opening, not a forecast of views.",cloud: "Cloud: no hosted TRIBE v2 model exists to call.",open: "Open engine: TRIBE v2 can run on your own GPU as an optional, non-commercial worker; Fuobe doesn't bundle it.",diff --git a/src/lib/catalog/faceless.ts b/src/lib/catalog/faceless.tsindex 4d04a217..d2f6bde9 100644--- a/src/lib/catalog/faceless.ts+++ b/src/lib/catalog/faceless.ts@@ -104,6 +104,34 @@ export const CHANNEL_IDEAS = ["Channel with songs for kids",];+/** The examples for each genre (CHANNEL_IDEAS sorted by genre, with a few more where a genre had one or none). */+export const GENRE_IDEAS: Record<FacelessGenre, string[]> = {+ education: [+ "Channel about survival in the wild",+ "Channel about how everyday things are made",+ "Channel explaining space in five minutes",+ "Channel about the science of sleep and the body",+ ],+ history: [+ "Channel about the rise and fall of empires",+ "Channel about ancient civilizations",+ "Channel with daily history facts",+ "Channel about famous heists and scams",+ ],+ kids: [+ "Channel with songs for kids",+ "Channel about animals for curious kids",+ "Channel with bedtime stories about friendly dragons",+ "Channel about how things work, for kids",+ ],+ storytelling: [+ "Channel retelling myths and legends",+ "Channel with true mysteries that were never solved",+ "Channel about famous heists and scams",+ "Channel with short ghost stories by the campfire",+ ],+};+export interface VisualStyle {id: string;name: string;diff --git a/src/lib/catalog/genjutsu.ts b/src/lib/catalog/genjutsu.tsindex c2d70414..dba20ce5 100644--- a/src/lib/catalog/genjutsu.ts+++ b/src/lib/catalog/genjutsu.ts@@ -603,12 +603,15 @@ const WEIGHTS: Record<string, string> = {"oss-vace-insert": "Wan 2.1 VACE weights: Apache-2.0",};-/** A model's licence in one line, as information for the picker (the admin decides what runs, in Settings). */-export function makerLicence(m: Maker): string {+/**+ * A model's licence in one line, as information for the picker (the admin decides what runs, in Settings), with where+ * it runs unless the line it goes in already says (`where` false).+ */+export function makerLicence(m: Maker, where = true): string {if (m.h3 || m.id === "h3-max-recast") return characterLicenceLine(m.engine, m.id);if (m.source === "partner") return "Closed model: pay per use, under its provider's terms";- const where = m.engine === "open" ? "free on your GPU" : "on fal, pay per use";- return WEIGHTS[m.id] ? `${WEIGHTS[m.id]} · ${where}` : `Open weights · ${where}`;+ const weights = WEIGHTS[m.id] ?? "Open weights";+ return where ? `${weights} · ${m.engine === "open" ? "free on your GPU" : "on fal, pay per use"}` : weights;}/**diff --git a/src/lib/command-search.ts b/src/lib/command-search.tsindex ca02dfd0..6fee706c 100644--- a/src/lib/command-search.ts+++ b/src/lib/command-search.ts@@ -122,6 +122,11 @@ export const GROUP_LIMIT: Record<PaletteKind, number> = { page: 6, setting: 4, s/** Matches far weaker than the best one are noise next to it ("lip" finds Lipsync, not "virality predictor"). */const KEEP_FROM_BEST = 0.35;+/**+ * Once something has the words themselves in it (a substring or better, 40+), letters-in-order guesses (30 at most, plus+ * a page's bonus) are noise: "tts" finds IndexTTS-2, not Settings or Tentacle Horror.+ */+const KEEP_FROM_REAL_MATCH = 0.6;/*** The matches for a query, grouped by kind: each group best first and cut to its limit, the groups@@ -132,7 +137,8 @@ const KEEP_FROM_BEST = 0.35;export function rankPalette(entries: PaletteEntry[], query: string, limits: Record<PaletteKind, number> = GROUP_LIMIT): PaletteGroup[] {if (!normalize(query)) return [];const scored = entries.map((e) => ({ e, s: entryScore(query, e) })).filter((x) => x.s > 0);- const floor = Math.max(0, ...scored.map((x) => x.s)) * KEEP_FROM_BEST;+ const top = Math.max(0, ...scored.map((x) => x.s));+ const floor = top * (top >= 40 ? KEEP_FROM_REAL_MATCH : KEEP_FROM_BEST);const byKind = new Map<PaletteKind, { e: PaletteEntry; s: number }[]>();for (const x of scored) {if (x.s < floor) continue;diff --git a/src/lib/connections.ts b/src/lib/connections.tsindex 83e62e09..73007757 100644--- a/src/lib/connections.ts+++ b/src/lib/connections.ts@@ -186,8 +186,11 @@ export function startLine(s: ConnectionState, quote: StartQuote | undefined, eng*/export const FIRST_RUN_KEY = "fuobe:first-run";-/** Runs while Home's HTML is parsed: `<html data-first-run="0">` when the guide was put away here before. */-export const FIRST_RUN_SCRIPT = `(function(){try{if(localStorage.getItem("${FIRST_RUN_KEY}")==="0")document.documentElement.setAttribute("data-first-run","0")}catch(e){}})()`;+/**+ * Runs while Home's HTML is parsed: `<html data-first-run="1">` when the guide showed here last time (the shell shows it+ * then), "0" when it was put away.+ */+export const FIRST_RUN_SCRIPT = `(function(){try{var v=localStorage.getItem("${FIRST_RUN_KEY}");if(v==="0"||v==="1")document.documentElement.setAttribute("data-first-run",v)}catch(e){}})()`;export const ENGINE_MODE_LABEL: Record<EngineModeName, string> = { both: "Open source + paid", open: "Open source only", cloud: "Paid APIs only" };diff --git a/src/lib/guest-access.ts b/src/lib/guest-access.tsindex 46fec637..cd211795 100644--- a/src/lib/guest-access.ts+++ b/src/lib/guest-access.ts@@ -24,7 +24,7 @@ export const GUEST_RUN_MESSAGE = "Create a free account to run this.";const GUEST_READS = new Set(["/api/status", "/api/models", "/api/search-index", "/api/comfyui", "/api/settings/models", "/api/gpu/requirements"]);/** Catalogs mixed with the owner's own items: the route leaves the owner's part out for a guest (GUEST_HEADER). */-const GUEST_FILTERED = new Set(["/api/moodboards", "/api/palettes", "/api/assist/skills"]);+const GUEST_FILTERED = new Set(["/api/moodboards", "/api/palettes", "/api/assist", "/api/assist/skills"]);/** The owner's lists ({ items }): a guest gets them empty. */const EMPTY_LISTS = [@@ -86,8 +86,11 @@ export function guestRead(pathname: string): GuestRead {return { kind: "closed" };}-/** The run routes whose `?preview=1` only plans and prices (any other route would ignore the flag and run). */-const PREVIEWS = [/^\/api\/(generations|audio-tools|dub|katana|turnaround)$/, /^\/api\/dub\/[^/]+\/voice$/];+/**+ * The run routes whose `?preview=1` only plans and prices (any other route would ignore the flag and run). AI+ * Influencer, Fashion Factory and Character Sheet price on load, with synchronous price functions.+ */+const PREVIEWS = [/^\/api\/(generations|audio-tools|dub|katana|turnaround|influencer|photodump|photodump\/fashion|photodump\/character)$/, /^\/api\/dub\/[^/]+\/voice$/];/** The estimate routes (named: a dynamic segment called "estimate" on another route must not pass for one). */const ESTIMATES =@@ -195,6 +198,8 @@ export const OWN_GPU_TOOL_MESSAGE = "This tool doesn't run on your own GPU yet./** Set on an account's refused run: the client shows "Connect your GPU to run this". */export const CONNECT_GPU_HEADER = "x-fuobe-connect-gpu";export const CONNECT_GPU_MESSAGE = "Connect your GPU to run this. Free accounts run on their own ComfyUI.";+/** An account's upload without a GPU: its files are kept for runs on its own ComfyUI. */+export const CONNECT_GPU_UPLOAD_MESSAGE = "Connect your GPU to add your own files. A free account uses them on its own ComfyUI.";/** Install-wide settings, keys and tokens: changes are the owner's (403 for an account). */const OWNER_WRITES = new Set(["/api/settings", "/api/settings/models", "/api/loras", "/api/llm", "/api/providers/test", "/api/auth/public"]);diff --git a/src/lib/hubs.ts b/src/lib/hubs.tsindex d6e0b1a5..52f19403 100644--- a/src/lib/hubs.ts+++ b/src/lib/hubs.ts@@ -1,7 +1,7 @@/*** Studio hubs: Audio, Video tools and Upscale group several studios, one path per mode* (/audio/music, /video-tools/join, /upscale/video, /upscale/fps). The hub's own path is its first mode.- * Pure data (client and server). Old `/audio?mode=music` links redirect in next.config.ts.+ * Pure data (client and server). Old `/audio?mode=music` links redirect in src/proxy.ts (hubModeLink).*/export type HubKind = "audio" | "video-tools" | "upscale";diff --git a/src/lib/preset-cards.ts b/src/lib/preset-cards.tsindex 56d1d668..d7f8c5dd 100644--- a/src/lib/preset-cards.ts+++ b/src/lib/preset-cards.ts@@ -466,6 +466,17 @@ export function interleaveByCategory<T extends { category: string }>(items: T[])/** Lower-cased text a gallery search matches against. */export const searchText = (c: Pick<PresetCardData, "name" | "description" | "category">) => `${c.name} ${c.description} ${c.category}`.toLowerCase();+/** A search word without a plain English ending (explosions → explosion, remover and removing → remov), so other forms match. */+const stem = (w: string) => (w.length > 4 ? w.replace(/(?:ing|es|er|s)$/, "") : w);++/**+ * Whether a gallery's search text (searchText) matches what was typed: every word, in any order, in any of its simple+ * forms ("explosions", "removing background"). The query is lower-cased already.+ */+export function matchesSearch(text: string, query: string): boolean {+ return query.split(/\s+/).every((w) => !w || text.includes(stem(w)));+}+const lowerFirst = (s: string) => (/^[A-Z][a-z]/.test(s) ? s[0].toLowerCase() + s.slice(1) : s);const article = (s: string) => (/^(a|an|the|your|my)\s/i.test(s) ? s : `${/^[aeiou]/i.test(s) ? "an" : "a"} ${s}`);diff --git a/src/lib/studios.ts b/src/lib/studios.tsindex 352b1c3d..bf611585 100644--- a/src/lib/studios.ts+++ b/src/lib/studios.ts@@ -56,7 +56,7 @@ export const INPAINT_STUDIO: StudioConfig = {feature: "edit",title: "Inpaint",hero: "Paint it, then say what goes there",- subtitle: "GPT Image, Ideogram and FLUX Fill take the mask directly; other edit models are shown the painted area.",+ subtitle: "Paint the area to change, then say what goes there. FLUX Fill uses your mask directly.",placeholder: "What should fill the painted area? e.g. “a vase of white tulips”",kind: "image",ops: ["inpaint", "edit"],@@ -206,21 +206,21 @@ export const AUDIO_STUDIO: StudioConfig = {feature: "audio",title: "Audio",hero: "Give it a voice",- subtitle: "Premade ElevenLabs voices, or clone any voice from a 10-second sample.",- placeholder: "What should it say? Try ElevenLabs v3 audio tags like [whispers] or [laughs]",+ subtitle: "Clone any voice from a 10-second sample, then give it your words.",+ placeholder: "What should it say?",kind: "audio",ops: ["tts"],feed: { kind: "audio", features: ["audio"] },slots: [],defaultModels: { cloud: "elevenlabs-v4", open: "oss-chatterbox" },- suggestions: ["Welcome to Fuobe — make anything, with any model.", "[whispers] Don't look now… but I think it's following us.", "Breaking news: the robots have learned to paint."],+ suggestions: ["Welcome to Fuobe — make anything, with any model.", "Don't look now… but I think it's following us.", "Breaking news: the robots have learned to paint."],};export const DIALOGUE_STUDIO: StudioConfig = {feature: "audio",title: "Audio",hero: "Write a conversation",- subtitle: "Every line gets its own voice; the model handles timing, interruptions and tone.",+ subtitle: "Every line gets its own voice, timed like a real conversation.",placeholder: "",kind: "audio",ops: ["dialogue"],@@ -310,7 +310,7 @@ export const FOLEY_STUDIO: StudioConfig = {feature: "audio",title: "Audio",hero: "Add sound to a video",- subtitle: "Foley in sync with the picture: Mirelo SFX 2.0 on the cloud, HunyuanVideo-Foley or MMAudio on your ComfyUI.",+ subtitle: "Foley in sync with the picture: HunyuanVideo-Foley or MMAudio on your ComfyUI.",placeholder: "Optional: describe the sound, e.g. “footsteps on gravel, distant birds”",kind: "video",ops: ["v2a"],diff --git a/src/lib/website.ts b/src/lib/website.tsnew file mode 100644index 00000000..b3657c93--- /dev/null+++ b/src/lib/website.ts@@ -0,0 +1,12 @@+/** Normalise a website the user typed ("acme.com" → "https://acme.com/"); null when it isn't one. Client and server. */+export function normalizeWebsite(input: string): string | null {+ const s = input.trim();+ if (!s || /\s/.test(s)) return null;+ try {+ const u = new URL(/^https?:\/\//i.test(s) ? s : `https://${s}`);+ if (!/^https?:$/.test(u.protocol) || !u.hostname.includes(".") || u.hostname.endsWith(".")) return null;+ return u.toString();+ } catch {+ return null;+ }+}diff --git a/src/proxy.ts b/src/proxy.tsindex f1bbe0e0..137360cd 100644--- a/src/proxy.ts+++ b/src/proxy.ts@@ -1,5 +1,6 @@import { NextResponse, type NextRequest } from "next/server";import { APPS } from "@/lib/catalog/apps";+import { modeHref, type HubKind } from "@/lib/hubs";import { recordForPath, unknownHubMode } from "@/lib/record-pages";import { countsAsView, SHARE_VIEW_HEADER, shareRoute } from "@/lib/share";import {@@ -44,8 +45,7 @@ const APP_IDS = new Set(APPS.map((a) => a.id));function pass(request: NextRequest): NextResponse {const { pathname } = request.nextUrl;const app = /^\/apps\/([^/]+)\/?$/.exec(pathname)?.[1];- if (app && !APP_IDS.has(safeDecode(app))) return notFound(request, { href: "/apps", label: "Browse apps" });- if (unknownHubMode(pathname)) return notFound(request);+ if ((app && !APP_IDS.has(safeDecode(app))) || unknownHubMode(pathname)) return notFound(request);const record = recordForPath(pathname);if (record && !recordExists(record)) return notFound(request);return NextResponse.next();@@ -56,37 +56,65 @@ function pass(request: NextRequest): NextResponse {* proxy's request address from its own name for the server ("localhost") and the forwarded protocol, and the address* it routes by from the host it listens on (`next start -H 127.0.0.1`): when they differ, a rewrite to the app's own* 404 page goes out as a request to another server, which fails over HTTPS and answered 500. Plain HTTP (a local- * install) keeps the rewrite to the app's own pages. It wears the studio's colours and type (Inter and Instrument- * Serif where installed, else the same fallbacks the app uses), with a way back: the section's own page (an unknown app:- * the apps), then Home.+ * install) keeps the rewrite to the app's own pages. It looks like the app's own 404 (NotFoundState in+ * src/components/empty-state.tsx): the Fuobe mark, the serif heading, the brand button, and the theme the visitor+ * chose (next-themes' "theme" key, read before the first paint).*/-type PageLink = { href: string; label: string };-function plain404(title: string, text: string, links: PageLink[]): NextResponse {- const nav = links.map((l, i) => `<a href="${l.href}"${i < links.length - 1 ? ' class="alt"' : ""}>${l.label}</a>`).join("");- const html = `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><meta name="robots" content="noindex"><title>${title} · Fuobe</title><style>-:root{color-scheme:light dark;--bg:#ffffff;--fg:#1e1e1f;--muted:#6e6e71;--line:#e4e4e7;--btn:#5d4bdb;--btn-fg:#ffffff}-@media (prefers-color-scheme:dark){:root{--bg:#121213;--fg:#fafafb;--muted:#a9a9ab;--line:#2e2e31;--btn:#6a5ee7;--btn-fg:#ffffff}}-body{margin:0;min-height:100svh;display:grid;place-items:center;background:var(--bg);color:var(--fg);font:15px/1.5 Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;text-align:center}-main{max-width:460px;padding:24px 16px 10vh}.brand{margin-bottom:18px;font:22px/1 "Instrument Serif",ui-serif,Georgia,serif}-h1{margin:0;font:400 40px/1.15 "Instrument Serif",ui-serif,Georgia,serif;text-wrap:balance}p{margin:10px 0 0;color:var(--muted);text-wrap:pretty}-nav{display:flex;flex-wrap:wrap;justify-content:center;gap:8px;margin-top:22px}nav a{padding:9px 16px;border-radius:999px;background:var(--btn);color:var(--btn-fg);text-decoration:none;font-weight:500}-nav a.alt{background:transparent;color:var(--fg);box-shadow:inset 0 0 0 1px var(--line)}-</style></head><body><main><div class="brand">Fuobe</div><h1>${title}</h1><p>${text}</p>${nav && `<nav>${nav}</nav>`}</main></body></html>`;+function plain404(title: string, text: string, back?: { href: string; label: string }, home = back ? "Home" : "Back to Home"): NextResponse {+ const html = `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><meta name="robots" content="noindex"><title>${title} · Fuobe</title><link rel="icon" href="/icon.svg" type="image/svg+xml"><script>try{var t=localStorage.getItem("theme");if(t==="dark"||(t!=="light"&&matchMedia("(prefers-color-scheme: dark)").matches))document.documentElement.className="dark"}catch(e){}</script><style>+:root{color-scheme:light;--bg:#fff;--fg:#1e1e1f;--muted:#6e6e71;--line:#e8e8e9;--brand:#5d4bdb;--faint:#efedfc}+.dark{color-scheme:dark;--bg:#121213;--fg:#fafafb;--muted:#a9a9ab;--line:rgba(255,255,255,.14);--brand:#6a5ee7;--faint:#25223d}+body{margin:0;min-height:100svh;display:flex;flex-direction:column;background:var(--bg);color:var(--fg);font:15px/1.5 Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif}+header{padding:16px}header a{display:inline-flex;align-items:center;gap:8px;color:inherit;text-decoration:none;font-weight:600;font-size:16px}+main{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;box-sizing:border-box;width:100%;max-width:520px;margin:0 auto;padding:24px 24px 12vh;text-align:center}+h1{margin:20px 0 0;font:400 34px/1.15 "Instrument Serif",ui-serif,Georgia,"Times New Roman",serif;text-wrap:balance}+p{margin:8px 0 0;color:var(--muted);text-wrap:pretty}nav{margin-top:28px;display:flex;flex-wrap:wrap;justify-content:center;gap:8px}+nav a{display:inline-flex;align-items:center;height:36px;padding:0 16px;border-radius:999px;text-decoration:none;font-weight:500;font-size:14px}+.go{background:var(--brand);color:#fff}.back{border:1px solid var(--line);color:var(--fg)}a:focus-visible{outline:2px solid var(--brand);outline-offset:2px}+.mark{display:grid;place-items:center;width:48px;height:48px;border-radius:16px;background:var(--faint);color:var(--brand)}+</style></head><body><header><a href="/">${LOGO}<span>Fuobe</span></a></header><main><span class="mark" aria-hidden="true">${COMPASS}</span><h1>${title}</h1><p>${text}</p><nav>${back ? `<a class="back" href="${back.href}">${back.label}</a>` : ""}<a class="go" href="/">${home}</a></nav></main></body></html>`;return new NextResponse(html, { status: 404, headers: { "Content-Type": "text/html; charset=utf-8", "Cache-Control": "no-store" } });}+/** The Fuobe mark (src/app/icon.svg) and the 404's compass (lucide's Compass, as NotFoundState shows). */+const LOGO =+ '<svg width="24" height="24" viewBox="0 0 32 32" aria-hidden="true"><rect width="32" height="32" rx="8" fill="#5d4bdb"/><g transform="translate(5.5 5.5) scale(0.875)" fill="none" stroke="#fff" stroke-width="2.3" stroke-linecap="round" stroke-linejoin="round"><path d="m12.296 3.464 3.02 3.956"/><path d="M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3z"/><path d="M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/><path d="m6.18 5.276 3.1 3.899"/></g></svg>';+const COMPASS =+ '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z"/></svg>';+const behindHttps = (request: NextRequest) => request.nextUrl.protocol === "https:";-const HOME: PageLink = { href: "/", label: "Back to Home" };+/** A dead link's section: the way back to it, and what is missing when the link names a stored item. */+const SECTIONS: { prefix: string; label: string; missing?: string }[] = [+ { prefix: "/apps", label: "Browse apps", missing: "This app isn’t here" },+ { prefix: "/canvas", label: "Back to Canvas", missing: "This canvas isn’t here" },+ { prefix: "/cinema", label: "Back to Cinema", missing: "This project isn’t here" },+ { prefix: "/shorts", label: "Back to Shorts", missing: "This session isn’t here" },+ { prefix: "/ads", label: "Back to Ads", missing: "This brand isn’t here" },+ { prefix: "/elements", label: "All elements", missing: "This element isn’t here" },+ { prefix: "/faceless", label: "Back to Faceless", missing: "This channel isn’t here" },+ { prefix: "/explainer", label: "Back to Explainer", missing: "This explainer isn’t here" },+ { prefix: "/content-factory", label: "Back to Content Factory", missing: "This series isn’t here" },+ { prefix: "/character-swap", label: "Back to Character Swap", missing: "This project isn’t here" },+ { prefix: "/layers", label: "Back to Layers", missing: "This project isn’t here" },+ { prefix: "/assist", label: "Back to Assist", missing: "This project isn’t here" },+ { prefix: "/audio", label: "Back to Audio" },+ { prefix: "/video-tools", label: "Back to Video tools" },+ { prefix: "/upscale", label: "Back to Upscale" },+];-const notFound = (request: NextRequest, section?: PageLink) =>- behindHttps(request)- ? plain404("Nothing here", "The page you’re looking for moved, or never existed.", section ? [section, HOME] : [HOME])- : NextResponse.rewrite(new URL("/_fuobe-not-found", request.url), { status: 404 });+const notFound = (request: NextRequest) => {+ if (!behindHttps(request)) return NextResponse.rewrite(new URL("/_fuobe-not-found", request.url), { status: 404 });+ const s = SECTIONS.find((x) => request.nextUrl.pathname.startsWith(`${x.prefix}/`));+ const back = s && { href: s.prefix, label: s.label };+ return s?.missing+ ? plain404(s.missing, "It’s private, or it was deleted, or it never existed.", back)+ : plain404("Nothing here", "The page you’re looking for moved, or never existed.", back);+};const shareGone = (request: NextRequest) =>behindHttps(request)- ? plain404("This link isn’t available", "It may have expired or been turned off, or what it shared was removed. Ask the person who sent it for a new link.", [])+ ? plain404("This link isn’t available", "It may have expired or been turned off, or what it shared was removed. Ask the person who sent it for a new link.", undefined, "Make your own with Fuobe"): NextResponse.rewrite(new URL("/s/gone", request.url), { status: 404 });/** Share pages and their files: never indexed, and the token never leaks to another site in a Referer. */@@ -177,9 +205,10 @@ function account(request: NextRequest, who: Account): NextResponse {if (isPriceCheck(request.method, pathname, search)) return priceCheck(request, `account:${who.id}`);if (accountMayChange(request.method, pathname, search)) return pass(request);if (isLibraryChange(request.method, pathname)) return NextResponse.json({ error: LIBRARY_MESSAGE, code: "library" }, { status: 403 });+ // A tool its own GPU wouldn't run says so first: "Connect your GPU" only for what a GPU unlocks.+ if (!ownGpuRun(request.method, pathname)) return NextResponse.json({ error: OWN_GPU_TOOL_MESSAGE, code: "own-gpu-tool" }, { status: 403 });if (!who.gpu) return NextResponse.json({ error: CONNECT_GPU_MESSAGE, code: "connect-gpu" }, { status: 403, headers: { [CONNECT_GPU_HEADER]: "1" } });- if (ownGpuRun(request.method, pathname)) return pass(request);- return NextResponse.json({ error: OWN_GPU_TOOL_MESSAGE, code: "own-gpu-tool" }, { status: 403 });+ return pass(request);}const tooMany = (seconds: number) =>@@ -222,6 +251,19 @@ function openShare(request: NextRequest, token: string, file: boolean): NextRespreturn res;}+/**+ * An old `/audio?mode=music` link (any case: ?mode=Music too): that mode's own page, without the mode in its query.+ * An unknown mode lands on the hub's 404 (unknownHubMode).+ */+function hubModeLink(request: NextRequest): URL | null {+ const kind = /^\/(audio|video-tools|upscale)\/?$/.exec(request.nextUrl.pathname)?.[1] as HubKind | undefined;+ const mode = kind && request.nextUrl.searchParams.get("mode")?.trim().toLowerCase();+ if (!kind || !mode || !/^[a-z0-9-]+$/.test(mode)) return null;+ const url = new URL(modeHref(kind, mode), request.url);+ for (const [k, v] of request.nextUrl.searchParams) if (k !== "mode") url.searchParams.append(k, v);+ return url;+}+function safeDecode(s: string): string {try {return decodeURIComponent(s);@@ -246,8 +288,17 @@ export function proxy(request: NextRequest) {}const { pathname, search } = request.nextUrl;// Share links are read-only and public, password or not: exactly a share's page and its files.- const share = (request.method === "GET" || request.method === "HEAD") && shareRoute(pathname);+ const read = request.method === "GET" || request.method === "HEAD";+ const share = read && shareRoute(pathname);if (share) return openShare(request, share.token, !!share.file);+ // Any other /s/ link is no share: the same "link unavailable" 404 as an unknown token.+ if (read && pathname.startsWith("/s/")) {+ const res = shareGone(request);+ for (const [k, v] of Object.entries(SHARE_HEADERS)) res.headers.set(k, v);+ return res;+ }+ const hub = read && hubModeLink(request);+ if (hub) return NextResponse.redirect(hub);if (!authEnabled()) return pass(request);if (OPEN.has(pathname)) return NextResponse.next();const open = publicSignup(request.headers.get("host") ?? request.nextUrl.host);diff --git a/src/server/auth.ts b/src/server/auth.tsindex cca31921..18417005 100644--- a/src/server/auth.ts+++ b/src/server/auth.ts@@ -69,6 +69,8 @@ interface AuthFile {accounts?: Account[];/** Settings → Security: guests may browse and anyone may sign up (FUOBE_PUBLIC_SIGNUP overrides it). */publicSignup?: boolean;+ /** Session cookies signed out (endSession), by their SHA-256, until they would have expired anyway. */+ signedOut?: { hash: string; exp: number }[];/** In memory only: the file is there but can't be read or parsed. Sign-in stays on, nobody is signed in, nothing is written. */unreadable?: true;}@@ -239,11 +241,28 @@ export function sessionViewer(value: string | undefined): Viewer | null {const d = read();if (!d.secret || !mac || !liveExpiry(exp)) return null;if (!same(Buffer.from(mac), Buffer.from(sign(keyFor(d, parts.length === 2), parts.slice(0, -1).join("."))))) return null;+ // Signed out with Sign out: a copy of the cookie (another tab's, a stolen one) is refused too.+ if (d.signedOut?.length && d.signedOut.some((s) => s.hash === cookieHash(value))) return null;if (parts.length === 2) return { kind: "owner" };const account = d.accounts?.find((a) => a.id === parts[1]);return account && !account.disabled ? { kind: "account", account } : null;}+const cookieHash = (value: string) => crypto.createHash("sha256").update(value).digest("hex");++/**+ * Sign out: the server stops taking this session cookie (deleting it from the browser alone would leave a copy working+ * until it expires). Kept until the cookie would have expired anyway, so the list stays short.+ */+export function endSession(value: string | undefined): void {+ if (!value || !sessionViewer(value)) return;+ const d = read();+ const now = Date.now();+ const signedOut = (d.signedOut ?? []).filter((s) => s.exp > now);+ signedOut.push({ hash: cookieHash(value), exp: Number(value.split(".")[0]) });+ write({ ...d, signedOut });+}+/*** Settings → Security → Sign everyone out: a new secret, so every session cookie (the owner's and every account's,* this browser's too) stops working at once. Works while FUOBE_PASSWORD is set, which the Settings password changediff --git a/src/server/brand.ts b/src/server/brand.tsindex fa45729d..feff7108 100644--- a/src/server/brand.ts+++ b/src/server/brand.ts@@ -19,6 +19,7 @@ import { db } from "./db";import { llmText } from "./enhance";import { fetchRemote } from "./remote-fetch";import { saveFile } from "./storage";+import { normalizeWebsite } from "@/lib/website";/*** Brand kits and products, shared by Marketing Studio, Ads Studio and Click to Ad.@@ -929,18 +930,8 @@ function storedKit(id: string): StoredKit | null {return r ? { ...emptyKit(r.name), ...parse<StoredKit>(r.kit_json, emptyKit(r.name)) } : null;}-/** Normalise a website the user typed ("acme.com" → "https://acme.com/"); null when it isn't one. */-export function normalizeWebsite(input: string): string | null {- const s = input.trim();- if (!s || /\s/.test(s)) return null;- try {- const u = new URL(/^https?:\/\//i.test(s) ? s : `https://${s}`);- if (!/^https?:$/.test(u.protocol) || !u.hostname.includes(".") || u.hostname.endsWith(".")) return null;- return u.toString();- } catch {- return null;- }-}+// The browser checks a link with the same rule before it sends one (src/lib/website.ts).+export { normalizeWebsite };/** Start a brand from a website: the row exists at once, the research runs in the background. */export function createBrandFromWebsite(website: string): { brand: BrandKit; run: Promise<void> } {diff --git a/tests/connections.test.ts b/tests/connections.test.tsindex a5f4134d..4512c784 100644--- a/tests/connections.test.ts+++ b/tests/connections.test.ts@@ -105,7 +105,7 @@ describe("first-run guide and status strip", () => {expect(nothingConnected(state(["replicate"], "cloud"))).toBe(false);});- it("hides Home's shell guide before the first paint only where this browser put it away", () => {+ it("shows Home's shell guide before the first paint only where this browser showed it last time", () => {const run = (stored: string | null | Error) => {const attrs: Record<string, string> = {};const localStorage = {@@ -119,9 +119,10 @@ describe("first-run guide and status strip", () => {return attrs["data-first-run"];};expect(run("0")).toBe("0");- // A first visit, or a guide still wanted: the shell keeps it, so it doesn't push the page down later.+ // A guide still wanted: the shell shows it, so it doesn't push the page down later.+ expect(run("1")).toBe("1");+ // A first visit (a public studio's visitor never gets the guide): the shell leaves it out.expect(run(null)).toBeUndefined();- expect(run("1")).toBeUndefined();// Storage blocked (a private window): nothing breaks.expect(run(new Error("denied"))).toBeUndefined();});diff --git a/tests/genjutsu.test.ts b/tests/genjutsu.test.tsindex 2026194d..f6985fd4 100644--- a/tests/genjutsu.test.ts+++ b/tests/genjutsu.test.ts@@ -86,6 +86,8 @@ describe("Genjutsu: which model runs", () => {expect(makerLicence(maker(ORIGINALS.character, "open"))).toMatch(/nodes GPL-3\.0 · SAM License$/);expect(makerLicence(maker("h3-max-recast"))).toMatch(/^MiniMax's closed H3 Max through fal/);expect(makerLicence(maker(ORIGINALS.swap, "open"))).toBe("Wan VACE weights: Apache-2.0 · SAM 3.1: Meta's SAM License · free on your GPU");+ // In a line whose note already says where it runs: not said twice.+ expect(makerLicence(maker(ORIGINALS.swap, "open"), false)).toBe("Wan VACE weights: Apache-2.0 · SAM 3.1: Meta's SAM License");expect(makerLicence(maker("scail-2"))).toBe("SCAIL-2 weights: MIT · on fal, pay per use");expect(makerLicence(maker("kling-o3"))).toBe("Closed model: pay per use, under its provider's terms");expect(MAKERS.every((m) => makerLicence(m).length > 10)).toBe(true);diff --git a/tests/preset-cards.test.ts b/tests/preset-cards.test.tsindex 6032b463..9a3b8c5c 100644--- a/tests/preset-cards.test.ts+++ b/tests/preset-cards.test.ts@@ -24,6 +24,7 @@ import {presetRouteLines,previewFlip,searchText,+ matchesSearch,type CameraMove,type MoveSpec,type PreviewLayer,@@ -253,6 +254,10 @@ describe("slim card DTOs", () => {it("searches name, description and category", () => {expect(searchText({ name: "Crash Zoom In", description: "A sudden zoom", category: "Push & Pull" })).toBe("crash zoom in a sudden zoom push & pull");+ // Every word, in any order and in its plain forms.+ const t = searchText({ name: "Remove Background", description: "A clean cut-out with one explosion", category: "Edit" });+ for (const q of ["remover", "removing", "explosions", "background remove", "explosion", "edit"]) expect(matchesSearch(t, q), q).toBe(true);+ for (const q of ["fire", "remove fire"]) expect(matchesSearch(t, q), q).toBe(false);});});diff --git a/tests/public-signup-tools.test.ts b/tests/public-signup-tools.test.tsindex 51f5dfca..5e153a61 100644--- a/tests/public-signup-tools.test.ts+++ b/tests/public-signup-tools.test.ts@@ -122,15 +122,15 @@ describe("the proxy: PR #15's routes as main treats their kind", () => {}});- it("gives an account the price checks, Connect your GPU for the runs, and library for the Export mix", async () => {+ it("gives an account the price checks, own-gpu-tool for the runs (a GPU wouldn't run them), and library for the Export mix", async () => {process.env.FUOBE_PUBLIC_SIGNUP = "1";const cookie = auth.createSession(newAccount().id).value;for (const p of ["/api/turnaround/estimate", "/api/turnaround?preview=1", "/api/audio-tools?preview=1"]) expect(passed(proxy(req(p, { method: "POST", cookie }))), p).toBe(true);for (const p of ["/api/turnaround", "/api/audio-tools"]) {const r = proxy(req(p, { method: "POST", cookie }));expect(r.status, p).toBe(403);- expect(r.headers.get(access.CONNECT_GPU_HEADER), p).toBe("1");- expect((await r.json()).code, p).toBe("connect-gpu");+ expect(r.headers.get(access.CONNECT_GPU_HEADER), p).toBeNull();+ expect((await r.json()).code, p).toBe("own-gpu-tool");}// The mix is saved to the owner's Library: a library change, whatever the GPU.const save = proxy(req("/api/audio-tools/export?offset=0", { method: "POST", cookie }));diff --git a/tests/public-signup.test.ts b/tests/public-signup.test.tsindex 6b80f8fc..ed279568 100644--- a/tests/public-signup.test.ts+++ b/tests/public-signup.test.ts@@ -123,15 +123,17 @@ describe("proxy with public sign-up on", () => {const list = proxy(req("/api/generations?limit=40"));expect(list.status).toBe(200);expect(await list.json()).toEqual({ items: [] });- for (const p of ["/api/files/outputs/a.png", "/api/settings", "/api/auth/tokens", "/api/generations/abc", "/api/layers/abc", "/api/uploads", "/api/assist"]) {+ for (const p of ["/api/files/outputs/a.png", "/api/settings", "/api/auth/tokens", "/api/generations/abc", "/api/layers/abc", "/api/uploads", "/api/assist/t1"]) {const r = proxy(req(p));expect(r.status, p).toBe(401);expect(r.headers.get(access.GUEST_HEADER), p).toBe("1");}// Catalogs mixed with the owner's items: the route is told it's a guest.- const moodboards = proxy(req("/api/moodboards"));- expect(passed(moodboards)).toBe(true);- expect(moodboards.headers.get(`x-middleware-request-${access.GUEST_HEADER}`)).toBe("1");+ for (const p of ["/api/moodboards", "/api/assist"]) {+ const r = proxy(req(p));+ expect(passed(r), p).toBe(true);+ expect(r.headers.get(`x-middleware-request-${access.GUEST_HEADER}`), p).toBe("1");+ }});it("refuses a guest's every change with a 401 the client turns into the sign-up prompt", async () => {@@ -208,11 +210,16 @@ describe("proxy with public sign-up off (today's behaviour)", () => {});describe("accounts never run on the owner's keys or GPU", () => {- it("refuses an account's runs and AI helpers with Connect your GPU", async () => {+ it("refuses an account's runs with Connect your GPU, and the tools a GPU wouldn't unlock with own-gpu-tool", async () => {process.env.FUOBE_PUBLIC_SIGNUP = "1";const cookie = auth.createSession(auth.createAccount("[email protected]", "long enough").id).value;+ // The studios' generations run on its own GPU: connect one.+ const run = proxy(req("/api/generations", { method: "POST", cookie }));+ expect(run.status).toBe(403);+ expect(run.headers.get(access.CONNECT_GPU_HEADER)).toBe("1");+ expect((await run.json()).code).toBe("connect-gpu");+ // Everything else wouldn't run on it even once connected: said first, with no Connect your GPU card.for (const p of [- "/api/generations","/api/canvases/c1/run","/api/cinema/projects/p1/generate","/api/layers/l1/jobs",@@ -230,8 +237,8 @@ describe("accounts never run on the owner's keys or GPU", () => {]) {const r = proxy(req(p, { method: "POST", cookie }));expect(r.status, p).toBe(403);- expect(r.headers.get(access.CONNECT_GPU_HEADER), p).toBe("1");- expect((await r.json()).code).toBe("connect-gpu");+ expect(r.headers.get(access.CONNECT_GPU_HEADER), p).toBeNull();+ expect((await r.json()).code, p).toBe("own-gpu-tool");}// Owner-only routes say so (not "connect your GPU").expect(proxy(req("/api/mcp", { method: "POST", cookie })).headers.get(access.CONNECT_GPU_HEADER)).toBeNull();@@ -264,7 +271,7 @@ describe("accounts never see or change the owner's library", () => {canvases: { lists: ["/api/canvases"], records: ["/api/canvases/c1"], changes: [["POST", "/api/canvases"], ["PATCH", "/api/canvases/c1"], ["DELETE", "/api/canvases/c1"], ["POST", "/api/canvases/c1/duplicate"]] },cinema: { lists: ["/api/cinema/projects"], records: ["/api/cinema/projects/p1", "/api/cinema/projects/p1/items"], changes: [["POST", "/api/cinema/projects"], ["PATCH", "/api/cinema/projects/p1"], ["DELETE", "/api/cinema/projects/p1"]] },storyboards: { lists: [], records: ["/api/storyboards"], changes: [["POST", "/api/storyboards"]] },- assist: { lists: ["/api/assist/projects"], records: ["/api/assist", "/api/assist/t1", "/api/assist/memory"], changes: [["PATCH", "/api/assist/t1"], ["DELETE", "/api/assist/t1"], ["POST", "/api/assist/projects"]] },+ assist: { lists: ["/api/assist/projects"], records: ["/api/assist/t1", "/api/assist/memory"], changes: [["PATCH", "/api/assist/t1"], ["DELETE", "/api/assist/t1"], ["POST", "/api/assist/projects"]] },brands: { lists: ["/api/brands", "/api/products"], records: ["/api/brands/b1"], changes: [["POST", "/api/brands"], ["DELETE", "/api/brands/b1"], ["POST", "/api/products"]] },};@@ -311,6 +318,19 @@ describe("accounts never see or change the owner's library", () => {expect(access.isPriceCheck("POST", "/api/canvases/c1/run", "?preview=1")).toBe(false);expect(access.isPriceCheck("POST", "/api/shorts/sessions/s1/segments/estimate", "")).toBe(false);expect(access.isPriceCheck("GET", "/api/shorts/estimate", "")).toBe(false);+ // AI Influencer, Photodump, Fashion Factory and Character Sheet price on load: a visitor's page never opens a card for it.+ for (const p of ["/api/influencer", "/api/photodump", "/api/photodump/fashion", "/api/photodump/character"]) {+ expect(access.isPriceCheck("POST", p, "?preview=1"), p).toBe(true);+ expect(access.isPriceCheck("POST", p, ""), p).toBe(false);+ }+ });++ it("lets a guest's and an account's price check on AI Influencer through", () => {+ process.env.FUOBE_PUBLIC_SIGNUP = "1";+ const cookie = auth.createSession(auth.createAccount("[email protected]", "long enough").id).value;+ expect(passed(proxy(req("/api/influencer?preview=1", { method: "POST" })))).toBe(true);+ expect(passed(proxy(req("/api/influencer?preview=1", { method: "POST", cookie })))).toBe(true);+ expect(proxy(req("/api/influencer", { method: "POST" })).status).toBe(401);});});diff --git a/tests/security-lows.test.ts b/tests/security-lows.test.tsindex a88f7ff8..3489a019 100644--- a/tests/security-lows.test.ts+++ b/tests/security-lows.test.ts@@ -190,16 +190,26 @@ describe("L-2: an unknown record or link answers 404 behind an HTTPS reverse proconst { NextRequest } = await import("next/server");process.env.FUOBE_PUBLIC_SIGNUP = "1";const at = (url: string) => proxy(new NextRequest(url, { headers: { host: "fuobe.example", "x-forwarded-proto": "https" } }));- for (const p of ["/apps/does-not-exist", "/canvas/nope-nope-nope"]) {+ for (const [p, title, back] of [+ ["/apps/does-not-exist", "This app isn’t here", "/apps"],+ ["/canvas/nope-nope-nope", "This canvas isn’t here", "/canvas"],+ ["/upscale/nope", "Nothing here", "/upscale"],+ ]) {const r = at(`https://fuobe.example${p}`);expect(r.status, p).toBe(404);expect(r.headers.get("x-middleware-rewrite"), p).toBeNull();expect(r.headers.get("content-type")).toMatch(/text\/html/);- expect(await r.text()).toMatch(/Nothing here/);+ const html = await r.text();+ // Branded: the site's mark and fonts, the visitor's theme, a way back to the section; nothing about a library.+ expect(html, p).toContain(`<h1>${title}</h1>`);+ expect(html, p).toContain(`href="${back}"`);+ expect(html, p).toMatch(/Instrument Serif/);+ expect(html, p).toMatch(/localStorage\.getItem\("theme"\)/);+ expect(html, p).not.toMatch(/library/);}// An unknown app points at the apps, then Home; a guest isn't told about a library they don't have.const app = await at("https://fuobe.example/apps/does-not-exist").text();- expect(app).toMatch(/<a href="\/apps" class="alt">Browse apps<\/a><a href="\/">Back to Home<\/a>/);+ expect(app).toMatch(/<a class="back" href="\/apps">Browse apps<\/a><a class="go" href="\/">Home<\/a>/);expect(app).not.toMatch(/library/);expect(await at("https://fuobe.example/canvas/nope-nope-nope").text()).not.toMatch(/Browse apps/);const share = at(`https://fuobe.example/s/${"A".repeat(44)}`);@@ -207,6 +217,18 @@ describe("L-2: an unknown record or link answers 404 behind an HTTPS reverse proexpect(share.headers.get("x-middleware-rewrite")).toBeNull();expect(share.headers.get("x-robots-tag")).toMatch(/noindex/);expect(await share.text()).toMatch(/This link isn.t available/);+ // A link that can't be a share (a wrong length) is the same 404, not a page with a 200.+ for (const p of ["/s/badtoken", `/s/${"A".repeat(43)}`, "/s/gone"]) {+ const r = at(`https://fuobe.example${p}`);+ expect(r.status, p).toBe(404);+ expect(r.headers.get("x-robots-tag"), p).toMatch(/noindex/);+ expect(await r.text(), p).toMatch(/Make your own with Fuobe/);+ }+ // Old ?mode= links open the mode's own page (any case), without the mode in the query.+ const mode = at("https://fuobe.example/audio?mode=Music&x=1");+ expect(mode.status).toBe(307);+ expect(new URL(mode.headers.get("location")!, "https://fuobe.example").pathname).toBe("/audio/music");+ expect(new URL(mode.headers.get("location")!, "https://fuobe.example").search).toBe("?x=1");// A plain-HTTP install keeps the rewrite to the app's own 404 pages.expect(proxy(new NextRequest("http://localhost:3000/apps/does-not-exist")).headers.get("x-middleware-rewrite")).toMatch(/_fuobe-not-found$/);});diff --git a/tests/share-links.test.ts b/tests/share-links.test.tsindex 99743a55..8873d1a7 100644--- a/tests/share-links.test.ts+++ b/tests/share-links.test.ts@@ -503,11 +503,13 @@ describe("the sign-in proxy", () => {expect(proxy(req(`http://localhost:3000/api/files/${rel}`)).status).toBe(401);expect(proxy(req("http://localhost:3000/api/shares")).status).toBe(401);expect(proxy(req(`http://localhost:3000/api/shares/${S.share.id}`, { method: "POST", headers: { origin: "http://localhost:3000" } })).status).toBe(401);- for (const p of [`/s/${S.token}/other`, `/s/${S.token}/f/../../library`, "/s/gone", "/library", `/s/${S.token}x`]) {+ for (const p of ["/library"]) {const r = proxy(req(`http://localhost:3000${p}`));expect(r.status, p).toBe(307);expect(r.headers.get("location"), p).toMatch(/\/login/);}+ // Any other /s/ link is no share: the "link unavailable" 404, which shows nothing either.+ for (const p of [`/s/${S.token}/other`, `/s/${S.token}/f/../../library`, "/s/gone", `/s/${S.token}x`]) expect(gone(proxy(req(`http://localhost:3000${p}`))), p).toBe(true);// A share path written to (a server action, a form post) is not opened.expect(passed(proxy(req(`http://localhost:3000/s/${S.token}`, { method: "POST", headers: { origin: "http://localhost:3000" } })))).toBe(false);diff --git a/tests/sign-in-hardening.test.ts b/tests/sign-in-hardening.test.tsindex 2dbf6b74..62956104 100644--- a/tests/sign-in-hardening.test.ts+++ b/tests/sign-in-hardening.test.ts@@ -212,3 +212,30 @@ describe("M-4: one visitor's wrong guesses don't lock everyone out", () => {expect((await signup.POST(post("/api/auth/signup", { email: "[email protected]", password: "newcomer password" }))).status).toBe(201);});});++describe("Sign out ends the session on the server", () => {+ it("refuses a copy of a signed-out cookie, the account's and the owner's, and keeps other sessions", async () => {+ const logout = await import("@/app/api/auth/logout/route");+ const account = auth.createAccount("[email protected]", "leaving password");+ const copy = auth.createSession(account.id).value;+ // Another browser's sign-in, a moment later (a cookie is its expiry, its account and their signature).+ await new Promise((r) => setTimeout(r, 5));+ const other = auth.createSession(account.id).value;+ expect(other).not.toBe(copy);+ const owner = auth.createSession().value;+ expect(auth.sessionViewer(copy)?.kind).toBe("account");+ for (const cookie of [copy, owner]) {+ jar.get.mockReturnValueOnce({ value: cookie });+ expect((await logout.POST()).status).toBe(200);+ expect(auth.sessionViewer(cookie)).toBeNull();+ }+ expect(jar.delete).toHaveBeenCalledWith(auth.SESSION_COOKIE);+ // Another browser's session of the same account isn't signed out.+ expect(auth.sessionViewer(other)?.kind).toBe("account");+ // Signing out again (or with no cookie) changes nothing.+ jar.get.mockReturnValueOnce({ value: copy });+ expect((await logout.POST()).status).toBe(200);+ jar.get.mockReturnValueOnce(undefined);+ expect((await logout.POST()).status).toBe(200);+ });+});