feat: Add custom video thumbnails for Drive uploads

- Implemented custom thumbnail injection in GASDriveService.getResumableUploadUrl.
- Fetches thumbnails from Google Photos using w320 size to avoid API limits.
- Added strict < 2MB size check for thumbnails.
- Updated mediaHandlers and MediaManager to pass sourceUrl to the backend.
- This allows Drive to display a visual cue immediately for video files still processing.
This commit is contained in:
Ben Miller
2025-12-30 00:38:57 -07:00
parent ebc1a39ce3
commit f1ab3b7b84
3 changed files with 48 additions and 5 deletions

View File

@ -128,7 +128,7 @@ export function linkDriveFileToShopifyMedia(sku: string, driveId: string, shopif
}
// NEW: Resumable Upload Ticket
export function getUploadUrl(sku: string, filename: string, mimeType: string) {
export function getUploadUrl(sku: string, filename: string, mimeType: string, sourceUrl?: string) {
const config = new Config()
const driveService = new GASDriveService()
@ -136,7 +136,7 @@ export function getUploadUrl(sku: string, filename: string, mimeType: string) {
const folder = driveService.getOrCreateFolder(sku, config.productPhotosFolderId)
// Generate Ticket
return driveService.getResumableUploadUrl(filename, mimeType, folder.getId())
return driveService.getResumableUploadUrl(filename, mimeType, folder.getId(), sourceUrl)
}
// Deprecated (but kept for fallback/legacy small files if needed)