Add settings page tabs and show env API keys with last four digits.
System settings now use the same CSS tab layout as env config; sensitive env fields display masked values from .env while keeping save-on-empty behavior. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -183,11 +183,30 @@ def build_instance_settings_view(
|
||||
}
|
||||
|
||||
|
||||
def build_settings_tabs(display: dict[str, Any] | None, instance_settings: dict[str, Any]) -> list[dict[str, str]]:
|
||||
disp = display or {}
|
||||
inst = instance_settings or {}
|
||||
tabs: list[dict[str, str]] = [{"key": "nav", "title": "导航显示"}]
|
||||
if disp.get("show_settings_password", True):
|
||||
tabs.append({"key": "password", "title": "账户密码"})
|
||||
if inst.get("show_transfer") and disp.get("show_settings_transfer", True):
|
||||
tabs.append({"key": "transfer", "title": "永续划转"})
|
||||
if disp.get("show_settings_export", True):
|
||||
tabs.append({"key": "export", "title": "数据导出"})
|
||||
if inst.get("options_settings_enabled") and disp.get("show_settings_options_swap", True):
|
||||
tabs.append({"key": "options_swap", "title": "币种兑换"})
|
||||
if inst.get("options_settings_enabled") and disp.get("show_settings_options_transfer", True):
|
||||
tabs.append({"key": "options_transfer", "title": "期权划转"})
|
||||
return tabs
|
||||
|
||||
|
||||
def settings_page_context(page: str, *, instance_base_dir: str | None = None, **kwargs: Any) -> dict[str, Any]:
|
||||
p = (page or "").strip()
|
||||
if p not in ("settings", "risk_policy", "env_config"):
|
||||
return {}
|
||||
ctx: dict[str, Any] = {"instance_settings": build_instance_settings_view(**kwargs)}
|
||||
if p == "settings":
|
||||
ctx["settings_tabs"] = build_settings_tabs(kwargs.get("display"), ctx["instance_settings"])
|
||||
if p == "env_config" and instance_base_dir:
|
||||
from lib.env.env_ui_manifest import build_env_ui_payload
|
||||
|
||||
|
||||
Reference in New Issue
Block a user