Merge 2a38d6fbf3 into ae614d919f
commit
5684c685a0
|
|
@ -295,6 +295,7 @@ export function AppInterface(props: {
|
|||
<Dynamic
|
||||
component={props.router ?? Router}
|
||||
root={(routerProps) => <RouterRoot appChildren={props.children}>{routerProps.children}</RouterRoot>}
|
||||
base={import.meta.env.BASE_URL.replace(/\/$/, "") || undefined}
|
||||
>
|
||||
<Route path="/" component={HomeRoute} />
|
||||
<Route path="/:dir" component={DirectoryLayout}>
|
||||
|
|
|
|||
|
|
@ -98,10 +98,13 @@ 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"
|
||||
if (import.meta.env.DEV)
|
||||
return `http://${import.meta.env.VITE_OPENCODE_SERVER_HOST ?? "localhost"}:${import.meta.env.VITE_OPENCODE_SERVER_PORT ?? "4096"}`
|
||||
return location.origin
|
||||
return `http://${import.meta.env.VITE_OPENCODE_SERVER_HOST ?? "localhost"}:${import.meta.env.VITE_OPENCODE_SERVER_PORT ?? "4096"}{serverBaseUrl}`
|
||||
return location.origin + serverBaseUrl
|
||||
}
|
||||
|
||||
const getDefaultUrl = () => {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import "solid-js"
|
||||
|
||||
interface ImportMetaEnv {
|
||||
readonly BASE_URL: string
|
||||
readonly VITE_OPENCODE_SERVER_HOST: string
|
||||
readonly VITE_OPENCODE_SERVER_PORT: string
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import { defineConfig } from "vite"
|
|||
import desktopPlugin from "./vite"
|
||||
|
||||
export default defineConfig({
|
||||
base: process.env.VITE_BASE_URL || "/",
|
||||
plugins: [desktopPlugin] as any,
|
||||
server: {
|
||||
host: "0.0.0.0",
|
||||
|
|
|
|||
Loading…
Reference in New Issue