refactor(updater): unify portable updates on Cloudflare R2
This commit is contained in:
1 parent
b73ea56135
commit
657b76fc7a
20 files changed
+118
-578
No files matched your search
@@ -24,12 +24,12 @@ NyaTerm 支持以下操作系统:
|
||||
| macOS | `.dmg` |
|
||||
| Linux | `.deb` / `.AppImage` |
|
||||
|
||||
Windows 便携版解压后运行 `NyaTerm.exe` 即可。**Help → 检查更新** 会从 GitHub Releases 读取版本和更新说明,并使用 GitHub 提供的 SHA-256 摘要验证下载包。可在设置中选择 GitHub 直连、内置镜像或自定义镜像;重启时 NyaTerm 会自动替换程序文件,并完整保留 `data/` 目录。
|
||||
Windows 便携版解压后运行 `NyaTerm.exe` 即可。**Help → 检查更新** 与安装版共用 Cloudflare R2 更新清单和下载源,暂存更新前会强制验证 Tauri updater 签名。重启时 NyaTerm 会自动替换程序文件,并完整保留 `data/` 目录。
|
||||
|
||||
Windows 便携版直接下载:
|
||||
|
||||
- [NyaTerm_1.1.17_windows_x64_portable.zip](https://github.com/nyakang/nyaterm/releases/download/v1.1.17/NyaTerm_1.1.17_windows_x64_portable.zip)(x64)
|
||||
- [NyaTerm_1.1.17_windows_arm64_portable.zip](https://github.com/nyakang/nyaterm/releases/download/v1.1.17/NyaTerm_1.1.17_windows_arm64_portable.zip)(ARM64)
|
||||
- [NyaTerm_1.1.17_windows_x64_portable.zip](https://downloads.nyaterm.app/releases/v1.1.17/NyaTerm_1.1.17_windows_x64_portable.zip)(x64)
|
||||
- [NyaTerm_1.1.17_windows_arm64_portable.zip](https://downloads.nyaterm.app/releases/v1.1.17/NyaTerm_1.1.17_windows_arm64_portable.zip)(ARM64)
|
||||
|
||||
### macOS
|
||||
|
||||
|
||||
+3
-3
@@ -24,12 +24,12 @@ Visit the [Releases](https://github.com/nyakang/nyaterm/releases) page and downl
|
||||
| macOS | `.dmg` |
|
||||
| Linux | `.deb` / `.AppImage` |
|
||||
|
||||
For the Windows portable edition, extract the zip and run `NyaTerm.exe`. **Help → Check Updates** reads version details and release notes from GitHub Releases, then verifies the downloaded archive against GitHub's SHA-256 digest. You can select direct GitHub downloads, a built-in mirror, or a custom mirror in Settings; when restarting, NyaTerm replaces the program files and preserves the complete `data/` folder.
|
||||
For the Windows portable edition, extract the zip and run `NyaTerm.exe`. **Help → Check Updates** uses the same Cloudflare R2 update manifest and download source as the installed edition. Tauri updater signatures are always verified before staging an update; when restarting, NyaTerm replaces the program files and preserves the complete `data/` folder.
|
||||
|
||||
Direct downloads for the Windows portable edition:
|
||||
|
||||
- [NyaTerm_1.1.17_windows_x64_portable.zip](https://github.com/nyakang/nyaterm/releases/download/v1.1.17/NyaTerm_1.1.17_windows_x64_portable.zip) (x64)
|
||||
- [NyaTerm_1.1.17_windows_arm64_portable.zip](https://github.com/nyakang/nyaterm/releases/download/v1.1.17/NyaTerm_1.1.17_windows_arm64_portable.zip) (ARM64)
|
||||
- [NyaTerm_1.1.17_windows_x64_portable.zip](https://downloads.nyaterm.app/releases/v1.1.17/NyaTerm_1.1.17_windows_x64_portable.zip) (x64)
|
||||
- [NyaTerm_1.1.17_windows_arm64_portable.zip](https://downloads.nyaterm.app/releases/v1.1.17/NyaTerm_1.1.17_windows_arm64_portable.zip) (ARM64)
|
||||
|
||||
### macOS
|
||||
|
||||
|
||||
@@ -47,9 +47,8 @@ type LatestDownloadManifest = {
|
||||
const latestDownloadManifestUrl = 'https://downloads.nyaterm.app/latest.json';
|
||||
const downloadBaseUrl = 'https://downloads.nyaterm.app';
|
||||
|
||||
// Fallback version for portable download links before the manifest loads.
|
||||
// Portable zips have no `.sig`, so they never appear in latest.json's platforms;
|
||||
// their URLs are derived from the manifest `version` instead (see buildPortableHref).
|
||||
// Fallback for the initial render and older manifests that predate portable targets.
|
||||
// The application updater itself never uses this unsigned URL derivation.
|
||||
const fallbackPortableVersion = 'latest';
|
||||
|
||||
const portableArchByKey: Partial<Record<DownloadPlatformKey, string>> = {
|
||||
@@ -65,7 +64,6 @@ function buildPortableHref(key: DownloadPlatformKey, version: string): string |
|
||||
|
||||
return `${downloadBaseUrl}/releases/v${version}/NyaTerm_${version}_windows_${arch}_portable.zip`;
|
||||
}
|
||||
|
||||
const downloadPlatforms: DownloadPlatform[] = [
|
||||
{
|
||||
key: 'windows-x86_64',
|
||||
@@ -237,15 +235,17 @@ function getPlatformKeyFromHints(os: string, architecture: string): DownloadPlat
|
||||
|
||||
function getDownloadPlatformsFromManifest(manifest: LatestDownloadManifest): DownloadPlatform[] {
|
||||
return downloadPlatforms.map((platform) => {
|
||||
// Portable zips have no `.sig`, so they never appear in manifest.platforms;
|
||||
// derive their URL from the manifest version when available.
|
||||
if (portableArchByKey[platform.key]) {
|
||||
const href = manifest.version ? buildPortableHref(platform.key, manifest.version) : undefined;
|
||||
return href ? {...platform, href} : platform;
|
||||
const manifestHref = manifest.platforms?.[platform.key]?.url;
|
||||
if (manifestHref) {
|
||||
return {...platform, href: manifestHref};
|
||||
}
|
||||
|
||||
const href = manifest.platforms?.[platform.key]?.url;
|
||||
return href ? {...platform, href} : platform;
|
||||
if (portableArchByKey[platform.key] && manifest.version) {
|
||||
const fallbackHref = buildPortableHref(platform.key, manifest.version);
|
||||
return fallbackHref ? {...platform, href: fallbackHref} : platform;
|
||||
}
|
||||
|
||||
return platform;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user