Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions src/Server/DTOs/VerificationResultDTO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,7 @@ public record VerificationResultDTO
public bool? IsFreeze { get; set; }

/// <summary>
/// 是否为跨版本升级包
/// 包类型: 0=Unspecified, 1=Chain(差分), 2=Full(完整包), 3=Driver
/// </summary>
Comment on lines 75 to 77
public bool? IsCrossVersion { get; set; }

/// <summary>
/// 跨版本升级的源版本号
/// </summary>
public string? FromVersion { get; set; }
public int PackageType { get; set; }
}
15 changes: 8 additions & 7 deletions src/Server/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
return true;
})
.OrderByDescending(v => new Version(v.Version!))
.ThenBy(v => v.IsCrossVersion == true ? 1 : 0)
.ThenBy(v => v.PackageType == 1 ? 1 : 0)
.ToList();

if (available.Count == 0)
Expand All @@ -80,14 +80,13 @@
Version = v.Version, AppType = v.AppType, Platform = v.Platform,
ProductId = v.ProductId, IsForcibly = v.IsForcibly,
Format = v.Format ?? ".zip", Size = v.Size, IsFreeze = v.IsFreeze,
IsCrossVersion = v.IsCrossVersion ?? false,
FromVersion = v.FromVersion
PackageType = v.PackageType,
});
}

Console.WriteLine($"[Verification] Returning {results.Count} packages");
foreach (var r in results)
Console.WriteLine($" {r.Version} — {r.Name} ({(r.IsCrossVersion == true ? $"Cross {r.FromVersion} → {r.Version}" : "Full")})");
Console.WriteLine($" {r.Version} — {r.Name} ({(r.PackageType == 1 ? "Chain" : "Full")})");
Comment on lines 88 to +89

return Results.Ok(HttpResponseDTO<IEnumerable<VerificationResultDTO>>.Success(results,
$"Found {results.Count} update(s)."));
Expand Down Expand Up @@ -162,7 +161,7 @@
if (versionStore.Count > 0)
{
foreach (var v in versionStore.OrderBy(v => new Version(v.Version!)))
Console.WriteLine($" {v.Version,-12} AppType={v.AppType} {(v.IsCrossVersion == true ? $"Cross {v.FromVersion} → {v.Version}" : "Full")} {v.PacketName}");
Console.WriteLine($" {v.Version,-12} AppType={v.AppType} {(v.PackageType == 1 ? "Chain" : "Full")} {v.PacketName}");
Comment on lines 163 to +164
}
else
{
Expand Down Expand Up @@ -232,6 +231,8 @@ record VersionEntry
public string? Format { get; set; }
public long? Size { get; set; }
public bool? IsFreeze { get; set; }
public bool? IsCrossVersion { get; set; }
public string? FromVersion { get; set; }
/// <summary>
/// 包类型: 0=Unspecified, 1=Chain(差分), 2=Full(完整包), 3=Driver
/// </summary>
Comment on lines +234 to +236
public int PackageType { get; set; }
}
6 changes: 2 additions & 4 deletions src/Server/create_versions_json.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,10 @@ foreach ($p in $packages) {
Format = ".zip"
Size = $size
IsFreeze = $false
IsCrossVersion = $p.IsCross
FromVersion = $fromVer
ToVersion = $toVer
PackageType = $(if ($p.IsCross) { 1 } else { 2 })
}
$entries += $entry
$crossLabel = if ($p.IsCross) { "Cross $fromVer -> $toVer" } else { "Full" }
$crossLabel = if ($p.IsCross) { "Chain" } else { "Full" }
Write-Host " AppType=$($p.AppType) v$($p.Ver) [$crossLabel] $($file.Name) ($size bytes)"
}
}
Expand Down
6 changes: 2 additions & 4 deletions src/Server/finalize_packages.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,10 @@ foreach ($f in $zipFiles) {
Format = ".zip"
Size = $size
IsFreeze = $false
IsCrossVersion = $isCross
FromVersion = $fromVer
ToVersion = $toVer
PackageType = $(if ($isCross) { 1 } else { 2 })
}
$entries += $entry
$crossLabel = if ($isCross) { "Cross $fromVer -> $toVer" } else { "Full" }
$crossLabel = if ($isCross) { "Chain" } else { "Full" }
Write-Host " AppType=$appType v$version [$crossLabel] $($f.Name) ($size bytes)"
}

Expand Down
26 changes: 10 additions & 16 deletions src/Server/generate_packages.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ function New-VersionEntry {
[string]$PacketName, [string]$Version, [int]$AppType,
[int]$Platform = 1, [string]$ProductId,
[bool]$IsForcibly = $false, [string]$Format = ".zip",
[bool]$IsCrossVersion = $false,
[string]$FromVersion = $null, [string]$ToVersion = $null,
[int]$PackageType = 2, # 1=Chain(差分), 2=Full(完整包)
[bool]$IsFreeze = $false
)
$zipPath = Join-Path $packagesDir "$PacketName.zip"
Expand All @@ -70,18 +69,15 @@ function New-VersionEntry {
Format = $Format
Size = $size
IsFreeze = $IsFreeze
IsCrossVersion = $(if ($IsCrossVersion) { $true } else { $false })
FromVersion = $FromVersion
ToVersion = $ToVersion
PackageType = $PackageType
}
}

