Skip to content

Open source CapCut alternative.

TypeScript

refactor(site): drop the per-host root from Cut landing and app links

David Lea6fa5d4ce21c
diff --git a/site/src/app/cut/_components/landing/CutFinalCTA.tsx b/site/src/app/cut/_components/landing/CutFinalCTA.tsx
index ec9e33f6..39b40a3f 100644
--- a/site/src/app/cut/_components/landing/CutFinalCTA.tsx
+++ b/site/src/app/cut/_components/landing/CutFinalCTA.tsx
@@ -3,7 +3,7 @@
import { PillButton } from "@/app/_components/landing/LandingPrimitives";
import { useAppEntryHref } from "@/app/_components/landing/useAppEntryHref";
-export function CutFinalCTA({ root }: { root: string }) {
+export function CutFinalCTA() {
const appHref = useAppEntryHref();
return (
@@ -21,7 +21,7 @@ export function CutFinalCTA({ root }: { root: string }) {
on your Mac.
</h2>
<div className="mt-8 flex justify-center">
- <PillButton href={appHref(`${root}/app`)} variant="primary" size="lg">
+ <PillButton href={appHref("/app")} variant="primary" size="lg">
Start Today
</PillButton>
</div>
diff --git a/site/src/app/cut/_components/landing/CutHero.tsx b/site/src/app/cut/_components/landing/CutHero.tsx
index a0b35e4d..7338904f 100644
--- a/site/src/app/cut/_components/landing/CutHero.tsx
+++ b/site/src/app/cut/_components/landing/CutHero.tsx
@@ -4,7 +4,7 @@ import { PillButton } from "@/app/_components/landing/LandingPrimitives";
import { useAppEntryHref } from "@/app/_components/landing/useAppEntryHref";
import { EditorMock } from "@/cut/components/editor-mock/EditorMock";
-export function CutHero({ root }: { root: string }) {
+export function CutHero() {
const appHref = useAppEntryHref();
return (
@@ -24,7 +24,7 @@ export function CutHero({ root }: { root: string }) {
subscriptions.
</p>
<div className="mt-12">
- <PillButton href={appHref(`${root}/app`)} variant="primary" size="md">
+ <PillButton href={appHref("/app")} variant="primary" size="md">
Start a new project
</PillButton>
</div>
diff --git a/site/src/app/cut/_components/landing/CutLanding.tsx b/site/src/app/cut/_components/landing/CutLanding.tsx
index 0f8f3627..0bd9b176 100644
--- a/site/src/app/cut/_components/landing/CutLanding.tsx
+++ b/site/src/app/cut/_components/landing/CutLanding.tsx
@@ -10,13 +10,11 @@ import { CutPricing } from "@/app/cut/_components/landing/CutPricing";
import { CutTopNav } from "@/app/cut/_components/landing/CutTopNav";
import { CutWorksWith } from "@/app/cut/_components/landing/CutWorksWith";
-// The donkeycut.com marketing page: the Donkey landing's cream visual system
-// with Cut-only content. `root` is "" on donkeycut.com and "/cut" in dev, so
-// links into the app resolve on either host. Every CTA into the app is gated on
-// session (useAppEntryHref): signed-out clicks route to sign-in first. The nav
-// mirrors this — a "Log in" link with a "Sign up" pill when signed out,
-// "Go to App" when signed in.
-export function CutLanding({ root }: { root: string }) {
+// The donkeycut.com marketing page, on the cream visual system. Every CTA into
+// the app is gated on session (useAppEntryHref): signed-out clicks route to
+// sign-in first. The nav mirrors this — a "Log in" link with a "Sign up" pill
+// when signed out, "Go to App" when signed in.
+export function CutLanding() {
return (
<main
style={{
@@ -27,13 +25,13 @@ export function CutLanding({ root }: { root: string }) {
WebkitFontSmoothing: "antialiased",
}}
>
- <CutTopNav root={root} />
- <CutHero root={root} />
+ <CutTopNav />
+ <CutHero />
<CutWorksWith />
- <CutPricing root={root} />
- <CutLocal root={root} />
+ <CutPricing />
+ <CutLocal />
<CutOpenSource />
- <CutFinalCTA root={root} />
+ <CutFinalCTA />
<CutFooter />
</main>
);
diff --git a/site/src/app/cut/_components/landing/CutLocal.tsx b/site/src/app/cut/_components/landing/CutLocal.tsx
index 356f7a72..eb190e76 100644
--- a/site/src/app/cut/_components/landing/CutLocal.tsx
+++ b/site/src/app/cut/_components/landing/CutLocal.tsx
@@ -8,7 +8,7 @@ import {
} from "@/app/_components/landing/LandingPrimitives";
import { cutInstallHref } from "@/cut/lib/install";
-export function CutLocal({ root }: { root: string }) {
+export function CutLocal() {
return (
<section
id="local"
@@ -24,7 +24,7 @@ export function CutLocal({ root }: { root: string }) {
transcribes audio on device.
</p>
<div className="mt-8">
- <PillButton href={cutInstallHref(root)} variant="primary" size="md">
+ <PillButton href={cutInstallHref()} variant="primary" size="md">
Download for Mac
</PillButton>
</div>
diff --git a/site/src/app/cut/_components/landing/CutPricing.tsx b/site/src/app/cut/_components/landing/CutPricing.tsx
index 16e6e850..d63d9675 100644
--- a/site/src/app/cut/_components/landing/CutPricing.tsx
+++ b/site/src/app/cut/_components/landing/CutPricing.tsx
@@ -6,13 +6,13 @@ import { useAppEntryHref } from "@/app/_components/landing/useAppEntryHref";
import { useMediaQuery } from "@/app/_components/landing/useMediaQuery";
import { cutPricingPlans } from "@/app/cut/_components/landing/cutPricingPlans";
-export function CutPricing({ root }: { root: string }) {
+export function CutPricing() {
const isDesktop = useMediaQuery("(min-width: 768px)");
const appHref = useAppEntryHref();
// Both plan CTAs enter the app, so gate them the same way as the hero: a
// signed-out click lands on sign-in first, then returns to the app target.
- const plans = cutPricingPlans(root).map((plan) => ({
+ const plans = cutPricingPlans().map((plan) => ({
...plan,
action: { ...plan.action, href: appHref(plan.action.href) },
}));
diff --git a/site/src/app/cut/_components/landing/CutTopNav.tsx b/site/src/app/cut/_components/landing/CutTopNav.tsx
index 44d1f91d..58065d9d 100644
--- a/site/src/app/cut/_components/landing/CutTopNav.tsx
+++ b/site/src/app/cut/_components/landing/CutTopNav.tsx
@@ -5,17 +5,16 @@ import { authHrefFor } from "@/app/_components/landing/useAppEntryHref";
// The donkeycut.com site nav: Donkey Cut wordmark with session-aware auth
// entries. Shared by the Cut landing and the pass-through pages (e.g.
-// /install) served on that host. `root` is "" on donkeycut.com and local dev,
-// "/cut" on the hosted apex.
-export function CutTopNav({ root }: { root: string }) {
+// /install).
+export function CutTopNav() {
return (
<TopNav
- homeHref={root || "/"}
+ homeHref="/"
wordmark="Donkey Cut"
- signedInPill={{ href: `${root}/app`, label: "Go to App" }}
+ signedInPill={{ href: "/app", label: "Go to App" }}
signedOutAuth={{
- logInHref: authHrefFor("/sign-in", `${root}/app`),
- signUpHref: authHrefFor("/sign-up", `${root}/app`),
+ logInHref: authHrefFor("/sign-in", "/app"),
+ signUpHref: authHrefFor("/sign-up", "/app"),
}}
/>
);
diff --git a/site/src/app/cut/_components/landing/cutPricingPlans.ts b/site/src/app/cut/_components/landing/cutPricingPlans.ts
index b21c6667..1990d02d 100644
--- a/site/src/app/cut/_components/landing/cutPricingPlans.ts
+++ b/site/src/app/cut/_components/landing/cutPricingPlans.ts
@@ -16,13 +16,12 @@ export const CUT_PRO = {
};
// Cut's two tiers: the editor itself is free and local; Pro adds monthly AI
-// generation credits. `root` prefixes in-app links ("" on donkeycut.com,
-// "/cut" in dev) so the cards work on either host.
-export function cutPricingPlans(root: string): PricingPlan[] {
+// generation credits.
+export function cutPricingPlans(): PricingPlan[] {
return [
{
action: {
- href: `${root}/app`,
+ href: "/app",
kind: "link",
label: "Start a new project",
},
@@ -41,7 +40,7 @@ export function cutPricingPlans(root: string): PricingPlan[] {
},
{
action: {
- href: `${root}/app/settings`,
+ href: "/app/settings",
kind: "link",
label: "Get Pro",
},
diff --git a/site/src/app/cut/page.tsx b/site/src/app/cut/page.tsx
index e09d7e65..a00be17f 100644
--- a/site/src/app/cut/page.tsx
+++ b/site/src/app/cut/page.tsx
@@ -1,12 +1,7 @@
import type { Metadata } from "next";
-import { headers } from "next/headers";
import { CutLanding } from "@/app/cut/_components/landing/CutLanding";
-import {
- DONKEYCUT_CANONICAL,
- isDonkeycutHost,
- isLocalHost,
-} from "@/cut/lib/hosts";
+import { DONKEYCUT_CANONICAL } from "@/cut/lib/hosts";
export const metadata: Metadata = {
title: "Donkey Cut — the AI video editor on your Mac",
@@ -31,11 +26,8 @@ export const metadata: Metadata = {
},
};
-// The Cut marketing landing: "/" on donkeycut.com and in local dev (both
-// rewrite "/…" → "/cut/…"), /cut on the hosted apex. `root` prefixes in-page
-// links to the app so they resolve on any host.
-export default async function CutLandingPage() {
- const host = (await headers()).get("host");
- const root = isDonkeycutHost(host) || isLocalHost(host) ? "" : "/cut";
- return <CutLanding root={root} />;
+// The Cut marketing landing, served at "/" on every host by the proxy's
+// "/…" → "/cut/…" rewrite.
+export default function CutLandingPage() {
+ return <CutLanding />;
}
diff --git a/site/src/app/install/page.tsx b/site/src/app/install/page.tsx
index 967bfca4..76c3bb6a 100644
--- a/site/src/app/install/page.tsx
+++ b/site/src/app/install/page.tsx
@@ -1,16 +1,10 @@
import type { Metadata } from "next";
-import { headers } from "next/headers";
-import { notFound } from "next/navigation";
import { BG, BLACK } from "@/app/_components/landing/theme";
import { CutFooter } from "@/app/cut/_components/landing/CutFooter";
import { CutTopNav } from "@/app/cut/_components/landing/CutTopNav";
import { InstallInstructions } from "@/app/install/_components/InstallInstructions";
-import {
- DONKEYCUT_CANONICAL,
- isDonkeycutHost,
- isLocalHost,
-} from "@/cut/lib/hosts";
+import { DONKEYCUT_CANONICAL } from "@/cut/lib/hosts";
export const metadata: Metadata = {
title: "Install Donkey",
@@ -18,12 +12,9 @@ export const metadata: Metadata = {
alternates: { canonical: `${DONKEYCUT_CANONICAL}/install` },
};
-// The install page lives on donkeycut.com (passed through by src/proxy.ts) and
-// wears the Cut site's header and footer; every other host 404s. Local dev
-// mirrors donkeycut.com.
-export default async function InstallPage() {
- const host = (await headers()).get("host");
- if (!isDonkeycutHost(host) && !isLocalHost(host)) notFound();
+// The install page is passed through by src/proxy.ts and wears the Cut site's
+// header and footer.
+export default function InstallPage() {
return (
<main
style={{
@@ -34,7 +25,7 @@ export default async function InstallPage() {
WebkitFontSmoothing: "antialiased",
}}
>
- <CutTopNav root="" />
+ <CutTopNav />
<InstallInstructions />
<CutFooter />
</main>
diff --git a/site/src/cut/components/NavUser.tsx b/site/src/cut/components/NavUser.tsx
index 4192f702..6bcac3a4 100644
--- a/site/src/cut/components/NavUser.tsx
+++ b/site/src/cut/components/NavUser.tsx
@@ -53,7 +53,6 @@ export function NavUser() {
// The name the user chose wins over the one the provider gave us.
const name = visibleName(profile, session.user.name);
const image = profile?.image ?? session.user.image;
- const root = base.replace(/\/app$/, "");
const signOut = () => {
// Sign out everywhere: revoke every session for this user (so the Mac app
@@ -65,7 +64,7 @@ export function NavUser() {
await authClient.revokeSessions();
} finally {
await authClient.signOut();
- router.push(root || "/");
+ router.push("/");
}
})();
};
@@ -105,7 +104,7 @@ export function NavUser() {
{/* The install page lives outside the editor, so it opens in its own
tab rather than navigating away from an open project. */}
<DropdownMenuItem
- onClick={() => window.open(cutInstallHref(root), "_blank", "noopener")}
+ onClick={() => window.open(cutInstallHref(), "_blank", "noopener")}
>
<MonitorDown /> Run locally on Mac
</DropdownMenuItem>
diff --git a/site/src/cut/lib/install.ts b/site/src/cut/lib/install.ts
index 59ae5b07..3a0ed4f9 100644
--- a/site/src/cut/lib/install.ts
+++ b/site/src/cut/lib/install.ts
@@ -1,9 +1,5 @@
-import { DONKEYCUT_CANONICAL } from "@/cut/lib/hosts";
-
-// Where "get the Mac app" points. The install page is served on donkeycut.com
-// and local dev only, so anywhere the Cut tree runs unrewritten — the hosted
-// apex, where in-app links carry a "/cut" root — the link leaves for the
-// canonical host.
-export function cutInstallHref(root: string): string {
- return root ? `${DONKEYCUT_CANONICAL}/install` : "/install";
+// Where "get the Mac app" points: the install page, passed through by the
+// proxy on every host.
+export function cutInstallHref(): string {
+ return "/install";
}