The open source coding agent.
TypeScript
app: make localhost urls work in isLocal
Brendan Allan50883cc1e995
diff --git a/packages/app/src/context/server.tsx b/packages/app/src/context/server.tsxindex 389371702eb..3849bb6ae75 100644--- a/packages/app/src/context/server.tsx+++ b/packages/app/src/context/server.tsx@@ -24,11 +24,15 @@ export function serverDisplayName(conn?: ServerConnection.Any) {function projectsKey(key: ServerConnection.Key) {if (!key) return ""if (key === "sidecar") return "local"- const host = key.replace(/^https?:\/\//, "").split(":")[0]- if (host === "localhost" || host === "127.0.0.1") return "local"+ if (isLocalHost(key)) return "local"return key}+function isLocalHost(url: string) {+ const host = url.replace(/^https?:\/\//, "").split(":")[0]+ if (host === "localhost" || host === "127.0.0.1") return "local"+}+export namespace ServerConnection {type Base = { displayName?: string }@@ -197,7 +201,7 @@ export const { use: useServer, provider: ServerProvider } = createSimpleContext()const isLocal = createMemo(() => {const c = current()- return c?.type === "sidecar" && c.variant === "base"+ return (c?.type === "sidecar" && c.variant === "base") || (c?.type === "http" && isLocalHost(c.http.url))})return {