@echo off chcp 65001 >nul title Boat^&Ship-Finder echo. echo =================================================== echo Boat^&Ship-Finder - Broker Tool echo =================================================== echo. :: Buscar Python set PYTHON= where python >nul 2>&1 && set PYTHON=python if not defined PYTHON ( where python3 >nul 2>&1 && set PYTHON=python3 ) if not defined PYTHON ( if exist "%LOCALAPPDATA%\Programs\Python\Python312\python.exe" set PYTHON=%LOCALAPPDATA%\Programs\Python\Python312\python.exe ) if not defined PYTHON ( if exist "%LOCALAPPDATA%\Programs\Python\Python311\python.exe" set PYTHON=%LOCALAPPDATA%\Programs\Python\Python311\python.exe ) if not defined PYTHON ( if exist "%LOCALAPPDATA%\Programs\Python\Python310\python.exe" set PYTHON=%LOCALAPPDATA%\Programs\Python\Python310\python.exe ) if not defined PYTHON ( if exist "C:\Python312\python.exe" set PYTHON=C:\Python312\python.exe ) if not defined PYTHON ( if exist "C:\Python311\python.exe" set PYTHON=C:\Python311\python.exe ) if not defined PYTHON ( echo [ERROR] No se encontro Python. echo. echo Descargalo de: https://www.python.org/downloads/ echo Durante la instalacion marca: "Add Python to PATH" echo. pause & exit /b 1 ) echo [OK] Python: %PYTHON% :: Verificar/instalar Flask %PYTHON% -c "import flask" >nul 2>&1 if %errorlevel% neq 0 ( echo [INSTALANDO] Flask y dependencias... %PYTHON% -m pip install flask flask-cors requests beautifulsoup4 --quiet echo [OK] Dependencias instaladas. ) :: Verificar Ollama curl -s http://localhost:11434/api/tags >nul 2>&1 if %errorlevel% neq 0 ( echo. echo [AVISO] Ollama no esta corriendo. echo Abre Ollama Desktop desde la barra de tareas. echo Luego presiona cualquier tecla aqui. echo. pause >nul ) echo [OK] Ollama activo. :: Puerto fijo set PORT=8765 set MARINE_PORT=8765 echo [OK] Puerto: %PORT% :: Obtener IP de Tailscale set TSIP= for /f "tokens=*" %%i in ('tailscale ip -4 2^>nul') do set TSIP=%%i if not defined TSIP ( for /f "tokens=2 delims=:" %%a in ('ipconfig ^| findstr /i "tailscale" 2^>nul') do set TSIP=%%a ) echo. echo =================================================== echo Corriendo en puerto %PORT% echo. echo Desde esta PC: http://localhost:%PORT% if defined TSIP ( echo Desde tu celular: http://%TSIP%:%PORT% ) else ( echo Tailscale: no detectado ) echo. echo Presiona Ctrl+C para detener echo =================================================== echo. :: Ir a carpeta con server.py if exist "server.py" goto :run if exist "Boat^&Ship-Finder\server.py" cd /d "Boat^&Ship-Finder" :run :: Abrir navegador en 5 segundos start "" cmd /c "timeout /t 5 /nobreak >nul & start http://localhost:8765" :: Iniciar servidor %PYTHON% server.py pause