fix(desktop): shell-compatible module updates, no linux walls (#3452)

This commit is contained in:
Hampus authored and GitHub committed 2026-10-13 22:07:00 +02:00
1 parent f501d34179
commit 959b03b5f4
73 files changed
+4142 -4311

No files matched your search

+1 -64
View File
@@ -2,24 +2,7 @@
import {BUILD_CHANNEL} from '@electron/common/BuildChannel';
import {DOWNLOAD_PAGE_URLS} from '@electron/common/Constants';
import {DESKTOP_ARTIFACT_PRODUCT_NAME} from '@electron/common/DesktopIdentity';
import {
DESKTOP_DOWNLOAD_ARCH,
getUpdateBaseUrl,
isLinuxManualDesktopFormat,
LINUX_MANUAL_ARCH_TOKENS,
LINUX_MANUAL_FORMAT_EXTENSIONS,
type LinuxManualDesktopFormat,
type ManualDesktopFormat,
} from '@electron/main/ShellDownloadFormats';
export type UpdaterDownloadOption = {
format: ManualDesktopFormat;
label: string;
url: string;
suggestedName?: string;
sha256?: string | null;
};
import {getUpdateBaseUrl, type ManualDesktopFormat} from '@electron/main/ShellDownloadFormats';
export const UPDATE_BASE_URL = getUpdateBaseUrl();
export const DOWNLOAD_PAGE_URL = DOWNLOAD_PAGE_URLS[BUILD_CHANNEL];
@@ -33,9 +16,6 @@ export type ManualLatestInfo = {
};
function getManualDownloadFormatPreference(): Array<ManualDesktopFormat> {
if (process.platform === 'linux') {
return ['appimage', 'deb', 'rpm', 'tar_gz'];
}
if (process.platform === 'darwin') {
return ['dmg', 'zip'];
}
@@ -45,50 +25,7 @@ function getManualDownloadFormatPreference(): Array<ManualDesktopFormat> {
return [];
}
const LINUX_MANUAL_FORMAT_LABELS: Record<LinuxManualDesktopFormat, string> = {
appimage: 'AppImage',
deb: 'DEB package',
rpm: 'RPM package',
tar_gz: 'tar.gz archive',
};
export function buildManualVersionDownloadUrl(version: string, format: ManualDesktopFormat): string {
return `${UPDATE_BASE_URL}/${version}/${format}`;
}
function getArtifactProductName(): string {
return DESKTOP_ARTIFACT_PRODUCT_NAME;
}
function getManualUpdateSuggestedName(format: LinuxManualDesktopFormat, version: string): string {
const archToken = LINUX_MANUAL_ARCH_TOKENS[format][DESKTOP_DOWNLOAD_ARCH];
const extension = LINUX_MANUAL_FORMAT_EXTENSIONS[format];
return `${getArtifactProductName()}-${version}-linux-${archToken}${extension}`;
}
export function getManualDownloadOptions(info: ManualLatestInfo): Array<UpdaterDownloadOption> {
if (process.platform !== 'linux') {
return [];
}
return getManualDownloadFormatPreference()
.filter(isLinuxManualDesktopFormat)
.map((format) => {
const file = info.files[format];
return {
format,
label: LINUX_MANUAL_FORMAT_LABELS[format],
url: buildManualVersionDownloadUrl(info.version, format),
suggestedName: getManualUpdateSuggestedName(format, info.version),
sha256: file?.sha256 ?? null,
};
});
}
export function getManualDownloadUrl(info: ManualLatestInfo): string {
const [preferredOption] = getManualDownloadOptions(info);
if (preferredOption) {
return preferredOption.url;
}
for (const format of getManualDownloadFormatPreference()) {
const url = info.files[format]?.url;
if (url) {