@@ -6,10 +6,10 @@ import { createLogger } from "../utils/log";
66import  {  createNanoEvents ,  type  Emitter  }  from  "nanoevents" ; 
77import  {  PortManager  }  from  "../utils/port" ; 
88import  {  Winboat  }  from  "./winboat" ; 
9- const  fs : typeof  import ( "fs" )  =  require ( "fs" ) ; 
10- const  {  exec } : typeof  import ( "child_process" )  =  require ( "child_process" ) ; 
11- const  path : typeof  import ( "path" )  =  require ( "path" ) ; 
12- const  {  promisify } : typeof  import ( "util" )  =  require ( "util" ) ; 
9+ const  fs : typeof  import ( "fs" )  =  require ( "node: fs" ) ; 
10+ const  {  exec } : typeof  import ( "child_process" )  =  require ( "node: child_process" ) ; 
11+ const  path : typeof  import ( "path" )  =  require ( "node: path" ) ; 
12+ const  {  promisify } : typeof  import ( "util" )  =  require ( "node: util" ) ; 
1313const  nodeFetch : typeof  import ( "node-fetch" ) . default  =  require ( "node-fetch" ) ; 
1414const  remote : typeof  import ( "@electron/remote" )  =  require ( "@electron/remote" ) ; 
1515
@@ -145,21 +145,21 @@ export class InstallManager {
145145
146146        // Storage folder mapping 
147147        const  storageFolderIdx  =  composeContent . services . windows . volumes . findIndex ( vol  =>  vol . includes ( "/storage" ) ) ; 
148-         if  ( storageFolderIdx  !==  - 1 )  { 
149-             composeContent . services . windows . volumes [ storageFolderIdx ]  =  `${ this . conf . installFolder }  ; 
150-         }  else  { 
148+         if  ( storageFolderIdx  ===  - 1 )  { 
151149            logger . warn ( "No /storage volume found in compose template, adding one..." ) ; 
152150            composeContent . services . windows . volumes . push ( `${ this . conf . installFolder }  ) ; 
151+         }  else  { 
152+             composeContent . services . windows . volumes [ storageFolderIdx ]  =  `${ this . conf . installFolder }  ; 
153153        } 
154154
155155        // Home folder mapping 
156156        if  ( ! this . conf . shareHomeFolder )  { 
157157            const  sharedFolderIdx  =  composeContent . services . windows . volumes . findIndex ( vol  =>  vol . includes ( "/shared" ) ) ; 
158-             if  ( sharedFolderIdx  !==  - 1 )  { 
158+             if  ( sharedFolderIdx  ===  - 1 )  { 
159+                 logger . info ( "No home folder sharing volume found, nothing to remove" ) ; 
160+             }  else  { 
159161                composeContent . services . windows . volumes . splice ( sharedFolderIdx ,  1 ) ; 
160162                logger . info ( "Removed home folder sharing as per user configuration" ) ; 
161-             }  else  { 
162-                 logger . info ( "No home folder sharing volume found, nothing to remove" ) ; 
163163            } 
164164        } 
165165
@@ -242,8 +242,7 @@ export class InstallManager {
242242
243243        // Start the container 
244244        try  { 
245-             // execSync(`docker compose -f ${composeFilePath} up -d`, { stdio: 'inherit' }); 
246-             const  {  stdout,  stderr }  =  await  execAsync ( `docker compose -f ${ composeFilePath }  ) ; 
245+             const  {  stderr }  =  await  execAsync ( `docker compose -f ${ composeFilePath }  ) ; 
247246            if  ( stderr )  { 
248247                logger . error ( stderr ) ; 
249248            } 
@@ -263,6 +262,7 @@ export class InstallManager {
263262        this . changeState ( InstallStates . MONITORING_PREINSTALL ) ; 
264263        logger . info ( "Starting preinstall monitoring..." ) ; 
265264
265+         const  re  =  new  RegExp ( / > ( [ ^ < ] + ) < / ) ; 
266266        while  ( true )  { 
267267            try  { 
268268                const  vncHostPort  =  this . portMgr . value ! . getHostPort ( GUEST_NOVNC_PORT ) ; 
@@ -272,8 +272,7 @@ export class InstallManager {
272272                    return ;  // Exit the method when we get 404 
273273                } 
274274                const  message  =  await  response . text ( ) ; 
275-                 const  re  =  / > ( [ ^ < ] + ) < / ; 
276-                 const  messageFormatted  =  message . match ( re ) ?. [ 1 ]  ||  message ; 
275+                 const  messageFormatted  =  re . exec ( message ) ?. [ 1 ]  ||  message ; 
277276                this . setPreinstallMsg ( messageFormatted ) ; 
278277            }  catch  ( error )  { 
279278                if  ( error  instanceof  Error  &&  error . message . includes ( "404" ) )  { 
@@ -304,7 +303,7 @@ export class InstallManager {
304303                    logger . info ( "WinBoat Guest Server is up and healthy!" ) ; 
305304                    this . changeState ( InstallStates . COMPLETED ) ; 
306305
307-                     const  winboat  =  new   Winboat ( ) ; 
306+                     const  winboat  =  Winboat . getInstance ( ) ; 
308307                    const  config  =  winboat . parseCompose ( ) ; 
309308                    const  filteredVolumes  =  config . services . windows . volumes . filter ( 
310309                        volume  =>  ! volume . endsWith ( "/boot.iso" ) , 
@@ -325,7 +324,7 @@ export class InstallManager {
325324                        }   minutes...`, 
326325                    ) ; 
327326                } 
328-             }  catch  ( error )   { 
327+             }  catch  { 
329328                // Log every 60 seconds for errors too 
330329                if  ( attempts  %  12  ===  0 )  { 
331330                    logger . info ( `API not responding yet, still waiting after ${ ( attempts  *  5 )  /  60 }  ) ; 
0 commit comments