Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix: offer all Linux release download formats

Richie McIlroy93fe59e2238f
diff --git a/apps/web/__tests__/unit/download-route.test.ts b/apps/web/__tests__/unit/download-route.test.ts
index d8e7fbeac..1d10aac57 100644
--- a/apps/web/__tests__/unit/download-route.test.ts
+++ b/apps/web/__tests__/unit/download-route.test.ts
@@ -47,6 +47,29 @@ describe("desktop download route", () => {
expect(response.headers.get("location")).toBe("https://github.com/cap.dmg");
vi.unstubAllGlobals();
});
+
+ it.each([
+ ["linux-appimage", "linux-appimage", "https://github.com/cap.AppImage"],
+ ["linux-rpm", "linux-rpm", "https://github.com/cap.rpm"],
+ ["linux-pacman", "linux-pacman", "https://github.com/cap.pkg.tar.zst"],
+ ])(
+ "keeps the %s download format in the fallback",
+ async (platform, key, url) => {
+ vi.stubGlobal(
+ "fetch",
+ vi.fn().mockRejectedValue(new Error("Unavailable")),
+ );
+ vi.mocked(getGitHubReleases).mockResolvedValue([
+ { downloads: { [key]: url } },
+ ] as Awaited<ReturnType<typeof getGitHubReleases>>);
+ const response = await GET(request, {
+ params: Promise.resolve({ platform }),
+ });
+ expect(response.headers.get("location")).toBe(url);
+ vi.unstubAllGlobals();
+ },
+ );
+
it("preserves a successful redirect when probe cancellation fails", async () => {
vi.stubGlobal(
"fetch",
diff --git a/apps/web/__tests__/unit/platform-downloads.test.ts b/apps/web/__tests__/unit/platform-downloads.test.ts
index e97e9e52e..115288b80 100644
--- a/apps/web/__tests__/unit/platform-downloads.test.ts
+++ b/apps/web/__tests__/unit/platform-downloads.test.ts
@@ -9,7 +9,9 @@ describe("download platform helpers", () => {
it("routes Linux users to the Linux deb download", () => {
expect(getDownloadUrl("linux", false)).toBe("/download/linux-deb");
expect(getDownloadButtonText("linux", false)).toBe("Download for free");
- expect(getVersionText("linux")).toBe("Linux x86_64 .deb recommended");
+ expect(getVersionText("linux")).toBe(
+ "Linux x86_64 • .deb, AppImage, RPM and Arch available",
+ );
});
it("keeps existing macOS and Windows download routing", () => {
diff --git a/apps/web/__tests__/unit/releases-downloads.test.ts b/apps/web/__tests__/unit/releases-downloads.test.ts
index adcab5010..2bab54954 100644
--- a/apps/web/__tests__/unit/releases-downloads.test.ts
+++ b/apps/web/__tests__/unit/releases-downloads.test.ts
@@ -8,11 +8,18 @@ import {
describe("release downloads", () => {
it("parses supported release download URLs from the release body", () => {
const downloads = parseDownloadsFromBody(`
- <!-- DOWNLOADS_JSON {"macos-arm64":"https://example.com/Cap.dmg","linux-appimage":"https://example.com/Cap.AppImage","linux-deb":"https://example.com/Cap.deb","linux-rpm":"https://example.com/Cap.rpm"} -->
+ <!-- DOWNLOADS_JSON {"macos-arm64":"https://example.com/Cap.dmg","linux-deb":"https://example.com/Cap.deb","linux-appimage":"https://example.com/Cap.AppImage","linux-rpm":"https://example.com/Cap.rpm","linux-pacman":"https://example.com/Cap.pkg.tar.zst"} -->
`);
expect(downloads["macos-arm64"]).toBe("https://example.com/Cap.dmg");
expect(downloads["linux-deb"]).toBe("https://example.com/Cap.deb");
+ expect(downloads["linux-appimage"]).toBe(
+ "https://example.com/Cap.AppImage",
+ );
+ expect(downloads["linux-rpm"]).toBe("https://example.com/Cap.rpm");
+ expect(downloads["linux-pacman"]).toBe(
+ "https://example.com/Cap.pkg.tar.zst",
+ );
expect(hasDownloads(downloads)).toBe(true);
});
@@ -25,13 +32,13 @@ describe("release downloads", () => {
expect(hasDownloads(downloads)).toBe(true);
});
- it("ignores unsupported Linux-only release metadata", () => {
+ it("accepts Linux-only release metadata", () => {
const downloads = parseDownloadsFromBody(`
<!-- DOWNLOADS_JSON {"linux-appimage":"https://example.com/Cap.AppImage","linux-rpm":"https://example.com/Cap.rpm"} -->
`);
expect(downloads["linux-deb"]).toBeUndefined();
- expect(hasDownloads(downloads)).toBe(false);
+ expect(hasDownloads(downloads)).toBe(true);
});
it("keeps the release download key list in platform order", () => {
@@ -40,6 +47,9 @@ describe("release downloads", () => {
"macos-x64",
"windows",
"linux-deb",
+ "linux-appimage",
+ "linux-rpm",
+ "linux-pacman",
]);
});
});
diff --git a/apps/web/app/(site)/download/[platform]/route.ts b/apps/web/app/(site)/download/[platform]/route.ts
index c55a6885e..83e574ceb 100644
--- a/apps/web/app/(site)/download/[platform]/route.ts
+++ b/apps/web/app/(site)/download/[platform]/route.ts
@@ -110,6 +110,38 @@ export async function GET(
url: "https://cdn.crabnebula.app/download/cap/cap/latest/platform/deb-x86_64",
fallback: "linux-deb",
},
+ "linux-appimage": {
+ url: "https://cdn.crabnebula.app/download/cap/cap/latest/platform/appimage-x86_64",
+ fallback: "linux-appimage",
+ },
+ appimage: {
+ url: "https://cdn.crabnebula.app/download/cap/cap/latest/platform/appimage-x86_64",
+ fallback: "linux-appimage",
+ },
+ "linux-rpm": {
+ url: "https://cdn.crabnebula.app/download/cap/cap/latest/platform/rpm-x86_64",
+ fallback: "linux-rpm",
+ },
+ rpm: {
+ url: "https://cdn.crabnebula.app/download/cap/cap/latest/platform/rpm-x86_64",
+ fallback: "linux-rpm",
+ },
+ fedora: {
+ url: "https://cdn.crabnebula.app/download/cap/cap/latest/platform/rpm-x86_64",
+ fallback: "linux-rpm",
+ },
+ "linux-pacman": {
+ url: "https://cdn.crabnebula.app/download/cap/cap/latest/platform/pacman-x86_64",
+ fallback: "linux-pacman",
+ },
+ pacman: {
+ url: "https://cdn.crabnebula.app/download/cap/cap/latest/platform/pacman-x86_64",
+ fallback: "linux-pacman",
+ },
+ arch: {
+ url: "https://cdn.crabnebula.app/download/cap/cap/latest/platform/pacman-x86_64",
+ fallback: "linux-pacman",
+ },
};
const download = downloadUrls[platform];
diff --git a/apps/web/app/(site)/download/versions/page.tsx b/apps/web/app/(site)/download/versions/page.tsx
index 26a736d37..0e08ba515 100644
--- a/apps/web/app/(site)/download/versions/page.tsx
+++ b/apps/web/app/(site)/download/versions/page.tsx
@@ -56,7 +56,28 @@ function DownloadLinks({
className="inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium rounded-md bg-gray-3 text-gray-12 hover:bg-gray-4 transition-colors"
>
<LinuxIcon />
- Linux .deb
+ Debian / Ubuntu (.deb)
+ </a>
+ <a
+ href="/download/linux-appimage"
+ className="inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium rounded-md bg-gray-3 text-gray-12 hover:bg-gray-4 transition-colors"
+ >
+ <LinuxIcon />
+ AppImage
+ </a>
+ <a
+ href="/download/linux-rpm"
+ className="inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium rounded-md bg-gray-3 text-gray-12 hover:bg-gray-4 transition-colors"
+ >
+ <LinuxIcon />
+ Fedora / RPM
+ </a>
+ <a
+ href="/download/linux-pacman"
+ className="inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium rounded-md bg-gray-3 text-gray-12 hover:bg-gray-4 transition-colors"
+ >
+ <LinuxIcon />
+ Arch / Pacman
</a>
</div>
);
@@ -101,7 +122,34 @@ function DownloadLinks({
className="inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium rounded-md bg-gray-3 text-gray-12 hover:bg-gray-4 transition-colors"
>
<LinuxIcon />
- Linux .deb
+ Debian / Ubuntu (.deb)
+ </a>
+ )}
+ {downloads["linux-appimage"] && (
+ <a
+ href={downloads["linux-appimage"]}
+ className="inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium rounded-md bg-gray-3 text-gray-12 hover:bg-gray-4 transition-colors"
+ >
+ <LinuxIcon />
+ AppImage
+ </a>
+ )}
+ {downloads["linux-rpm"] && (
+ <a
+ href={downloads["linux-rpm"]}
+ className="inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium rounded-md bg-gray-3 text-gray-12 hover:bg-gray-4 transition-colors"
+ >
+ <LinuxIcon />
+ Fedora / RPM
+ </a>
+ )}
+ {downloads["linux-pacman"] && (
+ <a
+ href={downloads["linux-pacman"]}
+ className="inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium rounded-md bg-gray-3 text-gray-12 hover:bg-gray-4 transition-colors"
+ >
+ <LinuxIcon />
+ Arch / Pacman
</a>
)}
</div>
diff --git a/apps/web/components/pages/DownloadPage.tsx b/apps/web/components/pages/DownloadPage.tsx
index 3a033bf07..30b475985 100644
--- a/apps/web/components/pages/DownloadPage.tsx
+++ b/apps/web/components/pages/DownloadPage.tsx
@@ -155,7 +155,7 @@ export const DownloadPage = () => {
<h3 className="mb-2 text-base font-medium text-gray-10">
Other download options:
</h3>
- <div className="flex flex-col gap-3 justify-center items-center md:flex-row">
+ <div className="flex flex-col gap-3 justify-center items-center md:flex-row md:flex-wrap">
{platform !== "windows" && (
<a
href="/download/windows"
@@ -181,9 +181,45 @@ export const DownloadPage = () => {
}
className="text-sm transition-all text-gray-10 hover:underline"
>
- Linux .deb
+ Debian / Ubuntu (.deb)
</a>
)}
+ <a
+ href="/download/linux-appimage"
+ onClick={() =>
+ trackDownloadClick(
+ "other_option_linux_appimage",
+ "/download/linux-appimage",
+ )
+ }
+ className="text-sm transition-all text-gray-10 hover:underline"
+ >
+ AppImage
+ </a>
+ <a
+ href="/download/linux-rpm"
+ onClick={() =>
+ trackDownloadClick(
+ "other_option_linux_rpm",
+ "/download/linux-rpm",
+ )
+ }
+ className="text-sm transition-all text-gray-10 hover:underline"
+ >
+ Fedora / RPM
+ </a>
+ <a
+ href="/download/linux-pacman"
+ onClick={() =>
+ trackDownloadClick(
+ "other_option_linux_pacman",
+ "/download/linux-pacman",
+ )
+ }
+ className="text-sm transition-all text-gray-10 hover:underline"
+ >
+ Arch / Pacman
+ </a>
{platform === "macos" && isIntel && (
<a
href="/download/apple-silicon"
diff --git a/apps/web/utils/platform.tsx b/apps/web/utils/platform.tsx
index ae354a744..6e1543b71 100644
--- a/apps/web/utils/platform.tsx
+++ b/apps/web/utils/platform.tsx
@@ -79,7 +79,7 @@ export const getVersionText = (platform: string | null): React.ReactNode => {
} else if (platform === "windows") {
return "Windows 10+ recommended";
} else if (platform === "linux") {
- return "Linux x86_64 .deb recommended";
+ return "Linux x86_64 • .deb, AppImage, RPM and Arch available";
} else {
return "macOS 13.1+ recommended";
}
diff --git a/apps/web/utils/releases.ts b/apps/web/utils/releases.ts
index 5ef6763a7..3014dbfbe 100644
--- a/apps/web/utils/releases.ts
+++ b/apps/web/utils/releases.ts
@@ -3,6 +3,9 @@ export interface ReleaseDownloads {
"macos-x64"?: string;
windows?: string;
"linux-deb"?: string;
+ "linux-appimage"?: string;
+ "linux-rpm"?: string;
+ "linux-pacman"?: string;
}
export const releasesRevalidateSeconds = 60;
@@ -15,6 +18,9 @@ export const releaseDownloadKeys = [
"macos-x64",
"windows",
"linux-deb",
+ "linux-appimage",
+ "linux-rpm",
+ "linux-pacman",
] satisfies ReleaseDownloadKey[];
export interface Release {