# --------------------------------------------------------- # core.ps1 - ORQUESTADOR PRINCIPAL v1.1.7 # --------------------------------------------------------- if (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Write-Host "`n[!] ERROR: Ejecuta como ADMINISTRADOR." -ForegroundColor Red; Pause; exit } $Global:ColTitle = "Cyan" $Global:ColMenu = "Magenta" $Global:ColOk = "Green" $Global:ColErr = "Red" $Global:ColWarn = "Yellow" $Global:SysVersion = "1.1.7" $ClaveMaestra = "123" Clear-Host Write-Host "`n[SISTEMA] Verificando credenciales..." -ForegroundColor $Global:ColTitle $passInput = Read-Host " -> Introduce clave" -AsSecureString $p = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($passInput)) if ($p -ne $ClaveMaestra) { Write-Host " [!] Acceso denegado." -ForegroundColor $Global:ColErr Start-Sleep -Seconds 2 exit } function Get-GitLabItem { param ([Parameter(Mandatory=$true)][string]$FilePath) $Branch = if ($Global:GitBranch) { $Global:GitBranch } else { "main" } $Url = "https://gitlab.com/api/v4/projects/80304083/repository/files/$([uri]::EscapeDataString($FilePath))/raw?ref=$Branch" $Headers = @{ "PRIVATE-TOKEN" = "glpat-_CjjGm3gO7XM1fubmcMBY286MQp1OmwyMTVzCw.01.1212nflx1" } try { return Invoke-RestMethod -Uri $Url -Headers $Headers -ErrorAction Stop } catch { return $null } } $settings = Get-GitLabItem -FilePath "config/settings.ps1" if ($settings) { Invoke-Expression $settings } else { Write-Host "ERROR CRÍTICO: No se pudo cargar config/settings.ps1" -ForegroundColor $Global:ColErr Pause; exit } function Show-ConfigMenu { $confLoop = $true while ($confLoop) { Clear-Host Write-Host "=== CONFIGURACIÓN DE SISTEMA ===" -ForegroundColor $Global:ColMenu Write-Host "1. Bootstrap FULL (Winget, VC++, WinRM)" Write-Host "R. Volver al Menú Principal" $opc = Read-Host "`nSelección" switch ($opc.Trim().ToUpper()) { "1" { $c = Get-GitLabItem -FilePath "$($Global:GitPath_SystemDir)/_bootstrap.ps1" if ($c) { Invoke-Expression $c } } "R" { $confLoop = $false } Default { Write-Host "Opción no válida." -ForegroundColor $Global:ColErr; Start-Sleep 1 } } } } function Show-MainMenu { $mainLoop = $true while ($mainLoop) { Clear-Host Write-Host "=== GESTOR DE AULAS v$($Global:SysVersion) ===" -ForegroundColor $Global:ColTitle Write-Host "1. Selección MANUAL de Software" Write-Host "2. BUNDLES y Aulas (Despliegue)" Write-Host "C. Configuración del Entorno" Write-Host "Q. Salir del Sistema" $op = Read-Host "`nSelección" switch ($op.Trim().ToUpper()) { "1" { $c = Get-GitLabItem -FilePath "$($Global:GitPath_SystemDir)/_select.ps1" if ($c) { Invoke-Expression $c } } "2" { $c = Get-GitLabItem -FilePath "$($Global:GitPath_SystemDir)/_select.ps1" if ($c) { Invoke-Expression $c } } "C" { Show-ConfigMenu } "Q" { $mainLoop = $false } Default { Write-Host "Opción no válida." -ForegroundColor $Global:ColErr; Start-Sleep 1 } } } } Show-MainMenu