Skip to content

Commit

Permalink
feat(website): add macos amd64 desktop
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfreska committed Oct 22, 2024
1 parent 6c7e368 commit 2c10bb7
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .changeset/honest-kids-destroy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'website': minor
---

The software downloads now try to detect and autoselect the correct architecture on Linux via user-agent.
5 changes: 5 additions & 0 deletions .changeset/ten-dancers-watch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'website': minor
---

The desktop downloads now include AMD64 for macOS.
2 changes: 1 addition & 1 deletion apps/website/components/DownloadCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export function DownloadCard({
{description}
</Text>
<div className="flex flex-col gap-2">
<div className="flex items-center flex-1">
<div className="flex items-center flex-1 gap-1">
<Checkbox
aria-label="Acept the Terms of Service"
onCheckedChange={(checked) => setAccepted(!!checked)}
Expand Down
50 changes: 42 additions & 8 deletions apps/website/content/downloads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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({
Expand Down Expand Up @@ -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')) {
Expand All @@ -132,26 +149,43 @@ 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') &&
i.tags.includes('arm64') &&
!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') &&
i.tags.includes('amd64') &&
!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
}

0 comments on commit 2c10bb7

Please sign in to comment.