Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
65 changes: 57 additions & 8 deletions website/docs/quickstart/GeneralUpdate.PacketTool.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,21 @@ dotnet run --project GeneralUpdate.Tools.csproj

> Simulation 模块内部会调用 `dotnet publish` 构建测试应用,因此使用仿真功能时必须安装 .NET SDK。Mobile 模块的项目模式(Build & Locate)也会调用 `dotnet publish`,同样需要 .NET SDK。仅运行 Patch / Extension / OSS / Config 模块以及 Mobile 的文件模式则不需要。

## 七个模块速览
## 左侧导航模块

| 模块 | 你提供 | 工具产出 | 下游消费者 |
|------|--------|----------|------------|
| **Patch** | 旧版本目录 + 新版本目录 | `{name}.zip`(含 `.patch` 文件、新文件、`generalupdate.delete.json`) | Server、OSS/CDN、Core Upgrade 进程 |
| **Extension** | 扩展源目录 + 元数据 | `{name}_{version}.zip`(含 `manifest.json`) | `GeneralUpdate.Extension` 组件 |
| **OSS Config** | 包名、版本、下载 URL、本地 ZIP(计算 Hash) | `oss_config.json`(版本数组) | OSS 客户端、对象存储发布流程 |
| **Config** | Client/Upgrade 的 `.csproj` | `generalupdate.manifest.json` + `sample_output/` 发布目录 | Client/Upgrade 启动引导 |
| **Simulation** | 旧版本目录 + 补丁 ZIP | 本地更新服务 + `simulation_report.md` | 发布前质量把关 |
| **Hash** | 本地文件(ZIP) | SHA256 小写十六进制字符串 | 完整性校验、服务端版本记录 |
| **Mobile** | APK/AAB 文件或 MAUI/Avalonia Android 的 `.csproj` | `mobile_version_{timestamp}.json` 版本记录 | 移动端更新服务端、GeneralUpdate.Avalonia/Maui 组件 |
| **补丁包(Patch)** | 旧版本目录 + 新版本目录 | `{name}.zip`(含 `.patch` 文件、新文件和删除清单) | Server、OSS/CDN、Core Upgrade 进程 |
| **扩展包(Extension)** | 扩展源目录 + 元数据 | `{name}_{version}.zip`(含 `manifest.json`) | `GeneralUpdate.Extension` 组件 |
| **OSS 配置(OSS)** | 包名、版本、下载 URL、本地文件(计算 Hash) | 用户选择位置的 `oss_config.json` | OSS 客户端、对象存储发布流程 |
| **模拟更新(Simulate)** | 旧版本目录 + 补丁 ZIP | 本地更新服务 + 仿真报告 | 发布前质量把关 |
| **移动端(Mobile)** | APK/AAB 或 MAUI/Avalonia Android `.csproj` | 上传结果 + `mobile_version_{timestamp}.json` | 移动端更新服务端、Avalonia/Maui Android 组件 |
| **配置生成(Config)** | Client/Upgrade 的 `.csproj` | `generalupdate.manifest.json` + 示例发布目录 | Client/Upgrade 启动引导 |
| **设置(Settings)** | 上传地址、身份认证、仿真参数、功能开关 | `%APPDATA%/GeneralUpdate.Tools/config.json` | 所有需要自动上传或本地仿真的模块 |

:::tip 关于 SHA256
SHA256 不作为独立导航页面,而是集成在 **OSS 配置**的“计算”和 **移动端**的元数据分析中。
:::

---

Expand Down Expand Up @@ -463,6 +467,51 @@ Generate Sample 额外输出:

---

## Settings:上传与运行参数

设置页集中管理所有模块共用的持久化配置。保存后,配置会写入:

```text
%APPDATA%\GeneralUpdate.Tools\config.json
```

Windows 可按 `Win+R` 输入 `%APPDATA%\GeneralUpdate.Tools` 后打开。工具会同时维护 `config.json.backup`;密码、Token 和 API Key 使用系统加密后再写入配置。

### 上传服务器

