Enhance run-aspire.cmd to support Tailscale integration for remote access. The script now checks for Tailscale availability and connection status, providing warnings if not found or connected. Updated documentation in AGENTS.md and README.md to reflect changes, including instructions for using Tailscale with the Vite client. Fixed Vite configuration to pin the client port to 5173 and support HMR over Tailscale. Adjusted AppHost.cs to ensure proper endpoint targeting for Tailscale.
This commit is contained in:
@@ -5,6 +5,7 @@ rem Starts the whole app: game server, Vite client and the Aspire dashboard.
|
||||
rem Skips MSBuild when AppHost and Server dlls are newer than C# / csproj / props.
|
||||
rem run-aspire.cmd --launch-profile http
|
||||
rem run-aspire.cmd --rebuild
|
||||
rem run-aspire.cmd --no-tailscale skip `tailscale serve --bg 5173`
|
||||
|
||||
cd /d "%~dp0"
|
||||
|
||||
@@ -25,6 +26,7 @@ if errorlevel 1 (
|
||||
|
||||
set "CONFIG=Debug"
|
||||
set "REBUILD=0"
|
||||
set "TAILSCALE_SERVE=1"
|
||||
set "ARGS="
|
||||
|
||||
:parse
|
||||
@@ -34,6 +36,11 @@ if /I "%~1"=="--rebuild" (
|
||||
shift
|
||||
goto parse
|
||||
)
|
||||
if /I "%~1"=="--no-tailscale" (
|
||||
set "TAILSCALE_SERVE=0"
|
||||
shift
|
||||
goto parse
|
||||
)
|
||||
if /I "%~1"=="-c" if not "%~2"=="" set "CONFIG=%~2"
|
||||
if /I "%~1"=="--configuration" if not "%~2"=="" set "CONFIG=%~2"
|
||||
set "ARGS=!ARGS! %1"
|
||||
@@ -74,6 +81,31 @@ if errorlevel 1 (
|
||||
echo.
|
||||
|
||||
:run
|
||||
if "%TAILSCALE_SERVE%"=="1" (
|
||||
where tailscale >nul 2>&1
|
||||
if errorlevel 1 (
|
||||
echo [run-aspire] WARNING: tailscale not found in PATH.
|
||||
echo Friends cannot reach the client over the tailnet.
|
||||
echo Continuing with local access only ^(http://localhost:5173^).
|
||||
) else (
|
||||
tailscale status >nul 2>&1
|
||||
if errorlevel 1 (
|
||||
echo [run-aspire] WARNING: tailscale is not connected or not running.
|
||||
echo Friends cannot reach the client over the tailnet.
|
||||
echo Continuing with local access only ^(http://localhost:5173^).
|
||||
) else (
|
||||
echo [run-aspire] tailscale serve --bg 5173
|
||||
tailscale serve --bg 5173
|
||||
if errorlevel 1 (
|
||||
echo [run-aspire] WARNING: tailscale serve failed.
|
||||
echo Friends cannot reach the client over the tailnet.
|
||||
echo Continuing with local access only ^(http://localhost:5173^).
|
||||
)
|
||||
)
|
||||
)
|
||||
echo.
|
||||
)
|
||||
|
||||
echo [run-aspire] Starting the Aspire AppHost. Press Ctrl+C to shut everything down.
|
||||
echo.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user