فهرست منبع

fix: opencode web command

Adam 2 ماه پیش
والد
کامیت
de415be4f6
2فایلهای تغییر یافته به همراه5 افزوده شده و 5 حذف شده
  1. 2 2
      packages/opencode/src/cli/cmd/web.ts
  2. 3 3
      packages/opencode/src/server/server.ts

+ 2 - 2
packages/opencode/src/cli/cmd/web.ts

@@ -55,7 +55,7 @@ export const WebCommand = cmd({
 
 
     if (hostname === "0.0.0.0") {
     if (hostname === "0.0.0.0") {
       // Show localhost for local access
       // Show localhost for local access
-      const localhostUrl = `http://localhost:${server.port}`
+      const localhostUrl = `http://localhost:${server.port}/web`
       UI.println(UI.Style.TEXT_INFO_BOLD + "  Local access:      ", UI.Style.TEXT_NORMAL, localhostUrl)
       UI.println(UI.Style.TEXT_INFO_BOLD + "  Local access:      ", UI.Style.TEXT_NORMAL, localhostUrl)
 
 
       // Show network IPs for remote access
       // Show network IPs for remote access
@@ -73,7 +73,7 @@ export const WebCommand = cmd({
       // Open localhost in browser
       // Open localhost in browser
       open(localhostUrl.toString()).catch(() => {})
       open(localhostUrl.toString()).catch(() => {})
     } else {
     } else {
-      const displayUrl = server.url.toString()
+      const displayUrl = server.url.toString() + "web"
       UI.println(UI.Style.TEXT_INFO_BOLD + "  Web interface:    ", UI.Style.TEXT_NORMAL, displayUrl)
       UI.println(UI.Style.TEXT_INFO_BOLD + "  Web interface:    ", UI.Style.TEXT_NORMAL, displayUrl)
       open(displayUrl).catch(() => {})
       open(displayUrl).catch(() => {})
     }
     }

+ 3 - 3
packages/opencode/src/server/server.ts

@@ -2371,11 +2371,11 @@ export namespace Server {
           })
           })
         },
         },
       )
       )
-      .all("/*", async (c) => {
-        return proxy(`https://desktop.dev.opencode.ai${c.req.path}`, {
+      .all("/web/*", async (c) => {
+        return proxy(`https://desktop.opencode.ai${c.req.path.replace(/^\/web/, "")}?=url=/web`, {
           ...c.req,
           ...c.req,
           headers: {
           headers: {
-            host: "desktop.dev.opencode.ai",
+            host: "desktop.opencode.ai",
           },
           },
         })
         })
       }),
       }),