From 251e34824d34985f766faf1e160e3d37a2a60b7d Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Tue, 22 Apr 2025 10:25:49 -0600 Subject: [PATCH] Update content security policy to allow post hog --- web/next.config.mjs | 7 +++++-- web/src/components/ui/dropdown/DropdownBase.tsx | 2 -- web/src/context/Posthog/BusterPosthogProvider.tsx | 12 +++++------- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/web/next.config.mjs b/web/next.config.mjs index a8478e1cc..8bebcc917 100644 --- a/web/next.config.mjs +++ b/web/next.config.mjs @@ -16,11 +16,14 @@ const createCspHeader = (isEmbed = false) => { .replace('http', 'ws') : ''; + const isDev = process.env.NODE_ENV === 'development'; + const localDomains = isDev ? 'http://127.0.0.1:* ws://127.0.0.1:*' : ''; + return [ // Default directives "default-src 'self'", // Scripts - "script-src 'self' 'unsafe-inline' 'unsafe-eval' https://vercel.live https://*.vercel.app https://cdn.jsdelivr.net https://*.cloudflareinsights.com", + "script-src 'self' 'unsafe-inline' 'unsafe-eval' https://vercel.live https://*.vercel.app https://cdn.jsdelivr.net https://*.cloudflareinsights.com https://*.posthog.com", // Styles "style-src 'self' 'unsafe-inline' https://fonts.googleapis.com https://cdn.jsdelivr.net", // Images @@ -32,7 +35,7 @@ const createCspHeader = (isEmbed = false) => { // Frame sources "frame-src 'self' https://vercel.live", // Connect sources for API calls - `connect-src 'self' http://127.0.0.1:* ws://127.0.0.1:* https://*.vercel.app https://*.supabase.co wss://*.supabase.co ${apiUrl} ${wsUrl}`.trim(), + `connect-src 'self' ${localDomains} https://*.vercel.app https://*.supabase.co wss://*.supabase.co https://*.posthog.com ${apiUrl} ${wsUrl}`.trim(), // Media "media-src 'self'", // Object diff --git a/web/src/components/ui/dropdown/DropdownBase.tsx b/web/src/components/ui/dropdown/DropdownBase.tsx index 1974a6c11..dacd11aa3 100644 --- a/web/src/components/ui/dropdown/DropdownBase.tsx +++ b/web/src/components/ui/dropdown/DropdownBase.tsx @@ -264,8 +264,6 @@ const DropdownMenuLink: React.FC<{ ); - console.log(link, isExternal, linkTarget); - return ( e.stopPropagation()}> diff --git a/web/src/context/Posthog/BusterPosthogProvider.tsx b/web/src/context/Posthog/BusterPosthogProvider.tsx index 762dd7f77..63195b31d 100644 --- a/web/src/context/Posthog/BusterPosthogProvider.tsx +++ b/web/src/context/Posthog/BusterPosthogProvider.tsx @@ -26,7 +26,11 @@ const options: Partial = { recordBody: true }, loaded: (x) => { - console.log('Posthog loaded', x); + console.log( + '%c🎉 Posthog loaded! 🚀', + 'background: linear-gradient(to right, #ff6b6b, #4ecdc4); color: white; font-size: 20px; font-weight: bold; padding: 10px; border-radius: 5px;', + x + ); } }; @@ -37,12 +41,6 @@ const PosthogWrapper: React.FC> = ({ children }) => { const team = userTeams[0]; useEffect(() => { - console.log('user', user); - console.log('team', team); - console.log(POSTHOG_KEY); - console.log(isServer); - console.log(posthog); - if (POSTHOG_KEY && !isServer && user && posthog && team) { posthog.init(POSTHOG_KEY, options);