Skip to content
Merged

save #33

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 41 additions & 14 deletions client/src-tauri/crates/xero-cli/src/update_cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -847,10 +847,7 @@ fn platform_key() -> Result<&'static str, CliError> {
}
#[cfg(all(target_os = "macos", target_arch = "x86_64"))]
{
return Err(CliError::user_fixable(
"xero_macos_intel_unsupported",
"Xero no longer publishes macOS Intel builds. Use an Apple silicon Mac, Windows, or Linux build.",
));
return Ok("x86_64-apple-darwin");
}
#[cfg(all(target_os = "linux", target_arch = "x86_64"))]
{
Expand Down Expand Up @@ -971,16 +968,28 @@ mod tests {
version: version.into(),
notes: Some("notes".into()),
pub_date: Some("2026-05-23T00:00:00Z".into()),
assets: BTreeMap::from([(
"x86_64-unknown-linux-gnu".into(),
UpdateAsset {
url: "xero-x86_64-unknown-linux-gnu.tar.gz".into(),
sha256: "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
.into(),
binary: Some("xero".into()),
archive: None,
},
)]),
assets: BTreeMap::from([
(
"x86_64-unknown-linux-gnu".into(),
UpdateAsset {
url: "xero-x86_64-unknown-linux-gnu.tar.gz".into(),
sha256: "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
.into(),
binary: Some("xero".into()),
archive: None,
},
),
(
"x86_64-apple-darwin".into(),
UpdateAsset {
url: "xero-x86_64-apple-darwin.tar.gz".into(),
sha256: "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789"
.into(),
binary: Some("xero".into()),
archive: None,
},
),
]),
}
}

Expand Down Expand Up @@ -1018,6 +1027,24 @@ mod tests {
assert_eq!(asset.binary, "xero");
}

#[test]
fn manifest_check_resolves_macos_intel_asset_url() {
let check = check_from_manifest(
&manifest("99.0.0"),
"https://xeroshell.com/downloads/tui/latest/manifest.json",
"x86_64-apple-darwin",
)
.expect("check manifest");
let asset = check.asset.expect("asset");

assert!(check.update_available);
assert_eq!(
asset.url,
"https://xeroshell.com/downloads/tui/latest/xero-x86_64-apple-darwin.tar.gz"
);
assert_eq!(asset.binary, "xero");
}

#[test]
fn manifest_check_reports_no_asset_for_unsupported_platform() {
let check = check_from_manifest(
Expand Down
6 changes: 0 additions & 6 deletions landing/app/download/[target]/route.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { NextResponse } from "next/server"
import {
isDownloadTarget,
isUnsupportedDownloadTarget,
releasePageUrl,
resolveDownloadUrl,
unsupportedDownloadUrls,
} from "@/lib/download-targets"

export const revalidate = 300
Expand All @@ -26,10 +24,6 @@ export async function GET(
return redirectTo(request, releasePageUrl)
}

if (isUnsupportedDownloadTarget(target)) {
return redirectTo(request, unsupportedDownloadUrls[target])
}

if (!isDownloadTarget(target)) {
return NextResponse.json({ error: "Unknown download target" }, { status: 404 })
}
Expand Down
8 changes: 0 additions & 8 deletions landing/app/download/route.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { NextResponse } from "next/server"
import {
detectDownloadTarget,
detectUnsupportedDownloadTarget,
resolveDownloadUrl,
unsupportedDownloadUrls,
} from "@/lib/download-targets"

export const revalidate = 300
Expand All @@ -16,11 +14,5 @@ function redirectTo(request: Request, url: string) {
}

export async function GET(request: Request) {
const unsupportedTarget = detectUnsupportedDownloadTarget(request.headers)

if (unsupportedTarget) {
return redirectTo(request, unsupportedDownloadUrls[unsupportedTarget])
}

return redirectTo(request, await resolveDownloadUrl(detectDownloadTarget(request.headers)))
}
89 changes: 0 additions & 89 deletions landing/app/download/unsupported/macos-intel/page.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion landing/components/landing/structured-data.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const jsonLd = {
"@id": absoluteUrl("/#software"),
name: siteConfig.name,
applicationCategory: "DeveloperApplication",
operatingSystem: "macOS (Apple silicon), Windows, Linux",
operatingSystem: "macOS (Apple silicon and Intel), Windows, Linux",
softwareVersion: desktopRelease.version,
description: siteConfig.description,
url: siteConfig.url,
Expand Down
26 changes: 6 additions & 20 deletions landing/lib/download-targets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,12 @@ const releaseApiUrl = "https://api.github.com/repos/hyperpush-org/xero/releases/

const assetPatterns = {
"macos-apple-silicon": /^Xero_.*_aarch64_macos-aarch64\.dmg$/,
"macos-intel": /^Xero_.*_(?:x64|x86_64)_macos-x86_64\.dmg$/,
windows: /^Xero_.*_x64-setup\.exe$/,
linux: /^Xero_.*_amd64\.AppImage$/,
} as const

export type DownloadTarget = keyof typeof assetPatterns
export type UnsupportedDownloadTarget = "macos-intel"

export const unsupportedDownloadUrls = {
"macos-intel": "/download/unsupported/macos-intel",
} as const satisfies Record<UnsupportedDownloadTarget, string>

type GitHubRelease = {
html_url?: string
Expand Down Expand Up @@ -46,24 +42,14 @@ export function isDownloadTarget(target: string): target is DownloadTarget {
return target in assetPatterns
}

export function isUnsupportedDownloadTarget(target: string): target is UnsupportedDownloadTarget {
return target in unsupportedDownloadUrls
}

export function detectUnsupportedDownloadTarget(headers: Headers): UnsupportedDownloadTarget | null {
const { platform, architecture, userAgent } = getRequestPlatform(headers)

if (isMacRequest(platform, userAgent) && isIntelArchitecture(architecture)) {
return "macos-intel"
}

return null
}

export function detectDownloadTarget(headers: Headers): DownloadTarget | null {
const { platform, userAgent } = getRequestPlatform(headers)
const { platform, architecture, userAgent } = getRequestPlatform(headers)

if (isMacRequest(platform, userAgent)) {
if (isIntelArchitecture(architecture)) {
return "macos-intel"
}

return "macos-apple-silicon"
}

Expand Down
2 changes: 1 addition & 1 deletion landing/public/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ target_triple() {
printf 'aarch64-apple-darwin'
;;
Darwin:x86_64|Darwin:amd64)
fail 'macOS Intel builds are no longer published. Xero for macOS requires Apple silicon; use an Apple silicon Mac, Windows, or Linux build.'
printf 'x86_64-apple-darwin'
;;
Linux:x86_64|Linux:amd64)
printf 'x86_64-unknown-linux-gnu'
Expand Down