From 5b20122425b3f4daf4e12b6370f744a4bc70c5a2 Mon Sep 17 00:00:00 2001
From: Philipinho <16838612+Philipinho@users.noreply.github.com>
Date: Sat, 17 May 2025 10:41:19 -0700
Subject: [PATCH] hide shared page branding in EE
---
.../features/share/components/share-branding.tsx | 16 ++++++++++++++++
.../features/share/components/share-shell.tsx | 12 ++----------
.../src/features/share/types/share.types.ts | 2 ++
apps/client/src/pages/share/shared-page.tsx | 7 +++++--
apps/server/src/core/share/share.controller.ts | 12 ++++++++++--
apps/server/src/ee | 2 +-
6 files changed, 36 insertions(+), 15 deletions(-)
create mode 100644 apps/client/src/features/share/components/share-branding.tsx
diff --git a/apps/client/src/features/share/components/share-branding.tsx b/apps/client/src/features/share/components/share-branding.tsx
new file mode 100644
index 00000000..4b3dfb3e
--- /dev/null
+++ b/apps/client/src/features/share/components/share-branding.tsx
@@ -0,0 +1,16 @@
+import { Affix, Button } from "@mantine/core";
+
+export default function ShareBranding() {
+ return (
+
+
+
+ );
+}
diff --git a/apps/client/src/features/share/components/share-shell.tsx b/apps/client/src/features/share/components/share-shell.tsx
index 7fa0c941..8550f59f 100644
--- a/apps/client/src/features/share/components/share-shell.tsx
+++ b/apps/client/src/features/share/components/share-shell.tsx
@@ -36,6 +36,7 @@ import {
} from "@/features/search/components/search-control.tsx";
import { ShareSearchSpotlight } from "@/features/search/share-search-spotlight";
import { shareSearchSpotlight } from "@/features/search/constants";
+import ShareBranding from '@/features/share/components/share-branding.tsx';
const MemoizedSharedTree = React.memo(SharedTree);
@@ -163,16 +164,7 @@ export default function ShareShell({
{children}
-
-
-
+ {data && shareId && !data.hasLicenseKey && }
;
+ hasLicenseKey: boolean;
}
diff --git a/apps/client/src/pages/share/shared-page.tsx b/apps/client/src/pages/share/shared-page.tsx
index a574a614..6d3a321c 100644
--- a/apps/client/src/pages/share/shared-page.tsx
+++ b/apps/client/src/pages/share/shared-page.tsx
@@ -2,13 +2,14 @@ import { useNavigate, useParams } from "react-router-dom";
import { Helmet } from "react-helmet-async";
import { useTranslation } from "react-i18next";
import { useSharePageQuery } from "@/features/share/queries/share-query.ts";
-import { Container } from "@mantine/core";
+import { Affix, Button, Container } from "@mantine/core";
import React, { useEffect } from "react";
import ReadonlyPageEditor from "@/features/editor/readonly-page-editor.tsx";
import { extractPageSlugId } from "@/lib";
import { Error404 } from "@/components/ui/error-404.tsx";
+import ShareBranding from "@/features/share/components/share-branding.tsx";
-export default function SingleSharedPage() {
+export default function SharedPage() {
const { t } = useTranslation();
const { pageSlug } = useParams();
const { shareId } = useParams();
@@ -53,6 +54,8 @@ export default function SingleSharedPage() {
content={data.page.content}
/>
+
+ {data && !shareId && !data.hasLicenseKey && }
);
}
diff --git a/apps/server/src/core/share/share.controller.ts b/apps/server/src/core/share/share.controller.ts
index 5e8debe0..47b5c17e 100644
--- a/apps/server/src/core/share/share.controller.ts
+++ b/apps/server/src/core/share/share.controller.ts
@@ -30,6 +30,7 @@ import { JwtAuthGuard } from '../../common/guards/jwt-auth.guard';
import { Public } from '../../common/decorators/public.decorator';
import { ShareRepo } from '@docmost/db/repos/share/share.repo';
import { PaginationOptions } from '@docmost/db/pagination/pagination-options';
+import { EnvironmentService } from '../../integrations/environment/environment.service';
@UseGuards(JwtAuthGuard)
@Controller('shares')
@@ -39,6 +40,7 @@ export class ShareController {
private readonly spaceAbility: SpaceAbilityFactory,
private readonly shareRepo: ShareRepo,
private readonly pageRepo: PageRepo,
+ private readonly environmentService: EnvironmentService,
) {}
@HttpCode(HttpStatus.OK)
@@ -61,7 +63,10 @@ export class ShareController {
throw new BadRequestException();
}
- return this.shareService.getSharedPage(dto, workspace.id);
+ return {
+ ...(await this.shareService.getSharedPage(dto, workspace.id)),
+ hasLicenseKey: Boolean(workspace.licenseKey),
+ };
}
@Public()
@@ -166,6 +171,9 @@ export class ShareController {
@Body() dto: ShareIdDto,
@AuthWorkspace() workspace: Workspace,
) {
- return this.shareService.getShareTree(dto.shareId, workspace.id);
+ return {
+ ...(await this.shareService.getShareTree(dto.shareId, workspace.id)),
+ hasLicenseKey: Boolean(workspace.licenseKey),
+ };
}
}
diff --git a/apps/server/src/ee b/apps/server/src/ee
index 96404fc1..12f576ce 160000
--- a/apps/server/src/ee
+++ b/apps/server/src/ee
@@ -1 +1 @@
-Subproject commit 96404fc121844a707bd0fb1e280df6e2d52e8973
+Subproject commit 12f576ce721747903a9fadef3d58e0aa4e7ea3da