From eff22f55d756dd4870cff36be3cdb34f07443541 Mon Sep 17 00:00:00 2001
From: Broque Thomas <26755000+Nezreka@users.noreply.github.com>
Date: Sat, 11 Apr 2026 23:03:51 -0700
Subject: [PATCH] Wire up automatic first-run detection for setup wizard
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Wizard now shows automatically on fresh installs. Detection uses a
server-side flag (setup.completed) plus download_source.mode as a
fallback for existing users who configured settings before the wizard
existed. Config.json template defaults no longer fool the check.
Script load order fixed — setup-wizard.js loads before script.js so
openSetupWizard exists when DOMContentLoaded fires. Both finish and
skip paths set the server flag and localStorage, then continue app
initialization via callback.
---
web_server.py | 20 ++++++++++--------
webui/index.html | 2 +-
webui/static/script.js | 32 ++++++++++++++++++++++++++++-
webui/static/setup-wizard.js | 40 ++++++++++++++++++++++++------------
4 files changed, 71 insertions(+), 23 deletions(-)
diff --git a/web_server.py b/web_server.py
index c3d67a2c..62071db0 100644
--- a/web_server.py
+++ b/web_server.py
@@ -6125,18 +6125,22 @@ def get_mirrored_playlists_list():
@app.route('/api/setup/status', methods=['GET'])
def setup_status_endpoint():
"""Check if first-run setup has been completed."""
- # Consider setup incomplete if no slskd URL and no download source configured
- slskd_url = config_manager.get('soulseek.slskd_url', '')
+ # The setup wizard sets this flag when completed. download_source.mode is only
+ # set by user action (wizard or settings page), never by config.json defaults.
+ setup_done = config_manager.get('setup.completed', False)
download_mode = config_manager.get('download_source.mode', '')
- transfer_path = config_manager.get('soulseek.transfer_path', '')
- has_any_config = bool(slskd_url) or bool(download_mode) or bool(transfer_path)
+ # Either the explicit flag or a user-configured download source means setup is done
+ has_user_config = bool(setup_done) or bool(download_mode)
return jsonify({
- "setup_complete": has_any_config,
- "has_download_source": bool(download_mode),
- "has_slskd": bool(slskd_url),
- "has_transfer_path": bool(transfer_path),
+ "setup_complete": has_user_config,
})
+@app.route('/api/setup/complete', methods=['POST'])
+def setup_complete_endpoint():
+ """Mark first-run setup as completed."""
+ config_manager.set('setup.completed', True)
+ return jsonify({"success": True})
+
@app.route('/api/test-connection', methods=['POST'])
def test_connection_endpoint():
data = request.get_json()
diff --git a/webui/index.html b/webui/index.html
index d77e8e94..e8550438 100644
--- a/webui/index.html
+++ b/webui/index.html
@@ -7351,6 +7351,7 @@
+
@@ -7376,7 +7377,6 @@
-