70 lines
2.6 KiB
PowerShell
70 lines
2.6 KiB
PowerShell
# Download Xray + Hysteria Android binaries into app assets (required for VPN cores).
|
|
$ErrorActionPreference = "Stop"
|
|
$Root = Split-Path -Parent $PSScriptRoot
|
|
$Assets = Join-Path $Root "android\app\src\main\assets\cores"
|
|
$Tmp = Join-Path $env:TEMP "navis-android-cores"
|
|
New-Item -ItemType Directory -Force -Path $Tmp, $Assets | Out-Null
|
|
|
|
function Get-AbiDir([string]$abi) {
|
|
$d = Join-Path $Assets $abi
|
|
New-Item -ItemType Directory -Force -Path $d | Out-Null
|
|
return $d
|
|
}
|
|
|
|
$xrayVer = "25.3.6"
|
|
$xrayAssets = @(
|
|
@{ abi = "arm64-v8a"; file = "Xray-android-arm64-v8a.zip" },
|
|
@{ abi = "armeabi-v7a"; file = "Xray-android-arm32-v7a.zip" },
|
|
@{ abi = "x86_64"; file = "Xray-android-x86_64.zip?"; }
|
|
)
|
|
# Correct zip names from XTLS releases (may vary — try common ones)
|
|
$xrayAssets = @(
|
|
@{ abi = "arm64-v8a"; file = "Xray-android-arm64-v8a.zip" },
|
|
@{ abi = "armeabi-v7a"; file = "Xray-android-arm32-v7a.zip" },
|
|
@{ abi = "x86_64"; file = "Xray-android-amd64.zip" }
|
|
)
|
|
|
|
foreach ($e in $xrayAssets) {
|
|
try {
|
|
$u = "https://github.com/XTLS/Xray-core/releases/download/v$xrayVer/$($e.file)"
|
|
$z = Join-Path $Tmp $e.file
|
|
Write-Host "Downloading Xray $($e.abi) from $u ..."
|
|
Invoke-WebRequest -Uri $u -OutFile $z
|
|
$out = Join-Path $Tmp ("xray-" + $e.abi)
|
|
if (Test-Path $out) { Remove-Item -Recurse -Force $out }
|
|
Expand-Archive -Force $z $out
|
|
$bin = Get-ChildItem $out -Recurse | Where-Object { $_.Name -eq "xray" } | Select-Object -First 1
|
|
if (-not $bin) { throw "xray binary not found in zip" }
|
|
Copy-Item -Force $bin.FullName (Join-Path (Get-AbiDir $e.abi) "xray")
|
|
} catch {
|
|
Write-Warning "Skip Xray $($e.abi): $($_.Exception.Message)"
|
|
}
|
|
}
|
|
|
|
$hyVer = "app/v2.6.1"
|
|
$hyMap = @(
|
|
@{ abi = "arm64-v8a"; file = "hysteria-android-arm64" },
|
|
@{ abi = "armeabi-v7a"; file = "hysteria-android-armv7" },
|
|
@{ abi = "x86_64"; file = "hysteria-android-amd64" }
|
|
)
|
|
foreach ($h in $hyMap) {
|
|
try {
|
|
$u = "https://github.com/apernet/hysteria/releases/download/$hyVer/$($h.file)"
|
|
$dest = Join-Path (Get-AbiDir $h.abi) "hysteria"
|
|
Write-Host "Downloading Hysteria $($h.abi)..."
|
|
Invoke-WebRequest -Uri $u -OutFile $dest
|
|
} catch {
|
|
Write-Warning "Skip Hy2 $($h.abi): $($_.Exception.Message)"
|
|
}
|
|
}
|
|
|
|
@"
|
|
Navis Android cores
|
|
- xray: VLESS / VMess / Trojan
|
|
- hysteria: Hysteria 2
|
|
NaiveProxy / full AmneziaWG tunnel: WIP (import UI already accepts links)
|
|
"@ | Set-Content -Encoding UTF8 (Join-Path $Assets "README.txt")
|
|
|
|
Write-Host "Cores ready under $Assets"
|
|
Get-ChildItem $Assets -Recurse | Select-Object FullName, Length
|