function Add-ZipPackage {
param(
[string]$SourceDir, [string]$PacketName,
[string]$Version, [int]$AppType,
[bool]$IsCrossVersion = $false,
[string]$FromVersion = $null, [string]$ToVersion = $null
[int]$PackageType = 2 # 1=Chain(差分), 2=Full(完整包)
)
$zipPath = Join-Path $packagesDir "$PacketName.zip"
Write-Host " Creating: $PacketName.zip" -ForegroundColor Yellow
Expand All @@ -101,7 +97,7 @@ function Add-ZipPackage {

$entry = New-VersionEntry -PacketName $PacketName -Version $Version `
-AppType $AppType -ProductId $productId `
-IsCrossVersion $IsCrossVersion -FromVersion $FromVersion -ToVersion $ToVersion
-PackageType $PackageType
$script:allVersions += $entry
}

Expand All @@ -119,7 +115,7 @@ if ((Test-Path $clientV2) -and (Test-Path $clientV1)) {
# Full (VersionChain) package
$pkgName = "packet_${timestamp}_full_client_2.0.0.0"
Add-ZipPackage -SourceDir $clientV2 -PacketName $pkgName `
-Version "2.0.0.0" -AppType 1 -IsCrossVersion $false
-Version "2.0.0.0" -AppType 1 -PackageType 2

if (-not $FullOnly) {
# Differential (CrossVersion) package via PatchGenerator
Expand Down Expand Up @@ -156,9 +152,7 @@ if ((Test-Path $clientV2) -and (Test-Path $clientV1)) {
Format = $pe.Format
Size = $pe.Size
IsFreeze = $pe.IsFreeze
IsCrossVersion = $(if ($pe.IsCrossVersion) { $true } else { $false })
FromVersion = $pe.FromVersion
ToVersion = $pe.ToVersion
PackageType = $(if ($pe.PackageType) { $pe.PackageType } elseif ($pe.IsCrossVersion) { 1 } else { 2 })
}
Comment on lines 153 to 156
}
}
Expand Down Expand Up @@ -186,7 +180,7 @@ if ((Test-Path $upgradeV2) -and (Test-Path $upgradeV1)) {
# Full (VersionChain) package
$pkgName = "packet_${timestamp}_full_upgrade_2.0.0.0"
Add-ZipPackage -SourceDir $upgradeV2 -PacketName $pkgName `
-Version "2.0.0.0" -AppType 2 -IsCrossVersion $false
-Version "2.0.0.0" -AppType 2 -PackageType 2
}
else {
Write-Host " [Skip] content_upgrade directories not found: $upgradeV1 or $upgradeV2" -ForegroundColor Yellow
Expand All @@ -207,12 +201,12 @@ foreach ($ver in @("1.0.0.1", "1.0.0.2")) {
# Client full package
$pkgName = "packet_${timestamp}_full_client_$ver"
Add-ZipPackage -SourceDir $srcPath -PacketName $pkgName `
-Version $ver -AppType 1 -IsCrossVersion $false
-Version $ver -AppType 1 -PackageType 2

# Upgrade full package
$pkgName = "packet_${timestamp}_full_upgrade_$ver"
Add-ZipPackage -SourceDir $srcPath -PacketName $pkgName `
-Version $ver -AppType 2 -IsCrossVersion $false
-Version $ver -AppType 2 -PackageType 2
}
}

Expand All @@ -233,6 +227,6 @@ Write-Host " Metadata: $versionsJsonPath" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan

foreach ($v in $uniqueVersions) {
$cross = if ($v.IsCrossVersion) { "Cross $($v.FromVersion) → $($v.ToVersion)" } else { "Full" }
$cross = if ($v.PackageType -eq 1) { "Chain" } else { "Full" }
Write-Host " AppType=$($v.AppType) v$($v.Version) [$cross] $($v.PacketName)" -ForegroundColor Gray
}
35 changes: 14 additions & 21 deletions src/Server/wwwroot/packages/versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@
"PacketName": "packet_20260602210052838_full_client_2.0.0.0",
"Url": "http://localhost:5000/File/Download/a1f180bfc0a58429a42be59d15421b810c993274af65b23a0b049880bb415d47",
"IsFreeze": false,
"IsCrossVersion": false,
"FromVersion": null,
"Platform": 1,
"IsForcibly": false,
"Size": 1068,
"Hash": "a1f180bfc0a58429a42be59d15421b810c993274af65b23a0b049880bb415d47"
"Hash": "a1f180bfc0a58429a42be59d15421b810c993274af65b23a0b049880bb415d47",
"packageType": 2
},
Comment on lines +14 to 16
{
"PubTime": "2026-06-02T21:00:52.9527877+08:00",
Expand All @@ -24,12 +23,11 @@
"PacketName": "packet_20260602210052838_full_upgrade_2.0.0.0",
"Url": "http://localhost:5000/File/Download/0d7727be7ea8520fe60ce37ce30b1a956ee6e33b252489045b4d852134b4abc6",
"IsFreeze": false,
"IsCrossVersion": false,
"FromVersion": null,
"Platform": 1,
"IsForcibly": false,
"Size": 227,
"Hash": "0d7727be7ea8520fe60ce37ce30b1a956ee6e33b252489045b4d852134b4abc6"
"Hash": "0d7727be7ea8520fe60ce37ce30b1a956ee6e33b252489045b4d852134b4abc6",
"packageType": 2
},
Comment on lines +29 to 31
{
"PubTime": "2026-06-02T21:00:52.9705223+08:00",
Expand All @@ -40,12 +38,11 @@
"PacketName": "packet_20260602210052838_full_client_1.0.0.1",
"Url": "http://localhost:5000/File/Download/47e693ac91230db216cf4ece7d6775e7bc73b79028eb76f847f74ad01d125ef6",
"IsFreeze": false,
"IsCrossVersion": false,
"FromVersion": null,
"Platform": 1,
"IsForcibly": false,
"Size": 140,
"Hash": "47e693ac91230db216cf4ece7d6775e7bc73b79028eb76f847f74ad01d125ef6"
"Hash": "47e693ac91230db216cf4ece7d6775e7bc73b79028eb76f847f74ad01d125ef6",
"packageType": 2
},
Comment on lines +44 to 46
{
"PubTime": "2026-06-02T21:00:52.9735836+08:00",
Expand All @@ -56,12 +53,11 @@
"PacketName": "packet_20260602210052838_full_upgrade_1.0.0.1",
"Url": "http://localhost:5000/File/Download/47e693ac91230db216cf4ece7d6775e7bc73b79028eb76f847f74ad01d125ef6",
"IsFreeze": false,
"IsCrossVersion": false,
"FromVersion": null,
"Platform": 1,
"IsForcibly": false,
"Size": 140,
"Hash": "47e693ac91230db216cf4ece7d6775e7bc73b79028eb76f847f74ad01d125ef6"
"Hash": "47e693ac91230db216cf4ece7d6775e7bc73b79028eb76f847f74ad01d125ef6",
"packageType": 2
},
Comment on lines +59 to 61
{
"PubTime": "2026-06-02T21:00:52.9849748+08:00",
Expand All @@ -72,12 +68,11 @@
"PacketName": "packet_20260602210052838_full_client_1.0.0.2",
"Url": "http://localhost:5000/File/Download/d0e74a16a230eb53cfd6d3d955582f3b1c22f838822e61a3148afcd2336ef94c",
"IsFreeze": false,
"IsCrossVersion": false,
"FromVersion": null,
"Platform": 1,
"IsForcibly": false,
"Size": 140,
"Hash": "d0e74a16a230eb53cfd6d3d955582f3b1c22f838822e61a3148afcd2336ef94c"
"Hash": "d0e74a16a230eb53cfd6d3d955582f3b1c22f838822e61a3148afcd2336ef94c",
"packageType": 2
},
Comment on lines +74 to 76
{
"PubTime": "2026-06-02T21:00:52.9889760+08:00",
Expand All @@ -88,12 +83,11 @@
"PacketName": "packet_20260602210052838_full_upgrade_1.0.0.2",
"Url": "http://localhost:5000/File/Download/d0e74a16a230eb53cfd6d3d955582f3b1c22f838822e61a3148afcd2336ef94c",
"IsFreeze": false,
"IsCrossVersion": false,
"FromVersion": null,
"Platform": 1,
"IsForcibly": false,
"Size": 140,
"Hash": "d0e74a16a230eb53cfd6d3d955582f3b1c22f838822e61a3148afcd2336ef94c"
"Hash": "d0e74a16a230eb53cfd6d3d955582f3b1c22f838822e61a3148afcd2336ef94c",
"packageType": 2
},
Comment on lines +89 to 91
{
"PacketName": "appupdate_2.0.0.0",
Expand All @@ -107,7 +101,6 @@
"Format": ".apk",
"Size": 43346849,
"IsFreeze": false,
"IsCrossVersion": false,
"FromVersion": null
"packageType": 2
}
Comment on lines 103 to 105
]
]
4 changes: 1 addition & 3 deletions src/gen_packages.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ function New-Package($SourceDir, $PacketName, $Version, $AppType) {
Format = ".zip"
Size = $size
IsFreeze = $false
IsCrossVersion = $false
FromVersion = $null
ToVersion = $null
PackageType = 2 # Full
}
$script:allVersions += $entry
Write-Host " $PacketName ($size bytes)" -ForegroundColor Gray
Expand Down
Loading