Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

feat: Push Windows release live

Richie McIlroy321473abbf90
diff --git a/Cargo.lock b/Cargo.lock
index f27c55cc1..766533ef6 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -918,7 +918,7 @@ dependencies = [
[[package]]
name = "cap-desktop"
-version = "0.3.26"
+version = "0.3.27"
dependencies = [
"anyhow",
"axum",
diff --git a/apps/web/app/download/[platform]/route.ts b/apps/web/app/download/[platform]/route.ts
index 181d6ed95..8588cc844 100644
--- a/apps/web/app/download/[platform]/route.ts
+++ b/apps/web/app/download/[platform]/route.ts
@@ -20,8 +20,8 @@ export async function GET(
"apple-silicon": "https://cdn.crabnebula.app/download/cap/cap/latest/platform/dmg-aarch64",
aarch64: "https://cdn.crabnebula.app/download/cap/cap/latest/platform/dmg-aarch64",
x86_64: "https://cdn.crabnebula.app/download/cap/cap/latest/platform/dmg-x86_64",
- windows: "https://cdn.crabnebula.app/download/cap/cap/latest/platform/wix-x86_64",
- win: "https://cdn.crabnebula.app/download/cap/cap/latest/platform/wix-x86_64",
+ windows: "https://cdn.crabnebula.app/download/cap/cap/latest/platform/nsis-x86_64",
+ win: "https://cdn.crabnebula.app/download/cap/cap/latest/platform/nsis-x86_64",
};
// Get the download URL for the requested platform
diff --git a/apps/web/components/pages/DownloadPage.tsx b/apps/web/components/pages/DownloadPage.tsx
index 36261be8a..5ec56b16b 100644
--- a/apps/web/components/pages/DownloadPage.tsx
+++ b/apps/web/components/pages/DownloadPage.tsx
@@ -1,27 +1,98 @@
"use client";
import { Button, LogoBadge } from "@cap/ui";
-import { useState } from "react";
+import { useEffect, useState } from "react";
+import {
+ detectPlatform,
+ getDownloadButtonText,
+ getDownloadUrl,
+ getPlatformIcon,
+ getVersionText,
+ PlatformIcons,
+} from "@/utils/platform";
export const DownloadPage = () => {
- const [loading, setLoading] = useState(false);
- const [showOtherOptions, setShowOtherOptions] = useState(false);
+ const [loading, setLoading] = useState(true);
+ const [platform, setPlatform] = useState<string | null>(null);
+ const [isIntel, setIsIntel] = useState(false);
+ const [showDebug, setShowDebug] = useState(true);
- const releaseFetch = async () => {
- setLoading(true);
- const response = await fetch("/api/releases/macos");
- const data = await response.json();
+ useEffect(() => {
+ const detectUserPlatform = async () => {
+ try {
+ const { platform, isIntel } = await detectPlatform();
+ setPlatform(platform);
+ setIsIntel(isIntel);
+ } catch (error) {
+ console.error("Error detecting platform:", error);
+ } finally {
+ setLoading(false);
+ }
+ };
- if (data.url) {
- window.location.href = data.url;
- }
+ detectUserPlatform();
+ }, []);
- setLoading(false);
+ const simulatePlatform = (newPlatform: string, newIsIntel: boolean) => {
+ setPlatform(newPlatform);
+ setIsIntel(newIsIntel);
};
return (
- <div className="pt-32 pb-16 wrapper wrapper-sm md:py-52">
+ <div className="pt-32 pb-16 wrapper wrapper-sm md:py-32">
<div className="space-y-4 text-center">
+ {/* Debug toggle button in top-right corner */}
+ <button
+ onClick={() => setShowDebug(!showDebug)}
+ className="absolute top-4 right-4 text-xs text-gray-400 hover:text-gray-300 bg-gray-800 px-2 py-1 rounded"
+ >
+ {showDebug ? "Hide Debug" : "Debug"}
+ </button>
+
+ {/* Debug panel */}
+ {showDebug && (
+ <div className="fixed top-10 right-4 bg-gray-800 p-3 rounded shadow-lg z-50 text-left">
+ <div className="text-xs text-gray-300 mb-2">Platform Simulator</div>
+ <div className="space-y-2">
+ <button
+ onClick={() => simulatePlatform("windows", false)}
+ className={`text-xs px-2 py-1 rounded w-full text-left ${
+ platform === "windows"
+ ? "bg-blue-600"
+ : "bg-gray-700 hover:bg-gray-600"
+ }`}
+ >
+ Windows (Beta)
+ </button>
+ <button
+ onClick={() => simulatePlatform("macos", true)}
+ className={`text-xs px-2 py-1 rounded w-full text-left ${
+ platform === "macos" && isIntel
+ ? "bg-blue-600"
+ : "bg-gray-700 hover:bg-gray-600"
+ }`}
+ >
+ macOS (Intel)
+ </button>
+ <button
+ onClick={() => simulatePlatform("macos", false)}
+ className={`text-xs px-2 py-1 rounded w-full text-left ${
+ platform === "macos" && !isIntel
+ ? "bg-blue-600"
+ : "bg-gray-700 hover:bg-gray-600"
+ }`}
+ >
+ macOS (Apple Silicon)
+ </button>
+ <div className="text-xs text-gray-400 mt-2">
+ Current: {platform}{" "}
+ {platform === "macos" &&
+ (isIntel ? "(Intel)" : "(Apple Silicon)")}
+ </div>
+ </div>
+ </div>
+ )}
+
<h1 className="text-2xl fade-in-down animate-delay-1 md:text-4xl">
Download Cap
</h1>
@@ -29,38 +100,93 @@ export const DownloadPage = () => {
The quickest way to share your screen. Pin to your dock and record in
seconds.
</p>
- <div className="flex flex-col justify-center items-center space-y-2 md:flex-row md:space-y-0 md:space-x-2 fade-in-up animate-delay-2">
- <Button
- variant="radialblue"
- spinner={loading}
- size="lg"
- href="https://solitary-art-7d28.brendonovich.workers.dev/desktop/latest/platform/dmg-aarch64"
- className="w-full font-medium md:w-auto"
- >
- Download for Apple Silicon
- </Button>
- {showOtherOptions && (
+ <div className="flex flex-col justify-center items-center space-y-4 fade-in-up animate-delay-2">
+ <div className="flex flex-col items-center space-y-4">
<Button
variant="radialblue"
size="lg"
- href="https://solitary-art-7d28.brendonovich.workers.dev/desktop/latest/platform/dmg-x86_64"
- className="w-full font-medium md:w-auto"
+ href={getDownloadUrl(platform, isIntel)}
+ className="font-medium flex items-center justify-center text-white py-6"
>
- Download for Mac Intel
+ {!loading && getPlatformIcon(platform)}
+ {getDownloadButtonText(platform, loading, isIntel)}
</Button>
- )}
+
+ <div className="text-sm text-gray-400">
+ {getVersionText(platform)}
+ </div>
+
+ {/* Windows SmartScreen video and instructions */}
+ {platform === "windows" && (
+ <div className="mt-4 max-w-md">
+ <video
+ src="/windows-smartscreen.mp4"
+ autoPlay
+ loop
+ muted
+ playsInline
+ className="w-full rounded-md shadow-md mx-auto"
+ style={{ maxWidth: "300px" }}
+ />
+ <p className="text-sm text-gray-400 mt-2">
+ Whilst Cap for Windows is in early beta, after downloading and
+ running the app, follow the steps above to whitelist Cap on
+ your PC.
+ </p>
+ </div>
+ )}
+ </div>
</div>
- <div className="fade-in-up animate-delay-2">
- <p className="text-xs">macOS 13+ or later recommended.</p>
+
+ <PlatformIcons />
+
+ <div className="mt-6 fade-in-up animate-delay-2">
+ <h3 className="text-sm font-medium mb-2 text-gray-400">
+ Other download options:
+ </h3>
+ <div className="flex flex-col md:flex-row justify-center items-center gap-3">
+ {platform !== "windows" && (
+ <a
+ href="/download/windows"
+ className="text-sm text-gray-400 hover:underline transition-all"
+ >
+ Windows (Beta)
+ </a>
+ )}
+ {platform === "macos" && isIntel && (
+ <a
+ href="/download/apple-silicon"
+ className="text-sm text-gray-400 hover:underline transition-all"
+ >
+ Apple Silicon
+ </a>
+ )}
+ {platform === "macos" && !isIntel && (
+ <a
+ href="/download/apple-intel"
+ className="text-sm text-gray-400 hover:underline transition-all"
+ >
+ Apple Intel
+ </a>
+ )}
+ {platform !== "macos" && (
+ <>
+ <a
+ href="/download/apple-silicon"
+ className="text-sm text-gray-400 hover:underline transition-all"
+ >
+ Apple Silicon
+ </a>
+ <a
+ href="/download/apple-intel"
+ className="text-sm text-gray-400 hover:underline transition-all"
+ >
+ Apple Intel
+ </a>
+ </>
+ )}
+ </div>
</div>
- {!showOtherOptions && (
- <button
- onClick={() => setShowOtherOptions(true)}
- className="mt-2 text-sm text-gray-400 underline fade-in-up animate-delay-2"
- >
- See other options
- </button>
- )}
</div>
</div>
);
diff --git a/apps/web/components/pages/HomePage/index.tsx b/apps/web/components/pages/HomePage/index.tsx
index 8ecab7e6d..047395a23 100644
--- a/apps/web/components/pages/HomePage/index.tsx
+++ b/apps/web/components/pages/HomePage/index.tsx
@@ -3,24 +3,49 @@
"use client";
import { Parallax } from "react-scroll-parallax";
-import toast from "react-hot-toast";
import { ParallaxProvider } from "react-scroll-parallax";
import { Button } from "@cap/ui";
-import React, { useEffect } from "react";
+import React, { useEffect, useState } from "react";
import { LogoSection } from "../_components/LogoSection";
import { ReadyToGetStarted } from "@/components/ReadyToGetStarted";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { faAngleRight, faPlay } from "@fortawesome/free-solid-svg-icons";
+import { faAngleRight } from "@fortawesome/free-solid-svg-icons";
import PowerfulFeaturesSVG from "./PowerfulFeaturesSVG";
import LeftBlueHue from "./LeftBlueHue";
import { AnimatePresence, motion } from "framer-motion";
import Link from "next/link";
-import { useState } from "react";
import { useClickAway } from "@uidotdev/usehooks";
import MuxPlayer from "@mux/mux-player-react";
+import {
+ detectPlatform,
+ getDownloadButtonText,
+ getDownloadUrl,
+ getPlatformIcon,
+ PlatformIcons,
+} from "@/utils/platform";
export const HomePage = () => {
const [videoToggled, setVideoToggled] = useState(false);
+ const [loading, setLoading] = useState(true);
+ const [platform, setPlatform] = useState<string | null>(null);
+ const [isIntel, setIsIntel] = useState(false);
+
+ useEffect(() => {
+ const detectUserPlatform = async () => {
+ try {
+ const { platform, isIntel } = await detectPlatform();
+ setPlatform(platform);
+ setIsIntel(isIntel);
+ } catch (error) {
+ console.error("Error detecting platform:", error);
+ } finally {
+ setLoading(false);
+ }
+ };
+
+ detectUserPlatform();
+ }, []);
+
return (
<ParallaxProvider>
<div className="mt-[120px]">
@@ -34,9 +59,9 @@ export const HomePage = () => {
mx-auto bg-[#2e2e2e] rounded-full border w-fit border-zinc-200"
>
<p className="text-xs text-white sm:text-sm">
- Launch Week Day 1:{" "}
+ Launch Week Day 2:{" "}
<span className="text-xs font-bold text-blue-100 sm:text-sm">
- Custom Domains
+ Windows Support
</span>
</p>
<FontAwesomeIcon
@@ -62,11 +87,16 @@ export const HomePage = () => {
<div className="flex flex-col justify-center items-center mb-5 space-y-2 fade-in-up animate-delay-2 sm:flex-row sm:space-y-0 sm:space-x-2">
<Button
variant="white"
- href="/download"
+ href={
+ platform === "windows"
+ ? "/download"
+ : getDownloadUrl(platform, isIntel)
+ }
size="lg"
- className="w-full font-medium text-md sm:w-auto"
+ className="w-full font-medium text-md sm:w-auto flex items-center justify-center"
>
- Download App
+ {!loading && getPlatformIcon(platform)}
+ {getDownloadButtonText(platform, loading, isIntel)}
</Button>
<Button
variant="radialblue"
@@ -77,9 +107,22 @@ export const HomePage = () => {
Buy Now
</Button>
</div>
- <p className="text-sm text-center text-zinc-400">
+ <p className="text-sm text-center text-zinc-400 animate-delay-2 fade-in-up">
Free version available. No credit card required.
</p>
+
+ {/* Platform icons */}
+ <PlatformIcons />
+
+ {/* See other options button */}
+ <div className="flex justify-center mt-2">
+ <Link
+ href="/download"
+ className="text-sm text-center text-zinc-400 underline animate-delay-2 fade-in-up hover:text-zinc-500"
+ >
+ See other options
+ </Link>
+ </div>
</div>
<AnimatePresence>
{videoToggled && <VideoModal setVideoToggled={setVideoToggled} />}
diff --git a/apps/web/public/windows-smartscreen.mp4 b/apps/web/public/windows-smartscreen.mp4
new file mode 100644
index 000000000..bc51251c9
Binary files /dev/null and b/apps/web/public/windows-smartscreen.mp4 differ
diff --git a/apps/web/utils/platform.tsx b/apps/web/utils/platform.tsx
index 2a282a2fe..1b75a25da 100644
--- a/apps/web/utils/platform.tsx
+++ b/apps/web/utils/platform.tsx
@@ -182,7 +182,7 @@ export const PlatformIcons: React.FC = () => {
</div>
<div>
<a
- href="/download/windows"
+ href="/download"
className="focus:outline-none"
aria-label="Download for Windows"
>