@@ -485,11 +485,11 @@ PORT=${this.config.port}
485485 if ( authToken && cleanUrl . includes ( 'github.com' ) ) {
486486 // Log sanitized URL for debugging (without token)
487487 Logger . log ( `Downloading from GitHub with authentication: ${ cleanUrl } ` , '🔍' ) ;
488- // Use GitHub API endpoint with proper redirect following
489- downloadCommand = `wget -O "${ downloadPath } " " ${ cleanUrl } " --header= "Authorization: Bearer ${ authToken } " --timeout=30 --tries=2 --no-check-certificate --max-redirect=5 -v ` ;
488+ // Use curl with GitHub API endpoint and proper headers
489+ downloadCommand = `curl -L -o "${ downloadPath } " -H "Authorization: Bearer ${ authToken } " -H "Accept: application/vnd.github.v3+json" --connect-timeout 30 --max-time 60 --retry 2 " ${ cleanUrl } " ` ;
490490 } else {
491491 Logger . log ( `Downloading from public URL: ${ cleanUrl } ` , '🔍' ) ;
492- downloadCommand = `wget -O "${ downloadPath } " " ${ cleanUrl } " -- timeout= 30 --tries=2 -v ` ;
492+ downloadCommand = `curl -L -o "${ downloadPath } " --connect- timeout 30 --max-time 60 --retry 2 " ${ cleanUrl } " ` ;
493493 }
494494
495495 // Download the plugin ZIP file
@@ -634,15 +634,15 @@ PORT=${this.config.port}
634634 // Use URL-specific token if provided, otherwise fall back to global token
635635 const authToken = token || this . config . githubToken ;
636636
637- // Prepare wget command
638- let wgetCommand = '' ;
637+ // Prepare curl command
638+ let curlCommand = '' ;
639639 if ( authToken && cleanUrl . includes ( 'github.com' ) ) {
640640 Logger . log ( `Installing theme with GitHub authentication: ${ cleanUrl } ` , '🔍' ) ;
641- // Use GitHub API endpoint with proper redirect following
642- wgetCommand = `wget -O theme.zip " ${ cleanUrl } " --header= "Authorization: Bearer ${ authToken } " --timeout=30 --tries=2 --no-check-certificate --max-redirect=5 -v ` ;
641+ // Use GitHub API endpoint with proper headers
642+ curlCommand = `curl -L -o theme.zip -H "Authorization: Bearer ${ authToken } " -H "Accept: application/vnd.github.v3+json" --connect-timeout 30 --max-time 60 --retry 2 " ${ cleanUrl } " ` ;
643643 } else {
644644 Logger . log ( `Installing theme from public URL: ${ cleanUrl } ` , '🔍' ) ;
645- wgetCommand = `wget -O theme.zip " ${ cleanUrl } " -- timeout= 30 --tries=2 -v ` ;
645+ curlCommand = `curl -L -o theme.zip --connect- timeout 30 --max-time 60 --retry 2 " ${ cleanUrl } " ` ;
646646 }
647647
648648 // Extract to specified directory or default behavior
@@ -654,7 +654,7 @@ PORT=${this.config.port}
654654 }
655655
656656 await ProcessManager . runShell ( `
657- docker exec mautic_web bash -c "cd /var/www/html/docroot/themes && ${ wgetCommand } && ${ extractCommand } "
657+ docker exec mautic_web bash -c "cd /var/www/html/docroot/themes && ${ curlCommand } && ${ extractCommand } "
658658 ` , { ignoreError : true } ) ;
659659
660660 const displayName = directory ? `${ themeUrl } → ${ directory } ` : themeUrl ;
@@ -702,22 +702,8 @@ PORT=${this.config.port}
702702 // Use URL-specific token if provided, otherwise fall back to global token
703703 const authToken = token || this . config . githubToken ;
704704
705- // Prepare wget command
706- let wgetCommand = '' ;
707- if ( authToken && cleanUrl . includes ( 'github.com' ) ) {
708- Logger . log ( `Installing plugin with GitHub authentication: ${ cleanUrl } ` , '🔍' ) ;
709- // Use GitHub API endpoint with proper redirect following
710- wgetCommand = `wget -O plugin.zip "${ cleanUrl } " --header="Authorization: Bearer ${ authToken } " --timeout=30 --tries=2 --no-check-certificate --max-redirect=5 -v` ;
711- } else {
712- Logger . log ( `Installing plugin from public URL: ${ cleanUrl } ` , '🔍' ) ;
713- wgetCommand = `wget -O plugin.zip "${ cleanUrl } " --timeout=30 --tries=2 -v` ;
714- }
715-
716- // Download and validate the plugin
717- Logger . log ( `Attempting to download with command: ${ wgetCommand . replace ( / t o k e n = [ ^ " ' \s ] * / g, 'token=***' ) } ` , '🔍' ) ;
718-
719705 // Check if required tools are available in container
720- const toolsCheck = await ProcessManager . runShell ( `docker exec mautic_web bash -c 'which wget && which unzip && which file'` , { ignoreError : true } ) ;
706+ const toolsCheck = await ProcessManager . runShell ( `docker exec mautic_web bash -c 'which curl && which unzip && which file'` , { ignoreError : true } ) ;
721707 if ( ! toolsCheck . success ) {
722708 Logger . log ( `⚠️ Warning: Some required tools may be missing in container: ${ toolsCheck . output } ` , '⚠️' ) ;
723709 } else {
@@ -727,10 +713,10 @@ PORT=${this.config.port}
727713 // Download the plugin using a more reliable approach
728714 let downloadCommand ;
729715 if ( authToken && cleanUrl . includes ( 'github.com' ) ) {
730- // For GitHub API, create a temporary script to avoid shell escaping issues
731- downloadCommand = `docker exec mautic_web bash -c 'cd /var/www/html/docroot/plugins && wget -O plugin.zip " ${ cleanUrl } " --header= "Authorization: Bearer ${ authToken } " --timeout=30 --tries=2 --no-check-certificate --max-redirect=5 -v '` ;
716+ // For GitHub API with authentication, use curl with proper headers
717+ downloadCommand = `docker exec mautic_web bash -c 'cd /var/www/html/docroot/plugins && curl -L -o plugin.zip -H "Authorization: Bearer ${ authToken } " -H "Accept: application/vnd.github.v3+json" --connect-timeout 30 --max-time 60 --retry 2 " ${ cleanUrl } " '` ;
732718 } else {
733- downloadCommand = `docker exec mautic_web bash -c 'cd /var/www/html/docroot/plugins && wget -O plugin.zip " ${ cleanUrl } " -- timeout= 30 --tries=2 -v '` ;
719+ downloadCommand = `docker exec mautic_web bash -c 'cd /var/www/html/docroot/plugins && curl -L -o plugin.zip --connect- timeout 30 --max-time 60 --retry 2 " ${ cleanUrl } " '` ;
734720 }
735721
736722 const downloadResult = await ProcessManager . runShell ( downloadCommand , { ignoreError : true } ) ;
0 commit comments