Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

Add license deactivation page and FAQ link

Richie McIlroy1239fdb42967
diff --git a/apps/web/app/(site)/deactivate-license/page.tsx b/apps/web/app/(site)/deactivate-license/page.tsx
new file mode 100644
index 000000000..024f3046a
--- /dev/null
+++ b/apps/web/app/(site)/deactivate-license/page.tsx
@@ -0,0 +1,12 @@
+import type { Metadata } from "next";
+import { LicenseDeactivationPage } from "@/components/pages/LicenseDeactivationPage";
+
+export const metadata: Metadata = {
+ title: "Deactivate License — Cap",
+ description:
+ "Deactivate your Cap commercial license from its current device to use it elsewhere.",
+};
+
+export default function App() {
+ return <LicenseDeactivationPage />;
+}
diff --git a/apps/web/app/api/desktop/[...route]/root.ts b/apps/web/app/api/desktop/[...route]/root.ts
index d240292ae..30f167904 100644
--- a/apps/web/app/api/desktop/[...route]/root.ts
+++ b/apps/web/app/api/desktop/[...route]/root.ts
@@ -17,6 +17,153 @@ import { withAuth, withOptionalAuth } from "../../utils";
export const app = new Hono();
+const diagnosticsSchema = z.object({
+ system: z
+ .object({
+ windowsVersion: z
+ .object({
+ displayName: z.string(),
+ meetsRequirements: z.boolean().optional(),
+ isWindows11: z.boolean().optional(),
+ })
+ .optional(),
+ macosVersion: z.object({ displayName: z.string() }).optional(),
+ gpuInfo: z
+ .object({
+ vendor: z.string(),
+ description: z.string(),
+ dedicatedVideoMemoryMb: z.number().optional(),
+ isSoftwareAdapter: z.boolean().optional(),
+ isBasicRenderDriver: z.boolean().optional(),
+ supportsHardwareEncoding: z.boolean().optional(),
+ })
+ .optional(),
+ allGpus: z
+ .object({
+ gpus: z.array(
+ z.object({
+ vendor: z.string(),
+ description: z.string(),
+ dedicatedVideoMemoryMb: z.number().optional(),
+ }),
+ ),
+ isMultiGpuSystem: z.boolean().optional(),
+ hasDiscreteGpu: z.boolean().optional(),
+ })
+ .optional(),
+ renderingStatus: z
+ .object({
+ isUsingSoftwareRendering: z.boolean().optional(),
+ isUsingBasicRenderDriver: z.boolean().optional(),
+ hardwareEncodingAvailable: z.boolean().optional(),
+ warningMessage: z.string().optional(),
+ })
+ .optional(),
+ availableEncoders: z.array(z.string()).optional(),
+ graphicsCaptureSupported: z.boolean().optional(),
+ screenCaptureSupported: z.boolean().optional(),
+ d3D11VideoProcessorAvailable: z.boolean().optional(),
+ })
+ .optional(),
+ cameras: z.array(z.string()).optional(),
+ microphones: z.array(z.string()).optional(),
+ permissions: z
+ .object({
+ screenRecording: z.string().optional(),
+ camera: z.string().optional(),
+ microphone: z.string().optional(),
+ })
+ .optional(),
+});
+
+function formatDiagnosticsForDiscord(
+ diagnostics: z.infer<typeof diagnosticsSchema>,
+): string {
+ const lines: string[] = [];
+ const sys = diagnostics.system;
+
+ if (sys?.windowsVersion?.displayName) {
+ lines.push(`**OS:** ${sys.windowsVersion.displayName}`);
+ } else if (sys?.macosVersion?.displayName) {
+ lines.push(`**OS:** ${sys.macosVersion.displayName}`);
+ }
+
+ if (sys?.gpuInfo) {
+ const gpu = sys.gpuInfo;
+ let gpuLine = `**GPU:** ${gpu.description}`;
+ if (gpu.vendor) gpuLine += ` (${gpu.vendor})`;
+ if (gpu.dedicatedVideoMemoryMb)
+ gpuLine += ` - ${gpu.dedicatedVideoMemoryMb}MB VRAM`;
+ lines.push(gpuLine);
+
+ const flags: string[] = [];
+ if (gpu.isSoftwareAdapter) flags.push("⚠️ Software Adapter");
+ if (gpu.isBasicRenderDriver) flags.push("⚠️ Basic Render Driver");
+ if (gpu.supportsHardwareEncoding === false) flags.push("❌ No HW Encoding");
+ if (gpu.supportsHardwareEncoding === true) flags.push("✅ HW Encoding");
+ if (flags.length > 0) lines.push(`**GPU Status:** ${flags.join(", ")}`);
+ }
+
+ if (sys?.allGpus?.gpus && sys.allGpus.gpus.length > 1) {
+ const gpuList = sys.allGpus.gpus
+ .map((g) => `${g.description} (${g.vendor})`)
+ .join(", ");
+ lines.push(`**All GPUs:** ${gpuList}`);
+ }
+
+ if (sys?.renderingStatus?.warningMessage) {
+ lines.push(`**⚠️ Warning:** ${sys.renderingStatus.warningMessage}`);
+ }
+
+ const captureSupported =
+ sys?.graphicsCaptureSupported ?? sys?.screenCaptureSupported;
+ if (captureSupported !== undefined) {
+ lines.push(
+ `**Screen Capture:** ${captureSupported ? "✅ Supported" : "❌ Not Supported"}`,
+ );
+ }
+
+ if (sys?.d3D11VideoProcessorAvailable !== undefined) {
+ lines.push(
+ `**D3D11 Video Processor:** ${sys.d3D11VideoProcessorAvailable ? "✅" : "❌"}`,
+ );
+ }
+
+ if (sys?.availableEncoders && sys.availableEncoders.length > 0) {
+ lines.push(`**Encoders:** ${sys.availableEncoders.join(", ")}`);
+ }
+
+ if (diagnostics.permissions) {
+ const perms = diagnostics.permissions;
+ const permList = [
+ perms.screenRecording && `Screen: ${perms.screenRecording}`,
+ perms.camera && `Camera: ${perms.camera}`,
+ perms.microphone && `Mic: ${perms.microphone}`,
+ ]
+ .filter(Boolean)
+ .join(", ");
+ if (permList) lines.push(`**Permissions:** ${permList}`);
+ }
+
+ if (diagnostics.cameras && diagnostics.cameras.length > 0) {
+ lines.push(
+ `**Cameras (${diagnostics.cameras.length}):** ${diagnostics.cameras.join(", ")}`,
+ );
+ } else {
+ lines.push("**Cameras:** None detected");
+ }
+
+ if (diagnostics.microphones && diagnostics.microphones.length > 0) {
+ lines.push(
+ `**Mics (${diagnostics.microphones.length}):** ${diagnostics.microphones.join(", ")}`,
+ );
+ } else {
+ lines.push("**Mics:** None detected");
+ }
+
+ return lines.join("\n");
+}
+
app.post(
"/logs",
zValidator(
@@ -25,11 +172,17 @@ app.post(
log: z.string(),
os: z.string().optional(),
version: z.string().optional(),
+ diagnostics: z.string().optional(),
}),
),
withOptionalAuth,
async (c) => {
- const { log, os, version } = c.req.valid("form");
+ const {
+ log,
+ os,
+ version,
+ diagnostics: diagnosticsJson,
+ } = c.req.valid("form");
const user = c.get("user");
try {
@@ -42,13 +195,29 @@ app.post(
const fileName = `cap-desktop-${os || "unknown"}-${version || "unknown"}-${Date.now()}.log`;
formData.append("file", logBlob, fileName);
+ let diagnosticsContent = "";
+ if (diagnosticsJson) {
+ try {
+ const parsed = JSON.parse(diagnosticsJson);
+ const validated = diagnosticsSchema.safeParse(parsed);
+ if (validated.success) {
+ diagnosticsContent = formatDiagnosticsForDiscord(validated.data);
+ }
+ } catch {
+ diagnosticsContent = "";
+ }
+ }
+
const content = [
- "New log file uploaded",
- user && `User: ${user.email} (${user.id})`,
- os && `OS: ${os}`,
- version && `Version: ${version}`,
+ "📋 **New Log File Uploaded**",
+ "",
+ user ? `**User:** ${user.email} (${user.id})` : null,
+ os ? `**Platform:** ${os}` : null,
+ version ? `**App Version:** ${version}` : null,
+ diagnosticsContent ? "" : null,
+ diagnosticsContent || null,
]
- .filter(Boolean)
+ .filter((line): line is string => line !== null)
.join("\n");
formData.append("content", content);
diff --git a/apps/web/components/pages/FaqPage.tsx b/apps/web/components/pages/FaqPage.tsx
index f9fe475d5..7c56353ab 100644
--- a/apps/web/components/pages/FaqPage.tsx
+++ b/apps/web/components/pages/FaqPage.tsx
@@ -1,6 +1,17 @@
"use client";
-const faqContent = [
+import Link from "next/link";
+
+interface FaqItem {
+ title: string;
+ answer: string;
+ link?: {
+ text: string;
+ href: string;
+ };
+}
+
+const faqContent: FaqItem[] = [
{
title: "Who is Cap for?",
answer:
@@ -30,6 +41,10 @@ const faqContent = [
title: "Is there a commercial license available?",
answer:
"Yes, we offer commercial licenses for businesses that want to use the Cap desktop app. The commercial license includes the Cap Recorder + Editor with local-only features. Our Pro plan also includes a commercial license for the desktop app.",
+ link: {
+ text: "Deactivate your license",
+ href: "/deactivate-license",
+ },
},
{
title: "What happens after the beta period ends?",
@@ -45,11 +60,19 @@ export const FaqPage = () => {
<h1>FAQ</h1>
</div>
<div className="mb-10">
- {faqContent.map((section, index) => {
+ {faqContent.map((section) => {
return (
- <div key={index} className="mx-auto my-8 max-w-2xl">
+ <div key={section.title} className="mx-auto my-8 max-w-2xl">
<h2 className="mb-2 text-xl">{section.title}</h2>
<p className="text-lg">{section.answer}</p>
+ {section.link && (
+ <Link
+ href={section.link.href}
+ className="inline-block mt-2 text-blue-500 hover:text-blue-600 hover:underline"
+ >
+ {section.link.text} &rarr;
+ </Link>
+ )}
</div>
);
})}
diff --git a/apps/web/components/pages/LicenseDeactivationPage.tsx b/apps/web/components/pages/LicenseDeactivationPage.tsx
new file mode 100644
index 000000000..85babaaac
--- /dev/null
+++ b/apps/web/components/pages/LicenseDeactivationPage.tsx
@@ -0,0 +1,116 @@
+"use client";
+
+import { Button } from "@cap/ui";
+import { useId, useState } from "react";
+import { toast } from "sonner";
+
+export const LicenseDeactivationPage = () => {
+ const licenseKeyId = useId();
+ const emailId = useId();
+ const [licenseKey, setLicenseKey] = useState("");
+ const [email, setEmail] = useState("");
+ const [isSubmitting, setIsSubmitting] = useState(false);
+
+ const handleSubmit = async (e: React.FormEvent) => {
+ e.preventDefault();
+
+ if (!licenseKey.trim() || !email.trim()) {
+ toast.error("Please fill in all fields");
+ return;
+ }
+
+ setIsSubmitting(true);
+
+ try {
+ const response = await fetch(
+ "https://l.cap.so/api/commercial/deactivate",
+ {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ licensekey: licenseKey.trim(),
+ },
+ body: JSON.stringify({ email: email.trim() }),
+ },
+ );
+
+ const data = await response.json();
+
+ if (!response.ok) {
+ toast.error(data.message || "Failed to deactivate license");
+ return;
+ }
+
+ toast.success("License deactivated successfully");
+ setLicenseKey("");
+ setEmail("");
+ } catch (_error) {
+ toast.error("An error occurred. Please try again.");
+ } finally {
+ setIsSubmitting(false);
+ }
+ };
+
+ return (
+ <div className="py-32 md:py-40 wrapper wrapper-sm">
+ <div className="mb-14 text-center page-intro">
+ <h1>Deactivate License</h1>
+ <p className="mt-4 text-lg text-gray-10">
+ Enter your license key and purchase email to deactivate your Cap
+ commercial license from its current device.
+ </p>
+ </div>
+ <div className="mx-auto max-w-md">
+ <form onSubmit={handleSubmit} className="space-y-6">
+ <div>
+ <label
+ htmlFor={licenseKeyId}
+ className="block mb-2 text-sm font-medium text-gray-12"
+ >
+ License Key
+ </label>
+ <input
+ type="text"
+ id={licenseKeyId}
+ value={licenseKey}
+ onChange={(e) => setLicenseKey(e.target.value)}
+ placeholder="XXXX-XXXX-XXXX-XXXX"
+ className="flex px-4 w-full font-thin transition-all duration-200 text-[16px] md:text-[13px] text-gray-12 bg-gray-1 border-gray-4 outline-0 focus:bg-gray-2 rounded-xl hover:bg-gray-2 autofill:bg-gray-1 hover:border-gray-5 h-[44px] placeholder:text-gray-8 border-[1px] focus:border-gray-5 ring-0 ring-gray-2 focus:ring-1 focus:ring-gray-12 focus:ring-offset-2 ring-offset-gray-3 hover:placeholder:text-gray-12 placeholder:transition-all placeholder:duration-200"
+ disabled={isSubmitting}
+ />
+ </div>
+ <div>
+ <label
+ htmlFor={emailId}
+ className="block mb-2 text-sm font-medium text-gray-12"
+ >
+ Purchase Email
+ </label>
+ <input
+ type="email"
+ id={emailId}
+ value={email}
+ onChange={(e) => setEmail(e.target.value)}
+ placeholder="[email protected]"
+ className="flex px-4 w-full font-thin transition-all duration-200 text-[16px] md:text-[13px] text-gray-12 bg-gray-1 border-gray-4 outline-0 focus:bg-gray-2 rounded-xl hover:bg-gray-2 autofill:bg-gray-1 hover:border-gray-5 h-[44px] placeholder:text-gray-8 border-[1px] focus:border-gray-5 ring-0 ring-gray-2 focus:ring-1 focus:ring-gray-12 focus:ring-offset-2 ring-offset-gray-3 hover:placeholder:text-gray-12 placeholder:transition-all placeholder:duration-200"
+ disabled={isSubmitting}
+ />
+ </div>
+ <Button
+ type="submit"
+ variant="primary"
+ className="w-full"
+ disabled={isSubmitting}
+ spinner={isSubmitting}
+ >
+ {isSubmitting ? "Deactivating..." : "Deactivate License"}
+ </Button>
+ </form>
+ <p className="mt-6 text-sm text-center text-gray-10">
+ After deactivating, you can activate your license on a different
+ device.
+ </p>
+ </div>
+ </div>
+ );
+};