forked from Coder-soft/renderdragon.org
-
Notifications
You must be signed in to change notification settings - Fork 0
Testingbranch - Greptile Review #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
smb060606
wants to merge
4
commits into
main
Choose a base branch
from
testingbranch-greptile
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| import { createClient } from '@supabase/supabase-js'; | ||
|
|
||
| const corsHeaders = { | ||
| 'Access-Control-Allow-Origin': '*', | ||
| 'Access-Control-Allow-Methods': 'POST, OPTIONS', | ||
| 'Access-Control-Allow-Headers': 'Content-Type, Authorization', | ||
| }; | ||
|
|
||
| export default async function handler(req) { | ||
| if (req.method === 'OPTIONS') { | ||
| return new Response(null, { status: 204, headers: corsHeaders }); | ||
| } | ||
|
|
||
| if (req.method !== 'POST') { | ||
| return new Response(JSON.stringify({ error: 'Method not allowed' }), { | ||
| status: 405, | ||
| headers: { ...corsHeaders, 'Content-Type': 'application/json' }, | ||
| }); | ||
| } | ||
|
|
||
| try { | ||
| // Get the authorization header from the request | ||
| const authHeader = req.headers.authorization || req.headers.get?.('authorization'); | ||
|
|
||
| if (!authHeader || !authHeader.startsWith('Bearer ')) { | ||
| return new Response(JSON.stringify({ error: 'Missing or invalid authorization header' }), { | ||
| status: 401, | ||
| headers: { ...corsHeaders, 'Content-Type': 'application/json' }, | ||
| }); | ||
| } | ||
|
|
||
| const accessToken = authHeader.replace('Bearer ', ''); | ||
|
|
||
| // Create a client with the user's access token to verify their identity | ||
| const supabaseUrl = process.env.VITE_SUPABASE_URL || process.env.SUPABASE_URL; | ||
| const supabaseAnonKey = process.env.VITE_SUPABASE_ANON_KEY || process.env.SUPABASE_ANON_KEY; | ||
|
|
||
| // Check for Supabase secret key (service role) under various common names | ||
| const supabaseSecretKey = process.env.SUPABASE_SECRET_KEY | ||
| || process.env.SUPABASE_SERVICE_ROLE_KEY | ||
| || process.env.SUPABASE_SERVICE_ROLE_SECRET; | ||
|
|
||
| if (!supabaseUrl || !supabaseAnonKey) { | ||
| throw new Error('Supabase configuration missing'); | ||
| } | ||
|
|
||
| if (!supabaseSecretKey) { | ||
| throw new Error('Supabase secret key not configured. Set SUPABASE_SECRET_KEY in your environment.'); | ||
| } | ||
|
|
||
| // First, verify the user's token and get their user ID | ||
| const userClient = createClient(supabaseUrl, supabaseAnonKey, { | ||
| global: { | ||
| headers: { | ||
| Authorization: `Bearer ${accessToken}`, | ||
| }, | ||
| }, | ||
| }); | ||
|
|
||
| const { data: { user }, error: userError } = await userClient.auth.getUser(); | ||
|
|
||
| if (userError || !user) { | ||
| return new Response(JSON.stringify({ error: 'Invalid or expired session' }), { | ||
| status: 401, | ||
| headers: { ...corsHeaders, 'Content-Type': 'application/json' }, | ||
| }); | ||
| } | ||
|
|
||
| // Now use the admin client with secret key to delete the user | ||
| const adminClient = createClient(supabaseUrl, supabaseSecretKey, { | ||
| auth: { | ||
| autoRefreshToken: false, | ||
| persistSession: false, | ||
| }, | ||
| }); | ||
|
|
||
| const { error: deleteError } = await adminClient.auth.admin.deleteUser(user.id); | ||
|
|
||
| if (deleteError) { | ||
| console.error('Delete user error:', deleteError); | ||
| throw new Error(deleteError.message || 'Failed to delete account'); | ||
| } | ||
|
|
||
| return new Response(JSON.stringify({ success: true, message: 'Account deleted successfully' }), { | ||
| status: 200, | ||
| headers: { ...corsHeaders, 'Content-Type': 'application/json' }, | ||
| }); | ||
|
|
||
| } catch (error) { | ||
| console.error('Account deletion error:', error); | ||
| const message = error instanceof Error ? error.message : 'Failed to delete account'; | ||
| return new Response(JSON.stringify({ error: message }), { | ||
| status: 500, | ||
| headers: { ...corsHeaders, 'Content-Type': 'application/json' }, | ||
| }); | ||
| } | ||
| } | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,48 +1,42 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
| <title> | ||
| Renderdragon - Minecraft Content Creator Tools & Assets | ||
| </title> | ||
| <meta name="google-site-verification" content="_1Znm2uL6EbALUvDw11BNaWNKQQ716QK-tixIKVEf3c" /> | ||
| <meta | ||
| name="description" | ||
| content="Your ultimate toolkit for creating Minecraft YouTube content. Get free tools, assets, music, and guides—all ad-free." | ||
| /> | ||
| <meta name="keywords" content="Minecraft, YouTube, Content Creator, Tools, Assets, Free, Music, SFX, Animations, Fonts, Images, Premiere Pro Presets, DaVinci Resolve Presets, AI Title Helper, YouTube Downloader, Copyright Checker, Renderdragon" /> | ||
| <meta name="author" content="Team Wheels" /> | ||
| <link rel="canonical" href="https://renderdragon.org" /> | ||
|
|
||
| <meta property="og:title" content="Renderdragon - Minecraft YouTube Tools & Assets" /> | ||
| <meta | ||
| property="og:description" | ||
| content="Your ultimate toolkit for creating Minecraft YouTube content. Get free tools, assets, music, and guides—all ad-free." | ||
| /> | ||
| <meta property="og:type" content="website" /> | ||
| <meta property="og:url" content="https://renderdragon.org" /> | ||
| <meta property="og:site_name" content="Renderdragon" /> | ||
| <meta property="og:image" content="https://renderdragon.org/ogimg.png" /> | ||
|
|
||
| <!-- Twitter --> | ||
| <meta name="twitter:card" content="summary_large_image" /> | ||
| <meta name="twitter:site" content="@renderdragon" /> | ||
| <meta | ||
| name="twitter:title" | ||
| content="Renderdragon - Minecraft YouTube Tools & Assets" | ||
| /> | ||
| <meta | ||
| name="twitter:description" | ||
| content="Your ultimate toolkit for creating Minecraft YouTube content. Get free tools, assets, music, and guides—all ad-free." | ||
| /> | ||
| <meta name="twitter:image" content="https://renderdragon.org/ogimg.png" /> | ||
|
|
||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
| <title> | ||
| Renderdragon - Minecraft Content Creator Tools & Assets | ||
| </title> | ||
| <meta name="google-site-verification" content="_1Znm2uL6EbALUvDw11BNaWNKQQ716QK-tixIKVEf3c" /> | ||
| <meta name="description" | ||
| content="Your ultimate toolkit for creating Minecraft YouTube content. Get free tools, assets, music, and guides—all ad-free." /> | ||
| <meta name="keywords" | ||
| content="Minecraft, YouTube, Content Creator, Tools, Assets, Free, Music, SFX, Animations, Fonts, Images, Premiere Pro Presets, DaVinci Resolve Presets, AI Title Helper, YouTube Downloader, Copyright Checker, Renderdragon" /> | ||
| <meta name="author" content="Team Wheels" /> | ||
| <link rel="canonical" href="https://renderdragon.org" /> | ||
|
|
||
| <meta property="og:title" content="Renderdragon - Minecraft YouTube Tools & Assets" /> | ||
| <meta property="og:description" | ||
| content="Your ultimate toolkit for creating Minecraft YouTube content. Get free tools, assets, music, and guides—all ad-free." /> | ||
| <meta property="og:type" content="website" /> | ||
| <meta property="og:url" content="https://renderdragon.org" /> | ||
| <meta property="og:site_name" content="Renderdragon" /> | ||
| <meta property="og:image" content="https://renderdragon.org/ogimg.png" /> | ||
|
|
||
| <!-- Twitter --> | ||
| <meta name="twitter:card" content="summary_large_image" /> | ||
| <meta name="twitter:site" content="@renderdragon" /> | ||
| <meta name="twitter:title" content="Renderdragon - Minecraft YouTube Tools & Assets" /> | ||
| <meta name="twitter:description" | ||
| content="Your ultimate toolkit for creating Minecraft YouTube content. Get free tools, assets, music, and guides—all ad-free." /> | ||
| <meta name="twitter:image" content="https://renderdragon.org/ogimg.png" /> | ||
| <link rel="icon" type="image/png" href="https://renderdragon.org/renderdragon.png"> | ||
| </head> | ||
|
|
||
| </head> | ||
|
|
||
|
|
||
| <body> | ||
| <div id="root"></div> | ||
| <script type="module" src="/src/main.tsx"></script> | ||
| </body> | ||
|
|
||
| <body> | ||
| <div id="root"></div> | ||
| <script type="module" src="/src/main.tsx"></script> | ||
| </body> | ||
| </html> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: CORS set to allow all origins (
*) for account deletion endpointPrompt To Fix With AI