Skip to content

Commit c5f4618

Browse files
committed
Fix: Download page for ARM64
1 parent 7b571a7 commit c5f4618

5 files changed

Lines changed: 68 additions & 36 deletions

File tree

‎Website/scripts/fetch-release-data.mjs‎

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,17 @@ function assetFileName(version, variant, arch) {
5454
return `NETworkManager_${version}${suffix}_win-${arch}${ext}`;
5555
}
5656

57+
// DEPRECATED: only exists to read releases published before the arch split
58+
// (native ARM64 build, #3538), which shipped a single, x64-only asset with no
59+
// "_win-<arch>" part in the name. Every release going forward uses
60+
// assetFileName() instead. Safe to delete once no release predating #3538 is
61+
// still linked to from the website (i.e. once release.json itself has moved
62+
// past 2026.7.7.0).
63+
function legacyAssetFileName(version, variant) {
64+
const { suffix, ext } = VARIANTS[variant];
65+
return `NETworkManager_${version}${suffix}${ext}`;
66+
}
67+
5768
function ghHeaders() {
5869
const headers = {
5970
"User-Agent": "NETworkManager-website-build",
@@ -90,11 +101,22 @@ async function fetchChecksumMap(version) {
90101
for (const line of text.split(/\r?\n/)) {
91102
const m = line.trim().match(/^([0-9a-fA-F]{64})\s+(.+)$/);
92103
if (!m) continue;
104+
let matched = false;
93105
for (const arch of ARCHITECTURES) {
94106
for (const variant of Object.keys(VARIANTS)) {
95107
if (m[2] === assetFileName(version, variant, arch)) {
96108
map[arch] ??= {};
97109
map[arch][variant] = m[1].toUpperCase();
110+
matched = true;
111+
}
112+
}
113+
}
114+
// DEPRECATED fallback — see legacyAssetFileName().
115+
if (!matched) {
116+
for (const variant of Object.keys(VARIANTS)) {
117+
if (m[2] === legacyAssetFileName(version, variant)) {
118+
map.x64 ??= {};
119+
map.x64[variant] = m[1].toUpperCase();
98120
}
99121
}
100122
}
@@ -107,13 +129,24 @@ async function fetchChecksumMap(version) {
107129
// asset (older releases predate ARM64 support and won't have one).
108130
function buildDownloads(release, version) {
109131
const downloads = {};
110-
for (const arch of ARCHITECTURES) {
111-
for (const variant of Object.keys(VARIANTS)) {
132+
for (const variant of Object.keys(VARIANTS)) {
133+
let matched = false;
134+
for (const arch of ARCHITECTURES) {
112135
const name = assetFileName(version, variant, arch);
113136
const asset = release.assets.find((a) => a.name === name);
114137
if (asset) {
115138
downloads[arch] ??= {};
116139
downloads[arch][variant] = asset.browser_download_url;
140+
matched = true;
141+
}
142+
}
143+
// DEPRECATED fallback — see legacyAssetFileName().
144+
if (!matched) {
145+
const legacyName = legacyAssetFileName(version, variant);
146+
const asset = release.assets.find((a) => a.name === legacyName);
147+
if (asset) {
148+
downloads.x64 ??= {};
149+
downloads.x64[variant] = asset.browser_download_url;
117150
}
118151
}
119152
}

‎Website/src/components/ArchSwitcher/index.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import clsx from "clsx";
22
import styles from "./styles.module.css";
33

44
// Segmented control to pick which CPU architecture's downloads are shown.
5-
// The caller is responsible for hiding it when only one architecture is available.
5+
// Always rendered, even with a single option, so the user can see which
6+
// architecture the download links point to.
67
export default function ArchSwitcher({ options, value, onChange, className }) {
78
return (
89
<div

‎Website/src/components/DownloadSection/index.js‎

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,16 @@ export default function DownloadSection() {
5858
changelogLabel="✨ What's new?"
5959
/>
6060

61-
{architectures.length > 1 && (
62-
<div className={styles.archSwitcherRow}>
63-
<ArchSwitcher
64-
options={architectures.map((a) => ({
65-
key: a,
66-
label: ARCH_LABELS[a] ?? a,
67-
}))}
68-
value={arch}
69-
onChange={setArch}
70-
/>
71-
</div>
72-
)}
61+
<div className={styles.archSwitcherRow}>
62+
<ArchSwitcher
63+
options={architectures.map((a) => ({
64+
key: a,
65+
label: ARCH_LABELS[a] ?? a,
66+
}))}
67+
value={arch}
68+
onChange={setArch}
69+
/>
70+
</div>
7371

7472
<DownloadGrid>
7573
{VARIANTS.filter((v) => archDownloads[v.key]).map((v) => (

‎Website/src/components/LatestPrerelease/index.js‎

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -46,24 +46,22 @@ export default function LatestPrerelease() {
4646
/>
4747

4848
<div className="margin-bottom--lg">
49-
{architectures.length > 1 && (
50-
<div
51-
style={{
52-
display: "flex",
53-
justifyContent: "center",
54-
marginBottom: "16px",
55-
}}
56-
>
57-
<ArchSwitcher
58-
options={architectures.map((a) => ({
59-
key: a,
60-
label: ARCH_LABELS[a] ?? a,
61-
}))}
62-
value={arch}
63-
onChange={setArch}
64-
/>
65-
</div>
66-
)}
49+
<div
50+
style={{
51+
display: "flex",
52+
justifyContent: "center",
53+
marginBottom: "16px",
54+
}}
55+
>
56+
<ArchSwitcher
57+
options={architectures.map((a) => ({
58+
key: a,
59+
label: ARCH_LABELS[a] ?? a,
60+
}))}
61+
value={arch}
62+
onChange={setArch}
63+
/>
64+
</div>
6765
<DownloadGrid>
6866
{VARIANTS.filter((v) => archDownloads[v.key]).map((v) => (
6967
<DownloadCard

‎Website/src/pages/index.js‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import ImageGalleryDashboard from "@site/docs/img/dashboard.png";
1111
import Heading from "@theme/Heading";
1212
import styles from "./styles.module.css";
1313

14+
const directDownloads = release.downloads.x64;
15+
1416
function HomepageHeader() {
1517
return (
1618
<div className={styles.hero} data-theme="dark">
@@ -73,10 +75,10 @@ function HomepageHeader() {
7375
</span>
7476
</div>
7577
<div className={styles.directDownloads}>
76-
<span aria-hidden="true">⬇</span> Direct download:{" "}
77-
<Link to={release.downloads.setup}>MSI-Setup</Link>
78+
<span aria-hidden="true">⬇</span> Direct download (x64):{" "}
79+
<Link to={directDownloads.setup}>MSI-Setup</Link>
7880
<span className={styles.directDownloadsSep}>|</span>
79-
<Link to={release.downloads.portable}>Portable</Link>
81+
<Link to={directDownloads.portable}>Portable</Link>
8082
</div>
8183
<div className={styles.heroScreenshotWrapper}>
8284
<img

0 commit comments

Comments
 (0)