Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
fix: eq select
Richie McIlroy0ed319fccba1
diff --git a/apps/web/app/api/desktop/session/request/route.ts b/apps/web/app/api/desktop/session/request/route.tsindex 89df44e40..6898f399e 100644--- a/apps/web/app/api/desktop/session/request/route.ts+++ b/apps/web/app/api/desktop/session/request/route.ts@@ -1,8 +1,7 @@import { type NextRequest } from "next/server";import { getServerSession } from "next-auth";import { authOptions } from "@cap/database/auth/auth-options";-import { decode, encode } from "next-auth/jwt";-import { cookies } from "next/headers";+import { decode } from "next-auth/jwt";export async function GET(req: NextRequest) {const searchParams = req.nextUrl.searchParams;diff --git a/apps/web/app/dashboard/caps/Caps.tsx b/apps/web/app/dashboard/caps/Caps.tsxindex 9350ead8f..9b5d3c8a7 100644--- a/apps/web/app/dashboard/caps/Caps.tsx+++ b/apps/web/app/dashboard/caps/Caps.tsx@@ -44,6 +44,32 @@ export const Caps = ({ data }: { data: (typeof videos.$inferSelect)[] }) => {<h1 className="text-2xl font-semibold mb-1">My Caps</h1><p>These are all of your videos created with Cap.</p></div>+ <div className="grid grid-cols-2 md:grid-cols-4 gap-6">+ {data.map((cap, index) => {+ return (+ <div+ key={index}+ className="rounded-xl border border-filler overflow-hidden group"+ >+ <a href={`/share/${cap.id}`}>+ <div>+ <VideoThumbnail+ userId={cap.ownerId}+ videoId={cap.id}+ alt={`${cap.name} Thumbnail`}+ />+ </div>+ <div className="p-4">+ <p className="font-medium">{cap.name}</p>+ <p className="text-sm text-gray-400">+ {moment(cap.createdAt).fromNow()}+ </p>+ </div>+ </a>+ </div>+ );+ })}+ </div></>)}</div>diff --git a/apps/web/app/dashboard/caps/page.tsx b/apps/web/app/dashboard/caps/page.tsxindex f94f26edd..1db8440c5 100644--- a/apps/web/app/dashboard/caps/page.tsx+++ b/apps/web/app/dashboard/caps/page.tsx@@ -1,15 +1,20 @@import { Caps } from "./Caps";import { db } from "@cap/database";import { videos } from "@cap/database/schema";-import { desc } from "drizzle-orm";+import { desc, eq } from "drizzle-orm";+import { getCurrentUser } from "@cap/database/auth/session";export const revalidate = 0;export default async function CapsPage() {+ const user = await getCurrentUser();+ const userId = user?.userId as string;+const videoData = await db.select().from(videos)- .orderBy(desc(videos.createdAt));+ .orderBy(desc(videos.createdAt))+ .where(eq(videos.ownerId, userId));return <Caps data={videoData} />;}diff --git a/apps/web/app/share/[videoId]/page.tsx b/apps/web/app/share/[videoId]/page.tsxindex d99b6c030..df4ad99f6 100644--- a/apps/web/app/share/[videoId]/page.tsx+++ b/apps/web/app/share/[videoId]/page.tsx@@ -13,6 +13,7 @@ export default async function ShareVideoPage(props: Props) {const params = props.params;const videoId = params.videoId as string;const user = (await getCurrentUser()) as typeof userSelectProps | null;+ const userId = user?.userId as string | undefined;const query = await db.select().from(videos).where(eq(videos.id, videoId));@@ -22,5 +23,11 @@ export default async function ShareVideoPage(props: Props) {const video = query[0];+ if (video.public === false) {+ if (video.public === false && userId !== video.ownerId) {+ return <p>Video is private</p>;+ }+ }+return <Share data={video} user={user} />;}diff --git a/packages/database/auth/auth-options.ts b/packages/database/auth/auth-options.tsindex 603360dcd..426ec2449 100644--- a/packages/database/auth/auth-options.ts+++ b/packages/database/auth/auth-options.ts@@ -7,8 +7,6 @@ import type { NextAuthOptions } from "next-auth";import { sendEmail } from "../emails/config";import { LoginLink } from "../emails/login-link";-const VERCEL_DEPLOYMENT = !!process.env.VERCEL_URL;-export const config = {maxDuration: 120,};