Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

Revert #805 (#806)

🐈 Yun Wang55dcec51547c
diff --git a/README.md b/README.md
index c0ab044ae..8981c0628 100644
--- a/README.md
+++ b/README.md
@@ -35,6 +35,8 @@ Cap Desktop can connect to your self-hosted Cap Web instance regardless of if yo
We use a combination of Rust, React (Next.js), TypeScript, Tauri, Drizzle (ORM), MySQL, TailwindCSS throughout this Turborepo powered monorepo.
+> A note about database: The codebase is currently designed to work with MySQL only. MariaDB or other compatible databases might partially work but are not officially supported.
+
### Apps:
- `desktop`: A [Tauri](https://tauri.app) (Rust) app, using [SolidStart](https://start.solidjs.com) on the frontend.
diff --git a/apps/web/app/api/playlist/route.ts b/apps/web/app/api/playlist/route.ts
index 7e6896d08..daada54f1 100644
--- a/apps/web/app/api/playlist/route.ts
+++ b/apps/web/app/api/playlist/route.ts
@@ -73,11 +73,8 @@ const app = new Hono()
const bucket = await createBucketProvider(customBucket);
- // Handle case where source is a JSON string instead of parsed object
- const source = typeof video.source === "string" ? JSON.parse(video.source) : video.source;
-
if (!customBucket || video.awsBucket === serverEnv().CAP_AWS_BUCKET) {
- if (source.type === "desktopMP4") {
+ if (video.source.type === "desktopMP4") {
return c.redirect(
await bucket.getSignedObjectUrl(
`${video.ownerId}/${videoId}/result.mp4`
@@ -85,7 +82,7 @@ const app = new Hono()
);
}
- if (source.type === "MediaConvert") {
+ if (video.source.type === "MediaConvert") {
return c.redirect(
await bucket.getSignedObjectUrl(
`${video.ownerId}/${videoId}/output/video_recording_000.m3u8`
@@ -128,7 +125,7 @@ const app = new Hono()
const audioPrefix = `${video.ownerId}/${videoId}/audio/`;
try {
- if (source.type === "local") {
+ if (video.source.type === "local") {
const playlistText =
(await bucket.getObject(
`${video.ownerId}/${videoId}/combined-source/stream.m3u8`
@@ -153,7 +150,7 @@ const app = new Hono()
});
}
- if (source.type === "desktopMP4") {
+ if (video.source.type === "desktopMP4") {
const playlistUrl = await bucket.getSignedObjectUrl(
`${video.ownerId}/${videoId}/result.mp4`
);
diff --git a/apps/web/app/embed/[videoId]/_components/EmbedVideo.tsx b/apps/web/app/embed/[videoId]/_components/EmbedVideo.tsx
index e93452eb4..8ee1fbd2a 100644
--- a/apps/web/app/embed/[videoId]/_components/EmbedVideo.tsx
+++ b/apps/web/app/embed/[videoId]/_components/EmbedVideo.tsx
@@ -141,20 +141,17 @@ export const EmbedVideo = forwardRef<
let videoSrc: string;
let enableCrossOrigin = false;
- // Handle case where source is a JSON string instead of parsed object
- const source = typeof data.source === "string" ? JSON.parse(data.source) : data.source;
-
- if (source.type === "desktopMP4") {
+ if (data.source.type === "desktopMP4") {
videoSrc = `/api/playlist?userId=${data.ownerId}&videoId=${data.id}&videoType=mp4`;
// Start with CORS enabled for desktopMP4, but CapVideoPlayer will dynamically disable if needed
enableCrossOrigin = true;
} else if (
NODE_ENV === "development" ||
((data.skipProcessing === true || data.jobStatus !== "COMPLETE") &&
- source.type === "MediaConvert")
+ data.source.type === "MediaConvert")
) {
videoSrc = `/api/playlist?userId=${data.ownerId}&videoId=${data.id}&videoType=master`;
- } else if (source.type === "MediaConvert") {
+ } else if (data.source.type === "MediaConvert") {
videoSrc = `${publicEnv.s3BucketUrl}/${data.ownerId}/${data.id}/output/video_recording_000.m3u8`;
} else {
videoSrc = `${publicEnv.s3BucketUrl}/${data.ownerId}/${data.id}/combined-source/stream.m3u8`;
@@ -190,7 +187,7 @@ export const EmbedVideo = forwardRef<
<>
<div className="relative w-screen h-screen rounded-xl">
- {source.type === "desktopMP4" ? (
+ {data.source.type === "desktopMP4" ? (
<CapVideoPlayer
mediaPlayerClassName="w-full h-full"
videoSrc={videoSrc}
diff --git a/apps/web/app/s/[videoId]/_components/ShareVideo.tsx b/apps/web/app/s/[videoId]/_components/ShareVideo.tsx
index a71313c66..2793112dc 100644
--- a/apps/web/app/s/[videoId]/_components/ShareVideo.tsx
+++ b/apps/web/app/s/[videoId]/_components/ShareVideo.tsx
@@ -115,20 +115,17 @@ export const ShareVideo = forwardRef<
let videoSrc: string;
let enableCrossOrigin = false;
- // Handle case where source is a JSON string instead of parsed object
- const source = typeof data.source === "string" ? JSON.parse(data.source) : data.source;
-
- if (source.type === "desktopMP4") {
+ if (data.source.type === "desktopMP4") {
videoSrc = `/api/playlist?userId=${data.ownerId}&videoId=${data.id}&videoType=mp4`;
// Start with CORS enabled for desktopMP4, but CapVideoPlayer will dynamically disable if needed
enableCrossOrigin = true;
} else if (
NODE_ENV === "development" ||
((data.skipProcessing === true || data.jobStatus !== "COMPLETE") &&
- source.type === "MediaConvert")
+ data.source.type === "MediaConvert")
) {
videoSrc = `/api/playlist?userId=${data.ownerId}&videoId=${data.id}&videoType=master`;
- } else if (source.type === "MediaConvert") {
+ } else if (data.source.type === "MediaConvert") {
videoSrc = `${publicEnv.s3BucketUrl}/${data.ownerId}/${data.id}/output/video_recording_000.m3u8`;
} else {
videoSrc = `${publicEnv.s3BucketUrl}/${data.ownerId}/${data.id}/combined-source/stream.m3u8`;
@@ -138,7 +135,7 @@ export const ShareVideo = forwardRef<
<>
<div className="relative h-full">
- {source.type === "desktopMP4" ? (
+ {data.source.type === "desktopMP4" ? (
<CapVideoPlayer
mediaPlayerClassName="w-full h-full max-w-full max-h-full rounded-xl"
videoSrc={videoSrc}