From 15a07707b3c47054133d83b5b8efe80eadf5eea7 Mon Sep 17 00:00:00 2001 From: Tw93 Date: Thu, 20 Jul 2023 22:26:30 +0800 Subject: [PATCH] :bug: Actions support set domain --- script/build.ps1 | 5 ++++- script/build.sh | 10 ++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/script/build.ps1 b/script/build.ps1 index 03747cd..9c951a6 100644 --- a/script/build.ps1 +++ b/script/build.ps1 @@ -38,7 +38,7 @@ $total = $total - 1 # for windows, we need replace package name to title ForEach ($line in (Get-Content -Path .\app.csv | Select-Object -Skip 1)) { - $name, $title, $name_zh, $url = $line.Split(",") + $name, $title, $name_zh, $url = $line.Split(","), $domain = ([Uri]$url).Host Write-Host "building package ${index}/${total}" Write-Host "package name is ${name} ${name_zh}" Write-Host "==========================" @@ -54,6 +54,9 @@ ForEach ($line in (Get-Content -Path .\app.csv | Select-Object -Skip 1)) { # replace url with no regex (Get-Content -Path $pake_conf_path -Raw) | ForEach-Object { $_.Replace('"url": ""', "`"url`": `"${url}`"") } | Set-Content $pake_conf_path + # -- replace domain -- # + (Get-Content -Path $common_conf_path -Raw) -replace '"domain":\s*"[^"]*"', '"domain": ""' | Set-Content -Path $common_conf_path + (Get-Content -Path $common_conf_path -Raw) | ForEach-Object { $_.Replace('"domain": ""', "`"domain`": `"${domain}`"") } | Set-Content $common_conf_path # -- replace package name -- # # clear package_name with regex diff --git a/script/build.sh b/script/build.sh index bc27133..a5af78e 100755 --- a/script/build.sh +++ b/script/build.sh @@ -59,6 +59,8 @@ do package_title=${arr[1]} package_zh_name=${arr[2]} url=${arr[3]} + domain=${url//http*:\/\//} + domain=${domain%%/*} # replace package info # clear url with regex @@ -66,6 +68,10 @@ do # replace url with no regex $sd -s "\"url\": \"\"," "\"url\": \"${url}\"," src-tauri/pake.json + # replace dangerousRemoteDomainIpcAccess domain + $sd "\"domain\": \"(.*?)\"," "\"domain\": \"\"," src-tauri/tauri.conf.json + $sd -s "\"domain\": \"\"," "\"domain\": \"${domain}\"," src-tauri/tauri.conf.json + # for apple, need replace title if [[ "$OSTYPE" =~ ^darwin ]]; then # update icon @@ -157,8 +163,8 @@ do if [[ "$OSTYPE" =~ ^linux ]]; then npm run tauri build - mv src-tauri/target/release/bundle/deb/${package_prefix}-"${package_name}"*.deb output/linux/"${package_title}"_`arch`.deb - mv src-tauri/target/release/bundle/appimage/${package_prefix}-"${package_name}"*.AppImage output/linux/"${package_title}"_`arch`.AppImage + mv "src-tauri/target/release/bundle/deb/${package_prefix}-${package_name}"*.deb "output/linux/${package_title}_`arch`.deb" + mv "src-tauri/target/release/bundle/appimage/${package_prefix}-${package_name}"*.AppImage "output/linux/${package_title}_`arch`.AppImage" echo clear cache rm src-tauri/target/release rm -rf src-tauri/target/release/bundle