Skip to content

Commit ad87112

Browse files
Merge branch 'main' into branded-ids
2 parents 2f61acc + 80d1983 commit ad87112

45 files changed

Lines changed: 1336 additions & 620 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/desktop/src-tauri/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "cap-desktop"
3-
version = "0.3.72-beta.1"
3+
version = "0.3.72"
44
description = "Beautiful screen recordings, owned by you."
55
authors = ["you"]
66
edition = "2024"
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
"use server";
2+
3+
import { db } from "@cap/database";
4+
import { getCurrentUser } from "@cap/database/auth/session";
5+
import { organizations } from "@cap/database/schema";
6+
import { eq } from "drizzle-orm";
7+
import { revalidatePath } from "next/cache";
8+
9+
export async function updateOrganizationSettings(settings: {
10+
disableSummary?: boolean;
11+
disableCaptions?: boolean;
12+
disableChapters?: boolean;
13+
disableReactions?: boolean;
14+
disableTranscript?: boolean;
15+
disableComments?: boolean;
16+
}) {
17+
const user = await getCurrentUser();
18+
19+
if (!user) {
20+
throw new Error("Unauthorized");
21+
}
22+
23+
if (!settings) {
24+
throw new Error("Settings are required");
25+
}
26+
27+
const [organization] = await db()
28+
.select()
29+
.from(organizations)
30+
.where(eq(organizations.id, user.activeOrganizationId));
31+
32+
if (!organization) {
33+
throw new Error("Organization not found");
34+
}
35+
36+
await db()
37+
.update(organizations)
38+
.set({ settings })
39+
.where(eq(organizations.id, user.activeOrganizationId));
40+
41+
revalidatePath("/dashboard/caps");
42+
43+
return { success: true };
44+
}

