11/* 
2- Copyright 2024 API Testing Authors. 
2+ Copyright 2024-2025  API Testing Authors. 
33
44Licensed under the Apache License, Version 2.0 (the "License"); 
55you may not use this file except in compliance with the License. 
@@ -117,22 +117,44 @@ menu.append(new MenuItem({
117117Menu . setApplicationMenu ( menu ) 
118118
119119let  serverProcess ; 
120+ let  serverPort  =  7788 ; 
121+ let  extensionRegistry  =  "ghcr.io" ; 
122+ let  downloadTimeout  =  "1m" ; 
123+ 
120124// This method will be called when Electron has finished 
121125// initialization and is ready to create browser windows. 
122126// Some APIs can only be used after this event occurs. 
123127app . whenReady ( ) . then ( ( )  =>  { 
124128  ipcMain . on ( 'openLogDir' ,  ( )  =>  { 
125129    shell . openExternal ( 'file://'  +  server . getLogfile ( ) ) 
126130  } ) 
131+   ipcMain . handle ( 'openWithExternalBrowser' ,  ( e ,  address )  =>  { 
132+     shell . openExternal ( address ) 
133+   } ) 
127134  ipcMain . on ( 'startServer' ,  startServer ) 
128135  ipcMain . on ( 'stopServer' ,  stopServer ) 
129136  ipcMain . on ( 'control' ,  ( e ,  okCallback ,  errCallback )  =>  { 
130137    server . control ( okCallback ,  errCallback ) 
131138  } ) 
132-   ipcMain . handle ( 'getHomePage' ,  server . getHomePage ) 
133139  ipcMain . handle ( 'getPort' ,  ( )  =>  { 
134-     return  server . getPort ( ) 
140+     return  serverPort 
141+   } ) 
142+   ipcMain . handle ( 'setPort' ,  ( e ,  port )  =>  { 
143+     serverPort  =  port ; 
144+   } ) 
145+   ipcMain . handle ( 'getExtensionRegistry' ,  ( )  =>  { 
146+     return  extensionRegistry 
135147  } ) 
148+   ipcMain . handle ( 'setExtensionRegistry' ,  ( e ,  registry )  =>  { 
149+     extensionRegistry  =  registry 
150+   } ) 
151+   ipcMain . handle ( 'getDownloadTimeout' ,  ( )  =>  { 
152+     return  downloadTimeout 
153+   } ) 
154+   ipcMain . handle ( 'setDownloadTimeout' ,  ( e ,  timeout )  =>  { 
155+     downloadTimeout  =  timeout 
156+   } ) 
157+   ipcMain . handle ( 'getHomePage' ,  server . getHomePage ) 
136158  ipcMain . handle ( 'getHealthzUrl' ,  server . getHealthzUrl ) 
137159
138160  startServer ( ) 
@@ -179,8 +201,10 @@ const startServer = () => {
179201
180202  serverProcess  =  spawn ( atestFromHome ,  [ 
181203    "server" , 
182-     " --http-port" ,   server . getPort ( ) , 
204+     ` --http-port= ${ serverPort } ` , 
183205    "--port=0" , 
206+     `--download-timeout=${ downloadTimeout }  ` , 
207+     `--extension-registry=${ extensionRegistry }  ` , 
184208    "--local-storage" ,  path . join ( homeData ,  "*.yaml" ) 
185209  ] ) 
186210  serverProcess . stdout . on ( 'data' ,  ( data )  =>  { 
@@ -222,4 +246,4 @@ function getLogLevel() {
222246} 
223247
224248// In this file you can include the rest of your app's specific main process 
225- // code. You can also put them in separate files and require them here. 
249+ // code. You can also put them in separate files and require them here. 
0 commit comments