Add global hide_powered_by and make it backward

This commit is contained in:
Owen
2026-05-11 16:18:57 -07:00
parent 264c6bf4e8
commit 77d17af15b
6 changed files with 29 additions and 14 deletions

View File

@@ -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 = process.env.LOGIN_PAGE_SUBTITLE_TEXT =
this.rawPrivateConfig.branding?.login_page?.subtitle_text || ""; this.rawPrivateConfig.branding?.login_page?.subtitle_text || "";

View File

@@ -141,6 +141,7 @@ export const privateConfigSchema = z
) )
.optional(), .optional(),
hide_auth_layout_footer: z.boolean().optional().default(false), hide_auth_layout_footer: z.boolean().optional().default(false),
hide_powered_by: z.boolean().optional(),
login_page: z login_page: z
.object({ .object({
subtitle_text: z.string().optional() subtitle_text: z.string().optional()

View File

@@ -16,6 +16,7 @@ import Link from "next/link";
import { replacePlaceholder } from "@app/lib/replacePlaceholder"; import { replacePlaceholder } from "@app/lib/replacePlaceholder";
import { getTranslations } from "next-intl/server"; import { getTranslations } from "next-intl/server";
import { pullEnv } from "@app/lib/pullEnv"; import { pullEnv } from "@app/lib/pullEnv";
import { build } from "@server/build";
type OrgLoginPageProps = { type OrgLoginPageProps = {
loginPage: LoadLoginPageResponse | undefined; loginPage: LoadLoginPageResponse | undefined;
@@ -52,19 +53,21 @@ export default async function OrgLoginPage({
const t = await getTranslations(); const t = await getTranslations();
return ( return (
<div> <div>
<div className="text-center mb-2"> {build !== "enterprise" || !env.branding.hidePoweredBy ? (
<span className="text-sm text-muted-foreground"> <div className="text-center mb-2">
{t("poweredBy")}{" "} <span className="text-sm text-muted-foreground">
<Link {t("poweredBy")}{" "}
href="https://pangolin.net/" <Link
target="_blank" href="https://pangolin.net/"
rel="noopener noreferrer" target="_blank"
className="underline" rel="noopener noreferrer"
> className="underline"
{env.branding.appName || "Pangolin"} >
</Link> {env.branding.appName || "Pangolin"}
</span> </Link>
</div> </span>
</div>
) : null}
<Card className="w-full max-w-md"> <Card className="w-full max-w-md">
<CardHeader> <CardHeader>
{branding?.logoUrl && ( {branding?.logoUrl && (

View File

@@ -375,7 +375,8 @@ export default function ResourceAuthPortal(props: ResourceAuthPortalProps) {
{!accessDenied ? ( {!accessDenied ? (
<div> <div>
{isUnlocked() && build === "enterprise" ? ( {isUnlocked() && build === "enterprise" ? (
!env.branding.resourceAuthPage?.hidePoweredBy && ( !env.branding.resourceAuthPage?.hidePoweredBy &&
!env.branding.hidePoweredBy && (
<div className="text-center mb-2"> <div className="text-center mb-2">
<span className="text-sm text-muted-foreground"> <span className="text-sm text-muted-foreground">
{t("poweredBy")}{" "} {t("poweredBy")}{" "}

View File

@@ -81,6 +81,8 @@ export function pullEnv(): Env {
process.env.BRANDING_HIDE_AUTH_LAYOUT_FOOTER === "true" process.env.BRANDING_HIDE_AUTH_LAYOUT_FOOTER === "true"
? true ? true
: false, : false,
hidePoweredBy:
process.env.BRANDING_HIDE_POWERED_BY === "true" ? true : false,
logo: { logo: {
lightPath: process.env.BRANDING_LOGO_LIGHT_PATH as string, lightPath: process.env.BRANDING_LOGO_LIGHT_PATH as string,
darkPath: process.env.BRANDING_LOGO_DARK_PATH as string, darkPath: process.env.BRANDING_LOGO_DARK_PATH as string,

View File

@@ -41,6 +41,7 @@ export type Env = {
appName?: string; appName?: string;
background_image_path?: string; background_image_path?: string;
hideAuthLayoutFooter?: boolean; hideAuthLayoutFooter?: boolean;
hidePoweredBy?: boolean;
logo?: { logo?: {
lightPath?: string; lightPath?: string;
darkPath?: string; darkPath?: string;