@echo off
title DreamSky Local Bridge
cd /d "%~dp0"
set JS=%~dp0dreamsky-local-bridge.js
if exist "%JS%" goto RUN
echo.
echo Bridge script not found. Opening download page in your browser ...
echo.
echo   Save it into THIS folder:
echo   %~dp0
echo.
start "" "https://tm.heavendream.com.cn/download/dreamsky-local-bridge.js"
pause
exit /b
:RUN
where node >nul 2>nul
if errorlevel 1 goto NONODE
echo.
echo Starting DreamSky Local Bridge ...
echo Keep this window open, then go back to the web page and click Scan.
echo.
node "%JS%"
echo.
echo Bridge stopped.
pause
exit /b
:NONODE
echo.
echo Node.js not found. Install it first: https://nodejs.org  (LTS)
echo.
pause
