Skip to content

armgit / E2B

Public Imported from GitHub
0

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

Correctly parse the API URL in dashboard

Vasek Mlejnsky49849f38bdd7
diff --git a/apps/web/src/components/Dashboard/Developer.tsx b/apps/web/src/components/Dashboard/Developer.tsx
index b3bd86b59..f2c3eda74 100644
--- a/apps/web/src/components/Dashboard/Developer.tsx
+++ b/apps/web/src/components/Dashboard/Developer.tsx
@@ -20,6 +20,14 @@ export const DeveloperContent = ({
}
}
+ function removeApiSubdomain(url: URL): string {
+ const hostParts = url.host.split('.')
+ if (hostParts.length > 2 && hostParts[0] === 'api') {
+ return hostParts.slice(1).join('.')
+ }
+ return url.host
+ }
+
return (
<div className="flex flex-col w-full">
<div className="flex flex-col h-full">
@@ -45,7 +53,7 @@ export const DeveloperContent = ({
<pre className="mt-2 w-full bg-neutral-700 px-2 py-1 rounded-md text-brand-300">
E2B_DOMAIN={
isUrl(apiUrl)
- ? `"${new URL(apiUrl).host}"`
+ ? `"${removeApiSubdomain(new URL(apiUrl))}"`
: 'Invalid URL'
}
</pre>