Unified · Split
| @@ -35,7 +35,7 @@ import Layout from '../layouts/Layout.astro' · 34 unmodified lines | |||
| 35 | <svg class="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M19 14l-7 7m0 0l-7-7m7 7V3"/></svg> | 35 | <svg class="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M19 14l-7 7m0 0l-7-7m7 7V3"/></svg> |
| 36 | <span id="primary-label">Download for macOS</span> | 36 | <span id="primary-label">Download for macOS</span> |
| 37 | </a> | 37 | </a> |
| 38 | <p class="mt-3 text-[12px] text-ink-faint" id="primary-meta">Apple Silicon & Intel · .dmg</p> | 38 | <p class="mt-3 text-[12px] text-ink-faint" id="primary-meta">Apple Silicon & Intel · .zip</p> |
| 39 | </div> | 39 | </div> |
| 40 | 40 | ||
| 41 | <!-- Other platforms link --> | 41 | <!-- Other platforms link --> |
| @@ -50,15 +50,15 @@ import Layout from '../layouts/Layout.astro' · 8 unmodified lines | |||
| 50 | <div class="grid sm:grid-cols-3 gap-4"> | 50 | <div class="grid sm:grid-cols-3 gap-4"> |
| 51 | <a id="link-mac" href="#" class="group rounded-xl border border-rule hover:border-teal/30 p-5 text-center transition-all"> | 51 | <a id="link-mac" href="#" class="group rounded-xl border border-rule hover:border-teal/30 p-5 text-center transition-all"> |
| 52 | <div class="text-[14px] font-medium text-ink mb-1">macOS</div> | 52 | <div class="text-[14px] font-medium text-ink mb-1">macOS</div> |
| 53 | <p class="text-[11px] text-ink-faint">Apple Silicon & Intel · .dmg</p> | 53 | <p class="text-[11px] text-ink-faint">Apple Silicon & Intel · .zip</p> |
| 54 | </a> | 54 | </a> |
| 55 | <a id="link-win" href="#" class="group rounded-xl border border-rule hover:border-teal/30 p-5 text-center transition-all"> | 55 | <a id="link-win" href="#" class="group rounded-xl border border-rule hover:border-teal/30 p-5 text-center transition-all"> |
| 56 | <div class="text-[14px] font-medium text-ink mb-1">Windows</div> | 56 | <div class="text-[14px] font-medium text-ink mb-1">Windows</div> |
| 57 | <p class="text-[11px] text-ink-faint">Windows 10+ · .exe</p> | 57 | <p class="text-[11px] text-ink-faint">Windows 10+ · .zip</p> |
| 58 | </a> | 58 | </a> |
| 59 | <a id="link-linux" href="#" class="group rounded-xl border border-rule hover:border-teal/30 p-5 text-center transition-all"> | 59 | <a id="link-linux" href="#" class="group rounded-xl border border-rule hover:border-teal/30 p-5 text-center transition-all"> |
| 60 | <div class="text-[14px] font-medium text-ink mb-1">Linux</div> | 60 | <div class="text-[14px] font-medium text-ink mb-1">Linux</div> |
| 61 | <p class="text-[11px] text-ink-faint">AppImage & .deb</p> | 61 | <p class="text-[11px] text-ink-faint">Linux x64 · .tar.gz</p> |
| 62 | </a> | 62 | </a> |
| 63 | </div> | 63 | </div> |
| 64 | </div> | 64 | </div> |
| @@ -96,9 +96,9 @@ import Layout from '../layouts/Layout.astro' · 31 unmodified lines | |||
| 96 | const RELEASE_API = `https://api.github.com/repos/${REPO}/releases/latest`; | 96 | const RELEASE_API = `https://api.github.com/repos/${REPO}/releases/latest`; |
| 97 | 97 | ||
| 98 | const PLATFORMS = { | 98 | const PLATFORMS = { |
| 99 | mac: { label: 'Download for macOS', meta: 'Apple Silicon & Intel \u00b7 .dmg', ext: '.dmg' }, | 99 | mac: { label: 'Download for macOS', meta: 'Apple Silicon & Intel \u00b7 .zip' }, |
| 100 | win: { label: 'Download for Windows', meta: 'Windows 10+ \u00b7 .exe', ext: '.exe' }, | 100 | win: { label: 'Download for Windows', meta: 'Windows 10+ \u00b7 .zip' }, |
| 101 | linux: { label: 'Download for Linux', meta: 'AppImage', ext: '.AppImage' }, | 101 | linux: { label: 'Download for Linux', meta: 'Linux x64 \u00b7 .tar.gz' }, |
| 102 | }; | 102 | }; |
| 103 | 103 | ||
| 104 | function detectOS() { | 104 | function detectOS() { |
| @@ -122,11 +122,15 @@ import Layout from '../layouts/Layout.astro' · 17 unmodified lines | |||
| 122 | const release = await res.json(); | 122 | const release = await res.json(); |
| 123 | const assets = release.assets || []; | 123 | const assets = release.assets || []; |
| 124 | 124 | ||
| 125 | const findAsset = (ext) => assets.find(a => a.name.endsWith(ext)); | 125 | const find = (pattern) => assets.find(a => pattern.test(a.name)); |
| 126 | 126 | ||
| 127 | const macUrl = findAsset('.dmg')?.browser_download_url; | 127 | // Match: Executor-arm64-mac.zip or Executor-x64-mac.zip based on Apple Silicon |
| 128 | const winUrl = findAsset('.exe')?.browser_download_url; | 128 | const isAppleSilicon = navigator.userAgent.includes('Mac') && |
| 129 | const linuxUrl = findAsset('.AppImage')?.browser_download_url; | 129 | (navigator.userAgent.includes('ARM') || navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 0); |
| 130 | const macAsset = find(isAppleSilicon ? /Executor-arm64-mac\.zip$/ : /Executor-x64-mac\.zip$/); | ||
| 131 | const macUrl = macAsset?.browser_download_url; | ||
| 132 | const winUrl = find(/Executor-x64-win\.zip$/)?.browser_download_url; | ||
| 133 | const linuxUrl = find(/Executor-x64-linux\.tar\.gz$/)?.browser_download_url; | ||
| 130 | 134 | ||
| 131 | const urls = { mac: macUrl, win: winUrl, linux: linuxUrl }; | 135 | const urls = { mac: macUrl, win: winUrl, linux: linuxUrl }; |
| 132 | 136 | ||
| @@ -139,8 +143,12 @@ import Layout from '../layouts/Layout.astro' · 6 unmodified lines | |||
| 139 | if (macUrl) document.getElementById('link-mac').href = macUrl; | 143 | if (macUrl) document.getElementById('link-mac').href = macUrl; |
| 140 | if (winUrl) document.getElementById('link-win').href = winUrl; | 144 | if (winUrl) document.getElementById('link-win').href = winUrl; |
| 141 | if (linuxUrl) document.getElementById('link-linux').href = linuxUrl; | 145 | if (linuxUrl) document.getElementById('link-linux').href = linuxUrl; |
| 146 | // If no asset found for user's OS, fall back to releases page | ||
| 147 | if (!urls[userOS]) { | ||
| 148 | document.getElementById('primary-btn').href = `https://github.com/${REPO}/releases/latest`; | ||
| 149 | } | ||
| 142 | } catch { | 150 | } catch { |
| 143 | // Silent fail — buttons just won't have hrefs | 151 | document.getElementById('primary-btn').href = `https://github.com/${REPO}/releases/latest`; |
| 144 | } | 152 | } |
| 145 | } | 153 | } |
| 146 | 154 | ||