Skip to content

Commit 2e668af

Browse files
Merge pull request #37 from sipsuru/main
feat: Allow configuring patch user information
2 parents 439549f + a617372 commit 2e668af

File tree

2 files changed

+77
-1
lines changed

2 files changed

+77
-1
lines changed

.github/workflows/cp_dispatch.yml

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,39 @@ on:
1515
- Windows (x86_64)
1616
- Linux (x86_64)
1717
patch-server-port:
18-
description: 'Patch server port (useful for resolving port conflicts)"'
18+
description: 'Patch server port (useful for resolving port conflicts)'
1919
required: true
2020
default: '5678'
21+
patch-user-email:
22+
description: 'Fake registered email (for fake FE account)'
23+
required: true
24+
default: '[email protected]'
25+
patch-user-firstName:
26+
description: 'Fake registered first name (for fake FE account)'
27+
required: true
28+
default: 'Long'
29+
patch-user-lastName:
30+
description: 'Fake registered first name (for fake FE account)'
31+
required: true
32+
default: 'Wang'
33+
patch-user-country-code:
34+
description: 'Fake registered country code (for fake FE account) ; Ex: 86'
35+
required: true
36+
default: '86'
37+
patch-user-provider:
38+
description: 'Fake registered provider (for fake FE account) ; Ex: Google'
39+
required: true
40+
default: 'Google'
2141

2242
env:
2343
OS_ARCH: ${{ github.event.inputs.os-and-arch }}
2444
VERSION_TO_PATCH: ${{ github.event.inputs.version_to_patch }}
2545
PATCH_SERVER_PORT: ${{ github.event.inputs.patch-server-port }}
46+
PATCH_USER_EMAIL: ${{ github.event.inputs.patch-user-email }}
47+
PATCH_USER_FNAME: ${{ github.event.inputs.patch-user-firstName }}
48+
PATCH_USER_LNAME: ${{ github.event.inputs.patch-user-lastName }}
49+
PATCH_USER_COUNTRYCODE: ${{ github.event.inputs.patch-user-country-code }}
50+
PATCH_USER_PROVIDER: ${{ github.event.inputs.patch-user-provider }}
2651

2752
jobs:
2853

@@ -480,6 +505,19 @@ jobs:
480505
Write-Host "index.js (from server) not found"
481506
}
482507
508+
- name: Set user credentials
509+
run: |
510+
$source_json = "FE/resources/app/out/file/identity.getfiddler.com/oauth/token.json"
511+
$main_content = Get-Content -Path $source_json -Raw | ConvertFrom-Json
512+
513+
$main_content.user_info.email = $env:PATCH_USER_EMAIL
514+
$main_content.user_info.firstName = $env:PATCH_USER_FNAME
515+
$main_content.user_info.lastName = $env:PATCH_USER_LNAME
516+
$main_content.user_info.country = $env:PATCH_USER_COUNTRYCODE
517+
$main_content.user_info.identities[0].providerName = $env:PATCH_USER_PROVIDER
518+
519+
$main_content | ConvertTo-Json -Depth 5 | Set-Content -Path $source_json
520+
483521
- name: Patch main.js to main.original.js
484522
run: |
485523
$source_main = "FE/resources/app/out/main.js"

.github/workflows/cp_latest_dispatch.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,35 @@ on:
1515
description: 'Patch server port (useful for resolving port conflicts)"'
1616
required: true
1717
default: '5678'
18+
patch-user-email:
19+
description: 'Fake registered email (for fake FE account)'
20+
required: true
21+
default: '[email protected]'
22+
patch-user-firstName:
23+
description: 'Fake registered first name (for fake FE account)'
24+
required: true
25+
default: 'Long'
26+
patch-user-lastName:
27+
description: 'Fake registered first name (for fake FE account)'
28+
required: true
29+
default: 'Wang'
30+
patch-user-country-code:
31+
description: 'Fake registered country code (for fake FE account) ; Ex: 86'
32+
required: true
33+
default: '86'
34+
patch-user-provider:
35+
description: 'Fake registered provider (for fake FE account) ; Ex: Google'
36+
required: true
37+
default: 'Google'
1838

1939
env:
2040
OS_ARCH: ${{ github.event.inputs.os-and-arch }}
2141
PATCH_SERVER_PORT: ${{ github.event.inputs.patch-server-port }}
42+
PATCH_USER_EMAIL: ${{ github.event.inputs.patch-user-email }}
43+
PATCH_USER_FNAME: ${{ github.event.inputs.patch-user-firstName }}
44+
PATCH_USER_LNAME: ${{ github.event.inputs.patch-user-lastName }}
45+
PATCH_USER_COUNTRYCODE: ${{ github.event.inputs.patch-user-country-code }}
46+
PATCH_USER_PROVIDER: ${{ github.event.inputs.patch-user-provider }}
2247

2348
jobs:
2449

@@ -457,6 +482,19 @@ jobs:
457482
Write-Host "index.js (from server) not found"
458483
}
459484
485+
- name: Set user credentials
486+
run: |
487+
$source_json = "FE/resources/app/out/file/identity.getfiddler.com/oauth/token.json"
488+
$main_content = Get-Content -Path $source_json -Raw | ConvertFrom-Json
489+
490+
$main_content.user_info.email = $env:PATCH_USER_EMAIL
491+
$main_content.user_info.firstName = $env:PATCH_USER_FNAME
492+
$main_content.user_info.lastName = $env:PATCH_USER_LNAME
493+
$main_content.user_info.country = $env:PATCH_USER_COUNTRYCODE
494+
$main_content.user_info.identities[0].providerName = $env:PATCH_USER_PROVIDER
495+
496+
$main_content | ConvertTo-Json -Depth 5 | Set-Content -Path $source_json
497+
460498
- name: Patch main.js to main.original.js
461499
run: |
462500
$source_main = "FE/resources/app/out/main.js"

0 commit comments

Comments
 (0)