mirror of
https://github.com/Flowseal/zapret-discord-youtube.git
synced 2026-03-08 07:55:21 +00:00
utils folder; check updates switcher
This commit is contained in:
65
service.bat
65
service.bat
@@ -9,11 +9,14 @@ if "%~1"=="status_zapret" (
|
||||
)
|
||||
|
||||
if "%~1"=="check_updates" (
|
||||
if not "%~2"=="soft" (
|
||||
start /b service check_updates soft
|
||||
) else (
|
||||
call :service_check_updates soft
|
||||
if exist "%~dp0utils\check_updates.enabled" (
|
||||
if not "%~2"=="soft" (
|
||||
start /b service check_updates soft
|
||||
) else (
|
||||
call :service_check_updates soft
|
||||
)
|
||||
)
|
||||
|
||||
exit /b
|
||||
)
|
||||
|
||||
@@ -38,6 +41,7 @@ setlocal EnableDelayedExpansion
|
||||
cls
|
||||
call :ipset_switch_status
|
||||
call :game_switch_status
|
||||
call :check_updates_switch_status
|
||||
|
||||
set "menu_choice=null"
|
||||
echo ========= v!LOCAL_VERSION! =========
|
||||
@@ -46,10 +50,11 @@ echo 2. Remove Services
|
||||
echo 3. Check Status
|
||||
echo 4. Run Diagnostics
|
||||
echo 5. Check Updates
|
||||
echo 6. Switch Game Filter (%GameFilterStatus%)
|
||||
echo 7. Switch ipset (%IPsetStatus%)
|
||||
echo 8. Update ipset list
|
||||
echo 9. Run Tests
|
||||
echo 6. Switch Check Updates (%CheckUpdatesStatus%)
|
||||
echo 7. Switch Game Filter (%GameFilterStatus%)
|
||||
echo 8. Switch ipset (%IPsetStatus%)
|
||||
echo 9. Update ipset list
|
||||
echo 10. Run Tests
|
||||
echo 0. Exit
|
||||
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%"=="4" goto service_diagnostics
|
||||
if "%menu_choice%"=="5" goto service_check_updates
|
||||
if "%menu_choice%"=="6" goto game_switch
|
||||
if "%menu_choice%"=="7" goto ipset_switch
|
||||
if "%menu_choice%"=="8" goto ipset_update
|
||||
if "%menu_choice%"=="9" goto run_tests
|
||||
if "%menu_choice%"=="6" goto check_updates_switch
|
||||
if "%menu_choice%"=="7" goto game_switch
|
||||
if "%menu_choice%"=="8" goto ipset_switch
|
||||
if "%menu_choice%"=="9" goto ipset_update
|
||||
if "%menu_choice%"=="10" goto run_tests
|
||||
if "%menu_choice%"=="0" exit /b
|
||||
goto menu
|
||||
|
||||
@@ -650,7 +656,7 @@ goto menu
|
||||
:game_switch_status
|
||||
chcp 437 > nul
|
||||
|
||||
set "gameFlagFile=%~dp0bin\game_filter.enabled"
|
||||
set "gameFlagFile=%~dp0utils\game_filter.enabled"
|
||||
|
||||
if exist "%gameFlagFile%" (
|
||||
set "GameFilterStatus=enabled"
|
||||
@@ -680,6 +686,36 @@ pause
|
||||
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_status
|
||||
chcp 437 > nul
|
||||
@@ -791,6 +827,7 @@ exit /b
|
||||
:: RUN TESTS =============================
|
||||
:run_tests
|
||||
chcp 65001 >nul
|
||||
cls
|
||||
|
||||
:: Check PowerShell
|
||||
where powershell >nul 2>&1
|
||||
@@ -814,6 +851,6 @@ if %errorLevel% neq 0 (
|
||||
|
||||
echo Starting configuration tests in PowerShell window...
|
||||
echo.
|
||||
start "" powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0bin\test zapret.ps1"
|
||||
start "" powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0utils\test zapret.ps1"
|
||||
pause
|
||||
goto menu
|
||||
|
||||
1
utils/check_updates.enabled
Normal file
1
utils/check_updates.enabled
Normal file
@@ -0,0 +1 @@
|
||||
ENABLED
|
||||
@@ -1,9 +1,9 @@
|
||||
$hasErrors = $false
|
||||
|
||||
$rootDir = Split-Path $PSScriptRoot
|
||||
$binDir = $PSScriptRoot
|
||||
$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 }
|
||||
|
||||
# Define functions early
|
||||
@@ -432,7 +432,7 @@ if ($mode -eq 'select') {
|
||||
$targetList = @()
|
||||
$maxNameLen = 10
|
||||
if ($testType -eq 'standard') {
|
||||
$targetsFile = Join-Path $targetDir "targets.txt"
|
||||
$targetsFile = Join-Path $utilsDir "targets.txt"
|
||||
$rawTargets = New-OrderedDict
|
||||
if (Test-Path $targetsFile) {
|
||||
Get-Content $targetsFile | ForEach-Object {
|
||||
Reference in New Issue
Block a user