Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
feat(website): detect the platform for direct downloads
EtienneLescotf27f76665d28
diff --git a/website/docusaurus.config.ts b/website/docusaurus.config.tsindex e374aa2bd..17bb8e980 100644--- a/website/docusaurus.config.ts+++ b/website/docusaurus.config.ts@@ -675,7 +675,7 @@ export default async function createConfig(): Promise<Config> {// link item only takes a string label, so the download glyph moves// to a CSS mask on .navbar-download-cta.to: "/download",- label: "Download",+ label: "Downloads",className: "navbar-download-cta",position: "right",},diff --git a/website/i18n/code.source.json b/website/i18n/code.source.jsonindex bf204883c..7f9fab65f 100644--- a/website/i18n/code.source.json+++ b/website/i18n/code.source.json@@ -1,4 +1,5 @@{+ "appLanguages.line": "Interface in {count} languages: {names}","download.macos.arm.label": "Apple Silicon","download.macos.arm.sublabel": "M1 and newer · .dmg","download.macos.intel.label": "Intel",@@ -40,7 +41,6 @@"home.meta.description": "Turn screen recordings into polished demos with automatic zooms, styled backgrounds and an editable cursor. Free and open source for Windows, macOS and Linux. No watermark.","home.hero.title": "Great demos on the first take.","home.hero.tagline": "Automatic zooms, smooth cursor movement, and a frame that looks finished. Record, adjust, share.",- "home.hero.download": "Download","home.hero.reassurance": "Free and open source. No watermark. No account.","home.features.platforms.title": "Windows, macOS, Linux","home.features.kicker": "Also true",@@ -68,7 +68,8 @@"home.install.note.windows": "Windows","home.install.note.mac": "Mac","home.install.note.linux": "Linux",- "appLanguages.line": "Interface in {count} languages: {names}",+ "editor.skipLink": "Skip the editor — go to downloads",+ "editor.title": "Five things you will actually do","demoLoop.pause": "Pause video","demoLoop.play": "Play video","demoLoop.classic-zoom": "A task board recorded in OpenScreen. The view zooms in on a checklist item and a Ship button as they are clicked, then pulls back to the whole board.",@@ -107,8 +108,6 @@"demoLoop.title.simpler-editor": "The OpenScreen editor","demoLoop.title.edit-like-a-doc": "Editing a video like a document","demoLoop.title.ask-the-agent": "Asking the editor's agent for an edit",- "editor.skipLink": "Skip the editor — go to downloads",- "editor.title": "Five things you will actually do","films.default.kicker": "Out of the box","films.default.title": "Good-looking from the first take.","films.default.lead": "Every new recording opens {zoomed}, on a wallpaper, with padding, a shadow and rounded corners. Change any of it, or export it as it is.",@@ -158,6 +157,32 @@"films.ship.blur": "{t} Smooth or mosaic, as a rectangle, an oval or a freehand shape, over an email, a key or a password.","films.ship.blur.t": "Blur regions.","films.label": "More of the app, in motion",+ "recreation.style.kicker": "Style",+ "recreation.style.title": "Swap the background",+ "recreation.style.sub": "Image, color or gradient behind your recording — no re-shoot.",+ "recreation.effects.kicker": "Effects",+ "recreation.effects.title": "Frame it your way",+ "recreation.effects.sub": "Padding, motion blur, shadow, roundness — every effect composites live.",+ "recreation.cursor.kicker": "Cursor",+ "recreation.cursor.title": "A cursor worth watching",+ "recreation.cursor.sub": "Size, smoothing, motion blur, click bounce — every move reads on screen.",+ "recreation.timeline.kicker": "Timeline",+ "recreation.timeline.title": "One click, every zoom placed",+ "recreation.timeline.sub": "Zooms, speed ramps, trims, comments — each edit lands as a pill on the timeline.",+ "recreation.transcript.kicker": "Transcript",+ "recreation.transcript.title": "Edit video like text",+ "recreation.transcript.sub": "Delete a word or a silence; the cut lands on the timeline. Nothing destructive.",+ "recreation.pause": "Pause animation",+ "recreation.play": "Play animation",+ "home.hero.explore": "Scroll to explore the editor",+ "announcement.v2.link": "See what's new",+ "announcement.v2.title": "OpenScreen v2 is here",+ "download.cta.mac": "Download for Mac",+ "download.cta.windows": "Download for Windows",+ "download.cta.linux": "Download for Linux",+ "home.hero.download": "Download",+ "download.cta.chooseMac": "Choose your Mac",+ "download.cta.otherVersions": "Other versions","showcase.record.kicker": "record","showcase.record.claim": "It records with the operating system, not around it.","showcase.record.body": "Pick a window or a display. macOS goes through ScreenCaptureKit, Windows through Windows Graphics Capture, Linux through PipeWire and the ScreenCast portal — on each, the capture path the system itself provides. The pointer is recorded as data rather than burned into the pixels, which is the only reason you could restyle it further up this page.",@@ -183,26 +208,6 @@"showcase.agent.link.docs": "AI editing docs","showcase.agent.link.feature": "How automatic zooms work","showcase.title": "Recorder, captions, agent, encoder.",- "recreation.style.kicker": "Style",- "recreation.style.title": "Swap the background",- "recreation.style.sub": "Image, color or gradient behind your recording — no re-shoot.",- "recreation.effects.kicker": "Effects",- "recreation.effects.title": "Frame it your way",- "recreation.effects.sub": "Padding, motion blur, shadow, roundness — every effect composites live.",- "recreation.cursor.kicker": "Cursor",- "recreation.cursor.title": "A cursor worth watching",- "recreation.cursor.sub": "Size, smoothing, motion blur, click bounce — every move reads on screen.",- "recreation.timeline.kicker": "Timeline",- "recreation.timeline.title": "One click, every zoom placed",- "recreation.timeline.sub": "Zooms, speed ramps, trims, comments — each edit lands as a pill on the timeline.",- "recreation.transcript.kicker": "Transcript",- "recreation.transcript.title": "Edit video like text",- "recreation.transcript.sub": "Delete a word or a silence; the cut lands on the timeline. Nothing destructive.",- "recreation.pause": "Pause animation",- "recreation.play": "Play animation",- "home.hero.explore": "Scroll to explore the editor",- "announcement.v2.title": "OpenScreen v2 is here",- "announcement.v2.link": "See what's new","footer.brand.description": "A free, open-source screen recorder and editor. Community-maintained continuation, MIT licensed.","footer.product.title": "Product","footer.product.download": "Download",diff --git a/website/i18n/de/code.json b/website/i18n/de/code.jsonindex cee61d18a..f2694af15 100644--- a/website/i18n/de/code.json+++ b/website/i18n/de/code.json@@ -1066,5 +1066,20 @@"announcement.v2.link": {"message": "Die Neuerungen (auf Englisch)","description": "Links to an English-only blog post. Mention English in translated labels."+ },+ "download.cta.mac": {+ "message": "Für Mac herunterladen"+ },+ "download.cta.windows": {+ "message": "Für Windows herunterladen"+ },+ "download.cta.linux": {+ "message": "Für Linux herunterladen"+ },+ "download.cta.chooseMac": {+ "message": "Mac auswählen"+ },+ "download.cta.otherVersions": {+ "message": "Andere Versionen"}}diff --git a/website/i18n/de/docusaurus-theme-classic/navbar.json b/website/i18n/de/docusaurus-theme-classic/navbar.jsonindex c8aba7a40..dc2219272 100644--- a/website/i18n/de/docusaurus-theme-classic/navbar.json+++ b/website/i18n/de/docusaurus-theme-classic/navbar.json@@ -23,8 +23,8 @@"message": "Discord","description": "Navbar item with label Discord"},- "item.label.Download": {- "message": "Download",- "description": "Navbar item with label Download"+ "item.label.Downloads": {+ "message": "Downloads",+ "description": "Navbar item with label Downloads"}}diff --git a/website/i18n/es/code.json b/website/i18n/es/code.jsonindex 52085100a..d3f883629 100644--- a/website/i18n/es/code.json+++ b/website/i18n/es/code.json@@ -1066,5 +1066,20 @@"announcement.v2.link": {"message": "Ver las novedades (en inglés)","description": "Links to an English-only blog post. Mention English in translated labels."+ },+ "download.cta.mac": {+ "message": "Descargar para Mac"+ },+ "download.cta.windows": {+ "message": "Descargar para Windows"+ },+ "download.cta.linux": {+ "message": "Descargar para Linux"+ },+ "download.cta.chooseMac": {+ "message": "Elige tu Mac"+ },+ "download.cta.otherVersions": {+ "message": "Otras versiones"}}diff --git a/website/i18n/es/docusaurus-theme-classic/navbar.json b/website/i18n/es/docusaurus-theme-classic/navbar.jsonindex ae2a9a232..a48baacc3 100644--- a/website/i18n/es/docusaurus-theme-classic/navbar.json+++ b/website/i18n/es/docusaurus-theme-classic/navbar.json@@ -23,8 +23,8 @@"message": "Discord","description": "Navbar item with label Discord"},- "item.label.Download": {- "message": "Descargar",- "description": "Navbar item with label Download"+ "item.label.Downloads": {+ "message": "Descargas",+ "description": "Navbar item with label Downloads"}}diff --git a/website/i18n/fr/code.json b/website/i18n/fr/code.jsonindex e7365c23e..7c1db0a7d 100644--- a/website/i18n/fr/code.json+++ b/website/i18n/fr/code.json@@ -1066,5 +1066,20 @@"announcement.v2.link": {"message": "Les nouveautés (en anglais)","description": "Links to an English-only blog post. Mention English in translated labels."+ },+ "download.cta.mac": {+ "message": "Télécharger pour Mac"+ },+ "download.cta.windows": {+ "message": "Télécharger pour Windows"+ },+ "download.cta.linux": {+ "message": "Télécharger pour Linux"+ },+ "download.cta.chooseMac": {+ "message": "Choisir votre Mac"+ },+ "download.cta.otherVersions": {+ "message": "Autres versions"}}diff --git a/website/i18n/fr/docusaurus-theme-classic/navbar.json b/website/i18n/fr/docusaurus-theme-classic/navbar.jsonindex 0bf8c13d7..edf1122a5 100644--- a/website/i18n/fr/docusaurus-theme-classic/navbar.json+++ b/website/i18n/fr/docusaurus-theme-classic/navbar.json@@ -23,8 +23,8 @@"message": "Discord","description": "Navbar item with label Discord"},- "item.label.Download": {- "message": "Télécharger",- "description": "Navbar item with label Download"+ "item.label.Downloads": {+ "message": "Téléchargements",+ "description": "Navbar item with label Downloads"}}diff --git a/website/i18n/ja/code.json b/website/i18n/ja/code.jsonindex ebce57882..fcb2708b8 100644--- a/website/i18n/ja/code.json+++ b/website/i18n/ja/code.json@@ -1066,5 +1066,20 @@"announcement.v2.link": {"message": "新機能を見る(英語)","description": "Links to an English-only blog post. Mention English in translated labels."+ },+ "download.cta.mac": {+ "message": "Mac用をダウンロード"+ },+ "download.cta.windows": {+ "message": "Windows用をダウンロード"+ },+ "download.cta.linux": {+ "message": "Linux用をダウンロード"+ },+ "download.cta.chooseMac": {+ "message": "Macの種類を選択"+ },+ "download.cta.otherVersions": {+ "message": "その他のバージョン"}}diff --git a/website/i18n/ja/docusaurus-theme-classic/navbar.json b/website/i18n/ja/docusaurus-theme-classic/navbar.jsonindex 59be03582..f25346e86 100644--- a/website/i18n/ja/docusaurus-theme-classic/navbar.json+++ b/website/i18n/ja/docusaurus-theme-classic/navbar.json@@ -23,8 +23,8 @@"message": "Discord","description": "Navbar item with label Discord"},- "item.label.Download": {+ "item.label.Downloads": {"message": "ダウンロード",- "description": "Navbar item with label Download"+ "description": "Navbar item with label Downloads"}}diff --git a/website/i18n/pt-BR/code.json b/website/i18n/pt-BR/code.jsonindex 0c6386502..aca61eb98 100644--- a/website/i18n/pt-BR/code.json+++ b/website/i18n/pt-BR/code.json@@ -1066,5 +1066,20 @@"announcement.v2.link": {"message": "Veja as novidades (em inglês)","description": "Links to an English-only blog post. Mention English in translated labels."+ },+ "download.cta.mac": {+ "message": "Baixar para Mac"+ },+ "download.cta.windows": {+ "message": "Baixar para Windows"+ },+ "download.cta.linux": {+ "message": "Baixar para Linux"+ },+ "download.cta.chooseMac": {+ "message": "Escolha seu Mac"+ },+ "download.cta.otherVersions": {+ "message": "Outras versões"}}diff --git a/website/i18n/pt-BR/docusaurus-theme-classic/navbar.json b/website/i18n/pt-BR/docusaurus-theme-classic/navbar.jsonindex 9d3984357..696322c45 100644--- a/website/i18n/pt-BR/docusaurus-theme-classic/navbar.json+++ b/website/i18n/pt-BR/docusaurus-theme-classic/navbar.json@@ -23,8 +23,8 @@"message": "Discord","description": "Navbar item with label Discord"},- "item.label.Download": {- "message": "Baixar",- "description": "Navbar item with label Download"+ "item.label.Downloads": {+ "message": "Downloads",+ "description": "Navbar item with label Downloads"}}diff --git a/website/i18n/zh-CN/code.json b/website/i18n/zh-CN/code.jsonindex ee5ff0688..66da6c9be 100644--- a/website/i18n/zh-CN/code.json+++ b/website/i18n/zh-CN/code.json@@ -1066,5 +1066,20 @@"announcement.v2.link": {"message": "了解新功能(英语)","description": "Links to an English-only blog post. Mention English in translated labels."+ },+ "download.cta.mac": {+ "message": "下载 Mac 版"+ },+ "download.cta.windows": {+ "message": "下载 Windows 版"+ },+ "download.cta.linux": {+ "message": "下载 Linux 版"+ },+ "download.cta.chooseMac": {+ "message": "选择你的 Mac"+ },+ "download.cta.otherVersions": {+ "message": "其他版本"}}diff --git a/website/i18n/zh-CN/docusaurus-theme-classic/navbar.json b/website/i18n/zh-CN/docusaurus-theme-classic/navbar.jsonindex 5886ca40e..6d0904217 100644--- a/website/i18n/zh-CN/docusaurus-theme-classic/navbar.json+++ b/website/i18n/zh-CN/docusaurus-theme-classic/navbar.json@@ -23,8 +23,8 @@"message": "Discord","description": "Navbar item with label Discord"},- "item.label.Download": {+ "item.label.Downloads": {"message": "下载",- "description": "Navbar item with label Download"+ "description": "Navbar item with label Downloads"}}diff --git a/website/i18n/zh-TW/code.json b/website/i18n/zh-TW/code.jsonindex 3e97c8eaa..93dcb271b 100644--- a/website/i18n/zh-TW/code.json+++ b/website/i18n/zh-TW/code.json@@ -1066,5 +1066,20 @@"announcement.v2.link": {"message": "了解新功能(英文)","description": "Links to an English-only blog post. Mention English in translated labels."+ },+ "download.cta.mac": {+ "message": "下載 Mac 版"+ },+ "download.cta.windows": {+ "message": "下載 Windows 版"+ },+ "download.cta.linux": {+ "message": "下載 Linux 版"+ },+ "download.cta.chooseMac": {+ "message": "選擇你的 Mac"+ },+ "download.cta.otherVersions": {+ "message": "其他版本"}}diff --git a/website/i18n/zh-TW/docusaurus-theme-classic/navbar.json b/website/i18n/zh-TW/docusaurus-theme-classic/navbar.jsonindex 84c8e32cd..04a1d5556 100644--- a/website/i18n/zh-TW/docusaurus-theme-classic/navbar.json+++ b/website/i18n/zh-TW/docusaurus-theme-classic/navbar.json@@ -23,8 +23,8 @@"message": "Discord","description": "Navbar item with label Discord"},- "item.label.Download": {+ "item.label.Downloads": {"message": "下載",- "description": "Navbar item with label Download"+ "description": "Navbar item with label Downloads"}}diff --git a/website/src/components/PlatformDownload/PlatformIcon.tsx b/website/src/components/PlatformDownload/PlatformIcon.tsxnew file mode 100644index 000000000..5d38e825e--- /dev/null+++ b/website/src/components/PlatformDownload/PlatformIcon.tsx@@ -0,0 +1,20 @@+import { Download } from "lucide-react";++import type { DownloadTarget } from "../../lib/download-target";+// Apple and Tux paths from Simple Icons, distributed under CC0.+import AppleIcon from "./apple.svg";+import LinuxIcon from "./linux.svg";++export default function PlatformIcon({ os }: { os: DownloadTarget["os"] }) {+ if (os === "macos")+ return <AppleIcon width={16} height={16} fill="currentColor" aria-hidden="true" />;+ if (os === "linux")+ return <LinuxIcon width={16} height={16} fill="currentColor" aria-hidden="true" />;+ if (os === "windows")+ return (+ <svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">+ <path d="M2 2h9v9H2zm11 0h9v9h-9zM2 13h9v9H2zm11 0h9v9h-9z" />+ </svg>+ );+ return <Download size={16} aria-hidden="true" />;+}diff --git a/website/src/components/PlatformDownload/apple.svg b/website/src/components/PlatformDownload/apple.svgnew file mode 100644index 000000000..796e5662f--- /dev/null+++ b/website/src/components/PlatformDownload/apple.svg@@ -0,0 +1 @@+<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Apple</title><path d="M12.152 6.896c-.948 0-2.415-1.078-3.96-1.04-2.04.027-3.91 1.183-4.961 3.014-2.117 3.675-.546 9.103 1.519 12.09 1.013 1.454 2.208 3.09 3.792 3.039 1.52-.065 2.09-.987 3.935-.987 1.831 0 2.35.987 3.96.948 1.637-.026 2.676-1.48 3.676-2.948 1.156-1.688 1.636-3.325 1.662-3.415-.039-.013-3.182-1.221-3.22-4.857-.026-3.04 2.48-4.494 2.597-4.559-1.429-2.09-3.623-2.324-4.39-2.376-2-.156-3.675 1.09-4.61 1.09zM15.53 3.83c.843-1.012 1.4-2.427 1.245-3.83-1.207.052-2.662.805-3.532 1.818-.78.896-1.454 2.338-1.273 3.714 1.338.104 2.715-.688 3.559-1.701"/></svg>diff --git a/website/src/components/PlatformDownload/index.tsx b/website/src/components/PlatformDownload/index.tsxnew file mode 100644index 000000000..9b3994207--- /dev/null+++ b/website/src/components/PlatformDownload/index.tsx@@ -0,0 +1,153 @@+import Link from "@docusaurus/Link";+import { translate } from "@docusaurus/Translate";+import useDocusaurusContext from "@docusaurus/useDocusaurusContext";+import clsx from "clsx";+import { ChevronDown } from "lucide-react";+import { useEffect, useId, useRef, useState } from "react";++import { directDownloadUrl } from "../../lib/download-target";+import { type AssetKind, findAsset, type LatestRelease } from "../../lib/release";+import PlatformIcon from "./PlatformIcon";+import styles from "./styles.module.css";+import useDownloadTarget from "./useDownloadTarget";++export default function PlatformDownload({ className }: { className: string }) {+ const { siteConfig } = useDocusaurusContext();+ const release = (siteConfig.customFields?.latestRelease ?? null) as LatestRelease;+ const target = useDownloadTarget();+ const [open, setOpen] = useState(false);+ const group = useRef<HTMLDivElement>(null);+ const chooser = useRef<HTMLButtonElement>(null);+ const optionsId = useId();+ const url = directDownloadUrl(target, release);+ const macChoice = target.os === "macos" && !target.kind;+ const options: { kind: AssetKind; label: string }[] =+ target.os === "macos"+ ? [+ { kind: "macArm", label: "Apple Silicon (M1, M2, M3…)" },+ { kind: "macIntel", label: "Intel" },+ ]+ : target.os === "linux" && target.kind+ ? [+ { kind: "deb", label: "Debian / Ubuntu · .deb" },+ { kind: "rpm", label: "Fedora / RHEL · .rpm" },+ { kind: "pacman", label: "Arch / Manjaro · .pacman" },+ { kind: "appImage", label: "AppImage" },+ ]+ : [];+ const available = options.flatMap((option) => {+ const asset = findAsset(release, option.kind);+ return asset ? [{ ...option, url: asset.url }] : [];+ });+ const label =+ target.os === "macos"+ ? translate({ id: "download.cta.mac", message: "Download for Mac" })+ : target.os === "windows"+ ? translate({ id: "download.cta.windows", message: "Download for Windows" })+ : target.os === "linux"+ ? translate({ id: "download.cta.linux", message: "Download for Linux" })+ : translate({ id: "home.hero.download", message: "Download" });+ const chooserLabel = macChoice+ ? translate({ id: "download.cta.chooseMac", message: "Choose your Mac" })+ : translate({ id: "download.cta.otherVersions", message: "Other versions" });+ const content = (+ <>+ <PlatformIcon os={target.os} />+ <span>{label}</span>+ </>+ );+ const needsChoice = macChoice && available.length > 0;+ const hasSplit = !needsChoice && available.length > 0;++ useEffect(() => {+ if (!open) return;+ const closeOutside = (event: PointerEvent) => {+ if (event.target instanceof Node && !group.current?.contains(event.target)) setOpen(false);+ };+ const closeOnEscape = (event: KeyboardEvent) => {+ if (event.key === "Escape") {+ setOpen(false);+ chooser.current?.focus();+ }+ };+ document.addEventListener("pointerdown", closeOutside);+ document.addEventListener("keydown", closeOnEscape);+ return () => {+ document.removeEventListener("pointerdown", closeOutside);+ document.removeEventListener("keydown", closeOnEscape);+ };+ }, [open]);++ return (+ <div+ ref={group}+ className={styles.group}+ onBlur={(event) => {+ if (!event.currentTarget.contains(event.relatedTarget)) setOpen(false);+ }}+ >+ {needsChoice ? (+ <button+ ref={chooser}+ type="button"+ className={clsx(className, styles.main)}+ data-platform-download={target.os}+ aria-expanded={open}+ aria-controls={optionsId}+ onClick={() => setOpen(!open)}+ >+ {content}+ <ChevronDown size={15} aria-hidden="true" />+ </button>+ ) : url ? (+ <a+ className={clsx(className, styles.main, hasSplit && styles.split)}+ href={url}+ data-platform-download={target.os}+ data-download-kind={target.kind ?? "store"}+ >+ {content}+ </a>+ ) : (+ <Link+ className={clsx(className, styles.main)}+ to="/download"+ data-platform-download={target.os ?? "unknown"}+ >+ {content}+ </Link>+ )}+ {hasSplit ? (+ <button+ ref={chooser}+ type="button"+ className={clsx(className, styles.chooser)}+ aria-label={chooserLabel}+ aria-expanded={open}+ aria-controls={optionsId}+ onClick={() => setOpen(!open)}+ >+ <ChevronDown size={15} aria-hidden="true" />+ </button>+ ) : null}+ {open ? (+ <div className={styles.options} id={optionsId}>+ <p>{chooserLabel}</p>+ <ul>+ {available.map((option) => (+ <li key={option.kind}>+ <a+ href={option.url}+ onClick={() => setOpen(false)}+ data-download-kind={option.kind}+ >+ {option.label}+ </a>+ </li>+ ))}+ </ul>+ </div>+ ) : null}+ </div>+ );+}diff --git a/website/src/components/PlatformDownload/linux.svg b/website/src/components/PlatformDownload/linux.svgnew file mode 100644index 000000000..6ea0c58e8--- /dev/null+++ b/website/src/components/PlatformDownload/linux.svg@@ -0,0 +1 @@+<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Linux</title><path d="M12.504 0c-.155 0-.315.008-.48.021-4.226.333-3.105 4.807-3.17 6.298-.076 1.092-.3 1.953-1.05 3.02-.885 1.051-2.127 2.75-2.716 4.521-.278.832-.41 1.684-.287 2.489a.424.424 0 00-.11.135c-.26.268-.45.6-.663.839-.199.199-.485.267-.797.4-.313.136-.658.269-.864.68-.09.189-.136.394-.132.602 0 .199.027.4.055.536.058.399.116.728.04.97-.249.68-.28 1.145-.106 1.484.174.334.535.47.94.601.81.2 1.91.135 2.774.6.926.466 1.866.67 2.616.47.526-.116.97-.464 1.208-.946.587-.003 1.23-.269 2.26-.334.699-.058 1.574.267 2.577.2.025.134.063.198.114.333l.003.003c.391.778 1.113 1.132 1.884 1.071.771-.06 1.592-.536 2.257-1.306.631-.765 1.683-1.084 2.378-1.503.348-.199.629-.469.649-.853.023-.4-.2-.811-.714-1.376v-.097l-.003-.003c-.17-.2-.25-.535-.338-.926-.085-.401-.182-.786-.492-1.046h-.003c-.059-.054-.123-.067-.188-.135a.357.357 0 00-.19-.064c.431-1.278.264-2.55-.173-3.694-.533-1.41-1.465-2.638-2.175-3.483-.796-1.005-1.576-1.957-1.56-3.368.026-2.152.236-6.133-3.544-6.139zm.529 3.405h.013c.213 0 .396.062.584.198.19.135.33.332.438.533.105.259.158.459.166.724 0-.02.006-.04.006-.06v.105a.086.086 0 01-.004-.021l-.004-.024a1.807 1.807 0 01-.15.706.953.953 0 01-.213.335.71.71 0 00-.088-.042c-.104-.045-.198-.064-.284-.133a1.312 1.312 0 00-.22-.066c.05-.06.146-.133.183-.198.053-.128.082-.264.088-.402v-.02a1.21 1.21 0 00-.061-.4c-.045-.134-.101-.2-.183-.333-.084-.066-.167-.132-.267-.132h-.016c-.093 0-.176.03-.262.132a.8.8 0 00-.205.334 1.18 1.18 0 00-.09.4v.019c.002.089.008.179.02.267-.193-.067-.438-.135-.607-.202a1.635 1.635 0 01-.018-.2v-.02a1.772 1.772 0 01.15-.768c.082-.22.232-.406.43-.533a.985.985 0 01.594-.2zm-2.962.059h.036c.142 0 .27.048.399.135.146.129.264.288.344.465.09.199.14.4.153.667v.004c.007.134.006.2-.002.266v.08c-.03.007-.056.018-.083.024-.152.055-.274.135-.393.2.012-.09.013-.18.003-.267v-.015c-.012-.133-.04-.2-.082-.333a.613.613 0 00-.166-.267.248.248 0 00-.183-.064h-.021c-.071.006-.13.04-.186.132a.552.552 0 00-.12.27.944.944 0 00-.023.33v.015c.012.135.037.2.08.334.046.134.098.2.166.268.01.009.02.018.034.024-.07.057-.117.07-.176.136a.304.304 0 01-.131.068 2.62 2.62 0 01-.275-.402 1.772 1.772 0 01-.155-.667 1.759 1.759 0 01.08-.668 1.43 1.43 0 01.283-.535c.128-.133.26-.2.418-.2zm1.37 1.706c.332 0 .733.065 1.216.399.293.2.523.269 1.052.468h.003c.255.136.405.266.478.399v-.131a.571.571 0 01.016.47c-.123.31-.516.643-1.063.842v.002c-.268.135-.501.333-.775.465-.276.135-.588.292-1.012.267a1.139 1.139 0 01-.448-.067 3.566 3.566 0 01-.322-.198c-.195-.135-.363-.332-.612-.465v-.005h-.005c-.4-.246-.616-.512-.686-.71-.07-.268-.005-.47.193-.6.224-.135.38-.271.483-.336.104-.074.143-.102.176-.131h.002v-.003c.169-.202.436-.47.839-.601.139-.036.294-.065.466-.065zm2.8 2.142c.358 1.417 1.196 3.475 1.735 4.473.286.534.855 1.659 1.102 3.024.156-.005.33.018.513.064.646-1.671-.546-3.467-1.089-3.966-.22-.2-.232-.335-.123-.335.59.534 1.365 1.572 1.646 2.757.13.535.16 1.104.021 1.67.067.028.135.06.205.067 1.032.534 1.413.938 1.23 1.537v-.043c-.06-.003-.12 0-.18 0h-.016c.151-.467-.182-.825-1.065-1.224-.915-.4-1.646-.336-1.77.465-.008.043-.013.066-.018.135-.068.023-.139.053-.209.064-.43.268-.662.669-.793 1.187-.13.533-.17 1.156-.205 1.869v.003c-.02.334-.17.838-.319 1.35-1.5 1.072-3.58 1.538-5.348.334a2.645 2.645 0 00-.402-.533 1.45 1.45 0 00-.275-.333c.182 0 .338-.03.465-.067a.615.615 0 00.314-.334c.108-.267 0-.697-.345-1.163-.345-.467-.931-.995-1.788-1.521-.63-.4-.986-.87-1.15-1.396-.165-.534-.143-1.085-.015-1.645.245-1.07.873-2.11 1.274-2.763.107-.065.037.135-.408.974-.396.751-1.14 2.497-.122 3.854a8.123 8.123 0 01.647-2.876c.564-1.278 1.743-3.504 1.836-5.268.048.036.217.135.289.202.218.133.38.333.59.465.21.201.477.335.876.335.039.003.075.006.11.006.412 0 .73-.134.997-.268.29-.134.52-.334.74-.4h.005c.467-.135.835-.402 1.044-.7zm2.185 8.958c.037.6.343 1.245.882 1.377.588.134 1.434-.333 1.791-.765l.211-.01c.315-.007.577.01.847.268l.003.003c.208.199.305.53.391.876.085.4.154.78.409 1.066.486.527.645.906.636 1.14l.003-.007v.018l-.003-.012c-.015.262-.185.396-.498.595-.63.401-1.746.712-2.457 1.57-.618.737-1.37 1.14-2.036 1.191-.664.053-1.237-.2-1.574-.898l-.005-.003c-.21-.4-.12-1.025.056-1.69.176-.668.428-1.344.463-1.897.037-.714.076-1.335.195-1.814.12-.465.308-.797.641-.984l.045-.022zm-10.814.049h.01c.053 0 .105.005.157.014.376.055.706.333 1.023.752l.91 1.664.003.003c.243.533.754 1.064 1.189 1.637.434.598.77 1.131.729 1.57v.006c-.057.744-.48 1.148-1.125 1.294-.645.135-1.52.002-2.395-.464-.968-.536-2.118-.469-2.857-.602-.369-.066-.61-.2-.723-.4-.11-.2-.113-.602.123-1.23v-.004l.002-.003c.117-.334.03-.752-.027-1.118-.055-.401-.083-.71.043-.94.16-.334.396-.4.69-.533.294-.135.64-.202.915-.47h.002v-.002c.256-.268.445-.601.668-.838.19-.201.38-.336.663-.336zm7.159-9.074c-.435.201-.945.535-1.488.535-.542 0-.97-.267-1.28-.466-.154-.134-.28-.268-.373-.335-.164-.134-.144-.333-.074-.333.109.016.129.134.199.2.096.066.215.2.36.333.292.2.68.467 1.167.467.485 0 1.053-.267 1.398-.466.195-.135.445-.334.648-.467.156-.136.149-.267.279-.267.128.016.034.134-.147.332a8.097 8.097 0 01-.69.468zm-1.082-1.583V5.64c-.006-.02.013-.042.029-.05.074-.043.18-.027.26.004.063 0 .16.067.15.135-.006.049-.085.066-.135.066-.055 0-.092-.043-.141-.068-.052-.018-.146-.008-.163-.065zm-.551 0c-.02.058-.113.049-.166.066-.047.025-.086.068-.14.068-.05 0-.13-.02-.136-.068-.01-.066.088-.133.15-.133.08-.031.184-.047.259-.005.019.009.036.03.03.05v.02h.003z"/></svg>diff --git a/website/src/components/PlatformDownload/styles.module.css b/website/src/components/PlatformDownload/styles.module.cssnew file mode 100644index 000000000..947b43b42--- /dev/null+++ b/website/src/components/PlatformDownload/styles.module.css@@ -0,0 +1,118 @@+.group {+ position: relative;+ display: inline-flex;+ max-width: 100%;+ text-align: left;+ z-index: 1;+ border-radius: 9px;+ box-shadow: 0 8px 24px var(--os-accent-ring);+ transition: transform 0.15s ease;+}++.group:hover {+ transform: translateY(-2px);+}++.group .main,+.group .chooser {+ box-shadow: none;+}++.group .main:hover,+.group .chooser:hover {+ transform: none;+}++.main,+.chooser {+ border: 0;+ font-family: inherit;+ line-height: inherit;+ cursor: pointer;+}++.main {+ min-width: 0;+}++.main svg,+.chooser svg {+ flex-shrink: 0;+}++.group .split {+ border-top-right-radius: 0;+ border-bottom-right-radius: 0;+}++.group .chooser {+ padding-right: 12px;+ padding-left: 12px;+ border-left: 1px solid color-mix(in srgb, var(--os-bg) 20%, transparent);+ border-top-left-radius: 0;+ border-bottom-left-radius: 0;+}++.main:focus-visible,+.chooser:focus-visible {+ outline: 2px solid var(--os-accent);+ outline-offset: 4px;+}++.options {+ position: absolute;+ top: calc(100% + 12px);+ left: 50%;+ transform: translateX(-50%);+ width: max-content;+ min-width: 100%;+ max-width: calc(100vw - 40px);+ padding: 8px;+ border: 1px solid var(--os-border);+ border-radius: 12px;+ background: var(--os-surface);+ box-shadow: var(--os-elev-pop);+ color: var(--os-fg);+}++.options p {+ margin: 0;+ padding: 8px 12px 6px;+ font-size: 12px;+ color: var(--os-muted);+}++.options ul {+ margin: 0;+ padding: 0;+ list-style: none;+}++.options a {+ display: block;+ padding: 10px 12px;+ border-radius: 6px;+ color: var(--os-fg);+ font-size: 14px;+ text-decoration: none;+}++.options a:hover,+.options a:focus-visible {+ background: var(--os-accent-wash);+ color: var(--os-accent);+}++@media (max-width: 600px) {+ .group .main {+ padding-right: 18px;+ padding-left: 18px;+ font-size: 14px;+ }+}++@media (prefers-reduced-motion: reduce) {+ .group {+ transition: none;+ }+}diff --git a/website/src/components/PlatformDownload/useDownloadTarget.ts b/website/src/components/PlatformDownload/useDownloadTarget.tsnew file mode 100644index 000000000..795055f23--- /dev/null+++ b/website/src/components/PlatformDownload/useDownloadTarget.ts@@ -0,0 +1,44 @@+import { useEffect, useState } from "react";++import {+ type BrowserNavigator,+ browserDownloadTarget,+ type DownloadTarget,+ downloadTarget,+} from "../../lib/download-target";++function macRenderer(): string {+ const canvas = document.createElement("canvas");+ const gl = canvas.getContext("webgl");+ if (!gl) return "";+ try {+ const debug = gl.getExtension("WEBGL_debug_renderer_info");+ return debug ? String(gl.getParameter(debug.UNMASKED_RENDERER_WEBGL)) : "";+ } finally {+ gl.getExtension("WEBGL_lose_context")?.loseContext();+ }+}++export default function useDownloadTarget(): DownloadTarget {+ const [target, setTarget] = useState<DownloadTarget>({ os: null, kind: null });+ useEffect(() => {+ let active = true;+ const nav = navigator as BrowserNavigator;+ setTarget(+ downloadTarget({+ userAgent: nav.userAgent,+ platform: nav.platform,+ maxTouchPoints: nav.maxTouchPoints,+ uaPlatform: nav.userAgentData?.platform,+ mobile: nav.userAgentData?.mobile,+ }),+ );+ void browserDownloadTarget(nav, macRenderer).then((detected) => {+ if (active) setTarget(detected);+ });+ return () => {+ active = false;+ };+ }, []);+ return target;+}diff --git a/website/src/lib/download-target.test.ts b/website/src/lib/download-target.test.tsnew file mode 100644index 000000000..2a5c2076c--- /dev/null+++ b/website/src/lib/download-target.test.ts@@ -0,0 +1,151 @@+import assert from "node:assert/strict";+import { test } from "node:test";++import {+ browserDownloadTarget,+ directDownloadUrl,+ downloadTarget,+ STORE_INSTALLER_URL,+} from "./download-target.ts";++test("Windows goes directly to the official Store installer without release metadata", () => {+ const target = downloadTarget({ userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64)" });+ assert.deepEqual(target, { os: "windows", kind: null });+ assert.equal(directDownloadUrl(target, null), STORE_INSTALLER_URL);+});++test("mobile devices and ChromeOS never get a desktop installer", () => {+ for (const signals of [+ { userAgent: "Mozilla/5.0 (Linux; Android 15)" },+ { userAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 18_0 like Mac OS X)" },+ { userAgent: "Mozilla/5.0 (X11; CrOS x86_64)" },+ {+ userAgent: "Mozilla/5.0 (Macintosh; Intel Mac OS X)",+ platform: "MacIntel",+ maxTouchPoints: 5,+ },+ { userAgent: "", uaPlatform: "Linux", mobile: true },+ ]) {+ assert.deepEqual(downloadTarget(signals), { os: null, kind: null });+ }+});++test("the Intel token in a Mac user agent does not pick the Intel download", () => {+ assert.deepEqual(+ downloadTarget({ userAgent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)" }),+ {+ os: "macos",+ kind: null,+ },+ );+});++test("real architecture hints and Mac GPU names select the right dmg", () => {+ const mac = { userAgent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)" };+ for (const architecture of ["arm", "arm64", "aarch64"])+ assert.equal(downloadTarget({ ...mac, architecture }).kind, "macArm");+ for (const architecture of ["x86", "x64", "amd64"])+ assert.equal(downloadTarget({ ...mac, architecture }).kind, "macIntel");+ for (const macRenderer of ["Apple M3", "ANGLE (Apple, Apple M1, Metal)"])+ assert.equal(downloadTarget({ ...mac, macRenderer }).kind, "macArm");+ for (const macRenderer of ["Intel Iris OpenGL Engine", "AMD Radeon Pro 5500M"])+ assert.equal(downloadTarget({ ...mac, macRenderer }).kind, "macIntel");+ assert.equal(+ downloadTarget({ ...mac, architecture: "x86", macRenderer: "Apple M2" }).kind,+ "macArm",+ );+ assert.equal(downloadTarget({ ...mac, macRenderer: "Apple Software Renderer" }).kind, null);+ assert.equal(downloadTarget({ ...mac, macRenderer: "Apple GPU" }).kind, null);+});++test("Linux distribution hints pick deb, rpm or pacman; generic Linux gets AppImage", () => {+ for (const [distro, kind] of [+ ["Debian", "deb"],+ ["Ubuntu", "deb"],+ ["Linux Mint", "deb"],+ ["Pop!_OS", "deb"],+ ["Fedora", "rpm"],+ ["Red Hat", "rpm"],+ ["CentOS", "rpm"],+ ["Arch Linux", "pacman"],+ ["ArchLinux", "pacman"],+ ["Manjaro", "pacman"],+ ["", "appImage"],+ ["openSUSE", "appImage"],+ ]) {+ assert.equal(+ downloadTarget({ userAgent: `Mozilla/5.0 (X11; ${distro}; Linux x86_64)` }).kind,+ kind,+ );+ }+});++test("known ARM and 32-bit Linux hosts do not get the x64 packages", () => {+ assert.equal(downloadTarget({ userAgent: "Mozilla/5.0 (Linux aarch64; Ubuntu)" }).kind, null);+ assert.equal(downloadTarget({ userAgent: "Linux", architecture: "arm" }).kind, null);+ assert.equal(downloadTarget({ userAgent: "Mozilla/5.0 (Linux i686; Ubuntu)" }).kind, null);+ assert.equal(downloadTarget({ userAgent: "Linux", platform: "Linux aarch64" }).kind, null);+ assert.equal(downloadTarget({ userAgent: "Linux", platform: "Linux i686" }).kind, null);+});++test("unrecognized platforms and missing release assets fall back to the downloads page", () => {+ assert.deepEqual(downloadTarget({ userAgent: "" }), { os: null, kind: null });+ assert.equal(directDownloadUrl({ os: "macos", kind: "macArm" }, null), null);+ assert.equal(+ directDownloadUrl(+ { os: "linux", kind: "deb" },+ {+ tag: "v1",+ published: "",+ publishedIso: "",+ assets: [],+ },+ ),+ null,+ );+});++test("the detected package resolves to the actual release asset", () => {+ const url = "https://example.test/Openscreen-Linux-2.0.0.deb";+ assert.equal(+ directDownloadUrl(+ { os: "linux", kind: "deb" },+ {+ tag: "v2.0.0",+ published: "",+ publishedIso: "",+ assets: [{ name: "Openscreen-Linux-2.0.0.deb", url, size: 1 }],+ },+ ),+ url,+ );+});++test("architecture detection asks for one hint and tolerates refusal and hidden GPUs", async () => {+ const nav = { userAgent: "Macintosh; Intel Mac OS X", platform: "MacIntel", maxTouchPoints: 0 };+ const result = await browserDownloadTarget({+ ...nav,+ userAgentData: {+ platform: "macOS",+ getHighEntropyValues: async (hints) => {+ assert.deepEqual(hints, ["architecture"]);+ return { architecture: "arm" };+ },+ },+ });+ assert.equal(result.kind, "macArm");+ const refused = await browserDownloadTarget(+ {+ ...nav,+ userAgentData: {+ getHighEntropyValues: async () => {+ throw new Error("blocked");+ },+ },+ },+ () => {+ throw new Error("hidden");+ },+ );+ assert.deepEqual(refused, { os: "macos", kind: null });+});diff --git a/website/src/lib/download-target.ts b/website/src/lib/download-target.tsnew file mode 100644index 000000000..8cbfec07d--- /dev/null+++ b/website/src/lib/download-target.ts@@ -0,0 +1,110 @@+import { type AssetKind, findAsset, type LatestRelease } from "./release.ts";++export const STORE_URL = "https://apps.microsoft.com/detail/9MXQ1HQJL5G5";+// The endpoint used by Microsoft's own Store badge in direct-install mode.+export const STORE_INSTALLER_URL = "https://get.microsoft.com/installer/download/9MXQ1HQJL5G5";++export type DownloadTarget = {+ os: "macos" | "windows" | "linux" | null;+ kind: AssetKind | null;+};++export type BrowserSignals = {+ userAgent: string;+ platform?: string;+ maxTouchPoints?: number;+ mobile?: boolean;+ uaPlatform?: string;+ architecture?: string;+ macRenderer?: string;+};++/** The UA's "Intel Mac" token is also used on Apple Silicon and is not a CPU hint. */+export function downloadTarget(signals: BrowserSignals): DownloadTarget {+ const { userAgent, platform = "", uaPlatform = "", architecture = "" } = signals;+ const unsupported = { os: null, kind: null };+ if (+ signals.mobile ||+ /Android|iPhone|iPad|iPod|CrOS|Windows Phone|Mobile/i.test(userAgent) ||+ (/Mac/i.test(platform) && (signals.maxTouchPoints ?? 0) > 1)+ ) {+ return unsupported;+ }++ if (/Windows/i.test(uaPlatform) || /Win/i.test(platform) || /Windows NT/i.test(userAgent)) {+ return { os: "windows", kind: null };+ }+ if (/macOS/i.test(uaPlatform) || /Mac/i.test(platform) || /Macintosh/i.test(userAgent)) {+ const renderer = signals.macRenderer ?? "";+ if (/^arm|aarch64/i.test(architecture) || /Apple (?:M\d|Silicon)/i.test(renderer)) {+ return { os: "macos", kind: "macArm" };+ }+ if (/^x86|^x64|^amd64/i.test(architecture) || /Intel|AMD|Radeon|NVIDIA/i.test(renderer)) {+ return { os: "macos", kind: "macIntel" };+ }+ return { os: "macos", kind: null };+ }+ if (/Linux/i.test(uaPlatform) || /Linux/i.test(platform) || /Linux/i.test(userAgent)) {+ // Linux releases currently ship for x64 only. Never offer one to a known ARM host.+ if (+ /^arm|aarch64/i.test(architecture) ||+ /aarch64|armv\d|\bi[3-6]86\b/i.test(`${userAgent} ${platform}`)+ ) {+ return { os: "linux", kind: null };+ }+ if (/\b(?:Debian|Ubuntu|Linux Mint|Pop!_OS)\b/i.test(userAgent)) {+ return { os: "linux", kind: "deb" };+ }+ if (/\b(?:Fedora|Red Hat|RHEL|CentOS)\b/i.test(userAgent)) {+ return { os: "linux", kind: "rpm" };+ }+ if (/\b(?:Arch(?: Linux|Linux)?|Manjaro)\b/i.test(userAgent)) {+ return { os: "linux", kind: "pacman" };+ }+ return { os: "linux", kind: "appImage" };+ }+ return unsupported;+}++export type BrowserNavigator = Pick<Navigator, "userAgent" | "platform" | "maxTouchPoints"> & {+ userAgentData?: {+ platform?: string;+ mobile?: boolean;+ getHighEntropyValues?: (hints: string[]) => Promise<{ architecture?: string }>;+ };+};++/** Ask only for architecture, and keep working when hints or WebGL are unavailable. */+export async function browserDownloadTarget(+ nav: BrowserNavigator,+ macRenderer: () => string = () => "",+): Promise<DownloadTarget> {+ const signals: BrowserSignals = {+ userAgent: nav.userAgent,+ platform: nav.platform,+ maxTouchPoints: nav.maxTouchPoints,+ uaPlatform: nav.userAgentData?.platform,+ mobile: nav.userAgentData?.mobile,+ };+ const initial = downloadTarget(signals);+ if (initial.os !== "macos" && initial.os !== "linux") return initial;+ try {+ const hints = await nav.userAgentData?.getHighEntropyValues?.(["architecture"]);+ signals.architecture = hints?.architecture;+ } catch {+ // A browser can decline hints without preventing the download chooser.+ }+ if (initial.os === "macos" && !/^arm|aarch64/i.test(signals.architecture ?? "")) {+ try {+ signals.macRenderer = macRenderer();+ } catch {+ // Privacy settings can hide the renderer; show the two Mac versions instead.+ }+ }+ return downloadTarget(signals);+}++export function directDownloadUrl(target: DownloadTarget, release: LatestRelease): string | null {+ if (target.os === "windows") return STORE_INSTALLER_URL;+ return target.kind ? (findAsset(release, target.kind)?.url ?? null) : null;+}diff --git a/website/src/pages/download.tsx b/website/src/pages/download.tsxindex c2199f0cc..7302926b5 100644--- a/website/src/pages/download.tsx+++ b/website/src/pages/download.tsx@@ -17,6 +17,8 @@ import {import { type ReactNode, useState } from "react";import AppLanguages from "../components/AppLanguages";+import useDownloadTarget from "../components/PlatformDownload/useDownloadTarget";+import { STORE_INSTALLER_URL, STORE_URL } from "../lib/download-target";import { type AppLanguage, type AssetKind, findAsset, type LatestRelease } from "../lib/release";import { jsonLd, SOFTWARE_ID, softwareApplicationLd, WEBSITE_ID } from "../lib/structured-data";import styles from "./download.module.css";@@ -24,8 +26,6 @@ import styles from "./download.module.css";const REPO_URL = "https://github.com/getopenscreen/openscreen";const RELEASES_URL = `${REPO_URL}/releases`;const LATEST_URL = `${RELEASES_URL}/latest`;-// The listing README.md recommends on Windows, and the ID in its winget command.-const STORE_URL = "https://apps.microsoft.com/detail/9MXQ1HQJL5G5";type PlatformSpec = {id: string;@@ -41,7 +41,7 @@ type PlatformSpec = {};/** Built at render, because translate() answers in the locale being rendered. */-function getPlatforms(): PlatformSpec[] {+function getPlatforms(windowsStoreUrl: string): PlatformSpec[] {return [{id: "macos",@@ -80,7 +80,7 @@ function getPlatforms(): PlatformSpec[] {// Store, and it is unsigned, which the winget panel below spells out.options: [{- href: STORE_URL,+ href: windowsStoreUrl,label: translate({ id: "download.windows.store.label", message: "Microsoft Store" }),sublabel: translate({id: "download.windows.store.sublabel",@@ -220,6 +220,8 @@ function StarPrompt({ starCount, locale }: { starCount: number | null; locale: sexport default function DownloadPage() {const { siteConfig, i18n } = useDocusaurusContext();const release = (siteConfig.customFields?.latestRelease ?? null) as LatestRelease;+ const target = useDownloadTarget();+ const platforms = getPlatforms(target.os === "windows" ? STORE_INSTALLER_URL : STORE_URL);const languages = (siteConfig.customFields?.appLanguages ?? []) as AppLanguage[];const starCount = (siteConfig.customFields?.starCount ?? null) as number | null;// Which platform card has had a file option clicked. One at a time: the prompt belongs to@@ -289,7 +291,7 @@ export default function DownloadPage() {<section className={styles.platforms}><div className={styles.platformsInner}><div className={styles.grid}>- {getPlatforms().map(({ id, name, icon: Icon, options, footnote }) => (+ {platforms.map(({ id, name, icon: Icon, options, footnote }) => (<article key={id} className={styles.card}><div className={styles.cardHeader}><Icon size={15} />@@ -313,23 +315,15 @@ export default function DownloadPage() {{ size: Math.round(asset.size / 1048576) },): "";- // A set href is a listing (the Store), not a file.- const OptionIcon = href ? ExternalLink : Download;+ const isDownload = Boolean(asset?.url) || href === STORE_INSTALLER_URL;+ const OptionIcon = isDownload ? Download : ExternalLink;return (<akey={kind ?? href}className={styles.option}href={href ?? asset?.url ?? LATEST_URL}- // No preventDefault: the click keeps its default navigation to the- // asset and the download starts as it always did.- //- // Two cases get no prompt, for the same reason: nothing downloaded- // and the page is gone. A set `href` is the Store listing, and a- // missing `asset?.url` means the build-time lookup came back empty- // and this link falls through to the releases page. Both navigate- // away, so the prompt would render behind a page the user has- // already left.- onClick={href || !asset?.url ? undefined : () => setStartedId(id)}+ // Keep the link's default download; listing/fallback links navigate away.+ onClick={isDownload ? () => setStartedId(id) : undefined}><span className={styles.optionText}><span className={styles.optionLabel}>{label}</span>diff --git a/website/src/pages/index.tsx b/website/src/pages/index.tsxindex 61baf3ff0..f047689c6 100644--- a/website/src/pages/index.tsx+++ b/website/src/pages/index.tsx@@ -4,12 +4,13 @@ import Translate, { translate } from "@docusaurus/Translate";import useDocusaurusContext from "@docusaurus/useDocusaurusContext";import Heading from "@theme/Heading";import Layout from "@theme/Layout";-import { Apple, AppWindow, CircleCheck, Download, TerminalSquare } from "lucide-react";+import { Apple, AppWindow, CircleCheck, TerminalSquare } from "lucide-react";import AppLanguages from "../components/AppLanguages";import Editor from "../components/Editor";import Films from "../components/Films";import LocaleLink from "../components/LocaleLink";+import PlatformDownload from "../components/PlatformDownload";import ReleaseBadge from "../components/ReleaseBadge";import Showcase from "../components/Showcase";import type { AppLanguage } from "../lib/release";@@ -53,10 +54,7 @@ export default function Home() {</Translate></p><div className={styles.actions}>- <Link className={styles.primaryCta} to="/download">- <Download size={16} />- <Translate id="home.hero.download">Download</Translate>- </Link>+ <PlatformDownload className={styles.primaryCta} /></div><p className={styles.reassurance}><Translate id="home.hero.reassurance">