@echo off
title PrimeRouter - ImageGen Installer
echo PrimeRouter - ImageGen installer
echo.
set "PRIMEROUTER_AUTO_CONFIRM=1"
set "PRIMEROUTER_IMAGEGEN_SOURCE_BASE=https://primerouter.ai/install/skill/imagegen"
set "PR_INSTALLER_TMP=%TEMP%\primerouter-install-%RANDOM%-%RANDOM%.ps1"
powershell -NoProfile -ExecutionPolicy Bypass -Command "Invoke-WebRequest -Uri 'https://primerouter.ai/install/imagegen.ps1' -OutFile $env:PR_INSTALLER_TMP -ErrorAction Stop"
if %errorlevel% neq 0 goto download_failed
findstr /b /c:"# PrimeRouter" "%PR_INSTALLER_TMP%" >nul
if %errorlevel% neq 0 goto script_unavailable
powershell -NoProfile -ExecutionPolicy Bypass -File "%PR_INSTALLER_TMP%"
if %errorlevel% neq 0 (
    echo.
    echo Installation failed. Please screenshot this window and contact support.
)
del /q "%PR_INSTALLER_TMP%" >nul 2>&1
goto done
:download_failed
echo.
echo Could not download the install script. Please check your network and try again.
goto cleanup
:script_unavailable
echo.
echo The install script is not available yet. Please try again after PrimeRouter has been updated.
:cleanup
del /q "%PR_INSTALLER_TMP%" >nul 2>&1
:done
echo.
pause
