diff --git a/ui/desktop/src/main.ts b/ui/desktop/src/main.ts index e471df645..816ef1292 100644 --- a/ui/desktop/src/main.ts +++ b/ui/desktop/src/main.ts @@ -57,7 +57,6 @@ import './utils/gitBranchIpc'; import './utils/recipeHash'; import type { GooseApp } from './types/apps'; import installExtension, { REACT_DEVELOPER_TOOLS } from 'electron-devtools-installer'; -import { WEB_PROTOCOLS } from './utils/urlSecurity'; import { openExternalUrl } from './utils/openExternalUrl'; import { buildCSP, leaseBackendOrigin, shouldApplyRendererCsp } from './utils/csp'; import { resolveWorkingDir } from './utils/workingDir'; @@ -2922,32 +2921,6 @@ async function appMain() { } }); - ipcMain.on('open-in-chrome', (_event, url) => { - try { - // Validate URL - const parsedUrl = new URL(url); - - // Only allow http and https protocols for browser URLs - if (!WEB_PROTOCOLS.includes(parsedUrl.protocol)) { - console.error('Invalid URL protocol. Only HTTP and HTTPS are allowed.'); - return; - } - - // On macOS, use the 'open' command with Chrome - if (process.platform === 'darwin') { - spawn('open', ['-a', 'Google Chrome', url]); - } else if (process.platform === 'win32') { - // On Windows, start is built-in command of cmd.exe - spawn('cmd.exe', ['/c', 'start', '', 'chrome', url]); - } else { - // On Linux, use xdg-open with chrome - spawn('xdg-open', [url]); - } - } catch (error) { - console.error('Error opening URL in browser:', error); - } - }); - // Handle app restart ipcMain.on('restart-app', () => { app.relaunch(); diff --git a/ui/desktop/src/preload.ts b/ui/desktop/src/preload.ts index 261bff10c..34d99953f 100644 --- a/ui/desktop/src/preload.ts +++ b/ui/desktop/src/preload.ts @@ -109,7 +109,6 @@ type ElectronAPI = { showNotification: (data: NotificationData) => void; showMessageBox: (options: MessageBoxOptions) => Promise; showSaveDialog: (options: SaveDialogOptions) => Promise; - openInChrome: (url: string) => void; reloadApp: () => void; checkForOllama: () => Promise; selectFileOrDirectory: (defaultPath?: string) => Promise; @@ -211,7 +210,6 @@ const electronAPI: ElectronAPI = { showNotification: (data: NotificationData) => ipcRenderer.send('notify', data), showMessageBox: (options: MessageBoxOptions) => ipcRenderer.invoke('show-message-box', options), showSaveDialog: (options: SaveDialogOptions) => ipcRenderer.invoke('show-save-dialog', options), - openInChrome: (url: string) => ipcRenderer.send('open-in-chrome', url), reloadApp: () => ipcRenderer.send('reload-app'), checkForOllama: () => ipcRenderer.invoke('check-ollama'),