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) { switch (osType) {
case "windows": case "windows":
return { label: "Windows", url: DOWNLOAD_URLS.WINDOWS }; return { label: "Windows", url: DOWNLOAD_URLS.WINDOWS };
case "mac-apple": case "mac":
return { return { label: "Mac", url: DOWNLOAD_URLS.MAC };
label: "Mac (Apple Silicon)",
url: DOWNLOAD_URLS.MAC_APPLE_SILICON,
};
case "mac-intel":
return { label: "Mac (Intel)", url: DOWNLOAD_URLS.MAC_INTEL };
case "linux-x64": case "linux-x64":
case "linux-arm64": case "linux-arm64":
return { label: "Linux", url: DOWNLOAD_URLS.LINUX_DOCS }; 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: "Windows", url: DOWNLOAD_URLS.WINDOWS, value: "windows" },
{ { label: "Mac", url: DOWNLOAD_URLS.MAC, value: "mac" },
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: "Linux", url: DOWNLOAD_URLS.LINUX_DOCS, value: "linux" }, { label: "Linux", url: DOWNLOAD_URLS.LINUX_DOCS, value: "linux" },
].filter((opt) => opt.url), ].filter((opt) => opt.url),
[], [],
+1 -2
View File
@@ -1,8 +1,7 @@
// Centralized download URLs for Stirling PDF desktop installers // Centralized download URLs for Stirling PDF desktop installers
export const DOWNLOAD_URLS = { export const DOWNLOAD_URLS = {
WINDOWS: "https://files.stirlingpdf.com/win-installer.exe", WINDOWS: "https://files.stirlingpdf.com/win-installer.exe",
MAC_APPLE_SILICON: "https://files.stirlingpdf.com/mac-installer.dmg", MAC: "https://files.stirlingpdf.com/mac-installer.dmg",
MAC_INTEL: "https://files.stirlingpdf.com/mac-x86_64-installer.dmg",
LINUX_DOCS: "https://docs.stirlingpdf.com/Installation/Unix%20Installation/", LINUX_DOCS: "https://docs.stirlingpdf.com/Installation/Unix%20Installation/",
} as const; } as const;
+3 -18
View File
@@ -2,8 +2,7 @@ import { useEffect, useState } from "react";
export type OS = export type OS =
| "windows" | "windows"
| "mac-intel" | "mac"
| "mac-apple"
| "linux-x64" | "linux-x64"
| "linux-arm64" | "linux-arm64"
| "ios" | "ios"
@@ -23,15 +22,7 @@ function parseUA(ua: string): OS {
if (/android/.test(uaLower)) return "android"; if (/android/.test(uaLower)) return "android";
if (/windows nt/.test(uaLower)) return "windows"; if (/windows nt/.test(uaLower)) return "windows";
if (/mac os x/.test(uaLower)) { if (/mac os x/.test(uaLower)) return "mac";
// 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 (/linux|x11/.test(uaLower)) return "linux-x64"; if (/linux|x11/.test(uaLower)) return "linux-x64";
return "unknown"; return "unknown";
@@ -64,10 +55,7 @@ export function useOs(): OS {
else if (plat.includes("ios")) detected = "ios"; else if (plat.includes("ios")) detected = "ios";
else if (plat.includes("android")) detected = "android"; else if (plat.includes("android")) detected = "android";
else if (plat.includes("mac")) { else if (plat.includes("mac")) {
// CH “architecture” is often "arm" on Apple Silicon detected = "mac";
detected = architecture?.toLowerCase().includes("arm")
? "mac-apple"
: "mac-intel";
} else if (plat.includes("linux") || plat.includes("chrome os")) { } else if (plat.includes("linux") || plat.includes("chrome os")) {
const archLower = (architecture || "").toLowerCase(); const archLower = (architecture || "").toLowerCase();
const isArm = const isArm =
@@ -78,9 +66,6 @@ export function useOs(): OS {
} catch { } catch {
// ignore // 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); if (!cancelled) setOs(detected);
@@ -46,13 +46,8 @@ export function useSaasOnboardingState({
switch (osType) { switch (osType) {
case "windows": case "windows":
return { label: "Windows", url: DOWNLOAD_URLS.WINDOWS }; return { label: "Windows", url: DOWNLOAD_URLS.WINDOWS };
case "mac-apple": case "mac":
return { return { label: "Mac", url: DOWNLOAD_URLS.MAC };
label: "Mac (Apple Silicon)",
url: DOWNLOAD_URLS.MAC_APPLE_SILICON,
};
case "mac-intel":
return { label: "Mac (Intel)", url: DOWNLOAD_URLS.MAC_INTEL };
case "linux-x64": case "linux-x64":
case "linux-arm64": case "linux-arm64":
return { label: "Linux", url: DOWNLOAD_URLS.LINUX_DOCS }; return { label: "Linux", url: DOWNLOAD_URLS.LINUX_DOCS };
@@ -64,16 +59,7 @@ export function useSaasOnboardingState({
const osOptions = useMemo(() => { const osOptions = useMemo(() => {
const options = [ const options = [
{ label: "Windows", url: DOWNLOAD_URLS.WINDOWS, value: "windows" }, { label: "Windows", url: DOWNLOAD_URLS.WINDOWS, value: "windows" },
{ { label: "Mac", url: DOWNLOAD_URLS.MAC, value: "mac" },
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: "Linux", url: DOWNLOAD_URLS.LINUX_DOCS, value: "linux" }, { label: "Linux", url: DOWNLOAD_URLS.LINUX_DOCS, value: "linux" },
]; ];
return options.filter((opt) => opt.url); return options.filter((opt) => opt.url);