# minimap-releases **Repository Path**: XFTools/minimap-releases ## Basic Information - **Project Name**: minimap-releases - **Description**: MiniMap ???????? - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-01-04 - **Last Updated**: 2026-02-02 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # MiniMap 更新服务 此仓库用于 MiniMap 应用的版本更新和通知推送。 ## 文件说明 - `version.json` - 版本信息和通知数据 ## version.json 结构 ```json { "latest": { "version": "0.2.0", "release_date": "2026-01-04", "download_url": "https://gitee.com/.../MiniMap-0.2.0-win64.msi", "changelog": ["新增功能1", "修复问题2"], "min_version": null, "force_update": false }, "notifications": [...], "maintenance": {...} } ``` ### latest - 最新版本信息 | 字段 | 类型 | 必填 | 说明 | |------|------|------|------| | `version` | string | ✓ | 版本号,格式 `x.y.z`,用于与本地版本比较 | | `release_date` | string | ✓ | 发布日期,格式 `YYYY-MM-DD`,显示在更新对话框 | | `download_url` | string | ✓ | MSI 安装包下载地址,必须是直链 | | `changelog` | string[] | ✓ | 更新日志列表,每项显示为一行 | | `min_version` | string? | ✗ | 最低兼容版本,低于此版本必须更新(用于破坏性更新) | | `force_update` | bool | ✗ | 强制更新,为 `true` 时用户无法跳过,默认 `false` | ### notifications - 应用内通知 ```json { "id": "notice-2026-01", "type": "info", "title": "新功能提示", "message": "试试新的图层管理功能!", "action_url": "https://docs.example.com/new-feature", "action_text": "查看文档", "start_date": "2026-01-01", "end_date": "2026-01-31", "target_versions": ["0.1.0", "0.2.0"], "dismissible": true, "priority": 10 } ``` | 字段 | 类型 | 必填 | 说明 | |------|------|------|------| | `id` | string | ✓ | 唯一标识,用于记录已关闭的通知,避免重复显示 | | `type` | string | ✓ | 类型:`info`(蓝) / `warning`(黄) / `success`(绿) / `error`(红) | | `title` | string | ✓ | 通知标题 | | `message` | string | ✓ | 通知内容,支持多行 | | `action_url` | string? | ✗ | 操作按钮链接,点击后在浏览器打开 | | `action_text` | string? | ✗ | 操作按钮文字,需与 `action_url` 配合使用 | | `start_date` | string? | ✗ | 生效开始日期 `YYYY-MM-DD`,为空则立即生效 | | `end_date` | string? | ✗ | 生效结束日期 `YYYY-MM-DD`,为空则永久有效 | | `target_versions` | string[]? | ✗ | 目标版本列表,为空则所有版本显示 | | `dismissible` | bool | ✗ | 是否可关闭,默认 `true`,为 `false` 时每次启动都显示 | | `priority` | int | ✗ | 优先级,数值越大越靠前显示,默认 `0` | ### maintenance - 维护模式 ```json { "enabled": true, "message": "服务器维护中,预计 2 小时后恢复", "end_time": "2026-01-04T18:00:00+08:00" } ``` | 字段 | 类型 | 必填 | 说明 | |------|------|------|------| | `enabled` | bool | ✓ | 是否启用维护模式,为 `true` 时显示维护提示 | | `message` | string? | ✗ | 维护说明信息 | | `end_time` | string? | ✗ | 预计结束时间,ISO 8601 格式 | ## 发布流程 ### 1. 修改版本号 编辑 `Cargo.toml` 中的 workspace 版本: ```toml [workspace.package] version = "x.y.z" ``` ### 2. 构建 MSI ```powershell .\scripts\build-msi.ps1 ``` ### 3. 更新 version.json 修改 `update-repo/version.json` 中的版本信息和 changelog。 ### 4. 提交并推送 version.json ```powershell cd update-repo git add version.json git commit -m "Release vx.y.z" git push ``` ### 5. 创建 Gitee Release 并上传 MSI 使用 PowerShell 脚本(需要 Gitee Access Token): ```powershell $token = "YOUR_GITEE_TOKEN" $owner = "XFTools" $repo = "minimap-releases" $version = "x.y.z" # 创建 Release $body = @{ access_token = $token tag_name = "v$version" name = "MiniMap v$version" body = "## 更新内容`n- 功能1`n- 功能2" target_commitish = "main" } | ConvertTo-Json -Compress $release = Invoke-RestMethod -Uri "https://gitee.com/api/v5/repos/$owner/$repo/releases" -Method Post -Body $body -ContentType "application/json" $releaseId = $release.id # 上传 MSI 附件 $msiPath = "dist\MiniMap-$version-win64.msi" $uri = "https://gitee.com/api/v5/repos/$owner/$repo/releases/$releaseId/attach_files" $boundary = [System.Guid]::NewGuid().ToString() $fileBin = [System.IO.File]::ReadAllBytes((Resolve-Path $msiPath)) $fileName = [System.IO.Path]::GetFileName($msiPath) $bodyLines = @( "--$boundary", "Content-Disposition: form-data; name=`"access_token`"", "", $token, "--$boundary", "Content-Disposition: form-data; name=`"file`"; filename=`"$fileName`"", "Content-Type: application/octet-stream", "" ) $bodyStart = [System.Text.Encoding]::UTF8.GetBytes(($bodyLines -join "`r`n") + "`r`n") $bodyEnd = [System.Text.Encoding]::UTF8.GetBytes("`r`n--$boundary--`r`n") $body = New-Object byte[] ($bodyStart.Length + $fileBin.Length + $bodyEnd.Length) [System.Buffer]::BlockCopy($bodyStart, 0, $body, 0, $bodyStart.Length) [System.Buffer]::BlockCopy($fileBin, 0, $body, $bodyStart.Length, $fileBin.Length) [System.Buffer]::BlockCopy($bodyEnd, 0, $body, $bodyStart.Length + $fileBin.Length, $bodyEnd.Length) Invoke-RestMethod -Uri $uri -Method Post -Body $body -ContentType "multipart/form-data; boundary=$boundary" ``` ### 6. 删除旧 Release(如需重新发布) ```powershell # 获取 Release ID $releases = Invoke-RestMethod -Uri "https://gitee.com/api/v5/repos/$owner/$repo/releases?access_token=$token" $releases | ForEach-Object { Write-Host "ID: $($_.id), Tag: $($_.tag_name)" } # 删除指定 Release $releaseId = 123456 Invoke-RestMethod -Uri "https://gitee.com/api/v5/repos/$owner/$repo/releases/$releaseId`?access_token=$token" -Method Delete ``` ## 应用端配置 应用从以下地址获取版本信息: ``` https://gitee.com/XFTools/minimap-releases/raw/main/version.json ``` MSI 下载地址格式: ``` https://gitee.com/XFTools/minimap-releases/releases/download/v{version}/MiniMap-{version}-win64.msi ``` ## Gitee Token 获取方式:Gitee → 设置 → 私人令牌 → 生成新令牌(勾选 projects 权限)