@echo off
setlocal
chcp 936 >nul
cd /d "%~dp0"

>nul 2>&1 fltmc || (
  powershell -NoProfile -Command "Start-Process -FilePath '%~f0' -WorkingDirectory '%~dp0' -Verb RunAs"
  exit /b
)

title NaiveProxy 一键启动

echo 是否执行IP更新？IP更新从云端更新IP配置以解决封锁问题！
echo 按3跳过，按1选择ip1更新，若ip1不好用再按2选ip2更新，如果更新后都用不了，请发邮件到rebeccalane27@gmail.com进行反馈！
choice /C 123 /T 15 /D 3 /M "1、ip1更新  2、ip2更新  3、跳过"
if errorlevel 3 goto startfq
if errorlevel 2 goto ip2
if errorlevel 1 goto ip1

:ip2
start /wait "" "%~dp0naiveproxy\ip_Update\ip_2.bat"
goto startfq

:ip1
start /wait "" "%~dp0naiveproxy\ip_Update\ip_1.bat"
goto startfq

:startfq

echo 等待 NaiveProxy 启动，请稍候...
start "" /D "%~dp0naiveproxy" "%~dp0naiveproxy\naive.exe" "%~dp0naiveproxy\config.json"
if exist "%~dp0App\chrome.exe" (
  start "" /D "%~dp0App" "%~dp0App\chrome.exe" --proxy-server="socks5://127.0.0.1:1080"
)
echo 完成。按空格或回车键退出。
pause