utils folder; check updates switcher

This commit is contained in:
Flowseal
2025-12-24 17:53:33 +03:00
parent 5a2b7d5e52
commit 56977c45a1
4 changed files with 918 additions and 880 deletions

View File

@@ -9,11 +9,14 @@ if "%~1"=="status_zapret" (
) )
if "%~1"=="check_updates" ( if "%~1"=="check_updates" (
if not "%~2"=="soft" ( if exist "%~dp0utils\check_updates.enabled" (
start /b service check_updates soft if not "%~2"=="soft" (
) else ( start /b service check_updates soft
call :service_check_updates soft ) else (
call :service_check_updates soft
)
) )
exit /b exit /b
) )
@@ -38,6 +41,7 @@ setlocal EnableDelayedExpansion
cls cls
call :ipset_switch_status call :ipset_switch_status
call :game_switch_status call :game_switch_status
call :check_updates_switch_status
set "menu_choice=null" set "menu_choice=null"
echo ========= v!LOCAL_VERSION! ========= echo ========= v!LOCAL_VERSION! =========
@@ -46,10 +50,11 @@ echo 2. Remove Services
echo 3. Check Status echo 3. Check 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 Check Updates (%CheckUpdatesStatus%)
echo 7. Switch ipset (%IPsetStatus%) echo 7. Switch Game Filter (%GameFilterStatus%)
echo 8. Update ipset list echo 8. Switch ipset (%IPsetStatus%)
echo 9. Run Tests echo 9. Update ipset list
echo 10. Run Tests
echo 0. Exit echo 0. Exit
set /p menu_choice=Enter choice (0-9): set /p menu_choice=Enter choice (0-9):
@@ -58,10 +63,11 @@ 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 check_updates_switch
if "%menu_choice%"=="7" goto ipset_switch if "%menu_choice%"=="7" goto game_switch
if "%menu_choice%"=="8" goto ipset_update if "%menu_choice%"=="8" goto ipset_switch
if "%menu_choice%"=="9" goto run_tests if "%menu_choice%"=="9" goto ipset_update
if "%menu_choice%"=="10" goto run_tests
if "%menu_choice%"=="0" exit /b if "%menu_choice%"=="0" exit /b
goto menu goto menu
@@ -650,7 +656,7 @@ goto menu
:game_switch_status :game_switch_status
chcp 437 > nul chcp 437 > nul
set "gameFlagFile=%~dp0bin\game_filter.enabled" set "gameFlagFile=%~dp0utils\game_filter.enabled"
if exist "%gameFlagFile%" ( if exist "%gameFlagFile%" (
set "GameFilterStatus=enabled" set "GameFilterStatus=enabled"
@@ -680,6 +686,36 @@ pause
goto menu goto menu
:: CHECK UPDATES SWITCH =================
:check_updates_switch_status
chcp 437 > nul
set "checkUpdatesFlag=%~dp0utils\check_updates.enabled"
if exist "%checkUpdatesFlag%" (
set "CheckUpdatesStatus=enabled"
) else (
set "CheckUpdatesStatus=disabled"
)
exit /b
:check_updates_switch
chcp 437 > nul
cls
if not exist "%checkUpdatesFlag%" (
echo Enabling check updates...
echo ENABLED > "%checkUpdatesFlag%"
) else (
echo Disabling check updates...
del /f /q "%checkUpdatesFlag%"
)
pause
goto menu
:: IPSET SWITCH ======================= :: IPSET SWITCH =======================
:ipset_switch_status :ipset_switch_status
chcp 437 > nul chcp 437 > nul
@@ -791,6 +827,7 @@ exit /b
:: RUN TESTS ============================= :: RUN TESTS =============================
:run_tests :run_tests
chcp 65001 >nul chcp 65001 >nul
cls
:: Check PowerShell :: Check PowerShell
where powershell >nul 2>&1 where powershell >nul 2>&1
@@ -814,6 +851,6 @@ if %errorLevel% neq 0 (
echo Starting configuration tests in PowerShell window... echo Starting configuration tests in PowerShell window...
echo. echo.
start "" powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0bin\test zapret.ps1" start "" powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0utils\test zapret.ps1"
pause pause
goto menu goto menu

View File

@@ -0,0 +1 @@
ENABLED

View File

@@ -1,9 +1,9 @@
$hasErrors = $false $hasErrors = $false
$rootDir = Split-Path $PSScriptRoot $rootDir = Split-Path $PSScriptRoot
$binDir = $PSScriptRoot
$listsDir = Join-Path $rootDir "lists" $listsDir = Join-Path $rootDir "lists"
$resultsDir = Join-Path $rootDir "test results" $utilsDir = Join-Path $rootDir "utils"
$resultsDir = Join-Path $utilsDir "test results"
if (-not (Test-Path $resultsDir)) { New-Item -ItemType Directory -Path $resultsDir | Out-Null } if (-not (Test-Path $resultsDir)) { New-Item -ItemType Directory -Path $resultsDir | Out-Null }
# Define functions early # Define functions early
@@ -432,7 +432,7 @@ if ($mode -eq 'select') {
$targetList = @() $targetList = @()
$maxNameLen = 10 $maxNameLen = 10
if ($testType -eq 'standard') { if ($testType -eq 'standard') {
$targetsFile = Join-Path $targetDir "targets.txt" $targetsFile = Join-Path $utilsDir "targets.txt"
$rawTargets = New-OrderedDict $rawTargets = New-OrderedDict
if (Test-Path $targetsFile) { if (Test-Path $targetsFile) {
Get-Content $targetsFile | ForEach-Object { Get-Content $targetsFile | ForEach-Object {