Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

feat: check auth before shareable link creation

Richie McIlroy2ac1c75913fc
diff --git a/apps/desktop/src/routes/editor/Header.tsx b/apps/desktop/src/routes/editor/Header.tsx
index e9411c57b..25ec6551e 100644
--- a/apps/desktop/src/routes/editor/Header.tsx
+++ b/apps/desktop/src/routes/editor/Header.tsx
@@ -23,6 +23,7 @@ import { getCurrentWindow, ProgressBarStatus } from "@tauri-apps/api/window";
import { type RenderProgress, commands, events } from "~/utils/tauri";
import { FPS, useEditorContext } from "./context";
+import { authStore } from "~/store";
import {
Dialog,
DialogContent,
@@ -585,6 +586,14 @@ function ShareButton(props: ShareButtonProps) {
const uploadVideo = createMutation(() => ({
mutationFn: async (useCustomMuxer: boolean) => {
console.log("Starting upload process...");
+
+ // Check authentication first
+ const existingAuth = await authStore.get();
+ if (!existingAuth) {
+ await commands.showWindow("SignIn");
+ throw new Error("You need to sign in to share recordings");
+ }
+
const meta = recordingMeta();
if (!meta) {
console.error("No recording metadata available");
@@ -709,6 +718,7 @@ function ShareButton(props: ShareButtonProps) {
});
if (result === "NotAuthenticated") {
+ await commands.showWindow("SignIn");
throw new Error("You need to sign in to share recordings");
}
if (result === "PlanCheckFailed") {
diff --git a/apps/desktop/src/routes/recordings-overlay.tsx b/apps/desktop/src/routes/recordings-overlay.tsx
index e4a9226f7..06bc1dc9f 100644
--- a/apps/desktop/src/routes/recordings-overlay.tsx
+++ b/apps/desktop/src/routes/recordings-overlay.tsx
@@ -36,6 +36,7 @@ import { DEFAULT_PROJECT_CONFIG } from "./editor/projectConfig";
import { createPresets } from "~/utils/createPresets";
import { progressState, setProgressState } from "~/store/progress";
import { FPS, OUTPUT_SIZE } from "./editor/context";
+import { authStore } from "~/store";
type MediaEntry = {
path: string;
@@ -983,6 +984,13 @@ function createRecordingMutations(
return;
}
+ // Check authentication first
+ const existingAuth = await authStore.get();
+ if (!existingAuth) {
+ await commands.showWindow("SignIn");
+ throw new Error("You need to sign in to share recordings");
+ }
+
const metadata = await commands.getVideoMetadata(media.path, null);
const plan = await commands.checkUpgradedAndUpdate();
const canShare = {