mirror of
https://github.com/yusufipk/OpenFrame.git
synced 2026-09-12 01:46:08 +00:00
chore: clean up lint/type issues and tighten comment media URL validation
This commit is contained in:
+1
-1
@@ -126,7 +126,7 @@ export function successResponse<T>(
|
||||
return NextResponse.json(body, { status });
|
||||
}
|
||||
|
||||
export function withCacheControl<T>(response: Response, value: string): Response {
|
||||
export function withCacheControl(response: Response, value: string): Response {
|
||||
response.headers.set('Cache-Control', value);
|
||||
return response;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ function createPool(connectionString: string): Pool {
|
||||
const pool = new Pool(poolConfig);
|
||||
|
||||
// Add error handling for pool errors
|
||||
pool.on('error', (err, client) => {
|
||||
pool.on('error', (err) => {
|
||||
console.error('Unexpected database pool error:', err.message);
|
||||
// Don't crash the app on unexpected pool errors
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { S3Client, PutObjectCommand, GetObjectCommand } from '@aws-sdk/client-s3';
|
||||
import { S3Client, PutObjectCommand } from '@aws-sdk/client-s3';
|
||||
|
||||
const R2_ACCOUNT_ID = process.env.R2_ACCOUNT_ID!;
|
||||
const R2_ACCESS_KEY_ID = process.env.R2_ACCESS_KEY_ID!;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { VideoProvider, VideoMetadata, EmbedOptions, ThumbnailSize } from './types';
|
||||
import type { VideoProvider, VideoMetadata, EmbedOptions } from './types';
|
||||
import { getCachedMetadata, setCachedMetadata } from './metadata-cache';
|
||||
|
||||
// Bunny Stream URL patterns
|
||||
@@ -43,8 +43,7 @@ export const bunnyProvider: VideoProvider = {
|
||||
return `https://iframe.mediadelivery.net/embed/${libraryId}/${videoId}?${params.toString()}`;
|
||||
},
|
||||
|
||||
getThumbnailUrl(videoId: string, size: ThumbnailSize = 'medium'): string {
|
||||
const libraryId = process.env.NEXT_PUBLIC_BUNNY_STREAM_LIBRARY_ID || process.env.BUNNY_STREAM_LIBRARY_ID || '0';
|
||||
getThumbnailUrl(videoId: string): string {
|
||||
// Bunny stream thumbnails: https://vz-uuid.b-cdn.net/{videoId}/thumbnail.jpg
|
||||
// Since we don't have the b-cdn pull zone readily available in pure abstract,
|
||||
// we should rely on fetching metadata for actual thumbnails, OR construct via API
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { VideoProvider, VideoMetadata, EmbedOptions, ThumbnailSize } from './types';
|
||||
import type { VideoProvider, VideoMetadata, EmbedOptions } from './types';
|
||||
|
||||
// Direct video URL patterns (for future self-hosted videos)
|
||||
const DIRECT_VIDEO_PATTERNS = [
|
||||
@@ -49,7 +49,8 @@ export const directProvider: VideoProvider = {
|
||||
return `${videoId}${queryString ? `#t=${options.startTime}` : ''}`;
|
||||
},
|
||||
|
||||
getThumbnailUrl(videoId: string, size: ThumbnailSize = 'medium'): string {
|
||||
getThumbnailUrl(videoId: string): string {
|
||||
void videoId;
|
||||
// For direct uploads, thumbnail would be generated server-side
|
||||
// Return a placeholder for now
|
||||
return '/placeholder-video-thumbnail.png';
|
||||
|
||||
@@ -84,7 +84,7 @@ export const youtubeProvider: VideoProvider = {
|
||||
|
||||
setCachedMetadata(cacheKey, metadata);
|
||||
return metadata;
|
||||
} catch (error) {
|
||||
} catch {
|
||||
// Fallback with minimal data
|
||||
const fallback: VideoMetadata = {
|
||||
title: 'YouTube Video',
|
||||
|
||||
Reference in New Issue
Block a user