diff --git a/ui/desktop/index.html b/ui/desktop/index.html index babfafbae..a871050a6 100644 --- a/ui/desktop/index.html +++ b/ui/desktop/index.html @@ -3,7 +3,7 @@ Goose - +
- + diff --git a/ui/desktop/src/main.ts b/ui/desktop/src/main.ts index 9fc43811c..aab65e6d9 100644 --- a/ui/desktop/src/main.ts +++ b/ui/desktop/src/main.ts @@ -190,9 +190,28 @@ const createChat = async (app, query?: string, dir?: string, version?: string) = if (MAIN_WINDOW_VITE_DEV_SERVER_URL) { mainWindow.loadURL(`${MAIN_WINDOW_VITE_DEV_SERVER_URL}${queryParam}`); } else { - mainWindow.loadFile(path.join(__dirname, `../renderer/${MAIN_WINDOW_VITE_NAME}/index.html`), { - search: queryParam.slice(1), - }); + // In production, we need to use a proper file protocol URL with correct base path + const indexPath = path.join(__dirname, `../renderer/${MAIN_WINDOW_VITE_NAME}/index.html`); + console.log('Loading production path:', indexPath); + mainWindow + .loadFile(indexPath, { + search: queryParam ? queryParam.slice(1) : undefined, + }) + .catch((err) => { + console.error('Failed to load window:', err); + // Try alternative path if first attempt fails + const altPath = path.join( + app.getAppPath(), + 'out', + 'renderer', + MAIN_WINDOW_VITE_NAME, + 'index.html' + ); + console.log('Trying alternative path:', altPath); + return mainWindow.loadFile(altPath, { + search: queryParam ? queryParam.slice(1) : undefined, + }); + }); } // DevTools shortcut management @@ -206,14 +225,19 @@ const createChat = async (app, query?: string, dir?: string, version?: string) = globalShortcut.unregister('Alt+Command+I'); }; - // Register shortcut when window is focused + // Register shortcuts when window is focused mainWindow.on('focus', () => { registerDevToolsShortcut(mainWindow); + // Register reload shortcut + globalShortcut.register('CommandOrControl+R', () => { + mainWindow.reload(); + }); }); - // Unregister shortcut when window loses focus + // Unregister shortcuts when window loses focus mainWindow.on('blur', () => { unregisterDevToolsShortcut(); + globalShortcut.unregister('CommandOrControl+R'); }); windowMap.set(windowId, mainWindow); diff --git a/ui/desktop/src/renderer.tsx b/ui/desktop/src/renderer.tsx index 09ab60fc4..6353c4fcc 100644 --- a/ui/desktop/src/renderer.tsx +++ b/ui/desktop/src/renderer.tsx @@ -1,6 +1,6 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; -import { BrowserRouter as Router } from 'react-router-dom'; +import { HashRouter as Router } from 'react-router-dom'; import App from './App'; // Error Boundary Component diff --git a/ui/desktop/vite.config.mts b/ui/desktop/vite.config.mts index fb6c807a1..984755bba 100644 --- a/ui/desktop/vite.config.mts +++ b/ui/desktop/vite.config.mts @@ -5,6 +5,7 @@ import { resolve } from 'path'; // https://vitejs.dev/config export default defineConfig({ plugins: [react()], + base: './', build: { rollupOptions: { input: {