diff --git a/run.bat b/run.bat index 7eb4026..06de423 100644 --- a/run.bat +++ b/run.bat @@ -4,17 +4,18 @@ cd /d "%~dp0" REM -------- MasterHttpRelayVPN one-click launcher (Windows) -------- REM Creates a local virtualenv, installs deps, runs the setup wizard -REM if needed, then starts the proxy. +REM if needed, then starts the proxy. Also checks and installs CA cert +REM if not already trusted. set "VENV_DIR=.venv" set "PY=" where py >nul 2>&1 -if %errorlevel%==0 ( +if !errorlevel!==0 ( set "PY=py -3" ) else ( where python >nul 2>&1 - if %errorlevel%==0 ( + if !errorlevel!==0 ( set "PY=python" ) ) @@ -51,10 +52,29 @@ if errorlevel 1 ( ) ) +if not exist "config.json" ( + echo [*] No config.json found — launching setup wizard ... + "%VPY%" setup.py + if errorlevel 1 ( + echo [X] Setup cancelled. + pause + exit /b 1 + ) +) + +REM -------- Check for uninstall flag -------- +echo %* | findstr /C:"--uninstall-cert" >nul +if not errorlevel 1 ( + echo [*] Uninstalling CA certificate ... + "%VPY%" main.py --uninstall-cert + exit /b %errorlevel% +) + + echo. echo [*] Starting mhr-cfw ... echo. "%VPY%" main.py %* set "RC=%errorlevel%" if not "%RC%"=="0" pause -exit /b %RC% +exit /b %RC% \ No newline at end of file