Files

21 lines
947 B
PowerShell

param(
[string]$Server = 'wss://ttstd.com/ads',
[string]$ConnectAddress = '175.178.213.60:443',
[string]$Device = 'home-phone',
[string]$Listen = '127.0.0.1:15555',
[string]$Adb = 'adb'
)
$ErrorActionPreference = 'Stop'
$projectRoot = Split-Path $PSScriptRoot -Parent
$tokenFile = Join-Path $projectRoot 'config/private/client.env'
if (-not $env:ADS_CLIENT_TOKEN -and (Test-Path -LiteralPath $tokenFile)) {
foreach ($line in Get-Content -LiteralPath $tokenFile) {
if ($line.StartsWith('ADS_CLIENT_TOKEN=')) { $env:ADS_CLIENT_TOKEN = $line.Substring(17) }
}
}
if (-not $env:ADS_CLIENT_TOKEN) { throw 'Set ADS_CLIENT_TOKEN or provide config/private/client.env' }
$arguments = @('--server', $Server, '--device', $Device, '--listen', $Listen, '--adb', $Adb)
if ($ConnectAddress) { $arguments += @('--connect-address', $ConnectAddress) }
& (Join-Path $projectRoot 'bin/ads-client.exe') @arguments
exit $LASTEXITCODE