Skip to content

Commit 77bea24

Browse files
committed
🐛 Actions support set domain
1 parent 7d9b01d commit 77bea24

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

script/build.ps1

+4-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ $total = $total - 1
3838

3939
# for windows, we need replace package name to title
4040
ForEach ($line in (Get-Content -Path .\app.csv | Select-Object -Skip 1)) {
41-
$name, $title, $name_zh, $url = $line.Split(",")
41+
$name, $title, $name_zh, $url = $line.Split(","), $domain = ([Uri]$url).Host
4242
Write-Host "building package ${index}/${total}"
4343
Write-Host "package name is ${name} ${name_zh}"
4444
Write-Host "=========================="
@@ -54,6 +54,9 @@ ForEach ($line in (Get-Content -Path .\app.csv | Select-Object -Skip 1)) {
5454
# replace url with no regex
5555
(Get-Content -Path $pake_conf_path -Raw) | ForEach-Object { $_.Replace('"url": ""', "`"url`": `"${url}`"") } | Set-Content $pake_conf_path
5656

57+
# -- replace domain -- #
58+
(Get-Content -Path $common_conf_path -Raw) -replace '"domain":\s*"[^"]*"', '"domain": ""' | Set-Content -Path $common_conf_path
59+
(Get-Content -Path $common_conf_path -Raw) | ForEach-Object { $_.Replace('"domain": ""', "`"domain`": `"${domain}`"") } | Set-Content $common_conf_path
5760

5861
# -- replace package name -- #
5962
# clear package_name with regex

script/build.sh

+8-2
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,19 @@ do
5959
package_title=${arr[1]}
6060
package_zh_name=${arr[2]}
6161
url=${arr[3]}
62+
domain=${url//http*:\/\//}
63+
domain=${domain%%/*}
6264

6365
# replace package info
6466
# clear url with regex
6567
$sd "\"url\": \"(.*?)\"," "\"url\": \"\"," src-tauri/pake.json
6668
# replace url with no regex
6769
$sd -s "\"url\": \"\"," "\"url\": \"${url}\"," src-tauri/pake.json
6870

71+
# replace dangerousRemoteDomainIpcAccess domain
72+
$sd "\"domain\": \"(.*?)\"," "\"domain\": \"\"," src-tauri/tauri.conf.json
73+
$sd -s "\"domain\": \"\"," "\"domain\": \"${domain}\"," src-tauri/tauri.conf.json
74+
6975
# for apple, need replace title
7076
if [[ "$OSTYPE" =~ ^darwin ]]; then
7177
# update icon
@@ -157,8 +163,8 @@ do
157163

158164
if [[ "$OSTYPE" =~ ^linux ]]; then
159165
npm run tauri build
160-
mv src-tauri/target/release/bundle/deb/${package_prefix}-"${package_name}"*.deb output/linux/"${package_title}"_`arch`.deb
161-
mv src-tauri/target/release/bundle/appimage/${package_prefix}-"${package_name}"*.AppImage output/linux/"${package_title}"_`arch`.AppImage
166+
mv "src-tauri/target/release/bundle/deb/${package_prefix}-${package_name}"*.deb "output/linux/${package_title}_`arch`.deb"
167+
mv "src-tauri/target/release/bundle/appimage/${package_prefix}-${package_name}"*.AppImage "output/linux/${package_title}_`arch`.AppImage"
162168
echo clear cache
163169
rm src-tauri/target/release
164170
rm -rf src-tauri/target/release/bundle

0 commit comments

Comments
 (0)