Skip to content

Commit

Permalink
调整 构建下载参数设置
Browse files Browse the repository at this point in the history
  • Loading branch information
xrgzs committed Sep 25, 2024
1 parent 770ebe8 commit ee01f55
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,36 @@ function Get-LanzouFile {
[string]
$OutFile
)

Write-Host "Downloading $Uri to $OutFile..."
try {
Invoke-WebRequest -Uri "https://api.xrgzs.top/lanzou/?type=down&url=$Uri" -OutFile $OutFile -ErrorAction Stop -ConnectionTimeoutSeconds 3
Write-Host "Using api.xrgzs.top..."
Invoke-Aria2Download -Uri "https://api.xrgzs.top/lanzou/?type=down&url=$Uri" -OutFile $OutFile
}
catch {
try {
Invoke-WebRequest -Uri "https://api.hanximeng.com/lanzou/?type=down&url=$Uri" -OutFile $OutFile -ErrorAction Stop -ConnectionTimeoutSeconds 3
Write-Host "Using api.hanximeng.com..."
Invoke-WebRequest -Uri "https://api.hanximeng.com/lanzou/?type=down&url=$Uri" -OutFile $OutFile
}
catch {
Invoke-WebRequest -Uri "https://lz.qaiu.top/parser?url=$Uri" -OutFile $OutFile -ErrorAction Stop -ConnectionTimeoutSeconds 3
try {
Write-Host "Using lz.qaiu.top..."
Invoke-WebRequest -Uri "https://lz.qaiu.top/parser?url=$Uri" -OutFile $OutFile
}
catch {
Write-Error "Failed to download $Uri. ($_)"
}
}
}
}

function Invoke-Aria2Download {
param (
[string]$Uri,
[string]$OutFile
)
& .\osc\aria2c.exe -c -R --timeout=5 --check-certificate=false -x 16 -s 16 -j 16 -k 1M -d "$PSScriptRoot\osc\runtime" -o "$OutFile" "$Uri"
}

# 检查
Write-Host "version: $env:GITHUB_WORKFLOW_VERSION"
if (-not (Test-Path "C:\Program Files (x86)\NSIS\makensis.exe")) {
Expand All @@ -47,8 +63,8 @@ else {
Get-LanzouFile -Uri "https://xrgzs.lanzouv.com/ixdbP27giisf" -OutFile "osc\xrsoft.exe"

# 下载其他文件
Invoke-WebRequest -Uri "http://url.xrgzs.top/osconline" -OutFile "osc\oscoffline.bat" -ErrorAction Stop -ConnectionTimeoutSeconds 3
Invoke-WebRequest -Uri "http://url.xrgzs.top/oscsoft" -OutFile "osc\oscsoftof.txt" -ErrorAction Stop -ConnectionTimeoutSeconds 3
Invoke-WebRequest -Uri "http://url.xrgzs.top/osconline" -OutFile "osc\oscoffline.bat" -ErrorAction Stop
Invoke-WebRequest -Uri "http://url.xrgzs.top/oscsoft" -OutFile "osc\oscsoftof.txt" -ErrorAction Stop
}

# 构建
Expand Down

0 comments on commit ee01f55

Please sign in to comment.