Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
web: improve owner check (#1277)
Ameer Al Ashhab3e0b7035ed28
diff --git a/apps/web/app/s/[videoId]/Share.tsx b/apps/web/app/s/[videoId]/Share.tsxindex ef7d9a270..2d3cae7d9 100644--- a/apps/web/app/s/[videoId]/Share.tsx+++ b/apps/web/app/s/[videoId]/Share.tsx@@ -39,7 +39,6 @@ type VideoWithOrganizationInfo = typeof videos.$inferSelect & {organizationId?: string;sharedOrganizations?: { id: string; name: string }[];hasPassword?: boolean;- ownerIsPro?: boolean;orgSettings?: OrganizationSettings | null;};@@ -51,6 +50,7 @@ interface ShareProps {customDomain: string | null;domainVerified: boolean;videoSettings?: OrganizationSettings | null;+ ownerIsPro?: boolean;userOrganizations?: { id: string; name: string }[];initialAiData?: {title?: string | null;@@ -141,6 +141,7 @@ export const Share = ({data,user,comments,+ ownerIsPro,views,initialAiData,aiGenerationEnabled,@@ -321,6 +322,7 @@ export const Share = ({createdAt: effectiveDate,transcriptionStatus,}}+ ownerIsPro={ownerIsPro}videoSettings={videoSettings}user={user}commentsData={commentsData}diff --git a/apps/web/app/s/[videoId]/_components/ShareHeader.tsx b/apps/web/app/s/[videoId]/_components/ShareHeader.tsxindex a80df1fa8..9ea8d9cc0 100644--- a/apps/web/app/s/[videoId]/_components/ShareHeader.tsx+++ b/apps/web/app/s/[videoId]/_components/ShareHeader.tsx@@ -183,7 +183,7 @@ export const ShareHeader = ({return (<>- {user !== null && !isVideoOwnerPro && (+ {isOwner && !isVideoOwnerPro && (<div className="flex sticky flex-col sm:flex-row inset-x-0 top-0 z-10 gap-4 justify-center items-center px-3 py-2 mx-auto w-[calc(100%-20px)] max-w-fit rounded-b-xl border bg-gray-4 border-gray-6"><p className="text-center text-gray-12">Shareable links are limited to 5 mins on the free plan.diff --git a/apps/web/app/s/[videoId]/_components/Sidebar.tsx b/apps/web/app/s/[videoId]/_components/Sidebar.tsxindex 2f92fd887..137977050 100644--- a/apps/web/app/s/[videoId]/_components/Sidebar.tsx+++ b/apps/web/app/s/[videoId]/_components/Sidebar.tsx@@ -43,6 +43,7 @@ interface SidebarProps {processing?: boolean;} | null;aiGenerationEnabled?: boolean;+ ownerIsPro?: boolean;}const TabContent = motion.div;@@ -85,6 +86,7 @@ export const Sidebar = forwardRef<{ scrollToBottom: () => void }, SidebarProps>(videoId,aiData,aiGenerationEnabled = false,+ ownerIsPro,},ref,) => {@@ -141,9 +143,6 @@ export const Sidebar = forwardRef<{ scrollToBottom: () => void }, SidebarProps>(setActiveTab(tabId);};- const isOwner = user?.id === data.ownerId;- const isVideoOwnerPro = user && isOwner ? userIsPro(user) : false;-const renderTabContent = () => {switch (activeTab) {case "activity":@@ -184,7 +183,7 @@ export const Sidebar = forwardRef<{ scrollToBottom: () => void }, SidebarProps>(isSummaryDisabled={videoSettings?.disableSummary}initialAiData={aiData || undefined}aiGenerationEnabled={aiGenerationEnabled}- isVideoOwnerPro={isVideoOwnerPro}+ ownerIsPro={ownerIsPro}/>);case "transcript":diff --git a/apps/web/app/s/[videoId]/_components/tabs/Summary.tsx b/apps/web/app/s/[videoId]/_components/tabs/Summary.tsxindex 1a3d17488..4725afe51 100644--- a/apps/web/app/s/[videoId]/_components/tabs/Summary.tsx+++ b/apps/web/app/s/[videoId]/_components/tabs/Summary.tsx@@ -22,7 +22,7 @@ interface SummaryProps {};aiGenerationEnabled?: boolean;isSummaryDisabled?: boolean;- isVideoOwnerPro: boolean | null;+ ownerIsPro?: boolean;}const formatTime = (time: number) => {@@ -66,7 +66,7 @@ export const Summary: React.FC<SummaryProps> = ({initialAiData,isSummaryDisabled = false,aiGenerationEnabled = false,- isVideoOwnerPro,+ ownerIsPro,}) => {const [aiData, setAiData] = useState<{title?: string | null;@@ -94,7 +94,7 @@ export const Summary: React.FC<SummaryProps> = ({}};- if (!isVideoOwnerPro) {+ if (!ownerIsPro) {return (<div className="flex flex-col justify-center items-center p-8 h-full text-center"><div className="space-y-4 max-w-sm">diff --git a/apps/web/app/s/[videoId]/page.tsx b/apps/web/app/s/[videoId]/page.tsxindex b34286685..7fe1947d6 100644--- a/apps/web/app/s/[videoId]/page.tsx+++ b/apps/web/app/s/[videoId]/page.tsx@@ -697,6 +697,7 @@ async function AuthorizedContent({organizationMembers: membersList.map((member) => member.userId),organizationId: video.sharedOrganization?.organizationId ?? undefined,sharedOrganizations: sharedOrganizations,+ ownerIsPro: video.ownerIsPro ?? false,password: null,folderId: null,orgSettings: video.orgSettings || null,@@ -728,6 +729,7 @@ async function AuthorizedContent({data={videoWithOrganizationInfo}videoSettings={videoWithOrganizationInfo.settings}user={user}+ ownerIsPro={videoWithOrganizationInfo.ownerIsPro}comments={commentsPromise}views={viewsPromise}customDomain={customDomain}