Open source CapCut alternative.
TypeScript
feat(site): the super-user surface gets its own host [rebuild]
David Led0c434b8be19
diff --git a/site/prisma/Marketing.prisma b/site/prisma/Marketing.prismaindex c27d17fe..4a089714 100644--- a/site/prisma/Marketing.prisma+++ b/site/prisma/Marketing.prisma@@ -1,7 +1,7 @@// Founder outreach: one row per account per campaign, seeded by the nightly-// outreach-scan job (src/lib/jobs/outreach-scan.ts) and worked by hand from-// /app/su/outreach. The row is a marker, not a mailbox — it carries status,-// timestamps, and the scan's credit snapshot, never a subject or a message+// outreach-scan job (src/lib/jobs/outreach-scan.ts) and worked by hand from the+// super-user Outreach tab. The row is a marker, not a mailbox — it carries+// status, timestamps, and the scan's credit snapshot, never a subject or a message// body. The conversation itself lives in the operator's inbox.model UserOutreach {diff --git a/site/src/app/cut/app/su/SuHeader.tsx b/site/src/app/cut/app/su/SuHeader.tsxdeleted file mode 100644index 02a4cd0e..00000000--- a/site/src/app/cut/app/su/SuHeader.tsx+++ /dev/null@@ -1,59 +0,0 @@-"use client";--import { usePathname } from "next/navigation";-import type { ComponentType } from "react";--import { RunAnalyticsButton } from "@/app/cut/app/su/analytics/RunAnalyticsButton";-import { ScanOutreachButton } from "@/app/cut/app/su/outreach/ScanOutreachButton";--// Every surface owns a path, so the match is exact; the rail's order is the-// order here, and its first entry is what the section root opens.-const SECTIONS: {- suffix: string;- title: string;- description: string;- Action?: ComponentType;-}[] = [- {- suffix: "/su/analytics",- title: "Analytics",- description: "Product analytics.",- Action: RunAnalyticsButton,- },- {- suffix: "/su/users",- title: "Users",- description: "Account actions.",- },- {- suffix: "/su/credits",- title: "Credits",- description: "Grant credits to a user.",- },- {- suffix: "/su/outreach",- title: "Outreach",- description: "Free accounts spending credits, and where each conversation stands.",- Action: ScanOutreachButton,- },- {- suffix: "/su/jobs",- title: "Jobs",- description: "Background work started from these surfaces, newest first.",- },-];--export function SuHeader() {- const pathname = usePathname();- const section =- SECTIONS.find((s) => pathname.endsWith(s.suffix)) ?? SECTIONS[0];- return (- <div className="sticky top-0 z-20 mx-auto flex w-full max-w-6xl shrink-0 items-start justify-between gap-4 bg-background px-10 pt-9 pb-5">- <div>- <h1 className="text-lg font-semibold tracking-tight">{section.title}</h1>- <p className="mt-1 text-sm text-muted-foreground">{section.description}</p>- </div>- {section.Action ? <section.Action /> : null}- </div>- );-}diff --git a/site/src/app/cut/app/su/layout.tsx b/site/src/app/cut/app/su/layout.tsxdeleted file mode 100644index ba66918e..00000000--- a/site/src/app/cut/app/su/layout.tsx+++ /dev/null@@ -1,49 +0,0 @@-"use client";--import { useEffect, type ReactNode } from "react";-import { useRouter } from "next/navigation";--import { SuHeader } from "@/app/cut/app/su/SuHeader";-import { SuSidebar } from "@/app/cut/app/su/SuSidebar";-import { Skeleton } from "@/components/ui/skeleton";-import { useCutBase } from "@/cut/lib/nav";-import { useAccount } from "@/queries/credits";--// The super-user section: its own left rail with the admin surfaces as tabs,-// page details on the right. Everyone else is sent back to the app root — the-// client gate is for UX; the routes these pages call are withSuperUser and-// enforce the role server-side.-export default function SuLayout({ children }: { children: ReactNode }) {- const router = useRouter();- const base = useCutBase();- const account = useAccount();- const superUser = account.data?.superUser === true;-- useEffect(() => {- if (account.isPending || superUser) return;- router.replace(base);- }, [account.isPending, superUser, router, base]);-- if (!superUser) {- return (- <div className="mx-auto max-w-3xl px-8 py-10">- <Skeleton className="h-8 w-48" />- <Skeleton className="mt-6 h-40 w-full" />- </div>- );- }-- return (- <div className="flex h-full bg-background">- <SuSidebar />- <main className="flex min-w-0 flex-1 flex-col overflow-y-auto">- <SuHeader />- <div className="min-h-0 flex-1">- <div className="mx-auto h-full w-full max-w-6xl px-10">- <div className="h-full p-px">{children}</div>- </div>- </div>- </main>- </div>- );-}diff --git a/site/src/app/cut/app/su/nav.ts b/site/src/app/cut/app/su/nav.tsdeleted file mode 100644index 6b7bb189..00000000--- a/site/src/app/cut/app/su/nav.ts+++ /dev/null@@ -1,11 +0,0 @@-import { ChartColumn, CreditCard, ListChecks, Mail, UserRound } from "lucide-react";--// The super-user surfaces in rail order. The section root lands on the first-// one, so reordering this list moves where /app/su opens.-export const SU_NAV: { suffix: string; label: string; icon: typeof UserRound }[] = [- { suffix: "/analytics", label: "Analytics", icon: ChartColumn },- { suffix: "/users", label: "Users", icon: UserRound },- { suffix: "/credits", label: "Credits", icon: CreditCard },- { suffix: "/outreach", label: "Outreach", icon: Mail },- { suffix: "/jobs", label: "Jobs", icon: ListChecks },-];diff --git a/site/src/app/su/SuHeader.tsx b/site/src/app/su/SuHeader.tsxnew file mode 100644index 00000000..8689a127--- /dev/null+++ b/site/src/app/su/SuHeader.tsx@@ -0,0 +1,21 @@+"use client";++import { usePathname } from "next/navigation";++import { SU_NAV } from "@/app/su/nav";++// Every surface owns a path, so the match is exact; an address outside the+// rail falls back to the entry the section root opens.+export function SuHeader() {+ const pathname = usePathname();+ const section = SU_NAV.find((s) => s.href === pathname) ?? SU_NAV[0];+ return (+ <div className="sticky top-0 z-20 mx-auto flex w-full max-w-6xl shrink-0 items-start justify-between gap-4 bg-background px-10 pt-9 pb-5">+ <div>+ <h1 className="text-lg font-semibold tracking-tight">{section.title}</h1>+ <p className="mt-1 text-sm text-muted-foreground">{section.description}</p>+ </div>+ {section.Action ? <section.Action /> : null}+ </div>+ );+}diff --git a/site/src/app/su/SuShell.tsx b/site/src/app/su/SuShell.tsxnew file mode 100644index 00000000..a176c051--- /dev/null+++ b/site/src/app/su/SuShell.tsx@@ -0,0 +1,72 @@+"use client";++import { useEffect, type ReactNode } from "react";++import { NoSessionReplay } from "@/app/_components/NoSessionReplay";+import { SuHeader } from "@/app/su/SuHeader";+import { SuSidebar } from "@/app/su/SuSidebar";+import { Skeleton } from "@/components/ui/skeleton";+import { SU_APP_ORIGIN } from "@/cut/lib/hosts";+import { authClient } from "@/lib/auth-client";+import { useAccount } from "@/queries/credits";++// The section's own gate and two-pane shell. Sign-in lives on the app's host,+// so a signed-out visitor leaves for it with this page's full address as the+// post-auth callback, and anyone signed in without the role is sent to the app.+// Both gates are for UX; the routes these pages call are withSuperUser and+// enforce the role server-side.+export function SuShell({ children }: { children: ReactNode }) {+ const { data: session, isPending: sessionPending } = authClient.useSession();+ const account = useAccount();+ const signedOut = !sessionPending && !session;+ const superUser = account.data?.superUser === true;++ useEffect(() => {+ if (!signedOut) return;+ const here = encodeURIComponent(window.location.href);+ window.location.replace(`${SU_APP_ORIGIN}/sign-in?callbackURL=${here}`);+ }, [signedOut]);++ // Only a definitive answer sends someone away: a failed account request+ // leaves the page waiting rather than bouncing the operator out mid-session.+ useEffect(() => {+ if (signedOut || !account.isSuccess || superUser) return;+ window.location.replace(`${SU_APP_ORIGIN}/app`);+ }, [account.isSuccess, signedOut, superUser]);++ // The section paints the white product surface. `app-surface` is what+ // repoints the --background token for the whole document (see globals.css),+ // so it belongs on the outermost element here.+ //+ // translate="no" covers the subtree: a browser's built-in translator rewrites+ // text nodes under a running React tree, the rewrite lands mid-hydration as a+ // text mismatch, and a later commit that moves one of those nodes throws+ // NotFoundError out of insertBefore and takes the page down. These surfaces+ // are dense text tables, which is exactly what a translator reaches for.+ return (+ <div+ translate="no"+ className="app-surface flex h-screen bg-background font-system text-foreground antialiased"+ >+ <NoSessionReplay />+ {superUser ? (+ <>+ <SuSidebar />+ <main className="flex min-w-0 flex-1 flex-col overflow-y-auto">+ <SuHeader />+ <div className="min-h-0 flex-1">+ <div className="mx-auto h-full w-full max-w-6xl px-10">+ <div className="h-full p-px">{children}</div>+ </div>+ </div>+ </main>+ </>+ ) : (+ <div className="mx-auto w-full max-w-3xl px-8 py-10">+ <Skeleton className="h-8 w-48" />+ <Skeleton className="mt-6 h-40 w-full" />+ </div>+ )}+ </div>+ );+}diff --git a/site/src/app/cut/app/su/SuSidebar.tsx b/site/src/app/su/SuSidebar.tsxsimilarity index 84%rename from site/src/app/cut/app/su/SuSidebar.tsxrename to site/src/app/su/SuSidebar.tsxindex 0708311c..de479fb2 100644--- a/site/src/app/cut/app/su/SuSidebar.tsx+++ b/site/src/app/su/SuSidebar.tsx@@ -4,8 +4,8 @@ import Link from "next/link";import { usePathname } from "next/navigation";import { ArrowLeft } from "lucide-react";-import { SU_NAV } from "@/app/cut/app/su/nav";-import { useCutBase } from "@/cut/lib/nav";+import { SU_NAV } from "@/app/su/nav";+import { SU_APP_ORIGIN } from "@/cut/lib/hosts";import { cn } from "@/lib/utils";const itemClass =@@ -15,7 +15,6 @@ const itemClass =// admin surfaces as tabs and a way back to the app pinned to the bottom.export function SuSidebar() {const pathname = usePathname();- const base = useCutBase();return (<aside className="flex w-60 shrink-0 flex-col border-r border-border bg-card px-3 py-4">@@ -33,8 +32,7 @@ export function SuSidebar() {</div><nav className="flex flex-col gap-0.5">- {SU_NAV.map(({ suffix, label, icon: Icon }) => {- const href = `${base}/su${suffix}`;+ {SU_NAV.map(({ href, label, icon: Icon }) => {const active = pathname === href;return (<Link@@ -49,11 +47,12 @@ export function SuSidebar() {})}</nav>+ {/* The app is a different host, so this is a document load. */}<div className="mt-auto flex flex-col">- <Link href={base} className={itemClass}>+ <a href={`${SU_APP_ORIGIN}/app`} className={itemClass}><ArrowLeft className="size-4" />Back to app- </Link>+ </a></div></aside>);diff --git a/site/src/app/cut/app/su/analytics/Reorder.tsx b/site/src/app/su/analytics/Reorder.tsxsimilarity index 100%rename from site/src/app/cut/app/su/analytics/Reorder.tsxrename to site/src/app/su/analytics/Reorder.tsxdiff --git a/site/src/app/cut/app/su/analytics/RunAnalyticsButton.tsx b/site/src/app/su/analytics/RunAnalyticsButton.tsxsimilarity index 100%rename from site/src/app/cut/app/su/analytics/RunAnalyticsButton.tsxrename to site/src/app/su/analytics/RunAnalyticsButton.tsxdiff --git a/site/src/app/cut/app/su/analytics/page.tsx b/site/src/app/su/analytics/page.tsxsimilarity index 99%rename from site/src/app/cut/app/su/analytics/page.tsxrename to site/src/app/su/analytics/page.tsxindex 6e412e94..0d24b8a7 100644--- a/site/src/app/cut/app/su/analytics/page.tsx+++ b/site/src/app/su/analytics/page.tsx@@ -21,7 +21,7 @@ import type {import { REFERRAL_SOURCES } from "@/lib/onboarding/sequence";import { useLocalPref } from "@/cut/lib/uiState";import { cn } from "@/lib/utils";-import { DragBlock, useReorder } from "@/app/cut/app/su/analytics/Reorder";+import { DragBlock, useReorder } from "@/app/su/analytics/Reorder";import { useAnalyticsRollup } from "@/queries/analytics";import { ApiError } from "@/queries/apiClient";diff --git a/site/src/app/cut/app/su/credits/page.tsx b/site/src/app/su/credits/page.tsxsimilarity index 100%rename from site/src/app/cut/app/su/credits/page.tsxrename to site/src/app/su/credits/page.tsxdiff --git a/site/src/app/cut/app/su/jobs/page.tsx b/site/src/app/su/jobs/page.tsxsimilarity index 100%rename from site/src/app/cut/app/su/jobs/page.tsxrename to site/src/app/su/jobs/page.tsxdiff --git a/site/src/app/su/layout.tsx b/site/src/app/su/layout.tsxnew file mode 100644index 00000000..e8448d9d--- /dev/null+++ b/site/src/app/su/layout.tsx@@ -0,0 +1,17 @@+import type { Metadata } from "next";+import type { ReactNode } from "react";++import { SuShell } from "@/app/su/SuShell";++// The super-user section, served on its own host (src/proxy.ts maps+// su.donkeycut.com onto this tree). It sits outside the Cut app's layout so+// none of the product shell — the engine connection gate, the exports dock,+// the welcome sequence — mounts on an admin page.+export const metadata: Metadata = {+ robots: { follow: false, index: false },+ title: "Super user",+};++export default function SuLayout({ children }: { children: ReactNode }) {+ return <SuShell>{children}</SuShell>;+}diff --git a/site/src/app/su/nav.ts b/site/src/app/su/nav.tsnew file mode 100644index 00000000..d069571f--- /dev/null+++ b/site/src/app/su/nav.ts@@ -0,0 +1,59 @@+import { ChartColumn, CreditCard, ListChecks, Mail, UserRound } from "lucide-react";+import type { ComponentType } from "react";++import { RunAnalyticsButton } from "@/app/su/analytics/RunAnalyticsButton";+import { ScanOutreachButton } from "@/app/su/outreach/ScanOutreachButton";++// The super-user surfaces in rail order, addressed from the root of their own+// host. One entry carries everything a surface is drawn from — the rail's tab,+// the header's title and action — so adding a surface is one edit here and a+// page.tsx. The section root lands on the first entry, so reordering this list+// moves where the host opens.+export type SuSurface = {+ href: string;+ label: string;+ icon: typeof UserRound;+ title: string;+ description: string;+ Action?: ComponentType;+};++export const SU_NAV: SuSurface[] = [+ {+ href: "/analytics",+ label: "Analytics",+ icon: ChartColumn,+ title: "Analytics",+ description: "Product analytics.",+ Action: RunAnalyticsButton,+ },+ {+ href: "/users",+ label: "Users",+ icon: UserRound,+ title: "Users",+ description: "Account actions.",+ },+ {+ href: "/credits",+ label: "Credits",+ icon: CreditCard,+ title: "Credits",+ description: "Grant credits to a user.",+ },+ {+ href: "/outreach",+ label: "Outreach",+ icon: Mail,+ title: "Outreach",+ description: "Free accounts spending credits, and where each conversation stands.",+ Action: ScanOutreachButton,+ },+ {+ href: "/jobs",+ label: "Jobs",+ icon: ListChecks,+ title: "Jobs",+ description: "Background work started from these surfaces, newest first.",+ },+];diff --git a/site/src/app/cut/app/su/outreach/ScanOutreachButton.tsx b/site/src/app/su/outreach/ScanOutreachButton.tsxsimilarity index 100%rename from site/src/app/cut/app/su/outreach/ScanOutreachButton.tsxrename to site/src/app/su/outreach/ScanOutreachButton.tsxdiff --git a/site/src/app/cut/app/su/outreach/drafts.ts b/site/src/app/su/outreach/drafts.tssimilarity index 100%rename from site/src/app/cut/app/su/outreach/drafts.tsrename to site/src/app/su/outreach/drafts.tsdiff --git a/site/src/app/cut/app/su/outreach/page.tsx b/site/src/app/su/outreach/page.tsxsimilarity index 99%rename from site/src/app/cut/app/su/outreach/page.tsxrename to site/src/app/su/outreach/page.tsxindex 9c679420..a7d46773 100644--- a/site/src/app/cut/app/su/outreach/page.tsx+++ b/site/src/app/su/outreach/page.tsx@@ -6,7 +6,7 @@ import { useRef, useState } from "react";import {useLastOutreachStart,useOutreachDrafts,-} from "@/app/cut/app/su/outreach/drafts";+} from "@/app/su/outreach/drafts";import { Badge } from "@/components/ui/badge";import { Button } from "@/components/ui/button";import {diff --git a/site/src/app/cut/app/su/page.tsx b/site/src/app/su/page.tsxsimilarity index 65%rename from site/src/app/cut/app/su/page.tsxrename to site/src/app/su/page.tsxindex 340a0c81..d97ba919 100644--- a/site/src/app/cut/app/su/page.tsx+++ b/site/src/app/su/page.tsx@@ -1,9 +1,8 @@import { redirect } from "next/navigation";-import { CUT_APP_BASE } from "@/cut/lib/appBase";import { SU_NAV } from "./nav";// The section root has no surface of its own; it opens the rail's first one.export default function SuPage() {- redirect(`${CUT_APP_BASE}/su${SU_NAV[0].suffix}`);+ redirect(SU_NAV[0].href);}diff --git a/site/src/app/cut/app/su/users/page.tsx b/site/src/app/su/users/page.tsxsimilarity index 100%rename from site/src/app/cut/app/su/users/page.tsxrename to site/src/app/su/users/page.tsxdiff --git a/site/src/cut/lib/hosts.ts b/site/src/cut/lib/hosts.tsindex 7fa8ad33..c41f19bc 100644--- a/site/src/cut/lib/hosts.ts+++ b/site/src/cut/lib/hosts.ts@@ -3,6 +3,11 @@// at "/app/…" (rewritten to /cut/app/…). Retired domains are redirected to// donkeycut.com at the edge (Cloudflare) and never reach this app.//+// The set below is the product host and its aliases, and it is what the+// www-to-apex canonicalization keys off. Sibling subdomains — media, worker,+// reply, su — are deliberately outside it: each is its own surface with its+// own routing.+//// Local dev is deliberately absent from the set: the proxy serves localhost// the same mapping, keeping the session cookie same-origin on the one dev// origin.@@ -30,6 +35,24 @@ export const OUTREACH_REPLY_HOST = "reply.donkeycut.com";export const CUT_WORKER_HOST = "worker.donkeycut.com";export const CUT_WORKER_WAKE_URL = `https://${CUT_WORKER_HOST}/wake`;+// The super-user surface has its own host: src/proxy.ts maps it onto the+// routes under /su, so the section's addresses are bare ("/analytics"). It+// shares the apex's session — auth cookies carry Domain=donkeycut.com (see+// src/lib/auth.ts) — while sign-in itself stays on the apex.+//+// su.localhost is the dev twin, and browsers resolve it to the loopback+// address without a hosts-file entry. Dev gets the same host split and the+// same bare addresses as production, so a link that works in one works in the+// other; serving the section under a /su prefix locally would make every href+// and every active-tab match host-dependent.+export const SU_HOST = "su.donkeycut.com";+export const SU_ORIGIN = `https://${SU_HOST}`;+const SU_HOSTS = new Set([SU_HOST, "su.localhost"]);++// The registrable host the auth cookies are scoped to, so a session started on+// the apex reaches its subdomains.+export const AUTH_COOKIE_DOMAIN = "donkeycut.com";+// Where the worker's runner calls the hosted API back: production containers// (NODE_ENV=production in the image) talk to the canonical host, a dev worker// run by hand talks to the local dev server.@@ -44,6 +67,17 @@ export function isDonkeycutHost(host: string | null | undefined): boolean {return DONKEYCUT_HOSTS.has(hostname(host));}+export function isSuHost(host: string | null | undefined): boolean {+ return SU_HOSTS.has(hostname(host));+}++// The app origin as the super-user surface addresses it. The two always sit on+// different hosts, so the link back is always absolute. NODE_ENV inlines the+// same value on the server and in the client bundle, so an href built from it+// survives hydration.+export const SU_APP_ORIGIN =+ process.env.NODE_ENV === "production" ? DONKEYCUT_CANONICAL : "http://localhost:3000";+// Local dev serves Donkey Cut by default: the proxy gives localhost the same// "/…" → "/cut/…" mapping as donkeycut.com (see src/proxy.ts).export function isLocalHost(host: string | null | undefined): boolean {diff --git a/site/src/lib/jobs/outreach-scan.ts b/site/src/lib/jobs/outreach-scan.tsindex 3a4bab27..999d83e8 100644--- a/site/src/lib/jobs/outreach-scan.ts+++ b/site/src/lib/jobs/outreach-scan.ts@@ -16,7 +16,7 @@ const BATCH = 50;// Rolls credit usage into the outreach list. Runs nightly from// /api/marketing/outreach/scan and by hand from the Outreach tab's Scan now-// button. Everything the /su page shows is written here, so the page itself+// button. Everything the Outreach tab shows is written here, so the page itself// never touches the credit tables.export const outreachScanJob = defineJob(z.object({}).strict(), async () => {const startedAt = new Date();diff --git a/site/src/lib/marketing/campaigns.ts b/site/src/lib/marketing/campaigns.tsindex 00db9a74..df6c9316 100644--- a/site/src/lib/marketing/campaigns.ts+++ b/site/src/lib/marketing/campaigns.ts@@ -1,4 +1,4 @@-// The outreach campaigns the scan and the /su surface know about. Ids are+// The outreach campaigns the scan and the super-user surface know about. Ids are// code, not data: adding one here is what makes it scannable and listable./** Free accounts that have spent credits — the people worth a personal note. */diff --git a/site/src/proxy.ts b/site/src/proxy.tsindex 1346679a..a809a210 100644--- a/site/src/proxy.ts+++ b/site/src/proxy.ts@@ -1,14 +1,19 @@import { NextResponse, type NextRequest } from "next/server";import { allowedOrigin, corsHeaders, preflightHeaders } from "@/cut/server/cors";-import { DONKEYCUT_CANONICAL, isDonkeycutHost } from "@/cut/lib/hosts";+import { DONKEYCUT_CANONICAL, isDonkeycutHost, isSuHost } 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. Every-// host gets the same mapping — "/" → landing, "/app/…" → editor app (generic-// "/…" → "/cut/…" rewrite) — with donkeycut.com as the one production host.-// The auth pages (/sign-in, /sign-up), "/install", and the legal pages are-// real root-level routes and pass through the rewrite.+// site app: the marketing landing at /cut and the app under /cut/app. The+// product host gets that mapping — "/" → landing, "/app/…" → editor app+// (generic "/…" → "/cut/…" rewrite) — with donkeycut.com as the one production+// host. The auth pages (/sign-in, /sign-up), "/install", and the legal pages+// are real root-level routes and pass through the rewrite.+//+// su.donkeycut.com is the second surface this file routes: the super-user+// section under /su, served at bare addresses ("/analytics") on that host+// alone. It shares the deployment and its /api handlers, and it shares the+// session, because auth cookies are scoped to donkeycut.com (src/lib/auth.ts).// www. 308s to the apex; retired domains redirect to donkeycut.com at the// edge (Cloudflare) and never reach this app.//@@ -69,12 +74,28 @@ const underPath = (pathname: string, prefix: string) =>const passesThrough = (pathname: string) =>PASSTHROUGH.some((p) => underPath(pathname, p));+// The super-user host serves one section and nothing else: /su/… for pages,+// the shared /api handlers for their data. Nothing here belongs in a search+// index, so every page response carries the header that says so.+const SU_ROOT = "/su";++function suHost(req: NextRequest, pathname: string): NextResponse {+ if (underPath(pathname, "/api")) return NextResponse.next();+ const url = req.nextUrl.clone();+ url.pathname = `${SU_ROOT}${pathname === "/" ? "" : pathname}`;+ const res = NextResponse.rewrite(url);+ res.headers.set("X-Robots-Tag", "noindex, nofollow");+ return res;+}+export function proxy(req: NextRequest) {const { pathname } = req.nextUrl;if (isCutApi(pathname)) return cutApi(req);const host = req.headers.get("host");+ if (isSuHost(host)) return suHost(req, pathname);+// Aliases (www.) canonicalize to the apex.if (isDonkeycutHost(host) && host?.split(":")[0] !== "donkeycut.com") {const url = req.nextUrl.clone();