fix(app): opencode web server url
parent
1041ae91d1
commit
4167e25c7e
|
|
@ -97,15 +97,10 @@ if (!(root instanceof HTMLElement) && import.meta.env.DEV) {
|
||||||
throw new Error(getRootNotFoundError())
|
throw new Error(getRootNotFoundError())
|
||||||
}
|
}
|
||||||
|
|
||||||
const localUrl = () =>
|
|
||||||
`http://${import.meta.env.VITE_OPENCODE_SERVER_HOST ?? "localhost"}:${import.meta.env.VITE_OPENCODE_SERVER_PORT ?? "4096"}`
|
|
||||||
|
|
||||||
const isLocalHost = () => ["localhost", "127.0.0.1", "0.0.0.0"].includes(location.hostname)
|
|
||||||
|
|
||||||
const getCurrentUrl = () => {
|
const getCurrentUrl = () => {
|
||||||
if (location.hostname.includes("opencode.ai")) return localUrl()
|
if (location.hostname.includes("opencode.ai")) return "http://localhost:4096"
|
||||||
if (import.meta.env.DEV) return localUrl()
|
if (import.meta.env.DEV)
|
||||||
if (isLocalHost()) return localUrl()
|
return `http://${import.meta.env.VITE_OPENCODE_SERVER_HOST ?? "localhost"}:${import.meta.env.VITE_OPENCODE_SERVER_PORT ?? "4096"}`
|
||||||
return location.origin
|
return location.origin
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue