Normalized the URL slashes
parent
ad930e0ba2
commit
2a38d6fbf3
|
|
@ -98,9 +98,10 @@ if (!(root instanceof HTMLElement) && import.meta.env.DEV) {
|
|||
}
|
||||
|
||||
const getCurrentUrl = () => {
|
||||
let serverBaseUrl = import.meta.env.VITE_OPENCODE_SERVER_BASE_URL ?? ""
|
||||
// Normalizing slashes. Add starting slash if needed, remove trailing slash. Default value will be empty string.
|
||||
serverBaseUrl = ("/" + serverBaseUrl.replace(/^\//, "")).replace(/\/$/, "")
|
||||
if (location.hostname.includes("opencode.ai")) return "http://localhost:4096"
|
||||
const serverBaseUrl =
|
||||
"/" + (import.meta.env.VITE_OPENCODE_SERVER_BASE_URL ?? "/").replace(/^\//, "").replace(/\/$/, "")
|
||||
if (import.meta.env.DEV)
|
||||
return `http://${import.meta.env.VITE_OPENCODE_SERVER_HOST ?? "localhost"}:${import.meta.env.VITE_OPENCODE_SERVER_PORT ?? "4096"}{serverBaseUrl}`
|
||||
return location.origin + serverBaseUrl
|
||||
|
|
|
|||
Loading…
Reference in New Issue