From c7747fd4b430ce4bbc07974b53f966dac561eac3 Mon Sep 17 00:00:00 2001 From: miloschwartz Date: Sat, 13 Dec 2025 11:45:07 -0500 Subject: [PATCH] add license watermark --- messages/en-US.json | 5 ++++- src/app/admin/license/page.tsx | 3 ++- src/app/auth/layout.tsx | 22 +++++++++++++++++++++- src/components/LayoutSidebar.tsx | 15 ++++++++++++++- src/components/ResourceAuthPortal.tsx | 18 +++++++++++++++++- 5 files changed, 58 insertions(+), 5 deletions(-) diff --git a/messages/en-US.json b/messages/en-US.json index 7d5deded..b023ac75 100644 --- a/messages/en-US.json +++ b/messages/en-US.json @@ -2272,5 +2272,8 @@ "remoteExitNodeRegenerateAndDisconnectWarning": "This will regenerate the credentials and immediately disconnect the remote exit node. The remote exit node will need to be restarted with the new credentials.", "remoteExitNodeRegenerateCredentialsConfirmation": "Are you sure you want to regenerate the credentials for this remote exit node?", "remoteExitNodeRegenerateCredentialsWarning": "This will regenerate the credentials. The remote exit node will stay connected until you manually restart it and use the new credentials.", - "agent": "Agent" + "agent": "Agent", + "personalUseOnly": "Personal Use Only", + "loginPageLicenseWatermark": "This instance is licensed for personal use only.", + "instanceIsUnlicensed": "This instance is unlicensed." } diff --git a/src/app/admin/license/page.tsx b/src/app/admin/license/page.tsx index bef4f173..4e0586bd 100644 --- a/src/app/admin/license/page.tsx +++ b/src/app/admin/license/page.tsx @@ -360,7 +360,8 @@ export default function LicensePage() {
- {t("licensed")} + {t("licensed") + + `${licenseStatus?.tier === "personal" ? ` (${t("personalUseOnly")})` : ""}`}
) : ( diff --git a/src/app/auth/layout.tsx b/src/app/auth/layout.tsx index 70439824..6a72006b 100644 --- a/src/app/auth/layout.tsx +++ b/src/app/auth/layout.tsx @@ -23,6 +23,7 @@ export default async function AuthLayout({ children }: AuthLayoutProps) { const t = await getTranslations(); let hideFooter = false; + let licenseStatus: GetLicenseStatusResponse | null = null; if (build == "enterprise") { const licenseStatusRes = await cache( async () => @@ -30,10 +31,12 @@ export default async function AuthLayout({ children }: AuthLayoutProps) { "/license/status" ) )(); + licenseStatus = licenseStatusRes.data.data; if ( env.branding.hideAuthLayoutFooter && licenseStatusRes.data.data.isHostLicensed && - licenseStatusRes.data.data.isLicenseValid + licenseStatusRes.data.data.isLicenseValid && + licenseStatusRes.data.data.tier !== "personal" ) { hideFooter = true; } @@ -83,6 +86,23 @@ export default async function AuthLayout({ children }: AuthLayoutProps) { ? t("enterpriseEdition") : t("pangolinCloud")} + {build === "enterprise" && + licenseStatus?.isHostLicensed && + licenseStatus?.isLicenseValid && + licenseStatus?.tier === "personal" ? ( + <> + + {t("personalUseOnly")} + + ) : null} + {build === "enterprise" && + (!licenseStatus?.isHostLicensed || + !licenseStatus?.isLicenseValid) ? ( + <> + + {t("unlicensed")} + + ) : null} {build === "saas" && ( <> diff --git a/src/components/LayoutSidebar.tsx b/src/components/LayoutSidebar.tsx index 8006b6e8..45d0292b 100644 --- a/src/components/LayoutSidebar.tsx +++ b/src/components/LayoutSidebar.tsx @@ -25,6 +25,7 @@ import { useEffect, useState } from "react"; import { FaGithub } from "react-icons/fa"; import SidebarLicenseButton from "./SidebarLicenseButton"; import { SidebarSupportButton } from "./SidebarSupportButton"; +import { is } from "drizzle-orm"; const ProductUpdates = dynamic(() => import("./ProductUpdates"), { ssr: false @@ -52,7 +53,7 @@ export function LayoutSidebar({ const pathname = usePathname(); const isAdminPage = pathname?.startsWith("/admin"); const { user } = useUserContext(); - const { isUnlocked } = useLicenseStatusContext(); + const { isUnlocked, licenseStatus } = useLicenseStatusContext(); const { env } = useEnvContext(); const t = useTranslations(); @@ -226,6 +227,18 @@ export function LayoutSidebar({ + {build === "enterprise" && + isUnlocked() && + licenseStatus?.tier === "personal" ? ( +
+ {t("personalUseOnly")} +
+ ) : null} + {build === "enterprise" && !isUnlocked() ? ( +
+ {t("unlicensed")} +
+ ) : null} {env?.app?.version && (
{ let colLength = 0; @@ -737,6 +737,22 @@ export default function ResourceAuthPortal(props: ResourceAuthPortalProps) {
)} + {build === "enterprise" && !isUnlocked() ? ( +
+ + {t("instanceIsUnlicensed")} + +
+ ) : null} + {build === "enterprise" && + isUnlocked() && + licenseStatus?.tier === "personal" ? ( +
+ + {t("loginPageLicenseWatermark")} + +
+ ) : null} ) : (