param( [switch]$RequireSigning, [switch]$VerifyUpdateFeed, [string]$Root = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path ) $ErrorActionPreference = "Stop" function Fail($Message) { Write-Error $Message exit 1 } function Read-Text($RelativePath) { Get-Content -LiteralPath (Join-Path $Root $RelativePath) -Raw -Encoding UTF8 } $branding = Read-Text "QSFERA.cmake" $cmake = Read-Text "CMakeLists.txt" $craft = Read-Text ".craft.ini" $expectedAppName = -join ([char[]](0x041a, 0x0443, 0x0421, 0x0444, 0x0435, 0x0440, 0x0430)) if (-not $branding.Contains("APPLICATION_NAME") -or -not $branding.Contains($expectedAppName)) { Fail "Desktop branding must use the production Cyrillic application name." } if ($branding -notmatch 'APPLICATION_EXECUTABLE\s+"qsfera"') { Fail "Desktop executable must remain `"qsfera`" for the production profile." } if ($branding -notmatch 'APPLICATION_REV_DOMAIN\s+"eu\.qsfera\.desktop"') { Fail "Desktop reverse-domain id must remain eu.qsfera.desktop for the production profile." } if ($branding -notmatch 'APPLICATION_DEFAULT_SERVER_URL\s+"https://qsfera\.kusoft\.xyz"') { Fail "Desktop default server URL must be https://qsfera.kusoft.xyz." } if ($branding -notmatch 'APPLICATION_UPDATE_URL\s+"https://qsfera\.kusoft\.xyz/desktop/updates/stable\.xml"') { Fail "Desktop update feed URL must be https://qsfera.kusoft.xyz/desktop/updates/stable.xml." } if ($cmake -notmatch 'option\(WITH_UPDATE_NOTIFICATION\s+"Whether to check for new releases"\s+ON\)') { Fail "Desktop release builds must keep update notifications enabled by default." } if ($cmake -notmatch 'VIRTUAL_FILE_SYSTEM_PLUGINS\s+off\s+cfapi\s+openvfs') { Fail "Desktop release builds must include the Windows CfAPI VFS plugin." } if ($craft -notmatch 'CodeSigning/Enabled\s*=\s*\$\{Env:SIGN_PACKAGE\}') { Fail "Craft code-signing must be controlled by SIGN_PACKAGE." } if ($RequireSigning) { if ($env:SIGN_PACKAGE -notin @("True", "true", "1", "yes", "YES")) { Fail "Production Windows tag releases require SIGN_PACKAGE=True." } if ([string]::IsNullOrWhiteSpace($env:CRAFT_CODESIGN_CERTIFICATE)) { Fail "Production Windows tag releases require CRAFT_CODESIGN_CERTIFICATE." } $VerifyUpdateFeed = $true } if ($VerifyUpdateFeed) { $feedValidator = Join-Path $PSScriptRoot "validate-desktop-update-feed.ps1" if (-not (Test-Path -LiteralPath $feedValidator)) { Fail "Desktop update feed validator was not found: $feedValidator" } & $feedValidator -Url "https://qsfera.kusoft.xyz/desktop/updates/stable.xml" } Write-Host "QSfera Desktop production release validation passed."