feat: Реализована нативная установка sing-box с системными утилитами и веб-сервером, заменяя устаревшие скрипты.

This commit is contained in:
2025-12-29 13:24:11 +03:00
parent a837072454
commit f04d04fa61
12 changed files with 1049 additions and 1320 deletions

100
scripts/setup-discord.ps1 Normal file
View File

@@ -0,0 +1,100 @@
# ==========================================
# 🎮 DISCORD PROXY SETUP
# ==========================================
param([switch]$Force)
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
. "$ScriptDir\lib\Common.ps1"
. "$ScriptDir\lib\Net.ps1"
. "$ScriptDir\lib\System.ps1"
Write-Header "НАСТРОЙКА DISCORD / VESKTOP"
Ensure-Admin
$InstallPath = "C:\Tools\ProxiFyre"
$DriverUrl = "https://github.com/wiresock/ndisapi/releases/download/v3.6.2/Windows.Packet.Filter.3.6.2.1.x64.msi"
$AppUrl = "https://github.com/wiresock/proxifyre/releases/download/v2.1.4/ProxiFyre-v2.1.4-x64-signed.zip"
# Проверка Sing-box
$singboxStatus = Get-TaskStatus -Name "SingBoxProxy"
$localProxy = "127.0.0.1:1080"
$useLocal = $false
if ($singboxStatus -eq "Running") {
Write-Info "Обнаружен работающий Native Sing-box."
$useLocal = $true
}
else {
Write-Warning "Native Sing-box не запущен!"
Write-Host " Для работы голосовых звонков он необходим." -ForegroundColor Gray
Write-Host " Вы можете вернуться в главное меню и настроить его." -ForegroundColor Gray
if ((Read-Host " Продолжить настройку БЕЗ него (голос может не работать)? (y/n)") -ne 'y') { exit }
}
# Меню выбора приложений
Write-Host "`n🎮 Какие приложения проксировать?" -ForegroundColor Yellow
$appOpts = [Ordered]@{
"1" = "Discord"
"2" = "Vesktop"
"3" = "Discord + Vesktop"
}
$appChoice = Show-Menu -Options $appOpts
$targetApps = switch ($appChoice) {
"1" { @("Discord") }
"2" { @("Vesktop") }
"3" { @("Vesktop", "Discord") }
default { @("Discord") }
}
$proxyAddr = $localProxy
if (!$useLocal) {
$proxyAddr = Read-Host "Введите адрес прокси (хост:порт) [Enter для $localProxy]"
if ([string]::IsNullOrWhiteSpace($proxyAddr)) { $proxyAddr = $localProxy }
}
# Установка драйвера
Write-Step "Установка драйвера..."
$msi = "$env:TEMP\WinpkFilter.msi"
if (Download-File -Url $DriverUrl -Destination $msi) {
Start-Process msiexec.exe -ArgumentList "/i `"$msi`" /qn /norestart" -Wait
Write-Success "Драйвер готов"
}
# Установка ProxiFyre
Write-Step "Установка ProxiFyre..."
if (!(Test-Path $InstallPath) -or $Force) {
New-Item -ItemType Directory -Path $InstallPath -Force | Out-Null
$zip = "$env:TEMP\ProxiFyre.zip"
if (Download-File -Url $AppUrl -Destination $zip) {
Expand-Archive -Path $zip -DestinationPath $InstallPath -Force
# Handle update folder structure if needed, simplified here assuming flat or check generic
$exe = Get-ChildItem $InstallPath -Recurse -Filter "ProxiFyre.exe" | Select -First 1
if ($exe.DirectoryName -ne $InstallPath) {
Copy-Item "$($exe.DirectoryName)\*" $InstallPath -Recurse -Force
}
Write-Success "Распаковано"
}
}
# Конфиг
$cfg = @{
logLevel = "Info"
proxies = @(@{
appNames = $targetApps
socks5ProxyEndpoint = $proxyAddr
supportedProtocols = @("TCP", "UDP")
})
excludes = @()
}
$cfg | ConvertTo-Json -Depth 5 | Set-Content "$InstallPath\app-config.json" -Encoding UTF8
# Служба
Write-Step "Перезапуск службы..."
Start-Process "$InstallPath\ProxiFyre.exe" -ArgumentList "stop" -Wait -NoNewWindow
Start-Process "$InstallPath\ProxiFyre.exe" -ArgumentList "install" -Wait -NoNewWindow
Start-Process "$InstallPath\ProxiFyre.exe" -ArgumentList "start" -Wait -NoNewWindow
Write-Success "Готово! Discord должен работать через прокси."
Start-Sleep -Seconds 3