| 字段 | 默认值 | 说明 |
|------|--------|------|
| 服务器地址 | 空 | 必须填写绝对地址,例如 `https://update.example.com` |
| 上传接口路径 | `/api/v1/packages/upload` | 工具会与服务器地址拼接;可填写相对路径或以 `/` 开头的路径 |
| 超时时间 | 300 秒 | 单次上传最长等待时间 |
| 重试次数 | 3 | 失败后最多重试的次数;重试间隔采用指数退避 |
| 补丁生成后自动上传 | 关闭 | 打开后,Patch 打包成功即调用上传接口 |

上传使用 `multipart/form-data`,文件字段名为 `file`。HTTP 4xx(超时、429 除外)会直接视为拒绝;5xx、超时、网络错误可按重试次数继续尝试。

### 身份认证

| 认证方式 | 工具行为 |
|----------|----------|
| None | 不发送认证头 |
| Basic Auth | 使用用户名、密码生成 `Authorization: Basic ...` |
| Token | 在 `Authorization` 请求头中发送配置的令牌 |
| API Key | 将 API Key 放入自定义请求头,默认请求头名为 `X-API-Key` |

配置后建议先点击 **测试连接**。测试会向拼接后的完整地址发送 GET 请求,并根据 HTTP 成功状态判断可用性。

### 仿真与功能开关

- **本地服务器端口**:模拟更新的默认端口为 `5000`。
- **模拟服务器需要身份认证**:为仿真服务器启用认证选项。
- **打包前检测加密文件**:控制 Patch 模块是否在打包前扫描可疑文件。
- **自动校验 SemVer**:保留为全局功能开关;实际模块仍会执行版本格式校验。
- **显示 JSON 预览**:配置中的 JSON 预览选项。

点击 **保存设置**立即持久化;**恢复默认**会重置上传、认证、仿真和功能开关配置。

---

## 推荐发布工作流

