From 77d17af15b48a5eb8ab8f813e8d6aabe2bc26fe8 Mon Sep 17 00:00:00 2001 From: Owen Date: Mon, 11 May 2026 16:18:57 -0700 Subject: [PATCH] Add global hide_powered_by and make it backward --- server/private/lib/config.ts | 7 +++++++ server/private/lib/readConfigFile.ts | 1 + src/components/OrgLoginPage.tsx | 29 +++++++++++++++------------ src/components/ResourceAuthPortal.tsx | 3 ++- src/lib/pullEnv.ts | 2 ++ src/lib/types/env.ts | 1 + 6 files changed, 29 insertions(+), 14 deletions(-) diff --git a/server/private/lib/config.ts b/server/private/lib/config.ts index 9884fe252..75600fba6 100644 --- a/server/private/lib/config.ts +++ b/server/private/lib/config.ts @@ -97,6 +97,13 @@ export class PrivateConfig { ); } + process.env.BRANDING_HIDE_POWERED_BY = + this.rawPrivateConfig.branding?.hide_powered_by === true || + this.rawPrivateConfig.branding?.resource_auth_page + ?.hide_powered_by === true + ? "true" + : "false"; + process.env.LOGIN_PAGE_SUBTITLE_TEXT = this.rawPrivateConfig.branding?.login_page?.subtitle_text || ""; diff --git a/server/private/lib/readConfigFile.ts b/server/private/lib/readConfigFile.ts index 63ca0b068..974e8e590 100644 --- a/server/private/lib/readConfigFile.ts +++ b/server/private/lib/readConfigFile.ts @@ -141,6 +141,7 @@ export const privateConfigSchema = z ) .optional(), hide_auth_layout_footer: z.boolean().optional().default(false), + hide_powered_by: z.boolean().optional(), login_page: z .object({ subtitle_text: z.string().optional() diff --git a/src/components/OrgLoginPage.tsx b/src/components/OrgLoginPage.tsx index 26cc23814..3270b7cb4 100644 --- a/src/components/OrgLoginPage.tsx +++ b/src/components/OrgLoginPage.tsx @@ -16,6 +16,7 @@ import Link from "next/link"; import { replacePlaceholder } from "@app/lib/replacePlaceholder"; import { getTranslations } from "next-intl/server"; import { pullEnv } from "@app/lib/pullEnv"; +import { build } from "@server/build"; type OrgLoginPageProps = { loginPage: LoadLoginPageResponse | undefined; @@ -52,19 +53,21 @@ export default async function OrgLoginPage({ const t = await getTranslations(); return (
-
- - {t("poweredBy")}{" "} - - {env.branding.appName || "Pangolin"} - - -
+ {build !== "enterprise" || !env.branding.hidePoweredBy ? ( +
+ + {t("poweredBy")}{" "} + + {env.branding.appName || "Pangolin"} + + +
+ ) : null} {branding?.logoUrl && ( diff --git a/src/components/ResourceAuthPortal.tsx b/src/components/ResourceAuthPortal.tsx index 0020330c6..64e1d2725 100644 --- a/src/components/ResourceAuthPortal.tsx +++ b/src/components/ResourceAuthPortal.tsx @@ -375,7 +375,8 @@ export default function ResourceAuthPortal(props: ResourceAuthPortalProps) { {!accessDenied ? (
{isUnlocked() && build === "enterprise" ? ( - !env.branding.resourceAuthPage?.hidePoweredBy && ( + !env.branding.resourceAuthPage?.hidePoweredBy && + !env.branding.hidePoweredBy && (
{t("poweredBy")}{" "} diff --git a/src/lib/pullEnv.ts b/src/lib/pullEnv.ts index ddbd42c26..21390effc 100644 --- a/src/lib/pullEnv.ts +++ b/src/lib/pullEnv.ts @@ -81,6 +81,8 @@ export function pullEnv(): Env { process.env.BRANDING_HIDE_AUTH_LAYOUT_FOOTER === "true" ? true : false, + hidePoweredBy: + process.env.BRANDING_HIDE_POWERED_BY === "true" ? true : false, logo: { lightPath: process.env.BRANDING_LOGO_LIGHT_PATH as string, darkPath: process.env.BRANDING_LOGO_DARK_PATH as string, diff --git a/src/lib/types/env.ts b/src/lib/types/env.ts index 46513ae52..2a9fd2549 100644 --- a/src/lib/types/env.ts +++ b/src/lib/types/env.ts @@ -41,6 +41,7 @@ export type Env = { appName?: string; background_image_path?: string; hideAuthLayoutFooter?: boolean; + hidePoweredBy?: boolean; logo?: { lightPath?: string; darkPath?: string;