From 0568b03a80d1f7b698b79ca5a2d85618f93c603a Mon Sep 17 00:00:00 2001 From: bkellam Date: Wed, 28 May 2025 16:42:59 -0700 Subject: [PATCH] fix: hide license settings in cloud environments --- packages/web/src/app/[domain]/settings/layout.tsx | 11 +++++++---- .../web/src/app/[domain]/settings/license/page.tsx | 7 ++++++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/packages/web/src/app/[domain]/settings/layout.tsx b/packages/web/src/app/[domain]/settings/layout.tsx index fc131359..4ad4c387 100644 --- a/packages/web/src/app/[domain]/settings/layout.tsx +++ b/packages/web/src/app/[domain]/settings/layout.tsx @@ -11,6 +11,7 @@ import { getMe, getOrgAccountRequests } from "@/actions"; import { ServiceErrorException } from "@/lib/serviceError"; import { getOrgFromDomain } from "@/data/org"; import { OrgRole } from "@prisma/client"; +import { env } from "@/env.mjs"; export const metadata: Metadata = { title: "Settings", @@ -84,10 +85,12 @@ export default async function SettingsLayout({ title: "API Keys", href: `/${domain}/settings/apiKeys`, }, - { - title: "License", - href: `/${domain}/settings/license`, - } + ...(env.NEXT_PUBLIC_SOURCEBOT_CLOUD_ENVIRONMENT === undefined ? [ + { + title: "License", + href: `/${domain}/settings/license`, + } + ] : []), ] return ( diff --git a/packages/web/src/app/[domain]/settings/license/page.tsx b/packages/web/src/app/[domain]/settings/license/page.tsx index 74a27c97..f46ecb5e 100644 --- a/packages/web/src/app/[domain]/settings/license/page.tsx +++ b/packages/web/src/app/[domain]/settings/license/page.tsx @@ -3,7 +3,8 @@ import { Button } from "@/components/ui/button"; import { Info, Mail } from "lucide-react"; import { getOrgMembers } from "@/actions"; import { isServiceError } from "@/lib/utils"; -import { ServiceErrorException } from "@/lib/serviceError"; +import { notFound, ServiceErrorException } from "@/lib/serviceError"; +import { env } from "@/env.mjs"; interface LicensePageProps { params: { @@ -12,6 +13,10 @@ interface LicensePageProps { } export default async function LicensePage({ params: { domain } }: LicensePageProps) { + if (env.NEXT_PUBLIC_SOURCEBOT_CLOUD_ENVIRONMENT !== undefined) { + notFound(); + } + const licenseKey = await getLicenseKey(); const entitlements = await getEntitlements(); const plan = await getPlan();