diff --git a/.env b/.env index 118568af..f31e0fa6 100644 --- a/.env +++ b/.env @@ -1,6 +1,6 @@ VITE_SUPABASE_PROJECT_ID="ydvtmnrszybqnbcqbdcy" VITE_SUPABASE_PUBLISHABLE_KEY="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InlkdnRtbnJzenlicW5iY3FiZGN5Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTgzMjYzNTYsImV4cCI6MjA3MzkwMjM1Nn0.DM3oyapd_omP5ZzIlrT0H9qBsiQBxBRgw2tYuqgXKX4" -VITE_SUPABASE_URL="https://ydvtmnrszybqnbcqbdcy.supabase.co" +VITE_SUPABASE_URL="https://api.thrillwiki.com" VITE_BASE_URL="https://www.thrillwiki.com" # Cloudflare Turnstile CAPTCHA diff --git a/.env.example b/.env.example index ef4279f5..2630d70a 100644 --- a/.env.example +++ b/.env.example @@ -1,7 +1,10 @@ # Supabase Configuration VITE_SUPABASE_PROJECT_ID=your-project-id VITE_SUPABASE_PUBLISHABLE_KEY=your-publishable-key -VITE_SUPABASE_URL=https://your-project-id.supabase.co +# Custom domain pointing to Supabase project (use your actual domain) +# For production: https://api.thrillwiki.com +# For development: https://ydvtmnrszybqnbcqbdcy.supabase.co (or your custom domain) +VITE_SUPABASE_URL=https://api.thrillwiki.com # Cloudflare Turnstile CAPTCHA (optional) # Get your site key from: https://dash.cloudflare.com/turnstile diff --git a/src/components/admin/NovuMigrationUtility.tsx b/src/components/admin/NovuMigrationUtility.tsx index e3456fab..f8b0da59 100644 --- a/src/components/admin/NovuMigrationUtility.tsx +++ b/src/components/admin/NovuMigrationUtility.tsx @@ -35,8 +35,9 @@ export function NovuMigrationUtility() { throw new Error('You must be logged in to run the migration'); } + const supabaseUrl = import.meta.env.VITE_SUPABASE_URL || 'https://api.thrillwiki.com'; const response = await fetch( - 'https://ydvtmnrszybqnbcqbdcy.supabase.co/functions/v1/migrate-novu-users', + `${supabaseUrl}/functions/v1/migrate-novu-users`, { method: 'POST', headers: { diff --git a/src/components/upload/PhotoUpload.tsx b/src/components/upload/PhotoUpload.tsx index a44edd63..4d6bd639 100644 --- a/src/components/upload/PhotoUpload.tsx +++ b/src/components/upload/PhotoUpload.tsx @@ -164,7 +164,7 @@ export function PhotoUpload({ const maxAttempts = 60; let attempts = 0; - const supabaseUrl = import.meta.env.VITE_SUPABASE_URL || 'https://ydvtmnrszybqnbcqbdcy.supabase.co'; + const supabaseUrl = import.meta.env.VITE_SUPABASE_URL || 'https://api.thrillwiki.com'; while (attempts < maxAttempts) { try { diff --git a/src/components/upload/UppyPhotoSubmissionUpload.tsx b/src/components/upload/UppyPhotoSubmissionUpload.tsx index 4f6d337b..21e778fa 100644 --- a/src/components/upload/UppyPhotoSubmissionUpload.tsx +++ b/src/components/upload/UppyPhotoSubmissionUpload.tsx @@ -129,12 +129,13 @@ export function UppyPhotoSubmissionUpload({ while (attempts < maxAttempts) { const { data: { session } } = await supabase.auth.getSession(); + const supabaseUrl = import.meta.env.VITE_SUPABASE_URL || 'https://api.thrillwiki.com'; const statusResponse = await fetch( - `https://ydvtmnrszybqnbcqbdcy.supabase.co/functions/v1/upload-image?id=${cloudflareId}`, + `${supabaseUrl}/functions/v1/upload-image?id=${cloudflareId}`, { headers: { 'Authorization': `Bearer ${session?.access_token || ''}`, - 'apikey': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InlkdnRtbnJzenlicW5iY3FiZGN5Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTgzMjYzNTYsImV4cCI6MjA3MzkwMjM1Nn0.DM3oyapd_omP5ZzIlrT0H9qBsiQBxBRgw2tYuqgXKX4', + 'apikey': import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY || 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InlkdnRtbnJzenlicW5iY3FiZGN5Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTgzMjYzNTYsImV4cCI6MjA3MzkwMjM1Nn0.DM3oyapd_omP5ZzIlrT0H9qBsiQBxBRgw2tYuqgXKX4', } } ); diff --git a/src/components/upload/UppyPhotoUpload.tsx b/src/components/upload/UppyPhotoUpload.tsx index 231606d3..e989edce 100644 --- a/src/components/upload/UppyPhotoUpload.tsx +++ b/src/components/upload/UppyPhotoUpload.tsx @@ -130,12 +130,13 @@ export function UppyPhotoUpload({ while (attempts < maxAttempts) { const { data: { session } } = await supabase.auth.getSession(); + const supabaseUrl = import.meta.env.VITE_SUPABASE_URL || 'https://api.thrillwiki.com'; const statusResponse = await fetch( - `https://ydvtmnrszybqnbcqbdcy.supabase.co/functions/v1/upload-image?id=${cloudflareId}`, + `${supabaseUrl}/functions/v1/upload-image?id=${cloudflareId}`, { headers: { 'Authorization': `Bearer ${session?.access_token || ''}`, - 'apikey': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InlkdnRtbnJzenlicW5iY3FiZGN5Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTgzMjYzNTYsImV4cCI6MjA3MzkwMjM1Nn0.DM3oyapd_omP5ZzIlrT0H9qBsiQBxBRgw2tYuqgXKX4', + 'apikey': import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY || 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InlkdnRtbnJzenlicW5iY3FiZGN5Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTgzMjYzNTYsImV4cCI6MjA3MzkwMjM1Nn0.DM3oyapd_omP5ZzIlrT0H9qBsiQBxBRgw2tYuqgXKX4', } } ); diff --git a/src/integrations/supabase/client.ts b/src/integrations/supabase/client.ts index 73e94ccd..4dd6fcb5 100644 --- a/src/integrations/supabase/client.ts +++ b/src/integrations/supabase/client.ts @@ -1,10 +1,10 @@ -// This file is automatically generated. Do not edit it directly. +// Note: This file uses environment variables for Supabase URL configuration. import { createClient } from '@supabase/supabase-js'; import type { Database } from './types'; import { authStorage } from '@/lib/authStorage'; -const SUPABASE_URL = "https://ydvtmnrszybqnbcqbdcy.supabase.co"; -const SUPABASE_PUBLISHABLE_KEY = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InlkdnRtbnJzenlicW5iY3FiZGN5Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTgzMjYzNTYsImV4cCI6MjA3MzkwMjM1Nn0.DM3oyapd_omP5ZzIlrT0H9qBsiQBxBRgw2tYuqgXKX4"; +const SUPABASE_URL = import.meta.env.VITE_SUPABASE_URL || "https://api.thrillwiki.com"; +const SUPABASE_PUBLISHABLE_KEY = import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY || "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InlkdnRtbnJzenlicW5iY3FiZGN5Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTgzMjYzNTYsImV4cCI6MjA3MzkwMjM1Nn0.DM3oyapd_omP5ZzIlrT0H9qBsiQBxBRgw2tYuqgXKX4"; // Import the supabase client like this: // import { supabase } from "@/integrations/supabase/client";