Fix frontend download links pointing to split Mac binaries (#6325)

This commit is contained in:
James Brunton
2026-05-07 20:25:01 +01:00
committed by GitHub
parent efd2ed754c
commit 270af912d4
4 changed files with 10 additions and 54 deletions
@@ -35,13 +35,8 @@ export function useOnboardingDownload(): UseOnboardingDownloadResult {
switch (osType) {
case "windows":
return { label: "Windows", url: DOWNLOAD_URLS.WINDOWS };
case "mac-apple":
return {
label: "Mac (Apple Silicon)",
url: DOWNLOAD_URLS.MAC_APPLE_SILICON,
};
case "mac-intel":
return { label: "Mac (Intel)", url: DOWNLOAD_URLS.MAC_INTEL };
case "mac":
return { label: "Mac", url: DOWNLOAD_URLS.MAC };
case "linux-x64":
case "linux-arm64":
return { label: "Linux", url: DOWNLOAD_URLS.LINUX_DOCS };
@@ -54,16 +49,7 @@ export function useOnboardingDownload(): UseOnboardingDownloadResult {
() =>
[
{ label: "Windows", url: DOWNLOAD_URLS.WINDOWS, value: "windows" },
{
label: "Mac (Apple Silicon)",
url: DOWNLOAD_URLS.MAC_APPLE_SILICON,
value: "mac-apple",
},
{
label: "Mac (Intel)",
url: DOWNLOAD_URLS.MAC_INTEL,
value: "mac-intel",
},
{ label: "Mac", url: DOWNLOAD_URLS.MAC, value: "mac" },
{ label: "Linux", url: DOWNLOAD_URLS.LINUX_DOCS, value: "linux" },
].filter((opt) => opt.url),
[],
+1 -2
View File
@@ -1,8 +1,7 @@
// Centralized download URLs for Stirling PDF desktop installers
export const DOWNLOAD_URLS = {
WINDOWS: "https://files.stirlingpdf.com/win-installer.exe",
MAC_APPLE_SILICON: "https://files.stirlingpdf.com/mac-installer.dmg",
MAC_INTEL: "https://files.stirlingpdf.com/mac-x86_64-installer.dmg",
MAC: "https://files.stirlingpdf.com/mac-installer.dmg",
LINUX_DOCS: "https://docs.stirlingpdf.com/Installation/Unix%20Installation/",
} as const;
+3 -18
View File
@@ -2,8 +2,7 @@ import { useEffect, useState } from "react";
export type OS =
| "windows"
| "mac-intel"
| "mac-apple"
| "mac"
| "linux-x64"
| "linux-arm64"
| "ios"
@@ -23,15 +22,7 @@ function parseUA(ua: string): OS {
if (/android/.test(uaLower)) return "android";
if (/windows nt/.test(uaLower)) return "windows";
if (/mac os x/.test(uaLower)) {
// Default to Intel; refine via hints below
let detected: OS = "mac-intel";
// Safari on Apple Silicon sometimes exposes both tokens
if (ua.includes("Apple") && ua.includes("ARM")) {
detected = "mac-apple";
}
return detected; // will be further refined via Client Hints if available
}
if (/mac os x/.test(uaLower)) return "mac";
if (/linux|x11/.test(uaLower)) return "linux-x64";
return "unknown";
@@ -64,10 +55,7 @@ export function useOs(): OS {
else if (plat.includes("ios")) detected = "ios";
else if (plat.includes("android")) detected = "android";
else if (plat.includes("mac")) {
// CH “architecture” is often "arm" on Apple Silicon
detected = architecture?.toLowerCase().includes("arm")
? "mac-apple"
: "mac-intel";
detected = "mac";
} else if (plat.includes("linux") || plat.includes("chrome os")) {
const archLower = (architecture || "").toLowerCase();
const isArm =
@@ -78,9 +66,6 @@ export function useOs(): OS {
} catch {
// ignore
}
} else {
// Heuristic Apple Silicon from UA when no Client Hints (Safari): uncertain, prefer not to guess
// Keep detected as-is (often 'mac-intel').
}
if (!cancelled) setOs(detected);
@@ -46,13 +46,8 @@ export function useSaasOnboardingState({
switch (osType) {
case "windows":
return { label: "Windows", url: DOWNLOAD_URLS.WINDOWS };
case "mac-apple":
return {
label: "Mac (Apple Silicon)",
url: DOWNLOAD_URLS.MAC_APPLE_SILICON,
};
case "mac-intel":
return { label: "Mac (Intel)", url: DOWNLOAD_URLS.MAC_INTEL };
case "mac":
return { label: "Mac", url: DOWNLOAD_URLS.MAC };
case "linux-x64":
case "linux-arm64":
return { label: "Linux", url: DOWNLOAD_URLS.LINUX_DOCS };
@@ -64,16 +59,7 @@ export function useSaasOnboardingState({
const osOptions = useMemo(() => {
const options = [
{ label: "Windows", url: DOWNLOAD_URLS.WINDOWS, value: "windows" },
{
label: "Mac (Apple Silicon)",
url: DOWNLOAD_URLS.MAC_APPLE_SILICON,
value: "mac-apple",
},
{
label: "Mac (Intel)",
url: DOWNLOAD_URLS.MAC_INTEL,
value: "mac-intel",
},
{ label: "Mac", url: DOWNLOAD_URLS.MAC, value: "mac" },
{ label: "Linux", url: DOWNLOAD_URLS.LINUX_DOCS, value: "linux" },
];
return options.filter((opt) => opt.url);