diff --git a/.gitignore b/.gitignore index 64cdb30d1..753389d1a 100644 --- a/.gitignore +++ b/.gitignore @@ -30,7 +30,6 @@ package-lock.json *.log .vscode .tool-versions -.claude # debug npm-debug.log* diff --git a/package.json b/package.json index 2c0279aad..09a691352 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ }, "type": "module", "scripts": { - "dev": "next dev -p 3003 --turbo", + "dev": "next dev -p 3001 --turbo", "build": "npm-run-all check-env build-db check-db build-tracker build-geo build-app", "start": "next start", "build-docker": "npm-run-all build-db build-tracker build-geo build-app", diff --git a/src/app/(main)/websites/[websiteId]/WebsiteHeader.tsx b/src/app/(main)/websites/[websiteId]/WebsiteHeader.tsx index 0d8b5d28e..7dd1d771c 100644 --- a/src/app/(main)/websites/[websiteId]/WebsiteHeader.tsx +++ b/src/app/(main)/websites/[websiteId]/WebsiteHeader.tsx @@ -8,13 +8,7 @@ import { Edit, Share } from '@/components/icons'; import { DialogButton } from '@/components/input/DialogButton'; import { ActiveUsers } from '@/components/metrics/ActiveUsers'; -export function WebsiteHeader({ - showActions, - allowLink = true, -}: { - showActions?: boolean; - allowLink?: boolean; -}) { +export function WebsiteHeader({ showActions }: { showActions?: boolean }) { const website = useWebsite(); const { renderUrl, pathname } = useNavigation(); const isSettings = pathname.endsWith('/settings'); @@ -29,7 +23,7 @@ export function WebsiteHeader({ } - titleHref={allowLink ? renderUrl(`/websites/${website.id}`, false) : undefined} + titleHref={renderUrl(`/websites/${website.id}`, false)} > diff --git a/src/app/api/share/[shareId]/route.ts b/src/app/api/share/[shareId]/route.ts index 8b0c9bb9f..bef87c4fb 100644 --- a/src/app/api/share/[shareId]/route.ts +++ b/src/app/api/share/[shareId]/route.ts @@ -1,53 +1,8 @@ -import { ROLES } from '@/lib/constants'; import { secret } from '@/lib/crypto'; import { createToken } from '@/lib/jwt'; -import prisma from '@/lib/prisma'; -import redis from '@/lib/redis'; import { json, notFound } from '@/lib/response'; import { getSharedWebsite } from '@/queries/prisma'; -export interface WhiteLabel { - name: string; - url: string; - image: string; -} - -async function getAccountId(website: { userId?: string; teamId?: string }): Promise { - if (website.userId) { - return website.userId; - } - - if (website.teamId) { - const teamOwner = await prisma.client.teamUser.findFirst({ - where: { - teamId: website.teamId, - role: ROLES.teamOwner, - }, - select: { - userId: true, - }, - }); - - return teamOwner?.userId || null; - } - - return null; -} - -async function getWhiteLabel(accountId: string): Promise { - if (!redis.enabled) { - return null; - } - - const data = await redis.client.get(`white-label:${accountId}`); - - if (data) { - return data as WhiteLabel; - } - - return null; -} - export async function GET(_request: Request, { params }: { params: Promise<{ shareId: string }> }) { const { shareId } = await params; @@ -57,20 +12,8 @@ export async function GET(_request: Request, { params }: { params: Promise<{ sha return notFound(); } - const data: { websiteId: string; token: string; whiteLabel?: WhiteLabel } = { - websiteId: website.id, - token: createToken({ websiteId: website.id }, secret()), - }; + const data = { websiteId: website.id }; + const token = createToken(data, secret()); - const accountId = await getAccountId(website); - - if (accountId) { - const whiteLabel = await getWhiteLabel(accountId); - - if (whiteLabel) { - data.whiteLabel = whiteLabel; - } - } - - return json(data); + return json({ ...data, token }); } diff --git a/src/app/share/[...shareId]/Footer.tsx b/src/app/share/[...shareId]/Footer.tsx index 0f17187c2..f29486286 100644 --- a/src/app/share/[...shareId]/Footer.tsx +++ b/src/app/share/[...shareId]/Footer.tsx @@ -1,18 +1,7 @@ import { Row, Text } from '@umami/react-zen'; -import type { WhiteLabel } from '@/app/api/share/[shareId]/route'; import { CURRENT_VERSION, HOMEPAGE_URL } from '@/lib/constants'; -export function Footer({ whiteLabel }: { whiteLabel?: WhiteLabel }) { - if (whiteLabel) { - return ( - - - {whiteLabel.name} - - - ); - } - +export function Footer() { return ( diff --git a/src/app/share/[...shareId]/Header.tsx b/src/app/share/[...shareId]/Header.tsx index 78e022af1..d7b7dcb42 100644 --- a/src/app/share/[...shareId]/Header.tsx +++ b/src/app/share/[...shareId]/Header.tsx @@ -1,26 +1,17 @@ import { Icon, Row, Text, ThemeButton } from '@umami/react-zen'; -import type { WhiteLabel } from '@/app/api/share/[shareId]/route'; import { LanguageButton } from '@/components/input/LanguageButton'; import { PreferencesButton } from '@/components/input/PreferencesButton'; import { Logo } from '@/components/svg'; -export function Header({ whiteLabel }: { whiteLabel?: WhiteLabel }) { - const logoUrl = whiteLabel?.url || 'https://umami.is'; - const logoName = whiteLabel?.name || 'umami'; - const logoImage = whiteLabel?.image; - +export function Header() { return ( - + - {logoImage ? ( - {logoName} - ) : ( - - - - )} - {logoName} + + + + umami diff --git a/src/app/share/[...shareId]/SharePage.tsx b/src/app/share/[...shareId]/SharePage.tsx index 7a76a29bb..7ed066735 100644 --- a/src/app/share/[...shareId]/SharePage.tsx +++ b/src/app/share/[...shareId]/SharePage.tsx @@ -26,17 +26,15 @@ export function SharePage({ shareId }) { return null; } - const { whiteLabel } = shareToken; - return ( -
+
- + -