From 50883cc1e995df3f14e31bdc1b5efa0d70b5ac51 Mon Sep 17 00:00:00 2001
From: Brendan Allan <git@brendonovich.dev>
Date: Fri, 20 Feb 2026 01:38:39 +0800
Subject: app: make localhost urls work in isLocal

---
 packages/app/src/context/server.tsx | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

(limited to 'packages/app/src/context/server.tsx')

diff --git a/packages/app/src/context/server.tsx b/packages/app/src/context/server.tsx
index 389371702..3849bb6ae 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 {
-- 
cgit v1.2.3

