From c72f826590deae8fb2298223e411f2b3e69b03d1 Mon Sep 17 00:00:00 2001 From: Alex Freska Date: Mon, 21 Oct 2024 08:01:13 -0400 Subject: [PATCH] feat(website): add macos amd64 desktop --- .changeset/honest-kids-destroy.md | 5 +++ .changeset/ten-dancers-watch.md | 5 +++ apps/website/components/DownloadCard.tsx | 2 +- apps/website/content/downloads.ts | 50 ++++++++++++++++++++---- 4 files changed, 53 insertions(+), 9 deletions(-) create mode 100644 .changeset/honest-kids-destroy.md create mode 100644 .changeset/ten-dancers-watch.md diff --git a/.changeset/honest-kids-destroy.md b/.changeset/honest-kids-destroy.md new file mode 100644 index 000000000..9a8dd8e61 --- /dev/null +++ b/.changeset/honest-kids-destroy.md @@ -0,0 +1,5 @@ +--- +'website': minor +--- + +The software downloads now try to detect and autoselect the correct architecture on Linux via user-agent. diff --git a/.changeset/ten-dancers-watch.md b/.changeset/ten-dancers-watch.md new file mode 100644 index 000000000..8812b1c60 --- /dev/null +++ b/.changeset/ten-dancers-watch.md @@ -0,0 +1,5 @@ +--- +'website': minor +--- + +The desktop downloads now include AMD64 for macOS. diff --git a/apps/website/components/DownloadCard.tsx b/apps/website/components/DownloadCard.tsx index 0f94b75da..de0e3cd13 100644 --- a/apps/website/components/DownloadCard.tsx +++ b/apps/website/components/DownloadCard.tsx @@ -43,7 +43,7 @@ export function DownloadCard({ {description}
-
+
setAccepted(!!checked)} diff --git a/apps/website/content/downloads.ts b/apps/website/content/downloads.ts index 61caad2bb..6e508c2df 100644 --- a/apps/website/content/downloads.ts +++ b/apps/website/content/downloads.ts @@ -37,7 +37,9 @@ export function getDownloadLinksDesktop( const final = [] - const macArm = assets.find((asset) => asset.name.includes('.dmg')) + const macArm = assets.find( + (asset) => asset.name.includes('arm64') && asset.name.includes('dmg') + ) if (macArm) { final.push({ title: 'MacOS ARM64', @@ -46,6 +48,17 @@ export function getDownloadLinksDesktop( }) } + const macAmd = assets.find( + (asset) => asset.name.includes('x64') && asset.name.includes('dmg') + ) + if (macAmd) { + final.push({ + title: 'MacOS AMD64', + link: macAmd.browser_download_url, + tags: getTags(macAmd), + }) + } + const windowsAmd = assets.find((asset) => asset.name.includes('.exe')) if (windowsAmd) { final.push({ @@ -118,7 +131,11 @@ function getTags(asset: GitHubReleaseAsset): DownloadTag[] { if (asset.name.includes('linux')) { tags.push('linux') } - if (asset.name.includes('amd64') || asset.name.includes('x86_64')) { + if ( + asset.name.includes('amd64') || + asset.name.includes('x86_64') || + asset.name.includes('x64') + ) { tags.push('amd64') } if (asset.name.includes('arm64')) { @@ -132,6 +149,8 @@ export function findUserDefaultDownload( ): DownloadOption | null { let d = null if (navigator.userAgent.includes('Macintosh')) { + // We do not try to detect the architecture for MacOS + // because browsers return an Intel user-agent even on ARM Macs. d = downloads.find( (i) => i.tags.includes('macos') && @@ -139,6 +158,9 @@ export function findUserDefaultDownload( !i.tags.includes('zen') ) } else if (navigator.userAgent.includes('Windows')) { + // We currently do not provide ARM64 builds for Windows + // but if we do in the future, we could try: + // navigator.userAgent.includes('ARM64') d = downloads.find( (i) => i.tags.includes('windows') && @@ -146,12 +168,24 @@ export function findUserDefaultDownload( !i.tags.includes('zen') ) } else if (navigator.userAgent.includes('Linux')) { - d = downloads.find( - (i) => - i.tags.includes('linux') && - i.tags.includes('amd64') && - !i.tags.includes('zen') - ) + if ( + navigator.userAgent.includes('aarch64') || + navigator.userAgent.includes('arm64') + ) { + d = downloads.find( + (i) => + i.tags.includes('linux') && + i.tags.includes('arm64') && + !i.tags.includes('zen') + ) + } else { + d = downloads.find( + (i) => + i.tags.includes('linux') && + i.tags.includes('amd64') && + !i.tags.includes('zen') + ) + } } return d }