mirror of
https://github.com/SpotX-Official/SpotX.git
synced 2026-04-13 20:28:25 +10:00
Exceptions
Improvement of exceptions on unsuccessful connection attempts
This commit is contained in:
42
Install.bat
42
Install.bat
@@ -1,11 +1,41 @@
|
||||
@echo off
|
||||
FOR /f %%i IN ('curl --write-out %%{http_code} --silent --output /dev/null --insecure https://raw.githubusercontent.com/amd64fox/SpotX/main/Install.ps1') do SET STATUS_CODE=%%i 2>nul
|
||||
IF %STATUS_CODE% == 200 (
|
||||
Setlocal EnableDelayedExpansion
|
||||
for /f %%i in ('curl --write-out %%{http_code} --silent --output /dev/null --insecure https://raw.githubusercontent.com/amd64fox/SpotX/main/Install.ps1') do set STATUS_CODE=%%i 2>nul
|
||||
if %STATUS_CODE% EQU 200 (
|
||||
powershell -Command "& {[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12}"; "& {Invoke-WebRequest -UseBasicParsing 'https://raw.githubusercontent.com/amd64fox/SpotX/main/Install.ps1' | Invoke-Expression}"
|
||||
)
|
||||
if %STATUS_CODE% LSS 1 (
|
||||
echo No network connection
|
||||
echo Trying to reconnect via...
|
||||
TIMEOUT /T 5
|
||||
cls
|
||||
for /f %%i in ('curl --write-out %%{http_code} --silent --output /dev/null --insecure https://raw.githubusercontent.com/amd64fox/SpotX/main/Install.ps1') do set STATUS_CODE=%%i 2>nul
|
||||
if "!STATUS_CODE!" EQU "200 " (
|
||||
cls
|
||||
powershell -Command "& {[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12}"; "& {Invoke-WebRequest -UseBasicParsing 'https://raw.githubusercontent.com/amd64fox/SpotX/main/Install.ps1' | Invoke-Expression}"
|
||||
) else (
|
||||
echo Error again
|
||||
echo Check your internet connection
|
||||
echo Script stopped
|
||||
pause
|
||||
exit
|
||||
)
|
||||
)
|
||||
if %STATUS_CODE% GTR 100 if not %STATUS_CODE% EQU 200 (
|
||||
echo Failed to connect to github.com
|
||||
echo HTTP response code %STATUS_CODE%
|
||||
echo Trying to reconnect via...
|
||||
TIMEOUT /T 5
|
||||
cls
|
||||
for /f %%i in ('curl --write-out %%{http_code} --silent --output /dev/null --insecure https://raw.githubusercontent.com/amd64fox/SpotX/main/Install.ps1') do set STATUS_CODE=%%i 2>nul
|
||||
if "!STATUS_CODE!" EQU "200 " (
|
||||
cls
|
||||
powershell -Command "& {[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12}"; "& {Invoke-WebRequest -UseBasicParsing 'https://raw.githubusercontent.com/amd64fox/SpotX/main/Install.ps1' | Invoke-Expression}"
|
||||
) else (
|
||||
echo Can't access github.com, please check your internet connection.
|
||||
echo HTTP status code %STATUS_CODE%
|
||||
echo Script stopped.
|
||||
)
|
||||
echo Error again
|
||||
echo Try to run after some time
|
||||
echo Script stopped
|
||||
)
|
||||
)
|
||||
pause
|
||||
exit
|
||||
@@ -1,13 +1,45 @@
|
||||
@echo off
|
||||
Setlocal EnableDelayedExpansion
|
||||
chcp 65001 >nul
|
||||
FOR /f %%i IN ('curl --write-out %%{http_code} --silent --output /dev/null --insecure https://raw.githubusercontent.com/amd64fox/SpotX/main/Install_rus.ps1') do SET STATUS_CODE=%%i 2>nul
|
||||
IF %STATUS_CODE% == 200 (
|
||||
for /f %%i in ('curl --write-out %%{http_code} --silent --output /dev/null --insecure https://raw.githubusercontent.com/amd64fox/SpotX/main/Install_rus.ps1') do set STATUS_CODE=%%i 2>nul
|
||||
if %STATUS_CODE% EQU 200 (
|
||||
chcp 866 >nul
|
||||
powershell -Command "& {[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12}"; "& {(Invoke-WebRequest -UseBasicParsing 'https://raw.githubusercontent.com/amd64fox/SpotX/main/Install_rus.ps1').Content | Invoke-Expression}"
|
||||
)
|
||||
if %STATUS_CODE% LSS 1 (
|
||||
echo Нет подключения к сети
|
||||
echo Попытка повторного подключения через ...
|
||||
TIMEOUT /T 5
|
||||
cls
|
||||
for /f %%i in ('curl --write-out %%{http_code} --silent --output /dev/null --insecure https://raw.githubusercontent.com/amd64fox/SpotX/main/Install_rus.ps1') do set STATUS_CODE=%%i 2>nul
|
||||
if "!STATUS_CODE!" EQU "200 " (
|
||||
cls
|
||||
chcp 866 >nul
|
||||
powershell -Command "& {[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12}"; "& {(Invoke-WebRequest -UseBasicParsing 'https://raw.githubusercontent.com/amd64fox/SpotX/main/Install_rus.ps1').Content | Invoke-Expression}"
|
||||
) else (
|
||||
echo Снова ошибка
|
||||
echo Проверьте свое интернет соединение
|
||||
echo Скрипт остановлен
|
||||
pause
|
||||
exit
|
||||
)
|
||||
)
|
||||
if %STATUS_CODE% GTR 100 if not %STATUS_CODE% EQU 200 (
|
||||
echo Не удалось подключиться к github.com
|
||||
echo Код ответа HTTP %STATUS_CODE%
|
||||
echo Попытка повторного подключения через ...
|
||||
TIMEOUT /T 5
|
||||
cls
|
||||
for /f %%i in ('curl --write-out %%{http_code} --silent --output /dev/null --insecure https://raw.githubusercontent.com/amd64fox/SpotX/main/Install_rus.ps1') do set STATUS_CODE=%%i 2>nul
|
||||
if "!STATUS_CODE!" EQU "200 " (
|
||||
cls
|
||||
chcp 866 >nul
|
||||
powershell -Command "& {[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12}"; "& {(Invoke-WebRequest -UseBasicParsing 'https://raw.githubusercontent.com/amd64fox/SpotX/main/Install_rus.ps1').Content | Invoke-Expression}"
|
||||
) else (
|
||||
echo Нет доступа к github.com, проверьте свое интернет соединение.
|
||||
echo Код ответа HTTP %STATUS_CODE%
|
||||
echo Скрипт завершен.
|
||||
echo Снова ошибка
|
||||
echo Попробуйте запустить спустя некоторое время
|
||||
echo Скрипт остановлен
|
||||
)
|
||||
)
|
||||
pause
|
||||
exit
|
||||
Reference in New Issue
Block a user