feat: Добавлены скрипты для работы с сетью, системными утилитами и настройки Discord.
This commit is contained in:
@@ -72,6 +72,9 @@ function Download-File {
|
||||
$stream.Close()
|
||||
$resp.Close()
|
||||
|
||||
# Unblock file to prevent "Mark of the Web" issues
|
||||
Unblock-File -Path $Destination -ErrorAction SilentlyContinue
|
||||
|
||||
return $true
|
||||
}
|
||||
catch {
|
||||
@@ -80,6 +83,7 @@ function Download-File {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function Get-SubscriptionData {
|
||||
param(
|
||||
[string]$Url,
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
# 🖥️ SYSTEM UTILS
|
||||
# ==========================================
|
||||
|
||||
|
||||
# --- СИСТЕМНАЯ ИНФОРМАЦИЯ ---
|
||||
|
||||
function Get-SystemInfo {
|
||||
@@ -11,6 +12,42 @@ function Get-SystemInfo {
|
||||
}
|
||||
}
|
||||
|
||||
function Ensure-VCRedist {
|
||||
Write-Info "Проверка Visual C++ Redistributable..."
|
||||
|
||||
# Check registry for VC++ 2015-2022 (x64)
|
||||
# Key: HKLM:\SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x64
|
||||
$regPath = "HKLM:\SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x64"
|
||||
if (Test-Path $regPath) {
|
||||
$installed = (Get-ItemProperty -Path $regPath).Installed
|
||||
if ($installed -eq 1) {
|
||||
Write-Success "Visual C++ Redistributable уже установлен."
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
Write-Warning "Visual C++ Redistributable не найден. Устанавливаю..."
|
||||
|
||||
$vcUrl = "https://aka.ms/vs/17/release/vc_redist.x64.exe"
|
||||
$vcFile = "$env:TEMP\vc_redist.x64.exe"
|
||||
|
||||
if (Download-File -Url $vcUrl -Destination $vcFile) {
|
||||
Write-Step "Установка библиотек Visual C++..."
|
||||
$process = Start-Process -FilePath $vcFile -ArgumentList "/install", "/quiet", "/norestart" -PassThru -Wait
|
||||
|
||||
if ($process.ExitCode -eq 0 -or $process.ExitCode -eq 3010) {
|
||||
# 3010 = reboot required (usually works without immediate reboot)
|
||||
Write-Success "Библиотеки установлены!"
|
||||
}
|
||||
else {
|
||||
Write-Error "Ошибка установки VC++ (Код: $($process.ExitCode))"
|
||||
Write-Host " Попробуйте установить вручную: https://aka.ms/vs/17/release/vc_redist.x64.exe"
|
||||
}
|
||||
|
||||
Remove-Item $vcFile -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
|
||||
# --- DOCKER ---
|
||||
|
||||
function Test-Docker {
|
||||
|
||||
@@ -76,6 +76,12 @@ function Get-CurrentConfig {
|
||||
}
|
||||
|
||||
function Install-ProxiFyre {
|
||||
# 0. Остановка старых процессов (чтобы файлы не были заблокированы)
|
||||
Write-Step "Остановка старых процессов..."
|
||||
Stop-Service "ProxiFyreService" -Force -ErrorAction SilentlyContinue
|
||||
Stop-Process -Name "ProxiFyre" -Force -ErrorAction SilentlyContinue
|
||||
Start-Sleep -Seconds 2
|
||||
|
||||
# Установка драйвера
|
||||
Write-Step "Установка драйвера..."
|
||||
$msi = "$env:TEMP\WinpkFilter.msi"
|
||||
@@ -126,7 +132,54 @@ function Configure-And-Start {
|
||||
& "$InstallPath\ProxiFyre.exe" start 2>&1 | Out-Null
|
||||
}
|
||||
|
||||
Write-Success "Готово! Discord должен работать через прокси."
|
||||
# Мониторинг запуска (10 сек)
|
||||
Write-Info "Проверка стабильности запуска (10 сек)..."
|
||||
$lastLogSize = 0
|
||||
$logFile = $null
|
||||
|
||||
for ($i = 1; $i -le 10; $i++) {
|
||||
Start-Sleep -Seconds 1
|
||||
|
||||
# 1. Ищем файл логов (если еще не нашли)
|
||||
if (-not $logFile) {
|
||||
$logFile = Get-ChildItem "$InstallPath\*.log" -ErrorAction SilentlyContinue | Sort-Object LastWriteTime | Select-Object -Last 1
|
||||
}
|
||||
|
||||
# 2. Выводим новые строки лога
|
||||
if ($logFile) {
|
||||
try {
|
||||
$stream = [System.IO.File]::Open($logFile.FullName, 'Open', 'Read', 'ReadWrite')
|
||||
if ($stream.Length -gt $lastLogSize) {
|
||||
$stream.Seek($lastLogSize, 'Begin') | Out-Null
|
||||
$reader = New-Object System.IO.StreamReader($stream)
|
||||
$content = $reader.ReadToEnd()
|
||||
$newPos = $stream.Position # Сохраняем позицию
|
||||
$reader.Dispose() # Закрывает поток
|
||||
$lastLogSize = $newPos
|
||||
|
||||
if (-not [string]::IsNullOrWhiteSpace($content)) {
|
||||
$content -split "`r`n" | Where-Object { -not [string]::IsNullOrWhiteSpace($_) } | ForEach-Object {
|
||||
Write-Host " LOG: $_" -ForegroundColor DarkGray
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$stream.Dispose()
|
||||
}
|
||||
}
|
||||
catch {}
|
||||
}
|
||||
|
||||
# 3. Проверяем статус службы
|
||||
$svc = Get-Service -Name "ProxiFyreService" -ErrorAction SilentlyContinue
|
||||
if ($svc.Status -ne 'Running') {
|
||||
Write-Error "Служба упала при запуске! (Код 1064 или другая ошибка)"
|
||||
Write-Host " Попробуйте запустить вручную для диагностики." -ForegroundColor Gray
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
Write-Success "Готово! Служба стабильна."
|
||||
}
|
||||
|
||||
function Select-Apps {
|
||||
@@ -258,6 +311,7 @@ if ($isInstalled -and $currentConfig -and -not $Force) {
|
||||
# --- НОВАЯ УСТАНОВКА ---
|
||||
|
||||
if (-not $isInstalled -or $Force) {
|
||||
Ensure-VCRedist
|
||||
Install-ProxiFyre
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user