Refresh portable USB bundle with freshly built server binary and synced LAUNCH.bat.
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled

This commit is contained in:
AetherForge
2026-06-09 04:17:28 -07:00
parent 615034554c
commit df88d160cb
2 changed files with 140 additions and 34 deletions

Binary file not shown.

View File

@@ -2,23 +2,52 @@
setlocal EnableExtensions EnableDelayedExpansion
title AetherForge Control Deck
cd /d "%~dp0"
set "REPO=%CD%"
echo.
echo ================================================================
echo AetherForge - One-Click Launch
echo ================================================================
echo Folder: %REPO%
echo.
set "PREP=%REPO%\scripts\launch-prep.bat"
if not exist "%PREP%" set "PREP=%REPO%\..\scripts\launch-prep.bat"
if exist "%PREP%" (
call "%PREP%" "%REPO%"
if errorlevel 1 (
echo.
echo LAUNCH prep failed - fix errors above and retry.
pause
exit /b 1
)
) else (
echo [Prep] launch-prep.bat not found - skipping pull/UI build.
)
if /i "%AF_LAUNCH_DRY_RUN%"=="1" (
echo.
echo [Dry run] Prep steps OK - not starting tunnel or server.
pause
exit /b 0
)
:: Portable deck root = folder that contains AetherForge.exe (repo usb\ or copied USB drive)
set "ROOT="
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 defined ROOT if exist "%ROOT%\AetherForge.exe" goto portable_deck
:: No portable binary - dev control server from repo
goto dev_server_launch
:portable_deck
if not exist "%ROOT%\AetherForge.exe" (
echo ERROR: AetherForge.exe missing in %ROOT%
pause
@@ -50,7 +79,6 @@ if exist "%BUNDLED_GO%" (
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.
@@ -58,7 +86,6 @@ if not errorlevel 1 (
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.
@@ -66,17 +93,11 @@ 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...
@@ -95,9 +116,8 @@ if /i not "%AF_INSTALL_TOOLS%"=="0" (
:server_launch
:: ----------------------------------------------------------------
:: 4. Ensure data directories exist
:: ----------------------------------------------------------------
echo.
echo Ensuring data directories...
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"
@@ -105,9 +125,6 @@ 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%" (
@@ -123,9 +140,7 @@ set "LAN_IP=localhost"
:lan_done
set "LAN_IP=%LAN_IP: =%"
:: ----------------------------------------------------------------
:: 6. Kill any stale server and tunnel processes
:: ----------------------------------------------------------------
echo Stopping stale 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
@@ -139,12 +154,11 @@ 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^)
echo Starting tunnel...
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%" (
@@ -154,31 +168,123 @@ if exist "%CF_SCRIPT%" (
)
echo.
:: Ensure cwd matches deck root so webroot resolution finds usb\webroot
cd /d "%ROOT%"
:: 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)
echo Starting server...
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 (
call :cleanup_tunnel "%ROOT%"
goto server_stopped
:dev_server_launch
echo.
echo No AetherForge.exe - starting dev control server ^(repo^).
echo ^(Run pack-usb.bat for portable USB bundle.^)
echo.
set "PATH=C:\Program Files\Go\bin;%USERPROFILE%\go\bin;C:\Program Files\nodejs;%PATH%"
set "DATA=%REPO%\data"
set "DECK=%REPO%"
if exist "%REPO%\usb\tools\cloudflared.exe" set "DECK=%REPO%\usb"
if exist "%REPO%\usb\data" if not exist "%DECK%\data" set "DECK=%REPO%\usb"
echo Ensuring data directories...
if not exist "%DATA%\builds" mkdir "%DATA%\builds"
if not exist "%DATA%\logs" mkdir "%DATA%\logs"
if not exist "%DATA%\spread-kits" mkdir "%DATA%\spread-kits"
if not exist "%DATA%\uploads" mkdir "%DATA%\uploads"
if not exist "%DATA%\blueprints" mkdir "%DATA%\blueprints"
if not exist "%DATA%\preps" mkdir "%DATA%\preps"
if not exist "%REPO%\bin" mkdir "%REPO%\bin"
set "SERVER_PORT=8989"
set "CONFIG_FILE=%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"
)
)
set "LAN_IP=localhost"
echo Stopping stale processes...
taskkill /F /IM miner-server.exe >nul 2>nul
taskkill /F /IM AetherForge.exe >nul 2>nul
taskkill /F /IM cloudflared.exe >nul 2>nul
ping -n 2 127.0.0.1 >nul
where go >nul 2>nul
if errorlevel 1 (
echo ERROR: Go not found - install from https://go.dev/dl/ or use pack-usb.bat
pause
exit /b 1
)
if not exist "%REPO%\bin\miner-server.exe" (
echo Building control server...
cd /d "%REPO%\server"
go mod download >nul 2>nul
go build -ldflags="-s -w" -o "..\bin\miner-server.exe" .
if errorlevel 1 (
cd /d "%REPO%"
echo ERROR: Server build failed.
pause
exit /b 1
)
cd /d "%REPO%"
)
echo.
echo ================================================================
echo STARTING CONTROL SERVER ^(dev^)
echo ================================================================
echo Dashboard: http://localhost:%SERVER_PORT%
echo Data: %DATA%\
echo ================================================================
echo.
echo Starting tunnel...
set "CF_SCRIPT=%REPO%\scripts\usb-start-cloudflared.ps1"
if not exist "%CF_SCRIPT%" set "CF_SCRIPT=%DECK%\scripts\usb-start-cloudflared.ps1"
if exist "%CF_SCRIPT%" (
powershell -NoProfile -ExecutionPolicy Bypass -File "%CF_SCRIPT%" -DeckRoot "%DECK%"
) else (
echo [Tunnel] WARNING: usb-start-cloudflared.ps1 not found.
)
echo.
start "" powershell -NoProfile -WindowStyle Hidden -Command "Start-Sleep -Seconds 3; Start-Process 'http://localhost:%SERVER_PORT%/'"
echo Starting server...
cd /d "%REPO%"
set "AF_TUNNEL_EXTERNAL=1"
"%REPO%\bin\miner-server.exe" -data "%DATA%"
set "EC=!ERRORLEVEL!"
call :cleanup_tunnel "%DECK%"
goto server_stopped
:cleanup_tunnel
set "TROOT=%~1"
if exist "%TROOT%\data\cloudflared.pid" (
for /f "usebackq" %%P in ("%TROOT%\data\cloudflared.pid") do (
taskkill /F /PID %%P >nul 2>nul
)
del "%ROOT%\data\cloudflared.pid" 2>nul
del "%TROOT%\data\cloudflared.pid" 2>nul
)
taskkill /F /IM cloudflared.exe >nul 2>nul
exit /b 0
:server_stopped
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 If port %SERVER_PORT% is in use, close other server windows and retry.
)
echo.