apps/web/actions/videos/generate-ai-metadata.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ export async function generateAiMetadata(
4141
const updatedAtTime = new Date(videoData.updatedAt).getTime();
4242
const currentTime = new Date().getTime();
4343
const tenMinutesInMs = 10 * 60 * 1000;
44-
const minutesElapsed = Math.round((currentTime - updatedAtTime) / 60000);
4544

4645
if (currentTime - updatedAtTime > tenMinutesInMs) {
4746
await db()

apps/web/actions/videos/get-status.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ import { generateAiMetadata } from "./generate-ai-metadata";
1414

1515
const MAX_AI_PROCESSING_TIME = 10 * 60 * 1000;
1616

17+
type TranscriptionStatus = "PROCESSING" | "COMPLETE" | "ERROR" | "SKIPPED";
18+
1719
export interface VideoStatusResult {
18-
transcriptionStatus: "PROCESSING" | "COMPLETE" | "ERROR" | null;
20+
transcriptionStatus: TranscriptionStatus | null;
1921
aiTitle: string | null;
2022
aiProcessing: boolean;
2123
summary: string | null;
@@ -124,10 +126,7 @@ export async function getVideoStatus(
124126

125127
return {
126128
transcriptionStatus:
127-
(updatedVideo.transcriptionStatus as
128-
| "PROCESSING"
129-
| "COMPLETE"
130-
| "ERROR") || null,
129+
(updatedVideo.transcriptionStatus as TranscriptionStatus) || null,
131130
aiProcessing: false,
132131
aiTitle: updatedMetadata.aiTitle || null,
133132
summary: updatedMetadata.summary || null,
@@ -214,8 +213,7 @@ export async function getVideoStatus(
214213

215214
return {
216215
transcriptionStatus:
217-
(video.transcriptionStatus as "PROCESSING" | "COMPLETE" | "ERROR") ||
218-
null,
216+
(video.transcriptionStatus as TranscriptionStatus) || null,
219217
aiProcessing: true,
220218
aiTitle: metadata.aiTitle || null,
221219
summary: metadata.summary || null,
@@ -232,8 +230,7 @@ export async function getVideoStatus(
232230

233231
return {
234232
transcriptionStatus:
235-
(video.transcriptionStatus as "PROCESSING" | "COMPLETE" | "ERROR") ||
236-
null,
233+
(video.transcriptionStatus as TranscriptionStatus) || null,
237234
aiProcessing: metadata.aiProcessing || false,
238235
aiTitle: metadata.aiTitle || null,
239236
summary: metadata.summary || null,
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
"use server";
2+
3+
import { db } from "@cap/database";
4+
import { getCurrentUser } from "@cap/database/auth/session";
5+
import { videos } from "@cap/database/schema";
6+
import type { Video } from "@cap/web-domain";
7+
import { eq } from "drizzle-orm";
8+
9+
export async function updateVideoSettings(
10+
videoId: Video.VideoId,
11+
videoSettings: {
12+
disableSummary?: boolean;
13+
disableCaptions?: boolean;
14+
disableChapters?: boolean;
15+
disableReactions?: boolean;
16+
disableTranscript?: boolean;
17+
disableComments?: boolean;
18+
},
19+
) {
20+
const user = await getCurrentUser();
21+
22+
if (!user || !videoId || !videoSettings) {
23+
throw new Error("Missing required data for updating video settings");
24+
}
25+
26+
const [video] = await db()
27+
.select()
28+
.from(videos)
29+
.where(eq(videos.id, videoId));
30+
31+
if (!video) {
32+
throw new Error("Video not found for updating video settings");
33+
}
34+
35+
if (video.ownerId !== user.id) {
36+
throw new Error("You don't have permission to update this video settings");
37+
}
38+
39+
await db()
40+
.update(videos)
41+
.set({ settings: videoSettings })
42+
.where(eq(videos.id, videoId));
43+
44+
return { success: true };
45+
}

apps/web/app/(org)/dashboard/Contexts.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,17 @@ import Cookies from "js-cookie";
66
import { usePathname } from "next/navigation";
77
import { createContext, useContext, useEffect, useState } from "react";
88
import { UpgradeModal } from "@/components/UpgradeModal";
9-
import type { Organization, Spaces, UserPreferences } from "./dashboard-data";
9+
import type {
10+
Organization,
11+
OrganizationSettings,
12+
Spaces,
13+
UserPreferences,
14+
} from "./dashboard-data";
1015

1116
type SharedContext = {
1217
organizationData: Organization[] | null;
1318
activeOrganization: Organization | null;
19+
organizationSettings: OrganizationSettings | null;
1420
spacesData: Spaces[] | null;
1521
userSpaces: Spaces[] | null;
1622
sharedSpaces: Spaces[] | null;
@@ -50,6 +56,7 @@ export function DashboardContexts({
5056
spacesData,
5157
user,
5258
isSubscribed,
59+
organizationSettings,
5360
userPreferences,
5461
anyNewNotifications,
5562
initialTheme,
@@ -62,6 +69,7 @@ export function DashboardContexts({
6269
spacesData: SharedContext["spacesData"];
6370
user: SharedContext["user"];
6471
isSubscribed: SharedContext["isSubscribed"];
72+
organizationSettings: SharedContext["organizationSettings"];
6573
userPreferences: SharedContext["userPreferences"];
6674
anyNewNotifications: boolean;
6775
initialTheme: ITheme;
@@ -154,6 +162,7 @@ export function DashboardContexts({
154162
spacesData,
155163
anyNewNotifications,
156164
userPreferences,
165+
organizationSettings,
157166
userSpaces,
158167
sharedSpaces,
159168
activeSpace,

apps/web/app/(org)/dashboard/_components/MobileTab.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const MobileTab = () => {
4444
}
4545
});
4646
return (
47-
<div className="flex sticky bottom-0 z-50 flex-1 justify-between items-center px-5 w-screen h-16 border-t lg:hidden border-gray-5 bg-gray-1">
47+
<div className="flex sticky bottom-0 z-50 flex-1 gap-5 justify-between items-center px-5 w-screen h-16 border-t lg:hidden border-gray-5 bg-gray-1">
4848
<AnimatePresence>
4949
{open && <OrgsMenu setOpen={setOpen} menuRef={menuRef} />}
5050
</AnimatePresence>

apps/web/app/(org)/dashboard/_components/Navbar/Items.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ const AdminNavItems = ({ toggleMobileNav }: Props) => {
9494
position="right"
9595
content={activeOrg?.organization.name ?? "No organization found"}
9696
>
97-
<PopoverTrigger asChild>
97+
<PopoverTrigger suppressHydrationWarning asChild>
9898
<motion.div
9999
transition={{
100100
type: "easeInOut",

apps/web/app/(org)/dashboard/caps/Caps.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { CapPagination } from "./components/CapPagination";
2424
import { EmptyCapState } from "./components/EmptyCapState";
2525
import type { FolderDataType } from "./components/Folder";
2626
import Folder from "./components/Folder";
27-
import { useUploadingContext, useUploadingStatus } from "./UploadingContext";
27+
import { useUploadingStatus } from "./UploadingContext";
2828

2929
export type VideoData = {
3030
id: Video.VideoId;

0 commit comments

Comments
 (0)