fix(Server): AppType filtering, WebRootPath, and new patch package#43
Merged
Conversation
- Use IWebHostEnvironment.WebRootPath instead of AppDomain.BaseDirectory to correctly locate wwwroot in both dev and publish scenarios - Filter patches by request.AppType to avoid returning mismatched updates - Remove hardcoded call counter to allow repeated test runs - Add patch_20260529221936.zip with matching SHA256 hash - Update csproj to copy patch_*.zip to output directory
There was a problem hiding this comment.
Pull request overview
Updates the sample server to correctly locate packages via IWebHostEnvironment.WebRootPath, filter returned patches by the request's AppType, and ship a freshly built patch package (with matching SHA256) so the sample can be re-run without the previous hardcoded call-count guard.
Changes:
- Replace
AppDomain.CurrentDomain.BaseDirectorywithIWebHostEnvironment.WebRootPathand remove the call counter gating repeated runs. - Add
AppTypematching on incomingVerifyDTOrequests and update the served package metadata (name/hash/URL/AppType). - Update csproj to copy any
patch_*.zipto output and refreshversions.jsonto reference the new patch package.
Reviewed changes
Copilot reviewed 3 out of 5 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Server/Program.cs | Switches to WebRootPath, removes call counter, adds AppType filtering, updates package name/hash/AppType. |
| src/Server/ServerSample.csproj | Replaces specific zip Content entry with patch_*.zip glob and removes duplicate None Include entry. |
| src/Server/wwwroot/packages/versions.json | Points to the new patch_20260529221936 package with its new hash and URL. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+24
to
+27
| // Only return patches whose AppType matches the request. | ||
| // Client convention: Client=1, Upgrade=2 (matches GeneralUpdate.Core.AppType enum). | ||
| // This patch is a main application update (AppType=Client). | ||
| const int patchAppType = 2; // Client |
ISSUE: src/Server 仅是一个硬编码模拟服务器,不支持:
- versions.json 动态加载
- AppType/Platform/ProductId 过滤
- VersionChain / CrossVersion 升级模式
- 基于 SHA256 的文件下载(断点续传)
- ClientTest/UpgradeTest 端到端升级流程
CHANGES:
Server:
重写 Program.cs,从 versions.json 动态加载包元数据
新增 /Upgrade/ 和 /Update/ 双路由兼容
新增 GET /File/Download/{hash} 下载端点(支持 Range)
新增请求日志中间件
新增 8 个升级包(Client/Upgrade × 全量/差分 × 多版本)
DTOs:
VerifyDTO 新增 UpgradeMode 字段
VerificationResultDTO 新增 UrlExpireTimeUtc/UpgradeMode/
IsCrossVersion/FromVersion/ToVersion 字段
脚本:
generate_packages.ps1 — 从 content 目录生成升级包
finalize_packages.ps1 — 整合差分/模拟包并生成 versions.json
create_versions_json.ps1 — 重建 versions.json
Content:
从 content_client/content_upgrade 移除 GeneralUpdate.*.dll,
避免升级包覆盖运行时 DLL 导致 IPC 解密失败
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
重写 src/Server,从硬编码模拟升级为功能完善的升级服务器。
Closes #44
Changes
Server 重写
DTOs 补全
升级包
脚本