Skip to content

Open source CapCut alternative.

TypeScript

fix(site): drop the legacy cut.donkeyuse.com host [rebuild]

David Lef2ed37553869
diff --git a/site/src/app/cut/layout.tsx b/site/src/app/cut/layout.tsx
index 045d3732..30825d6e 100644
--- a/site/src/app/cut/layout.tsx
+++ b/site/src/app/cut/layout.tsx
@@ -15,7 +15,6 @@ export const metadata: Metadata = {
// while the app subtree under /cut/app paints its own white product surface.
//
// The app's routes live under /cut/app/*. Per host they are served as:
-// cut.donkeyuse.com → proxy rewrites "/…" → "/cut/app/…" (base "")
// donkeycut.com → proxy rewrites "/app/…" → "/cut/app/…" (base "/app")
// local dev → same mapping as donkeycut.com (base "/app")
// hosted apex → no rewrite, served at /cut/app directly (base "/cut/app")
diff --git a/site/src/cut/components/RequireSession.tsx b/site/src/cut/components/RequireSession.tsx
index f3b4400a..65219de3 100644
--- a/site/src/cut/components/RequireSession.tsx
+++ b/site/src/cut/components/RequireSession.tsx
@@ -5,10 +5,8 @@ import { useEffect, type ReactNode } from "react";
import { authHrefFor } from "@/app/_components/landing/useAppEntryHref";
import { setEngineUser } from "@/cut/lib/api";
import { syncAccountFlags } from "@/cut/lib/flags";
-import { DONKEYCUT_CANONICAL } from "@/cut/lib/hosts";
import { useAppLoaded } from "@/lib/analytics";
import { authClient } from "@/lib/auth-client";
-import { useCutBase } from "@/cut/lib/nav";
// Session gate for the whole Cut app surface. The landing CTAs already route
// signed-out clicks through /sign-in (useAppEntryHref); this covers direct
@@ -21,14 +19,8 @@ import { useCutBase } from "@/cut/lib/nav";
// children until the id is bound makes that impossible; the session check is
// a fast same-origin cookie read, and the ConnectGate's own connect flow
// covers the moment visually.
-//
-// The legacy host (base "") has no /sign-in of its own — donkeycut.com owns
-// auth — so its URLs redirect to the canonical host, mapped onto the same app
-// under /app. Project state lives in the local engine, so it survives the host
-// move.
export function RequireSession({ children }: { children: ReactNode }) {
const { data: session, isPending } = authClient.useSession();
- const base = useCutBase();
const signedOut = !isPending && !session;
@@ -45,12 +37,8 @@ export function RequireSession({ children }: { children: ReactNode }) {
useEffect(() => {
if (!signedOut) return;
const here = window.location.pathname + window.location.search;
- window.location.replace(
- base === ""
- ? `${DONKEYCUT_CANONICAL}${authHrefFor("/sign-in", here === "/" ? "/app" : `/app${here}`)}`
- : authHrefFor("/sign-in", here),
- );
- }, [signedOut, base]);
+ window.location.replace(authHrefFor("/sign-in", here));
+ }, [signedOut]);
if (!session) return null;
setEngineUser(session.user.id);
diff --git a/site/src/cut/lib/api.ts b/site/src/cut/lib/api.ts
index 5bd1eb1c..c80a4ab7 100644
--- a/site/src/cut/lib/api.ts
+++ b/site/src/cut/lib/api.ts
@@ -1,6 +1,6 @@
// Cut's client reaches its engine two ways. Served locally (cut.localhost,
// localhost) the page and the engine share an origin, so paths stay relative.
-// Served from the hosted domain (cut.donkeyuse.com) the page is just static
+// Served from the hosted domain (donkeycut.com) the page is just static
// html/js — the Cut APIs are switched off on that host — so every API call
// targets the engine running on this Mac instead. Loopback is a trustworthy
// origin, so the https page may call it; the engine grants the hosted origin
diff --git a/site/src/cut/lib/generate.ts b/site/src/cut/lib/generate.ts
index c3ab68b0..d5db46bf 100644
--- a/site/src/cut/lib/generate.ts
+++ b/site/src/cut/lib/generate.ts
@@ -193,17 +193,12 @@ const promptName = (prompt: string) => {
return line.length > 60 ? `${line.slice(0, 57)}…` : line;
};
-/** The Donkey sign-in URL for the current host (cut.* → apex). Image, video,
- * and voiceover all run on the user's Donkey account, so every generation
- * surface links here when signed out. */
+/** The Donkey sign-in URL, same-host, returning to the Cut page the user
+ * started from. Image, video, and voiceover all run on the user's Donkey
+ * account, so every generation surface links here when signed out. */
export function signInUrl(): string {
if (typeof window === "undefined") return "/sign-in";
- const { protocol, host, href } = window.location;
- // Sign-in runs on the auth-owning host (Google's redirect_uri is pinned
- // there) and returns to the Cut page the user started from. donkeycut.com owns
- // auth directly; the legacy cut.* host strips to its apex.
- const apex = `${protocol}//${host.replace(/^cut\./, "")}`;
- return `${apex}/sign-in?callbackURL=${encodeURIComponent(href)}`;
+ return `/sign-in?callbackURL=${encodeURIComponent(window.location.href)}`;
}
/** Shown for any 402 (empty balance) across chat and generation tiles. The
diff --git a/site/src/cut/lib/hosts.ts b/site/src/cut/lib/hosts.ts
index c28f967a..6b771a0e 100644
--- a/site/src/cut/lib/hosts.ts
+++ b/site/src/cut/lib/hosts.ts
@@ -1,16 +1,12 @@
-// Cut is served from two production hosts, mapped by src/proxy.ts onto the
-// real routes under /cut:
+// Cut is served from one production host, mapped by src/proxy.ts onto the
+// real routes under /cut: donkeycut.com — marketing landing at "/", the app
+// at "/app/…" (rewritten to /cut/app/…). Old cut.donkeyuse.com links are
+// redirected to donkeycut.com at the edge (Cloudflare) and never reach this
+// app.
//
-// donkeycut.com the Cut product domain — marketing landing at "/",
-// the app at "/app/…" (rewritten to /cut/app/…).
-// cut.donkeyuse.com the legacy host — the app at its root ("/", "/p/[id]",
-// rewritten to /cut/app/…), unchanged for existing links.
-//
-// Local dev is deliberately absent from both sets: localhost gets its own
-// proxy branch that mirrors donkeycut.com (Cut at "/", Donkey Use under /use),
+// Local dev is deliberately absent from the set: localhost gets its own proxy
+// branch that mirrors donkeycut.com (Cut at "/", Donkey Use under /use),
// keeping the session cookie same-origin on the one dev origin.
-export const CUT_HOSTS = new Set(["cut.donkeyuse.com"]);
-
export const DONKEYCUT_HOSTS = new Set(["donkeycut.com", "www.donkeycut.com"]);
export const DONKEYCUT_CANONICAL = "https://donkeycut.com";
@@ -19,10 +15,6 @@ function hostname(host: string | null | undefined): string {
return host ? host.split(":")[0] : "";
}
-export function isCutHost(host: string | null | undefined): boolean {
- return CUT_HOSTS.has(hostname(host));
-}
-
export function isDonkeycutHost(host: string | null | undefined): boolean {
return DONKEYCUT_HOSTS.has(hostname(host));
}
@@ -38,7 +30,6 @@ export function isLocalHost(host: string | null | undefined): boolean {
// The link base every in-app Cut href is built on (see src/cut/lib/nav.tsx).
// The hosted apex (donkeyuse.com) serves the Cut tree unrewritten at /cut/app.
export function cutAppBase(host: string | null | undefined): string {
- if (isCutHost(host)) return "";
if (isDonkeycutHost(host) || isLocalHost(host)) return "/app";
return "/cut/app";
}
diff --git a/site/src/cut/lib/nav.tsx b/site/src/cut/lib/nav.tsx
index 45c7d44c..3f0b74d5 100644
--- a/site/src/cut/lib/nav.tsx
+++ b/site/src/cut/lib/nav.tsx
@@ -3,11 +3,10 @@
import { createContext, useContext, type ReactNode } from "react";
// The Cut app's routes live under /cut/app/*. A proxy rewrite (src/proxy.ts)
-// serves them at "/…" on cut.donkeyuse.com (base "") and at "/app/…" on
-// donkeycut.com (base "/app"). In local dev the app is served from the apex
-// under /cut/app so its session cookie is same-origin, and links carry the
-// full "/cut/app" base. The base is resolved on the server from the request
-// host (see the cut layout) and handed to the client here.
+// serves them at "/app/…" on donkeycut.com and in local dev (base "/app");
+// the hosted apex serves them unrewritten at /cut/app (base "/cut/app"). The
+// base is resolved on the server from the request host (see the cut layout)
+// and handed to the client here.
const CutBaseContext = createContext("");
export function CutBaseProvider({ base, children }: { base: string; children: ReactNode }) {
diff --git a/site/src/cut/server/cors.ts b/site/src/cut/server/cors.ts
index 58dd6908..a58f77a5 100644
--- a/site/src/cut/server/cors.ts
+++ b/site/src/cut/server/cors.ts
@@ -1,13 +1,10 @@
/**
* One CORS policy for Cut's engine, shared by the Next dev server (src/proxy.ts)
* and the packaged engine's http server (src/cut/engine/serve.ts). The hosted
- * Cut pages are the only browser origins allowed to reach the engine
+ * Cut page is the only browser origin allowed to reach the engine
* cross-origin; every other origin is refused before any handler runs.
*/
-export const CUT_CLIENT_ORIGINS = new Set([
- "https://donkeycut.com",
- "https://cut.donkeyuse.com",
-]);
+export const CUT_CLIENT_ORIGINS = new Set(["https://donkeycut.com"]);
/** The echo-back origin for an allowed caller, else null. */
export function allowedOrigin(origin: string): string | null {
diff --git a/site/src/cut/server/local-only.ts b/site/src/cut/server/local-only.ts
index a9202ec6..94164052 100644
--- a/site/src/cut/server/local-only.ts
+++ b/site/src/cut/server/local-only.ts
@@ -4,7 +4,7 @@
// the tools and files aren't there and because those routes are unauthenticated
// by design (fine on localhost, an exposure on a public host).
//
-// On a hosted deploy, cut.donkeyuse.com still serves Cut's client bundle, but
+// On a hosted deploy, donkeycut.com still serves Cut's client bundle, but
// every server API is switched off — so nothing reads local disk, spawns a
// process, or reaches any model, including our production models. Cut's AI only
// ever uses the user's local claude/codex logins; it has no path to hosted
diff --git a/site/src/proxy.ts b/site/src/proxy.ts
index cb0d9468..fd20820c 100644
--- a/site/src/proxy.ts
+++ b/site/src/proxy.ts
@@ -3,23 +3,23 @@ import { NextResponse, type NextRequest } from "next/server";
import { allowedOrigin, corsHeaders, preflightHeaders } from "@/cut/server/cors";
import {
DONKEYCUT_CANONICAL,
- isCutHost,
isDonkeycutHost,
isLocalHost,
} from "@/cut/lib/hosts";
// Cut (the video editor, publicly "Donkey Cut") lives under /cut in this single
// site app: the marketing landing at /cut and the app under /cut/app. The proxy
-// maps its two production hosts onto that tree while the apex host keeps
-// serving Donkey:
+// maps its production host onto that tree while the apex host keeps serving
+// Donkey:
//
// donkeycut.com "/" → landing, "/app/…" → editor app (generic
// "/…" → "/cut/…" rewrite). The auth pages (/sign-in,
// /sign-up, /mac-auth), "/install", and the legal pages
// pass through so the shared apex routes serve them
// same-host. www. 308s to the apex.
-// cut.donkeyuse.com legacy host, unchanged URLs: "/…" → "/cut/app/…" so
-// "/", "/library", "/p/[id]" keep working.
+//
+// Old cut.donkeyuse.com links are redirected to donkeycut.com at the edge
+// (Cloudflare) and never reach this app.
//
// Local dev (localhost) mirrors donkeycut.com — Cut is the default product, so
// "/" is the Cut landing and "/app/…" the editor — while Donkey Use stays
@@ -135,14 +135,7 @@ export function proxy(req: NextRequest) {
return NextResponse.rewrite(url);
}
- if (!isCutHost(host)) return NextResponse.next();
-
- if (underPath(pathname, "/cut") || underPath(pathname, "/api")) {
- return NextResponse.next();
- }
- const url = req.nextUrl.clone();
- url.pathname = `/cut/app${pathname === "/" ? "" : pathname}`;
- return NextResponse.rewrite(url);
+ return NextResponse.next();
}
export const config = {