File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 77 BrowserWindow ,
88 Menu ,
99 type MenuItemConstructorOptions ,
10+ shell ,
1011} from "electron" ;
1112import { registerAgentIpc , type TaskController } from "./services/agent.js" ;
1213import { registerOsIpc } from "./services/os.js" ;
@@ -36,6 +37,21 @@ function ensureClaudeConfigDir(): void {
3637 process . env . CLAUDE_CONFIG_DIR = claudeDir ;
3738}
3839
40+ function setupExternalLinkHandlers ( window : BrowserWindow ) : void {
41+ window . webContents . setWindowOpenHandler ( ( { url } ) => {
42+ shell . openExternal ( url ) ;
43+ return { action : "deny" } ;
44+ } ) ;
45+
46+ window . webContents . on ( "will-navigate" , ( event , url ) => {
47+ const appUrl = isDev ? "http://localhost:5173" : "file://" ;
48+ if ( ! url . startsWith ( appUrl ) ) {
49+ event . preventDefault ( ) ;
50+ shell . openExternal ( url ) ;
51+ }
52+ } ) ;
53+ }
54+
3955function createWindow ( ) : void {
4056 mainWindow = new BrowserWindow ( {
4157 width : 900 ,
@@ -57,6 +73,8 @@ function createWindow(): void {
5773 mainWindow ?. show ( ) ;
5874 } ) ;
5975
76+ setupExternalLinkHandlers ( mainWindow ) ;
77+
6078 // Set up menu for keyboard shortcuts
6179 const template : MenuItemConstructorOptions [ ] = [
6280 {
You can’t perform that action at this time.
0 commit comments