$ErrorActionPreference = 'Stop' # VALIDACIÓN: exigir el mismo código compilado y probado antes de tocar Exaroton. $pythonPath = 'C:\Users\toto83571\AppData\Local\Programs\Python\Python311\python.exe' & $pythonPath (Join-Path $PSScriptRoot 'docs/publicar-raps.py') --check-server-ready if ($LASTEXITCODE -ne 0) { throw 'La entrega actual no tiene todas las comprobaciones requeridas.' } # PUBLICACIÓN: el puente sólo escribe con el servidor apagado y conserva respaldo. $bridgePath = Join-Path $env:LOCALAPPDATA 'CodexTools/ExarotonBridge/ExarotonBridge.ps1' . $bridgePath -Command help Assert-ServerOffline $jarPath = Join-Path $PSScriptRoot 'build/libs/Raps.jar' $expected = (Get-FileHash -LiteralPath $jarPath -Algorithm SHA256).Hash & $bridgePath -Command push -Arguments @($jarPath, 'mods/Raps.jar') if (-not $?) { throw 'El puente no confirmó la subida del JAR.' } # VERIFICACIÓN: descargar la copia real, comprobar bytes y conservar evidencia. $serverId = (Get-Settings).serverId $verifiedPath = Join-Path $PSScriptRoot 'dist/Raps-verificado-servidor.jar' New-Item -ItemType Directory -Path (Split-Path $verifiedPath -Parent) -Force | Out-Null Invoke-ExarotonApi -Method GET -Route "servers/$serverId/files/data/mods/Raps.jar/" -DownloadFile $verifiedPath | Out-Null $actual = (Get-FileHash -LiteralPath $verifiedPath -Algorithm SHA256).Hash if ($actual -ne $expected) { throw 'La copia de Exaroton no coincide con el JAR validado.' } $evidence = @{ status = 'verified'; sha256 = $expected.ToLowerInvariant(); server = 'dontstarve.exaroton.me'; verified_at = (Get-Date -Format o) } [IO.File]::WriteAllText((Join-Path $PSScriptRoot 'build/publicacion/exaroton.json'), ($evidence | ConvertTo-Json), [Text.UTF8Encoding]::new($false)) Write-Output "Exaroton actualizado y verificado: $expected"