66 version_to_patch :
77 description : ' The Version You Want to Patch'
88 required : true
9- default : ' 5.21 .0'
9+ default : ' 6.0 .0'
1010
1111env :
1212 VERSION_TO_PATCH : ${{ github.event.inputs.version_to_patch }}
@@ -106,13 +106,8 @@ jobs:
106106 id : is-compatible-cont
107107 run : echo "is-compatible-cont=${{ env.IS_COMPATIBLE_CONT }}" | Out-File -Append -FilePath $env:GITHUB_OUTPUT
108108
109- - name : Set Yui name (>= 5.17.0)
110- if : env.IS_COMPATIBLE_CONT == 'true'
109+ - name : Set Yui name
111110 run : echo "YUI_NAME=yui" | Out-File -Append -FilePath $env:GITHUB_ENV
112-
113- - name : Set Yui name (< 5.17.0)
114- if : env.IS_COMPATIBLE_CONT == 'false'
115- run : echo "YUI_NAME=yukihana" | Out-File -Append -FilePath $env:GITHUB_ENV
116111
117112 - name : Set Yui fiddler name (>= 5.17.0)
118113 if : env.IS_COMPATIBLE_CONT == 'true'
@@ -133,29 +128,21 @@ jobs:
133128 }
134129 shell : pwsh
135130
136- - name : Set Yui Release (>= 5.17.0)
137- if : env.IS_COMPATIBLE_CONT == 'true'
131+ - name : Set Yui Release
138132 run : echo "Yui_RELEASE=continuous" | Out-File -Append -FilePath $env:GITHUB_ENV
139-
140- - name : Set Yui Release (< 5.17.0)
141- if : env.IS_COMPATIBLE_CONT == 'false'
142- run : echo "Yui_RELEASE=v1.0.9" | Out-File -Append -FilePath $env:GITHUB_ENV
143133
144134 - name : Download Yui Patch
145135 run : |
146136 try {
147137 # Build the download URLs
148138 $YuiFiddlerUrl = "https://github.com/project-yui/Yui-patch/releases/download/$env:Yui_RELEASE/$env:YUI_NAME-$env:Yui_FIDDLER_NAME-win32-x86_64-$env:Yui_RELEASE.dll"
149- $YuiHostPolicyUrl = "https://github.com/project-yui/Yui-patch/releases/download/$env:Yui_RELEASE/$env:YUI_NAME-hostpolicy-win32-x86_64-$env:Yui_RELEASE.dll"
150139
151140 # Print the URLs to ensure they're correct
152141 Write-Host "Downloading files from $env:Yui_RELEASE"
153142 Write-Host "Yui Fiddler URL: $YuiFiddlerUrl"
154- Write-Host "Yui HostPolicy URL: $YuiHostPolicyUrl"
155143
156144 # Download the files
157145 Invoke-WebRequest -Uri $YuiFiddlerUrl -OutFile "Yui\$env:Yui_FIDDLER_NAME.dll"
158- Invoke-WebRequest -Uri $YuiHostPolicyUrl -OutFile "Yui\hostpolicy.dll"
159146 }
160147 catch {
161148 Write-Error "Failed to download the patch files. Error details: $_"
@@ -298,20 +285,6 @@ jobs:
298285 }
299286 shell : pwsh
300287
301- - name : Patch hostpolicy.dll
302- run : |
303- $original_hostpolicy = "FE/resources/app/out/WebServer/hostpolicy.dll"
304- $original_copy_hostpolicy = "FE/resources/app/out/WebServer/hostpolicy.original.dll"
305- $Yui_hostpolicy = "Yui-patch/hostpolicy.dll"
306-
307- if ((Test-Path $original_hostpolicy) -and (Test-Path $Yui_hostpolicy)) {
308- Move-Item -Path $original_hostpolicy -Destination $original_copy_hostpolicy
309- Copy-Item -Path $Yui_hostpolicy -Destination $original_hostpolicy
310- Write-Host "Renamed $original_fiddler with $original_copy_hostpolicy & Applied Yui Patch"
311- } else {
312- Write-Host "original hostpolicy.dll or Yui hotstpolicy not found"
313- }
314-
315288 - name : Clean Yui-patch
316289 run : |
317290 if (Test-Path Yui-patch) {
@@ -352,81 +325,13 @@ jobs:
352325 Write-Host "Source main.js or index.js (from server) not found"
353326 }
354327
355- - name : Patch main.XXX.js to main.XXX.original.js
356- run : |
357- $directory = 'FE/resources/app/out/WebServer/ClientApp/dist'
358-
359- $source_main = Get-ChildItem -Path $directory -Filter "main*" | Where-Object { -not $_.PSIsContainer }
360-
361- if ($source_main) {
362- # Extract original file name without extension
363- $originalName = [System.IO.Path]::GetFileNameWithoutExtension($source_main.Name)
364- $originalFullPath = $source_main.FullName
365-
366- # Define the new file name in the format "original-name.original.js"
367- $new_main_name = "$originalName.original.js"
368-
369- # Rename the file
370- Copy-Item -Path $originalFullPath -Destination (Join-Path -Path $directory -ChildPath $new_main_name)
371- Write-Host "File renamed from $($source_main.Name) to $(Join-Path -Path $directory -ChildPath $new_main_name)"
372-
373- Write-Host "Finding and Replacing now"
374-
375- $source_content = Get-Content -Path $originalFullPath -Raw
376-
377- $searchText1 = "https://api.getfiddler.com"
378- $replaceText1 = "http://127.0.0.1:5678/api.getfiddler.com"
379- $updatedText1 = $source_content -replace [regex]::Escape($searchText1), $replaceText1
380-
381- $searchText2 = "https://identity.getfiddler.com"
382- $replaceText2 = "http://127.0.0.1:5678/identity.getfiddler.com"
383- $finalUpdatedText = $updatedText1 -replace [regex]::Escape($searchText2), $replaceText2
384-
385- # Overwrite the file with the new content
386- Set-Content -Path $originalFullPath -Value $finalUpdatedText
387-
388- echo "MAIN_XXX_NAME=$originalName" >> $env:GITHUB_ENV
389- } else {
390- Write-Host "No file found starting with 'main' in the specified directory. (Main,XXX.js)"
391- }
392-
393328 - name : Clean msojocs-patch
394329 run : |
395330 if (Test-Path msojocs-patch) {
396331 Remove-Item -Path "msojocs-patch" -Recurse
397332 } else {
398333 Write-Host "msojocs-patch Folder not found"
399334 }
400-
401- - name : Add patch.json
402- run : |
403- $patch_json = "FE/resources/app/out/WebServer/patch.json"
404-
405- $jsonContent = @{
406- "ClientApp\\dist\\$env:MAIN_XXX_NAME.js" = @{
407- "target" = "ClientApp\\dist\\$env:MAIN_XXX_NAME.original.js"
408- "content" = ""
409- "cur" = 0
410- "start" = 0
411- "end" = 1
412- }
413- "..\\main.js" = @{
414- "target" = "..\\main.original.js"
415- "content" = ""
416- "cur" = 0
417- "start" = 0
418- "end" = 1
419- }
420- }
421-
422- # Convert the PowerShell object to JSON format
423- $jsonString = $jsonContent | ConvertTo-Json -Depth 10
424-
425- # Write the JSON string to the file
426- $jsonString | Set-Content -Path $patch_json -Encoding UTF8
427-
428- # Output message
429- Write-Host "JSON file created successfully at $patch_json"
430335
431336 - name : Rename FE
432337 id : rename-fe
0 commit comments