The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Update process-link.ts
Steven Teyf3a728c8d4f0
diff --git a/apps/web/lib/api/links/process-link.ts b/apps/web/lib/api/links/process-link.tsindex 0cd0700774..aad61d8dc0 100644--- a/apps/web/lib/api/links/process-link.ts+++ b/apps/web/lib/api/links/process-link.ts@@ -1,4 +1,8 @@-import { isBlacklistedDomain, updateConfig } from "@/lib/edge-config";+import {+ getFeatureFlags,+ isBlacklistedDomain,+ updateConfig,+} from "@/lib/edge-config";import { getPangeaDomainIntel } from "@/lib/pangea";import { checkIfUserExists, getRandomKey } from "@/lib/planetscale";import { prisma } from "@/lib/prisma";@@ -207,6 +211,20 @@ export async function processLink<T extends Record<string, any>>({};}+ if (domain === "cal.link") {+ const flags = await getFeatureFlags({+ workspaceId: workspace?.id,+ });+ if (!flags?.callink) {+ return {+ link: payload,+ error:+ "You can only use the cal.link domain if you have beta access to it. Contact [email protected] to get access.",+ code: "forbidden",+ };+ }+ }+if (key?.includes("/")) {// check if the user has access to the parent linkconst parentKey = key.split("/")[0];