### 桌面端更新
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,21 @@ Go to [GeneralUpdate.Tools Releases](https://github.com/GeneralLibrary/GeneralUp

> The Simulation module internally runs `dotnet publish` to build test apps, so you need the .NET SDK for that feature. The Mobile module's Project Mode (Build & Locate) also runs `dotnet publish`, which requires the .NET SDK too. Patch / Extension / OSS / Config modules and Mobile's File Mode work without the SDK.

## Seven modules at a glance
## Sidebar modules

| Module | What you provide | What the tool produces | Downstream consumer |
|--------|-----------------|----------------------|---------------------|
| **Patch** | Old version directory + new version directory | `{name}.zip` (contains `.patch` files, new files, `generalupdate.delete.json`) | Server, OSS/CDN, Core Upgrade process |
| **Extension** | Extension source directory + metadata | `{name}_{version}.zip` (contains `manifest.json`) | `GeneralUpdate.Extension` component |
| **OSS Config** | Package name, version, download URL, local ZIP (for hash) | `oss_config.json` (version array) | OSS client, object storage publish flow |
| **Config** | Client/Upgrade `.csproj` files | `generalupdate.manifest.json` + `sample_output/` publish directory | Client/Upgrade bootstrap |
| **Simulation** | Old version directory + patch ZIP | Local update server + `simulation_report.md` | Pre-release QA gate |
| **Hash** | Local file (ZIP) | SHA256 lowercase hex string | Integrity check, server-side version records |
| **Mobile** | APK/AAB file or MAUI/Avalonia Android `.csproj` | `mobile_version_{timestamp}.json` version record | Mobile update server, GeneralUpdate.Avalonia/Maui components |
| **Patch** | Old and new version directories | `{name}.zip` with `.patch` files, new files, and a deletion manifest | Server, OSS/CDN, Core Upgrade process |
| **Extension** | Extension source directory and metadata | `{name}_{version}.zip` containing `manifest.json` | `GeneralUpdate.Extension` component |
| **OSS** | Package name, version, URL, and a local file for hashing | `oss_config.json` at the location you choose | OSS client or object-storage publish flow |
| **Simulate** | Old application directory and patch ZIP | Local update server and simulation report | Pre-release QA gate |
| **Mobile** | APK/AAB file or MAUI/Avalonia Android `.csproj` | Upload result and `mobile_version_{timestamp}.json` | Mobile update server and Android clients |
| **Config** | Client/Upgrade `.csproj` files | `generalupdate.manifest.json` and an optional sample publish directory | Client/Upgrade bootstrap |
| **Settings** | Upload server, authentication, simulation, and feature options | `%APPDATA%/GeneralUpdate.Tools/config.json` | Modules that upload or run a local simulation |

:::tip SHA256
SHA256 is not a separate sidebar page. It is available through **OSS Config > Compute** and the **Mobile** metadata workflow.
:::

---

Expand Down Expand Up @@ -443,6 +447,51 @@ Supports two modes:

---

## Settings: Upload and runtime options

The Settings page stores shared configuration used by upload and simulation workflows:

```text
%APPDATA%\GeneralUpdate.Tools\config.json
```

On Windows, open `%APPDATA%\GeneralUpdate.Tools` from `Win+R`. The app keeps a backup at `config.json.backup`. Passwords, bearer tokens, and API keys are protected by the operating-system credential encryption before they are written to the configuration file.

### Upload server

| Field | Default | Description |
|-------|---------|-------------|
| Server URL | Empty | An absolute URL such as `https://update.example.com` |
| Upload endpoint | `/api/v1/packages/upload` | Appended to the server URL |
| Timeout | 300 seconds | Maximum time to wait for one upload attempt |
| Retry count | 3 | Number of retries after failure; delays use exponential backoff |
| Auto-upload after patch generation | Off | Upload the generated ZIP immediately after a successful Patch build |

Uploads use `multipart/form-data`, with the file supplied under the `file` field. HTTP 4xx responses (except timeout and 429) are treated as server rejection; 5xx, timeout, and network errors can be retried.

### Authentication

| Scheme | Behavior |
|--------|----------|
| None | No authentication header |
| Basic Auth | Sends `Authorization: Basic ...` using username and password |
| Token | Sends the configured token in the `Authorization` request header |
| API Key | Sends the key in a configurable request header, defaulting to `X-API-Key` |

Use **Test Connection** after saving; it sends a GET request to the configured upload URL and reports whether the response is successful.

### Simulation and feature switches

- **Local server port**: defaults to `5000` for update simulation.
- **Simulation server requires authentication**: enables authentication for the local simulation server.
- **Detect encrypted files before packaging**: controls whether Patch scans output for suspicious or packed files.
- **Validate SemVer automatically**: global option for version-validation behavior; modules still validate required version fields.
- **Show JSON preview**: the JSON-preview option in the configuration.

**Save Settings** persists immediately. **Reset to Defaults** restores upload, authentication, simulation, and feature options.

---

## Recommended release workflow

### Desktop update
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,21 @@ dotnet run --project GeneralUpdate.Tools.csproj

> Simulation 模块内部会调用 `dotnet publish` 构建测试应用,因此使用仿真功能时必须安装 .NET SDK。Mobile 模块的项目模式(Build & Locate)也会调用 `dotnet publish`,同样需要 .NET SDK。仅运行 Patch / Extension / OSS / Config 模块以及 Mobile 的文件模式则不需要。

## 七个模块速览
## 左侧导航模块

| 模块 | 你提供 | 工具产出 | 下游消费者 |
|------|--------|----------|------------|
| **Patch** | 旧版本目录 + 新版本目录 | `{name}.zip`(含 `.patch` 文件、新文件、`generalupdate.delete.json`) | Server、OSS/CDN、Core Upgrade 进程 |
| **Extension** | 扩展源目录 + 元数据 | `{name}_{version}.zip`(含 `manifest.json`) | `GeneralUpdate.Extension` 组件 |
| **OSS Config** | 包名、版本、下载 URL、本地 ZIP(计算 Hash) | `oss_config.json`(版本数组) | OSS 客户端、对象存储发布流程 |
| **Config** | Client/Upgrade 的 `.csproj` | `generalupdate.manifest.json` + `sample_output/` 发布目录 | Client/Upgrade 启动引导 |
| **Simulation** | 旧版本目录 + 补丁 ZIP | 本地更新服务 + `simulation_report.md` | 发布前质量把关 |
| **Hash** | 本地文件(ZIP) | SHA256 小写十六进制字符串 | 完整性校验、服务端版本记录 |
| **Mobile** | APK/AAB 文件或 MAUI/Avalonia Android 的 `.csproj` | `mobile_version_{timestamp}.json` 版本记录 | 移动端更新服务端、GeneralUpdate.Avalonia/Maui 组件 |
| **补丁包(Patch)** | 旧版本目录 + 新版本目录 | `{name}.zip`(含 `.patch` 文件、新文件和删除清单) | Server、OSS/CDN、Core Upgrade 进程 |
| **扩展包(Extension)** | 扩展源目录 + 元数据 | `{name}_{version}.zip`(含 `manifest.json`) | `GeneralUpdate.Extension` 组件 |
| **OSS 配置(OSS)** | 包名、版本、下载 URL、本地文件(计算 Hash) | 用户选择位置的 `oss_config.json` | OSS 客户端、对象存储发布流程 |
| **模拟更新(Simulate)** | 旧版本目录 + 补丁 ZIP | 本地更新服务 + 仿真报告 | 发布前质量把关 |
| **移动端(Mobile)** | APK/AAB 或 MAUI/Avalonia Android `.csproj` | 上传结果 + `mobile_version_{timestamp}.json` | 移动端更新服务端、Avalonia/Maui Android 组件 |
| **配置生成(Config)** | Client/Upgrade 的 `.csproj` | `generalupdate.manifest.json` + 示例发布目录 | Client/Upgrade 启动引导 |
| **设置(Settings)** | 上传地址、身份认证、仿真参数、功能开关 | `%APPDATA%/GeneralUpdate.Tools/config.json` | 所有需要自动上传或本地仿真的模块 |

:::tip 关于 SHA256
SHA256 不作为独立导航页面,而是集成在 **OSS 配置**的“计算”和 **移动端**的元数据分析中。
:::

---

Expand Down Expand Up @@ -458,6 +462,51 @@ Generate Sample 额外输出:

---

## Settings:上传与运行参数

设置页集中管理所有模块共用的持久化配置。保存后,配置会写入:

```text
%APPDATA%\GeneralUpdate.Tools\config.json
```

Windows 可按 `Win+R` 输入 `%APPDATA%\GeneralUpdate.Tools` 后打开。工具会同时维护 `config.json.backup`;密码、Token 和 API Key 使用系统加密后再写入配置。

### 上传服务器

| 字段 | 默认值 | 说明 |
|------|--------|------|
| 服务器地址 | 空 | 必须填写绝对地址,例如 `https://update.example.com` |
| 上传接口路径 | `/api/v1/packages/upload` | 工具会与服务器地址拼接;可填写相对路径或以 `/` 开头的路径 |
| 超时时间 | 300 秒 | 单次上传最长等待时间 |
| 重试次数 | 3 | 失败后最多重试的次数;重试间隔采用指数退避 |
| 补丁生成后自动上传 | 关闭 | 打开后,Patch 打包成功即调用上传接口 |

上传使用 `multipart/form-data`,文件字段名为 `file`。HTTP 4xx(超时、429 除外)会直接视为拒绝;5xx、超时、网络错误可按重试次数继续尝试。

### 身份认证

| 认证方式 | 工具行为 |
|----------|----------|
| None | 不发送认证头 |
| Basic Auth | 使用用户名、密码生成 `Authorization: Basic ...` |
| Token | 在 `Authorization` 请求头中发送配置的令牌 |
| API Key | 将 API Key 放入自定义请求头,默认请求头名为 `X-API-Key` |

配置后建议先点击 **测试连接**。测试会向拼接后的完整地址发送 GET 请求,并根据 HTTP 成功状态判断可用性。

### 仿真与功能开关

- **本地服务器端口**:模拟更新的默认端口为 `5000`。
- **模拟服务器需要身份认证**:为仿真服务器启用认证选项。
- **打包前检测加密文件**:控制 Patch 模块是否在打包前扫描可疑文件。
- **自动校验 SemVer**:保留为全局功能开关;实际模块仍会执行版本格式校验。
- **显示 JSON 预览**:配置中的 JSON 预览选项。

点击 **保存设置**立即持久化;**恢复默认**会重置上传、认证、仿真和功能开关配置。

---

## 推荐发布工作流

### 桌面端更新
Expand Down
Loading