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
fix(website): make /download links platform-specific instead of four ways to the same URL
Etienne Lescot434963fd72e6
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.ymlindex 9164f164d..9b533f916 100644--- a/.github/workflows/docs.yml+++ b/.github/workflows/docs.yml@@ -11,6 +11,14 @@ on:paths:- "website/**"- ".github/workflows/docs.yml"+ # The /download page resolves the current release's assets at build time so it+ # can link each platform to its actual file. Without this trigger that data+ # would freeze at whatever the last website/** change saw, and the page would+ # keep serving the previous version's binaries after every release.+ # Pre-releases are skipped: /releases/latest ignores them, so the built output+ # would be byte-identical.+ release:+ types: [published]workflow_dispatch:# Cancel in-flight runs on the same ref so fast follow-up pushes@@ -26,6 +34,9 @@ jobs:build:name: Build siteruns-on: ubuntu-latest+ # A pre-release does not change what /releases/latest resolves to, so+ # rebuilding for one would burn a run to produce identical output.+ if: github.event_name != 'release' || github.event.release.prerelease == falsesteps:- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1with:@@ -53,7 +64,9 @@ jobs:name: Deploy to GitHub Pagesruns-on: ubuntu-latestneeds: build- if: github.event_name == 'push' && github.ref == 'refs/heads/main'+ if: >-+ (github.event_name == 'push' && github.ref == 'refs/heads/main')+ || github.event_name == 'release'environment:name: github-pagesurl: ${{ steps.deployment.outputs.page_url }}diff --git a/website/docusaurus.config.ts b/website/docusaurus.config.tsindex 5224d90f4..ba07ea0ec 100644--- a/website/docusaurus.config.ts+++ b/website/docusaurus.config.ts@@ -2,8 +2,11 @@ import type * as Preset from "@docusaurus/preset-classic";import type { Config } from "@docusaurus/types";import { themes as prismThemes } from "prism-react-renderer";+import type { LatestRelease } from "./src/lib/release";+const SITE_URL = "https://getopenscreen.com";-const REPO_URL = "https://github.com/getopenscreen/openscreen";+const REPO_SLUG = "getopenscreen/openscreen";+const REPO_URL = `https://github.com/${REPO_SLUG}`;const UPSTREAM_REPO_URL = "https://github.com/siddharthvaddem/openscreen";const DISCORD_URL = "https://discord.gg/VvT6Vtnyh";@@ -64,8 +67,73 @@ async function fetchStarCount(): Promise<number | null> {}}+const MONTHS = [+ "January",+ "February",+ "March",+ "April",+ "May",+ "June",+ "July",+ "August",+ "September",+ "October",+ "November",+ "December",+];++/**+ * The published assets for the current stable release, resolved at build time+ * so /download can link each platform to its actual file instead of bouncing+ * everyone through the releases list.+ *+ * This is only safe because .github/workflows/docs.yml also rebuilds on+ * `release: published`. Without that trigger the data would go stale silently —+ * the workflow otherwise only fires on website/** changes, so shipping a new+ * version would leave this page advertising the previous one indefinitely.+ *+ * Returns null on any failure (the API is called unauthenticated, so a+ * rate-limited runner is a real possibility); the page falls back to+ * /releases/latest links, which are always correct.+ */+async function fetchLatestRelease(): Promise<LatestRelease> {+ try {+ const res = await fetch(`https://api.github.com/repos/${REPO_SLUG}/releases/latest`, {+ headers: { Accept: "application/vnd.github+json" },+ signal: AbortSignal.timeout(5000),+ });+ if (!res.ok) return null;+ const data = (await res.json()) as {+ tag_name?: unknown;+ published_at?: unknown;+ assets?: unknown;+ };+ if (typeof data.tag_name !== "string" || !Array.isArray(data.assets)) return null;++ const assets = data.assets.flatMap((raw) => {+ const a = raw as { name?: unknown; browser_download_url?: unknown; size?: unknown };+ if (typeof a.name !== "string" || typeof a.browser_download_url !== "string") return [];+ return [{ name: a.name, url: a.browser_download_url, size: Number(a.size) || 0 }];+ });+ if (assets.length === 0) return null;++ // Formatted here rather than in the component: toLocaleDateString would+ // resolve against the visitor's locale and time zone on hydration and+ // mismatch the server-rendered string.+ let published = "";+ if (typeof data.published_at === "string") {+ const [y, m, d] = data.published_at.slice(0, 10).split("-");+ if (y && m && d) published = `${Number(d)} ${MONTHS[Number(m) - 1]} ${y}`;+ }++ return { tag: data.tag_name, published, assets };+ } catch {+ return null;+ }+}+export default async function createConfig(): Promise<Config> {- const starCount = await fetchStarCount();+ const [starCount, latestRelease] = await Promise.all([fetchStarCount(), fetchLatestRelease()]);const starBadge =starCount !== null? `<span class="navbar-github-stars">${STAR_SVG}${formatStarCount(starCount)}</span>`@@ -93,6 +161,10 @@ export default async function createConfig(): Promise<Config> {organizationName: "getopenscreen",projectName: "openscreen",+ // Read back by src/pages/download.tsx. Serialized into the client bundle,+ // so it stays plain JSON.+ customFields: { latestRelease },+onBrokenLinks: "throw",onBrokenAnchors: "throw",diff --git a/website/src/lib/release.ts b/website/src/lib/release.tsnew file mode 100644index 000000000..5bf1d2b50--- /dev/null+++ b/website/src/lib/release.ts@@ -0,0 +1,44 @@+/**+ * Shape of the build-time GitHub release lookup, shared between the config that+ * fetches it (docusaurus.config.ts) and the page that renders it+ * (src/pages/download.tsx), which reads it back off siteConfig.customFields.+ */++export type ReleaseAsset = {+ name: string;+ url: string;+ size: number;+};++/** null whenever the build-time lookup failed; callers must handle it. */+export type LatestRelease = {+ tag: string;+ /** Pre-formatted at build time, e.g. "19 July 2026". Empty if unknown. */+ published: string;+ assets: ReleaseAsset[];+} | null;++/**+ * Asset filenames carry the version (Openscreen-Mac-arm64-1.7.0.dmg), so these+ * match on the stable parts only — platform, arch, and extension — and keep+ * working across releases without a config change.+ */+export const ASSET_PATTERNS = {+ macArm: /Mac.*arm64.*\.dmg$/i,+ macIntel: /Mac.*x64.*\.dmg$/i,+ windows: /\.exe$/i,+ deb: /\.deb$/i,+ pacman: /\.pacman$/i,+ appImage: /\.AppImage$/i,+} as const;++export type AssetKind = keyof typeof ASSET_PATTERNS;++export function findAsset(release: LatestRelease, kind: AssetKind): ReleaseAsset | null {+ return release?.assets.find((a) => ASSET_PATTERNS[kind].test(a.name)) ?? null;+}++export function formatSize(bytes: number): string {+ if (!bytes) return "";+ return `${Math.round(bytes / 1048576)} MB`;+}diff --git a/website/src/pages/download.module.css b/website/src/pages/download.module.cssindex 0924e518e..6f789a250 100644--- a/website/src/pages/download.module.css+++ b/website/src/pages/download.module.css@@ -51,68 +51,16 @@max-width: 560px;}-.actions {- display: flex;- gap: 12px;- justify-content: center;- flex-wrap: wrap;- margin: 30px 0 0;-}--.primaryCta,-.secondaryCta {- display: inline-flex;- align-items: center;- gap: 0.5rem;- padding: 0.65rem 1.35rem;- border-radius: 9px;- font-weight: 600;- font-size: 0.95rem;- text-decoration: none;- transition: transform 0.15s ease, box-shadow 0.15s ease;-}--.primaryCta {- background: var(--os-accent);- color: #fff;- box-shadow: 0 8px 24px rgba(16, 185, 129, 0.25);-}--.primaryCta:hover {- transform: translateY(-2px);- color: #fff;- text-decoration: none;-}--.secondaryCta {- background: transparent;- color: var(--os-fg-2);- border: 1px solid var(--os-border);-}--.secondaryCta:hover {- transform: translateY(-2px);- border-color: var(--os-fg-2);- color: var(--os-fg-2);- text-decoration: none;-}--.note {- margin: 22px auto 0;- max-width: 460px;+.releaseMeta {+ margin: 18px 0 0;font-size: 12.5px;color: var(--os-meta);- line-height: 1.5;-}--.note strong {- color: var(--os-muted);}/* ---- platform cards ---- */.platforms {- padding: 56px 28px 100px;+ padding: 44px 28px 100px;display: flex;justify-content: center;}@@ -126,6 +74,7 @@display: grid;grid-template-columns: repeat(3, 1fr);gap: 0.875rem;+ align-items: start;}@media (max-width: 860px) {@@ -134,8 +83,6 @@}}-/* Flex column so .cardBody absorbs the slack and the CTA sits flush at the- bottom of all three cards, whose blurbs differ in length. */.card {display: flex;flex-direction: column;@@ -157,59 +104,71 @@color: var(--os-fg-2);}-.artifactChip {- margin-left: auto;- padding: 1px 7px;- border-radius: 999px;+.cardBody {+ display: flex;+ flex-direction: column;+ gap: 8px;+ padding: 14px;+}++/* One row per real artifact. The whole row is the link: a platform can ship+ three of these, and three stacked buttons would read as three CTAs. */+.option {+ display: flex;+ align-items: center;+ gap: 10px;+ padding: 10px 12px;+ border-radius: 10px;border: 1px solid var(--os-border-soft);- font-family: var(--ifm-font-family-monospace);- font-size: 10.5px;- color: var(--os-meta);+ background: var(--os-surface-2);+ color: var(--os-fg-2);+ text-decoration: none;+ transition: border-color 0.15s ease, background 0.15s ease;}-.cardBody {+.option:hover {+ border-color: var(--os-accent-border);+ background: var(--os-accent-wash);+ color: var(--os-fg-2);+ text-decoration: none;+}++.optionText {+ display: flex;+ flex-direction: column;+ min-width: 0;flex: 1;- padding: 16px;}-.cardBlurb {- margin: 0;+.optionLabel {font-size: 13px;- line-height: 1.6;- color: var(--os-muted);+ font-weight: 600;+ color: var(--os-fg-emphasis);}-.noteList {- margin: 12px 0 0;- padding-left: 16px;- font-size: 12.5px;- line-height: 1.75;+.optionSub {+ font-size: 11.5px;color: var(--os-meta);}-.noteList li::marker {- color: var(--os-accent);+.optionSize {+ flex: none;+ font-family: var(--ifm-font-family-monospace);+ font-size: 11px;+ color: var(--os-muted);}-.cardCta {- display: flex;- align-items: center;- justify-content: center;- gap: 7px;- margin: 0 16px 16px;- padding: 9px 14px;- border-radius: 9px;- background: var(--os-accent);- color: #fff;- font-size: 13px;- font-weight: 600;- text-decoration: none;+.optionIcon {+ flex: none;+ color: var(--os-accent);}-.cardCta:hover {- background: var(--os-brand-lo);- color: #fff;- text-decoration: none;+.cardFoot {+ margin: 0;+ padding: 0 16px 14px;+ font-size: 11.5px;+ line-height: 1.55;+ color: var(--os-meta);}/* ---- side panels ---- */@@ -271,10 +230,72 @@color: var(--os-meta);}-.footNote {- margin: 26px 0 0;- text-align: center;+/* ---- pre-release / all releases ---- */++/* Deliberately quieter than the cards: bordered but unfilled, no accent+ background, and a ghost CTA rather than a solid one, so it reads as the+ secondary path it is. */+.preRelease {+ margin-top: 0.875rem;+ display: flex;+ align-items: center;+ gap: 14px;+ padding: 16px 18px;+ border-radius: 14px;+ border: 1px dashed var(--os-border-hi);+ background: transparent;+}++.preReleaseIcon {+ flex: none;+ color: var(--os-muted);+}++.preReleaseText {+ flex: 1;+ min-width: 0;+}++.preReleaseTitle {+ margin: 0;+ font-size: 13px;+ font-weight: 600;+ color: var(--os-fg-2);+}++.preReleaseBody {+ margin: 2px 0 0;font-size: 12.5px;- line-height: 1.6;+ line-height: 1.55;color: var(--os-meta);}++.preReleaseCta {+ flex: none;+ padding: 8px 14px;+ border-radius: 9px;+ border: 1px solid var(--os-border);+ font-size: 12.5px;+ font-weight: 600;+ color: var(--os-fg-2);+ text-decoration: none;+ white-space: nowrap;+}++.preReleaseCta:hover {+ border-color: var(--os-fg-2);+ color: var(--os-fg-2);+ text-decoration: none;+}++@media (max-width: 700px) {+ .preRelease {+ flex-direction: column;+ align-items: flex-start;+ }++ .preReleaseCta {+ align-self: stretch;+ text-align: center;+ }+}diff --git a/website/src/pages/download.tsx b/website/src/pages/download.tsxindex a6ec04a5d..130861de6 100644--- a/website/src/pages/download.tsx+++ b/website/src/pages/download.tsx@@ -1,64 +1,67 @@import Link from "@docusaurus/Link";+import useDocusaurusContext from "@docusaurus/useDocusaurusContext";import Heading from "@theme/Heading";import Layout from "@theme/Layout";-import { Apple, AppWindow, Download, Package, ShieldCheck, TerminalSquare } from "lucide-react";+import {+ Apple,+ AppWindow,+ Download,+ FlaskConical,+ ShieldCheck,+ TerminalSquare,+} from "lucide-react";+import { type AssetKind, findAsset, formatSize, type LatestRelease } from "../lib/release";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`;-// Every published asset carries the version in its filename-// (Openscreen-Mac-arm64-1.7.0.dmg), so there is no stable per-asset URL to deep-// link to. A build-time lookup of the current release would go stale silently:-// the docs workflow only fires on website/** changes, so a new app release-// would not rebuild this page and it would keep advertising the previous-// version. /releases/latest is resolved by GitHub on every click instead, which-// is always correct at the cost of one extra hop.-const LATEST = `${REPO_URL}/releases/latest`;+type PlatformSpec = {+ id: string;+ name: string;+ icon: typeof Apple;+ /** One row per artifact the platform actually ships. */+ options: { kind: AssetKind; label: string; sublabel: string }[];+ footnote?: string;+};-const PLATFORMS = [+const PLATFORMS: PlatformSpec[] = [{id: "macos",name: "macOS",icon: Apple,- artifact: ".dmg",- blurb:- "Separate builds for Apple Silicon and Intel. Native ScreenCaptureKit capture, real cursor and click effects, native webcam.",- notes: [- "Apple Silicon: Openscreen-Mac-arm64",- "Intel: Openscreen-Mac-x64",- "Grant Screen Recording and Accessibility in System Settings on first launch",+ options: [+ { kind: "macArm", label: "Apple Silicon", sublabel: "M1 and newer · .dmg" },+ { kind: "macIntel", label: "Intel", sublabel: "x86_64 · .dmg" },],+ footnote: "Grant Screen Recording and Accessibility on first launch.",},{id: "windows",name: "Windows",icon: AppWindow,- artifact: ".exe",- blurb:- "One installer, nothing to configure. Windows Graphics Capture, system audio out of the box, native webcam.",- notes: [- "Run the installer and launch — no terminal step",- "System audio captured without extra drivers",- ],+ options: [{ kind: "windows", label: "Windows 10 & 11", sublabel: "Installer · .exe" }],+ footnote: "System audio is captured without extra drivers.",},{id: "linux",name: "Linux",icon: TerminalSquare,- artifact: ".deb · .pacman · AppImage",- blurb:- "Four ways to install, including a Nix flake. Browser-pipeline capture; PipeWire is needed for system audio.",- notes: [- "Debian, Ubuntu, Pop!_OS: .deb",- "Arch, Manjaro: .pacman",- "Any distro: AppImage",- "NixOS: flake",+ options: [+ { kind: "deb", label: "Debian, Ubuntu, Pop!_OS", sublabel: "Package · .deb" },+ { kind: "pacman", label: "Arch, Manjaro", sublabel: "Package · .pacman" },+ { kind: "appImage", label: "Any distribution", sublabel: "Portable · .AppImage" },],+ footnote: "PipeWire is required for system audio.",},-] as const;+];export default function DownloadPage() {+ const { siteConfig } = useDocusaurusContext();+ const release = (siteConfig.customFields?.latestRelease ?? null) as LatestRelease;+return (<Layouttitle="Download for Windows, macOS & Linux"@@ -66,52 +69,53 @@ export default function DownloadPage() {><header className={styles.hero}><div className={styles.heroInner}>- <span className={styles.badge}>MIT licensed · free forever</span>+ <span className={styles.badge}>+ {release ? `${release.tag} · MIT licensed` : "MIT licensed · free forever"}+ </span><Heading as="h1" className={styles.title}>Download OpenScreen</Heading><p className={styles.tagline}>- A free, open-source screen recorder and video editor for Windows, macOS, and Linux. No- account, no watermark, no subscription.- </p>- <div className={styles.actions}>- <a className={styles.primaryCta} href={LATEST}>- <Download size={16} />- Get the latest release- </a>- <Link className={styles.secondaryCta} to="/docs/installation">- Installation guide- </Link>- </div>- <p className={styles.note}>- OpenScreen is <strong>not production-grade</strong>. Expect rough edges while we build- in the open.+ A free, open-source screen recorder and video editor. No account, no watermark, no+ subscription.</p>+ {release?.published ? (+ <p className={styles.releaseMeta}>+ Latest stable release, published {release.published}+ </p>+ ) : null}</div></header><section className={styles.platforms}><div className={styles.platformsInner}><div className={styles.grid}>- {PLATFORMS.map(({ id, name, icon: Icon, artifact, blurb, notes }) => (+ {PLATFORMS.map(({ id, name, icon: Icon, options, footnote }) => (<article key={id} className={styles.card}><div className={styles.cardHeader}><Icon size={15} /><span>{name}</span>- <span className={styles.artifactChip}>{artifact}</span></div><div className={styles.cardBody}>- <p className={styles.cardBlurb}>{blurb}</p>- <ul className={styles.noteList}>- {notes.map((n) => (- <li key={n}>{n}</li>- ))}- </ul>+ {options.map(({ kind, label, sublabel }) => {+ const asset = findAsset(release, kind);+ // No build-time asset data (rate-limited runner, or a+ // release that dropped this artifact) degrades to the+ // releases list rather than rendering a dead link.+ const size = asset ? formatSize(asset.size) : "";+ return (+ <a key={kind} className={styles.option} href={asset?.url ?? LATEST_URL}>+ <span className={styles.optionText}>+ <span className={styles.optionLabel}>{label}</span>+ <span className={styles.optionSub}>{sublabel}</span>+ </span>+ {size ? <span className={styles.optionSize}>{size}</span> : null}+ <Download size={14} className={styles.optionIcon} />+ </a>+ );+ })}</div>- <a className={styles.cardCta} href={LATEST}>- <Download size={14} />- Download for {name}- </a>+ {footnote ? <p className={styles.cardFoot}>{footnote}</p> : null}</article>))}</div>@@ -133,26 +137,36 @@ export default function DownloadPage() {<div className={styles.panel}><div className={styles.panelHeader}>- <Package size={14} />- <span>Linux: install without downloading</span>+ <TerminalSquare size={14} />+ <span>Nix: run it without installing</span></div><pre className={styles.code}>- <span className={styles.meta}># run it straight from the flake</span>- {"\n"}<span className={styles.accentText}>nix</span> run github:getopenscreen/openscreen</pre><p className={styles.panelFoot}>- Package manager commands for .deb, .pacman, and AppImage are in the{" "}+ Per-distribution steps are in the{" "}<Link to="/docs/installation">installation guide</Link>.</p></div></div>- <p className={styles.footNote}>- Every artifact for every release — including checksums and release notes — is on the{" "}- <a href={`${REPO_URL}/releases`}>Releases page</a>. Source is on{" "}- <a href={REPO_URL}>GitHub</a> under the MIT license.- </p>+ {/* Release candidates ship between stable versions and are genuinely+ ahead of what the cards above serve, so this is a real path and not+ a footer link — kept visually quiet so it cannot be mistaken for+ the recommended download. */}+ <aside className={styles.preRelease}>+ <FlaskConical size={16} className={styles.preReleaseIcon} />+ <div className={styles.preReleaseText}>+ <p className={styles.preReleaseTitle}>Want to test what is coming next?</p>+ <p className={styles.preReleaseBody}>+ Release candidates ship between stable versions, alongside older releases,+ checksums, and full release notes.+ </p>+ </div>+ <a className={styles.preReleaseCta} href={RELEASES_URL}>+ Browse all releases+ </a>+ </aside></div></section></Layout>