🐛 Actions support set domain

This commit is contained in:
Tw93
2023-07-20 22:26:30 +08:00
parent 4052fd164c
commit 15a07707b3
2 changed files with 12 additions and 3 deletions

5
script/build.ps1 vendored
View File

@@ -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

10
script/build.sh vendored
View File

@@ -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