mirror of
https://github.com/yusufipk/OpenFrame.git
synced 2026-09-11 17:46:06 +00:00
fix(api): add rate limiting, file size validation, and timeout handling
- Add Content-Length header check for early file size validation on audio upload - Add rate limiting (60 req/min) to public watch endpoint - Add 10-second timeout with AbortController for YouTube and Vimeo oEmbed requests - Add automatic rate limit cleanup interval for self-hosted servers - Fix null check for comment.replies in video page content - Add checkWorkspaceAccess helper for workspace authorization
This commit is contained in:
@@ -65,9 +65,14 @@ export const vimeoProvider: VideoProvider = {
|
||||
const cached = getCachedMetadata(cacheKey);
|
||||
if (cached) return cached;
|
||||
try {
|
||||
const controller = new AbortController();
|
||||
const timeoutId = setTimeout(() => controller.abort(), 10000); // 10 second timeout
|
||||
|
||||
const response = await fetch(
|
||||
`https://vimeo.com/api/oembed.json?url=https://vimeo.com/${videoId}`
|
||||
`https://vimeo.com/api/oembed.json?url=https://vimeo.com/${videoId}`,
|
||||
{ signal: controller.signal }
|
||||
);
|
||||
clearTimeout(timeoutId);
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error('Failed to fetch video metadata');
|
||||
|
||||
Reference in New Issue
Block a user