diff --git a/apps/web/app/api/metatags/route.ts b/apps/web/app/api/metatags/route.ts index 9bb1bdec15..683349fd63 100644 --- a/apps/web/app/api/metatags/route.ts +++ b/apps/web/app/api/metatags/route.ts @@ -6,6 +6,11 @@ import { getMetaTags } from "./utils"; export const runtime = "edge"; +const CORS_HEADERS = { + "Access-Control-Allow-Origin": "*", + "Access-Control-Allow-Methods": "GET, OPTIONS", +}; + export async function GET(req: NextRequest) { try { const { url } = getUrlQuerySchema.parse({ @@ -21,22 +26,17 @@ export async function GET(req: NextRequest) { poweredBy: "Dub.co - Link management for modern marketing teams", }, { - headers: { - "Access-Control-Allow-Origin": "*", - }, + headers: CORS_HEADERS, }, ); } catch (error) { - return handleAndReturnErrorResponse(error); + return handleAndReturnErrorResponse(error, CORS_HEADERS); } } export function OPTIONS() { return new Response(null, { status: 204, - headers: { - "Access-Control-Allow-Origin": "*", - "Access-Control-Allow-Methods": "GET, OPTIONS", - }, + headers: CORS_HEADERS, }); } diff --git a/apps/web/app/api/qr/route.tsx b/apps/web/app/api/qr/route.tsx index 52ba82b35f..153cfe5e98 100644 --- a/apps/web/app/api/qr/route.tsx +++ b/apps/web/app/api/qr/route.tsx @@ -9,6 +9,11 @@ import { NextRequest } from "next/server"; export const runtime = "edge"; +const CORS_HEADERS = { + "Access-Control-Allow-Origin": "*", + "Access-Control-Allow-Methods": "GET, OPTIONS", +}; + export async function GET(req: NextRequest) { try { const params = getSearchParams(req.url); @@ -62,9 +67,17 @@ export async function GET(req: NextRequest) { { width: size, height: size, + headers: CORS_HEADERS, }, ); } catch (error) { - return handleAndReturnErrorResponse(error); + return handleAndReturnErrorResponse(error, CORS_HEADERS); } } + +export function OPTIONS() { + return new Response(null, { + status: 204, + headers: CORS_HEADERS, + }); +} diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/domains/default-domains.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/domains/default-domains.tsx index d78da6b244..e56167abdf 100644 --- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/domains/default-domains.tsx +++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/domains/default-domains.tsx @@ -8,6 +8,7 @@ import { UpgradeRequiredToast } from "@/ui/shared/upgrade-required-toast"; import { Logo, Switch } from "@dub/ui"; import { Amazon, + CalendarDays, ChatGPT, Figma, GitHubEnhanced, @@ -28,6 +29,8 @@ function DubDomainsIcon(domain: string) { return GitHubEnhanced; case "spti.fi": return Spotify; + case "cal.link": + return CalendarDays; case "amzn.id": return Amazon; case "ggl.link": diff --git a/apps/web/lib/api/links/process-link.ts b/apps/web/lib/api/links/process-link.ts index 2a3a52ad63..0cd0700774 100644 --- a/apps/web/lib/api/links/process-link.ts +++ b/apps/web/lib/api/links/process-link.ts @@ -1,8 +1,4 @@ -import { - getFeatureFlags, - isBlacklistedDomain, - updateConfig, -} from "@/lib/edge-config"; +import { isBlacklistedDomain, updateConfig } from "@/lib/edge-config"; import { getPangeaDomainIntel } from "@/lib/pangea"; import { checkIfUserExists, getRandomKey } from "@/lib/planetscale"; import { prisma } from "@/lib/prisma"; @@ -197,7 +193,11 @@ export async function processLink>({ // coerce type with ! cause we already checked if it exists const { allowedHostnames } = DUB_DOMAINS.find((d) => d.slug === domain)!; const urlDomain = getApexDomain(url) || ""; - if (allowedHostnames && !allowedHostnames.includes(urlDomain)) { + if ( + key !== "_root" && + allowedHostnames && + !allowedHostnames.includes(urlDomain) + ) { return { link: payload, error: `Invalid destination URL. You can only create ${domain} short links for URLs with the domain${allowedHostnames.length > 1 ? "s" : ""} ${allowedHostnames @@ -207,20 +207,6 @@ export async function processLink>({ }; } - 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 support@dub.co to get access.", - code: "forbidden", - }; - } - } - if (key?.includes("/")) { // check if the user has access to the parent link const parentKey = key.split("/")[0]; diff --git a/apps/web/ui/domains/domain-card-title-column.tsx b/apps/web/ui/domains/domain-card-title-column.tsx index 4c2536ae79..1343339f98 100644 --- a/apps/web/ui/domains/domain-card-title-column.tsx +++ b/apps/web/ui/domains/domain-card-title-column.tsx @@ -23,11 +23,16 @@ export function DomainCardTitleColumn({
- +
diff --git a/packages/ui/src/icons/nucleo/calendar-days.tsx b/packages/ui/src/icons/nucleo/calendar-days.tsx new file mode 100644 index 0000000000..2f98c17a3f --- /dev/null +++ b/packages/ui/src/icons/nucleo/calendar-days.tsx @@ -0,0 +1,73 @@ +import { SVGProps } from "react"; + +export function CalendarDays(props: SVGProps) { + return ( + + + + + + + + + + + + + + + ); +} diff --git a/packages/ui/src/icons/nucleo/index.ts b/packages/ui/src/icons/nucleo/index.ts index 59056ec143..ce505d8d28 100644 --- a/packages/ui/src/icons/nucleo/index.ts +++ b/packages/ui/src/icons/nucleo/index.ts @@ -10,6 +10,7 @@ export * from "./book2"; export * from "./books2"; export * from "./box-archive"; export * from "./bullet-list"; +export * from "./calendar-days"; export * from "./cards"; export * from "./caret-up-fill"; export * from "./chart-activity2";