89 lines
2.6 KiB
Batchfile
89 lines
2.6 KiB
Batchfile
@echo off
|
|
title CSG Image Upload Tool
|
|
color 0B
|
|
echo.
|
|
echo ==========================================
|
|
echo CSG Image Upload Tool ^| Launcher
|
|
echo ==========================================
|
|
echo.
|
|
|
|
set PORT=3000
|
|
|
|
:: Change to the folder where this bat file lives
|
|
cd /d "%~dp0"
|
|
|
|
echo Looking for a web server on your machine...
|
|
echo.
|
|
|
|
:: ── Try Python 3 (most common) ─────────────────────────────
|
|
python --version >nul 2>&1
|
|
if %errorlevel% == 0 (
|
|
echo [OK] Found Python! Starting on http://localhost:%PORT%
|
|
echo.
|
|
echo Leave this window open while using the tool.
|
|
echo Press Ctrl+C here to stop the server when done.
|
|
echo.
|
|
timeout /t 2 /nobreak >nul
|
|
start "" "http://localhost:%PORT%"
|
|
python -m http.server %PORT%
|
|
goto :end
|
|
)
|
|
|
|
:: ── Try "py" launcher (Windows Python Launcher) ────────────
|
|
py -3 --version >nul 2>&1
|
|
if %errorlevel% == 0 (
|
|
echo [OK] Found Python (py launcher)! Starting on http://localhost:%PORT%
|
|
echo.
|
|
echo Leave this window open while using the tool.
|
|
echo Press Ctrl+C here to stop the server when done.
|
|
echo.
|
|
timeout /t 2 /nobreak >nul
|
|
start "" "http://localhost:%PORT%"
|
|
py -3 -m http.server %PORT%
|
|
goto :end
|
|
)
|
|
|
|
:: ── Try Node.js / npx ──────────────────────────────────────
|
|
npx --version >nul 2>&1
|
|
if %errorlevel% == 0 (
|
|
echo [OK] Found Node.js! Starting on http://localhost:%PORT%
|
|
echo.
|
|
echo Leave this window open while using the tool.
|
|
echo Press Ctrl+C here to stop the server when done.
|
|
echo.
|
|
timeout /t 2 /nobreak >nul
|
|
start "" "http://localhost:%PORT%"
|
|
npx -y serve . -l %PORT%
|
|
goto :end
|
|
)
|
|
|
|
:: ── Nothing found ──────────────────────────────────────────
|
|
color 0C
|
|
echo.
|
|
echo ==========================================
|
|
echo No web server found on your machine!
|
|
echo ==========================================
|
|
echo.
|
|
echo This tool requires a local web server because
|
|
echo browsers block camera + API access from files
|
|
echo opened directly (file://).
|
|
echo.
|
|
echo Fix: Install Python (free, easy) then try again:
|
|
echo.
|
|
echo https://www.python.org/downloads/
|
|
echo.
|
|
echo During install, CHECK the box:
|
|
echo "Add Python to PATH"
|
|
echo.
|
|
echo Then double-click start.bat again.
|
|
echo.
|
|
echo ── OR install Node.js: https://nodejs.org/ ──
|
|
echo.
|
|
pause
|
|
goto :eof
|
|
|
|
:end
|
|
echo.
|
|
echo Server stopped.
|
|
pause
|