@@ -11,14 +11,14 @@ import {
1111} from '@puppeteer/browsers'
1212import { t } from '@/i18n'
1313
14- const launch_browser = (
15- executable_path : string ,
16- user_data_dir : string ,
14+ const launch_browser = ( params : {
15+ executable_path : string
16+ user_data_dir : string
1717 extension_path : string
18- ) => {
18+ } ) => {
1919 const args = [
20- `--user-data-dir=${ user_data_dir } ` ,
21- `--load-extension=${ extension_path } ` ,
20+ `--user-data-dir=${ params . user_data_dir } ` ,
21+ `--load-extension=${ params . extension_path } ` ,
2222 '--disable-infobars' ,
2323 '--no-first-run'
2424 ]
@@ -29,7 +29,7 @@ const launch_browser = (
2929 args . push ( '--password-store=basic' )
3030 }
3131
32- const child = spawn ( executable_path , args , {
32+ const child = spawn ( params . executable_path , args , {
3333 detached : true ,
3434 stdio : 'ignore'
3535 } )
@@ -75,7 +75,7 @@ export const handle_run_browser = async () => {
7575 if ( fs . existsSync ( cached_path_file ) ) {
7676 const executable_path = fs . readFileSync ( cached_path_file , 'utf-8' ) . trim ( )
7777 if ( fs . existsSync ( executable_path ) ) {
78- launch_browser ( executable_path , user_data_dir , extension_path )
78+ launch_browser ( { executable_path, user_data_dir, extension_path } )
7979 return
8080 }
8181 }
@@ -131,7 +131,7 @@ export const handle_run_browser = async () => {
131131 }
132132
133133 fs . writeFileSync ( cached_path_file , executable_path )
134- launch_browser ( executable_path , user_data_dir , extension_path )
134+ launch_browser ( { executable_path, user_data_dir, extension_path } )
135135 } catch ( error : any ) {
136136 if ( error . message === 'Download cancelled' ) {
137137 return
0 commit comments