Compare commits

...
3 changed files with 11 additions and 2 deletions
+4
View File
@@ -42,6 +42,10 @@ const clearAuthToken = () => {
const web = createWebPlatform(pkg.version)
if ("serviceWorker" in navigator) {
window.addEventListener("load", () => void navigator.serviceWorker.register("/sw.js"), { once: true })
}
if (import.meta.env.VITE_SENTRY_DSN) {
init({
dsn: import.meta.env.VITE_SENTRY_DSN,
+6 -2
View File
@@ -54,8 +54,12 @@ export function createWebPlatform(version: string) {
function getCurrentServerUrl() {
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"}`
if (import.meta.env.DEV) {
const loopback =
location.hostname === "localhost" || location.hostname === "[::1]" || location.hostname.startsWith("127.")
const host = import.meta.env.VITE_OPENCODE_SERVER_HOST ?? (loopback ? location.hostname : "localhost")
return `http://${host}:${import.meta.env.VITE_OPENCODE_SERVER_PORT ?? "4096"}`
}
return location.origin
}
+1
View File
@@ -25,6 +25,7 @@ export default defineConfig({
desktopPlugin,
VitePWA({
strategies: "generateSW",
injectRegister: false,
manifest: false,
workbox: {
cleanupOutdatedCaches: true,