Skip to content
Open
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

### 修复
- 修复 PostgreSQL 控制面凭证在配置保存重载时被重复编码的问题,并保留用户名和密码中的空格。
- Linux 桌面端能识别更新清单中的 `linux_x64` / `linux_arm` 资产,不再固定显示「已是最新」

## [1.0.3b7] - 2026-11-17

Expand Down
23 changes: 22 additions & 1 deletion desktop/src/main/update/update-coordinator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,28 @@ test("platformAssetKey maps platform+arch", () => {
assert.equal(platformAssetKey("darwin", "x64"), "mac_intel");
assert.equal(platformAssetKey("win32", "arm64"), "win_arm");
assert.equal(platformAssetKey("win32", "x64"), "win_x64");
assert.equal(platformAssetKey("linux", "x64"), null);
assert.equal(platformAssetKey("linux", "x64"), "linux_x64");
assert.equal(platformAssetKey("linux", "arm64"), "linux_arm");
assert.equal(platformAssetKey("freebsd", "x64"), null);
});

test("selectRelease picks a Linux asset", () => {
const linuxStable = {
tag: "v1.0.3",
releasesUrl: "https://github.com/x/releases",
assets: {
linux_x64: {
name: "Octop-desktop-linux-amd64-1.0.3.deb",
ext: "deb",
url: "https://download.octop.cloud/Octop-desktop-linux-amd64-1.0.3.deb",
},
},
};

const selection = selectRelease({ client: { stable: linuxStable } }, "1.0.2", "linux_x64", true);

assert.equal(selection?.tag, "v1.0.3");
assert.equal(selection?.asset.ext, "deb");
});

test("channel head stays on stable when stableOnly and beta is higher", () => {
Expand Down
9 changes: 6 additions & 3 deletions desktop/src/main/update/update-coordinator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ export interface DownloadAsset {
export interface ChannelRelease {
tag: string;
releasesUrl: string;
assets: Partial<Record<"mac_arm" | "mac_intel" | "win_x64" | "win_arm", DownloadAsset>>;
assets: Partial<
Record<"mac_arm" | "mac_intel" | "win_x64" | "win_arm" | "linux_x64" | "linux_arm", DownloadAsset>
>;
}

export interface DownloadManifest {
Expand Down Expand Up @@ -44,12 +46,13 @@ export function manifestFromDownloadsResponse(body: unknown): DownloadManifest {
return { client: data.client as DownloadManifest["client"] };
}

export type PlatformKey = "mac_arm" | "mac_intel" | "win_x64" | "win_arm";
export type PlatformKey = "mac_arm" | "mac_intel" | "win_x64" | "win_arm" | "linux_x64" | "linux_arm";

export function platformAssetKey(platform: NodeJS.Platform, arch: string): PlatformKey | null {
if (platform === "darwin") return arch === "arm64" ? "mac_arm" : "mac_intel";
if (platform === "win32") return arch === "arm64" ? "win_arm" : "win_x64";
return null; // Linux is not in the current manifest keys (§6.1).
if (platform === "linux") return arch === "arm64" ? "linux_arm" : "linux_x64";
return null;
}

export interface SelectedRelease {
Expand Down
Loading