(userId: User.UserId)
| 98 | "Only organization admins and owners can import Loom videos from a CSV."; |
| 99 | |
| 100 | async function createLoomImportRateLimitCheck(userId: User.UserId) { |
| 101 | if (NODE_ENV !== "production") return async () => false; |
| 102 | |
| 103 | const headersList = await headers(); |
| 104 | const request = new Request("https://cap.so/api/loom-import-rate-limit", { |
| 105 | method: "POST", |
| 106 | headers: headersList, |
| 107 | }); |
| 108 | |
| 109 | return async () => { |
| 110 | const { rateLimited } = await checkRateLimit(LOOM_IMPORT_RATE_LIMIT_ID, { |
| 111 | request, |
| 112 | rateLimitKey: `loom-import:${userId}`, |
| 113 | }); |
| 114 | return rateLimited; |
| 115 | }; |
| 116 | } |
| 117 | |
| 118 | function extractLoomVideoId(url: string): string | null { |
| 119 | try { |
no outgoing calls
no test coverage detected