Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

delete old endpoints

ErikKaumk31995c62e9bf
diff --git a/apps/docs/src/app/(main)/api/create-api-key/route.ts b/apps/docs/src/app/(main)/api/create-api-key/route.ts
deleted file mode 100644
index 66aaae8d5..000000000
--- a/apps/docs/src/app/(main)/api/create-api-key/route.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-export const dynamic = 'force-dynamic' // static by default, unless reading the request
-export const runtime = 'nodejs'
-
-import { createClient } from '@supabase/supabase-js'
-import { randomBytes } from 'crypto'
-
-const supabase = createClient(
- process.env.NEXT_PUBLIC_SUPABASE_URL!,
- process.env.SUPABASE_SERVICE_ROLE_KEY!,
-)
-
-const generateApiKey = (): string => {
- const keyPrefix = 'e2b_'
- const randomPart = randomBytes(20).toString('hex') // 20 bytes = 40 hex characters
- const apiKey = `${keyPrefix}${randomPart}`
- return apiKey
-}
-
-// TODO this needs some auth
-export async function POST(request: Request) {
-
- const { teamId } = await request.json()
-
- const newKey = {
- team_id: teamId,
- api_key: generateApiKey(),
- created_at: new Date().toISOString(),
- }
-
- const { error } = await supabase
- .from('team_api_keys')
- .insert(newKey)
-
- if (error) {
- // TODO: Add sentry event here
- console.log(error)
- return new Response('Failed creating new api key', { status: 503 })
- }
-
- return new Response(JSON.stringify({ api_key: newKey.api_key, createdAt: newKey.created_at }), { status: 200 })
-
-}
-
diff --git a/apps/docs/src/app/(main)/api/create-new-team/route.ts b/apps/docs/src/app/(main)/api/create-new-team/route.ts
deleted file mode 100644
index 36640073c..000000000
--- a/apps/docs/src/app/(main)/api/create-new-team/route.ts
+++ /dev/null
@@ -1,67 +0,0 @@
-export const dynamic = 'force-dynamic' // static by default, unless reading the request
-export const runtime = 'nodejs'
-
-import { Team } from '@/utils/useUser'
-import { createClient } from '@supabase/supabase-js'
-import { uniqueNamesGenerator, Config, adjectives, colors } from 'unique-names-generator'
-
-const supabase = createClient(
- process.env.NEXT_PUBLIC_SUPABASE_URL!,
- process.env.SUPABASE_SERVICE_ROLE_KEY!,
-)
-
-const customConfig: Config = {
- dictionaries: [adjectives, colors],
- separator: '-',
- length: 2,
-}
-
-// TODO this needs some auth
-export async function POST(request: Request) {
-
- const { email, user_id } = await request.json()
-
- const newTeam = {
- name: uniqueNamesGenerator(customConfig),
- is_default: false,
- is_blocked: false,
- email: email,
- is_banned: false,
- blocked_reason: null,
- tier: 'base_v1',
- }
-
- const { data: team, error } = await supabase
- .from('teams')
- .insert(newTeam)
- .select()
-
- if (error) {
- // TODO: Add sentry event here
- console.log(error)
- return new Response('Failed creating new team', { status: 503 })
- }
-
-
- let insertedTeam: Team
- try {
- insertedTeam = team[0] as Team
- }
- catch (e) {
- console.log(e)
- return new Response('Failed creating new team', { status: 503 })
- }
-
- const data = await supabase
- .from('users_teams')
- .insert({ user_id: user_id, team_id: insertedTeam.id })
-
- if (data.error) {
- // TODO: Add sentry event here
- console.log(data.error)
- return new Response('Failed creating new team', { status: 503 })
- }
-
- return new Response(JSON.stringify({ team: insertedTeam }), { status: 200 })
-}
-