GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — BlockPilotMC/Start-BlockPilot-EN.bat at main · BlockPilotDev/BlockPilotMC Expand file tree/ Copy pathStart-BlockPilot-EN.batMore file actions 153 lines (140 loc) · 6.32 KB / Copy pathStart-BlockPilot-EN.batFile metadata and controls153 lines (140 loc) · 6.32 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 @echo off REM SPDX-License-Identifier: Apache-2.0 REM BlockPilot Minecraft Panel v1.0.5 REM Purpose: Check npm, install dependencies, build the project, and open separate WEB and API consoles. REM Maintenance: Keep the split-console startup flow synchronized with the public documentation. setlocal EnableExtensions EnableDelayedExpansion chcp 65001 >nul title BlockPilotMC WEB - English cd /d "%~dp0" set "PANEL_PORT=8787" call :PrintHeader call :EnsureNpm if errorlevel 1 goto :Failed REM Install dependencies only when node_modules is missing or package-lock.json has changed. set "NEED_INSTALL=0" if not exist "node_modules\" set "NEED_INSTALL=1" if not exist "package-lock.json" ( echo [ERROR] package-lock.json was not found. Make sure the source archive was extracted completely. goto :Failed ) for /f "usebackq delims=" %%H in (`powershell -NoProfile -ExecutionPolicy Bypass -Command "(Get-FileHash -Algorithm SHA256 'package-lock.json').Hash"`) do set "CURRENT_LOCK_HASH=%%H" if not defined CURRENT_LOCK_HASH ( echo [WARN] The package-lock.json hash could not be calculated. npm ci will run again. set "NEED_INSTALL=1" ) set "SAVED_LOCK_HASH=" if exist ".blockpilot-npm-lock.sha256" set /p SAVED_LOCK_HASH=<".blockpilot-npm-lock.sha256" if /I not "!CURRENT_LOCK_HASH!"=="!SAVED_LOCK_HASH!" set "NEED_INSTALL=1" REM Reinstall when a required runtime dependency is missing, even if the saved lock hash matches. if "!NEED_INSTALL!"=="0" ( node -e "require.resolve('iconv-lite')" >nul 2>&1 if errorlevel 1 set "NEED_INSTALL=1" ) if "!NEED_INSTALL!"=="1" ( echo [INFO] Preparing project dependencies... powershell -NoProfile -ExecutionPolicy Bypass -File "scripts\windows\Install-Dependencies.ps1" -Locale "en" if errorlevel 1 goto :Failed if defined CURRENT_LOCK_HASH >".blockpilot-npm-lock.sha256" echo !CURRENT_LOCK_HASH! ) else ( echo [INFO] npm and project dependencies are ready. Installation was skipped. ) REM GitHub source archives do not include dist folders, so build the API and web interface before startup. echo [INFO] Building the API and WEB interface... call npm run build if errorlevel 1 ( echo [ERROR] The BlockPilotMC build failed. goto :Failed ) call :ReadPanelPort call :ApiIsReady if not errorlevel 1 ( echo [INFO] An existing BlockPilotMC API is already responding on port !PANEL_PORT!. goto :ApiReady ) echo [INFO] Opening a separate BlockPilotMC API console... call :StartApiConsole if errorlevel 1 goto :Failed echo [INFO] Waiting for the API to become ready... call :WaitForApi if errorlevel 1 ( echo [ERROR] The API did not become ready. Review the separate API console for details. goto :Failed ) :ApiReady set "PANEL_URL=http://127.0.0.1:!PANEL_PORT!" echo. echo [INFO] The WEB interface is ready: echo !PANEL_URL! echo [INFO] API messages are shown only in the separate API console. start "" "!PANEL_URL!" >nul 2>&1 echo [INFO] Startup complete. The WEB launcher console will close automatically; the API console will keep running. REM Successful startup no longer leaves the WEB launcher console open. REM EXIT (not EXIT /B) closes the launcher cmd.exe / Windows Terminal tab while REM the independent API console keeps running. endlocal exit 0 :ReadPanelPort REM Read PORT from .env without exposing any other environment values in the console. for /f "usebackq delims=" %%P in (`powershell -NoProfile -ExecutionPolicy Bypass -Command "$p=8787; if(Test-Path '.env'){ $line=Get-Content '.env' ^| Where-Object { $_ -match '^\s*PORT\s*=' } ^| Select-Object -Last 1; if($line){ $candidate=($line -split '=',2)[1].Trim(); $number=0; if([int]::TryParse($candidate,[ref]$number) -and $number -ge 1 -and $number -le 65535){ $p=$number } } }; Write-Output $p"`) do set "PANEL_PORT=%%P" exit /b 0 :ApiIsReady powershell -NoProfile -ExecutionPolicy Bypass -Command "try { $response=Invoke-WebRequest -UseBasicParsing -Uri 'http://127.0.0.1:!PANEL_PORT!/api/health' -TimeoutSec 2; if($response.StatusCode -eq 200){ exit 0 } } catch {}; exit 1" >nul 2>&1 exit /b %ERRORLEVEL% :StartApiConsole if not exist "scripts\windows\Start-BlockPilot-API.cmd" ( echo [ERROR] scripts\windows\Start-BlockPilot-API.cmd was not found. exit /b 1 ) REM The previous API health check intentionally returns ERRORLEVEL 1 when no API is running. REM START can preserve that old value even after opening the console successfully, so clear it first. "%ComSpec%" /d /c exit 0 call "%CD%\scripts\windows\Start-BlockPilot-API.cmd" en if errorlevel 1 ( echo [ERROR] The separate API console could not be opened. exit /b 1 ) exit /b 0 :WaitForApi powershell -NoProfile -ExecutionPolicy Bypass -Command "$url='http://127.0.0.1:!PANEL_PORT!/api/health'; for($i=0; $i -lt 45; $i++){ try { $response=Invoke-WebRequest -UseBasicParsing -Uri $url -TimeoutSec 2; if($response.StatusCode -eq 200){ exit 0 } } catch {}; Start-Sleep -Milliseconds 750 }; exit 1" >nul 2>&1 exit /b %ERRORLEVEL% :EnsureNpm REM Use the installed npm when available; otherwise install Node.js LTS through winget. where npm >nul 2>&1 if not errorlevel 1 ( for /f "usebackq delims=" %%V in (`npm --version`) do echo [INFO] npm %%V detected. exit /b 0 ) echo [WARN] npm was not found. The launcher will try to install Node.js LTS, including npm, through winget. where winget >nul 2>&1 if errorlevel 1 ( echo [ERROR] npm is unavailable and winget cannot be used to install Node.js automatically. echo [INFO] Install Node.js 22 or later from the official Node.js website, then run this file again. exit /b 1 ) winget install --id OpenJS.NodeJS.LTS --exact --accept-package-agreements --accept-source-agreements if errorlevel 1 ( echo [ERROR] The automatic Node.js LTS installation failed. exit /b 1 ) REM Add the common Node.js installation path to this console session so Windows does not need to be restarted. if exist "%ProgramFiles%\nodejs\npm.cmd" set "PATH=%ProgramFiles%\nodejs;%PATH%" where npm >nul 2>&1 if errorlevel 1 ( echo [ERROR] Node.js was installed, but npm is still unavailable in this console. echo [INFO] Close this window and run Start-BlockPilot-EN.bat again. exit /b 1 ) exit /b 0 :PrintHeader echo ============================================================ echo BlockPilotMC v1.0.5 echo WEB Startup Console - English echo ============================================================ echo. exit /b 0 :Failed echo. echo [INFO] Review the messages above to identify the startup problem. pause exit /b 1 |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |