Remove unused open-in-chrome IPC handler (#12455)

This commit is contained in:
Michael Neale
2026-10-14 19:20:02 +00:00
committed by GitHub
parent 0505d4bd2d
commit d7592d5ded
2 changed files with 0 additions and 29 deletions
-27
View File
@@ -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();
-2
View File
@@ -109,7 +109,6 @@ type ElectronAPI = {
showNotification: (data: NotificationData) => void;
showMessageBox: (options: MessageBoxOptions) => Promise<MessageBoxResponse>;
showSaveDialog: (options: SaveDialogOptions) => Promise<SaveDialogResponse>;
openInChrome: (url: string) => void;
reloadApp: () => void;
checkForOllama: () => Promise<boolean>;
selectFileOrDirectory: (defaultPath?: string) => Promise<string | null>;
@@ -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'),