From cfe2ab7decf0aa3226a83ff1a1cc265fceb47c8b Mon Sep 17 00:00:00 2001 From: Broque Thomas <26755000+Nezreka@users.noreply.github.com> Date: Tue, 31 Mar 2026 13:03:37 -0700 Subject: [PATCH] Add toggle to disable auto-clearing slskd search history MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Users who keep manual searches in slskd as reminders were losing them when SoulSync auto-cleaned at 200+ entries. New toggle in Settings → Downloads → Soulseek: "Auto-clear slskd search history" (on by default, preserving current behavior). When disabled, both the hourly cleanup automation and the full cleanup step skip the search history maintenance. --- web_server.py | 23 ++++++++++++++++------- webui/index.html | 8 ++++++++ webui/static/script.js | 4 +++- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/web_server.py b/web_server.py index 42bd09da..444746ef 100644 --- a/web_server.py +++ b/web_server.py @@ -1316,6 +1316,10 @@ def _register_automation_handlers(): def _auto_clean_search_history(config): """Remove old searches from Soulseek.""" automation_id = config.get('_automation_id') + if not config_manager.get('soulseek.auto_clear_searches', True): + _update_automation_progress(automation_id, + log_line='Auto-clear disabled in settings', log_type='skip') + return {'status': 'skipped'} try: success = run_async(soulseek_client.maintain_search_history_with_buffer( keep_searches=50, trigger_threshold=200 @@ -1458,15 +1462,20 @@ def _register_automation_handlers(): _update_automation_progress(automation_id, log_line=f'Staging: removed {s_removed} empty directories', log_type='success' if s_removed else 'info') - # --- 5. Clean search history --- + # --- 5. Clean search history (if enabled) --- _update_automation_progress(automation_id, phase='Cleaning search history...', progress=80) try: - run_async(soulseek_client.maintain_search_history_with_buffer( - keep_searches=50, trigger_threshold=200 - )) - steps.append('Search history: cleaned') - _update_automation_progress(automation_id, - log_line='Search history: cleaned', log_type='success') + if not config_manager.get('soulseek.auto_clear_searches', True): + steps.append('Search cleanup: disabled in settings') + _update_automation_progress(automation_id, + log_line='Search cleanup: disabled in settings', log_type='skip') + else: + run_async(soulseek_client.maintain_search_history_with_buffer( + keep_searches=50, trigger_threshold=200 + )) + steps.append('Search history: cleaned') + _update_automation_progress(automation_id, + log_line='Search history: cleaned', log_type='success') except Exception as e: steps.append(f'Search history: error ({e})') _update_automation_progress(automation_id, diff --git a/webui/index.html b/webui/index.html index 8ba8c0ae..076d64d7 100644 --- a/webui/index.html +++ b/webui/index.html @@ -4218,6 +4218,14 @@ max="60" value="10"> Abandon stuck downloads after this many minutes +
+ + Automatically cleans old searches from slskd when over 200 entries. + Disable if you want to keep manual searches in slskd's queue. +
diff --git a/webui/static/script.js b/webui/static/script.js index 1e8fbd49..c32382c7 100644 --- a/webui/static/script.js +++ b/webui/static/script.js @@ -5710,6 +5710,7 @@ async function loadSettingsData() { document.getElementById('soulseek-min-peer-speed').value = settings.soulseek?.min_peer_upload_speed || 0; document.getElementById('soulseek-max-peer-queue').value = settings.soulseek?.max_peer_queue || 0; document.getElementById('soulseek-download-timeout').value = Math.round((settings.soulseek?.download_timeout || 600) / 60); + document.getElementById('soulseek-auto-clear-searches').checked = settings.soulseek?.auto_clear_searches !== false; // Populate ListenBrainz settings document.getElementById('listenbrainz-base-url').value = settings.listenbrainz?.base_url || ''; @@ -6764,7 +6765,8 @@ async function saveSettings(quiet = false) { search_timeout_buffer: parseInt(document.getElementById('soulseek-search-timeout-buffer').value) || 15, min_peer_upload_speed: parseInt(document.getElementById('soulseek-min-peer-speed').value) || 0, max_peer_queue: parseInt(document.getElementById('soulseek-max-peer-queue').value) || 0, - download_timeout: (parseInt(document.getElementById('soulseek-download-timeout').value) || 10) * 60 + download_timeout: (parseInt(document.getElementById('soulseek-download-timeout').value) || 10) * 60, + auto_clear_searches: document.getElementById('soulseek-auto-clear-searches').checked }, listenbrainz: { base_url: document.getElementById('listenbrainz-base-url').value,