- 支持 Ctrl+V 粘贴配对文本和二维码图片,预览确认后识别校验 - 修复控制发送阻塞、TLS 读写争锁、设备切换沿用旧连接及串流误关窗 - 优化媒体加密上下文、UDP 接收缓冲和异步诊断日志 - 安装器按路径停止主控与信令进程,统一递增版本、打包和清理旧产物 - 发布 0.1.3+4,通过三端编译、20 项 Flutter 测试和 58 项 Rust 单元测试
48 lines
3.5 KiB
PowerShell
48 lines
3.5 KiB
PowerShell
param([Parameter(Mandatory = $true)][string]$KeepVersion)
|
|
$ErrorActionPreference = 'Stop'
|
|
if ($KeepVersion -notmatch '^\d+\.\d+\.\d+$') { throw 'Invalid version' }
|
|
$root = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path
|
|
$dist = [IO.Path]::GetFullPath((Join-Path $root 'dist'))
|
|
$keep = [IO.Path]::GetFullPath((Join-Path $dist "releases/v$KeepVersion"))
|
|
foreach ($name in @("TTSTDConnect-$KeepVersion-windows-x64-setup.exe", "TTSTDConnect-Receiver-$KeepVersion-neutral.apk", "TTSTDConnect-Receiver-$KeepVersion-aosp.apk", "TTSTDConnect-Receiver-$KeepVersion-zhanxun.apk", 'SHA256SUMS')) {
|
|
if (-not (Test-Path -LiteralPath (Join-Path $keep $name))) { throw "Latest release is incomplete: $name" }
|
|
}
|
|
function Remove-OwnedArtifact([string]$Path) {
|
|
if (-not (Test-Path -LiteralPath $Path)) { return }
|
|
$resolved = (Resolve-Path -LiteralPath $Path).Path
|
|
if (-not $resolved.StartsWith($dist + '\', [StringComparison]::OrdinalIgnoreCase) -or
|
|
$resolved -eq $keep -or $resolved.StartsWith($keep + '\', [StringComparison]::OrdinalIgnoreCase)) {
|
|
throw "Unsafe cleanup target: $resolved"
|
|
}
|
|
$item = Get-Item -LiteralPath $resolved
|
|
if ($item.PSIsContainer) {
|
|
$contents = @(Get-ChildItem -LiteralPath $resolved -Recurse -Force)
|
|
if ($item.Attributes -band [IO.FileAttributes]::ReparsePoint) {
|
|
throw "Refusing a linked cleanup root: $resolved"
|
|
}
|
|
foreach ($link in ($contents | Where-Object { $_.Attributes -band [IO.FileAttributes]::ReparsePoint })) {
|
|
$linkPath = [IO.Path]::GetFullPath($link.FullName)
|
|
if (-not $linkPath.StartsWith($resolved + '\', [StringComparison]::OrdinalIgnoreCase)) { throw "Unsafe link: $linkPath" }
|
|
# Unlink the entry itself without recursion; never traverse its target.
|
|
Remove-Item -LiteralPath $linkPath -Force
|
|
}
|
|
# Preserve diagnostics and local app settings that accidentally landed in a bundle.
|
|
foreach ($file in ($contents | Where-Object { -not $_.PSIsContainer -and -not ($_.Attributes -band [IO.FileAttributes]::ReparsePoint) -and ($_.Extension -eq '.log' -or $_.Name -like 'ttstd_*.json') })) {
|
|
$relative = $file.FullName.Substring($dist.Length + 1)
|
|
$saved = Join-Path $dist "validation/retained-artifact-data/$relative"
|
|
New-Item -ItemType Directory -Force -Path (Split-Path $saved) | Out-Null
|
|
Copy-Item -LiteralPath $file.FullName -Destination $saved -Force
|
|
}
|
|
}
|
|
Write-Output "Removing old artifact: $resolved"
|
|
Remove-Item -LiteralPath $resolved -Recurse -Force
|
|
}
|
|
Get-ChildItem -LiteralPath (Join-Path $dist 'releases') -Directory | Where-Object { $_.FullName -ne $keep } | ForEach-Object { Remove-OwnedArtifact $_.FullName }
|
|
$windows = Join-Path $dist 'windows'
|
|
if (Test-Path -LiteralPath $windows) {
|
|
Get-ChildItem -LiteralPath $windows -Directory -Filter 'stage-*' | ForEach-Object { Remove-OwnedArtifact $_.FullName }
|
|
Get-ChildItem -LiteralPath $windows -File -Filter 'TTSTDConnect-*-setup.exe' | Where-Object { $_.Name -ne "TTSTDConnect-$KeepVersion-windows-x64-setup.exe" } | ForEach-Object { Remove-OwnedArtifact $_.FullName }
|
|
}
|
|
foreach ($name in @('TTSTDConnect-Windows', 'TTSTDConnect-Android', 'linux', 'linux-signaling')) { Remove-OwnedArtifact (Join-Path $dist $name) }
|
|
Get-ChildItem -LiteralPath $dist -File | Where-Object { $_.Name -match '^(ttstdconnect[-_].*\.(deb|rpm)|TTSTDConnect-.*\.(AppImage|apk|exe|zip)|SHA256SUMS)$' } | ForEach-Object { Remove-OwnedArtifact $_.FullName }
|