File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -97,13 +97,14 @@ if (!(root instanceof HTMLElement) && import.meta.env.DEV) {
9797}
9898
9999const getCurrentUrl = ( ) => {
100- let serverBaseUrl = import . meta. env . VITE_OPENCODE_SERVER_BASE_URL ?? ""
101- // Normalizing slashes. Add starting slash if needed, remove trailing slash. Default value will be empty string.
102- serverBaseUrl = ( "/" + serverBaseUrl . replace ( / ^ \/ / , "" ) ) . replace ( / \/ $ / , "" )
103100 if ( location . hostname . includes ( "opencode.ai" ) ) return "http://localhost:4096"
104- if ( import . meta. env . DEV )
105- return `http://${ import . meta. env . VITE_OPENCODE_SERVER_HOST ?? "localhost" } :${ import . meta. env . VITE_OPENCODE_SERVER_PORT ?? "4096" } ${ serverBaseUrl } `
106- return location . origin + serverBaseUrl
101+ const url = new URL (
102+ import . meta. env . DEV
103+ ? `http://${ import . meta. env . VITE_OPENCODE_SERVER_HOST ?? "localhost" } :${ import . meta. env . VITE_OPENCODE_SERVER_PORT ?? "4096" } `
104+ : location . origin ,
105+ )
106+ url . pathname = import . meta. env . VITE_OPENCODE_SERVER_BASE_URL ?? ""
107+ return url . href
107108}
108109
109110const getDefaultUrl = ( ) => {
You can’t perform that action at this time.
0 commit comments