From b74c507e2e02b6e951b40809ecd2b6832c532b61 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 17 Feb 2026 21:01:34 +0800 Subject: [PATCH] =?UTF-8?q?fix(video-history):=20=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E6=88=96=E4=B8=AD=E6=96=AD=E4=BB=BB=E5=8A=A1=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E7=A7=BB=E9=99=A4=E5=8E=86=E5=8F=B2=E5=8D=A1=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/static/public/js/video.js | 39 +++++++++++++++++++++++++++++- app/static/public/pages/video.html | 2 +- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/app/static/public/js/video.js b/app/static/public/js/video.js index d1e1a69..d211dff 100644 --- a/app/static/public/js/video.js +++ b/app/static/public/js/video.js @@ -134,6 +134,32 @@ historyCount.textContent = String(count); } + function removePreviewItem(item) { + if (!item || !videoStage) return; + const idx = String(item.dataset.index || ''); + const url = String(item.dataset.url || '').trim(); + if (selectedVideoItemId && selectedVideoItemId === idx) { + selectedVideoItemId = ''; + selectedVideoUrl = ''; + if (enterEditBtn) enterEditBtn.disabled = true; + closeEditPanel(); + } + if (mergeTargetVideoUrl && url && mergeTargetVideoUrl === url) { + mergeTargetVideoUrl = ''; + mergeTargetVideoName = ''; + } + item.remove(); + const hasAny = videoStage.querySelector('.video-item'); + if (!hasAny) { + videoStage.classList.add('hidden'); + if (videoEmpty) videoEmpty.classList.remove('hidden'); + } + updateHistoryCount(); + refreshVideoSelectionUi(); + updateMergeLabels(); + updateManualActionsVisibility(); + } + function updateMergeLabels() { if (mergeVideoA) { mergeVideoA.textContent = selectedVideoUrl ? shortHash(selectedVideoUrl) : '-'; @@ -1356,11 +1382,16 @@ if (!taskState || taskState.done) { return; } + const previewItem = taskState.previewItem || null; + const hasVideoUrl = Boolean(previewItem && String(previewItem.dataset.url || '').trim()); taskState.done = true; - if (!hasError) { + if (!hasError && hasVideoUrl) { taskState.progress = 100; } else { hasRunError = true; + if (previewItem) { + removePreviewItem(previewItem); + } } if (taskState.source) { try { @@ -1506,6 +1537,12 @@ if (authHeader !== null) { await stopVideoTask(activeTaskIds, authHeader); } + taskStates.forEach((taskState) => { + if (!taskState || taskState.done) return; + if (taskState.previewItem) { + removePreviewItem(taskState.previewItem); + } + }); closeAllSources(); isRunning = false; taskStates = new Map(); diff --git a/app/static/public/pages/video.html b/app/static/public/pages/video.html index 9359aa9..25c6eb8 100644 --- a/app/static/public/pages/video.html +++ b/app/static/public/pages/video.html @@ -307,7 +307,7 @@ - +