feat: Добавлена установка и управление sing-box, настройка Discord и общие системные утилиты для задач и брандмауэра.
This commit is contained in:
@@ -2,6 +2,25 @@
|
||||
# 🛠️ COMMON UTILS
|
||||
# ==========================================
|
||||
|
||||
# --- ГЛОБАЛЬНЫЕ НАСТРОЙКИ ---
|
||||
|
||||
# Режим отладки (передаётся через -Debug)
|
||||
if (-not (Test-Path variable:script:DebugMode)) {
|
||||
$script:DebugMode = $false
|
||||
}
|
||||
|
||||
function Set-DebugMode {
|
||||
param([bool]$Enabled)
|
||||
$script:DebugMode = $Enabled
|
||||
if ($Enabled) {
|
||||
Write-Host " 🔧 Debug режим включён" -ForegroundColor Magenta
|
||||
}
|
||||
}
|
||||
|
||||
function Get-DebugMode {
|
||||
return $script:DebugMode
|
||||
}
|
||||
|
||||
# --- ЦВЕТА И ВЫВОД ---
|
||||
|
||||
function Write-Step { param($msg) Write-Host "`n📦 $msg" -ForegroundColor Cyan }
|
||||
@@ -10,8 +29,20 @@ function Write-Warning { param($msg) Write-Host " ⚠️ $msg" -ForegroundColo
|
||||
function Write-Error { param($msg) Write-Host " ❌ $msg" -ForegroundColor Red }
|
||||
function Write-Info { param($msg) Write-Host " ℹ️ $msg" -ForegroundColor Gray }
|
||||
|
||||
function Write-DebugLog {
|
||||
param($msg)
|
||||
if ($script:DebugMode) {
|
||||
Write-Host " [DEBUG] $msg" -ForegroundColor DarkGray
|
||||
}
|
||||
}
|
||||
|
||||
function Write-Header {
|
||||
param($Title)
|
||||
param($Title, [switch]$ClearScreen)
|
||||
|
||||
if ($ClearScreen -and -not $script:DebugMode) {
|
||||
Clear-Host
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "==========================================" -ForegroundColor Cyan
|
||||
Write-Host " $Title" -ForegroundColor Cyan
|
||||
@@ -19,6 +50,36 @@ function Write-Header {
|
||||
Write-Host ""
|
||||
}
|
||||
|
||||
# --- ЗАПУСК КОМАНД ---
|
||||
|
||||
function Invoke-Silent {
|
||||
param(
|
||||
[string]$FilePath,
|
||||
[string]$Arguments,
|
||||
[switch]$Wait
|
||||
)
|
||||
|
||||
$psi = New-Object System.Diagnostics.ProcessStartInfo
|
||||
$psi.FileName = $FilePath
|
||||
$psi.Arguments = $Arguments
|
||||
$psi.UseShellExecute = $false
|
||||
$psi.CreateNoWindow = $true
|
||||
|
||||
if (-not $script:DebugMode) {
|
||||
$psi.RedirectStandardOutput = $true
|
||||
$psi.RedirectStandardError = $true
|
||||
}
|
||||
|
||||
$process = [System.Diagnostics.Process]::Start($psi)
|
||||
|
||||
if ($Wait) {
|
||||
$process.WaitForExit()
|
||||
return $process.ExitCode
|
||||
}
|
||||
|
||||
return $process
|
||||
}
|
||||
|
||||
# --- ПОЛЕЗНЫЕ ФУНКЦИИ ---
|
||||
|
||||
function Get-ScriptDirectory {
|
||||
@@ -55,5 +116,3 @@ function Show-Menu {
|
||||
|
||||
return Read-Host "$Prompt"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -4,24 +4,6 @@
|
||||
|
||||
# --- СИСТЕМНАЯ ИНФОРМАЦИЯ ---
|
||||
|
||||
function Get-HWID {
|
||||
param([string]$StoreDir)
|
||||
|
||||
$hwidFile = "$StoreDir\hwid"
|
||||
if (Test-Path $hwidFile) {
|
||||
return (Get-Content $hwidFile -Raw).Trim()
|
||||
}
|
||||
|
||||
$hwid = [System.Guid]::NewGuid().ToString("N").Substring(0, 16)
|
||||
|
||||
if (!(Test-Path $StoreDir)) {
|
||||
New-Item -ItemType Directory -Path $StoreDir -Force | Out-Null
|
||||
}
|
||||
|
||||
Set-Content -Path $hwidFile -Value $hwid
|
||||
return $hwid
|
||||
}
|
||||
|
||||
function Get-SystemInfo {
|
||||
return @{
|
||||
os = "windows"
|
||||
|
||||
Reference in New Issue
Block a user