The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
convert all relevant instances of "dub.sh" → DUB_DOMAINS
Steven Tey57fecd11cecd
diff --git a/apps/docs/api-reference/introduction.mdx b/apps/docs/api-reference/introduction.mdxindex 44485e6e8c..5470f9e234 100644--- a/apps/docs/api-reference/introduction.mdx+++ b/apps/docs/api-reference/introduction.mdx@@ -48,4 +48,4 @@ The API returns standard HTTP response codes to indicate the success or failure- Dub's API is currently in beta and is subject to change. However, we will do our best to keep breaking changes to a minimum.- The API does not support `PUT` requests at this time. One workaround would be to`DELETE` the resource and `POST` a new one.-- The API does not support `dub.sh` shortlinks at this time.+- The API does not support generic shortlinks (`dub.sh`, `chatg.pt`) at this time.diff --git a/apps/web/app/api/links/[linkId]/archive/route.ts b/apps/web/app/api/links/[linkId]/archive/route.tsindex c58d433f10..3ce928107f 100644--- a/apps/web/app/api/links/[linkId]/archive/route.ts+++ b/apps/web/app/api/links/[linkId]/archive/route.ts@@ -4,16 +4,12 @@ import { NextResponse } from "next/server";// POST /api/links/[linkId]/archive – archive a linkexport const POST = withAuth(async ({ headers, link }) => {- const response = await archiveLink(link!.domain || "dub.sh", link!.key, true);+ const response = await archiveLink(link!.domain, link!.key, true);return NextResponse.json(response, { headers });});// DELETE /api/links/[linkId]/archive – unarchive a linkexport const DELETE = withAuth(async ({ headers, link }) => {- const response = await archiveLink(- link!.domain || "dub.sh",- link!.key,- false,- );+ const response = await archiveLink(link!.domain, link!.key, false);return NextResponse.json(response, { headers });});diff --git a/apps/web/app/api/links/[linkId]/route.ts b/apps/web/app/api/links/[linkId]/route.tsindex b587ae4391..4c62596dab 100644--- a/apps/web/app/api/links/[linkId]/route.ts+++ b/apps/web/app/api/links/[linkId]/route.ts@@ -3,6 +3,14 @@ import { deleteLink, editLink, processLink } from "@/lib/api/links";import { NextResponse } from "next/server";import { GOOGLE_FAVICON_URL, getApexDomain, log } from "@dub/utils";+// GET /api/links/[linkId] – get a link+export const GET = withAuth(async ({ headers, link }) => {+ // link is guaranteed to exist because if not we will return 404+ return NextResponse.json(link!, {+ headers,+ });+});+// PUT /api/links/[linkId] – update a linkexport const PUT = withAuth(async ({ req, headers, project, link, session }) => {@@ -67,9 +75,9 @@ export const PUT = withAuth(if (!project && invalidFavicon) {await log({- message: `*${session.user.email}* edited a link (dub.sh/${- processedLink.key- }) to the ${processedLink.url} ${+ message: `*${session.user.email}* edited a link (${+ processedLink.domain+ }/${processedLink.key}) to the ${processedLink.url} ${invalidFavicon ? " but it has an invalid favicon :thinking_face:" : ""}`,type: "links",diff --git a/apps/web/app/api/links/exists/route.ts b/apps/web/app/api/links/exists/route.tsindex be1c94bf07..5175c763f3 100644--- a/apps/web/app/api/links/exists/route.ts+++ b/apps/web/app/api/links/exists/route.ts@@ -5,7 +5,10 @@ import { NextResponse } from "next/server";// GET /api//links/exists – check if a link existsexport const GET = withAuth(async ({ headers, searchParams }) => {const { domain, key } = searchParams;- const response = await checkIfKeyExists(domain || "dub.sh", key);+ if (!domain || !key) {+ return new Response("Missing domain or key", { status: 400 });+ }+ const response = await checkIfKeyExists(domain, key);return NextResponse.json(response, {headers,});diff --git a/apps/web/app/api/links/info/route.ts b/apps/web/app/api/links/info/route.tsindex 8d94b8c509..06c28e814f 100644--- a/apps/web/app/api/links/info/route.ts+++ b/apps/web/app/api/links/info/route.ts@@ -5,10 +5,13 @@ import { NextResponse } from "next/server";// GET /api/links/info – get the info for a linkexport const GET = withAuth(async ({ headers, searchParams }) => {const { domain, key } = searchParams;+ if (!domain || !key) {+ return new Response("Missing domain or key", { status: 400 });+ }const response = await prisma.link.findUnique({where: {domain_key: {- domain: domain || "dub.sh",+ domain,key,},},diff --git a/apps/web/app/api/links/random/route.ts b/apps/web/app/api/links/random/route.tsindex be9ffb941c..5486d17691 100644--- a/apps/web/app/api/links/random/route.ts+++ b/apps/web/app/api/links/random/route.ts@@ -5,7 +5,10 @@ import { NextResponse } from "next/server";// GET /api/links/random – get a random available link keyexport const GET = withAuth(async ({ headers, searchParams }) => {const { domain } = searchParams;- const response = await getRandomKey(domain || "dub.sh");+ if (!domain) {+ return new Response("Missing domain", { status: 400 });+ }+ const response = await getRandomKey(domain);return NextResponse.json(response, {headers,});diff --git a/apps/web/app/api/links/route.ts b/apps/web/app/api/links/route.tsindex 296dbb5251..bec5a14f6c 100644--- a/apps/web/app/api/links/route.ts+++ b/apps/web/app/api/links/route.ts@@ -78,7 +78,7 @@ export const POST = withAuth(if (!project && invalidFavicon) {await log({- message: `*${session.user.email}* created a new link (dub.sh/${+ message: `*${session.user.email}* created a new link (${link.domain}/${link.key}) for ${link.url} ${invalidFavicon ? " but it has an invalid favicon :thinking_face:" : ""diff --git a/apps/web/app/api/stats/[endpoint]/route.ts b/apps/web/app/api/stats/[endpoint]/route.tsindex 2f14a87af7..d3c914f735 100644--- a/apps/web/app/api/stats/[endpoint]/route.ts+++ b/apps/web/app/api/stats/[endpoint]/route.ts@@ -8,9 +8,19 @@ export const GET = withAuth(const { endpoint } = params;const { domain, key, interval } = searchParams;+ const constructedDomain =+ domain || project?.domains?.map((d) => d.slug).join(",");++ if (!constructedDomain) {+ return new Response("Missing link domain.", { status: 400 });+ }++ if (!project && !key) {+ return new Response("Missing link key.", { status: 400 });+ }+const response = await getStats({- domain:- domain || project?.domains?.map((d) => d.slug).join(",") || "dub.sh",+ domain: constructedDomain,key,endpoint,interval,diff --git a/apps/web/app/api/stats/route.ts b/apps/web/app/api/stats/route.tsindex e7d8019005..24c8690e86 100644--- a/apps/web/app/api/stats/route.ts+++ b/apps/web/app/api/stats/route.ts@@ -5,10 +5,13 @@ import { NextResponse } from "next/server";// GET /api/stats – get the publicStats setting for a linkexport const GET = withAuth(async ({ searchParams }) => {const { domain, key } = searchParams;+ if (!domain || !key) {+ return new Response("Missing domain or key", { status: 400 });+ }const response = await prisma.link.findUnique({where: {domain_key: {- domain: domain || "dub.sh",+ domain,key,},},@@ -22,11 +25,14 @@ export const GET = withAuth(async ({ searchParams }) => {// PUT /api/stats – update the publicStats setting for a linkexport const PUT = withAuth(async ({ req, searchParams }) => {const { domain, key } = searchParams;+ if (!domain || !key) {+ return new Response("Missing domain or key", { status: 400 });+ }const { publicStats } = await req.json();const response = await prisma.link.update({where: {domain_key: {- domain: domain || "dub.sh",+ domain,key,},},diff --git a/apps/web/app/app.dub.co/(dashboard)/analytics/client.tsx b/apps/web/app/app.dub.co/(dashboard)/analytics/client.tsxindex d8d08a971c..3478e57d06 100644--- a/apps/web/app/app.dub.co/(dashboard)/analytics/client.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/analytics/client.tsx@@ -2,7 +2,7 @@import LayoutLoader from "@/ui/layout/layout-loader";import LinkNotFound from "@/ui/links/link-not-found";-import { DUB_DOMAINS, fetcher } from "@dub/utils";+import { DUB_DOMAINS, fetcher, isDubDomain } from "@dub/utils";import { useSession } from "next-auth/react";import { useParams, useSearchParams } from "next/navigation";import { ReactNode } from "react";@@ -13,7 +13,7 @@ export default function AnalyticsClient({ children }: { children: ReactNode }) {const domain = searchParams?.get("domain");const key = searchParams?.get("key");- if (!domain || !DUB_DOMAINS.find((d) => d.slug === domain) || !key) {+ if (!domain || !isDubDomain(domain) || !key) {return <LinkNotFound />;}diff --git a/apps/web/app/protected/[domain]/[key]/page.tsx b/apps/web/app/protected/[domain]/[key]/page.tsxindex 3096059985..39ca061b8e 100644--- a/apps/web/app/protected/[domain]/[key]/page.tsx+++ b/apps/web/app/protected/[domain]/[key]/page.tsx@@ -1,5 +1,5 @@import { Background, Logo } from "@dub/ui";-import { constructMetadata } from "@dub/utils";+import { constructMetadata, isDubDomain } from "@dub/utils";import prisma from "@/lib/prisma";import PasswordForm from "./form";import { notFound, redirect } from "next/navigation";@@ -42,7 +42,7 @@ export async function generateMetadata({title,description,image,- ...(domain !== "dub.sh" &&+ ...(!isDubDomain(domain) &&link.project?.plan !== "free" &&link.project?.logo && {icons: link.project.logo,@@ -113,7 +113,7 @@ export default async function PasswordProtectedLinkPage({<Background /><div className="w-full max-w-md overflow-hidden rounded-2xl border border-gray-100 shadow-xl"><div className="flex flex-col items-center justify-center space-y-3 border-b border-gray-200 bg-white px-4 py-6 pt-8 text-center sm:px-16">- {domain !== "dub.sh" &&+ {!isDubDomain(domain) &&link.project?.plan !== "free" &&link.project?.logo ? (<imgdiff --git a/apps/web/lib/api/links.ts b/apps/web/lib/api/links.tsindex a5a5b63063..0e9d697839 100644--- a/apps/web/lib/api/links.ts+++ b/apps/web/lib/api/links.ts@@ -2,6 +2,7 @@ import {isBlacklistedDomain,isBlacklistedKey,isReservedKey,+ isReservedUsername,} from "@/lib/edge-config";import prisma from "@/lib/prisma";import { redis } from "@/lib/upstash";@@ -11,6 +12,7 @@ import {DUB_PROJECT_ID,getDomainWithoutWWW,getParamsFromURL,+ isDubDomain,nanoid,truncate,validKeyRegex,@@ -171,11 +173,13 @@ export async function getRandomKey(domain: string): Promise<string> {}export async function checkIfKeyExists(domain: string, key: string) {- if (- domain === "dub.sh" &&- ((await isReservedKey(key)) || DEFAULT_REDIRECTS[key])- ) {- return true; // reserved keys for dub.sh+ // reserved keys for dub.sh+ if (domain === "dub.sh") {+ return (await isReservedKey(key)) || DEFAULT_REDIRECTS[key];++ // if it's a default Dub domain, check if the key is a reserved key+ } else if (isDubDomain(domain)) {+ return await isReservedUsername(key);}const link = await prisma.link.findUnique({where: {@@ -270,7 +274,7 @@ export async function processLink({status: 422,};}- } else if (DUB_DOMAINS.find((d) => d.slug === domain)) {+ } else if (isDubDomain(domain)) {// coerce type with ! cause we already checked if it existsconst { allowedHostnames } = DUB_DOMAINS.find((d) => d.slug === domain)!;const urlDomain = getDomainWithoutWWW(url) || "";diff --git a/apps/web/lib/auth/index.ts b/apps/web/lib/auth/index.tsindex d1336d645f..8f3f8abd35 100644--- a/apps/web/lib/auth/index.ts+++ b/apps/web/lib/auth/index.ts@@ -4,7 +4,13 @@ import { Link as LinkProps } from "@prisma/client";import { PlanProps, ProjectProps } from "../types";import { getServerSession } from "next-auth/next";import { createHash } from "crypto";-import { API_DOMAIN, DUB_DOMAINS, getSearchParams } from "@dub/utils";+import {+ API_DOMAIN,+ DUB_DOMAINS,+ DUB_PROJECT_ID,+ getSearchParams,+ isDubDomain,+} from "@dub/utils";import { ratelimit } from "../upstash";export interface Session {@@ -75,6 +81,7 @@ export const withAuth =const { linkId } = params || {};const slug = params?.slug || searchParams.projectSlug;const domain = params?.domain || searchParams.domain;+ const key = searchParams.key;let session: Session | undefined;let headers = {};@@ -93,7 +100,7 @@ export const withAuth =const url = new URL(req.url || "", API_DOMAIN);- if (url.pathname.includes("/stats/")) {+ if (url.pathname.includes("/stats")) {return new Response("API access is not available for stats yet.", {status: 403,});@@ -207,12 +214,22 @@ export const withAuth =},},}),- linkId &&- prisma.link.findUnique({- where: {- id: linkId,- },- }),+ linkId+ ? prisma.link.findUnique({+ where: {+ id: linkId,+ },+ })+ : domain && key+ ? prisma.link.findUnique({+ where: {+ domain_key: {+ domain,+ key,+ },+ },+ })+ : undefined,])) as [ProjectProps | undefined, LinkProps | undefined];// project checks@@ -235,13 +252,6 @@ export const withAuth =}}- if (link && link.projectId !== project.id) {- return new Response("Unauthorized: Invalid link.", {- status: 403,- headers,- });- }-// project exists but user is not part of itif (project.users.length === 0) {const pendingInvites = await prisma.projectInvite.findUnique({@@ -273,6 +283,7 @@ export const withAuth =}}+ // project role checks (enterprise only)if (requiredRole &&project.plan === "enterprise" &&@@ -289,6 +300,7 @@ export const withAuth =});}+ // usage overage checksif (needNotExceededUsage && project.usage > project.usageLimit) {return new Response("Unauthorized: Usage limits exceeded.", {status: 403,@@ -296,6 +308,7 @@ export const withAuth =});}+ // plan checksif (!requiredPlan.includes(project.plan)) {// return res.status(403).end("Unauthorized: Need higher plan.");return new Response("Unauthorized: Need higher plan.", {@@ -305,7 +318,7 @@ export const withAuth =}// for generic DUB_DOMAINS links / stats} else {- if (domain && !DUB_DOMAINS.find((d) => d.slug === domain)) {+ if (domain && !isDubDomain(domain)) {return new Response("Domain not found.", {status: 404,headers,@@ -313,8 +326,9 @@ export const withAuth =}}- // link checks- if (linkId) {+ // link checks (if linkId or domain and key are provided)+ if (linkId || (domain && key)) {+ // if link doesn't existif (!link) {return new Response("Link not found.", {status: 404,@@ -322,13 +336,31 @@ export const withAuth =});}- // if it's generic DUB_DOMAINS links, we need to make sure the user is the owner of the link- if (- DUB_DOMAINS.find((d) => d.slug === link.domain) &&- link.userId !== session.user.id- ) {- return new Response("Unauthorized: Invalid link.", {- status: 403,+ // if it's a custom project link, we need to make sure the link is owned by the project+ if (slug) {+ if (link.projectId !== project?.id) {+ return new Response("Link not found.", {+ status: 404,+ headers,+ });+ }++ // if it's generic DUB_DOMAINS links, we need to make sure the user is the owner of the link+ } else if (isDubDomain(link.domain)) {+ if (+ link.projectId !== DUB_PROJECT_ID ||+ link.userId !== session.user.id+ ) {+ return new Response("Link not found.", {+ status: 404,+ headers,+ });+ }++ // if the domain is not part of DUB_DOMAINS+ } else {+ return new Response("Link not found.", {+ status: 404,headers,});}diff --git a/apps/web/lib/auth/links.ts b/apps/web/lib/auth/links.tsdeleted file mode 100644index 562b70aff4..0000000000--- a/apps/web/lib/auth/links.ts+++ /dev/null@@ -1,249 +0,0 @@-import { authOptions } from "./options";-import { NextApiRequest, NextApiResponse } from "next";-import { API_DOMAIN } from "@dub/utils";-import { ratelimit } from "../upstash";-import { Session, hashToken } from ".";-import { Link as LinkProps } from "@prisma/client";-import { PlanProps, ProjectProps } from "../types";-import prisma from "@/lib/prisma";-import { getServerSession } from "next-auth/next";--interface WithLinksAuthNextApiHandler {- (- req: NextApiRequest,- res: NextApiResponse,- session: Session,- project?: ProjectProps,- domain?: string,- link?: LinkProps,- ): any;-}--/*- This is the auth handler for all link-related actions.-- In the future, we might want to combine this with other endpoints as well (e.g. /projects, /domains, etc.)-- Here's an outline of the flow:- 1. Check if user is logged in, if not, return 401 right away.- 2. Check if there's a `slug` in the query params:- a. If there is no slug, it means that it's the generic dub.sh links- i. Make sure the domain is `dub.sh` (prevent query injection)- ii. If link `key` is provided, make sure user is the owner of the link- b. If there is a slug, it means that it's a custom project- i. Make sure the project exists- ii. Make sure the user is part of the project- iii. Make sure the project is within its usage limits- iv. Make sure the action is allowed for the project's plan- v. Make sure the domain is part of the project (prevent query injection)- */--const withLinksAuth =- (- handler: WithLinksAuthNextApiHandler,- {- needNotExceededUsage, // if the action needs the user to not have exceeded their usage- excludeGet, // if the action doesn't need to be gated for GET requests- requiredPlan = ["free", "pro", "enterprise"], // if the action needs a specific plan- skipKeyCheck, // if the action doesn't need to check if the user is the owner of the link (/exists endpoint)- }: {- needNotExceededUsage?: boolean;- excludeGet?: boolean;- requiredPlan?: Array<PlanProps>;- skipKeyCheck?: boolean;- } = {},- ) =>- async (req: NextApiRequest, res: NextApiResponse) => {- const { slug, domain, key } = req.query as {- slug?: string; // project slug (query param)- domain?: string; // link domain (query param)- key?: string; // link key (path param)- };-- // if slug is misconfgured- if (slug && typeof slug !== "string") {- return res.status(400).end("Missing or misconfigured project slug.");- }-- let session: Session | undefined;-- const authorizationHeader = req.headers.authorization;- if (authorizationHeader) {- if (!authorizationHeader.includes("Bearer ")) {- return res- .status(400)- .end(- "Misconfigured authorization header. Did you forget to add 'Bearer '? Learn more: https://dub.sh/auth ",- );- }- const apiKey = authorizationHeader.replace("Bearer ", "");- // if there is no slug, it's the default dub.sh link- if (!slug) {- return res- .status(403)- .end("Unauthorized: API is not supported for dub.sh links yet.");- }-- const url = new URL(req.url || "", API_DOMAIN);-- if (url.pathname.includes("/stats/")) {- return res.status(403).end("Unauthorized: Invalid route.");- }-- const hashedKey = hashToken(apiKey, {- noSecret: true,- });-- const user = await prisma.user.findFirst({- where: {- tokens: {- some: {- hashedKey,- },- },- },- select: {- id: true,- name: true,- email: true,- },- });- if (!user) {- return res.status(401).end("Unauthorized: Invalid API key.");- }-- const { success, limit, reset, remaining } = await ratelimit(- 10,- "1 s",- ).limit(apiKey);- res.setHeader("X-RateLimit-Limit", limit.toString());- res.setHeader("X-RateLimit-Remaining", remaining.toString());- res.setHeader("X-RateLimit-Reset", reset.toString());- res.setHeader("Retry-After", reset.toString());-- if (!success) {- return res.status(429).end("Too many requests.");- }- await prisma.token.update({- where: {- hashedKey,- },- data: {- lastUsed: new Date(),- },- });- session = {- user: {- id: user.id,- name: user.name || "",- email: user.email || "",- },- };- } else {- session = (await getServerSession(req, res, authOptions)) as Session;- if (!session?.user.id) {- return res.status(401).end("Unauthorized: Login required.");- }- }-- let project: ProjectProps | undefined;- let link: LinkProps | undefined;-- // if there is no slug, it's the default dub.sh link- if (!slug) {- // prevent domain from being query injected by- // making sure that all instances of `domain` are `dub.sh`- if (- (domain && domain !== "dub.sh") ||- (req.body.domain && req.body.domain !== "dub.sh")- ) {- return res.status(403).end("Unauthorized: Invalid domain.");- }-- // if project slug is defined, that means it's a custom project on Dub- } else {- project = (await prisma.project.findUnique({- where: {- slug,- },- include: {- domains: {- select: {- slug: true,- },- },- users: {- where: {- userId: session.user.id,- },- select: {- role: true,- },- },- },- })) as ProjectProps;-- // if project doesn't exist- if (!project) {- return res.status(404).end("Project not found.");-- // if project exists but user is not part of it- } else if (project.users && project.users.length === 0) {- // TODO: check if user has pending invite- return res.status(401).end("Unauthorized: Not part of project.");-- // project exists and user is part of it- } else {- // if the action requires the project to be within usage limits,- // and the action is not a GET request with excludeGet set to true,- // check if the project is within usage limits- if (- needNotExceededUsage &&- !(req.method === "GET" && excludeGet) &&- project.usage > project.usageLimit- ) {- return res.status(403).end("Unauthorized: Usage limits exceeded.");- }-- if (requiredPlan && !requiredPlan.includes(project.plan)) {- return res.status(403).end("Unauthorized: Need higher plan.");- }-- // prevent unauthorized access to domains- if (- (domain && !project.domains?.find((d) => d.slug === domain)) ||- (req.body.domain &&- !project.domains?.find((d) => d.slug === req.body.domain))- ) {- return res.status(403).end("Unauthorized: Invalid domain.");- }- }- }-- if (key) {- if (typeof key !== "string") {- return res.status(400).end("Missing or misconfigured link key.");- }- link =- (await prisma.link.findUnique({- where: {- domain_key: {- domain: domain || "dub.sh",- key,- },- },- })) || undefined;-- if (!link) {- return res.status(404).end("Link not found.");-- // for dub.sh links, check if the user is the owner of the link- } else if (!slug && link.userId !== session.user.id && !skipKeyCheck) {- return res.status(404).end("Link not found.");- }- }-- return handler(req, res, session, project, domain, link);- };--export { withLinksAuth };diff --git a/apps/web/lib/edge-config.ts b/apps/web/lib/edge-config.tsindex 6b3a025034..9c9c836808 100644--- a/apps/web/lib/edge-config.ts+++ b/apps/web/lib/edge-config.ts@@ -73,11 +73,21 @@ export const isReservedKey = async (key: string) => {"privacy",].includes(key);}- let reservedKey;+ let reservedKeys;try {- reservedKey = await get("reserved");+ reservedKeys = await get("reserved");} catch (e) {- reservedKey = [];+ reservedKeys = [];}- return reservedKey.includes(key);+ return reservedKeys.includes(key);+};++export const isReservedUsername = async (key: string) => {+ let reservedUsernames;+ try {+ reservedUsernames = await get("reservedUsernames");+ } catch (e) {+ reservedUsernames = [];+ }+ return reservedUsernames.includes(key);};diff --git a/apps/web/ui/modals/add-edit-link-modal/index.tsx b/apps/web/ui/modals/add-edit-link-modal/index.tsxindex 693108c5f1..53914e005f 100644--- a/apps/web/ui/modals/add-edit-link-modal/index.tsx+++ b/apps/web/ui/modals/add-edit-link-modal/index.tsx@@ -110,8 +110,7 @@ function AddEditLinkModal({if (showAddEditLinkModal &&debouncedKey.length > 0 &&- debouncedKey !== props?.key &&- !keyError+ debouncedKey !== props?.key) {fetch(`/api/links/exists?domain=${domain}&key=${debouncedKey}${@@ -135,7 +134,7 @@ function AddEditLinkModal({const key = await res.json();setData((prev) => ({ ...prev, key }));setGeneratingKey(false);- }, []);+ }, [domain, slug]);useEffect(() => {// generate random key when someone pastes a URL and there's no key@@ -416,7 +415,8 @@ function AddEditLinkModal({requiredplaceholder={domains?.find(({ slug }) => slug === domain)- ?.placeholder || "https://dub.co/help/article/what-is-dub"+ ?.placeholder ||+ "https://dub.co/help/article/what-is-dub"}value={url}autoFocus={!key}diff --git a/packages/utils/src/index.ts b/packages/utils/src/index.tsindex 227fbe5319..09932a91e4 100644--- a/packages/utils/src/index.ts+++ b/packages/utils/src/index.ts@@ -5,6 +5,7 @@ import { customAlphabet } from "nanoid";import { Metadata } from "next";import { twMerge } from "tailwind-merge";import {+ DUB_DOMAINS,HOME_DOMAIN,SECOND_LEVEL_DOMAINS,SPECIAL_APEX_DOMAINS,@@ -340,6 +341,10 @@ export const getDomainWithoutWWW = (url: string) => {}};+export const isDubDomain = (domain: string) => {+ return DUB_DOMAINS.some((d) => d.slug === domain);+};+export const getSearchParams = (url: string) => {// Create a params objectlet params = {} as Record<string, string>;