feat(transcode): add PDF proxy support for TXT and CSV files

This commit is contained in:
yiling
2026-07-19 21:19:43 +08:00
parent 817889e501
commit 081dbf6d39
21 changed files with 558 additions and 24 deletions
@@ -5,7 +5,7 @@ import { CompareImagePane } from './compare-image-pane'
export const imageTypeDefinition: FileTypeDefinition = {
id: 'image',
name: 'Image',
match: (file) => !!file.mediaType?.startsWith('image/'),
match: (file) => file.proxyType === 'image',
viewer: ImageViewer,
comparePane: CompareImagePane,
commentsConfig: {
@@ -4,7 +4,7 @@ import PdfViewer from './pdf-viewer'
export const pdfTypeDefinition: FileTypeDefinition = {
id: 'pdf',
name: 'PDF',
match: (file) => file.mediaType === 'application/pdf' || file.name.toLowerCase().endsWith('.pdf'),
match: (file) => file.proxyType === 'pdf',
viewer: PdfViewer,
commentsConfig: {
hasTimestamp: true,
@@ -132,7 +132,7 @@ export const PdfViewer = React.forwardRef<MediaController, FileViewerProps>(
}
}, [])
const fileUrl = file.media?.original?.downloadUrl
const fileUrl = file.media?.pdfTranscode?.url || file.media?.original?.downloadUrl
// Load PDF Document
useEffect(() => {
@@ -5,7 +5,7 @@ import { CompareVideoPane } from './compare-video-pane'
export const videoTypeDefinition: FileTypeDefinition = {
id: 'video',
name: 'Video',
match: (file) => !!file.mediaType?.startsWith('video/') || !!file.mediaType?.startsWith('audio/'),
match: (file) => file.proxyType === 'video' || file.proxyType === 'audio',
viewer: VideoViewer,
comparePane: CompareVideoPane,
commentsConfig: {