mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-04 01:36:39 +00:00
add license watermark
This commit is contained in:
@@ -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.",
|
"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?",
|
"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.",
|
"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."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -360,7 +360,8 @@ export default function LicensePage() {
|
|||||||
<div className="space-y-2 text-green-500">
|
<div className="space-y-2 text-green-500">
|
||||||
<div className="text-2xl flex items-center gap-2">
|
<div className="text-2xl flex items-center gap-2">
|
||||||
<Check />
|
<Check />
|
||||||
{t("licensed")}
|
{t("licensed") +
|
||||||
|
`${licenseStatus?.tier === "personal" ? ` (${t("personalUseOnly")})` : ""}`}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ export default async function AuthLayout({ children }: AuthLayoutProps) {
|
|||||||
const t = await getTranslations();
|
const t = await getTranslations();
|
||||||
let hideFooter = false;
|
let hideFooter = false;
|
||||||
|
|
||||||
|
let licenseStatus: GetLicenseStatusResponse | null = null;
|
||||||
if (build == "enterprise") {
|
if (build == "enterprise") {
|
||||||
const licenseStatusRes = await cache(
|
const licenseStatusRes = await cache(
|
||||||
async () =>
|
async () =>
|
||||||
@@ -30,10 +31,12 @@ export default async function AuthLayout({ children }: AuthLayoutProps) {
|
|||||||
"/license/status"
|
"/license/status"
|
||||||
)
|
)
|
||||||
)();
|
)();
|
||||||
|
licenseStatus = licenseStatusRes.data.data;
|
||||||
if (
|
if (
|
||||||
env.branding.hideAuthLayoutFooter &&
|
env.branding.hideAuthLayoutFooter &&
|
||||||
licenseStatusRes.data.data.isHostLicensed &&
|
licenseStatusRes.data.data.isHostLicensed &&
|
||||||
licenseStatusRes.data.data.isLicenseValid
|
licenseStatusRes.data.data.isLicenseValid &&
|
||||||
|
licenseStatusRes.data.data.tier !== "personal"
|
||||||
) {
|
) {
|
||||||
hideFooter = true;
|
hideFooter = true;
|
||||||
}
|
}
|
||||||
@@ -83,6 +86,23 @@ export default async function AuthLayout({ children }: AuthLayoutProps) {
|
|||||||
? t("enterpriseEdition")
|
? t("enterpriseEdition")
|
||||||
: t("pangolinCloud")}
|
: t("pangolinCloud")}
|
||||||
</span>
|
</span>
|
||||||
|
{build === "enterprise" &&
|
||||||
|
licenseStatus?.isHostLicensed &&
|
||||||
|
licenseStatus?.isLicenseValid &&
|
||||||
|
licenseStatus?.tier === "personal" ? (
|
||||||
|
<>
|
||||||
|
<Separator orientation="vertical" />
|
||||||
|
<span>{t("personalUseOnly")}</span>
|
||||||
|
</>
|
||||||
|
) : null}
|
||||||
|
{build === "enterprise" &&
|
||||||
|
(!licenseStatus?.isHostLicensed ||
|
||||||
|
!licenseStatus?.isLicenseValid) ? (
|
||||||
|
<>
|
||||||
|
<Separator orientation="vertical" />
|
||||||
|
<span>{t("unlicensed")}</span>
|
||||||
|
</>
|
||||||
|
) : null}
|
||||||
{build === "saas" && (
|
{build === "saas" && (
|
||||||
<>
|
<>
|
||||||
<Separator orientation="vertical" />
|
<Separator orientation="vertical" />
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import { useEffect, useState } from "react";
|
|||||||
import { FaGithub } from "react-icons/fa";
|
import { FaGithub } from "react-icons/fa";
|
||||||
import SidebarLicenseButton from "./SidebarLicenseButton";
|
import SidebarLicenseButton from "./SidebarLicenseButton";
|
||||||
import { SidebarSupportButton } from "./SidebarSupportButton";
|
import { SidebarSupportButton } from "./SidebarSupportButton";
|
||||||
|
import { is } from "drizzle-orm";
|
||||||
|
|
||||||
const ProductUpdates = dynamic(() => import("./ProductUpdates"), {
|
const ProductUpdates = dynamic(() => import("./ProductUpdates"), {
|
||||||
ssr: false
|
ssr: false
|
||||||
@@ -52,7 +53,7 @@ export function LayoutSidebar({
|
|||||||
const pathname = usePathname();
|
const pathname = usePathname();
|
||||||
const isAdminPage = pathname?.startsWith("/admin");
|
const isAdminPage = pathname?.startsWith("/admin");
|
||||||
const { user } = useUserContext();
|
const { user } = useUserContext();
|
||||||
const { isUnlocked } = useLicenseStatusContext();
|
const { isUnlocked, licenseStatus } = useLicenseStatusContext();
|
||||||
const { env } = useEnvContext();
|
const { env } = useEnvContext();
|
||||||
const t = useTranslations();
|
const t = useTranslations();
|
||||||
|
|
||||||
@@ -226,6 +227,18 @@ export function LayoutSidebar({
|
|||||||
<FaGithub size={12} />
|
<FaGithub size={12} />
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
{build === "enterprise" &&
|
||||||
|
isUnlocked() &&
|
||||||
|
licenseStatus?.tier === "personal" ? (
|
||||||
|
<div className="text-xs text-muted-foreground text-center">
|
||||||
|
{t("personalUseOnly")}
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
|
{build === "enterprise" && !isUnlocked() ? (
|
||||||
|
<div className="text-xs text-muted-foreground text-center">
|
||||||
|
{t("unlicensed")}
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
{env?.app?.version && (
|
{env?.app?.version && (
|
||||||
<div className="text-xs text-muted-foreground text-center">
|
<div className="text-xs text-muted-foreground text-center">
|
||||||
<Link
|
<Link
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ type ResourceAuthPortalProps = {
|
|||||||
export default function ResourceAuthPortal(props: ResourceAuthPortalProps) {
|
export default function ResourceAuthPortal(props: ResourceAuthPortalProps) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const t = useTranslations();
|
const t = useTranslations();
|
||||||
const { isUnlocked } = useLicenseStatusContext();
|
const { isUnlocked, licenseStatus } = useLicenseStatusContext();
|
||||||
|
|
||||||
const getNumMethods = () => {
|
const getNumMethods = () => {
|
||||||
let colLength = 0;
|
let colLength = 0;
|
||||||
@@ -737,6 +737,22 @@ export default function ResourceAuthPortal(props: ResourceAuthPortalProps) {
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
{build === "enterprise" && !isUnlocked() ? (
|
||||||
|
<div className="text-center mt-2">
|
||||||
|
<span className="text-sm font-medium text-muted-foreground">
|
||||||
|
{t("instanceIsUnlicensed")}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
|
{build === "enterprise" &&
|
||||||
|
isUnlocked() &&
|
||||||
|
licenseStatus?.tier === "personal" ? (
|
||||||
|
<div className="text-center mt-2">
|
||||||
|
<span className="text-sm font-medium text-muted-foreground">
|
||||||
|
{t("loginPageLicenseWatermark")}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<ResourceAccessDenied />
|
<ResourceAccessDenied />
|
||||||
|
|||||||
Reference in New Issue
Block a user