Fix settings loading and use 2-column card layout.
Merge Flask GET/POST routes, refresh prefs on tab revisit after preload, and reorganize system settings into separate cards. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -65,21 +65,18 @@ def register_instance_settings_routes(
|
||||
example_path = os.path.join(base_dir, ".env.example")
|
||||
api_auth = _api_login_required()
|
||||
|
||||
@app.route("/api/settings/display", methods=["GET"])
|
||||
@app.route("/api/settings/display", methods=["GET", "POST"])
|
||||
@api_auth
|
||||
def api_get_display_prefs():
|
||||
prefs = get_display_prefs(get_db)
|
||||
return jsonify(
|
||||
{
|
||||
"ok": True,
|
||||
"display": prefs,
|
||||
"meta": display_meta_for_ui(),
|
||||
}
|
||||
)
|
||||
|
||||
@app.route("/api/settings/display", methods=["POST"])
|
||||
@api_auth
|
||||
def api_save_display_prefs():
|
||||
def api_settings_display():
|
||||
if request.method == "GET":
|
||||
prefs = get_display_prefs(get_db)
|
||||
return jsonify(
|
||||
{
|
||||
"ok": True,
|
||||
"display": prefs,
|
||||
"meta": display_meta_for_ui(),
|
||||
}
|
||||
)
|
||||
body = request.get_json(silent=True) or {}
|
||||
raw = body.get("display") if isinstance(body.get("display"), dict) else body
|
||||
saved = save_display_prefs(get_db, raw)
|
||||
@@ -91,15 +88,12 @@ def register_instance_settings_routes(
|
||||
payload = build_env_payload(example_path, env_path)
|
||||
return jsonify({"ok": True, **payload})
|
||||
|
||||
@app.route("/api/settings/env", methods=["GET"])
|
||||
@app.route("/api/settings/env", methods=["GET", "POST"])
|
||||
@api_auth
|
||||
def api_env_get():
|
||||
payload = build_env_payload(example_path, env_path)
|
||||
return jsonify({"ok": True, **payload})
|
||||
|
||||
@app.route("/api/settings/env", methods=["POST"])
|
||||
@api_auth
|
||||
def api_env_post():
|
||||
def api_settings_env():
|
||||
if request.method == "GET":
|
||||
payload = build_env_payload(example_path, env_path)
|
||||
return jsonify({"ok": True, **payload})
|
||||
body = request.get_json(silent=True) or {}
|
||||
updates = body.get("values") if isinstance(body.get("values"), dict) else body
|
||||
if not isinstance(updates, dict):
|
||||
|
||||
Reference in New Issue
Block a user