feat: auto-use cached HQ video file without upgrade prompt
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -262,6 +262,22 @@ export async function beginDownload() {
|
||||
|
||||
session.processingStep = 'downloading';
|
||||
|
||||
// --- Check export (HQ) cache first ---
|
||||
const exportCached = await checkCachedDownload(session.title, 'export').catch(() => null);
|
||||
if (exportCached) {
|
||||
// HQ file already on disk — use it directly, skip preview entirely
|
||||
session.exportFilePath = exportCached;
|
||||
session.exportProgress = 1.0;
|
||||
session.exportStatus = 'complete';
|
||||
session.previewFilePath = exportCached;
|
||||
session.previewProgress = 1.0;
|
||||
session.previewStatus = 'complete';
|
||||
session.activeVideoPath = exportCached;
|
||||
// No upgrade toast — we're already at best quality
|
||||
triggerPostDownloadProcessing(exportCached);
|
||||
return;
|
||||
}
|
||||
|
||||
// --- Preview download (low-res, fast) ---
|
||||
const previewCached = await checkCachedDownload(session.title, 'preview').catch(() => null);
|
||||
if (previewCached) {
|
||||
@@ -305,20 +321,11 @@ export async function beginDownload() {
|
||||
}
|
||||
|
||||
// --- Export download (best quality, background) ---
|
||||
const exportCached = await checkCachedDownload(session.title, 'export').catch(() => null);
|
||||
if (exportCached) {
|
||||
session.exportFilePath = exportCached;
|
||||
session.exportProgress = 1.0;
|
||||
session.exportStatus = 'complete';
|
||||
if ((session.processingStep as ProcessingStep) === 'done') {
|
||||
session.showUpgradeToast = true;
|
||||
}
|
||||
} else {
|
||||
// Only start if not already cached (we handled cached case above with early return)
|
||||
session.exportStatus = 'downloading';
|
||||
session.exportProgress = 0;
|
||||
session.exportFilePath = null;
|
||||
|
||||
// Fire-and-forget — runs in background
|
||||
runDownload(
|
||||
session.url,
|
||||
EXPORT_FORMAT,
|
||||
@@ -345,5 +352,4 @@ export async function beginDownload() {
|
||||
session.exportStatus = 'failed';
|
||||
console.error('Export download failed:', e);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user