From ab9e0727405562e54a5ba7390a33c0e92e04acbd Mon Sep 17 00:00:00 2001 From: Oscar Beaumont Date: Thu, 25 Sep 2025 10:40:38 +0800 Subject: [PATCH 01/27] wip --- apps/web/actions/video/upload.ts | 3 +++ .../(org)/dashboard/caps/components/UploadCapButton.tsx | 8 +++++++- apps/web/app/api/desktop/[...route]/video.ts | 6 ++---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/apps/web/actions/video/upload.ts b/apps/web/actions/video/upload.ts index 2bfa2f541..69583d12d 100644 --- a/apps/web/actions/video/upload.ts +++ b/apps/web/actions/video/upload.ts @@ -164,6 +164,7 @@ export async function createVideoAndGetUploadUrl({ isScreenshot = false, isUpload = false, folderId, + orgId: orgId, }: { videoId?: Video.VideoId; duration?: number; @@ -173,6 +174,7 @@ export async function createVideoAndGetUploadUrl({ isScreenshot?: boolean; isUpload?: boolean; folderId?: Folder.FolderId; + orgId: string; }) { const user = await getCurrentUser(); @@ -228,6 +230,7 @@ export async function createVideoAndGetUploadUrl({ isScreenshot ? "Screenshot" : isUpload ? "Upload" : "Recording" } - ${formattedDate}`, ownerId: user.id, + orgId: orgId, source: { type: "desktopMP4" as const }, isScreenshot, bucket: customBucket?.id, diff --git a/apps/web/app/(org)/dashboard/caps/components/UploadCapButton.tsx b/apps/web/app/(org)/dashboard/caps/components/UploadCapButton.tsx index 80931b4c3..8d5c5c8aa 100644 --- a/apps/web/app/(org)/dashboard/caps/components/UploadCapButton.tsx +++ b/apps/web/app/(org)/dashboard/caps/components/UploadCapButton.tsx @@ -27,7 +27,7 @@ export const UploadCapButton = ({ grey?: boolean; folderId?: Folder.FolderId; }) => { - const { user } = useDashboardContext(); + const { user, activeOrganization } = useDashboardContext(); const inputRef = useRef(null); const { uploadingStore, setUploadStatus } = useUploadingContext(); const isUploading = useStore(uploadingStore, (s) => !!s.uploadStatus); @@ -52,9 +52,13 @@ export const UploadCapButton = ({ const file = e.target.files?.[0]; if (!file || !user) return; + // This should be unreachable. + if (activeOrganization === null) alert("No organization active!"); + const ok = await legacyUploadCap( file, folderId, + activeOrganization.organization.id, setUploadStatus, queryClient, ); @@ -93,6 +97,7 @@ export const UploadCapButton = ({ async function legacyUploadCap( file: File, folderId: Folder.FolderId | undefined, + orgId: string, setUploadStatus: (state: UploadStatus | undefined) => void, queryClient: QueryClient, ) { @@ -127,6 +132,7 @@ async function legacyUploadCap( isScreenshot: false, isUpload: true, folderId, + orgId, }); const uploadId = videoData.id; diff --git a/apps/web/app/api/desktop/[...route]/video.ts b/apps/web/app/api/desktop/[...route]/video.ts index 29a007422..21b84e94d 100644 --- a/apps/web/app/api/desktop/[...route]/video.ts +++ b/apps/web/app/api/desktop/[...route]/video.ts @@ -71,8 +71,6 @@ app.get( .from(s3Buckets) .where(eq(s3Buckets.ownerId, user.id)); - console.log("User bucket:", customBucket ? "found" : "not found"); - const date = new Date(); const formattedDate = `${date.getDate()} ${date.toLocaleString( "default", @@ -85,7 +83,7 @@ app.get( .from(videos) .where(eq(videos.id, Video.VideoId.make(videoId))); - if (video) { + if (video) return c.json({ id: video.id, // All deprecated @@ -93,7 +91,6 @@ app.get( aws_region: "n/a", aws_bucket: "n/a", }); - } } const idToUse = Video.VideoId.make(nanoId()); @@ -108,6 +105,7 @@ app.get( id: idToUse, name: videoName, ownerId: user.id, + orgId: undefined, source: recordingMode === "hls" ? { type: "local" as const } From c501a4252eaf2129af8e57bf02018c7f1f2fe655 Mon Sep 17 00:00:00 2001 From: Oscar Beaumont Date: Thu, 25 Sep 2025 20:49:45 +1000 Subject: [PATCH 02/27] wip --- .../(org)/dashboard/settings/account/Settings.tsx | 13 +++++++++++++ packages/database/schema.ts | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/apps/web/app/(org)/dashboard/settings/account/Settings.tsx b/apps/web/app/(org)/dashboard/settings/account/Settings.tsx index e97793dfe..47b8e5dfb 100644 --- a/apps/web/app/(org)/dashboard/settings/account/Settings.tsx +++ b/apps/web/app/(org)/dashboard/settings/account/Settings.tsx @@ -91,6 +91,19 @@ export const Settings = ({ disabled /> + +
+ Default organization + This is the default organization +
+ {/**/} +