From 21426af7fe6aa5e2bd743c2458474acf637e7653 Mon Sep 17 00:00:00 2001 From: BoulderBadgeDad Date: Fri, 29 May 2026 10:47:02 -0700 Subject: [PATCH] Tools: add Deep Scan option to the Database Updater MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Tools-page Database Updater dropdown only offered Incremental and Full Refresh, even though the backend (/api/database/update with deep_scan) and the dashboard Deep Scan button already supported a deep scan. Wire the missing option into the Tools UI: - Add a "Deep Scan" option to the #db-refresh-type dropdown. - handleDbUpdateButtonClick now sends { deep_scan: true } for that option (deep scan takes precedence server-side) and confirms first, since deep scan removes stale entries — mirroring the dashboard flow. Frontend-only; the progress/status handler already drives the bar from the backend phase ("Deep scan: ...") and the help/docs copy already described all three modes. --- webui/index.html | 1 + webui/static/sync-services.js | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/webui/index.html b/webui/index.html index 4388ffda..b37d6349 100644 --- a/webui/index.html +++ b/webui/index.html @@ -6447,6 +6447,7 @@ diff --git a/webui/static/sync-services.js b/webui/static/sync-services.js index 63f18be3..0490076f 100644 --- a/webui/static/sync-services.js +++ b/webui/static/sync-services.js @@ -4022,12 +4022,18 @@ async function handleDbUpdateButtonClick() { if (currentAction === 'Update Database') { const refreshSelect = document.getElementById('db-refresh-type'); - const isFullRefresh = refreshSelect.value === 'full'; + const refreshType = refreshSelect.value; + const isFullRefresh = refreshType === 'full'; + const isDeepScan = refreshType === 'deep'; if (isFullRefresh) { // Replicates the QMessageBox confirmation from the GUI const confirmed = await showConfirmDialog({ title: 'Full Refresh', message: 'This will clear and rebuild the database for the active server. It can take a long time.\n\nAre you sure you want to proceed?', confirmText: 'Proceed' }); if (!confirmed) return; + } else if (isDeepScan) { + // Deep scan removes stale entries — confirm like the dashboard deep scan does. + const confirmed = await showConfirmDialog({ title: 'Deep Scan', message: 'A deep scan re-checks every track in your media server library against the database.\n\n• Adds any new tracks that were missed\n• Removes tracks no longer on your server\n• Preserves all existing metadata and enrichment data\n\nThis may take a while for large libraries. Proceed?', confirmText: 'Proceed' }); + if (!confirmed) return; } try { @@ -4036,7 +4042,9 @@ async function handleDbUpdateButtonClick() { const response = await fetch('/api/database/update', { method: 'POST', headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ full_refresh: isFullRefresh }) + // Deep scan and full refresh use distinct backend flags; deep + // scan takes precedence server-side, so send only its flag. + body: JSON.stringify(isDeepScan ? { deep_scan: true } : { full_refresh: isFullRefresh }) }); if (response.ok) {