diff --git a/apps/web/next.config.mjs b/apps/web/next.config.mjs index 955231a0c..260fdccc1 100644 --- a/apps/web/next.config.mjs +++ b/apps/web/next.config.mjs @@ -7,9 +7,6 @@ const __dirname = dirname(__filename); const apiUrl = new URL(env.NEXT_PUBLIC_API_URL).origin; const api2Url = new URL(env.NEXT_PUBLIC_API2_URL).origin; -const wsUrl = new URL(env.NEXT_PUBLIC_WEB_SOCKET_URL).origin - .replace('https', 'wss') - .replace('http', 'ws'); // Function to create CSP header with dynamic API URLs const createCspHeader = (isEmbed = false) => { @@ -34,7 +31,7 @@ const createCspHeader = (isEmbed = false) => { // Frame sources "frame-src 'self' https://vercel.live", // Connect sources for API calls - `connect-src 'self' ${localDomains} https://*.vercel.app https://*.supabase.co wss://*.supabase.co https://*.posthog.com ${apiUrl} ${api2Url} ${wsUrl}` + `connect-src 'self' ${localDomains} https://*.vercel.app https://*.supabase.co wss://*.supabase.co https://*.posthog.com ${apiUrl} ${api2Url}` .replace(/\s+/g, ' ') .trim(), // Media diff --git a/apps/web/src/config/env.mjs b/apps/web/src/config/env.mjs index e965f67ef..350d50cff 100644 --- a/apps/web/src/config/env.mjs +++ b/apps/web/src/config/env.mjs @@ -25,7 +25,8 @@ const clientEnvSchema = z.object({ NEXT_PUBLIC_WEB_SOCKET_URL: z .string() .min(1, { message: 'NEXT_PUBLIC_WEB_SOCKET_URL is required' }) - .url({ message: 'NEXT_PUBLIC_WEB_SOCKET_URL must be a valid URL' }), + .url({ message: 'NEXT_PUBLIC_WEB_SOCKET_URL must be a valid URL' }) + .optional(), NEXT_PUBLIC_URL: z .string() .min(1, { message: 'NEXT_PUBLIC_URL is required' }) diff --git a/apps/web/src/context/BusterWebSocket/BusterWebSocketProvider/useBusterWebSocket.tsx b/apps/web/src/context/BusterWebSocket/BusterWebSocketProvider/useBusterWebSocket.tsx index ca6bf86de..2eb0e89d5 100644 --- a/apps/web/src/context/BusterWebSocket/BusterWebSocketProvider/useBusterWebSocket.tsx +++ b/apps/web/src/context/BusterWebSocket/BusterWebSocketProvider/useBusterWebSocket.tsx @@ -13,8 +13,7 @@ import { useMemoizedFn } from '@/hooks'; import { useWebSocket } from '@/hooks/useWebSocket'; import type { SupabaseContextReturnType } from '../../Supabase'; import { useSupabaseContext } from '../../Supabase'; - -const BUSTER_WS_URL = `${process.env.NEXT_PUBLIC_WEB_SOCKET_URL}/api/v1/ws`; +import { BUSTER_WS_URL } from './config'; export type BusterOnCallback = { callback: BusterSocketResponse['callback']; diff --git a/biome.json b/biome.json index 3b3f4cbb3..148bb4326 100644 --- a/biome.json +++ b/biome.json @@ -80,8 +80,8 @@ "trigger/**/*.js", "vitest.config.ts", "biome.json", - "package.json", - "turbo.json" + "./package.json", + "./turbo.json" ], "ignore": [ "**/node_modules/**", @@ -102,7 +102,7 @@ "packages/**/node_modules/**", "packages/**/dist/**", "packages/**/build/**", - "web/**" + "apps/web/**" ] }, "overrides": [ diff --git a/package.json b/package.json index f95666e41..1ca41b735 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,6 @@ "check": "biome check ${1:-.}", "check:fix": "biome check --write ${1:-.}", "ci:check": "pnpm run check && pnpm run typecheck", - "new:package": "bun run scripts/new-package.ts", "db:check": "pnpm --filter @buster/database run db:check", "db:generate": "pnpm --filter @buster/database run db:generate", "db:introspect": "pnpm --filter @buster/database run db:introspect", @@ -20,12 +19,13 @@ "db:studio": "pnpm --filter @buster/database run db:studio", "dev": "turbo dev", "dev:db-init": "turbo run dev:init --filter \"@buster/database\"", - "dev:server:reset": "pnpm run dev:db-init && turbo run dev --filter \"@buster-app/server\"", "dev:server": "turbo run dev --filter \"@buster-app/server\"", + "dev:server:reset": "pnpm run dev:db-init && turbo run dev --filter \"@buster-app/server\"", "evals": "bash scripts/evals.sh", "format": "biome format ${1:-.}", "format:fix": "biome format --write ${1:-.}", "lint": "turbo lint", + "new:package": "bun run scripts/new-package.ts", "test": "dotenv -e .env -- turbo test", "test:coverage": "turbo test:coverage", "test:ui": "vitest --ui", @@ -37,13 +37,15 @@ "typecheck": "turbo typecheck", "typescript": "^5.8.3" }, + "dependencies": { + "dotenv": "^16.5.0", + "dotenv-cli": "^8.0.0" + }, "devDependencies": { "@biomejs/biome": "^1.9.4", "@types/node": "^20.17.57", - "dotenv": "^16.5.0", - "dotenv-cli": "^8.0.0", - "vitest": "catalog:", - "turbo": "^2.5.4" + "turbo": "^2.5.4", + "vitest": "catalog:" }, "peerDependencies": { "bun": "^1.2.15", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b9c4e0dfa..0f544463e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -50,6 +50,12 @@ importers: bun: specifier: ^1.2.15 version: 1.2.16 + dotenv: + specifier: ^16.5.0 + version: 16.5.0 + dotenv-cli: + specifier: ^8.0.0 + version: 8.0.0 typescript: specifier: ^5 version: 5.8.3 @@ -60,12 +66,6 @@ importers: '@types/node': specifier: ^20.17.57 version: 20.19.1 - dotenv: - specifier: ^16.5.0 - version: 16.5.0 - dotenv-cli: - specifier: ^8.0.0 - version: 8.0.0 turbo: specifier: ^2.5.4 version: 2.5.4 @@ -18432,8 +18432,8 @@ snapshots: '@typescript-eslint/parser': 8.34.1(eslint@8.57.1)(typescript@5.8.3) eslint: 8.57.1 eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.34.1(eslint@8.57.1)(typescript@5.8.3))(eslint@8.57.1))(eslint@8.57.1) - eslint-plugin-import: 2.31.0(@typescript-eslint/parser@8.34.1(eslint@8.57.1)(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.34.1(eslint@8.57.1)(typescript@5.8.3))(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1) + eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.31.0)(eslint@8.57.1) + eslint-plugin-import: 2.31.0(@typescript-eslint/parser@8.34.1(eslint@8.57.1)(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1)(eslint@8.57.1) eslint-plugin-jsx-a11y: 6.10.2(eslint@8.57.1) eslint-plugin-react: 7.37.5(eslint@8.57.1) eslint-plugin-react-hooks: 5.2.0(eslint@8.57.1) @@ -18456,7 +18456,7 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.34.1(eslint@8.57.1)(typescript@5.8.3))(eslint@8.57.1))(eslint@8.57.1): + eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.31.0)(eslint@8.57.1): dependencies: '@nolyfill/is-core-module': 1.0.39 debug: 4.4.1 @@ -18467,22 +18467,22 @@ snapshots: tinyglobby: 0.2.14 unrs-resolver: 1.9.0 optionalDependencies: - eslint-plugin-import: 2.31.0(@typescript-eslint/parser@8.34.1(eslint@8.57.1)(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.34.1(eslint@8.57.1)(typescript@5.8.3))(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1) + eslint-plugin-import: 2.31.0(@typescript-eslint/parser@8.34.1(eslint@8.57.1)(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1)(eslint@8.57.1) transitivePeerDependencies: - supports-color - eslint-module-utils@2.12.0(@typescript-eslint/parser@8.34.1(eslint@8.57.1)(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.34.1(eslint@8.57.1)(typescript@5.8.3))(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1): + eslint-module-utils@2.12.0(@typescript-eslint/parser@8.34.1(eslint@8.57.1)(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1)(eslint@8.57.1): dependencies: debug: 3.2.7 optionalDependencies: '@typescript-eslint/parser': 8.34.1(eslint@8.57.1)(typescript@5.8.3) eslint: 8.57.1 eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.34.1(eslint@8.57.1)(typescript@5.8.3))(eslint@8.57.1))(eslint@8.57.1) + eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.31.0)(eslint@8.57.1) transitivePeerDependencies: - supports-color - eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.34.1(eslint@8.57.1)(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.34.1(eslint@8.57.1)(typescript@5.8.3))(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1): + eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.34.1(eslint@8.57.1)(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1)(eslint@8.57.1): dependencies: '@rtsao/scc': 1.1.0 array-includes: 3.1.9 @@ -18493,7 +18493,7 @@ snapshots: doctrine: 2.1.0 eslint: 8.57.1 eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.34.1(eslint@8.57.1)(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.34.1(eslint@8.57.1)(typescript@5.8.3))(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1) + eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.34.1(eslint@8.57.1)(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1)(eslint@8.57.1) hasown: 2.0.2 is-core-module: 2.16.1 is-glob: 4.0.3