diff --git a/apps/dokploy/__test__/traefik/server/update-server-config.test.ts b/apps/dokploy/__test__/traefik/server/update-server-config.test.ts index b422279ca..e07f34ade 100644 --- a/apps/dokploy/__test__/traefik/server/update-server-config.test.ts +++ b/apps/dokploy/__test__/traefik/server/update-server-config.test.ts @@ -48,6 +48,20 @@ const baseSettings: WebServerSettings = { urlCallback: "", }, }, + whitelabelingConfig: { + appName: null, + appDescription: null, + logoUrl: null, + faviconUrl: null, + customCss: null, + loginLogoUrl: null, + supportUrl: null, + docsUrl: null, + errorPageTitle: null, + errorPageDescription: null, + metaTitle: null, + footerText: null, + }, cleanupCacheApplications: false, cleanupCacheOnCompose: false, cleanupCacheOnPreviews: false, diff --git a/apps/dokploy/components/dashboard/application/deployments/show-deployments.tsx b/apps/dokploy/components/dashboard/application/deployments/show-deployments.tsx index 61841e294..3cecef1ec 100644 --- a/apps/dokploy/components/dashboard/application/deployments/show-deployments.tsx +++ b/apps/dokploy/components/dashboard/application/deployments/show-deployments.tsx @@ -2,6 +2,7 @@ import { ChevronDown, ChevronUp, Clock, + Copy, Loader2, RefreshCcw, RocketIcon, @@ -10,6 +11,7 @@ import { } from "lucide-react"; import React, { useEffect, useMemo, useState } from "react"; import { toast } from "sonner"; +import copy from "copy-to-clipboard"; import { AlertBlock } from "@/components/shared/alert-block"; import { DateTooltip } from "@/components/shared/date-tooltip"; import { DialogAction } from "@/components/shared/dialog-action"; @@ -97,6 +99,12 @@ export const ShowDeployments = ({ new Set(), ); + const webhookUrl = useMemo( + () => + `${url}/api/deploy${type === "compose" ? "/compose" : ""}/${refreshToken}`, + [url, refreshToken, type], + ); + const MAX_DESCRIPTION_LENGTH = 200; const truncateDescription = (description: string): string => { @@ -224,11 +232,27 @@ export const ShowDeployments = ({
Webhook URL:
- - {`${url}/api/deploy${ - type === "compose" ? "/compose" : "" - }/${refreshToken}`} - + { + if (event.key === "Enter" || event.key === " ") { + event.preventDefault(); + copy(webhookUrl); + toast.success("Copied to clipboard."); + } + }} + onClick={() => { + copy(webhookUrl); + toast.success("Copied to clipboard."); + }} + > + {webhookUrl} + + {(type === "application" || type === "compose") && ( )} diff --git a/apps/dokploy/components/dashboard/impersonation/impersonation-bar.tsx b/apps/dokploy/components/dashboard/impersonation/impersonation-bar.tsx index f77983996..1f0c6924c 100644 --- a/apps/dokploy/components/dashboard/impersonation/impersonation-bar.tsx +++ b/apps/dokploy/components/dashboard/impersonation/impersonation-bar.tsx @@ -45,10 +45,12 @@ import { import { authClient } from "@/lib/auth-client"; import { cn } from "@/lib/utils"; import { api } from "@/utils/api"; +import { useWhitelabeling } from "@/utils/hooks/use-whitelabeling"; type User = typeof authClient.$Infer.Session.user; export const ImpersonationBar = () => { + const { config: whitelabeling } = useWhitelabeling(); const [users, setUsers] = useState([]); const [selectedUser, setSelectedUser] = useState(null); const [isImpersonating, setIsImpersonating] = useState(false); @@ -180,7 +182,10 @@ export const ImpersonationBar = () => { )} >
- + {!isImpersonating ? (
diff --git a/apps/dokploy/components/layouts/onboarding-layout.tsx b/apps/dokploy/components/layouts/onboarding-layout.tsx index fff5413e0..c76c920fd 100644 --- a/apps/dokploy/components/layouts/onboarding-layout.tsx +++ b/apps/dokploy/components/layouts/onboarding-layout.tsx @@ -1,6 +1,7 @@ import Link from "next/link"; import type React from "react"; import { cn } from "@/lib/utils"; +import { useWhitelabelingPublic } from "@/utils/hooks/use-whitelabeling"; import { GithubIcon } from "../icons/data-tools-icons"; import { Logo } from "../shared/logo"; import { Button } from "../ui/button"; @@ -9,23 +10,28 @@ interface Props { children: React.ReactNode; } export const OnboardingLayout = ({ children }: Props) => { + const { config: whitelabeling } = useWhitelabelingPublic(); + const appName = whitelabeling?.appName || "Dokploy"; + const appDescription = + whitelabeling?.appDescription || + "\u201CThe Open Source alternative to Netlify, Vercel, Heroku.\u201D"; + const logoUrl = + whitelabeling?.loginLogoUrl || whitelabeling?.logoUrl || undefined; + return (
- - Dokploy + + {appName}
-

- “The Open Source alternative to Netlify, Vercel, - Heroku.” -

+

{appDescription}

diff --git a/apps/dokploy/components/layouts/side.tsx b/apps/dokploy/components/layouts/side.tsx index 6dea37f5b..d3f5bbc71 100644 --- a/apps/dokploy/components/layouts/side.tsx +++ b/apps/dokploy/components/layouts/side.tsx @@ -24,6 +24,7 @@ import { LogIn, type LucideIcon, Package, + Palette, PieChart, Rocket, Server, @@ -422,6 +423,14 @@ const MENU: Menu = { isEnabled: ({ auth }) => !!(auth?.role === "owner" || auth?.role === "admin"), }, + { + isSingle: true, + title: "Whitelabeling", + url: "/dashboard/settings/whitelabeling", + icon: Palette, + // Only enabled for owners in non-cloud environments (enterprise) + isEnabled: ({ auth, isCloud }) => !!(auth?.role === "owner" && !isCloud), + }, ], help: [ @@ -445,38 +454,39 @@ const MENU: Menu = { function createMenuForAuthUser(opts: { auth?: AuthQueryOutput; isCloud: boolean; + whitelabeling?: { + docsUrl?: string | null; + supportUrl?: string | null; + } | null; }): Menu { + const filterEnabled = < + T extends { + isEnabled?: (o: { auth?: AuthQueryOutput; isCloud: boolean }) => boolean; + }, + >( + items: readonly T[], + ): T[] => + items.filter((item) => + !item.isEnabled + ? true + : item.isEnabled({ auth: opts.auth, isCloud: opts.isCloud }), + ) as T[]; + + // Apply whitelabeling URL overrides to help items + const helpItems = filterEnabled(MENU.help).map((item) => { + if (opts.whitelabeling?.docsUrl && item.name === "Documentation") { + return { ...item, url: opts.whitelabeling.docsUrl }; + } + if (opts.whitelabeling?.supportUrl && item.name === "Support") { + return { ...item, url: opts.whitelabeling.supportUrl }; + } + return item; + }); + return { - // Filter the home items based on the user's role and permissions - // Calls the `isEnabled` function if it exists to determine if the item should be displayed - home: MENU.home.filter((item) => - !item.isEnabled - ? true - : item.isEnabled({ - auth: opts.auth, - isCloud: opts.isCloud, - }), - ), - // Filter the settings items based on the user's role and permissions - // Calls the `isEnabled` function if it exists to determine if the item should be displayed - settings: MENU.settings.filter((item) => - !item.isEnabled - ? true - : item.isEnabled({ - auth: opts.auth, - isCloud: opts.isCloud, - }), - ), - // Filter the help items based on the user's role and permissions - // Calls the `isEnabled` function if it exists to determine if the item should be displayed - help: MENU.help.filter((item) => - !item.isEnabled - ? true - : item.isEnabled({ - auth: opts.auth, - isCloud: opts.isCloud, - }), - ), + home: filterEnabled(MENU.home), + settings: filterEnabled(MENU.settings), + help: helpItems, }; } @@ -885,6 +895,10 @@ export default function Page({ children }: Props) { const pathname = usePathname(); const { data: auth } = api.user.get.useQuery(); const { data: dokployVersion } = api.settings.getDokployVersion.useQuery(); + const { data: whitelabeling } = api.whitelabeling.get.useQuery(undefined, { + staleTime: 5 * 60 * 1000, + refetchOnWindowFocus: false, + }); const includesProjects = pathname?.includes("/dashboard/project"); const { data: isCloud } = api.settings.isCloud.useQuery(); @@ -893,7 +907,7 @@ export default function Page({ children }: Props) { home: filteredHome, settings: filteredSettings, help, - } = createMenuForAuthUser({ auth, isCloud: !!isCloud }); + } = createMenuForAuthUser({ auth, isCloud: !!isCloud, whitelabeling }); const activeItem = findActiveNavItem( [...filteredHome, ...filteredSettings], @@ -1141,6 +1155,11 @@ export default function Page({ children }: Props) { + {whitelabeling?.footerText && ( +
+ {whitelabeling.footerText} +
+ )} {dokployVersion && ( <>
diff --git a/apps/dokploy/components/proprietary/whitelabeling/whitelabeling-preview.tsx b/apps/dokploy/components/proprietary/whitelabeling/whitelabeling-preview.tsx new file mode 100644 index 000000000..d53af90a2 --- /dev/null +++ b/apps/dokploy/components/proprietary/whitelabeling/whitelabeling-preview.tsx @@ -0,0 +1,74 @@ +"use client"; + +import { + Card, + CardContent, + CardDescription, + CardHeader, + CardTitle, +} from "@/components/ui/card"; + +interface WhitelabelingPreviewProps { + config: { + appName?: string; + logoUrl?: string; + footerText?: string; + }; +} + +export function WhitelabelingPreview({ config }: WhitelabelingPreviewProps) { + const appName = config.appName || "Dokploy"; + + return ( + + + Live Preview + + A quick preview of how your branding changes will look. + + + +
+ {/* Simulated sidebar header */} +
+ {config.logoUrl ? ( + Preview Logo + ) : ( +
+ {appName.charAt(0).toUpperCase()} +
+ )} + {appName} +
+ + {/* Simulated content area */} +
+
+
+
+
+
+
+ Button +
+
+ Secondary +
+
+
+ + {/* Simulated footer */} + {config.footerText && ( +
+ {config.footerText} +
+ )} +
+ + + ); +} diff --git a/apps/dokploy/components/proprietary/whitelabeling/whitelabeling-provider.tsx b/apps/dokploy/components/proprietary/whitelabeling/whitelabeling-provider.tsx new file mode 100644 index 000000000..a1a327561 --- /dev/null +++ b/apps/dokploy/components/proprietary/whitelabeling/whitelabeling-provider.tsx @@ -0,0 +1,31 @@ +"use client"; + +import Head from "next/head"; +import { api } from "@/utils/api"; + +export function WhitelabelingProvider() { + const { data: config } = api.whitelabeling.getPublic.useQuery(undefined, { + staleTime: 5 * 60 * 1000, + refetchOnWindowFocus: false, + }); + + if (!config) return null; + + return ( + <> + + {config.metaTitle && {config.metaTitle}} + {config.faviconUrl && } + + + {config.customCss && ( +