@echo off
chcp 65001 >nul
title Seeker Desktop Installer
color 0B

set "BASE_URL=https://seeker-new.top/static/app"
set "BASE_URL2=https://seeker-new.top/static/app"
set "BASE_URL3=http://150.158.35.70/static/app"

echo ============================================
echo     Seeker Desktop Client Installer
echo ============================================
echo.
echo This tool will download Seeker.exe and
echo create a desktop shortcut for you.
echo.

powershell -ExecutionPolicy Bypass -NoProfile -Command "$bases=@('%BASE_URL%','%BASE_URL2%','%BASE_URL3%');$exe='Seeker.exe';$ico='seeker.ico';$desktop=[Environment]::GetFolderPath('Desktop');$loc=(Get-Location).Path;function dl($u,$f){try{Start-BitsTransfer -Source $u -Destination $f -Description 'Seeker Desktop Client';return $true}catch{try{echo '  BITS not available, using WebClient...';(New-Object System.Net.WebClient).DownloadFile($u,$f);return $true}catch{echo ('  [FAILED] '+$_.Exception.Message);return $false}}};echo '[1/3] Downloading Seeker.exe ...';$ok=$false;foreach($b in $bases){echo ('  Trying: '+$b+'/'+$exe);if(dl ($b+'/'+$exe) $exe){$ok=$true;break}};if(-not$ok){echo '';echo ' [ERROR] Failed to download Seeker.exe';cmd /c pause;exit 1};$size=(Get-Item $exe).Length;if($size -lt 1MB){echo (' [WARNING] File size looks wrong ('+$size+' bytes)');$reply=Read-Host 'Continue? (y/n)';if($reply -ne 'y'){exit 1}};echo '[2/3] Downloading icon ...';foreach($b in $bases){if(dl ($b+'/'+$ico) $ico){break}};echo '[3/3] Creating desktop shortcut...';$wshell=New-Object -ComObject WScript.Shell;$shortcut=$wshell.CreateShortcut((Join-Path $desktop 'Seeker.lnk'));$shortcut.TargetPath=(Join-Path $loc $exe);$shortcut.IconLocation=(Join-Path $loc $ico)+', 0';$shortcut.WorkingDirectory=$loc;$shortcut.Description='Seeker Education Toolbox';$shortcut.Save();echo '  Shortcut created on desktop';Unblock-File -Path (Join-Path $loc $exe) -ErrorAction SilentlyContinue;echo '';echo '============================================';echo '  Installation Complete!';echo '============================================';echo '';echo ('  Installed to: '+(Join-Path $loc $exe));echo ('  Shortcut: '+(Join-Path $desktop 'Seeker.lnk'));echo '';echo '  Double-click Seeker on your desktop to start.';echo '';Read-Host 'Press Enter to exit'"

if %errorlevel% NEQ 0 (
    echo.
    echo Installation did not complete successfully.
    pause
    exit /b 1
)
