Fix diagnostic launcher script path

This commit is contained in:
amd64fox
2026-04-18 17:54:10 +03:00
parent 4106903513
commit 4f0706b010

View File

@@ -2,13 +2,20 @@
setlocal
set "script_name=DL_Diag.ps1"
set "raw_url=https://raw.githubusercontent.com/SpotX-Official/SpotX/refs/heads/main/scripts/%script_name%"
set "mirror_url=https://spotx-official.github.io/SpotX/scripts/%script_name%"
set "temp_script=%TEMP%\%script_name%"
set "branch_name=dl-diag-scripts"
set "script_dir=%~dp0"
set "local_script=%script_dir%%script_name%"
set "branch_url=https://raw.githubusercontent.com/SpotX-Official/SpotX/refs/heads/%branch_name%/scripts/%script_name%"
set "main_url=https://raw.githubusercontent.com/SpotX-Official/SpotX/refs/heads/main/scripts/%script_name%"
set "temp_script=%TEMP%\SpotX-%script_name%"
set "ps=%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\powershell.exe"
%ps% -NoProfile -ExecutionPolicy Bypass ^
-Command "[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12; $raw='%raw_url%'; $mirror='%mirror_url%'; $out='%temp_script%'; try { Invoke-WebRequest -UseBasicParsing -Uri $raw -OutFile $out -ErrorAction Stop } catch { Invoke-WebRequest -UseBasicParsing -Uri $mirror -OutFile $out -ErrorAction Stop }; & $out"
if exist "%local_script%" (
%ps% -NoProfile -ExecutionPolicy Bypass -File "%local_script%"
) else (
%ps% -NoProfile -ExecutionPolicy Bypass ^
-Command "[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12; $out='%temp_script%'; $urls=@('%branch_url%','%main_url%'); $downloaded=$false; foreach ($url in $urls) { try { Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $out -ErrorAction Stop; $downloaded=$true; break } catch {} }; if (-not $downloaded) { throw 'Failed to download diagnostic script' }; & $out"
)
pause
endlocal