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

59
scripts/lib/Common.ps1 Normal file
View File

@@ -0,0 +1,59 @@
# ==========================================
# 🛠️ COMMON UTILS
# ==========================================
# --- ЦВЕТА И ВЫВОД ---
function Write-Step { param($msg) Write-Host "`n📦 $msg" -ForegroundColor Cyan }
function Write-Success { param($msg) Write-Host "$msg" -ForegroundColor Green }
function Write-Warning { param($msg) Write-Host " ⚠️ $msg" -ForegroundColor Yellow }
function Write-Error { param($msg) Write-Host "$msg" -ForegroundColor Red }
function Write-Info { param($msg) Write-Host " $msg" -ForegroundColor Gray }
function Write-Header {
param($Title)
Write-Host ""
Write-Host "==========================================" -ForegroundColor Cyan
Write-Host " $Title" -ForegroundColor Cyan
Write-Host "==========================================" -ForegroundColor Cyan
Write-Host ""
}
# --- ПОЛЕЗНЫЕ ФУНКЦИИ ---
function Get-ScriptDirectory {
if ($PSScriptRoot) { return $PSScriptRoot }
return Split-Path -Parent $MyInvocation.MyCommand.Path
}
function Ensure-Admin {
$isAdmin = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
if (-not $isAdmin) {
Write-Host "⛔ Требуются права АДМИНИСТРАТОРА!" -ForegroundColor Red
Write-Host " Пожалуйста, запустите скрипт от имени администратора." -ForegroundColor Gray
Start-Sleep -Seconds 3
exit 1
}
}
function Show-Menu {
param(
[string]$Title,
[System.Collections.Specialized.OrderedDictionary]$Options,
[string]$Prompt = "👉 Ваш выбор"
)
if ($Title) {
Write-Host "`n$Title" -ForegroundColor Yellow
}
$keys = $Options.Keys
foreach ($key in $keys) {
Write-Host " [$key] $($Options[$key])" -ForegroundColor White
}
Write-Host ""
return Read-Host "$Prompt"
}