Skip to content

armgit / E2B

Public Imported from GitHub
0

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

Fix URLs

Jakub Novakae062be52b51
diff --git a/apps/docs/next.config.mjs b/apps/docs/next.config.mjs
index 7e907e62d..c80029666 100644
--- a/apps/docs/next.config.mjs
+++ b/apps/docs/next.config.mjs
@@ -44,25 +44,37 @@ function getFilesHash(rootPath) {
const codeSnippetsDir = path.resolve('./src/code')
-/** @type {import('next').NextCofig} */
+/** @type {import('next').NextConfig} */
const nextConfig = {
pageExtensions: ['js', 'jsx', 'ts', 'tsx', 'mdx'],
- // basePath: '/docs',
+ basePath: '',
webpack: config => {
const codeFilesHash = getFilesHash(codeSnippetsDir)
config.cache.version = config.cache.version + delimiter + codeFilesHash
return config
},
- async redirects() {
- return [
- {
- source: '/',
- destination: '/dashboard',
- permanent: false,
- basePath: false,
- },
- ]
+ async rewrites() {
+ return {
+ afterFiles: [
+ {
+ source: '/ingest/:path*',
+ destination: 'https://app.posthog.com/:path*',
+ // BEWARE: setting basePath will break the analytics proxy
+ },
+ { source: '/:path*', destination: '/_404/:path*' },
+ ]
+ }
},
+ // async redirects() {
+ // return [
+ // {
+ // source: '/',
+ // destination: '/dashboard',
+ // permanent: false,
+ // basePath: false,
+ // },
+ // ]
+ // },
}
export default withSearch(
diff --git a/apps/docs/src/components/Dashboard/Personal.tsx b/apps/docs/src/components/Dashboard/Personal.tsx
index 7dc467769..cf7e77871 100644
--- a/apps/docs/src/components/Dashboard/Personal.tsx
+++ b/apps/docs/src/components/Dashboard/Personal.tsx
@@ -81,7 +81,7 @@ export const PersonalContent = ({user, accessToken}: {user: User, accessToken: s
<span className='font-bold text-neutral-300 pb-2'>Access token:</span>
<span className='text-sm text-neutral-300 pb-4'>
- This is your personal access token. It is used in CLI (e.g. for building new templates). You may need it for GitHub Actions or other CI/CD tools.
+ This is your personal access token. It is used in CLI (e.g. for building new templates). You can find more information in the <Link className='text-brand-500' href={'docs/getting-started/api-key'}>documentation</Link>.
</span>
<div className='flex w-full justify-between items-center border border-white/5 rounded-lg p-2 mb-4 space-x-4'>
<div
diff --git a/apps/docs/src/components/Header.tsx b/apps/docs/src/components/Header.tsx
index cbc39137a..9c1b19a58 100644
--- a/apps/docs/src/components/Header.tsx
+++ b/apps/docs/src/components/Header.tsx
@@ -94,9 +94,13 @@ export const Header = forwardRef(function Header({ className, isAuth }, ref) {
<HeaderSeparator />
<MobileSearch />
<div className="hidden min-[540px]:contents">
+ <Link className='hover:text-white hover:cursor-pointer text-sm text-neutral-400' href='/docs'>
+ Docs
+ </Link>
<Link className='hover:text-white hover:cursor-pointer text-sm text-neutral-400' href='/dashboard'>
Dashboard
</Link>
+ <HeaderSeparator />
<Auth />
</div>
</div>
diff --git a/apps/docs/src/components/Navigation/routes.tsx b/apps/docs/src/components/Navigation/routes.tsx
index 83365cdcd..d4302b582 100644
--- a/apps/docs/src/components/Navigation/routes.tsx
+++ b/apps/docs/src/components/Navigation/routes.tsx
@@ -77,7 +77,7 @@ export const routes = [
{
icon: <ShieldQuestion strokeWidth={1} size={20} />,
title: 'Getting help',
- href: 'docs/getting-help',
+ href: '/docs/getting-help',
},
],
},
@@ -121,12 +121,12 @@ export const routes = [
links: [
{
title: 'Installation',
- href: 'docs/code-interpreter/installation',
+ href: '/docs/code-interpreter/installation',
},
{
icon: <Terminal strokeWidth={1} size={20} />,
title: 'AI Code Execution',
- href: 'docs/code-interpreter/execution',
+ href: '/docs/code-interpreter/execution',
},
// {
// icon: <Book strokeWidth={1} size={20} />,
@@ -146,12 +146,12 @@ export const routes = [
{
icon: <Wrench strokeWidth={1} size={20} />,
title: 'Customization',
- href: 'docs/code-interpreter/template',
+ href: '/docs/code-interpreter/template',
},
{
icon: <Cog strokeWidth={1} size={20} />,
title: 'Kernels',
- href: 'docs/code-interpreter/kernels',
+ href: '/docs/code-interpreter/kernels',
},
],
},
@@ -160,67 +160,67 @@ export const routes = [
links: [
{
title: 'Overview',
- href: 'docs/sandbox/overview',
+ href: '/docs/sandbox/overview',
},
{
icon: <Cpu strokeWidth={1} size={20} />,
title: 'Compute',
- href: 'docs/sandbox/compute',
+ href: '/docs/sandbox/compute',
},
{
icon: <PencilRuler strokeWidth={1} size={20} />,
title: 'Customization',
- href: 'docs/sandbox/custom',
+ href: '/docs/sandbox/custom',
},
{
icon: <Variable strokeWidth={1} size={20} />,
title: 'Environment Variables',
- href: 'docs/sandbox/api/envs',
+ href: '/docs/sandbox/api/envs',
},
{
icon: <FolderTree strokeWidth={1} size={20} />,
title: 'Filesystem',
- href: 'docs/sandbox/api/filesystem',
+ href: '/docs/sandbox/api/filesystem',
},
{
icon: <ChevronRightSquare strokeWidth={1} size={20} />,
title: 'Process',
- href: 'docs/sandbox/api/process',
+ href: '/docs/sandbox/api/process',
},
{
icon: <Folder strokeWidth={1} size={20} />,
title: 'Working Directory',
- href: 'docs/sandbox/api/cwd',
+ href: '/docs/sandbox/api/cwd',
},
{
icon: <Link strokeWidth={1} size={20} />,
title: 'Sandbox URL',
- href: 'docs/sandbox/api/url',
+ href: '/docs/sandbox/api/url',
},
{
icon: <FileUp strokeWidth={1} size={20} />,
title: 'Upload Files',
- href: 'docs/sandbox/api/upload',
+ href: '/docs/sandbox/api/upload',
},
{
icon: <FileDown strokeWidth={1} size={20} />,
title: 'Download Files',
- href: 'docs/sandbox/api/download',
+ href: '/docs/sandbox/api/download',
},
{
icon: <Timer strokeWidth={1} size={20} />,
title: 'Timeouts',
- href: 'docs/sandbox/api/timeouts',
+ href: '/docs/sandbox/api/timeouts',
},
{
icon: <RefreshCw strokeWidth={1} size={20} />,
title: 'Connect to running sandbox',
- href: 'docs/sandbox/api/reconnect',
+ href: '/docs/sandbox/api/reconnect',
},
{
icon: <Braces strokeWidth={1} size={20} />,
title: 'Sandbox metadata',
- href: 'docs/sandbox/api/metadata',
+ href: '/docs/sandbox/api/metadata',
},
],
},
@@ -230,12 +230,12 @@ export const routes = [
{
icon: <Settings strokeWidth={1} size={20} />,
title: 'Installation',
- href: 'docs/cli/installation',
+ href: '/docs/cli/installation',
},
{
icon: <TerminalSquare strokeWidth={1} size={20} />,
title: 'Commands',
- href: 'docs/cli/commands',
+ href: '/docs/cli/commands',
},
],
},
@@ -244,27 +244,27 @@ export const routes = [
links: [
{
title: 'Overview',
- href: 'docs/sandbox/templates/overview',
+ href: '/docs/sandbox/templates/overview',
},
{
icon: <File strokeWidth={1} size={20} />,
title: 'Template File',
- href: 'docs/sandbox/templates/template-file',
+ href: '/docs/sandbox/templates/template-file',
},
{
icon: <PlaySquare strokeWidth={1} size={20} />,
title: 'Start Command',
- href: 'docs/sandbox/templates/start-cmd',
+ href: '/docs/sandbox/templates/start-cmd',
},
{
icon: <Hammer strokeWidth={1} size={20} />,
title: 'Guide: Creating Custom Sandbox',
- href: 'docs/guide/custom-sandbox',
+ href: '/docs/guide/custom-sandbox',
},
{
icon: <HardDrive strokeWidth={1} size={20} />,
title: 'Connecting buckets to persist data',
- href: 'docs/guide/connect-bucket',
+ href: '/docs/guide/connect-bucket',
},
],
},
diff --git a/apps/docs/src/utils/useUsage.tsx b/apps/docs/src/utils/useUsage.tsx
deleted file mode 100644
index 58109ef69..000000000
--- a/apps/docs/src/utils/useUsage.tsx
+++ /dev/null
@@ -1,57 +0,0 @@
-'use client'
-
-import {
- useEffect,
- useState,
- useCallback,
-} from 'react'
-
-import { useApiKey, useUser } from '@/utils/useUser'
-import { createPagesBrowserClient } from '@supabase/auth-helpers-nextjs'
-
-export interface MonthlyCosts {
- month: number
- year: number
- total_cost: number
- unpaid_cost: number
-}
-
-const usageUrl = `${process.env.NEXT_PUBLIC_BILLING_API_URL}/usage`
-
-export function useUsage() {
- const { user } = useUser()
- const apiKey = useApiKey()
- const [credits, setCredits] = useState<number | null>(null)
- const [usage, setUsage] = useState<MonthlyCosts[]>([])
- const [isLoading, setIsLoading] = useState(true)
- const supabase = createPagesBrowserClient()
-
- const fetchCredits = useCallback(async function fetchCredits() {
- if (!user) return
- const { teams } = user
- if (!teams || !supabase) return
- if (teams.length === 0) return
- if (!apiKey) return
-
- const teamUsage = await
- fetch(usageUrl, {
- headers: {
- 'X-Team-API-Key': apiKey,
- },
- }).then(res => res.json())
-
- setCredits(teamUsage.credits)
- setUsage(teamUsage.usages as MonthlyCosts[])
- setIsLoading(false)
- }, [user, supabase, apiKey])
-
- useEffect(function () {
- fetchCredits()
- }, [fetchCredits])
-
- return {
- credits,
- usage,
- isLoading,
- }
-}
\ No newline at end of file