mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-06-15 20:25:23 +02:00
- Added whitelabeling support, allowing customization of application name, logos, and login page. - Introduced new WhitelabelSettings component for managing whitelabel configurations. - Updated onboarding and sidebar layouts to reflect whitelabel settings dynamically. - Created database schema changes to accommodate new whitelabel fields. - Implemented API endpoints for retrieving and updating whitelabel settings.
85 lines
2.3 KiB
TypeScript
85 lines
2.3 KiB
TypeScript
import { validateRequest } from "@dokploy/server";
|
|
import { createServerSideHelpers } from "@trpc/react-query/server";
|
|
import type { GetServerSidePropsContext } from "next";
|
|
import type { ReactElement } from "react";
|
|
import superjson from "superjson";
|
|
import { DashboardLayout } from "@/components/layouts/dashboard-layout";
|
|
import { EnterpriseFeatureGate } from "@/components/proprietary/enterprise-feature-gate";
|
|
import { WhitelabelSettings } from "@/components/proprietary/whitelabelling/whitelabel-settings";
|
|
import { Card } from "@/components/ui/card";
|
|
import { appRouter } from "@/server/api/root";
|
|
import { getLocale, serverSideTranslations } from "@/utils/i18n";
|
|
|
|
const Page = () => {
|
|
return (
|
|
<div className="w-full">
|
|
<div className="h-full rounded-xl max-w-5xl mx-auto flex flex-col gap-4">
|
|
<Card className="h-full bg-sidebar p-2.5 rounded-xl mx-auto w-full">
|
|
<div className="rounded-xl bg-background shadow-md">
|
|
<div className="p-6">
|
|
<EnterpriseFeatureGate
|
|
lockedProps={{
|
|
title: "Enterprise Whitelabeling",
|
|
description:
|
|
"Whitelabeling is part of Dokploy Enterprise. Add a valid license to customize logos, app name, and login page.",
|
|
ctaLabel: "Go to License",
|
|
}}
|
|
>
|
|
<WhitelabelSettings />
|
|
</EnterpriseFeatureGate>
|
|
</div>
|
|
</div>
|
|
</Card>
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default Page;
|
|
|
|
Page.getLayout = (page: ReactElement) => {
|
|
return <DashboardLayout metaName="Whitelabeling">{page}</DashboardLayout>;
|
|
};
|
|
|
|
export async function getServerSideProps(ctx: GetServerSidePropsContext) {
|
|
const { req } = ctx;
|
|
const locale = await getLocale(req.cookies);
|
|
const { user, session } = await validateRequest(ctx.req);
|
|
if (!user) {
|
|
return {
|
|
redirect: {
|
|
permanent: true,
|
|
destination: "/",
|
|
},
|
|
};
|
|
}
|
|
if (user.role === "member") {
|
|
return {
|
|
redirect: {
|
|
permanent: true,
|
|
destination: "/dashboard/settings/profile",
|
|
},
|
|
};
|
|
}
|
|
|
|
const helpers = createServerSideHelpers({
|
|
router: appRouter,
|
|
ctx: {
|
|
req: req as any,
|
|
res: ctx.res as any,
|
|
db: null as any,
|
|
session: session as any,
|
|
user: user as any,
|
|
},
|
|
transformer: superjson,
|
|
});
|
|
await helpers.user.get.prefetch();
|
|
|
|
return {
|
|
props: {
|
|
trpcState: helpers.dehydrate(),
|
|
...(await serverSideTranslations(locale, ["settings"])),
|
|
},
|
|
};
|
|
}
|