Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

DUB_PROJECT_ID → DUB_WORKSPACE_ID

Steven Teya6a0d2646c20
diff --git a/apps/web/app/api/analytics/edge/[endpoint]/route.ts b/apps/web/app/api/analytics/edge/[endpoint]/route.ts
index bb8d151f37..0f5090ce9a 100644
--- a/apps/web/app/api/analytics/edge/[endpoint]/route.ts
+++ b/apps/web/app/api/analytics/edge/[endpoint]/route.ts
@@ -11,7 +11,7 @@ import {
analyticsEndpointSchema,
getAnalyticsEdgeQuerySchema,
} from "@/lib/zod/schemas/analytics";
-import { DUB_DEMO_LINKS, DUB_PROJECT_ID, getSearchParams } from "@dub/utils";
+import { DUB_DEMO_LINKS, DUB_WORKSPACE_ID, getSearchParams } from "@dub/utils";
import { NextResponse, type NextRequest } from "next/server";
export const runtime = "edge";
@@ -51,7 +51,7 @@ export const GET = async (
}
link = {
id: demoLink.id,
- projectId: DUB_PROJECT_ID,
+ projectId: DUB_WORKSPACE_ID,
};
} else {
link = await getDomainOrLink({ domain, key });
diff --git a/apps/web/app/api/domains/[domain]/route.ts b/apps/web/app/api/domains/[domain]/route.ts
index fcaf912170..3b6856b6ce 100644
--- a/apps/web/app/api/domains/[domain]/route.ts
+++ b/apps/web/app/api/domains/[domain]/route.ts
@@ -7,12 +7,12 @@ import {
} from "@/lib/api/domains";
import { withAuth } from "@/lib/auth";
import prisma from "@/lib/prisma";
-import { DUB_PROJECT_ID, isDubDomain } from "@dub/utils";
+import { DUB_WORKSPACE_ID, isDubDomain } from "@dub/utils";
import { NextResponse } from "next/server";
// GET /api/domains/[domain] – get a workspace's domain
export const GET = withAuth(async ({ domain, workspace }) => {
- if (isDubDomain(domain) && workspace.id !== DUB_PROJECT_ID) {
+ if (isDubDomain(domain) && workspace.id !== DUB_WORKSPACE_ID) {
return new Response("Domain does not belong to workspace.", {
status: 403,
});
@@ -52,7 +52,7 @@ export const PUT = withAuth(async ({ req, workspace, domain }) => {
archived,
} = await req.json();
- if (isDubDomain(domain) && workspace.id !== DUB_PROJECT_ID) {
+ if (isDubDomain(domain) && workspace.id !== DUB_WORKSPACE_ID) {
return new Response("Domain does not belong to workspace.", {
status: 403,
});
@@ -127,7 +127,7 @@ export const PUT = withAuth(async ({ req, workspace, domain }) => {
// DELETE /api/domains/[domain] - delete a workspace's domain
export const DELETE = withAuth(async ({ domain, workspace }) => {
- if (isDubDomain(domain) && workspace.id !== DUB_PROJECT_ID) {
+ if (isDubDomain(domain) && workspace.id !== DUB_WORKSPACE_ID) {
return new Response("Domain does not belong to workspace.", {
status: 403,
});
diff --git a/apps/web/lib/auth/index.ts b/apps/web/lib/auth/index.ts
index f0888f10d1..f643ed92a5 100644
--- a/apps/web/lib/auth/index.ts
+++ b/apps/web/lib/auth/index.ts
@@ -2,7 +2,7 @@ import { DubApiError, handleAndReturnErrorResponse } from "@/lib/api/errors";
import prisma from "@/lib/prisma";
import {
API_DOMAIN,
- DUB_PROJECT_ID,
+ DUB_WORKSPACE_ID,
getSearchParams,
isDubDomain,
} from "@dub/utils";
@@ -573,7 +573,7 @@ export const withAdmin =
where: {
userId_projectId: {
userId: session.user.id,
- projectId: DUB_PROJECT_ID,
+ projectId: DUB_WORKSPACE_ID,
},
},
});
diff --git a/apps/web/lib/middleware/admin.ts b/apps/web/lib/middleware/admin.ts
index 5deac76ba8..d8782465cf 100644
--- a/apps/web/lib/middleware/admin.ts
+++ b/apps/web/lib/middleware/admin.ts
@@ -1,5 +1,5 @@
import { parse } from "@/lib/middleware/utils";
-import { DUB_PROJECT_ID } from "@dub/utils";
+import { DUB_WORKSPACE_ID } from "@dub/utils";
import { getToken } from "next-auth/jwt";
import { NextRequest, NextResponse } from "next/server";
import { conn } from "../planetscale";
@@ -24,7 +24,7 @@ export default async function AdminMiddleware(req: NextRequest) {
])
.then((res) => res.rows[0] as { projectId: string } | undefined);
- if (response?.projectId === DUB_PROJECT_ID) {
+ if (response?.projectId === DUB_WORKSPACE_ID) {
isAdmin = true;
}
diff --git a/apps/web/lib/swr/use-domains.ts b/apps/web/lib/swr/use-domains.ts
index dfda191c2c..18ea46324b 100644
--- a/apps/web/lib/swr/use-domains.ts
+++ b/apps/web/lib/swr/use-domains.ts
@@ -1,5 +1,10 @@
import { DomainProps } from "@/lib/types";
-import { DUB_DOMAINS, DUB_PROJECT_ID, SHORT_DOMAIN, fetcher } from "@dub/utils";
+import {
+ DUB_DOMAINS,
+ DUB_WORKSPACE_ID,
+ SHORT_DOMAIN,
+ fetcher,
+} from "@dub/utils";
import useSWR from "swr";
import useDefaultDomains from "./use-default-domains";
import useWorkspace from "./use-workspace";
@@ -36,11 +41,11 @@ export default function useDomains({
const allDomains = [
...allProjectDomains,
- ...(id === DUB_PROJECT_ID ? [] : DUB_DOMAINS),
+ ...(id === DUB_WORKSPACE_ID ? [] : DUB_DOMAINS),
];
const allActiveDomains = [
...(activeProjectDomains || []),
- ...(id === DUB_PROJECT_ID ? [] : activeDefaultDomains),
+ ...(id === DUB_WORKSPACE_ID ? [] : activeDefaultDomains),
];
const primaryDomain =
diff --git a/packages/utils/src/constants/index.ts b/packages/utils/src/constants/index.ts
index 76a25f17e2..63ebb91282 100644
--- a/packages/utils/src/constants/index.ts
+++ b/packages/utils/src/constants/index.ts
@@ -59,7 +59,7 @@ export const ADMIN_HOSTNAMES = new Set([
export const DUB_LOGO = "https://assets.dub.co/logo.png";
export const DUB_THUMBNAIL = "https://assets.dub.co/thumbnail.png";
-export const DUB_PROJECT_ID = "cl7pj5kq4006835rbjlt2ofka";
+export const DUB_WORKSPACE_ID = "cl7pj5kq4006835rbjlt2ofka";
export const LEGAL_PROJECT_ID = "clrflia0j0000vs7sqfhz9c7q";
export const LEGAL_USER_ID = "clqei1lgc0000vsnzi01pbf47";
@@ -76,7 +76,7 @@ export const DUB_DOMAINS = [
placeholder: "https://dub.co/help/article/what-is-dub",
clicks: 0,
allowedHostnames: [],
- projectId: DUB_PROJECT_ID,
+ projectId: DUB_WORKSPACE_ID,
},
...(process.env.NEXT_PUBLIC_IS_DUB
? [
@@ -92,7 +92,7 @@ export const DUB_DOMAINS = [
placeholder: "https://chat.openai.com/g/g-UGjKKONEe-domainsgpt",
clicks: 0,
allowedHostnames: ["chat.openai.com"],
- projectId: DUB_PROJECT_ID,
+ projectId: DUB_WORKSPACE_ID,
},
{
id: "cloxw8y2u0003js08a7mqg1j8",
@@ -106,7 +106,7 @@ export const DUB_DOMAINS = [
placeholder: "https://open.spotify.com/album/1SCyi9a5pOasikidToUY5y",
clicks: 0,
allowedHostnames: ["open.spotify.com"],
- projectId: DUB_PROJECT_ID,
+ projectId: DUB_WORKSPACE_ID,
},
{
id: "cltgtd6s5000341itdszz20u2",
@@ -120,7 +120,7 @@ export const DUB_DOMAINS = [
placeholder: "https://github.com/dubinc/dub",
clicks: 0,
allowedHostnames: ["github.com", "gist.github.com"],
- projectId: DUB_PROJECT_ID,
+ projectId: DUB_WORKSPACE_ID,
},
{
id: "cloxw8qtk000bjt08n9b812vs",
@@ -139,7 +139,7 @@ export const DUB_DOMAINS = [
"amazon.ca",
"amazon.es",
],
- projectId: DUB_PROJECT_ID,
+ projectId: DUB_WORKSPACE_ID,
},
]
: []),