feat(receiver): 持久化接收机发现端点并支持位置备注信息
This commit is contained in:
@@ -14,6 +14,15 @@ if (-not $ridRejected) { throw 'Dirty deployment folder was accepted' }
|
||||
if ((Get-FileHash -LiteralPath $ridSentinel -Algorithm SHA256).Hash -ne $ridBefore) { throw 'Deployment data was modified' }
|
||||
if (Test-Path -LiteralPath (Join-Path $ridOutput 'FPV-RID-Rust-Windows-x64.zip')) { throw 'Dirty package was published' }
|
||||
|
||||
$ridCacheOutput = Join-Path $ridRoot 'existing-map'
|
||||
$ridExistingTiles = Join-Path $ridCacheOutput 'FPV-RID-Rust/map_cache/img_w/2/1'
|
||||
New-Item -ItemType Directory -Path $ridExistingTiles -Force | Out-Null
|
||||
$ridMapSentinel = Join-Path $ridExistingTiles '2.png'
|
||||
[IO.File]::WriteAllText($ridMapSentinel, 'existing offline tile')
|
||||
$ridRejected = $false
|
||||
try { & (Join-Path $PSScriptRoot 'package.ps1') -OutputRoot $ridCacheOutput } catch { $ridRejected = $true }
|
||||
if (!$ridRejected -or [IO.File]::ReadAllText($ridMapSentinel) -ne 'existing offline tile') { throw 'Offline map directory was not protected' }
|
||||
|
||||
$ridCleanOutput = Join-Path $ridRoot 'clean'
|
||||
& (Join-Path $PSScriptRoot 'package.ps1') -OutputRoot $ridCleanOutput
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Clean package failed' }
|
||||
@@ -34,7 +43,7 @@ Add-Type -AssemblyName System.IO.Compression.FileSystem
|
||||
$ridZipPath = Join-Path $ridCleanOutput 'FPV-RID-Rust-Windows-x64.zip'
|
||||
$ridZip = [IO.Compression.ZipFile]::OpenRead($ridZipPath)
|
||||
try {
|
||||
$ridExpected = @('fpv-rid-registry.exe','rid-map-downloader.exe','map-downloader-LICENSE.txt','启动Rust版.cmd','使用说明.md','config.example.json','third-party-licenses.txt','dependency-licenses.txt','build-info.json','SHA256SUMS.txt') | ForEach-Object { 'FPV-RID-Rust/' + $_ }
|
||||
$ridExpected = @('fpv-rid-registry.exe','rid-map-downloader.exe','map-downloader-LICENSE.txt','启动Rust版.cmd','使用说明.md','config.example.json','third-party-licenses.txt','dependency-licenses.txt','build-info.json','SHA256SUMS.txt','map_cache/README.txt') | ForEach-Object { 'FPV-RID-Rust/' + $_ }
|
||||
$ridActual = @($ridZip.Entries | ForEach-Object { $_.FullName.Replace('\','/') })
|
||||
if ($ridActual.Count -ne $ridExpected.Count -or @(Compare-Object $ridActual $ridExpected).Count) { throw 'Archive contains unexpected files' }
|
||||
} finally { $ridZip.Dispose() }
|
||||
@@ -47,4 +56,4 @@ foreach ($ridLine in Get-Content -LiteralPath (Join-Path $ridCleanOutput 'FPV-RI
|
||||
if ((Get-FileHash -LiteralPath $ridFile -Algorithm SHA256).Hash -ne $ridHash) { throw 'Release file checksum mismatch' }
|
||||
}
|
||||
if (@(Get-ChildItem -LiteralPath $ridCleanOutput -Directory -Filter '.package-*').Count) { throw 'Owned staging files were left behind' }
|
||||
Write-Output "PASS: dirty deployment refused and preserved; repeat package, whitelist, ZIP and file checksums verified. Evidence: $ridRoot"
|
||||
Write-Output "PASS: existing data and tiles preserved; repeat package, map_cache, ZIP and file checksums verified. Evidence: $ridRoot"
|
||||
|
||||
Reference in New Issue
Block a user