Compare commits

..

No commits in common. "3ef216b71b4e7c5b42cff4ede984e9a015504d0b" and "faed518d0cdca95c29ca153fe036dcbd41473fbf" have entirely different histories.

2 changed files with 18 additions and 94 deletions

View File

@ -1 +0,0 @@
ENABLED

View File

@ -1,4 +1,5 @@
@echo off @echo off
setlocal EnableDelayedExpansion
set "LOCAL_VERSION=1.7.2b" set "LOCAL_VERSION=1.7.2b"
:: External commands :: External commands
@ -12,12 +13,6 @@ if "%~1"=="check_updates" (
exit /b exit /b
) )
if "%~1"=="load_game_filter" (
call :game_switch_status
exit /b
)
if "%1"=="admin" ( if "%1"=="admin" (
echo Started with admin rights echo Started with admin rights
) else ( ) else (
@ -28,11 +23,9 @@ if "%1"=="admin" (
:: MENU ================================ :: MENU ================================
setlocal EnableDelayedExpansion
:menu :menu
cls cls
call :ipset_switch_status call :ipset_switch_status
call :game_switch_status
set "menu_choice=null" set "menu_choice=null"
echo ======================= echo =======================
@ -41,20 +34,16 @@ echo 2. Remove Services
echo 3. Check Service Status echo 3. Check Service Status
echo 4. Run Diagnostics echo 4. Run Diagnostics
echo 5. Check Updates echo 5. Check Updates
echo 6. Switch Game Filter (%GameFilterStatus%) echo 6. Switch ipset (%IPsetStatus%)
echo 7. Switch ipset (%IPsetStatus%)
echo 8. Update ipset list
echo 0. Exit echo 0. Exit
set /p menu_choice=Enter choice (0-8): set /p menu_choice=Enter choice (0-6):
if "%menu_choice%"=="1" goto service_install if "%menu_choice%"=="1" goto service_install
if "%menu_choice%"=="2" goto service_remove if "%menu_choice%"=="2" goto service_remove
if "%menu_choice%"=="3" goto service_status if "%menu_choice%"=="3" goto service_status
if "%menu_choice%"=="4" goto service_diagnostics if "%menu_choice%"=="4" goto service_diagnostics
if "%menu_choice%"=="5" goto service_check_updates if "%menu_choice%"=="5" goto service_check_updates
if "%menu_choice%"=="6" goto game_switch if "%menu_choice%"=="6" goto ipset_switch
if "%menu_choice%"=="7" goto ipset_switch
if "%menu_choice%"=="8" goto ipset_update
if "%menu_choice%"=="0" exit /b if "%menu_choice%"=="0" exit /b
goto menu goto menu
@ -267,26 +256,21 @@ if not defined GITHUB_VERSION (
:: Version comparison :: Version comparison
if "%LOCAL_VERSION%"=="%GITHUB_VERSION%" ( if "%LOCAL_VERSION%"=="%GITHUB_VERSION%" (
echo Latest version installed: %LOCAL_VERSION% echo Latest version installed: %LOCAL_VERSION%
) else (
if "%1"=="soft" exit /b echo New version available: %GITHUB_VERSION%
pause echo Release page: %GITHUB_RELEASE_URL%%GITHUB_VERSION%
goto menu
)
echo New version available: %GITHUB_VERSION% set "CHOICE="
echo Release page: %GITHUB_RELEASE_URL%%GITHUB_VERSION% set /p "CHOICE=Do you want to automatically download the new version? (Y/N) (default: Y) "
if "!CHOICE!"=="" set "CHOICE=Y"
if "!CHOICE!"=="y" set "CHOICE=Y"
set "CHOICE=" if /i "!CHOICE!"=="Y" (
set /p "CHOICE=Do you want to automatically download the new version? (Y/N) (default: Y) " echo Opening the download page...
if "%CHOICE%"=="" set "CHOICE=Y" start "" "%GITHUB_DOWNLOAD_URL%%GITHUB_VERSION%.rar"
if /i "%CHOICE%"=="y" set "CHOICE=Y" )
if /i "%CHOICE%"=="Y" (
echo Opening the download page...
start "" "%GITHUB_DOWNLOAD_URL%%GITHUB_VERSION%.rar"
) )
if "%1"=="soft" exit /b if "%1"=="soft" exit /b
pause pause
goto menu goto menu
@ -413,47 +397,15 @@ pause
goto menu goto menu
:: GAME SWITCH ========================
:game_switch_status
chcp 437 > nul
set "gameFlagFile=%~dp0bin\game_filter.enabled"
if exist "%gameFlagFile%" (
set "GameFilterStatus=enabled"
set "GameFilter=1024-65535"
) else (
set "GameFilterStatus=disabled"
set "GameFilter=0"
)
exit /b
:game_switch
chcp 437 > nul
cls
if not exist "%gameFlagFile%" (
echo Enabling game filter...
echo ENABLED > "%gameFlagFile%"
) else (
echo Disabling game filter...
del /f /q "%gameFlagFile%"
)
pause
goto menu
:: IPSET SWITCH ======================= :: IPSET SWITCH =======================
:ipset_switch_status :ipset_switch_status
chcp 437 > nul chcp 437 > nul
findstr /R "^0\.0\.0\.0/32$" "%~dp0lists\ipset-all.txt" >nul findstr /R "^0\.0\.0\.0/32$" "%~dp0lists\ipset-all.txt" >nul
if !errorlevel!==0 ( if !errorlevel!==0 (
set "IPsetStatus=empty" set "IPsetStatus=load"
) else ( ) else (
set "IPsetStatus=loaded" set "IPsetStatus=unload"
) )
exit /b exit /b
@ -473,7 +425,7 @@ if !errorlevel!==0 (
del /f /q "%listFile%" del /f /q "%listFile%"
ren "%backupFile%" "ipset-all.txt" ren "%backupFile%" "ipset-all.txt"
) else ( ) else (
echo Error: no backup to restore. Update list from service menu by yourself echo Error: no backup to restore. Download list from repoistory
) )
) else ( ) else (
@ -495,33 +447,6 @@ pause
goto menu goto menu
:: IPSET UPDATE =======================
:ipset_update
chcp 437 > nul
cls
set "listFile=%~dp0lists\ipset-all.txt"
set "url=https://raw.githubusercontent.com/Flowseal/zapret-discord-youtube/refs/heads/main/lists/ipset-all.txt"
echo Updating ipset-all...
if exist "%SystemRoot%\System32\curl.exe" (
curl -L -o "%listFile%" "%url%"
) else (
powershell -Command ^
"$url = '%url%';" ^
"$out = '%listFile%';" ^
"$dir = Split-Path -Parent $out;" ^
"if (-not (Test-Path $dir)) { New-Item -ItemType Directory -Path $dir | Out-Null };" ^
"$res = Invoke-WebRequest -Uri $url -TimeoutSec 10 -UseBasicParsing;" ^
"if ($res.StatusCode -eq 200) { $res.Content | Out-File -FilePath $out -Encoding UTF8 } else { exit 1 }"
)
echo Finished
pause
goto menu
:: Utility functions :: Utility functions
:PrintGreen :PrintGreen